Skip to content

Commit 62f03c6

Browse files
committed
Automatic Firebase analytics notification events
* Tracks opens and influenced opens. * Received event WIP.
1 parent c0cb032 commit 62f03c6

File tree

69 files changed

+5355
-186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+5355
-186
lines changed

Examples/ObjectiveCExample/OneSignalDemo.xcodeproj/project.pbxproj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,13 +313,16 @@
313313
files = (
314314
);
315315
inputPaths = (
316+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
317+
"${PODS_ROOT}/Manifest.lock",
316318
);
317319
name = "[CP] Check Pods Manifest.lock";
318320
outputPaths = (
321+
"$(DERIVED_FILE_DIR)/Pods-OneSignalDemo-checkManifestLockResult.txt",
319322
);
320323
runOnlyForDeploymentPostprocessing = 0;
321324
shellPath = /bin/sh;
322-
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
325+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
323326
showEnvVarsInLog = 0;
324327
};
325328
B6FE2DEB3B7911DA542111D2 /* [CP] Check Pods Manifest.lock */ = {
@@ -328,13 +331,16 @@
328331
files = (
329332
);
330333
inputPaths = (
334+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
335+
"${PODS_ROOT}/Manifest.lock",
331336
);
332337
name = "[CP] Check Pods Manifest.lock";
333338
outputPaths = (
339+
"$(DERIVED_FILE_DIR)/Pods-NotificationServiceExtension-checkManifestLockResult.txt",
334340
);
335341
runOnlyForDeploymentPostprocessing = 0;
336342
shellPath = /bin/sh;
337-
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
343+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
338344
showEnvVarsInLog = 0;
339345
};
340346
EE781DE378D91960D86CE6A9 /* [CP] Copy Pods Resources */ = {

Examples/SwiftExample/OneSignalDemo.xcodeproj/project.pbxproj

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
/* Begin PBXBuildFile section */
1010
0BFA9580A5738FE71877AB42 /* libPods-OneSignalNotificationServiceExtension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D32C4978E51F05AA82FC597 /* libPods-OneSignalNotificationServiceExtension.a */; };
11-
378310DE5E74831CBC5C833C /* Pods_OneSignalDemo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6DE881DDE387B7869A75E56A /* Pods_OneSignalDemo.framework */; };
1211
3E20C84D1D8787B6004ACDEA /* UserNotifications.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EA62EFB1D877EF200E5845A /* UserNotifications.framework */; };
12+
90B5E6598DAC12EBD02E3210 /* libPods-OneSignalDemo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A5781FB7CA3EFBC8BBE04FB7 /* libPods-OneSignalDemo.a */; };
1313
9112E8B01E725C1E0022A1CB /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9112E8AF1E725C1E0022A1CB /* NotificationService.swift */; };
1414
9112E8B41E725C1E0022A1CB /* OneSignalNotificationServiceExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 9112E8AD1E725C1E0022A1CB /* OneSignalNotificationServiceExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
1515
9150E7691E734F6E00C5D46A /* GreenViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9150E7671E734F6E00C5D46A /* GreenViewController.swift */; };
@@ -49,7 +49,6 @@
4949
/* Begin PBXFileReference section */
5050
2F2B914C976A118DAE4F0182 /* Pods-OneSignalDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OneSignalDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-OneSignalDemo/Pods-OneSignalDemo.release.xcconfig"; sourceTree = "<group>"; };
5151
3EA62EFB1D877EF200E5845A /* UserNotifications.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotifications.framework; path = System/Library/Frameworks/UserNotifications.framework; sourceTree = SDKROOT; };
52-
6DE881DDE387B7869A75E56A /* Pods_OneSignalDemo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_OneSignalDemo.framework; sourceTree = BUILT_PRODUCTS_DIR; };
5352
7D32C4978E51F05AA82FC597 /* libPods-OneSignalNotificationServiceExtension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OneSignalNotificationServiceExtension.a"; sourceTree = BUILT_PRODUCTS_DIR; };
5453
9112E8AD1E725C1E0022A1CB /* OneSignalNotificationServiceExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = OneSignalNotificationServiceExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
5554
9112E8AF1E725C1E0022A1CB /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
@@ -65,6 +64,7 @@
6564
91C3CFD71E7266F600D9EA80 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
6665
91C3CFD81E7266F600D9EA80 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
6766
91E4D50D1C7521DE00025BA8 /* OneSignalDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OneSignalDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
67+
A5781FB7CA3EFBC8BBE04FB7 /* libPods-OneSignalDemo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OneSignalDemo.a"; sourceTree = BUILT_PRODUCTS_DIR; };
6868
C4E3EDAB2FA367616C26AB60 /* Pods-OneSignalNotificationServiceExtension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OneSignalNotificationServiceExtension.release.xcconfig"; path = "Pods/Target Support Files/Pods-OneSignalNotificationServiceExtension/Pods-OneSignalNotificationServiceExtension.release.xcconfig"; sourceTree = "<group>"; };
6969
F7D037F3EC51FAA8D3FEE517 /* Pods-OneSignalNotificationServiceExtension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OneSignalNotificationServiceExtension.debug.xcconfig"; path = "Pods/Target Support Files/Pods-OneSignalNotificationServiceExtension/Pods-OneSignalNotificationServiceExtension.debug.xcconfig"; sourceTree = "<group>"; };
7070
FBF7B1679DAECB1F8823DFA8 /* Pods-OneSignalDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OneSignalDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-OneSignalDemo/Pods-OneSignalDemo.debug.xcconfig"; sourceTree = "<group>"; };
@@ -85,7 +85,7 @@
8585
files = (
8686
9150E76D1E73556A00C5D46A /* CoreLocation.framework in Frameworks */,
8787
3E20C84D1D8787B6004ACDEA /* UserNotifications.framework in Frameworks */,
88-
378310DE5E74831CBC5C833C /* Pods_OneSignalDemo.framework in Frameworks */,
88+
90B5E6598DAC12EBD02E3210 /* libPods-OneSignalDemo.a in Frameworks */,
8989
);
9090
runOnlyForDeploymentPostprocessing = 0;
9191
};
@@ -108,8 +108,8 @@
108108
children = (
109109
9150E76C1E73556A00C5D46A /* CoreLocation.framework */,
110110
3EA62EFB1D877EF200E5845A /* UserNotifications.framework */,
111-
6DE881DDE387B7869A75E56A /* Pods_OneSignalDemo.framework */,
112111
7D32C4978E51F05AA82FC597 /* libPods-OneSignalNotificationServiceExtension.a */,
112+
A5781FB7CA3EFBC8BBE04FB7 /* libPods-OneSignalDemo.a */,
113113
);
114114
name = Frameworks;
115115
sourceTree = "<group>";
@@ -215,12 +215,12 @@
215215
TargetAttributes = {
216216
9112E8AC1E725C1E0022A1CB = {
217217
CreatedOnToolsVersion = 8.2.1;
218-
DevelopmentTeam = MGZJFP2D98;
218+
DevelopmentTeam = 99SW8E36CT;
219219
ProvisioningStyle = Automatic;
220220
};
221221
91E4D50C1C7521DE00025BA8 = {
222222
CreatedOnToolsVersion = 7.2;
223-
DevelopmentTeam = MGZJFP2D98;
223+
DevelopmentTeam = 99SW8E36CT;
224224
LastSwiftMigration = 0800;
225225
SystemCapabilities = {
226226
com.apple.BackgroundModes = {
@@ -279,13 +279,16 @@
279279
files = (
280280
);
281281
inputPaths = (
282+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
283+
"${PODS_ROOT}/Manifest.lock",
282284
);
283285
name = "[CP] Check Pods Manifest.lock";
284286
outputPaths = (
287+
"$(DERIVED_FILE_DIR)/Pods-OneSignalDemo-checkManifestLockResult.txt",
285288
);
286289
runOnlyForDeploymentPostprocessing = 0;
287290
shellPath = /bin/sh;
288-
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
291+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
289292
showEnvVarsInLog = 0;
290293
};
291294
6F0A94118DCF1271C41EE7C2 /* [CP] Embed Pods Frameworks */ = {
@@ -324,13 +327,16 @@
324327
files = (
325328
);
326329
inputPaths = (
330+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
331+
"${PODS_ROOT}/Manifest.lock",
327332
);
328333
name = "[CP] Check Pods Manifest.lock";
329334
outputPaths = (
335+
"$(DERIVED_FILE_DIR)/Pods-OneSignalNotificationServiceExtension-checkManifestLockResult.txt",
330336
);
331337
runOnlyForDeploymentPostprocessing = 0;
332338
shellPath = /bin/sh;
333-
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
339+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
334340
showEnvVarsInLog = 0;
335341
};
336342
F081337AC0967A1DFB1C1C9D /* [CP] Copy Pods Resources */ = {
@@ -408,7 +414,7 @@
408414
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
409415
CLANG_WARN_INFINITE_RECURSION = YES;
410416
CLANG_WARN_SUSPICIOUS_MOVE = YES;
411-
DEVELOPMENT_TEAM = MGZJFP2D98;
417+
DEVELOPMENT_TEAM = 99SW8E36CT;
412418
INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist;
413419
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
414420
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
@@ -428,7 +434,7 @@
428434
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
429435
CLANG_WARN_INFINITE_RECURSION = YES;
430436
CLANG_WARN_SUSPICIOUS_MOVE = YES;
431-
DEVELOPMENT_TEAM = MGZJFP2D98;
437+
DEVELOPMENT_TEAM = 99SW8E36CT;
432438
INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist;
433439
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
434440
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
@@ -534,7 +540,7 @@
534540
buildSettings = {
535541
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
536542
CODE_SIGN_ENTITLEMENTS = OneSignalDemo/OneSignalDemo.entitlements;
537-
DEVELOPMENT_TEAM = MGZJFP2D98;
543+
DEVELOPMENT_TEAM = 99SW8E36CT;
538544
INFOPLIST_FILE = "$(SRCROOT)/OneSignalDemo/Info.plist";
539545
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
540546
PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example;
@@ -550,7 +556,7 @@
550556
buildSettings = {
551557
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
552558
CODE_SIGN_ENTITLEMENTS = OneSignalDemo/OneSignalDemo.entitlements;
553-
DEVELOPMENT_TEAM = MGZJFP2D98;
559+
DEVELOPMENT_TEAM = 99SW8E36CT;
554560
INFOPLIST_FILE = "$(SRCROOT)/OneSignalDemo/Info.plist";
555561
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
556562
PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example;
Binary file not shown.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#import <Foundation/Foundation.h>
2+
3+
#import "FIRAnalytics.h"
4+
5+
NS_ASSUME_NONNULL_BEGIN
6+
7+
/**
8+
* Provides App Delegate handlers to be used in your App Delegate.
9+
*
10+
* To save time integrating Firebase Analytics in an application, Firebase Analytics does not
11+
* require delegation implementation from the AppDelegate. Instead this is automatically done by
12+
* Firebase Analytics. Should you choose instead to delegate manually, you can turn off the App
13+
* Delegate Proxy by adding FirebaseAppDelegateProxyEnabled into your app's Info.plist and setting
14+
* it to NO, and adding the methods in this category to corresponding delegation handlers.
15+
*
16+
* To handle Universal Links, you must return YES in
17+
* [UIApplicationDelegate application:didFinishLaunchingWithOptions:].
18+
*/
19+
@interface FIRAnalytics (AppDelegate)
20+
21+
/**
22+
* Handles events related to a URL session that are waiting to be processed.
23+
*
24+
* For optimal use of Firebase Analytics, call this method from the
25+
* [UIApplicationDelegate application:handleEventsForBackgroundURLSession:completionHandler]
26+
* method of the app delegate in your app.
27+
*
28+
* @param identifier The identifier of the URL session requiring attention.
29+
* @param completionHandler The completion handler to call when you finish processing the events.
30+
* Calling this completion handler lets the system know that your app's user interface is
31+
* updated and a new snapshot can be taken.
32+
*/
33+
+ (void)handleEventsForBackgroundURLSession:(NSString *)identifier
34+
completionHandler:(nullable void (^)(void))completionHandler;
35+
36+
/**
37+
* Handles the event when the app is launched by a URL.
38+
*
39+
* Call this method from [UIApplicationDelegate application:openURL:options:] &#40;on iOS 9.0 and
40+
* above&#41;, or [UIApplicationDelegate application:openURL:sourceApplication:annotation:] &#40;on
41+
* iOS 8.x and below&#41; in your app.
42+
*
43+
* @param url The URL resource to open. This resource can be a network resource or a file.
44+
*/
45+
+ (void)handleOpenURL:(NSURL *)url;
46+
47+
/**
48+
* Handles the event when the app receives data associated with user activity that includes a
49+
* Universal Link (on iOS 9.0 and above).
50+
*
51+
* Call this method from [UIApplication continueUserActivity:restorationHandler:] in your app
52+
* delegate (on iOS 9.0 and above).
53+
*
54+
* @param userActivity The activity object containing the data associated with the task the user
55+
* was performing.
56+
*/
57+
+ (void)handleUserActivity:(id)userActivity;
58+
59+
@end
60+
61+
NS_ASSUME_NONNULL_END
62+

0 commit comments

Comments
 (0)