react-native-mapp-plugin 1.3.6 → 1.4.1
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/CHANGELOG.md +19 -10
- package/Mapp.js +27 -4
- package/MappEventEmitter.js +4 -1
- package/RNMappPlugin.podspec +3 -4
- package/android/build.gradle +40 -20
- package/android/gradle/gradle-daemon-jvm.properties +12 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/gradle.properties +0 -2
- package/android/gradlew +18 -0
- package/android/gradlew.bat +15 -0
- package/android/settings.gradle +2 -4
- package/android/src/main/java/com/reactlibrary/ActivityListener.java +2 -4
- package/android/src/main/java/com/reactlibrary/HelperActivity.java +2 -2
- package/android/src/main/java/com/reactlibrary/MessageService.java +15 -10
- package/android/src/main/java/com/reactlibrary/MyPushBroadcastReceiver.java +29 -22
- package/android/src/main/java/com/reactlibrary/NativeRNMappPluginModuleSpec.java +232 -0
- package/android/src/main/java/com/reactlibrary/PushNotificationEvent.java +3 -3
- package/android/src/main/java/com/reactlibrary/RNMappPluginModule.java +525 -402
- package/android/src/main/java/com/reactlibrary/RNMappPluginPackage.java +9 -14
- package/android/src/main/java/com/reactlibrary/RNUtils.java +16 -16
- package/android/src/main/jni/CMakeLists.txt +28 -0
- package/android/src/main/jni/RNMappPlugin-generated.cpp +320 -0
- package/android/src/main/jni/RNMappPlugin.h +31 -0
- package/android/src/main/jni/react/renderer/components/RNMappPlugin/RNMappPluginJSI.h +471 -0
- package/ios/Frameworks/AppoxeeInapp.xcframework/Info.plist +5 -5
- package/ios/Frameworks/AppoxeeInapp.xcframework/ios-arm64/libAppoxeeInapp.a +0 -0
- package/ios/Frameworks/AppoxeeInapp.xcframework/ios-arm64_x86_64-simulator/libAppoxeeInapp.a +0 -0
- package/ios/Frameworks/AppoxeeSDK.xcframework/ios-arm64/libAppoxeeSDK.a +0 -0
- package/ios/Frameworks/AppoxeeSDK.xcframework/ios-arm64_x86_64-simulator/libAppoxeeSDK.a +0 -0
- package/package.json +65 -12
- package/react-native.config.js +6 -3
- package/specs/NativeRNMappPluginModule.js +59 -0
- package/.gitattributes +0 -1
- package/.local-pack/settings.json +0 -1
- package/.vscode/settings.json +0 -4
- package/Helper.md +0 -23
- package/__package.json +0 -33
- package/android/.classpath +0 -6
- package/android/.project +0 -34
- package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
- package/clean.sh +0 -34
- package/ios/RNMappPlugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/RNMappPlugin.xcodeproj/project.xcworkspace/xcuserdata/stefan.stevanovic.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/RNMappPlugin.xcodeproj/xcuserdata/stefan.stevanovic.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/jsdoc.conf.json +0 -15
- package/react-native-mapp-plugin-1.3.8.tgz +0 -0
- package/specs/MappEngagePluginSpec.js +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,21 +1,30 @@
|
|
|
1
|
-
## Version 1.
|
|
1
|
+
## Version 1.4.1
|
|
2
|
+
|
|
3
|
+
***Dependency Updates***
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
- Android: Aligned with Mapp Engage Android SDK 7.1.1.
|
|
6
|
+
- iOS: Aligned with Mapp Engage Inapp iOS SDK 6.0.11, which provides improved in-app statistics.
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
***Architecture***
|
|
6
9
|
|
|
7
|
-
-
|
|
10
|
+
- Android: Updated plugin to support New Architecture (TurboModule).
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
## Version 1.4.0
|
|
10
13
|
|
|
11
|
-
***
|
|
14
|
+
***Bug Fixes***
|
|
12
15
|
|
|
13
|
-
-
|
|
16
|
+
- Android: `requestPostNotificationPermission` now requests the runtime notification permission instead of only checking its current state.
|
|
17
|
+
- Android: If the runtime prompt is unavailable or the permission is blocked, the plugin now opens the app notification settings screen and resolves the promise in every path.
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
***Dependency Updates***
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
- Aligned with Mapp Engage Android SDK 7.0.2.
|
|
22
|
+
|
|
23
|
+
## Version 1.3.6
|
|
24
|
+
|
|
25
|
+
***Dependency Updates***
|
|
26
|
+
|
|
27
|
+
-Aligned with Mapp Engage iOS SDK 6.1.3
|
|
19
28
|
|
|
20
29
|
## Version 1.3.5
|
|
21
30
|
|
package/Mapp.js
CHANGED
|
@@ -6,8 +6,10 @@ import { NativeModules, Platform } from "react-native";
|
|
|
6
6
|
import CustomEvent from "./CustomEvent.js";
|
|
7
7
|
|
|
8
8
|
import MappEventEmitter from "./MappEventEmitter.js";
|
|
9
|
+
import NativeRNMappPluginModule from "./specs/NativeRNMappPluginModule";
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
+
const RNMappPluginModule =
|
|
12
|
+
NativeRNMappPluginModule || NativeModules.RNMappPluginModule;
|
|
11
13
|
const EventEmitter = new MappEventEmitter();
|
|
12
14
|
|
|
13
15
|
const IOS_INIT = "com.mapp.init";
|
|
@@ -142,6 +144,26 @@ export class Mapp {
|
|
|
142
144
|
);
|
|
143
145
|
}
|
|
144
146
|
|
|
147
|
+
static engageTestServer(
|
|
148
|
+
cepUrl: string,
|
|
149
|
+
sdkKey: string,
|
|
150
|
+
googleProjectId: string,
|
|
151
|
+
server: string,
|
|
152
|
+
appID: string,
|
|
153
|
+
tenantID: string
|
|
154
|
+
) {
|
|
155
|
+
if (Platform.OS == "android") {
|
|
156
|
+
return RNMappPluginModule.engageTestServer(
|
|
157
|
+
cepUrl,
|
|
158
|
+
sdkKey,
|
|
159
|
+
googleProjectId,
|
|
160
|
+
server,
|
|
161
|
+
appID,
|
|
162
|
+
tenantID
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
145
167
|
/**
|
|
146
168
|
* On Init Completed Listener
|
|
147
169
|
*
|
|
@@ -409,9 +431,10 @@ export class Mapp {
|
|
|
409
431
|
}
|
|
410
432
|
|
|
411
433
|
/**
|
|
412
|
-
*
|
|
413
|
-
* If
|
|
414
|
-
*
|
|
434
|
+
* Requests notification permission on Android 13 and up.
|
|
435
|
+
* If the runtime prompt is unavailable or the permission is blocked, native code
|
|
436
|
+
* falls back to opening the app notification settings screen.
|
|
437
|
+
* @returns true if permission is already granted or the user grants it, false otherwise
|
|
415
438
|
*/
|
|
416
439
|
static requestPostNotificationPermission(): Promise<any> {
|
|
417
440
|
if (Platform.OS == "android") {
|
package/MappEventEmitter.js
CHANGED
|
@@ -7,7 +7,10 @@ import {
|
|
|
7
7
|
Platform
|
|
8
8
|
} from 'react-native';
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
import NativeRNMappPluginModule from './specs/NativeRNMappPluginModule';
|
|
11
|
+
|
|
12
|
+
const RNMappPluginModule =
|
|
13
|
+
NativeRNMappPluginModule || NativeModules.RNMappPluginModule;
|
|
11
14
|
|
|
12
15
|
class MappEventEmitter extends NativeEventEmitter {
|
|
13
16
|
|
package/RNMappPlugin.podspec
CHANGED
|
@@ -9,13 +9,14 @@ Pod::Spec.new do |s|
|
|
|
9
9
|
s.description = <<-DESC
|
|
10
10
|
Mapp SDK for React Native
|
|
11
11
|
DESC
|
|
12
|
-
s.homepage = "https://github.com/
|
|
12
|
+
s.homepage = "https://github.com/mapp-digital/Mapp-Engage-ReactNative-Plugin"
|
|
13
13
|
s.license = "MIT"
|
|
14
14
|
s.author = "Mapp"
|
|
15
15
|
s.platforms = { :ios => "10.0" }
|
|
16
|
-
s.source = { :git => "https://github.com/
|
|
16
|
+
s.source = { :git => "https://github.com/mapp-digital/Mapp-Engage-ReactNative-Plugin", :tag => "#{s.version}" }
|
|
17
17
|
|
|
18
18
|
s.source_files = "ios/**/*.{h,c,m,swift}"
|
|
19
|
+
s.exclude_files = "ios/RNMappPluginTests/**/*"
|
|
19
20
|
s.vendored_framework = "ios/Frameworks/AppoxeeSDK.xcframework", "ios/Frameworks/AppoxeeLocationServices.xcframework", "ios/Frameworks/AppoxeeInapp.xcframework"
|
|
20
21
|
s.resources = "ios/Frameworks/AppoxeeSDKResources.bundle", "ios/Frameworks/AppoxeeInappResources.bundle"
|
|
21
22
|
s.preserve_path = "ios/Frameworks/"
|
|
@@ -24,7 +25,5 @@ Pod::Spec.new do |s|
|
|
|
24
25
|
s.frameworks = "WebKit"
|
|
25
26
|
s.library = 'sqlite3'
|
|
26
27
|
s.dependency "React"
|
|
27
|
-
s.dependency 'RCT-Folly'
|
|
28
28
|
|
|
29
29
|
end
|
|
30
|
-
|
package/android/build.gradle
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
apply plugin: "com.android.library"
|
|
2
|
+
|
|
3
|
+
def getExtOrDefault = { name, fallback ->
|
|
4
|
+
rootProject.ext.has(name) ? rootProject.ext.get(name) : fallback
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
android {
|
|
8
8
|
namespace "com.reactlibrary"
|
|
9
|
-
compileSdk = 36
|
|
9
|
+
compileSdk = getExtOrDefault("compileSdkVersion", 36)
|
|
10
10
|
|
|
11
11
|
defaultConfig {
|
|
12
|
-
minSdk = 24
|
|
13
|
-
targetSdk = 36
|
|
12
|
+
minSdk = getExtOrDefault("minSdkVersion", 24)
|
|
13
|
+
targetSdk = getExtOrDefault("targetSdkVersion", 36)
|
|
14
14
|
versionCode = 1
|
|
15
15
|
versionName = "1.0"
|
|
16
16
|
}
|
|
@@ -19,24 +19,44 @@ android {
|
|
|
19
19
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
20
20
|
targetCompatibility = JavaVersion.VERSION_17
|
|
21
21
|
}
|
|
22
|
+
|
|
23
|
+
testOptions {
|
|
24
|
+
unitTests {
|
|
25
|
+
returnDefaultValues = true
|
|
26
|
+
includeAndroidResources = true
|
|
27
|
+
}
|
|
28
|
+
}
|
|
22
29
|
}
|
|
23
30
|
|
|
24
31
|
dependencies {
|
|
25
|
-
|
|
26
|
-
implementation "
|
|
27
|
-
|
|
32
|
+
//noinspection GradleDynamicVersion
|
|
33
|
+
implementation "com.facebook.react:react-native:+"
|
|
34
|
+
constraints {
|
|
35
|
+
implementation("androidx.core:core") {
|
|
36
|
+
version {
|
|
37
|
+
strictly "1.18.0"
|
|
38
|
+
}
|
|
39
|
+
because "androidx.core 1.19.0 requires AGP 9.1+, while React Native dependencies currently require the app to stay on AGP 8"
|
|
40
|
+
}
|
|
41
|
+
implementation("androidx.core:core-ktx") {
|
|
42
|
+
version {
|
|
43
|
+
strictly "1.18.0"
|
|
44
|
+
}
|
|
45
|
+
because "androidx.core-ktx 1.19.0 requires AGP 9.1+, while React Native dependencies currently require the app to stay on AGP 8"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
implementation 'com.google.code.gson:gson:2.14.0'
|
|
28
49
|
implementation 'androidx.appcompat:appcompat:1.7.1'
|
|
29
|
-
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.
|
|
30
|
-
implementation platform('com.google.firebase:firebase-bom:
|
|
50
|
+
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7'
|
|
51
|
+
implementation platform('com.google.firebase:firebase-bom:33.16.0')
|
|
31
52
|
implementation('com.google.firebase:firebase-messaging')
|
|
32
53
|
api('com.google.android.gms:play-services-location:21.3.0')
|
|
33
|
-
implementation 'androidx.media:media:1.
|
|
54
|
+
implementation 'androidx.media:media:1.8.0'
|
|
34
55
|
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
|
|
35
|
-
implementation("com.mapp.sdk:
|
|
56
|
+
implementation("com.mapp.sdk:engage-android:7.1.1")
|
|
57
|
+
testImplementation 'junit:junit:4.13.2'
|
|
58
|
+
testImplementation 'org.mockito:mockito-core:5.23.0'
|
|
59
|
+
testImplementation 'org.mockito:mockito-inline:5.2.0'
|
|
60
|
+
testImplementation 'org.json:json:20260522'
|
|
61
|
+
testImplementation 'org.robolectric:robolectric:4.16.1'
|
|
36
62
|
}
|
|
37
|
-
|
|
38
|
-
react {
|
|
39
|
-
jsRootDir = rootDir
|
|
40
|
-
libraryName = "RNMappPlugin"
|
|
41
|
-
codegenJavaPackageName = "com.reactlibrary"
|
|
42
|
-
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#This file is generated by updateDaemonJvm
|
|
2
|
+
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/ec7520a1e057cd116f9544c42142a16b/redirect
|
|
3
|
+
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/4c4f879899012ff0a8b2e2117df03b0e/redirect
|
|
4
|
+
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/ec7520a1e057cd116f9544c42142a16b/redirect
|
|
5
|
+
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/4c4f879899012ff0a8b2e2117df03b0e/redirect
|
|
6
|
+
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/73bcfb608d1fde9fb62e462f834a3299/redirect
|
|
7
|
+
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/846ee0d876d26a26f37aa1ce8de73224/redirect
|
|
8
|
+
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/ec7520a1e057cd116f9544c42142a16b/redirect
|
|
9
|
+
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/4c4f879899012ff0a8b2e2117df03b0e/redirect
|
|
10
|
+
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9482ddec596298c84656d31d16652665/redirect
|
|
11
|
+
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/39701d92e1756bb2f141eb67cd4c660e/redirect
|
|
12
|
+
toolchainVersion=21
|
|
@@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME
|
|
|
3
3
|
distributionPath=wrapper/dists
|
|
4
4
|
zipStoreBase=GRADLE_USER_HOME
|
|
5
5
|
zipStorePath=wrapper/dists
|
|
6
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
|
6
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-all.zip
|
|
7
7
|
android.enableAapt2=false
|
package/android/gradlew
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
set -eu
|
|
4
|
+
|
|
5
|
+
APP_HOME=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
6
|
+
CLASSPATH="$APP_HOME/gradle/wrapper/gradle-wrapper.jar"
|
|
7
|
+
|
|
8
|
+
if [ -n "${JAVA_HOME:-}" ]; then
|
|
9
|
+
JAVACMD="$JAVA_HOME/bin/java"
|
|
10
|
+
else
|
|
11
|
+
JAVACMD="java"
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
exec "$JAVACMD" \
|
|
15
|
+
-Dorg.gradle.appname=gradlew \
|
|
16
|
+
-classpath "$CLASSPATH" \
|
|
17
|
+
org.gradle.wrapper.GradleWrapperMain \
|
|
18
|
+
"$@"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@ECHO OFF
|
|
2
|
+
SETLOCAL
|
|
3
|
+
|
|
4
|
+
SET DIRNAME=%~dp0
|
|
5
|
+
IF "%DIRNAME%"=="" SET DIRNAME=.
|
|
6
|
+
SET APP_HOME=%DIRNAME%
|
|
7
|
+
SET CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
8
|
+
|
|
9
|
+
IF DEFINED JAVA_HOME (
|
|
10
|
+
SET JAVA_EXE=%JAVA_HOME%\bin\java.exe
|
|
11
|
+
) ELSE (
|
|
12
|
+
SET JAVA_EXE=java.exe
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
"%JAVA_EXE%" -Dorg.gradle.appname=gradlew -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
package/android/settings.gradle
CHANGED
|
@@ -5,9 +5,8 @@ pluginManagement {
|
|
|
5
5
|
gradlePluginPortal()
|
|
6
6
|
}
|
|
7
7
|
plugins {
|
|
8
|
-
id("com.android.library") version("
|
|
9
|
-
id("com.facebook.react") version("0.
|
|
10
|
-
id("org.jetbrains.kotlin.android") version("2.2.20") // 👈 for Kotlin
|
|
8
|
+
id("com.android.library") version("9.1.1") // 👈 for library
|
|
9
|
+
id("com.facebook.react") version("0.84.1") // 👈 for React Native
|
|
11
10
|
}
|
|
12
11
|
}
|
|
13
12
|
|
|
@@ -21,4 +20,3 @@ dependencyResolutionManagement {
|
|
|
21
20
|
includeBuild("../node_modules/@react-native/gradle-plugin")
|
|
22
21
|
|
|
23
22
|
rootProject.name="MappEngagePlugin"
|
|
24
|
-
include(":MappEngagePlugin")
|
|
@@ -8,8 +8,6 @@ import android.os.Bundle;
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
import com.appoxee.Appoxee;
|
|
12
|
-
|
|
13
11
|
/**
|
|
14
12
|
* Created by Aleksandar Marinkovic on 1/30/19.
|
|
15
13
|
* Copyright (c) 2019 MAPP.
|
|
@@ -27,14 +25,14 @@ public class ActivityListener extends Activity {
|
|
|
27
25
|
launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
|
28
26
|
launchIntent.setPackage(this.getPackageName());
|
|
29
27
|
startActivity(launchIntent);
|
|
30
|
-
|
|
28
|
+
// handleRichPush() removed in SDK v7
|
|
31
29
|
finish();
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
@Override
|
|
35
33
|
protected void onNewIntent(Intent intent) {
|
|
36
34
|
super.onNewIntent(intent);
|
|
37
|
-
|
|
35
|
+
// handleRichPush() removed in SDK v7
|
|
38
36
|
}
|
|
39
37
|
|
|
40
38
|
private Intent getDefaultActivityIntent() {
|
|
@@ -27,7 +27,7 @@ public class HelperActivity extends Activity {
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
if (intent.getAction() != null && !intent.getAction().
|
|
30
|
+
if (intent.getAction() != null && !intent.getAction().isEmpty()) {
|
|
31
31
|
Intent launchIntent = getDefaultActivityIntent();
|
|
32
32
|
launchIntent.setPackage(this.getPackageName());
|
|
33
33
|
launchIntent.putExtra("action", intent.getAction());
|
|
@@ -56,7 +56,7 @@ public class HelperActivity extends Activity {
|
|
|
56
56
|
String packageName = getPackageName();
|
|
57
57
|
|
|
58
58
|
if (Objects.equals(name.getPackageName(), packageName)) {
|
|
59
|
-
if (intent.getAction() != null && !intent.getAction().
|
|
59
|
+
if (intent.getAction() != null && !intent.getAction().isEmpty()) {
|
|
60
60
|
EventEmitter.shared().sendEvent(new IntentNotificationEvent(Objects.requireNonNull(intent.getData()), intent.getAction()));
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -5,38 +5,43 @@ import android.util.Log;
|
|
|
5
5
|
import androidx.annotation.NonNull;
|
|
6
6
|
|
|
7
7
|
import com.appoxee.Appoxee;
|
|
8
|
-
import com.appoxee.
|
|
8
|
+
import com.appoxee.shared.AppoxeeOptions;
|
|
9
9
|
import com.google.firebase.messaging.FirebaseMessagingService;
|
|
10
10
|
import com.google.firebase.messaging.RemoteMessage;
|
|
11
11
|
|
|
12
|
-
import java.util.Map;
|
|
13
12
|
import java.util.concurrent.TimeUnit;
|
|
14
13
|
|
|
15
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Updated for Engage SDK v7:
|
|
17
|
+
* - isPushMessageFromMapp() replaces data.containsKey("p") check
|
|
18
|
+
* - handlePushMessage() replaces setRemoteMessage()
|
|
19
|
+
* - updateFirebaseToken() replaces setToken()
|
|
20
|
+
*/
|
|
16
21
|
public class MessageService extends FirebaseMessagingService {
|
|
22
|
+
|
|
17
23
|
@Override
|
|
18
24
|
public void onCreate() {
|
|
19
25
|
super.onCreate();
|
|
20
|
-
Appoxee.engage(getApplication());
|
|
26
|
+
Appoxee.engage(getApplication(), null);
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
@Override
|
|
24
30
|
public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
|
|
25
31
|
Log.d("onMessageReceived", remoteMessage.toString());
|
|
26
|
-
|
|
27
|
-
if (data.containsKey("p")) {
|
|
32
|
+
if (Appoxee.instance().isPushMessageFromMapp(remoteMessage)) {
|
|
28
33
|
waitInitialization();
|
|
29
|
-
Appoxee.instance().
|
|
34
|
+
Appoxee.instance().handlePushMessage(remoteMessage);
|
|
30
35
|
} else {
|
|
31
36
|
super.onMessageReceived(remoteMessage);
|
|
32
37
|
}
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
@Override
|
|
36
|
-
public void onNewToken(@NonNull String
|
|
41
|
+
public void onNewToken(@NonNull String token) {
|
|
37
42
|
waitInitialization();
|
|
38
|
-
Appoxee.instance().
|
|
39
|
-
super.onNewToken(
|
|
43
|
+
Appoxee.instance().updateFirebaseToken(token).enqueue(result -> {});
|
|
44
|
+
super.onNewToken(token);
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
private void waitInitialization() {
|
|
@@ -47,7 +52,7 @@ public class MessageService extends FirebaseMessagingService {
|
|
|
47
52
|
limit--;
|
|
48
53
|
}
|
|
49
54
|
} catch (Exception e) {
|
|
50
|
-
|
|
55
|
+
Log.e("MessageService", "waitInitialization interrupted", e);
|
|
51
56
|
}
|
|
52
57
|
}
|
|
53
58
|
}
|
|
@@ -2,43 +2,50 @@ package com.reactlibrary;
|
|
|
2
2
|
|
|
3
3
|
import android.util.Log;
|
|
4
4
|
|
|
5
|
-
import com.appoxee.
|
|
6
|
-
import com.appoxee.
|
|
5
|
+
import com.appoxee.shared.LocalPushBroadcast;
|
|
6
|
+
import com.appoxee.shared.MappPush;
|
|
7
|
+
|
|
7
8
|
/**
|
|
8
9
|
* Created by Aleksandar Marinkovic on 2019-05-15.
|
|
9
10
|
* Copyright (c) 2019 MAPP.
|
|
11
|
+
*
|
|
12
|
+
* Updated for Engage SDK v7: extends LocalPushBroadcast instead of PushDataReceiver.
|
|
10
13
|
*/
|
|
11
|
-
public
|
|
12
|
-
@Override
|
|
13
|
-
public void onPushReceived(PushData pushData) {
|
|
14
|
-
Log.d("APX", "Push received " + pushData);
|
|
14
|
+
public class MyPushBroadcastReceiver extends LocalPushBroadcast {
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
@Override
|
|
17
|
+
public void onReceived(MappPush mappPush) {
|
|
18
|
+
Log.d("APX", "Push received " + mappPush);
|
|
19
|
+
EventEmitter.shared().sendEvent(new PushNotificationEvent(mappPush, "onPushReceived"));
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
@Override
|
|
21
|
-
public void
|
|
22
|
-
Log.d("APX", "Push opened " +
|
|
23
|
-
EventEmitter.shared().sendEvent(new PushNotificationEvent(
|
|
24
|
-
super.onPushOpened(pushData);
|
|
23
|
+
public void onOpened(MappPush mappPush) {
|
|
24
|
+
Log.d("APX", "Push opened " + mappPush);
|
|
25
|
+
EventEmitter.shared().sendEvent(new PushNotificationEvent(mappPush, "onPushOpened"));
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
@Override
|
|
28
|
-
public void
|
|
29
|
-
Log.d("APX", "Push dismissed " +
|
|
30
|
-
EventEmitter.shared().sendEvent(new PushNotificationEvent(
|
|
31
|
-
super.onPushDismissed(pushData);
|
|
29
|
+
public void onDismissed(MappPush mappPush) {
|
|
30
|
+
Log.d("APX", "Push dismissed " + mappPush);
|
|
31
|
+
EventEmitter.shared().sendEvent(new PushNotificationEvent(mappPush, "onPushDismissed"));
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
35
34
|
@Override
|
|
36
|
-
public void
|
|
37
|
-
Log.d("APX", "Push
|
|
38
|
-
EventEmitter.shared().sendEvent(new PushNotificationEvent(
|
|
39
|
-
super.onSilentPush(pushData);
|
|
40
|
-
|
|
35
|
+
public void onSilent(MappPush mappPush) {
|
|
36
|
+
Log.d("APX", "Push silent " + mappPush);
|
|
37
|
+
EventEmitter.shared().sendEvent(new PushNotificationEvent(mappPush, "onSilentPush"));
|
|
41
38
|
}
|
|
42
39
|
|
|
40
|
+
@Override
|
|
41
|
+
public void onButtonClick(MappPush mappPush) {
|
|
42
|
+
Log.d("APX", "Push button clicked " + mappPush);
|
|
43
|
+
EventEmitter.shared().sendEvent(new PushNotificationEvent(mappPush, "onPushButtonClicked"));
|
|
44
|
+
}
|
|
43
45
|
|
|
46
|
+
@Override
|
|
47
|
+
public void onRichPush(MappPush mappPush) {
|
|
48
|
+
Log.d("APX", "Rich push " + mappPush);
|
|
49
|
+
EventEmitter.shared().sendEvent(new PushNotificationEvent(mappPush, "onRichPush"));
|
|
50
|
+
}
|
|
44
51
|
}
|