react-native-mapp-plugin 1.0.4-beta6 → 1.0.4-beta7
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/.idea/React-native-plugin.iml +12 -0
- package/.idea/modules.xml +8 -0
- package/{android/.idea → .idea}/vcs.xml +5 -5
- package/.idea/workspace.xml +85 -0
- package/.vscode/settings.json +2 -2
- package/CustomEvent.js +47 -47
- package/Mapp.js +414 -414
- package/MappEventEmitter.js +41 -41
- package/README.md +93 -93
- package/RNMappPlugin.podspec +29 -29
- package/__package.json +37 -37
- package/android/.classpath +6 -6
- package/android/.project +34 -34
- package/android/.settings/org.eclipse.buildship.core.prefs +13 -13
- package/android/build.gradle +75 -75
- package/android/gradle/wrapper/gradle-wrapper.properties +7 -7
- package/android/gradle.properties +15 -15
- package/android/src/main/AndroidManifest.xml +65 -65
- package/android/src/main/java/com/reactlibrary/ActivityListener.java +43 -43
- package/android/src/main/java/com/reactlibrary/Event.java +28 -28
- package/android/src/main/java/com/reactlibrary/EventEmitter.java +153 -153
- package/android/src/main/java/com/reactlibrary/HelperActivity.java +254 -254
- package/android/src/main/java/com/reactlibrary/IntentNotificationEvent.java +54 -54
- package/android/src/main/java/com/reactlibrary/MessageService.java +21 -21
- package/android/src/main/java/com/reactlibrary/MyPushBroadcastReceiver.java +43 -43
- package/android/src/main/java/com/reactlibrary/PushNotificationEvent.java +37 -37
- package/android/src/main/java/com/reactlibrary/RNMappPluginModule.java +601 -601
- package/android/src/main/java/com/reactlibrary/RNMappPluginPackage.java +34 -34
- package/android/src/main/java/com/reactlibrary/RNUtils.java +191 -191
- package/android/src/main/java/com/reactlibrary/RequestPermissionsTask.java +58 -58
- package/android/src/main/res/values/styles.xml +14 -14
- package/index.js +8 -8
- package/ios/Frameworks/AppoxeeInapp.framework/Versions/A/Headers/APXInBoxMessage.h +101 -101
- package/ios/Frameworks/AppoxeeInapp.framework/Versions/A/Headers/AppoxeeInapp.h +153 -153
- package/ios/Frameworks/AppoxeeInapp.framework/Versions/A/Headers/AppoxeeInappSDK.h +9 -9
- package/ios/Frameworks/AppoxeeLocationServices.framework/Versions/A/Headers/AppoxeeLocationManager.h +122 -122
- package/ios/Frameworks/AppoxeeLocationServices.framework/Versions/A/Headers/AppoxeeLocationServices.h +10 -10
- package/ios/Frameworks/AppoxeeSDK.framework/Versions/A/Headers/APXClientDevice.h +26 -26
- package/ios/Frameworks/AppoxeeSDK.framework/Versions/A/Headers/APXInterfaceService.h +49 -49
- package/ios/Frameworks/AppoxeeSDK.framework/Versions/A/Headers/APXPushNotification.h +92 -92
- package/ios/Frameworks/AppoxeeSDK.framework/Versions/A/Headers/APXPushNotificationAction.h +20 -20
- package/ios/Frameworks/AppoxeeSDK.framework/Versions/A/Headers/APXPushNotificationActionButton.h +19 -19
- package/ios/Frameworks/AppoxeeSDK.framework/Versions/A/Headers/APXPushNotificationActionButtonAction.h +34 -34
- package/ios/Frameworks/AppoxeeSDK.framework/Versions/A/Headers/APXRichMessage.h +58 -58
- package/ios/Frameworks/AppoxeeSDK.framework/Versions/A/Headers/Appoxee.h +840 -840
- package/ios/Frameworks/AppoxeeSDK.framework/Versions/A/Headers/AppoxeeManager.h +385 -385
- package/ios/Frameworks/AppoxeeSDK.framework/Versions/A/Headers/AppoxeeSDK.h +12 -12
- package/ios/Frameworks/AppoxeeSDKResources.bundle/app_conf.json +340 -340
- package/ios/RNMappEventEmmiter.h +25 -25
- package/ios/RNMappEventEmmiter.m +221 -221
- package/ios/RNMappPluginModule.h +10 -10
- package/ios/RNMappPluginModule.m +311 -311
- package/iospatch.sh +13 -13
- package/jsdoc.conf.json +14 -14
- package/package.json +49 -45
- package/android/.gradle/5.6.4/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/5.6.4/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/5.6.4/fileChanges/last-build.bin +0 -0
- package/android/.gradle/5.6.4/fileContent/fileContent.lock +0 -0
- package/android/.gradle/5.6.4/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/5.6.4/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/5.6.4/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/5.6.4/gc.properties +0 -0
- package/android/.gradle/5.6.4/javaCompile/classAnalysis.bin +0 -0
- package/android/.gradle/5.6.4/javaCompile/jarAnalysis.bin +0 -0
- package/android/.gradle/5.6.4/javaCompile/javaCompile.lock +0 -0
- package/android/.gradle/5.6.4/javaCompile/taskHistory.bin +0 -0
- package/android/.gradle/7.0-rc-1/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.0-rc-1/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.0-rc-1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.0-rc-1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.0-rc-1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.0-rc-1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/configuration-cache/gc.properties +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/compiler.xml +0 -6
- package/android/.idea/gradle.xml +0 -21
- package/android/.idea/jarRepositories.xml +0 -35
- package/android/.idea/libraries/Gradle__androidx_activity_activity_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_2_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_2_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_collection_collection_1_1_0.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_0_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_core_core_1_3_1_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_documentfile_documentfile_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_fragment_fragment_1_1_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_ui_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_legacy_legacy_support_v13_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_legacy_legacy_support_v4_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_1_0.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_1_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_1_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_media_media_1_0_1_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_print_print_1_0_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_recyclerview_recyclerview_1_0_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_slidingpanelayout_slidingpanelayout_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__com_facebook_fresco_drawee_0_8_1_aar.xml +0 -15
- package/android/.idea/libraries/Gradle__com_facebook_fresco_fbcore_0_8_1_aar.xml +0 -15
- package/android/.idea/libraries/Gradle__com_facebook_fresco_fresco_0_8_1_aar.xml +0 -15
- package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_0_8_1_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_okhttp_0_8_1_aar.xml +0 -15
- package/android/.idea/libraries/Gradle__com_facebook_react_react_native_0_20_1_aar.xml +0 -19
- package/android/.idea/libraries/Gradle__com_facebook_stetho_stetho_1_2_0.xml +0 -13
- package/android/.idea/libraries/Gradle__com_facebook_stetho_stetho_okhttp_1_2_0.xml +0 -13
- package/android/.idea/libraries/Gradle__com_fasterxml_jackson_core_jackson_core_2_2_3.xml +0 -13
- package/android/.idea/libraries/Gradle__com_google_android_gms_play_services_base_17_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__com_google_android_gms_play_services_basement_17_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__com_google_android_gms_play_services_location_16_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__com_google_android_gms_play_services_places_placereport_16_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__com_google_android_gms_play_services_stats_17_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__com_google_android_gms_play_services_tasks_17_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__com_google_auto_value_auto_value_annotations_1_6_5.xml +0 -13
- package/android/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_3_0_0.xml +0 -13
- package/android/.idea/libraries/Gradle__com_google_code_gson_gson_2_8_5.xml +0 -13
- package/android/.idea/libraries/Gradle__com_google_dagger_dagger_2_24.xml +0 -13
- package/android/.idea/libraries/Gradle__com_google_firebase_firebase_common_19_0_0_aar.xml +0 -15
- package/android/.idea/libraries/Gradle__com_google_firebase_firebase_iid_20_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__com_google_firebase_firebase_iid_interop_17_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__com_google_firebase_firebase_measurement_connector_18_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__com_google_firebase_firebase_messaging_20_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__com_mapp_sdk_mapp_android_6_0_17_special7_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__com_nineoldandroids_library_2_4_0.xml +0 -13
- package/android/.idea/libraries/Gradle__com_parse_bolts_bolts_android_1_1_4.xml +0 -13
- package/android/.idea/libraries/Gradle__com_squareup_okhttp_okhttp_2_5_0.xml +0 -13
- package/android/.idea/libraries/Gradle__com_squareup_okhttp_okhttp_ws_2_5_0.xml +0 -13
- package/android/.idea/libraries/Gradle__com_squareup_okio_okio_1_6_0.xml +0 -13
- package/android/.idea/libraries/Gradle__commons_cli_commons_cli_1_2.xml +0 -13
- package/android/.idea/libraries/Gradle__javax_inject_javax_inject_1.xml +0 -13
- package/android/.idea/libraries/Gradle__org_webkit_android_jsc_r174650_aar.xml +0 -11
- package/android/.idea/misc.xml +0 -9
- package/android/.idea/modules/android.iml +0 -122
- package/android/.idea/modules/app/android.app.iml +0 -26
- package/android/.idea/modules.xml +0 -9
- package/android/build/generated/source/buildConfig/debug/com/reactlibrary/BuildConfig.java +0 -18
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -70
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output.json +0 -1
- package/android/build/intermediates/aar_main_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
- package/android/build/intermediates/annotations_typedef_file/debug/typedefs.txt +0 -0
- package/android/build/intermediates/compile_only_not_namespaced_r_class_jar/debug/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -2993
- package/android/build/intermediates/incremental/debug-mergeJavaRes/merge-state +0 -0
- package/android/build/intermediates/incremental/debug-mergeNativeLibs/merge-state +0 -0
- 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/incremental/packageDebugResources/compile-file-map.properties +0 -1
- package/android/build/intermediates/incremental/packageDebugResources/merged.dir/values/values.xml +0 -13
- package/android/build/intermediates/incremental/packageDebugResources/merger.xml +0 -11
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/ActivityListener.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/BuildConfig.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/Event.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/EventEmitter$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/EventEmitter$2.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/EventEmitter$3.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/EventEmitter.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/HelperActivity$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/HelperActivity$2.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/HelperActivity$ActivityResult.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/HelperActivity.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/IntentNotificationEvent.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/MessageService.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/MyPushBroadcastReceiver.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/PushNotificationEvent.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/RNMappPluginModule$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/RNMappPluginModule$2.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/RNMappPluginModule$3.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/RNMappPluginModule$4.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/RNMappPluginModule.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/RNMappPluginPackage.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/RNUtils$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/RNUtils.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/RequestPermissionsTask$Callback.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/reactlibrary/RequestPermissionsTask.class +0 -0
- package/android/build/intermediates/library_manifest/debug/AndroidManifest.xml +0 -70
- package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +0 -3
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -134
- package/android/build/intermediates/merged_java_res/debug/out.jar +0 -0
- package/android/build/intermediates/merged_manifests/debug/output.json +0 -1
- package/android/build/intermediates/packaged_res/debug/values/values.xml +0 -13
- package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -1856
- package/android/build/outputs/aar/android-debug.aar +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -135
- package/android/local.properties +0 -8
- package/ios/Frameworks/AppoxeeInapp.framework/AppoxeeInapp +0 -1
- package/ios/Frameworks/AppoxeeInapp.framework/Headers +0 -1
- package/ios/Frameworks/AppoxeeInapp.framework/Versions/Current +0 -1
- package/ios/Frameworks/AppoxeeLocationServices.framework/AppoxeeLocationServices +0 -1
- package/ios/Frameworks/AppoxeeLocationServices.framework/Headers +0 -1
- package/ios/Frameworks/AppoxeeLocationServices.framework/Versions/Current +0 -1
- package/ios/Frameworks/AppoxeeSDK.framework/AppoxeeSDK +0 -1
- package/ios/Frameworks/AppoxeeSDK.framework/Headers +0 -1
- package/ios/Frameworks/AppoxeeSDK.framework/Versions/Current +0 -1
package/Mapp.js
CHANGED
|
@@ -1,414 +1,414 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
import { NativeModules, Platform } from "react-native";
|
|
5
|
-
|
|
6
|
-
import CustomEvent from "./CustomEvent.js";
|
|
7
|
-
|
|
8
|
-
import MappEventEmitter from "./MappEventEmitter.js";
|
|
9
|
-
|
|
10
|
-
const { RNMappPluginModule } = NativeModules;
|
|
11
|
-
const EventEmitter = new MappEventEmitter();
|
|
12
|
-
|
|
13
|
-
const IOS_INIT = "com.mapp.init";
|
|
14
|
-
const IOS_INBOX_MESSAGE = "com.mapp.inbox_message_received";
|
|
15
|
-
const IOS_INBOX_MESSAGES = "com.mapp.inbox_messages_received";
|
|
16
|
-
const PUSH_RECEIVED_EVENT = "com.mapp.rich_message_received";
|
|
17
|
-
const MappIntentEvent = "com.mapp.deep_link_received";
|
|
18
|
-
const IOS_RICH_MESSAGE = "com.mapp.rich_message";
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @private
|
|
22
|
-
*/
|
|
23
|
-
function convertEventEnum(type: EventName): ?string {
|
|
24
|
-
if (type === "notificationResponse") {
|
|
25
|
-
return PUSH_RECEIVED_EVENT;
|
|
26
|
-
} else if (type === "deepLink") {
|
|
27
|
-
return MappIntentEvent;
|
|
28
|
-
} else if (type === "iosSDKInit") {
|
|
29
|
-
return IOS_INIT;
|
|
30
|
-
} else if (type === "iosInboxMessages") {
|
|
31
|
-
return IOS_INBOX_MESSAGES;
|
|
32
|
-
} else if (type === "iosInboxMessage") {
|
|
33
|
-
return IOS_INBOX_MESSAGE;
|
|
34
|
-
} else if (type === "iosRichMessage") {
|
|
35
|
-
return IOS_RICH_MESSAGE;
|
|
36
|
-
}
|
|
37
|
-
throw new Error("Invalid event name: " + type);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export type EventName = $Enum<{
|
|
41
|
-
notificationResponse: string,
|
|
42
|
-
deepLink: string,
|
|
43
|
-
iosSDKInit: string,
|
|
44
|
-
iosInboxMessages: string,
|
|
45
|
-
iosInboxMessage: string,
|
|
46
|
-
iosRichMessage: string,
|
|
47
|
-
}>;
|
|
48
|
-
|
|
49
|
-
export class Mapp {
|
|
50
|
-
/**
|
|
51
|
-
* Sets firebase token
|
|
52
|
-
*
|
|
53
|
-
* @param token
|
|
54
|
-
*/
|
|
55
|
-
static setToken(token: string) {
|
|
56
|
-
RNMappPluginModule.setToken(token);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Show notification
|
|
61
|
-
*
|
|
62
|
-
* @param {remoteMessage} push message received
|
|
63
|
-
*/
|
|
64
|
-
static setRemoteMessage(remoteMessage: Any) {
|
|
65
|
-
RNMappPluginModule.setRemoteMessage(JSON.stringify(remoteMessage));
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Check if firebase push message is from MAPP or not
|
|
70
|
-
* @param {*} remoteMessage
|
|
71
|
-
* @returns Promise with true if push message is from MAPP, otherwise false
|
|
72
|
-
*/
|
|
73
|
-
static isPushFromMapp(remoteMessage: RemoteMessage): Promise<Boolean> {
|
|
74
|
-
return RNMappPluginModule.isPushFromMapp(JSON.stringify(remoteMessage));
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Sets user alias
|
|
79
|
-
*
|
|
80
|
-
* @param alias
|
|
81
|
-
*/
|
|
82
|
-
static setAlias(alias: string) {
|
|
83
|
-
RNMappPluginModule.setAlias(alias);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* getAlias
|
|
88
|
-
*
|
|
89
|
-
*/
|
|
90
|
-
|
|
91
|
-
static getAlias(): Promise<String> {
|
|
92
|
-
return RNMappPluginModule.getAlias();
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Engage
|
|
97
|
-
*
|
|
98
|
-
* @return {Promise.<string>} A promise with the result.
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
|
-
static engage2() {
|
|
102
|
-
if (Platform.OS == "android") {
|
|
103
|
-
return RNMappPluginModule.engage2();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Engage
|
|
109
|
-
*
|
|
110
|
-
*/
|
|
111
|
-
|
|
112
|
-
static engage(
|
|
113
|
-
sdkKey: string,
|
|
114
|
-
googleProjectId: string,
|
|
115
|
-
server: string,
|
|
116
|
-
appID: string,
|
|
117
|
-
tenantID: string
|
|
118
|
-
) {
|
|
119
|
-
if (Platform.OS == "ios") {
|
|
120
|
-
RNMappPluginModule.engageInapp(server);
|
|
121
|
-
return RNMappPluginModule.autoengage(server);
|
|
122
|
-
}
|
|
123
|
-
return RNMappPluginModule.engage(
|
|
124
|
-
sdkKey,
|
|
125
|
-
googleProjectId,
|
|
126
|
-
server,
|
|
127
|
-
appID,
|
|
128
|
-
tenantID
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* On Init Completed Listener
|
|
134
|
-
*
|
|
135
|
-
* @return {Promise.<boolean>} A promise with the result.
|
|
136
|
-
*/
|
|
137
|
-
static onInitCompletedListener(): Promise<boolean> {
|
|
138
|
-
if (Platform.OS == "android") {
|
|
139
|
-
return RNMappPluginModule.onInitCompletedListener();
|
|
140
|
-
}
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
*
|
|
146
|
-
* Checks is sdk ready.
|
|
147
|
-
*
|
|
148
|
-
* @return {Promise.<boolean>} A promise with the result.
|
|
149
|
-
*/
|
|
150
|
-
static isReady(): Promise<boolean> {
|
|
151
|
-
return RNMappPluginModule.isReady();
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
*
|
|
156
|
-
* Checks if user notifications are enabled or not.
|
|
157
|
-
*
|
|
158
|
-
* @return {Promise.<boolean>} A promise with the result.
|
|
159
|
-
*/
|
|
160
|
-
static isPushEnabled(): Promise<boolean> {
|
|
161
|
-
return RNMappPluginModule.isPushEnabled();
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Enables user notifications.
|
|
166
|
-
*/
|
|
167
|
-
static setPushEnabled(optIn: boolean) {
|
|
168
|
-
return RNMappPluginModule.setPushEnabled(optIn);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Set Custom Attribute
|
|
173
|
-
*
|
|
174
|
-
*/
|
|
175
|
-
static setAttributeString(key: string, value: string) {
|
|
176
|
-
return RNMappPluginModule.setAttribute(key, value);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Set Custom Attribute
|
|
181
|
-
*
|
|
182
|
-
*/
|
|
183
|
-
static setAttributeInt(key: string, value: number) {
|
|
184
|
-
return RNMappPluginModule.setAttributeInt(key, value);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Remove Custom Attribute
|
|
189
|
-
* TODO: it is andoid only function
|
|
190
|
-
*/
|
|
191
|
-
static removeAttribute(key: string) {
|
|
192
|
-
if (Platform.OS == "android") {
|
|
193
|
-
return RNMappPluginModule.removeAttribute(key);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Removes a tag.
|
|
199
|
-
*
|
|
200
|
-
* @param {string} tag A channel tag.
|
|
201
|
-
*/
|
|
202
|
-
static removeTag(tag: string) {
|
|
203
|
-
RNMappPluginModule.removeTag(tag);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Adds a tag.
|
|
208
|
-
*
|
|
209
|
-
* @param {string} tag A channel tag.
|
|
210
|
-
*/
|
|
211
|
-
static addTag(tag: string) {
|
|
212
|
-
RNMappPluginModule.addTag(tag);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// static removeTags(tag: string) {
|
|
216
|
-
// RNMappPluginModule.removeTag(tag);
|
|
217
|
-
// }
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Gets the channel tags.
|
|
221
|
-
*
|
|
222
|
-
* @return {Promise.<Array>} A promise with the result.
|
|
223
|
-
*/
|
|
224
|
-
static getTags(): Promise<Array<string>> {
|
|
225
|
-
return RNMappPluginModule.getTags();
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
static getDeviceInfo(): Promise<Object> {
|
|
229
|
-
return RNMappPluginModule.getDeviceInfo();
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
static getAttributeStringValue(value: string): Promise<string> {
|
|
233
|
-
return RNMappPluginModule.getAttributeStringValue(value);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
static lockScreenOrientation(value: boolean) {
|
|
237
|
-
if (Platform.OS == "android") {
|
|
238
|
-
return RNMappPluginModule.lockScreenOrientation(value);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
static removeBadgeNumber() {
|
|
243
|
-
return RNMappPluginModule.removeBadgeNumber();
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
static startGeoFencing() {
|
|
247
|
-
return RNMappPluginModule.startGeoFencing();
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
static stopGeoFencing() {
|
|
251
|
-
return RNMappPluginModule.stopGeoFencing();
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
static fetchInboxMessage(): Promise<any> {
|
|
255
|
-
return RNMappPluginModule.fetchInboxMessage();
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
static triggerInApp(value: string) {
|
|
259
|
-
return RNMappPluginModule.triggerInApp(value);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
static inAppMarkAsRead(templateId: number, eventId: string) {
|
|
263
|
-
return RNMappPluginModule.inAppMarkAsRead(templateId, eventId);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
static inAppMarkAsUnRead(templateId: number, eventId: string) {
|
|
267
|
-
return RNMappPluginModule.inAppMarkAsUnRead(templateId, eventId);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
static inAppMarkAsDeleted(templateId: number, eventId: string) {
|
|
271
|
-
return RNMappPluginModule.inAppMarkAsDeleted(templateId, eventId);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
static triggerStatistic(
|
|
275
|
-
templateId: number,
|
|
276
|
-
originalEventId: string,
|
|
277
|
-
trackingKey: string,
|
|
278
|
-
displayMillis: number,
|
|
279
|
-
reason: string,
|
|
280
|
-
link
|
|
281
|
-
): string {
|
|
282
|
-
if (Platform.OS == "android") {
|
|
283
|
-
return RNMappPluginModule.triggerStatistic(
|
|
284
|
-
templateId,
|
|
285
|
-
originalEventId,
|
|
286
|
-
trackingKey,
|
|
287
|
-
displayMillis,
|
|
288
|
-
reason,
|
|
289
|
-
link
|
|
290
|
-
);
|
|
291
|
-
}
|
|
292
|
-
return null;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
static isDeviceRegistered(): Promise<boolean> {
|
|
296
|
-
return RNMappPluginModule.isDeviceRegistered(value);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
static incrementNumericKey(key: String, value: number) {
|
|
300
|
-
if (Platform.OS == "ios") {
|
|
301
|
-
return RNMappPluginModule.incrementNumericKey(key, value);
|
|
302
|
-
}
|
|
303
|
-
return null;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
static logOut(pushEnabled: Boolean) {
|
|
307
|
-
return RNMappPluginModule.logOut(pushEnabled);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* Adds a custom event.
|
|
312
|
-
*
|
|
313
|
-
* @param {CustomEvent} event The custom event.
|
|
314
|
-
* @return {Promise.<null, Error>} A promise that returns null if resolved, or an Error if the
|
|
315
|
-
* custom event is rejected.
|
|
316
|
-
*/
|
|
317
|
-
static addCustomEvent(event: CustomEvent): Promise {
|
|
318
|
-
var actionArg = {
|
|
319
|
-
event_name: event._name,
|
|
320
|
-
event_value: event._value,
|
|
321
|
-
transaction_id: event._transactionId,
|
|
322
|
-
properties: event._properties,
|
|
323
|
-
};
|
|
324
|
-
|
|
325
|
-
return new Promise((resolve, reject) => {
|
|
326
|
-
RNMappPluginModule.runAction("add_custom_event_action", actionArg).then(
|
|
327
|
-
() => {
|
|
328
|
-
resolve();
|
|
329
|
-
},
|
|
330
|
-
(error) => {
|
|
331
|
-
reject(error);
|
|
332
|
-
}
|
|
333
|
-
);
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
static runAction(name: string, value: ?any): Promise<any> {
|
|
338
|
-
if (Platform.OS == "android") {
|
|
339
|
-
return RNMappPluginModule.runAction(name, value);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
static addPushListener(listener: Function): EmitterSubscription {
|
|
344
|
-
return this.addListener("notificationResponse", listener);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
static addDeepLinkingListener(listener: Function): EmitterSubscription {
|
|
348
|
-
return this.addListener("deepLink", listener);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
static addInitListener(listener: Function): EmitterSubscription {
|
|
352
|
-
if (Platform.OS == "ios") {
|
|
353
|
-
return this.addListener("iosSDKInit", listener);
|
|
354
|
-
}
|
|
355
|
-
return null;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
static addInboxMessagesListener(listener: Function): EmitterSubscription {
|
|
359
|
-
if (Platform.OS == "ios") {
|
|
360
|
-
return this.addListener("iosInboxMessages", listener);
|
|
361
|
-
}
|
|
362
|
-
return null;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
static addInboxMessageListener(listener: Function): EmitterSubscription {
|
|
366
|
-
if (Platform.OS == "ios") {
|
|
367
|
-
return this.addListener("iosInboxMessage", listener);
|
|
368
|
-
}
|
|
369
|
-
return null;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
static addRichMessagesListener(listener: Function): EmitterSubscription {
|
|
373
|
-
if (Platform.OS == "ios") {
|
|
374
|
-
return this.addListener("iosRichMessage", listener);
|
|
375
|
-
}
|
|
376
|
-
return null;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
static removePushListener(listener: Function): EmitterSubscription {
|
|
380
|
-
return this.removeListener("notificationResponse", listener);
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
static removeDeepLinkingListener(listener: Function): EmitterSubscription {
|
|
384
|
-
return this.removeListener("deepLink", listener);
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
static addListener(
|
|
388
|
-
eventName: EventName,
|
|
389
|
-
listener: Function
|
|
390
|
-
): EmitterSubscription {
|
|
391
|
-
let name = convertEventEnum(eventName);
|
|
392
|
-
return EventEmitter.addListener(name, listener);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
static removeListener(eventName: EventName, listener: Function) {
|
|
396
|
-
let name = convertEventEnum(eventName);
|
|
397
|
-
EventEmitter.removeListener(name, listener);
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* Clears all notifications for the application.
|
|
402
|
-
* Supported on Android and iOS 10+. For older iOS devices, you can set
|
|
403
|
-
* the badge number to 0 to clear notifications.
|
|
404
|
-
*/
|
|
405
|
-
static clearNotifications() {
|
|
406
|
-
RNMappPluginModule.clearNotifications();
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
static clearNotification(identifier: string) {
|
|
410
|
-
RNMappPluginModule.clearNotification(identifier);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
module.exports = Mapp;
|
|
1
|
+
// @flow
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
import { NativeModules, Platform } from "react-native";
|
|
5
|
+
|
|
6
|
+
import CustomEvent from "./CustomEvent.js";
|
|
7
|
+
|
|
8
|
+
import MappEventEmitter from "./MappEventEmitter.js";
|
|
9
|
+
|
|
10
|
+
const { RNMappPluginModule } = NativeModules;
|
|
11
|
+
const EventEmitter = new MappEventEmitter();
|
|
12
|
+
|
|
13
|
+
const IOS_INIT = "com.mapp.init";
|
|
14
|
+
const IOS_INBOX_MESSAGE = "com.mapp.inbox_message_received";
|
|
15
|
+
const IOS_INBOX_MESSAGES = "com.mapp.inbox_messages_received";
|
|
16
|
+
const PUSH_RECEIVED_EVENT = "com.mapp.rich_message_received";
|
|
17
|
+
const MappIntentEvent = "com.mapp.deep_link_received";
|
|
18
|
+
const IOS_RICH_MESSAGE = "com.mapp.rich_message";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
function convertEventEnum(type: EventName): ?string {
|
|
24
|
+
if (type === "notificationResponse") {
|
|
25
|
+
return PUSH_RECEIVED_EVENT;
|
|
26
|
+
} else if (type === "deepLink") {
|
|
27
|
+
return MappIntentEvent;
|
|
28
|
+
} else if (type === "iosSDKInit") {
|
|
29
|
+
return IOS_INIT;
|
|
30
|
+
} else if (type === "iosInboxMessages") {
|
|
31
|
+
return IOS_INBOX_MESSAGES;
|
|
32
|
+
} else if (type === "iosInboxMessage") {
|
|
33
|
+
return IOS_INBOX_MESSAGE;
|
|
34
|
+
} else if (type === "iosRichMessage") {
|
|
35
|
+
return IOS_RICH_MESSAGE;
|
|
36
|
+
}
|
|
37
|
+
throw new Error("Invalid event name: " + type);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type EventName = $Enum<{
|
|
41
|
+
notificationResponse: string,
|
|
42
|
+
deepLink: string,
|
|
43
|
+
iosSDKInit: string,
|
|
44
|
+
iosInboxMessages: string,
|
|
45
|
+
iosInboxMessage: string,
|
|
46
|
+
iosRichMessage: string,
|
|
47
|
+
}>;
|
|
48
|
+
|
|
49
|
+
export class Mapp {
|
|
50
|
+
/**
|
|
51
|
+
* Sets firebase token
|
|
52
|
+
*
|
|
53
|
+
* @param token
|
|
54
|
+
*/
|
|
55
|
+
static setToken(token: string) {
|
|
56
|
+
RNMappPluginModule.setToken(token);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Show notification
|
|
61
|
+
*
|
|
62
|
+
* @param {remoteMessage} push message received
|
|
63
|
+
*/
|
|
64
|
+
static setRemoteMessage(remoteMessage: Any) {
|
|
65
|
+
RNMappPluginModule.setRemoteMessage(JSON.stringify(remoteMessage));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Check if firebase push message is from MAPP or not
|
|
70
|
+
* @param {*} remoteMessage
|
|
71
|
+
* @returns Promise with true if push message is from MAPP, otherwise false
|
|
72
|
+
*/
|
|
73
|
+
static isPushFromMapp(remoteMessage: RemoteMessage): Promise<Boolean> {
|
|
74
|
+
return RNMappPluginModule.isPushFromMapp(JSON.stringify(remoteMessage));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Sets user alias
|
|
79
|
+
*
|
|
80
|
+
* @param alias
|
|
81
|
+
*/
|
|
82
|
+
static setAlias(alias: string) {
|
|
83
|
+
RNMappPluginModule.setAlias(alias);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* getAlias
|
|
88
|
+
*
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
static getAlias(): Promise<String> {
|
|
92
|
+
return RNMappPluginModule.getAlias();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Engage
|
|
97
|
+
*
|
|
98
|
+
* @return {Promise.<string>} A promise with the result.
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
static engage2() {
|
|
102
|
+
if (Platform.OS == "android") {
|
|
103
|
+
return RNMappPluginModule.engage2();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Engage
|
|
109
|
+
*
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
static engage(
|
|
113
|
+
sdkKey: string,
|
|
114
|
+
googleProjectId: string,
|
|
115
|
+
server: string,
|
|
116
|
+
appID: string,
|
|
117
|
+
tenantID: string
|
|
118
|
+
) {
|
|
119
|
+
if (Platform.OS == "ios") {
|
|
120
|
+
RNMappPluginModule.engageInapp(server);
|
|
121
|
+
return RNMappPluginModule.autoengage(server);
|
|
122
|
+
}
|
|
123
|
+
return RNMappPluginModule.engage(
|
|
124
|
+
sdkKey,
|
|
125
|
+
googleProjectId,
|
|
126
|
+
server,
|
|
127
|
+
appID,
|
|
128
|
+
tenantID
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* On Init Completed Listener
|
|
134
|
+
*
|
|
135
|
+
* @return {Promise.<boolean>} A promise with the result.
|
|
136
|
+
*/
|
|
137
|
+
static onInitCompletedListener(): Promise<boolean> {
|
|
138
|
+
if (Platform.OS == "android") {
|
|
139
|
+
return RNMappPluginModule.onInitCompletedListener();
|
|
140
|
+
}
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
*
|
|
146
|
+
* Checks is sdk ready.
|
|
147
|
+
*
|
|
148
|
+
* @return {Promise.<boolean>} A promise with the result.
|
|
149
|
+
*/
|
|
150
|
+
static isReady(): Promise<boolean> {
|
|
151
|
+
return RNMappPluginModule.isReady();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
*
|
|
156
|
+
* Checks if user notifications are enabled or not.
|
|
157
|
+
*
|
|
158
|
+
* @return {Promise.<boolean>} A promise with the result.
|
|
159
|
+
*/
|
|
160
|
+
static isPushEnabled(): Promise<boolean> {
|
|
161
|
+
return RNMappPluginModule.isPushEnabled();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Enables user notifications.
|
|
166
|
+
*/
|
|
167
|
+
static setPushEnabled(optIn: boolean) {
|
|
168
|
+
return RNMappPluginModule.setPushEnabled(optIn);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Set Custom Attribute
|
|
173
|
+
*
|
|
174
|
+
*/
|
|
175
|
+
static setAttributeString(key: string, value: string) {
|
|
176
|
+
return RNMappPluginModule.setAttribute(key, value);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Set Custom Attribute
|
|
181
|
+
*
|
|
182
|
+
*/
|
|
183
|
+
static setAttributeInt(key: string, value: number) {
|
|
184
|
+
return RNMappPluginModule.setAttributeInt(key, value);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Remove Custom Attribute
|
|
189
|
+
* TODO: it is andoid only function
|
|
190
|
+
*/
|
|
191
|
+
static removeAttribute(key: string) {
|
|
192
|
+
if (Platform.OS == "android") {
|
|
193
|
+
return RNMappPluginModule.removeAttribute(key);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Removes a tag.
|
|
199
|
+
*
|
|
200
|
+
* @param {string} tag A channel tag.
|
|
201
|
+
*/
|
|
202
|
+
static removeTag(tag: string) {
|
|
203
|
+
RNMappPluginModule.removeTag(tag);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Adds a tag.
|
|
208
|
+
*
|
|
209
|
+
* @param {string} tag A channel tag.
|
|
210
|
+
*/
|
|
211
|
+
static addTag(tag: string) {
|
|
212
|
+
RNMappPluginModule.addTag(tag);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// static removeTags(tag: string) {
|
|
216
|
+
// RNMappPluginModule.removeTag(tag);
|
|
217
|
+
// }
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Gets the channel tags.
|
|
221
|
+
*
|
|
222
|
+
* @return {Promise.<Array>} A promise with the result.
|
|
223
|
+
*/
|
|
224
|
+
static getTags(): Promise<Array<string>> {
|
|
225
|
+
return RNMappPluginModule.getTags();
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
static getDeviceInfo(): Promise<Object> {
|
|
229
|
+
return RNMappPluginModule.getDeviceInfo();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
static getAttributeStringValue(value: string): Promise<string> {
|
|
233
|
+
return RNMappPluginModule.getAttributeStringValue(value);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
static lockScreenOrientation(value: boolean) {
|
|
237
|
+
if (Platform.OS == "android") {
|
|
238
|
+
return RNMappPluginModule.lockScreenOrientation(value);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
static removeBadgeNumber() {
|
|
243
|
+
return RNMappPluginModule.removeBadgeNumber();
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
static startGeoFencing() {
|
|
247
|
+
return RNMappPluginModule.startGeoFencing();
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
static stopGeoFencing() {
|
|
251
|
+
return RNMappPluginModule.stopGeoFencing();
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
static fetchInboxMessage(): Promise<any> {
|
|
255
|
+
return RNMappPluginModule.fetchInboxMessage();
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
static triggerInApp(value: string) {
|
|
259
|
+
return RNMappPluginModule.triggerInApp(value);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
static inAppMarkAsRead(templateId: number, eventId: string) {
|
|
263
|
+
return RNMappPluginModule.inAppMarkAsRead(templateId, eventId);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
static inAppMarkAsUnRead(templateId: number, eventId: string) {
|
|
267
|
+
return RNMappPluginModule.inAppMarkAsUnRead(templateId, eventId);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
static inAppMarkAsDeleted(templateId: number, eventId: string) {
|
|
271
|
+
return RNMappPluginModule.inAppMarkAsDeleted(templateId, eventId);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
static triggerStatistic(
|
|
275
|
+
templateId: number,
|
|
276
|
+
originalEventId: string,
|
|
277
|
+
trackingKey: string,
|
|
278
|
+
displayMillis: number,
|
|
279
|
+
reason: string,
|
|
280
|
+
link
|
|
281
|
+
): string {
|
|
282
|
+
if (Platform.OS == "android") {
|
|
283
|
+
return RNMappPluginModule.triggerStatistic(
|
|
284
|
+
templateId,
|
|
285
|
+
originalEventId,
|
|
286
|
+
trackingKey,
|
|
287
|
+
displayMillis,
|
|
288
|
+
reason,
|
|
289
|
+
link
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
static isDeviceRegistered(): Promise<boolean> {
|
|
296
|
+
return RNMappPluginModule.isDeviceRegistered(value);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
static incrementNumericKey(key: String, value: number) {
|
|
300
|
+
if (Platform.OS == "ios") {
|
|
301
|
+
return RNMappPluginModule.incrementNumericKey(key, value);
|
|
302
|
+
}
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
static logOut(pushEnabled: Boolean) {
|
|
307
|
+
return RNMappPluginModule.logOut(pushEnabled);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Adds a custom event.
|
|
312
|
+
*
|
|
313
|
+
* @param {CustomEvent} event The custom event.
|
|
314
|
+
* @return {Promise.<null, Error>} A promise that returns null if resolved, or an Error if the
|
|
315
|
+
* custom event is rejected.
|
|
316
|
+
*/
|
|
317
|
+
static addCustomEvent(event: CustomEvent): Promise {
|
|
318
|
+
var actionArg = {
|
|
319
|
+
event_name: event._name,
|
|
320
|
+
event_value: event._value,
|
|
321
|
+
transaction_id: event._transactionId,
|
|
322
|
+
properties: event._properties,
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
return new Promise((resolve, reject) => {
|
|
326
|
+
RNMappPluginModule.runAction("add_custom_event_action", actionArg).then(
|
|
327
|
+
() => {
|
|
328
|
+
resolve();
|
|
329
|
+
},
|
|
330
|
+
(error) => {
|
|
331
|
+
reject(error);
|
|
332
|
+
}
|
|
333
|
+
);
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
static runAction(name: string, value: ?any): Promise<any> {
|
|
338
|
+
if (Platform.OS == "android") {
|
|
339
|
+
return RNMappPluginModule.runAction(name, value);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
static addPushListener(listener: Function): EmitterSubscription {
|
|
344
|
+
return this.addListener("notificationResponse", listener);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
static addDeepLinkingListener(listener: Function): EmitterSubscription {
|
|
348
|
+
return this.addListener("deepLink", listener);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
static addInitListener(listener: Function): EmitterSubscription {
|
|
352
|
+
if (Platform.OS == "ios") {
|
|
353
|
+
return this.addListener("iosSDKInit", listener);
|
|
354
|
+
}
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
static addInboxMessagesListener(listener: Function): EmitterSubscription {
|
|
359
|
+
if (Platform.OS == "ios") {
|
|
360
|
+
return this.addListener("iosInboxMessages", listener);
|
|
361
|
+
}
|
|
362
|
+
return null;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
static addInboxMessageListener(listener: Function): EmitterSubscription {
|
|
366
|
+
if (Platform.OS == "ios") {
|
|
367
|
+
return this.addListener("iosInboxMessage", listener);
|
|
368
|
+
}
|
|
369
|
+
return null;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
static addRichMessagesListener(listener: Function): EmitterSubscription {
|
|
373
|
+
if (Platform.OS == "ios") {
|
|
374
|
+
return this.addListener("iosRichMessage", listener);
|
|
375
|
+
}
|
|
376
|
+
return null;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
static removePushListener(listener: Function): EmitterSubscription {
|
|
380
|
+
return this.removeListener("notificationResponse", listener);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
static removeDeepLinkingListener(listener: Function): EmitterSubscription {
|
|
384
|
+
return this.removeListener("deepLink", listener);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
static addListener(
|
|
388
|
+
eventName: EventName,
|
|
389
|
+
listener: Function
|
|
390
|
+
): EmitterSubscription {
|
|
391
|
+
let name = convertEventEnum(eventName);
|
|
392
|
+
return EventEmitter.addListener(name, listener);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
static removeListener(eventName: EventName, listener: Function) {
|
|
396
|
+
let name = convertEventEnum(eventName);
|
|
397
|
+
EventEmitter.removeListener(name, listener);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Clears all notifications for the application.
|
|
402
|
+
* Supported on Android and iOS 10+. For older iOS devices, you can set
|
|
403
|
+
* the badge number to 0 to clear notifications.
|
|
404
|
+
*/
|
|
405
|
+
static clearNotifications() {
|
|
406
|
+
RNMappPluginModule.clearNotifications();
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
static clearNotification(identifier: string) {
|
|
410
|
+
RNMappPluginModule.clearNotification(identifier);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
module.exports = Mapp;
|