Преглед изворни кода

Add a new firebase messaging test app using swiftui (#5301)

Chen Liang пре 6 година
родитељ
комит
ed52d0d8f6
24 измењених фајлова са 888 додато и 191 уклоњено
  1. 11 1
      .github/workflows/messaging.yml
  2. 0 17
      Example/Messaging/Messaging_Example-Bridging-Header.h
  3. 0 28
      Example/Messaging/Sample/GoogleService-Info.plist
  4. 18 0
      Example/Messaging/Sample/Podfile
  5. 18 0
      Example/Messaging/Sample/README.md
  6. 384 0
      Example/Messaging/Sample/Sample.xcodeproj/project.pbxproj
  7. 47 0
      Example/Messaging/Sample/Sample/AppDelegate.swift
  8. 98 0
      Example/Messaging/Sample/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json
  9. 6 0
      Example/Messaging/Sample/Sample/Assets.xcassets/Contents.json
  10. 35 0
      Example/Messaging/Sample/Sample/Base.lproj/LaunchScreen.storyboard
  11. 148 0
      Example/Messaging/Sample/Sample/ContentView.swift
  12. 22 0
      Example/Messaging/Sample/Sample/Identity.swift
  13. 22 17
      Example/Messaging/Sample/Sample/Info.plist
  14. 6 0
      Example/Messaging/Sample/Sample/Preview Content/Preview Assets.xcassets/Contents.json
  15. 0 0
      Example/Messaging/Sample/Sample/Sample.entitlements
  16. 8 0
      Example/Messaging/Sample/Sample/Sample.xcdatamodeld/.xccurrentversion
  17. 4 0
      Example/Messaging/Sample/Sample/Sample.xcdatamodeld/Sample.xcdatamodel/contents
  18. 46 0
      Example/Messaging/Sample/Sample/SceneDelegate.swift
  19. 0 27
      Example/Messaging/Sample/iOS/Base.lproj/LaunchScreen.storyboard
  20. 0 48
      Example/Messaging/Sample/iOS/Base.lproj/Main.storyboard
  21. 0 25
      Example/Messaging/Sample/iOS/Data+MessagingExtensions.swift
  22. 0 27
      Example/Messaging/Sample/iOS/Environment.swift
  23. 9 0
      scripts/build.sh
  24. 6 1
      scripts/install_prereqs.sh

+ 11 - 1
.github/workflows/messaging.yml

@@ -4,6 +4,7 @@ on:
   pull_request:
     paths:
     - 'Firebase/Messaging/**'
+    - 'Examples/Messaging/Sample/**'
 
     #Podspec
     - 'FirebaseMessaging.podspec'
@@ -101,4 +102,13 @@ jobs:
     - name: PodLibLint Messaging Cron
       run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseMessaging.podspec --platforms=watchos
 
-
+  messaging-sample-build-test:
+    runs-on: macos-latest
+    steps:
+    - uses: actions/checkout@v2
+    - name: Setup Bundler
+      run: scripts/setup_bundler.sh
+    - name: Prereqs
+      run: scripts/install_prereqs.sh MessagingSample iOS
+    - name: Build
+      run: scripts/build.sh MessagingSample iOS

+ 0 - 17
Example/Messaging/Messaging_Example-Bridging-Header.h

@@ -1,17 +0,0 @@
-/*
- * Copyright 2017 Google
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#import "FIRSampleAppUtilities.h"

+ 0 - 28
Example/Messaging/Sample/GoogleService-Info.plist

@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>API_KEY</key>
-	<string>correct_api_key</string>
-	<key>TRACKING_ID</key>
-	<string>correct_tracking_id</string>
-	<key>CLIENT_ID</key>
-	<string>correct_client_id</string>
-	<key>REVERSED_CLIENT_ID</key>
-	<string>correct_reversed_client_id</string>
-	<key>GOOGLE_APP_ID</key>
-	<string>1:123:ios:123abc</string>
-	<key>GCM_SENDER_ID</key>
-	<string>correct_gcm_sender_id</string>
-	<key>PLIST_VERSION</key>
-	<string>1</string>
-	<key>BUNDLE_ID</key>
-	<string>com.google.FirebaseSDKTests</string>
-	<key>PROJECT_ID</key>
-	<string>abc-xyz-123</string>
-	<key>DATABASE_URL</key>
-	<string>https://abc-xyz-123.firebaseio.com</string>
-	<key>STORAGE_BUCKET</key>
-	<string>project-id-123.storage.firebase.com</string>
-</dict>
-</plist>

+ 18 - 0
Example/Messaging/Sample/Podfile

@@ -0,0 +1,18 @@
+use_frameworks!
+
+target 'Sample' do
+  platform :ios, '13.0'
+
+  pod 'FirebaseAnalyticsInterop', :path => '../../../'
+  pod 'FirebaseAuthInterop', :path => '../../../'
+  pod 'FirebaseCore', :path => '../../../'
+  pod 'GoogleUtilities', :path => '../../../'
+  pod 'FirebaseMessaging', :path => '../../../'
+  pod 'FirebaseInstanceID', :path => '../../../'
+  pod 'FirebaseCoreDiagnostics', :path => '../../../'
+  pod 'FirebaseCoreDiagnosticsInterop', :path => '../../../'
+  pod 'GoogleDataTransport', :path => '../../../'
+  pod 'GoogleDataTransportCCTSupport', :path => '../../../'
+  pod 'FirebaseInstallations', :path => '../../../'
+
+end

+ 18 - 0
Example/Messaging/Sample/README.md

@@ -0,0 +1,18 @@
+### Messaging App Setup
+
+To run this app, you'll need the following steps.
+
+#### GoogleService-Info.plist file
+
+1. Go to the [Firebase Console](https://console.firebase.google.com/)
+2. Create a Firebase project if you don't have one already.
+3. Create a new iOS App if you don't have one already.
+4. Go to Project Overview -> General -> Your apps, select your iOS app and download the GoogleSerive-Info.plist file.
+
+
+#### Push notification provisioning profile
+
+If you need to test push notifications sent from FCM console or Sender API, you will need to run this test app on real device. In order to do so, you will need a provisioning profile enabled with push notifications.
+
+Following the [steps](https://firebase.google.com/docs/cloud-messaging/ios/certs) here to setup the properly APNs configuration to work with Firebase Messaging.
+

+ 384 - 0
Example/Messaging/Sample/Sample.xcodeproj/project.pbxproj

@@ -0,0 +1,384 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 51;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		5125CC9D2437F471006CA5D0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5125CC9C2437F471006CA5D0 /* AppDelegate.swift */; };
+		5125CC9F2437F471006CA5D0 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5125CC9E2437F471006CA5D0 /* SceneDelegate.swift */; };
+		5125CCA22437F471006CA5D0 /* Sample.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 5125CCA02437F471006CA5D0 /* Sample.xcdatamodeld */; };
+		5125CCA42437F471006CA5D0 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5125CCA32437F471006CA5D0 /* ContentView.swift */; };
+		5125CCA62437F472006CA5D0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5125CCA52437F472006CA5D0 /* Assets.xcassets */; };
+		5125CCA92437F472006CA5D0 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5125CCA82437F472006CA5D0 /* Preview Assets.xcassets */; };
+		5125CCAC2437F472006CA5D0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5125CCAA2437F472006CA5D0 /* LaunchScreen.storyboard */; };
+		513771F2243BE5DE004503C3 /* Identity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 513771F1243BE5DE004503C3 /* Identity.swift */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+		5125CC992437F471006CA5D0 /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; };
+		5125CC9C2437F471006CA5D0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
+		5125CC9E2437F471006CA5D0 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
+		5125CCA12437F471006CA5D0 /* Sample.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Sample.xcdatamodel; sourceTree = "<group>"; };
+		5125CCA32437F471006CA5D0 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
+		5125CCA52437F472006CA5D0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+		5125CCA82437F472006CA5D0 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
+		5125CCAB2437F472006CA5D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
+		5125CCAD2437F472006CA5D0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+		5125CCB32437F9A9006CA5D0 /* Sample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Sample.entitlements; sourceTree = "<group>"; };
+		513771F1243BE5DE004503C3 /* Identity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Identity.swift; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		5125CC962437F471006CA5D0 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		06211DE6118DB67F2425BF9B /* Pods */ = {
+			isa = PBXGroup;
+			children = (
+			);
+			path = Pods;
+			sourceTree = "<group>";
+		};
+		5125CC902437F471006CA5D0 = {
+			isa = PBXGroup;
+			children = (
+				5125CC9B2437F471006CA5D0 /* Sample */,
+				5125CC9A2437F471006CA5D0 /* Products */,
+				06211DE6118DB67F2425BF9B /* Pods */,
+			);
+			sourceTree = "<group>";
+		};
+		5125CC9A2437F471006CA5D0 /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				5125CC992437F471006CA5D0 /* Sample.app */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		5125CC9B2437F471006CA5D0 /* Sample */ = {
+			isa = PBXGroup;
+			children = (
+				5125CCB32437F9A9006CA5D0 /* Sample.entitlements */,
+				5125CC9C2437F471006CA5D0 /* AppDelegate.swift */,
+				5125CC9E2437F471006CA5D0 /* SceneDelegate.swift */,
+				5125CCA32437F471006CA5D0 /* ContentView.swift */,
+				5125CCA52437F472006CA5D0 /* Assets.xcassets */,
+				5125CCAA2437F472006CA5D0 /* LaunchScreen.storyboard */,
+				5125CCAD2437F472006CA5D0 /* Info.plist */,
+				5125CCA02437F471006CA5D0 /* Sample.xcdatamodeld */,
+				5125CCA72437F472006CA5D0 /* Preview Content */,
+				513771F1243BE5DE004503C3 /* Identity.swift */,
+			);
+			path = Sample;
+			sourceTree = "<group>";
+		};
+		5125CCA72437F472006CA5D0 /* Preview Content */ = {
+			isa = PBXGroup;
+			children = (
+				5125CCA82437F472006CA5D0 /* Preview Assets.xcassets */,
+			);
+			path = "Preview Content";
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		5125CC982437F471006CA5D0 /* Sample */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 5125CCB02437F472006CA5D0 /* Build configuration list for PBXNativeTarget "Sample" */;
+			buildPhases = (
+				5125CC952437F471006CA5D0 /* Sources */,
+				5125CC962437F471006CA5D0 /* Frameworks */,
+				5125CC972437F471006CA5D0 /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = Sample;
+			productName = Sample;
+			productReference = 5125CC992437F471006CA5D0 /* Sample.app */;
+			productType = "com.apple.product-type.application";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		5125CC912437F471006CA5D0 /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastSwiftUpdateCheck = 1120;
+				LastUpgradeCheck = 1120;
+				ORGANIZATIONNAME = "Google, Inc";
+				TargetAttributes = {
+					5125CC982437F471006CA5D0 = {
+						CreatedOnToolsVersion = 11.2.1;
+					};
+				};
+			};
+			buildConfigurationList = 5125CC942437F471006CA5D0 /* Build configuration list for PBXProject "Sample" */;
+			compatibilityVersion = "Xcode 9.3";
+			developmentRegion = en;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+				Base,
+			);
+			mainGroup = 5125CC902437F471006CA5D0;
+			productRefGroup = 5125CC9A2437F471006CA5D0 /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				5125CC982437F471006CA5D0 /* Sample */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+		5125CC972437F471006CA5D0 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				5125CCAC2437F472006CA5D0 /* LaunchScreen.storyboard in Resources */,
+				5125CCA92437F472006CA5D0 /* Preview Assets.xcassets in Resources */,
+				5125CCA62437F472006CA5D0 /* Assets.xcassets in Resources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		5125CC952437F471006CA5D0 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				5125CCA22437F471006CA5D0 /* Sample.xcdatamodeld in Sources */,
+				5125CC9D2437F471006CA5D0 /* AppDelegate.swift in Sources */,
+				513771F2243BE5DE004503C3 /* Identity.swift in Sources */,
+				5125CCA42437F471006CA5D0 /* ContentView.swift in Sources */,
+				5125CC9F2437F471006CA5D0 /* SceneDelegate.swift in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+		5125CCAA2437F472006CA5D0 /* LaunchScreen.storyboard */ = {
+			isa = PBXVariantGroup;
+			children = (
+				5125CCAB2437F472006CA5D0 /* Base */,
+			);
+			name = LaunchScreen.storyboard;
+			sourceTree = "<group>";
+		};
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+		5125CCAE2437F472006CA5D0 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ANALYZER_NONNULL = YES;
+				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_ENABLE_OBJC_WEAK = YES;
+				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_COMMA = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INFINITE_RECURSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+				CLANG_WARN_STRICT_PROTOTYPES = YES;
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
+				CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COPY_PHASE_STRIP = NO;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				ENABLE_TESTABILITY = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu11;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_NO_COMMON_BLOCKS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"DEBUG=1",
+					"$(inherited)",
+				);
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				IPHONEOS_DEPLOYMENT_TARGET = 13.2;
+				MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
+				MTL_FAST_MATH = YES;
+				ONLY_ACTIVE_ARCH = YES;
+				SDKROOT = iphoneos;
+				SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
+				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+			};
+			name = Debug;
+		};
+		5125CCAF2437F472006CA5D0 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_ANALYZER_NONNULL = YES;
+				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_ENABLE_OBJC_WEAK = YES;
+				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_COMMA = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INFINITE_RECURSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+				CLANG_WARN_STRICT_PROTOTYPES = YES;
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
+				CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COPY_PHASE_STRIP = NO;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				ENABLE_NS_ASSERTIONS = NO;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu11;
+				GCC_NO_COMMON_BLOCKS = YES;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				IPHONEOS_DEPLOYMENT_TARGET = 13.2;
+				MTL_ENABLE_DEBUG_INFO = NO;
+				MTL_FAST_MATH = YES;
+				SDKROOT = iphoneos;
+				SWIFT_COMPILATION_MODE = wholemodule;
+				SWIFT_OPTIMIZATION_LEVEL = "-O";
+				VALIDATE_PRODUCT = YES;
+			};
+			name = Release;
+		};
+		5125CCB12437F472006CA5D0 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CODE_SIGN_ENTITLEMENTS = Sample/Sample.entitlements;
+				CODE_SIGN_IDENTITY = "iPhone Developer";
+				CODE_SIGN_STYLE = Manual;
+				DEVELOPMENT_ASSET_PATHS = "\"Sample/Preview Content\"";
+				DEVELOPMENT_TEAM = EQHXZ8M8AV;
+				ENABLE_PREVIEWS = YES;
+				INFOPLIST_FILE = Sample/Info.plist;
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+				);
+				PRODUCT_BUNDLE_IDENTIFIER = com.google.firebase.extensions.dev;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				PROVISIONING_PROFILE_SPECIFIER = "Firebase iOS App Extensions Dev";
+				SWIFT_VERSION = 5.0;
+				TARGETED_DEVICE_FAMILY = "1,2";
+			};
+			name = Debug;
+		};
+		5125CCB22437F472006CA5D0 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CODE_SIGN_ENTITLEMENTS = Sample/Sample.entitlements;
+				CODE_SIGN_IDENTITY = "iPhone Developer";
+				CODE_SIGN_STYLE = Manual;
+				DEVELOPMENT_ASSET_PATHS = "\"Sample/Preview Content\"";
+				DEVELOPMENT_TEAM = EQHXZ8M8AV;
+				ENABLE_PREVIEWS = YES;
+				INFOPLIST_FILE = Sample/Info.plist;
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+				);
+				PRODUCT_BUNDLE_IDENTIFIER = com.google.firebase.extensions.dev;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				PROVISIONING_PROFILE_SPECIFIER = "Firebase iOS App Extensions Dev";
+				SWIFT_VERSION = 5.0;
+				TARGETED_DEVICE_FAMILY = "1,2";
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		5125CC942437F471006CA5D0 /* Build configuration list for PBXProject "Sample" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				5125CCAE2437F472006CA5D0 /* Debug */,
+				5125CCAF2437F472006CA5D0 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		5125CCB02437F472006CA5D0 /* Build configuration list for PBXNativeTarget "Sample" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				5125CCB12437F472006CA5D0 /* Debug */,
+				5125CCB22437F472006CA5D0 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+
+/* Begin XCVersionGroup section */
+		5125CCA02437F471006CA5D0 /* Sample.xcdatamodeld */ = {
+			isa = XCVersionGroup;
+			children = (
+				5125CCA12437F471006CA5D0 /* Sample.xcdatamodel */,
+			);
+			currentVersion = 5125CCA12437F471006CA5D0 /* Sample.xcdatamodel */;
+			path = Sample.xcdatamodeld;
+			sourceTree = "<group>";
+			versionGroupType = wrapper.xcdatamodel;
+		};
+/* End XCVersionGroup section */
+	};
+	rootObject = 5125CC912437F471006CA5D0 /* Project object */;
+}

+ 47 - 0
Example/Messaging/Sample/Sample/AppDelegate.swift

@@ -0,0 +1,47 @@
+// Copyright 2020 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import UIKit
+import CoreData
+import FirebaseCore
+import FirebaseMessaging
+
+@UIApplicationMain
+class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
+  func application(_ application: UIApplication,
+                   didFinishLaunchingWithOptions launchOptions: [UIApplication
+                     .LaunchOptionsKey: Any]?) -> Bool {
+    FirebaseApp.configure()
+
+    let center = UNUserNotificationCenter.current()
+    center.requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in
+      if error != nil {
+        print("Failed requesting notification permission: ", error ?? "")
+      }
+    }
+    application.registerForRemoteNotifications()
+    return true
+  }
+
+  // MARK: UISceneSession Lifecycle
+
+  func application(_ application: UIApplication,
+                   configurationForConnecting connectingSceneSession: UISceneSession,
+                   options: UIScene.ConnectionOptions) -> UISceneConfiguration {
+    // Called when a new scene session is being created.
+    // Use this method to select a configuration to create the new scene with.
+    return UISceneConfiguration(name: "Default Configuration",
+                                sessionRole: connectingSceneSession.role)
+  }
+}

+ 98 - 0
Example/Messaging/Sample/Sample/Assets.xcassets/AppIcon.appiconset/Contents.json

@@ -0,0 +1,98 @@
+{
+  "images" : [
+    {
+      "idiom" : "iphone",
+      "size" : "20x20",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "iphone",
+      "size" : "20x20",
+      "scale" : "3x"
+    },
+    {
+      "idiom" : "iphone",
+      "size" : "29x29",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "iphone",
+      "size" : "29x29",
+      "scale" : "3x"
+    },
+    {
+      "idiom" : "iphone",
+      "size" : "40x40",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "iphone",
+      "size" : "40x40",
+      "scale" : "3x"
+    },
+    {
+      "idiom" : "iphone",
+      "size" : "60x60",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "iphone",
+      "size" : "60x60",
+      "scale" : "3x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "20x20",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "20x20",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "29x29",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "29x29",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "40x40",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "40x40",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "76x76",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "76x76",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "ipad",
+      "size" : "83.5x83.5",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "ios-marketing",
+      "size" : "1024x1024",
+      "scale" : "1x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

+ 6 - 0
Example/Messaging/Sample/Sample/Assets.xcassets/Contents.json

@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

+ 35 - 0
Example/Messaging/Sample/Sample/Base.lproj/LaunchScreen.storyboard

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
+    <device id="retina6_1" orientation="portrait" appearance="light"/>
+    <dependencies>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15510"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <scenes>
+        <!--View Controller-->
+        <scene sceneID="EHf-IW-A2E">
+            <objects>
+                <viewController id="01J-lp-oVM" sceneMemberID="viewController">
+                    <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="📱FCM 🔔" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Eq5-E8-pqf">
+                                <rect key="frame" x="10" y="212" width="396" height="78"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
+                                <fontDescription key="fontDescription" type="boldSystem" pointSize="28"/>
+                                <color key="textColor" systemColor="systemTealColor" red="0.35294117650000001" green="0.7843137255" blue="0.98039215690000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                <nil key="highlightedColor"/>
+                            </label>
+                        </subviews>
+                        <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
+                        <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
+                    </view>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="52.173913043478265" y="375"/>
+        </scene>
+    </scenes>
+</document>

+ 148 - 0
Example/Messaging/Sample/Sample/ContentView.swift

@@ -0,0 +1,148 @@
+// Copyright 2020 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import SwiftUI
+import FirebaseCore
+import FirebaseMessaging
+import FirebaseInstanceID
+import FirebaseInstallations
+
+struct ContentView: View {
+  @EnvironmentObject var identity: Identity
+
+  var body: some View {
+    NavigationView {
+      List {
+        Button(action: getToken) {
+          HStack {
+            Image(systemName: "arrow.clockwise.circle.fill").font(.body)
+            Text("Get ID and Token")
+              .fontWeight(.semibold)
+          }
+        }
+        .buttonStyle(IdentityButtonStyle())
+
+        Button(action: deleteToken) {
+          HStack {
+            Image(systemName: "trash.fill").font(.body)
+            Text("Delete Token")
+              .fontWeight(.semibold)
+          }
+        }
+        .buttonStyle(IdentityButtonStyle())
+
+        Button(action: deleteID) {
+          HStack {
+            Image(systemName: "trash.fill").font(.body)
+            Text("Delete ID")
+              .fontWeight(.semibold)
+          }
+        }
+        .buttonStyle(IdentityButtonStyle())
+
+        Button(action: deleteFID) {
+          HStack {
+            Image(systemName: "trash.fill").font(.body)
+            Text("Delete FID")
+              .fontWeight(.semibold)
+          }
+        }
+        .buttonStyle(IdentityButtonStyle())
+
+        Text("InstanceID: \(identity.instanceID)")
+          .foregroundColor(.blue)
+        Text("Token: \(identity.token)")
+          .foregroundColor(.blue)
+        NavigationLink(destination: DetailView()) {
+          Text("Show Detail View")
+        }
+      }
+    }
+  }
+
+  func getToken() {
+    InstanceID.instanceID().instanceID { result, error in
+      guard let result = result, error == nil else {
+        print("Failed getting iid and token: ", error ?? "")
+        return
+      }
+      self.identity.token = result.token
+      self.identity.instanceID = result.instanceID
+    }
+  }
+
+  func deleteToken() {
+    guard let app = FirebaseApp.app() else {
+      return
+    }
+    let senderID = app.options.gcmSenderID
+    Messaging.messaging().deleteFCMToken(forSenderID: senderID) { error in
+      if let error = error as NSError? {
+        print("Failed delete token: ", error)
+        return
+      }
+      self.identity.token = ""
+    }
+  }
+
+  func deleteID() {
+    InstanceID.instanceID().deleteID { error in
+      if let error = error as NSError? {
+        print("Failed delete ID: ", error)
+        return
+      }
+      self.identity.instanceID = ""
+      self.identity.token = ""
+    }
+  }
+
+  func deleteFID() {
+    Installations.installations().delete { error in
+      if let error = error as NSError? {
+        print("Failed delete FID: ", error)
+        return
+      }
+      self.identity.instanceID = ""
+    }
+  }
+}
+
+struct DetailView: View {
+  @EnvironmentObject var identity: Identity
+
+  var body: some View {
+    VStack {
+      Text("InstanceID: \(self.identity.instanceID)")
+      Text("Token: \(self.identity.token)")
+    }
+  }
+}
+
+struct ContentView_Previews: PreviewProvider {
+  static var previews: some View {
+    ContentView().environmentObject(Identity())
+  }
+}
+
+struct IdentityButtonStyle: ButtonStyle {
+  func makeBody(configuration: Self.Configuration) -> some View {
+    configuration.label
+      .frame(minWidth: 0, maxWidth: 200)
+      .padding()
+      .foregroundColor(.white)
+      .background(LinearGradient(gradient: Gradient(colors: [Color.blue, Color.pink]),
+                                 startPoint: .leading, endPoint: .trailing))
+      .cornerRadius(40)
+  }
+}

+ 22 - 0
Example/Messaging/Sample/Sample/Identity.swift

@@ -0,0 +1,22 @@
+// Copyright 2020 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import SwiftUI
+
+public final class Identity: ObservableObject {
+  // Identity that is unique per app.
+  @Published public var instanceID = ""
+  // The token that Firebase Messaging use to send notifications.
+  @Published public var token = ""
+}

+ 22 - 17
Example/Messaging/Sample/iOS/Messaging-Info.plist → Example/Messaging/Sample/Sample/Info.plist

@@ -3,37 +3,42 @@
 <plist version="1.0">
 <dict>
 	<key>CFBundleDevelopmentRegion</key>
-	<string>en</string>
-	<key>CFBundleDisplayName</key>
-	<string>${PRODUCT_NAME}</string>
+	<string>$(DEVELOPMENT_LANGUAGE)</string>
 	<key>CFBundleExecutable</key>
-	<string>${EXECUTABLE_NAME}</string>
+	<string>$(EXECUTABLE_NAME)</string>
 	<key>CFBundleIdentifier</key>
 	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
 	<key>CFBundleName</key>
-	<string>${PRODUCT_NAME}</string>
+	<string>$(PRODUCT_NAME)</string>
 	<key>CFBundlePackageType</key>
-	<string>APPL</string>
+	<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
 	<key>CFBundleShortVersionString</key>
 	<string>1.0</string>
-	<key>CFBundleSignature</key>
-	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>1.0</string>
-	<key>FirebaseMessagingAutoInitEnabled</key>
-	<false/>
+	<string>1</string>
 	<key>LSRequiresIPhoneOS</key>
 	<true/>
-	<key>UIBackgroundModes</key>
-	<array>
-		<string>remote-notification</string>
-	</array>
+	<key>UIApplicationSceneManifest</key>
+	<dict>
+		<key>UIApplicationSupportsMultipleScenes</key>
+		<false/>
+		<key>UISceneConfigurations</key>
+		<dict>
+			<key>UIWindowSceneSessionRoleApplication</key>
+			<array>
+				<dict>
+					<key>UISceneConfigurationName</key>
+					<string>Default Configuration</string>
+					<key>UISceneDelegateClassName</key>
+					<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
+				</dict>
+			</array>
+		</dict>
+	</dict>
 	<key>UILaunchStoryboardName</key>
 	<string>LaunchScreen</string>
-	<key>UIMainStoryboardFile</key>
-	<string>Main</string>
 	<key>UIRequiredDeviceCapabilities</key>
 	<array>
 		<string>armv7</string>

+ 6 - 0
Example/Messaging/Sample/Sample/Preview Content/Preview Assets.xcassets/Contents.json

@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

+ 0 - 0
Example/Messaging/Sample/iOS/Messaging_Example.entitlements → Example/Messaging/Sample/Sample/Sample.entitlements


+ 8 - 0
Example/Messaging/Sample/Sample/Sample.xcdatamodeld/.xccurrentversion

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>_XCCurrentVersionName</key>
+	<string>Sample.xcdatamodel</string>
+</dict>
+</plist>

+ 4 - 0
Example/Messaging/Sample/Sample/Sample.xcdatamodeld/Sample.xcdatamodel/contents

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="1" systemVersion="11A491" minimumToolsVersion="Automatic" sourceLanguage="Swift" usedWithCloudKit="false" userDefinedModelVersionIdentifier="">
+    <elements/>
+</model>

+ 46 - 0
Example/Messaging/Sample/Sample/SceneDelegate.swift

@@ -0,0 +1,46 @@
+// Copyright 2020 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import UIKit
+import SwiftUI
+import FirebaseInstanceID
+import FirebaseMessaging
+import FirebaseInstallations
+
+class SceneDelegate: UIResponder, UIWindowSceneDelegate, MessagingDelegate {
+  var window: UIWindow?
+  let identity = Identity()
+
+  func scene(_ scene: UIScene, willConnectTo session: UISceneSession,
+             options connectionOptions: UIScene.ConnectionOptions) {
+    let contentView = ContentView()
+    // Use a UIHostingController as window root view controller.
+    Messaging.messaging().delegate = self
+    if let windowScene = scene as? UIWindowScene {
+      let window = UIWindow(windowScene: windowScene)
+      window
+        .rootViewController = UIHostingController(rootView: contentView.environmentObject(identity))
+
+      self.window = window
+      window.makeKeyAndVisible()
+    }
+  }
+
+  func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) {
+    identity.token = fcmToken
+    InstanceID.instanceID().instanceID { result, error in
+      self.identity.instanceID = result?.instanceID ?? ""
+    }
+  }
+}

+ 0 - 27
Example/Messaging/Sample/iOS/Base.lproj/LaunchScreen.storyboard

@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
-    <dependencies>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
-        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
-    </dependencies>
-    <scenes>
-        <!--View Controller-->
-        <scene sceneID="EHf-IW-A2E">
-            <objects>
-                <viewController id="01J-lp-oVM" sceneMemberID="viewController">
-                    <layoutGuides>
-                        <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
-                        <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
-                    </layoutGuides>
-                    <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
-                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
-                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                        <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                    </view>
-                </viewController>
-                <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
-            </objects>
-            <point key="canvasLocation" x="53" y="375"/>
-        </scene>
-    </scenes>
-</document>

+ 0 - 48
Example/Messaging/Sample/iOS/Base.lproj/Main.storyboard

@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="taE-sK-BOl">
-    <device id="retina4_7" orientation="portrait">
-        <adaptation id="fullscreen"/>
-    </device>
-    <dependencies>
-        <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
-        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
-    </dependencies>
-    <scenes>
-        <!--Firebase Cloud Messaging-->
-        <scene sceneID="tne-QT-ifu">
-            <objects>
-                <viewController id="BYZ-38-t0r" customClass="MessagingViewController" customModule="Messaging_Example" customModuleProvider="target" sceneMemberID="viewController">
-                    <layoutGuides>
-                        <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
-                        <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
-                    </layoutGuides>
-                    <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
-                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
-                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                        <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                    </view>
-                    <navigationItem key="navigationItem" title="Firebase Cloud Messaging" id="z1u-kE-qKb"/>
-                </viewController>
-                <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
-            </objects>
-            <point key="canvasLocation" x="698" y="164"/>
-        </scene>
-        <!--Navigation Controller-->
-        <scene sceneID="rmF-xz-rwn">
-            <objects>
-                <placeholder placeholderIdentifier="IBFirstResponder" id="Ju1-Bj-8eG" userLabel="First Responder" sceneMemberID="firstResponder"/>
-                <navigationController id="taE-sK-BOl" sceneMemberID="viewController">
-                    <navigationBar key="navigationBar" contentMode="scaleToFill" id="iTL-Kg-11w">
-                        <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
-                        <autoresizingMask key="autoresizingMask"/>
-                    </navigationBar>
-                    <connections>
-                        <segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="04R-HZ-bi6"/>
-                    </connections>
-                </navigationController>
-            </objects>
-            <point key="canvasLocation" x="-92" y="165"/>
-        </scene>
-    </scenes>
-</document>

+ 0 - 25
Example/Messaging/Sample/iOS/Data+MessagingExtensions.swift

@@ -1,25 +0,0 @@
-/*
- * Copyright 2017 Google
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import Foundation
-
-extension Data {
-  // Print Data as a string of bytes in hex, such as the common representation of APNs device tokens
-  // See: http://stackoverflow.com/a/40031342/9849
-  var hexByteString: String {
-    return map { String(format: "%02.2hhx", $0) }.joined()
-  }
-}

+ 0 - 27
Example/Messaging/Sample/iOS/Environment.swift

@@ -1,27 +0,0 @@
-/*
- * Copyright 2017 Google
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import Foundation
-
-struct Environment {
-  static let isSimulator: Bool = {
-    #if targetEnvironment(simulator)
-      return true
-    #else
-      return false
-    #endif
-  }()
-}

+ 9 - 0
scripts/build.sh

@@ -33,6 +33,7 @@ product can be one of:
   Firebase
   Firestore
   InAppMessaging
+  MessagingSample
   Storage
   StorageSwift
   SymbolCollision
@@ -352,6 +353,14 @@ case "$product-$platform-$method" in
         build
     ;;
 
+  MessagingSample-*-*)
+    RunXcodebuild \
+        -workspace 'Example/Messaging/Sample/Sample.xcworkspace' \
+        -scheme "Sample" \
+        "${xcb_flags[@]}" \
+        build
+    ;;
+
   Database-*-xcodebuild)
     pod_gen FirebaseDatabase.podspec --platforms=ios
     RunXcodebuild \

+ 6 - 1
scripts/install_prereqs.sh

@@ -134,7 +134,7 @@ case "$project-$platform-$method" in
     install_secrets
     ;;
 
-  InstanceID*)
+  InstanceID-*)
     install_secrets
     ;;
 
@@ -178,6 +178,11 @@ case "$project-$platform-$method" in
     bundle exec pod install --project-directory=SymbolCollisionTest --repo-update
     ;;
 
+  MessagingSample-*)
+    install_xcpretty
+    bundle exec pod install --project-directory=Example/Messaging/Sample --repo-update
+    ;;
+
   *-pod-lib-lint)
     ;;