@selligent-marketing-cloud/selligent-react-native 3.1.0 → 3.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -1550
- package/RNSelligent.podspec +8 -15
- package/android/build.gradle +46 -79
- package/android/src/main/java/com/selligent/BroadcastEventType.java +4 -1
- package/android/src/main/java/com/selligent/ButtonAction.java +81 -0
- package/android/src/main/java/com/selligent/ButtonBroadcastEventDataParser.java +9 -3
- package/android/src/main/java/com/selligent/DeviceIdBroadcastEventDataParser.java +15 -0
- package/android/src/main/java/com/selligent/EventType.java +1 -1
- package/android/src/main/java/com/selligent/GCMTokenBroadcastEventDataParser.java +6 -1
- package/android/src/main/java/com/selligent/InAppMessageBroadcastEventDataParser.java +7 -1
- package/android/src/main/java/com/selligent/NotificationMessageBroadcastEventDataParser.java +19 -0
- package/android/src/main/java/com/selligent/RNSelligent.java +195 -56
- package/android/src/main/java/com/selligent/SMSettingsFactory.java +0 -1
- package/android/src/main/java/com/selligent/Settings.java +0 -9
- package/constants.d.ts +7 -33
- package/constants.js +51 -85
- package/documentation/README.md +826 -0
- package/helpers.js +5 -6
- package/index.android.js +8 -83
- package/index.d.ts +33 -43
- package/index.ios.js +25 -76
- package/index.js +153 -45
- package/ios/RNSelligentMapper.h +21 -0
- package/ios/RNSelligentMapper.m +151 -0
- package/ios/RNSelligentMobileSDK.xcframework/Info.plist +40 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Headers/RNSelligentMobileSDK-Swift.h +350 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Info.plist +0 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios.abi.json +2603 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +59 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios.swiftinterface +59 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/Modules/module.modulemap +4 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/RNSelligentMobileSDK +0 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64/RNSelligentMobileSDK.framework/_CodeSignature/CodeResources +179 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Headers/RNSelligentMobileSDK-Swift.h +696 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Info.plist +0 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +2603 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +59 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +59 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +2603 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +59 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/RNSelligentMobileSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +59 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/Modules/module.modulemap +4 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/RNSelligentMobileSDK +0 -0
- package/ios/RNSelligentMobileSDK.xcframework/ios-arm64_x86_64-simulator/RNSelligentMobileSDK.framework/_CodeSignature/CodeResources +234 -0
- package/package.json +30 -11
- package/.gitattributes +0 -1
- package/CHANGELOG.md +0 -68
- package/android/README.md +0 -15
- package/android/build/generated/source/buildConfig/debug/com/selligent/BuildConfig.java +0 -12
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -9
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +0 -18
- package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +0 -4
- package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
- package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -6781
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -1
- package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
- package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +0 -2
- package/android/build/intermediates/javac/debug/classes/com/selligent/BroadcastDataFactory$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/BroadcastDataFactory.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/BroadcastEventDataParser.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/BroadcastEventType.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/BuildConfig.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/ButtonBroadcastEventDataParser.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/ClearCacheIntervalValue.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/Event.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/EventReceiver.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/EventType.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/GCMTokenBroadcastEventDataParser.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/InAppMessageBroadcastEventDataParser.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/InAppMessageRefreshType.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligent$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligent$2.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligent$3.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligent$4.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligent$5.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligent.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/RNSelligentPackage.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/RemoteMessageDisplayType.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/SMEventFactory$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/SMEventFactory.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/SMSettingsFactory.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/selligent/Settings.class +0 -0
- package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +0 -2
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -11
- package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +0 -9
- package/android/build/intermediates/navigation_json/debug/navigation.json +0 -1
- package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +0 -18
- package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -5100
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -25
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/libs/sdk-release.aar +0 -0
- package/documentation/add_json_file.png +0 -0
- package/documentation/add_lib_file.png +0 -0
- package/ios/BackgroundFetchResult.h +0 -5
- package/ios/ClearCacheInterval.h +0 -7
- package/ios/ClientSettings.h +0 -22
- package/ios/ClientSettings.m +0 -39
- package/ios/EnumMapper.h +0 -36
- package/ios/EnumMapper.m +0 -121
- package/ios/Event+SMEvent.h +0 -13
- package/ios/Event+SMEvent.m +0 -41
- package/ios/Event.h +0 -12
- package/ios/Event.m +0 -24
- package/ios/EventType.h +0 -7
- package/ios/InAppMessageRefreshType.h +0 -6
- package/ios/InAppMessageSettings.h +0 -9
- package/ios/InAppMessageSettings.m +0 -19
- package/ios/LocationAuthorisationStatus.h +0 -6
- package/ios/LocationAuthorisationType.h +0 -4
- package/ios/LogLevel.h +0 -9
- package/ios/NotificationButtonType.h +0 -15
- package/ios/ParsableObject.h +0 -5
- package/ios/RNSelligent.h +0 -22
- package/ios/RNSelligent.m +0 -347
- package/ios/RemoteMessageDisplayType.h +0 -5
- package/ios/SMManagerSetting+ClientSettings.h +0 -9
- package/ios/SMManagerSetting+ClientSettings.m +0 -73
- package/ios/SelligentLogger.h +0 -7
- package/ios/SelligentLogger.m +0 -9
- package/ios/SelligentReactNative.xcodeproj/project.pbxproj +0 -446
- package/ios/include/SMBaseMessage.h +0 -48
- package/ios/include/SMBlock.h +0 -21
- package/ios/include/SMClearCache.h +0 -34
- package/ios/include/SMContentAlignment.h +0 -27
- package/ios/include/SMDeviceInfos.h +0 -38
- package/ios/include/SMDisplayMode.h +0 -27
- package/ios/include/SMEvent.h +0 -69
- package/ios/include/SMEventUser.h +0 -20
- package/ios/include/SMEventUserLogin.h +0 -42
- package/ios/include/SMEventUserLogout.h +0 -42
- package/ios/include/SMEventUserRegistration.h +0 -42
- package/ios/include/SMEventUserUnregistration.h +0 -42
- package/ios/include/SMFailure.h +0 -19
- package/ios/include/SMHelper.h +0 -51
- package/ios/include/SMInAppContentHTMLViewController.h +0 -59
- package/ios/include/SMInAppContentImageViewController.h +0 -36
- package/ios/include/SMInAppContentMessage.h +0 -56
- package/ios/include/SMInAppContentStyleOptions.h +0 -511
- package/ios/include/SMInAppContentType.h +0 -35
- package/ios/include/SMInAppContentURLViewController.h +0 -36
- package/ios/include/SMInAppContentViewController.h +0 -31
- package/ios/include/SMInAppMessage.h +0 -51
- package/ios/include/SMInAppMessageType.h +0 -50
- package/ios/include/SMInAppRefreshType.h +0 -29
- package/ios/include/SMLink.h +0 -39
- package/ios/include/SMLog.h +0 -54
- package/ios/include/SMManager+DataTransaction.h +0 -33
- package/ios/include/SMManager+InAppContent.h +0 -170
- package/ios/include/SMManager+InAppMessage.h +0 -172
- package/ios/include/SMManager+Location.h +0 -41
- package/ios/include/SMManager+Log.h +0 -31
- package/ios/include/SMManager+RemoteNotification.h +0 -171
- package/ios/include/SMManager+SMEvent.h +0 -67
- package/ios/include/SMManager+SMLink.h +0 -44
- package/ios/include/SMManager+SilentPush.h +0 -53
- package/ios/include/SMManager+StyleOptions.h +0 -36
- package/ios/include/SMManager+UserNotification.h +0 -180
- package/ios/include/SMManager+ViewController.h +0 -45
- package/ios/include/SMManager.h +0 -69
- package/ios/include/SMManagerHelper.h +0 -18
- package/ios/include/SMManagerInAppMessageDelegate.h +0 -24
- package/ios/include/SMManagerSetting+Location.h +0 -27
- package/ios/include/SMManagerSetting.h +0 -180
- package/ios/include/SMManagerSettingIAC.h +0 -48
- package/ios/include/SMManagerSettingIAM.h +0 -49
- package/ios/include/SMManagerUniversalLinksDelegate.h +0 -23
- package/ios/include/SMMessage.h +0 -21
- package/ios/include/SMNSNotification.h +0 -81
- package/ios/include/SMNotificationAnnotationData.h +0 -33
- package/ios/include/SMNotificationButtonData.h +0 -20
- package/ios/include/SMNotificationButtonType.h +0 -90
- package/ios/include/SMNotificationMessage.h +0 -31
- package/ios/include/SMRemoteMessageDisplayType.h +0 -32
- package/ios/include/SMSuccess.h +0 -16
- package/ios/libSelligentMobile.a +0 -0
- package/trigger.yml +0 -9
package/ios/RNSelligent.m
DELETED
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
#import "RNSelligent.h"
|
|
2
|
-
#import "SMManager.h"
|
|
3
|
-
#import "SMNSNotification.h"
|
|
4
|
-
#import "SMManager+DataTransaction.h"
|
|
5
|
-
#import "SMManagerSetting+ClientSettings.h"
|
|
6
|
-
#import "SMManager+Location.h"
|
|
7
|
-
#import "SMManager+Log.h"
|
|
8
|
-
#import "SMManager+SMEvent.h"
|
|
9
|
-
#import "SMManager+RemoteNotification.h"
|
|
10
|
-
#import "SMManager+UserNotification.h"
|
|
11
|
-
#import "SMManager+InAppMessage.h"
|
|
12
|
-
#import "SMManager+SilentPush.h"
|
|
13
|
-
#import "Event.h"
|
|
14
|
-
#import "Event+SMEvent.h"
|
|
15
|
-
#import "LogLevel.h"
|
|
16
|
-
#import "EnumMapper.h"
|
|
17
|
-
#import "SMDeviceInfos.h"
|
|
18
|
-
#import "ClientSettings.h"
|
|
19
|
-
#import "SelligentLogger.h"
|
|
20
|
-
#import "SMNotificationButtonData.h"
|
|
21
|
-
|
|
22
|
-
static RNSelligent *rnSelligent = nil;
|
|
23
|
-
|
|
24
|
-
static NSString * const BROADCAST_BUTTON_CLICKED = @"ButtonClicked";
|
|
25
|
-
static NSString * const BROADCAST_RECEIVED_IN_APP_MSG = @"ReceivedInAppMessage";
|
|
26
|
-
static NSString * const BROADCAST_WILL_DISPLAY_NOTIFICATION = @"WillDisplayNotification";
|
|
27
|
-
static NSString * const BROADCAST_WILL_DISMISS_NOTIFICATION = @"WillDismissNotification";
|
|
28
|
-
static NSString * const BROADCAST_RECEIVED_DEVICE_ID = @"ReceivedDeviceId";
|
|
29
|
-
static NSString * const BROADCAST_RECEIVED_REMOTENOTIFICATION = @"ReceivedRemoteNotification";
|
|
30
|
-
static NSString * const FETCHED_REMOTE_NOTIFICATION = @"FetchedRemoteNotification";
|
|
31
|
-
|
|
32
|
-
@interface RNSelligent()
|
|
33
|
-
@property (nonatomic, strong) NSNumber *requestedForcedRemoteNotificationBackgroundFetchResult;
|
|
34
|
-
@end
|
|
35
|
-
|
|
36
|
-
@implementation RNSelligent
|
|
37
|
-
|
|
38
|
-
RCT_EXPORT_MODULE(RNSelligent)
|
|
39
|
-
|
|
40
|
-
+ (nonnull instancetype)instance {
|
|
41
|
-
return rnSelligent;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
- (instancetype)init {
|
|
45
|
-
self = [super init];
|
|
46
|
-
if (self != nil) {
|
|
47
|
-
rnSelligent = self;
|
|
48
|
-
}
|
|
49
|
-
return self;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
+ (BOOL)requiresMainQueueSetup
|
|
53
|
-
{
|
|
54
|
-
return YES;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
+ (void)configureWithLaunchOptions:(NSDictionary *)launchOptions {
|
|
58
|
-
NSArray *selligentSettingsJSONPathComponents = @[[[NSBundle mainBundle] bundlePath], @"selligent.json"];
|
|
59
|
-
NSString *selligentSettingsJSONPath = [NSString pathWithComponents:selligentSettingsJSONPathComponents];
|
|
60
|
-
if ([[NSFileManager defaultManager] fileExistsAtPath:selligentSettingsJSONPath]) {
|
|
61
|
-
NSData *data = [NSData dataWithContentsOfFile:selligentSettingsJSONPath];
|
|
62
|
-
NSDictionary *settingsJson = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
|
|
63
|
-
ClientSettings *clientSettings = [ClientSettings fromDictionary:settingsJson];
|
|
64
|
-
SMManagerSetting *settings = [SMManagerSetting smManagerSettingsFrom:clientSettings];
|
|
65
|
-
[[SMManager sharedInstance] startWithLaunchOptions:launchOptions Setting:settings];
|
|
66
|
-
} else {
|
|
67
|
-
[SelligentLogger log:@"no selligent.json file found. Please provide a selligent.json file as a bundle resource of your iOS application."];
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
+ (void)performIAMFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
|
|
72
|
-
[[SMManager sharedInstance] performIAMFetchWithCompletionHandler:completionHandler];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
+ (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
|
|
76
|
-
[[SMManager sharedInstance] didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
#pragma clang diagnostic push
|
|
80
|
-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
81
|
-
+ (void)didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
|
|
82
|
-
[[SMManager sharedInstance] didRegisterUserNotificationSettings:notificationSettings];
|
|
83
|
-
}
|
|
84
|
-
#pragma clang diagnostic pop
|
|
85
|
-
|
|
86
|
-
+ (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
|
|
87
|
-
[[SMManager sharedInstance] didFailToRegisterForRemoteNotificationsWithError:error];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
+ (void)didReceiveRemoteNotification:(NSDictionary *)notification {
|
|
91
|
-
void (^fetchCompletionHandler)(UIBackgroundFetchResult) = ^(UIBackgroundFetchResult backgroundResult) {
|
|
92
|
-
NSDictionary *message = @{
|
|
93
|
-
@"backgroundFetchResult": @([[EnumMapper sharedEnumMapper] backgroundFetchResultForUIBackgroundFetchResult:backgroundResult]),
|
|
94
|
-
@"notification" : notification,
|
|
95
|
-
};
|
|
96
|
-
[[RNSelligent instance] sendEventWithName:FETCHED_REMOTE_NOTIFICATION body:message];
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
NSNumber *requestedFetchResult = [[RNSelligent instance] requestedForcedRemoteNotificationBackgroundFetchResult];
|
|
100
|
-
if (requestedFetchResult) {
|
|
101
|
-
[[SMManager sharedInstance] didReceiveRemoteNotification:notification fetchCompletionHandler:fetchCompletionHandler ForceResultFetch:requestedFetchResult.integerValue];
|
|
102
|
-
} else {
|
|
103
|
-
[[SMManager sharedInstance] didReceiveRemoteNotification:notification fetchCompletionHandler:fetchCompletionHandler];
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
+ (void)willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
|
|
108
|
-
[[SMManager sharedInstance] willPresentNotification:notification withCompletionHandler:completionHandler];
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
+ (void)didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(UNNotificationContentExtensionResponseOption options))completionHandler {
|
|
112
|
-
[[SMManager sharedInstance] didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
RCT_EXPORT_METHOD(getVersionLib:(RCTResponseSenderBlock)callback) {
|
|
116
|
-
NSString *libraryVersion = [[SMManager sharedInstance] versionLib];
|
|
117
|
-
callback(@[libraryVersion, [NSNull null]]);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
RCT_EXPORT_METHOD(enableInAppMessages:(BOOL)enabled) {
|
|
121
|
-
[[SMManager sharedInstance] enableInAppMessage:enabled];
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
RCT_EXPORT_METHOD(getInAppMessages:(RCTResponseSenderBlock)callback) {
|
|
125
|
-
NSArray *inAppMessages = [[SMManager sharedInstance] getInAppMessages];
|
|
126
|
-
NSMutableArray *mappedMessages = [NSMutableArray new];
|
|
127
|
-
for (SMInAppMessage *inAppMessage in inAppMessages) {
|
|
128
|
-
NSMutableArray *mappedLinks = [NSMutableArray new];
|
|
129
|
-
for (SMLink *link in [inAppMessage arrayIAMLinks]) {
|
|
130
|
-
[mappedLinks addObject: @{
|
|
131
|
-
@"id" : [link idButtonData],
|
|
132
|
-
@"label" : [link label],
|
|
133
|
-
@"value" : [link value],
|
|
134
|
-
@"type" : @([link type]),
|
|
135
|
-
}];
|
|
136
|
-
}
|
|
137
|
-
[mappedMessages addObject: @{
|
|
138
|
-
@"id" : [inAppMessage idMessage],
|
|
139
|
-
@"title" : [inAppMessage title],
|
|
140
|
-
@"body" : [inAppMessage body],
|
|
141
|
-
@"receptionDate" : [inAppMessage receptionDate] ? @([[inAppMessage receptionDate] timeIntervalSince1970]) : [NSNull null],
|
|
142
|
-
@"creationDate" : @([[inAppMessage creationDate] timeIntervalSince1970]),
|
|
143
|
-
@"expirationDate" : [inAppMessage expirationDate] ? @([[inAppMessage expirationDate] timeIntervalSince1970]) : [NSNull null],
|
|
144
|
-
@"hasBeenSeen" : @([inAppMessage isViewed]),
|
|
145
|
-
@"buttons" : mappedLinks,
|
|
146
|
-
@"type" : @([inAppMessage iamType])
|
|
147
|
-
}];
|
|
148
|
-
}
|
|
149
|
-
callback(@[mappedMessages ?: [NSNull null], [NSNull null]]);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
RCT_EXPORT_METHOD(setInAppMessageAsSeen:(NSString *) messageId successCallback:(RCTResponseSenderBlock)successCallback errorCallback:(RCTResponseSenderBlock)errorCallback) {
|
|
153
|
-
NSArray *inAppMessages = [[SMManager sharedInstance] getInAppMessages];
|
|
154
|
-
for (SMInAppMessage *inAppMessage in inAppMessages) {
|
|
155
|
-
if ([[inAppMessage idMessage] isEqualToString: messageId]) {
|
|
156
|
-
[[SMManager sharedInstance] setInAppMessageAsSeen: inAppMessage];
|
|
157
|
-
successCallback(@[[NSNull null]]);
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
errorCallback(@[[NSString stringWithFormat:@"No message with id %@ found", messageId]]);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
RCT_EXPORT_METHOD(executeButtonAction: (NSString *)buttonId messageId:(NSString *) messageId successCallback:(RCTResponseSenderBlock)successCallback errorCallback:(RCTResponseSenderBlock) errorCallback) {
|
|
165
|
-
NSArray *inAppMessages = [[SMManager sharedInstance] getInAppMessages];
|
|
166
|
-
for (SMInAppMessage *inAppMessage in inAppMessages) {
|
|
167
|
-
if ([[inAppMessage idMessage] isEqualToString: messageId]) {
|
|
168
|
-
for (SMLink *link in [inAppMessage arrayIAMLinks]) {
|
|
169
|
-
if ([[link idButtonData] isEqualToString: buttonId]) {
|
|
170
|
-
[[SMManager sharedInstance] executeLinkAction: link InAppMessage:inAppMessage];
|
|
171
|
-
successCallback(@[[NSNull null]]);
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
errorCallback(@[@"buttonId does not exist in message."]);
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
errorCallback(@[[NSString stringWithFormat:@"No message with id %@ found", messageId]]);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
RCT_EXPORT_METHOD(applyLogLevel:(NSArray<NSNumber *> *)logLevels) {
|
|
183
|
-
__block NSInteger requestedBitShiftedLogLevel = 0;
|
|
184
|
-
for (NSNumber *logLevel in logLevels) {
|
|
185
|
-
LogLevel plLogLevel = logLevel.integerValue;
|
|
186
|
-
SMLogLevel smLogLevel = [[EnumMapper sharedEnumMapper] smLogLevelForLogLevel:plLogLevel];
|
|
187
|
-
requestedBitShiftedLogLevel = requestedBitShiftedLogLevel | smLogLevel;
|
|
188
|
-
}
|
|
189
|
-
[[SMManager sharedInstance] applyLogLevel:(SMLogLevel) requestedBitShiftedLogLevel];
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
RCT_EXPORT_METHOD(isGeolocationEnabled:(RCTResponseSenderBlock)callback) {
|
|
193
|
-
BOOL enabled = [[SMManager sharedInstance] isGeoLocationEnabled];
|
|
194
|
-
callback(@[@(enabled), [NSNull null]]);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
RCT_EXPORT_METHOD(sendEvent:(NSDictionary *)data successCallback:(RCTResponseSenderBlock)successCallback errorCallback:(RCTResponseSenderBlock)errorCallback) {
|
|
198
|
-
Event *event = [Event fromDictionary:data];
|
|
199
|
-
SMEvent *smEvent = [event smEventWithBlockSuccess:^(SMSuccess *success) {
|
|
200
|
-
successCallback(@[success.messageSM, [NSNull null]]);
|
|
201
|
-
} BlockFailure:^(SMFailure *failure) {
|
|
202
|
-
errorCallback(@[failure.messageSM, [NSNull null]]);
|
|
203
|
-
}];
|
|
204
|
-
[[SMManager sharedInstance] sendSMEvent:smEvent];
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
RCT_EXPORT_METHOD(enableGeolocation:(BOOL)enable) {
|
|
208
|
-
if (enable) {
|
|
209
|
-
[[SMManager sharedInstance] enableGeoLocation];
|
|
210
|
-
} else {
|
|
211
|
-
[[SMManager sharedInstance] disableGeoLocation];
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
RCT_EXPORT_METHOD(forceRemoteNotificationBackgroundFetchResult:(nonnull NSNumber *)remoteNotificationBackgroundFetchResult) {
|
|
216
|
-
self.requestedForcedRemoteNotificationBackgroundFetchResult = @([[EnumMapper sharedEnumMapper] uiBackgroundFetchResultForBackgroundFetchResult:remoteNotificationBackgroundFetchResult.integerValue]);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
RCT_EXPORT_METHOD(getDeviceId:(RCTResponseSenderBlock)callback) {
|
|
220
|
-
NSString *deviceId = [[SMManager sharedInstance] deviceID];
|
|
221
|
-
callback(@[deviceId, [NSNull null]]);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
RCT_EXPORT_METHOD(enableNotifications:(BOOL)enable) {
|
|
225
|
-
if (enable) {
|
|
226
|
-
[[SMManager sharedInstance] registerForRemoteNotification];
|
|
227
|
-
} else {
|
|
228
|
-
[[SMManager sharedInstance] unregisterForRemoteNotification];
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
RCT_EXPORT_METHOD(registerForProvisionalRemoteNotification) {
|
|
233
|
-
if (@available(iOS 12.0, *)) {
|
|
234
|
-
[[SMManager sharedInstance] registerForProvisionalRemoteNotification];
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
RCT_EXPORT_METHOD(displayLastReceivedRemotePushNotification) {
|
|
239
|
-
[[SMManager sharedInstance] displayLastReceivedRemotePushNotification];
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
RCT_EXPORT_METHOD(getLastRemotePushNotification:(RCTResponseSenderBlock)callback) {
|
|
243
|
-
NSDictionary *lastRemotePushNotification = [[SMManager sharedInstance] retrieveLastRemotePushNotification];
|
|
244
|
-
NSDictionary *message = nil;
|
|
245
|
-
if(lastRemotePushNotification) {
|
|
246
|
-
message = @{
|
|
247
|
-
@"id" : lastRemotePushNotification[@"id"],
|
|
248
|
-
@"title" : lastRemotePushNotification[@"title"],
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
callback(@[message ?: [NSNull null], [NSNull null]]);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
RCT_EXPORT_METHOD(displayNotification:(NSString *)notificationId) {
|
|
255
|
-
[[SMManager sharedInstance] displayNotificationID:notificationId];
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
RCT_EXPORT_METHOD(subscribeToEvents) {
|
|
259
|
-
[self _addOrReplaceObserverForSelector:@selector(_handleDidReceiveInAppMessage:) forName:kSMNotification_Event_DidReceiveInAppMessage];
|
|
260
|
-
[self _addOrReplaceObserverForSelector:@selector(_handleButtonClicked:) forName:kSMNotification_Event_ButtonClicked];
|
|
261
|
-
[self _addOrReplaceObserverForSelector:@selector(_handleWillDisplayNotification:) forName:kSMNotification_Event_WillDisplayNotification];
|
|
262
|
-
[self _addOrReplaceObserverForSelector:@selector(_handleWillDismissNotification:) forName:kSMNotification_Event_WillDismissNotification];
|
|
263
|
-
[self _addOrReplaceObserverForSelector:@selector(_handleReceivedDeviceId:) forName:kSMNotification_Data_DeviceId];
|
|
264
|
-
[self _addOrReplaceObserverForSelector:@selector(_handleDidReceiveRemoteNotification:) forName:kSMNotification_Event_DidReceiveRemoteNotification];
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
- (void)_addOrReplaceObserverForSelector:(SEL)selector forName:(NSString *)name {
|
|
268
|
-
[[NSNotificationCenter defaultCenter] removeObserver:self name:name object:nil];
|
|
269
|
-
[[NSNotificationCenter defaultCenter] addObserver:self selector:selector name:name object:nil];
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
#pragma mark - Event Observation
|
|
273
|
-
|
|
274
|
-
- (void)_handleButtonClicked:(NSNotification*)notification {
|
|
275
|
-
NSDictionary *dict = [notification userInfo];
|
|
276
|
-
SMNotificationButtonData *btnData = dict[kSMNotification_Data_ButtonData];
|
|
277
|
-
NSDictionary *data = @{
|
|
278
|
-
@"type": @([[EnumMapper sharedEnumMapper] notificationButtonTypeForSMNotificationButtonType:btnData.type]),
|
|
279
|
-
@"value": btnData.value ?: [NSNull null],
|
|
280
|
-
@"id": btnData.idButtonData ?: [NSNull null],
|
|
281
|
-
@"label": btnData.label ?: [NSNull null],
|
|
282
|
-
};
|
|
283
|
-
[self _sendBroadcastEventResultWithData:data andType:BROADCAST_BUTTON_CLICKED];
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
- (void)_handleDidReceiveInAppMessage:(NSNotification*)notification {
|
|
287
|
-
NSDictionary *dict = [notification userInfo];
|
|
288
|
-
NSArray *inAppMessageData = dict[kSMNotification_Data_InAppMessage];
|
|
289
|
-
NSDictionary *data = @{
|
|
290
|
-
@"messages": inAppMessageData ?: [NSNull null],
|
|
291
|
-
};
|
|
292
|
-
[self _sendBroadcastEventResultWithData:data andType:BROADCAST_RECEIVED_IN_APP_MSG];
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
- (void)_handleDidReceiveRemoteNotification:(NSNotification*)notification {
|
|
296
|
-
NSDictionary *dict = [notification userInfo];
|
|
297
|
-
NSDictionary *notificationData = dict[kSMNotification_Data_RemoteNotification];
|
|
298
|
-
NSDictionary *data = @{
|
|
299
|
-
@"pushId": notificationData[@"pushId"] ?: [NSNull null],
|
|
300
|
-
@"name": notificationData[@"name"] ?: [NSNull null],
|
|
301
|
-
};
|
|
302
|
-
[self _sendBroadcastEventResultWithData:data andType:BROADCAST_RECEIVED_REMOTENOTIFICATION];
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
- (void)_handleWillDisplayNotification:(NSNotification*)notification {
|
|
306
|
-
[self _sendBroadcastEventResultWithData:nil andType:BROADCAST_WILL_DISPLAY_NOTIFICATION];
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
- (void)_handleWillDismissNotification:(NSNotification*)notification {
|
|
310
|
-
[self _sendBroadcastEventResultWithData:nil andType:BROADCAST_WILL_DISMISS_NOTIFICATION];
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
- (void)_handleReceivedDeviceId:(NSNotification*)notification {
|
|
314
|
-
NSDictionary *dict = [notification userInfo];
|
|
315
|
-
NSString *deviceId = [dict objectForKey:kSMNotification_Data_DeviceId];
|
|
316
|
-
NSDictionary *data = @{
|
|
317
|
-
@"deviceId": deviceId
|
|
318
|
-
};
|
|
319
|
-
[self _sendBroadcastEventResultWithData:data andType:BROADCAST_RECEIVED_DEVICE_ID];
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
- (void)_sendBroadcastEventResultWithData:(NSDictionary *)data andType:(NSString *)type {
|
|
323
|
-
[self sendEventWithName:type body:@{@"data": data ?: [NSNull null], @"broadcastEventType": type}];
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
-(NSArray<NSString *> *)supportedEvents {
|
|
327
|
-
return @[
|
|
328
|
-
BROADCAST_BUTTON_CLICKED,
|
|
329
|
-
BROADCAST_RECEIVED_IN_APP_MSG,
|
|
330
|
-
BROADCAST_WILL_DISPLAY_NOTIFICATION,
|
|
331
|
-
BROADCAST_WILL_DISMISS_NOTIFICATION,
|
|
332
|
-
BROADCAST_RECEIVED_REMOTENOTIFICATION,
|
|
333
|
-
FETCHED_REMOTE_NOTIFICATION
|
|
334
|
-
];
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
- (dispatch_queue_t)methodQueue {
|
|
338
|
-
return dispatch_get_main_queue();
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
#pragma mark - Dealloc
|
|
342
|
-
|
|
343
|
-
- (void)dealloc {
|
|
344
|
-
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
@end
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
#import "SMManagerSetting+ClientSettings.h"
|
|
2
|
-
#import "SMManagerSetting+Location.h"
|
|
3
|
-
#import "SMManagerSettingIAM.h"
|
|
4
|
-
#import "ClientSettings.h"
|
|
5
|
-
#import "EnumMapper.h"
|
|
6
|
-
|
|
7
|
-
@implementation SMManagerSetting (ClientSettings)
|
|
8
|
-
|
|
9
|
-
+ (SMManagerSetting *)smManagerSettingsFrom:(ClientSettings *)clientSettings {
|
|
10
|
-
SMManagerSetting *settings = [SMManagerSetting settingWithUrl:clientSettings.url ClientID:clientSettings.clientId PrivateKey:clientSettings.privateKey];
|
|
11
|
-
[self _configureManagerSettings:settings withClientSettings:clientSettings];
|
|
12
|
-
SMManagerSettingIAM *iamSettings = [self _iamManagerSettingsFor:clientSettings];
|
|
13
|
-
if (iamSettings) {
|
|
14
|
-
[settings configureInAppMessageServiceWithSetting:iamSettings];
|
|
15
|
-
}
|
|
16
|
-
return settings;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
+ (void)_configureManagerSettings:(SMManagerSetting *)settings withClientSettings:(ClientSettings *)clientSettings {
|
|
20
|
-
NSString *appGroupId = clientSettings.appGroupId;
|
|
21
|
-
if(appGroupId) {
|
|
22
|
-
if([appGroupId hasPrefix:@"group."]) {
|
|
23
|
-
settings.appGroupId = appGroupId;
|
|
24
|
-
} else {
|
|
25
|
-
settings.appGroupId = [NSString stringWithFormat:@"group.%@", appGroupId];
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
NSNumber *shouldAddInAppMessageFromPushToInAppMessageList = clientSettings.shouldAddInAppMessageFromPushToInAppMessageList;
|
|
30
|
-
if(shouldAddInAppMessageFromPushToInAppMessageList) {
|
|
31
|
-
settings.shouldAddInAppMessageFromPushToInAppMessageList = shouldAddInAppMessageFromPushToInAppMessageList.boolValue;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
NSNumber *shouldClearBadgeAsNumber = clientSettings.shouldClearBadge;
|
|
35
|
-
if(shouldClearBadgeAsNumber) {
|
|
36
|
-
settings.shouldClearBadge = shouldClearBadgeAsNumber.boolValue;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if(clientSettings.configureLocationServices.boolValue) {
|
|
40
|
-
[settings configureLocationService];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
NSNumber *shouldDisplayRemoteNotificationAsNumber = clientSettings.shouldDisplayRemoteNotification;
|
|
44
|
-
if(shouldDisplayRemoteNotificationAsNumber) {
|
|
45
|
-
settings.shouldDisplayRemoteNotification = shouldDisplayRemoteNotificationAsNumber.boolValue;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
NSNumber *clearCacheIntervalValueAsNumber = clientSettings.clearCacheIntervalValue;
|
|
49
|
-
if(clearCacheIntervalValueAsNumber) {
|
|
50
|
-
settings.clearCacheIntervalValue = [[EnumMapper sharedEnumMapper] smClearCacheForClearCacheInterval:clearCacheIntervalValueAsNumber.integerValue]; //((SMClearCache) );
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
NSNumber *remoteMessageDisplayType = clientSettings.remoteMessageDisplayType;
|
|
54
|
-
if(remoteMessageDisplayType) {
|
|
55
|
-
settings.remoteMessageDisplayType = [[EnumMapper sharedEnumMapper] smRemoteMessageDisplayTypeForRemoteMessageDisplayType:remoteMessageDisplayType.integerValue];
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
+ (SMManagerSettingIAM *)_iamManagerSettingsFor:(ClientSettings *)clientSettings {
|
|
60
|
-
SMManagerSettingIAM *iamSettings = nil;
|
|
61
|
-
if(clientSettings.inAppMessageSettings.shouldPerformBackgroundFetch && clientSettings.inAppMessageSettings.refreshType) {
|
|
62
|
-
SMInAppRefreshType refreshType = [[EnumMapper sharedEnumMapper] smInAppRefreshTypeForInAppMessageRefreshType:clientSettings.inAppMessageSettings.refreshType.integerValue];
|
|
63
|
-
iamSettings = [SMManagerSettingIAM settingWithRefreshType:refreshType ShouldPerformBackgroundFetch:clientSettings.inAppMessageSettings.shouldPerformBackgroundFetch.boolValue];
|
|
64
|
-
} else if (clientSettings.inAppMessageSettings.shouldPerformBackgroundFetch) {
|
|
65
|
-
iamSettings = [SMManagerSettingIAM settingWithBackgroundFetchOnly];
|
|
66
|
-
} else if(clientSettings.inAppMessageSettings.refreshType){
|
|
67
|
-
SMInAppRefreshType refreshType = [[EnumMapper sharedEnumMapper] smInAppRefreshTypeForInAppMessageRefreshType:clientSettings.inAppMessageSettings.refreshType.integerValue];
|
|
68
|
-
iamSettings = [SMManagerSettingIAM settingWithRefreshType:refreshType];
|
|
69
|
-
}
|
|
70
|
-
return iamSettings;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
@end
|
package/ios/SelligentLogger.h
DELETED