diff --git a/sample-apps/swift-sample-app/swift-sample-app.xcodeproj/project.pbxproj b/sample-apps/swift-sample-app/swift-sample-app.xcodeproj/project.pbxproj index 2c9947be0..2de3226b0 100644 --- a/sample-apps/swift-sample-app/swift-sample-app.xcodeproj/project.pbxproj +++ b/sample-apps/swift-sample-app/swift-sample-app.xcodeproj/project.pbxproj @@ -7,6 +7,32 @@ objects = { /* Begin PBXBuildFile section */ + 0C8EE43E2CEEF678006F17D6 /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE43D2CEEF678006F17D6 /* FirebaseAnalytics */; }; + 0C8EE4402CEEF678006F17D6 /* FirebaseAnalyticsOnDeviceConversion in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE43F2CEEF678006F17D6 /* FirebaseAnalyticsOnDeviceConversion */; }; + 0C8EE4422CEEF678006F17D6 /* FirebaseAnalyticsWithoutAdIdSupport in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE4412CEEF678006F17D6 /* FirebaseAnalyticsWithoutAdIdSupport */; }; + 0C8EE4442CEEF678006F17D6 /* FirebaseAppCheck in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE4432CEEF678006F17D6 /* FirebaseAppCheck */; }; + 0C8EE4462CEEF678006F17D6 /* FirebaseAppDistribution-Beta in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE4452CEEF678006F17D6 /* FirebaseAppDistribution-Beta */; }; + 0C8EE4482CEEF678006F17D6 /* FirebaseAuth in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE4472CEEF678006F17D6 /* FirebaseAuth */; }; + 0C8EE44A2CEEF678006F17D6 /* FirebaseAuthCombine-Community in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE4492CEEF678006F17D6 /* FirebaseAuthCombine-Community */; }; + 0C8EE44C2CEEF678006F17D6 /* FirebaseCore in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE44B2CEEF678006F17D6 /* FirebaseCore */; }; + 0C8EE44E2CEEF678006F17D6 /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE44D2CEEF678006F17D6 /* FirebaseCrashlytics */; }; + 0C8EE4502CEEF678006F17D6 /* FirebaseDatabase in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE44F2CEEF678006F17D6 /* FirebaseDatabase */; }; + 0C8EE4522CEEF678006F17D6 /* FirebaseDynamicLinks in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE4512CEEF678006F17D6 /* FirebaseDynamicLinks */; }; + 0C8EE4542CEEF678006F17D6 /* FirebaseFirestore in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE4532CEEF678006F17D6 /* FirebaseFirestore */; }; + 0C8EE4562CEEF678006F17D6 /* FirebaseFirestoreCombine-Community in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE4552CEEF678006F17D6 /* FirebaseFirestoreCombine-Community */; }; + 0C8EE4582CEEF678006F17D6 /* FirebaseFunctions in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE4572CEEF678006F17D6 /* FirebaseFunctions */; }; + 0C8EE45A2CEEF678006F17D6 /* FirebaseFunctionsCombine-Community in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE4592CEEF678006F17D6 /* FirebaseFunctionsCombine-Community */; }; + 0C8EE45C2CEEF678006F17D6 /* FirebaseInAppMessaging-Beta in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE45B2CEEF678006F17D6 /* FirebaseInAppMessaging-Beta */; }; + 0C8EE45E2CEEF678006F17D6 /* FirebaseInstallations in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE45D2CEEF678006F17D6 /* FirebaseInstallations */; }; + 0C8EE4602CEEF678006F17D6 /* FirebaseMLModelDownloader in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE45F2CEEF678006F17D6 /* FirebaseMLModelDownloader */; }; + 0C8EE4622CEEF678006F17D6 /* FirebaseMessaging in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE4612CEEF678006F17D6 /* FirebaseMessaging */; }; + 0C8EE4642CEEF678006F17D6 /* FirebasePerformance in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE4632CEEF678006F17D6 /* FirebasePerformance */; }; + 0C8EE4662CEEF678006F17D6 /* FirebaseRemoteConfig in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE4652CEEF678006F17D6 /* FirebaseRemoteConfig */; }; + 0C8EE4682CEEF678006F17D6 /* FirebaseStorage in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE4672CEEF678006F17D6 /* FirebaseStorage */; }; + 0C8EE46A2CEEF678006F17D6 /* FirebaseStorageCombine-Community in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE4692CEEF678006F17D6 /* FirebaseStorageCombine-Community */; }; + 0C8EE46C2CEEF678006F17D6 /* FirebaseVertexAI in Frameworks */ = {isa = PBXBuildFile; productRef = 0C8EE46B2CEEF678006F17D6 /* FirebaseVertexAI */; }; + 0CD4B0562CEF00BD000DD590 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 0CD4B0552CEF00BD000DD590 /* GoogleService-Info.plist */; }; + 0CEAAB3E2CF8BB4F00172B3E /* guitar.wav in Resources */ = {isa = PBXBuildFile; fileRef = 0CEAAB3D2CF8BB4F00172B3E /* guitar.wav */; }; 37088F332B3C38250000B218 /* IterableAppExtensions in Frameworks */ = {isa = PBXBuildFile; productRef = 37088F322B3C38250000B218 /* IterableAppExtensions */; }; 37088F352B3C38250000B218 /* IterableSDK in Frameworks */ = {isa = PBXBuildFile; productRef = 37088F342B3C38250000B218 /* IterableSDK */; }; 551A5FF1251AB1950004C9A0 /* IterableSDK in Frameworks */ = {isa = PBXBuildFile; productRef = 551A5FF0251AB1950004C9A0 /* IterableSDK */; }; @@ -53,6 +79,8 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0CD4B0552CEF00BD000DD590 /* GoogleService-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; + 0CEAAB3D2CF8BB4F00172B3E /* guitar.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = guitar.wav; sourceTree = ""; }; 551A5FEC251AB1510004C9A0 /* swift-sdk */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "swift-sdk"; path = ../..; sourceTree = ""; }; AC1BDF5720E30436000010CA /* DeepLinkHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeepLinkHandler.swift; sourceTree = ""; }; AC5ECD9C20E303D20081E1DA /* UIViewController+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Extension.swift"; sourceTree = ""; }; @@ -80,8 +108,32 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 0C8EE4642CEEF678006F17D6 /* FirebasePerformance in Frameworks */, + 0C8EE4462CEEF678006F17D6 /* FirebaseAppDistribution-Beta in Frameworks */, + 0C8EE45A2CEEF678006F17D6 /* FirebaseFunctionsCombine-Community in Frameworks */, + 0C8EE44A2CEEF678006F17D6 /* FirebaseAuthCombine-Community in Frameworks */, 551A5FF1251AB1950004C9A0 /* IterableSDK in Frameworks */, + 0C8EE4682CEEF678006F17D6 /* FirebaseStorage in Frameworks */, + 0C8EE4562CEEF678006F17D6 /* FirebaseFirestoreCombine-Community in Frameworks */, + 0C8EE4422CEEF678006F17D6 /* FirebaseAnalyticsWithoutAdIdSupport in Frameworks */, 37088F352B3C38250000B218 /* IterableSDK in Frameworks */, + 0C8EE4602CEEF678006F17D6 /* FirebaseMLModelDownloader in Frameworks */, + 0C8EE44E2CEEF678006F17D6 /* FirebaseCrashlytics in Frameworks */, + 0C8EE46C2CEEF678006F17D6 /* FirebaseVertexAI in Frameworks */, + 0C8EE4622CEEF678006F17D6 /* FirebaseMessaging in Frameworks */, + 0C8EE45E2CEEF678006F17D6 /* FirebaseInstallations in Frameworks */, + 0C8EE4502CEEF678006F17D6 /* FirebaseDatabase in Frameworks */, + 0C8EE43E2CEEF678006F17D6 /* FirebaseAnalytics in Frameworks */, + 0C8EE44C2CEEF678006F17D6 /* FirebaseCore in Frameworks */, + 0C8EE45C2CEEF678006F17D6 /* FirebaseInAppMessaging-Beta in Frameworks */, + 0C8EE4442CEEF678006F17D6 /* FirebaseAppCheck in Frameworks */, + 0C8EE4582CEEF678006F17D6 /* FirebaseFunctions in Frameworks */, + 0C8EE4662CEEF678006F17D6 /* FirebaseRemoteConfig in Frameworks */, + 0C8EE4402CEEF678006F17D6 /* FirebaseAnalyticsOnDeviceConversion in Frameworks */, + 0C8EE4482CEEF678006F17D6 /* FirebaseAuth in Frameworks */, + 0C8EE46A2CEEF678006F17D6 /* FirebaseStorageCombine-Community in Frameworks */, + 0C8EE4522CEEF678006F17D6 /* FirebaseDynamicLinks in Frameworks */, + 0C8EE4542CEEF678006F17D6 /* FirebaseFirestore in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -138,6 +190,8 @@ ACA3A13720E2F6AF00FEF74F /* swift-sample-app */ = { isa = PBXGroup; children = ( + 0CEAAB3D2CF8BB4F00172B3E /* guitar.wav */, + 0CD4B0552CEF00BD000DD590 /* GoogleService-Info.plist */, E9C60B782B3C2061005C4462 /* EmbeddedMessages */, AC5ECD9D20E303F50081E1DA /* ViewControllers */, AC5ECD9B20E3038B0081E1DA /* Deep Link Handling */, @@ -224,6 +278,30 @@ packageProductDependencies = ( 551A5FF0251AB1950004C9A0 /* IterableSDK */, 37088F342B3C38250000B218 /* IterableSDK */, + 0C8EE43D2CEEF678006F17D6 /* FirebaseAnalytics */, + 0C8EE43F2CEEF678006F17D6 /* FirebaseAnalyticsOnDeviceConversion */, + 0C8EE4412CEEF678006F17D6 /* FirebaseAnalyticsWithoutAdIdSupport */, + 0C8EE4432CEEF678006F17D6 /* FirebaseAppCheck */, + 0C8EE4452CEEF678006F17D6 /* FirebaseAppDistribution-Beta */, + 0C8EE4472CEEF678006F17D6 /* FirebaseAuth */, + 0C8EE4492CEEF678006F17D6 /* FirebaseAuthCombine-Community */, + 0C8EE44B2CEEF678006F17D6 /* FirebaseCore */, + 0C8EE44D2CEEF678006F17D6 /* FirebaseCrashlytics */, + 0C8EE44F2CEEF678006F17D6 /* FirebaseDatabase */, + 0C8EE4512CEEF678006F17D6 /* FirebaseDynamicLinks */, + 0C8EE4532CEEF678006F17D6 /* FirebaseFirestore */, + 0C8EE4552CEEF678006F17D6 /* FirebaseFirestoreCombine-Community */, + 0C8EE4572CEEF678006F17D6 /* FirebaseFunctions */, + 0C8EE4592CEEF678006F17D6 /* FirebaseFunctionsCombine-Community */, + 0C8EE45B2CEEF678006F17D6 /* FirebaseInAppMessaging-Beta */, + 0C8EE45D2CEEF678006F17D6 /* FirebaseInstallations */, + 0C8EE45F2CEEF678006F17D6 /* FirebaseMLModelDownloader */, + 0C8EE4612CEEF678006F17D6 /* FirebaseMessaging */, + 0C8EE4632CEEF678006F17D6 /* FirebasePerformance */, + 0C8EE4652CEEF678006F17D6 /* FirebaseRemoteConfig */, + 0C8EE4672CEEF678006F17D6 /* FirebaseStorage */, + 0C8EE4692CEEF678006F17D6 /* FirebaseStorageCombine-Community */, + 0C8EE46B2CEEF678006F17D6 /* FirebaseVertexAI */, ); productName = "swift-sample-app"; productReference = ACA3A13520E2F6AF00FEF74F /* swift-sample-app.app */; @@ -288,6 +366,7 @@ ); mainGroup = ACA3A12C20E2F6AF00FEF74F; packageReferences = ( + 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */, ); productRefGroup = ACA3A13620E2F6AF00FEF74F /* Products */; projectDirPath = ""; @@ -304,8 +383,10 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 0CEAAB3E2CF8BB4F00172B3E /* guitar.wav in Resources */, ACA3A14320E2F6B100FEF74F /* LaunchScreen.storyboard in Resources */, ACA3A14020E2F6B100FEF74F /* Assets.xcassets in Resources */, + 0CD4B0562CEF00BD000DD590 /* GoogleService-Info.plist in Resources */, ACA3A13E20E2F6AF00FEF74F /* Main.storyboard in Resources */, E9C60B7B2B3C2061005C4462 /* embeddedmessages.json in Resources */, ); @@ -496,15 +577,20 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = "swift-sample-app/swift-sample-app.entitlements"; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = R4HRZ34ZYE; INFOPLIST_FILE = "swift-sample-app/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = "com.example.iterable.swift-sample-app"; + MARKETING_VERSION = 2.0; + PRODUCT_BUNDLE_IDENTIFIER = com.iterable.sdkexample; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = iterable_development; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -515,15 +601,20 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = "swift-sample-app/swift-sample-app.entitlements"; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = R4HRZ34ZYE; INFOPLIST_FILE = "swift-sample-app/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = "com.example.iterable.swift-sample-app"; + MARKETING_VERSION = 2.0; + PRODUCT_BUNDLE_IDENTIFIER = com.iterable.sdkexample; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = iterable_development; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -532,16 +623,19 @@ ACA3A15720E2F83E00FEF74F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = R4HRZ34ZYE; INFOPLIST_FILE = "swift-sample-app-notification-extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = "com.example.iterable.swift-sample-app.swift-sample-app-notification-extension"; + PRODUCT_BUNDLE_IDENTIFIER = com.iterable.sdkexample.notificationservice; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = iterable_development_notification; SKIP_INSTALL = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -551,16 +645,19 @@ ACA3A15820E2F83E00FEF74F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = R4HRZ34ZYE; INFOPLIST_FILE = "swift-sample-app-notification-extension/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = "com.example.iterable.swift-sample-app.swift-sample-app-notification-extension"; + PRODUCT_BUNDLE_IDENTIFIER = com.iterable.sdkexample.notificationservice; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = iterable_development_notification; SKIP_INSTALL = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -599,7 +696,138 @@ }; /* End XCConfigurationList section */ +/* Begin XCRemoteSwiftPackageReference section */ + 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/firebase/firebase-ios-sdk.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 11.5.0; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + /* Begin XCSwiftPackageProductDependency section */ + 0C8EE43D2CEEF678006F17D6 /* FirebaseAnalytics */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseAnalytics; + }; + 0C8EE43F2CEEF678006F17D6 /* FirebaseAnalyticsOnDeviceConversion */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseAnalyticsOnDeviceConversion; + }; + 0C8EE4412CEEF678006F17D6 /* FirebaseAnalyticsWithoutAdIdSupport */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseAnalyticsWithoutAdIdSupport; + }; + 0C8EE4432CEEF678006F17D6 /* FirebaseAppCheck */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseAppCheck; + }; + 0C8EE4452CEEF678006F17D6 /* FirebaseAppDistribution-Beta */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = "FirebaseAppDistribution-Beta"; + }; + 0C8EE4472CEEF678006F17D6 /* FirebaseAuth */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseAuth; + }; + 0C8EE4492CEEF678006F17D6 /* FirebaseAuthCombine-Community */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = "FirebaseAuthCombine-Community"; + }; + 0C8EE44B2CEEF678006F17D6 /* FirebaseCore */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseCore; + }; + 0C8EE44D2CEEF678006F17D6 /* FirebaseCrashlytics */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseCrashlytics; + }; + 0C8EE44F2CEEF678006F17D6 /* FirebaseDatabase */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseDatabase; + }; + 0C8EE4512CEEF678006F17D6 /* FirebaseDynamicLinks */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseDynamicLinks; + }; + 0C8EE4532CEEF678006F17D6 /* FirebaseFirestore */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseFirestore; + }; + 0C8EE4552CEEF678006F17D6 /* FirebaseFirestoreCombine-Community */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = "FirebaseFirestoreCombine-Community"; + }; + 0C8EE4572CEEF678006F17D6 /* FirebaseFunctions */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseFunctions; + }; + 0C8EE4592CEEF678006F17D6 /* FirebaseFunctionsCombine-Community */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = "FirebaseFunctionsCombine-Community"; + }; + 0C8EE45B2CEEF678006F17D6 /* FirebaseInAppMessaging-Beta */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = "FirebaseInAppMessaging-Beta"; + }; + 0C8EE45D2CEEF678006F17D6 /* FirebaseInstallations */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseInstallations; + }; + 0C8EE45F2CEEF678006F17D6 /* FirebaseMLModelDownloader */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseMLModelDownloader; + }; + 0C8EE4612CEEF678006F17D6 /* FirebaseMessaging */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseMessaging; + }; + 0C8EE4632CEEF678006F17D6 /* FirebasePerformance */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebasePerformance; + }; + 0C8EE4652CEEF678006F17D6 /* FirebaseRemoteConfig */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseRemoteConfig; + }; + 0C8EE4672CEEF678006F17D6 /* FirebaseStorage */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseStorage; + }; + 0C8EE4692CEEF678006F17D6 /* FirebaseStorageCombine-Community */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = "FirebaseStorageCombine-Community"; + }; + 0C8EE46B2CEEF678006F17D6 /* FirebaseVertexAI */ = { + isa = XCSwiftPackageProductDependency; + package = 0C8EE43C2CEEE98D006F17D6 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseVertexAI; + }; 37088F322B3C38250000B218 /* IterableAppExtensions */ = { isa = XCSwiftPackageProductDependency; productName = IterableAppExtensions; diff --git a/sample-apps/swift-sample-app/swift-sample-app.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/sample-apps/swift-sample-app/swift-sample-app.xcodeproj/project.xcworkspace/contents.xcworkspacedata index b4c94ba12..919434a62 100644 --- a/sample-apps/swift-sample-app/swift-sample-app.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/sample-apps/swift-sample-app/swift-sample-app.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/sample-apps/swift-sample-app/swift-sample-app.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/sample-apps/swift-sample-app/swift-sample-app.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 000000000..338217aa5 --- /dev/null +++ b/sample-apps/swift-sample-app/swift-sample-app.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,124 @@ +{ + "object": { + "pins": [ + { + "package": "abseil", + "repositoryURL": "https://github.com/google/abseil-cpp-binary.git", + "state": { + "branch": null, + "revision": "194a6706acbd25e4ef639bcaddea16e8758a3e27", + "version": "1.2024011602.0" + } + }, + { + "package": "AppCheck", + "repositoryURL": "https://github.com/google/app-check.git", + "state": { + "branch": null, + "revision": "61b85103a1aeed8218f17c794687781505fbbef5", + "version": "11.2.0" + } + }, + { + "package": "Firebase", + "repositoryURL": "https://github.com/firebase/firebase-ios-sdk.git", + "state": { + "branch": null, + "revision": "dbdfdc44bee8b8e4eaa5ec27eb12b9338f3f2bc1", + "version": "11.5.0" + } + }, + { + "package": "GoogleAppMeasurement", + "repositoryURL": "https://github.com/google/GoogleAppMeasurement.git", + "state": { + "branch": null, + "revision": "4f234bcbdae841d7015258fbbf8e7743a39b8200", + "version": "11.4.0" + } + }, + { + "package": "GoogleDataTransport", + "repositoryURL": "https://github.com/google/GoogleDataTransport.git", + "state": { + "branch": null, + "revision": "617af071af9aa1d6a091d59a202910ac482128f9", + "version": "10.1.0" + } + }, + { + "package": "GoogleUtilities", + "repositoryURL": "https://github.com/google/GoogleUtilities.git", + "state": { + "branch": null, + "revision": "53156c7ec267db846e6b64c9f4c4e31ba4cf75eb", + "version": "8.0.2" + } + }, + { + "package": "gRPC", + "repositoryURL": "https://github.com/google/grpc-binary.git", + "state": { + "branch": null, + "revision": "f56d8fc3162de9a498377c7b6cea43431f4f5083", + "version": "1.65.1" + } + }, + { + "package": "GTMSessionFetcher", + "repositoryURL": "https://github.com/google/gtm-session-fetcher.git", + "state": { + "branch": null, + "revision": "5cfe5f090c982de9c58605d2a82a4fc77b774fbd", + "version": "4.1.0" + } + }, + { + "package": "InteropForGoogle", + "repositoryURL": "https://github.com/google/interop-ios-for-google-sdks.git", + "state": { + "branch": null, + "revision": "2d12673670417654f08f5f90fdd62926dc3a2648", + "version": "100.0.0" + } + }, + { + "package": "leveldb", + "repositoryURL": "https://github.com/firebase/leveldb.git", + "state": { + "branch": null, + "revision": "a0bc79961d7be727d258d33d5a6b2f1023270ba1", + "version": "1.22.5" + } + }, + { + "package": "nanopb", + "repositoryURL": "https://github.com/firebase/nanopb.git", + "state": { + "branch": null, + "revision": "b7e1104502eca3a213b46303391ca4d3bc8ddec1", + "version": "2.30910.0" + } + }, + { + "package": "Promises", + "repositoryURL": "https://github.com/google/promises.git", + "state": { + "branch": null, + "revision": "540318ecedd63d883069ae7f1ed811a2df00b6ac", + "version": "2.4.0" + } + }, + { + "package": "SwiftProtobuf", + "repositoryURL": "https://github.com/apple/swift-protobuf.git", + "state": { + "branch": null, + "revision": "ebc7251dd5b37f627c93698e4374084d98409633", + "version": "1.28.2" + } + } + ] + }, + "version": 1 +} diff --git a/sample-apps/swift-sample-app/swift-sample-app/AppDelegate.swift b/sample-apps/swift-sample-app/swift-sample-app/AppDelegate.swift index 4cd304d21..b02726a95 100644 --- a/sample-apps/swift-sample-app/swift-sample-app/AppDelegate.swift +++ b/sample-apps/swift-sample-app/swift-sample-app/AppDelegate.swift @@ -8,8 +8,9 @@ import UIKit import UserNotifications - import IterableSDK +import Firebase +import FirebaseMessaging @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, IterableAuthDelegate { @@ -37,6 +38,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, IterableAuthDelegate { func application(_: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // ITBL: Setup Notification setupNotifications() + FirebaseApp.configure() + Messaging.messaging().delegate = self // ITBL: Initialize API let config = IterableConfig() @@ -44,7 +47,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, IterableAuthDelegate { config.urlDelegate = self config.inAppDisplayInterval = 1 config.anonUserDelegate = self - config.enableAnonTracking = true + config.enableAnonActivation = true config.authDelegate = self IterableAPI.initialize(apiKey: iterableApiKey, launchOptions: launchOptions, @@ -104,6 +107,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, IterableAuthDelegate { func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { IterableAppIntegration.application(application, didReceiveRemoteNotification: userInfo, fetchCompletionHandler: completionHandler) + Messaging.messaging().appDidReceiveMessage(userInfo) + completionHandler(.noData) } // MARK: Deep link @@ -121,7 +126,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate, IterableAuthDelegate { // ITBL: func application(_: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { - IterableAPI.register(token: deviceToken) +// For Firebase Notification Intigration + if !deviceToken.hexString.isEmpty { + Messaging.messaging().apnsToken = deviceToken + } +// For APNS +// IterableAPI.register(token: deviceToken) } func application(_: UIApplication, didFailToRegisterForRemoteNotificationsWithError _: Error) {} @@ -152,6 +162,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate, IterableAuthDelegate { } } +extension AppDelegate : MessagingDelegate { + func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) { + if let token = fcmToken { + IterableAPI.registerFCM(token: token) + } + } +} + // MARK: UNUserNotificationCenterDelegate extension AppDelegate: UNUserNotificationCenterDelegate { @@ -196,3 +214,9 @@ extension AppDelegate: IterableCustomActionDelegate { } } + +extension Data { + public var hexString: String { + return map { String(format: "%02.2hhx", arguments: [$0]) }.joined() + } +} diff --git a/sample-apps/swift-sample-app/swift-sample-app/CoffeeListTableViewController.swift b/sample-apps/swift-sample-app/swift-sample-app/CoffeeListTableViewController.swift index 0164b8bca..cb3492a0c 100644 --- a/sample-apps/swift-sample-app/swift-sample-app/CoffeeListTableViewController.swift +++ b/sample-apps/swift-sample-app/swift-sample-app/CoffeeListTableViewController.swift @@ -74,9 +74,9 @@ class CoffeeListTableViewController: UITableViewController { override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if indexPath.section == 0 { let cell = tableView.dequeueReusableCell(withIdentifier: "anonymousUsageTrackCell", for: indexPath) - cell.textLabel?.text = IterableAPI.getAnonymousUsageTracked() ? "Tap to disable Anonymous Usage Track" : "Tap to enable Anonymous Usage Track" + cell.textLabel?.text = IterableAPI.getVisitorUsageTracked() ? "Tap to disable Anonymous Usage Track" : "Tap to enable Anonymous Usage Track" cell.textLabel?.numberOfLines = 0 - cell.accessoryType = IterableAPI.getAnonymousUsageTracked() ? .checkmark : .none + cell.accessoryType = IterableAPI.getVisitorUsageTracked() ? .checkmark : .none return cell } else { let cell = tableView.dequeueReusableCell(withIdentifier: "coffeeCell", for: indexPath) @@ -90,8 +90,8 @@ class CoffeeListTableViewController: UITableViewController { override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if indexPath.section == 0 { - let permissionToTrack = IterableAPI.getAnonymousUsageTracked() - IterableAPI.setAnonymousUsageTracked(isAnonymousUsageTracked: !permissionToTrack) + let permissionToTrack = IterableAPI.getVisitorUsageTracked() + IterableAPI.setVisitorUsageTracked(isVisitorUsageTracked: !permissionToTrack) self.tableView.reloadData() } } diff --git a/sample-apps/swift-sample-app/swift-sample-app/CoffeeViewController.swift b/sample-apps/swift-sample-app/swift-sample-app/CoffeeViewController.swift index b6dce4418..6fb51dc8b 100644 --- a/sample-apps/swift-sample-app/swift-sample-app/CoffeeViewController.swift +++ b/sample-apps/swift-sample-app/swift-sample-app/CoffeeViewController.swift @@ -45,6 +45,7 @@ class CoffeeViewController: UIViewController { // ITBL: Track attribution to purchase IterableAPI.track(purchase: 10.0, items: [CommerceItem(id: coffee.name.lowercased(), name: coffee.name, price: 10.0, quantity: 1)], dataFields: dataFields) + IterableAPI.updateUser(["firstName":"Leah"], mergeNestedObjects: false) } } diff --git a/sample-apps/swift-sample-app/swift-sample-app/guitar.wav b/sample-apps/swift-sample-app/swift-sample-app/guitar.wav new file mode 100644 index 000000000..ad7c666c4 Binary files /dev/null and b/sample-apps/swift-sample-app/swift-sample-app/guitar.wav differ diff --git a/swift-sdk/Constants.swift b/swift-sdk/Constants.swift index de620b7b5..90965996a 100644 --- a/swift-sdk/Constants.swift +++ b/swift-sdk/Constants.swift @@ -346,6 +346,8 @@ enum JsonValue { static let applicationJson = "application/json" static let apnsSandbox = "APNS_SANDBOX" static let apnsProduction = "APNS" + static let gcmSandbox = "GCM" + static let gcmProduction = "GCM" static let iOS = "iOS" static let bearer = "Bearer" @@ -432,6 +434,12 @@ extension String: JsonValueRepresentable { } } +extension String { + func toJsonDict() -> [AnyHashable: Any] { + try! JSONSerialization.jsonObject(with: data(using: .utf8)!, options: []) as! [AnyHashable: Any] + } +} + extension Bool: JsonValueRepresentable { public var jsonValue: Any { self diff --git a/swift-sdk/Internal/ApiClient.swift b/swift-sdk/Internal/ApiClient.swift index f49c5d30c..f8b1974b3 100644 --- a/swift-sdk/Internal/ApiClient.swift +++ b/swift-sdk/Internal/ApiClient.swift @@ -128,9 +128,9 @@ class ApiClient { extension ApiClient: ApiClientProtocol { - func register(registerTokenInfo: RegisterTokenInfo, notificationsEnabled: Bool) -> Pending { + func register(registerTokenInfo: RegisterTokenInfo, notificationsEnabled: Bool, isFromFCM: Bool) -> Pending { let result = createRequestCreator().flatMap { $0.createRegisterTokenRequest(registerTokenInfo: registerTokenInfo, - notificationsEnabled: notificationsEnabled) } + notificationsEnabled: notificationsEnabled, isFromFCM: isFromFCM) } return send(iterableRequestResult: result) } diff --git a/swift-sdk/Internal/ApiClientProtocol.swift b/swift-sdk/Internal/ApiClientProtocol.swift index a09fdeb53..889941ec2 100644 --- a/swift-sdk/Internal/ApiClientProtocol.swift +++ b/swift-sdk/Internal/ApiClientProtocol.swift @@ -5,7 +5,7 @@ import Foundation protocol ApiClientProtocol: AnyObject { - func register(registerTokenInfo: RegisterTokenInfo, notificationsEnabled: Bool) -> Pending + func register(registerTokenInfo: RegisterTokenInfo, notificationsEnabled: Bool, isFromFCM: Bool) -> Pending func updateUser(_ dataFields: [AnyHashable: Any], mergeNestedObjects: Bool) -> Pending diff --git a/swift-sdk/Internal/InternalIterableAPI.swift b/swift-sdk/Internal/InternalIterableAPI.swift index b66179763..530d390a9 100644 --- a/swift-sdk/Internal/InternalIterableAPI.swift +++ b/swift-sdk/Internal/InternalIterableAPI.swift @@ -256,7 +256,8 @@ final class InternalIterableAPI: NSObject, PushTrackerProtocol, AuthProvider { // MARK: - API Request Calls - func register(token: Data, + func register(token: String, + isFromFCM: Bool, onSuccess: OnSuccessHandler? = nil, onFailure: OnFailureHandler? = nil) { @@ -270,14 +271,14 @@ final class InternalIterableAPI: NSObject, PushTrackerProtocol, AuthProvider { if !isEitherUserIdOrEmailSet() && localStorage.userIdAnnon == nil { if config.enableAnonActivation { - anonymousUserManager.trackAnonTokenRegistration(token: token.hexString()) + anonymousUserManager.trackAnonTokenRegistration(token: token) } onFailure?("Iterable SDK must be initialized with an API key and user email/userId before calling SDK methods", nil) return } - hexToken = token.hexString() - let registerTokenInfo = RegisterTokenInfo(hexToken: token.hexString(), + hexToken = token + let registerTokenInfo = RegisterTokenInfo(hexToken: token, appName: appName, pushServicePlatform: config.pushPlatform, apnsType: dependencyContainer.apnsTypeChecker.apnsType, @@ -286,6 +287,7 @@ final class InternalIterableAPI: NSObject, PushTrackerProtocol, AuthProvider { sdkVersion: localStorage.sdkVersion) requestHandler.register(registerTokenInfo: registerTokenInfo, notificationStateProvider: notificationStateProvider, + isFromFCM: isFromFCM, onSuccess: { (_ data: [AnyHashable: Any]?) in self._successCallback?(data) onSuccess?(data) diff --git a/swift-sdk/Internal/InternalIterableAppIntegration.swift b/swift-sdk/Internal/InternalIterableAppIntegration.swift index 50a637155..0a1796bf3 100644 --- a/swift-sdk/Internal/InternalIterableAppIntegration.swift +++ b/swift-sdk/Internal/InternalIterableAppIntegration.swift @@ -314,7 +314,14 @@ struct InternalIterableAppIntegration { // Normally itblValue would be the value stored in "itbl" key inside of userInfo. // But it is possible to save them at root level for debugging purpose. private static func itblValue(fromUserInfo userInfo: [AnyHashable: Any]) -> [AnyHashable: Any]? { - let itbl = userInfo[JsonKey.Payload.metadata] as? [AnyHashable: Any] + var itbl: [AnyHashable: Any]? = nil + if let itblData = userInfo[JsonKey.Payload.metadata] as? [AnyHashable: Any] { + itbl = itblData + } else if let itblString = userInfo[JsonKey.Payload.metadata] as? String { + itbl = itblString.toJsonDict() + } else { + return nil + } #if DEBUG guard let value = itbl else { diff --git a/swift-sdk/Internal/OnlineRequestProcessor.swift b/swift-sdk/Internal/OnlineRequestProcessor.swift index c332a46f7..4eb3f2e49 100644 --- a/swift-sdk/Internal/OnlineRequestProcessor.swift +++ b/swift-sdk/Internal/OnlineRequestProcessor.swift @@ -23,12 +23,13 @@ struct OnlineRequestProcessor: RequestProcessorProtocol { } func register(registerTokenInfo: RegisterTokenInfo, - notificationStateProvider: NotificationStateProviderProtocol, + notificationStateProvider: NotificationStateProviderProtocol, isFromFCM: Bool, onSuccess: OnSuccessHandler? = nil, onFailure: OnFailureHandler? = nil) { notificationStateProvider.isNotificationsEnabled { enabled in self.register(registerTokenInfo: registerTokenInfo, notificationsEnabled: enabled, + isFromFCM: isFromFCM, onSuccess: onSuccess, onFailure: onFailure) } @@ -324,11 +325,11 @@ struct OnlineRequestProcessor: RequestProcessorProtocol { @discardableResult private func register(registerTokenInfo: RegisterTokenInfo, - notificationsEnabled: Bool, + notificationsEnabled: Bool, isFromFCM: Bool, onSuccess: OnSuccessHandler? = nil, onFailure: OnFailureHandler? = nil) -> Pending { sendRequest(requestProvider: { apiClient.register(registerTokenInfo: registerTokenInfo, - notificationsEnabled: notificationsEnabled) }, + notificationsEnabled: notificationsEnabled, isFromFCM: isFromFCM) }, successHandler: onSuccess, failureHandler: onFailure, requestIdentifier: "registerToken") diff --git a/swift-sdk/Internal/RequestCreator.swift b/swift-sdk/Internal/RequestCreator.swift index 8ab683c1a..a98476925 100644 --- a/swift-sdk/Internal/RequestCreator.swift +++ b/swift-sdk/Internal/RequestCreator.swift @@ -34,7 +34,7 @@ struct RequestCreator { } func createRegisterTokenRequest(registerTokenInfo: RegisterTokenInfo, - notificationsEnabled: Bool) -> Result { + notificationsEnabled: Bool, isFromFCM: Bool) -> Result { if case .none = auth.emailOrUserId { ITBError(Self.authMissingMessage) return .failure(IterableError.general(description: Self.authMissingMessage)) @@ -49,8 +49,7 @@ struct RequestCreator { let deviceDictionary: [String: Any] = [ JsonKey.token: registerTokenInfo.hexToken, - JsonKey.platform: RequestCreator.pushServicePlatformToString(registerTokenInfo.pushServicePlatform, - apnsType: registerTokenInfo.apnsType), + JsonKey.platform: RequestCreator.pushServicePlatformToString(registerTokenInfo.pushServicePlatform, apnsType: registerTokenInfo.apnsType, isFromFCM: isFromFCM), JsonKey.applicationName: registerTokenInfo.appName, JsonKey.dataFields: dataFields, ] @@ -716,14 +715,18 @@ struct RequestCreator { args: args) } - private static func pushServicePlatformToString(_ pushServicePlatform: PushServicePlatform, apnsType: APNSType) -> String { + private static func pushServicePlatformToString(_ pushServicePlatform: PushServicePlatform, apnsType: APNSType, isFromFCM: Bool) -> String { switch pushServicePlatform { case .production: - return JsonValue.apnsProduction + return isFromFCM ? JsonValue.gcmProduction : JsonValue.apnsProduction case .sandbox: - return JsonValue.apnsSandbox + return isFromFCM ? JsonValue.gcmSandbox : JsonValue.apnsSandbox case .auto: - return apnsType == .sandbox ? JsonValue.apnsSandbox : JsonValue.apnsProduction + if apnsType == .sandbox { + return isFromFCM ? JsonValue.gcmSandbox : JsonValue.apnsSandbox + } else { + return isFromFCM ? JsonValue.gcmProduction : JsonValue.apnsProduction + } } } diff --git a/swift-sdk/Internal/RequestHandler.swift b/swift-sdk/Internal/RequestHandler.swift index d414ab9c4..f9934cf07 100644 --- a/swift-sdk/Internal/RequestHandler.swift +++ b/swift-sdk/Internal/RequestHandler.swift @@ -39,10 +39,12 @@ class RequestHandler: RequestHandlerProtocol { func register(registerTokenInfo: RegisterTokenInfo, notificationStateProvider: NotificationStateProviderProtocol, + isFromFCM: Bool, onSuccess: OnSuccessHandler?, onFailure: OnFailureHandler?) { onlineProcessor.register(registerTokenInfo: registerTokenInfo, notificationStateProvider: notificationStateProvider, + isFromFCM: isFromFCM, onSuccess: onSuccess, onFailure: onFailure) } diff --git a/swift-sdk/Internal/RequestHandlerProtocol.swift b/swift-sdk/Internal/RequestHandlerProtocol.swift index 4c51e1b43..591cc7ce3 100644 --- a/swift-sdk/Internal/RequestHandlerProtocol.swift +++ b/swift-sdk/Internal/RequestHandlerProtocol.swift @@ -14,6 +14,7 @@ protocol RequestHandlerProtocol: AnyObject { func register(registerTokenInfo: RegisterTokenInfo, notificationStateProvider: NotificationStateProviderProtocol, + isFromFCM: Bool, onSuccess: OnSuccessHandler?, onFailure: OnFailureHandler?) diff --git a/swift-sdk/IterableAPI.swift b/swift-sdk/IterableAPI.swift index aee77d7ef..27cba790a 100644 --- a/swift-sdk/IterableAPI.swift +++ b/swift-sdk/IterableAPI.swift @@ -253,6 +253,20 @@ import UIKit register(token: token, onSuccess: nil, onFailure: nil) } + /// Register this device's token with Iterable using firebase + /// + /// - Parameters: + /// - token: The token representing this device/application pair, obtained from + /// `didReceiveRegistrationToken fcmToken: String?` + /// after registering for remote notifications + /// + /// - SeeAlso: IterableConfig + @objc(registerFCMToken:) + public static func registerFCM(token: String) { + registerFCM(token: token, onSuccess: nil, onFailure: nil) + } + + /// Register this device's token with Iterable /// /// Push integration name and platform are read from `IterableConfig`. If platform is set to `auto`, it will @@ -269,7 +283,23 @@ import UIKit @objc(registerToken:onSuccess:OnFailure:) public static func register(token: Data, onSuccess: OnSuccessHandler? = nil, onFailure: OnFailureHandler? = nil) { guard let implementation, implementation.isSDKInitialized() else { return } - implementation.register(token: token, onSuccess: onSuccess, onFailure: onFailure) + implementation.register(token: token.hexString(), isFromFCM: false, onSuccess: onSuccess, onFailure: onFailure) + } + + /// Register this device's token with Iterable using firebase + /// + /// - Parameters: + /// - token: The token representing this device/application pair, obtained from + /// `didReceiveRegistrationToken fcmToken: String?` + /// after registering for remote notifications + /// - onSuccess: `OnSuccessHandler` to invoke if token registration is successful + /// - onFailure: `OnFailureHandler` to invoke if token registration fails + /// + /// - SeeAlso: IterableConfig, OnSuccessHandler, OnFailureHandler + @objc(registerFCMToken:onSuccess:OnFailure:) + public static func registerFCM(token: String, onSuccess: OnSuccessHandler? = nil, onFailure: OnFailureHandler? = nil) { + guard let implementation, implementation.isSDKInitialized() else { return } + implementation.register(token: token, isFromFCM: true, onSuccess: onSuccess, onFailure: onFailure) } @objc(pauseAuthRetries:)