react-native-mapp-plugin 1.2.1 → 1.3.0
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/.vscode/settings.json +2 -1
- package/Helper.md +23 -0
- package/RNMappPlugin.podspec +1 -1
- package/__package.json +2 -2
- package/android/.project +1 -1
- package/android/.settings/org.eclipse.buildship.core.prefs +1 -1
- package/android/build.gradle +25 -54
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/gradle.properties +36 -8
- package/android/settings.gradle +24 -1
- package/android/src/main/AndroidManifest.xml +2 -3
- package/android/src/main/java/com/reactlibrary/MessageService.java +16 -10
- package/android/src/main/java/com/reactlibrary/RNMappPluginModule.java +23 -11
- package/android/src/main/java/com/reactlibrary/RNMappPluginPackage.java +36 -19
- package/clean.sh +34 -0
- package/ios/RNMappPluginModule.m +8 -0
- package/package.json +11 -4
- package/react-native.config.js +7 -0
- package/specs/MappEngagePluginSpec.js +8 -0
package/.vscode/settings.json
CHANGED
package/Helper.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
### Clean all caches
|
|
2
|
+
```bash
|
|
3
|
+
./clean.sh
|
|
4
|
+
```
|
|
5
|
+
|
|
6
|
+
### Generate codegen
|
|
7
|
+
```bash
|
|
8
|
+
npx react-native codegen
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### rebuild node_modules
|
|
12
|
+
```bash
|
|
13
|
+
npm install #or yarn install
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Run application
|
|
17
|
+
```bash
|
|
18
|
+
npx react-native run-android
|
|
19
|
+
```
|
|
20
|
+
or
|
|
21
|
+
```bash
|
|
22
|
+
npx react-native run-ios
|
|
23
|
+
```
|
package/RNMappPlugin.podspec
CHANGED
package/__package.json
CHANGED
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"author": "Mapp",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"react": "^
|
|
17
|
+
"react": "^19.0.0",
|
|
18
18
|
"react-native": ">=0.60.0-rc.0 <1.0.x"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"jest": "^24.9.0",
|
|
22
|
-
"react": "^
|
|
22
|
+
"react": "^19.0.0",
|
|
23
23
|
"react-native": "^0.61.5"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
package/android/.project
CHANGED
|
@@ -5,7 +5,7 @@ connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
|
|
|
5
5
|
connection.project.dir=
|
|
6
6
|
eclipse.preferences.version=1
|
|
7
7
|
gradle.user.home=
|
|
8
|
-
java.home=/Users/semsudin.tafilovic/
|
|
8
|
+
java.home=/Users/semsudin.tafilovic/.sdkman/candidates/java/17.0.15-tem
|
|
9
9
|
jvm.arguments=
|
|
10
10
|
offline.mode=false
|
|
11
11
|
override.workspace.settings=true
|
package/android/build.gradle
CHANGED
|
@@ -1,71 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
google()
|
|
7
|
-
mavenCentral()
|
|
8
|
-
maven {
|
|
9
|
-
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
10
|
-
url "$rootDir/../node_modules/react-native/android"
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
dependencies {
|
|
14
|
-
classpath('com.android.tools.build:gradle:8.2.2')
|
|
15
|
-
//classpath('com.google.gms:google-services:4.3.15')
|
|
16
|
-
//classpath("com.facebook.react:react-native-gradle-plugin")
|
|
17
|
-
// NOTE: Do not place your application dependencies here; they belong
|
|
18
|
-
// in the individual module build.gradle files
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
allprojects {
|
|
23
|
-
repositories {
|
|
24
|
-
google()
|
|
25
|
-
mavenLocal()
|
|
26
|
-
mavenCentral()
|
|
27
|
-
maven { url "https://maven.google.com/" }
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
apply plugin: 'com.android.library'
|
|
31
|
-
|
|
32
|
-
def safeExtGet(prop, fallback) {
|
|
33
|
-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
1
|
+
plugins {
|
|
2
|
+
id("com.android.library")
|
|
3
|
+
id("org.jetbrains.kotlin.android")
|
|
4
|
+
id("com.facebook.react") // This is required for New Architecture & Codegen
|
|
34
5
|
}
|
|
35
6
|
|
|
36
7
|
android {
|
|
37
|
-
namespace
|
|
38
|
-
|
|
39
|
-
buildToolsVersion safeExtGet('buildToolsVersion', '34.0.0')
|
|
8
|
+
namespace "com.reactlibrary"
|
|
9
|
+
compileSdk = 35
|
|
40
10
|
|
|
41
11
|
defaultConfig {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
versionCode 1
|
|
45
|
-
versionName
|
|
12
|
+
minSdk = 21
|
|
13
|
+
targetSdk = 35
|
|
14
|
+
versionCode = 1
|
|
15
|
+
versionName = "1.0"
|
|
46
16
|
}
|
|
47
17
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
52
|
-
}
|
|
18
|
+
compileOptions {
|
|
19
|
+
sourceCompatibility = JavaVersion.VERSION_17
|
|
20
|
+
targetCompatibility = JavaVersion.VERSION_17
|
|
53
21
|
}
|
|
54
22
|
}
|
|
55
23
|
|
|
56
24
|
dependencies {
|
|
57
|
-
implementation
|
|
58
|
-
implementation
|
|
59
|
-
|
|
60
|
-
implementation 'androidx.appcompat:appcompat:1.7.
|
|
61
|
-
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.
|
|
62
|
-
implementation '
|
|
63
|
-
annotationProcessor 'com.google.dagger:dagger-compiler:2.24'
|
|
64
|
-
implementation platform('com.google.firebase:firebase-bom:33.6.0')
|
|
25
|
+
implementation "com.facebook.react:react-android:0.79.3"
|
|
26
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:2.1.21"
|
|
27
|
+
implementation 'com.google.code.gson:gson:2.13.0'
|
|
28
|
+
implementation 'androidx.appcompat:appcompat:1.7.1'
|
|
29
|
+
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.9.1'
|
|
30
|
+
implementation platform('com.google.firebase:firebase-bom:33.15.0')
|
|
65
31
|
implementation('com.google.firebase:firebase-messaging')
|
|
66
32
|
api('com.google.android.gms:play-services-location:21.3.0')
|
|
67
33
|
implementation 'androidx.media:media:1.7.0'
|
|
68
34
|
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
|
|
69
|
-
implementation("com.mapp.sdk:mapp-android:6.0.
|
|
35
|
+
implementation("com.mapp.sdk:mapp-android:6.0.29-alpha02")
|
|
70
36
|
}
|
|
71
37
|
|
|
38
|
+
react {
|
|
39
|
+
jsRootDir = rootDir
|
|
40
|
+
libraryName = "RNMappPlugin"
|
|
41
|
+
codegenJavaPackageName = "com.reactlibrary"
|
|
42
|
+
}
|
|
@@ -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-8.
|
|
6
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
|
7
7
|
android.enableAapt2=false
|
|
@@ -1,16 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
# Project-wide Gradle settings.
|
|
2
|
+
|
|
3
|
+
# IDE (e.g. Android Studio) users:
|
|
4
|
+
# Gradle settings configured through the IDE *will override*
|
|
5
|
+
# any settings specified in this file.
|
|
6
|
+
|
|
7
|
+
# For more details on how to configure your build environment visit
|
|
2
8
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
|
3
|
-
|
|
9
|
+
|
|
4
10
|
# Specifies the JVM arguments used for the daemon process.
|
|
5
11
|
# The setting is particularly useful for tweaking memory settings.
|
|
6
|
-
# Default value: -
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
|
|
13
|
+
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m
|
|
14
|
+
|
|
15
|
+
android.enableJetifier=true
|
|
9
16
|
# When configured, Gradle will run in incubating parallel mode.
|
|
10
17
|
# This option should only be used with decoupled projects. More details, visit
|
|
11
18
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
|
12
19
|
# org.gradle.parallel=true
|
|
13
|
-
|
|
20
|
+
|
|
21
|
+
# AndroidX package structure to make it clearer which packages are bundled with the
|
|
22
|
+
# Android operating system, and which are packaged with your app's APK
|
|
23
|
+
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
|
14
24
|
android.useAndroidX=true
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
|
|
26
|
+
# Use this property to specify which architecture you want to build.
|
|
27
|
+
# You can also override it from the CLI using
|
|
28
|
+
# ./gradlew <task> -PreactNativeArchitectures=x86_64
|
|
29
|
+
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
|
|
30
|
+
|
|
31
|
+
# Use this property to enable support to the new architecture.
|
|
32
|
+
# This will allow you to use TurboModules and the Fabric render in
|
|
33
|
+
# your application. You should enable this flag either if you want
|
|
34
|
+
# to write custom TurboModules/Fabric components OR use libraries that
|
|
35
|
+
# are providing them.
|
|
36
|
+
newArchEnabled=true
|
|
37
|
+
|
|
38
|
+
# Use this property to enable or disable the Hermes JS engine.
|
|
39
|
+
# If set to false, you will be using JSC instead.
|
|
40
|
+
hermesEnabled=false
|
|
41
|
+
|
|
42
|
+
NODE_BINARY=/Users/semsudin.tafilovic/.nvm/versions/node/v20.19.0/bin/node
|
|
43
|
+
|
|
44
|
+
org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home
|
package/android/settings.gradle
CHANGED
|
@@ -1 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
pluginManagement {
|
|
2
|
+
repositories {
|
|
3
|
+
google()
|
|
4
|
+
mavenCentral()
|
|
5
|
+
gradlePluginPortal()
|
|
6
|
+
}
|
|
7
|
+
plugins {
|
|
8
|
+
id("com.android.library") version("8.10.1") // 👈 for library
|
|
9
|
+
id("com.facebook.react") version("0.79.3") // 👈 for React Native
|
|
10
|
+
id("org.jetbrains.kotlin.android") version("2.1.21") // 👈 for Kotlin
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
dependencyResolutionManagement {
|
|
15
|
+
repositories {
|
|
16
|
+
google()
|
|
17
|
+
mavenLocal()
|
|
18
|
+
mavenCentral()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
includeBuild("../node_modules/@react-native/gradle-plugin")
|
|
22
|
+
|
|
23
|
+
rootProject.name="MappEngagePlugin"
|
|
24
|
+
include(":MappEngagePlugin")
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
-
xmlns:tools="http://schemas.android.com/tools"
|
|
3
|
-
package="com.reactlibrary">
|
|
2
|
+
xmlns:tools="http://schemas.android.com/tools">
|
|
4
3
|
|
|
5
4
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
|
6
5
|
<uses-permission android:name="android.permission.INTERNET" />
|
|
@@ -61,7 +60,7 @@
|
|
|
61
60
|
android:name=".ActivityListener"
|
|
62
61
|
android:exported="false"
|
|
63
62
|
android:theme="@style/HelperActivityStyle">
|
|
64
|
-
<intent-filter>
|
|
63
|
+
<intent-filter tools:ignore="AppLinkUrlError">
|
|
65
64
|
<action android:name="com.mapp.RICH_PUSH" />
|
|
66
65
|
<category android:name="${applicationId}" />
|
|
67
66
|
|
|
@@ -6,14 +6,14 @@ import androidx.annotation.NonNull;
|
|
|
6
6
|
|
|
7
7
|
import com.appoxee.Appoxee;
|
|
8
8
|
import com.appoxee.internal.logger.LoggerFactory;
|
|
9
|
-
import com.
|
|
9
|
+
import com.google.firebase.messaging.FirebaseMessagingService;
|
|
10
10
|
import com.google.firebase.messaging.RemoteMessage;
|
|
11
11
|
|
|
12
|
+
import java.util.Map;
|
|
12
13
|
import java.util.concurrent.TimeUnit;
|
|
13
14
|
|
|
14
15
|
|
|
15
|
-
public class MessageService extends
|
|
16
|
-
|
|
16
|
+
public class MessageService extends FirebaseMessagingService {
|
|
17
17
|
@Override
|
|
18
18
|
public void onCreate() {
|
|
19
19
|
super.onCreate();
|
|
@@ -23,24 +23,30 @@ public class MessageService extends MappMessagingService {
|
|
|
23
23
|
@Override
|
|
24
24
|
public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
|
|
25
25
|
Log.d("onMessageReceived", remoteMessage.toString());
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
Map<String, String> data = remoteMessage.getData();
|
|
27
|
+
if (data.containsKey("p")) {
|
|
28
|
+
waitInitialization();
|
|
29
|
+
Appoxee.instance().setRemoteMessage(remoteMessage);
|
|
30
|
+
} else {
|
|
31
|
+
super.onMessageReceived(remoteMessage);
|
|
32
|
+
}
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
@Override
|
|
31
|
-
public void onNewToken(String s) {
|
|
36
|
+
public void onNewToken(@NonNull String s) {
|
|
32
37
|
waitInitialization();
|
|
38
|
+
Appoxee.instance().setToken(s);
|
|
33
39
|
super.onNewToken(s);
|
|
34
40
|
}
|
|
35
41
|
|
|
36
|
-
private void waitInitialization(){
|
|
37
|
-
int limit=15;
|
|
38
|
-
try{
|
|
42
|
+
private void waitInitialization() {
|
|
43
|
+
int limit = 15;
|
|
44
|
+
try {
|
|
39
45
|
while (limit >= 0 && !Appoxee.instance().isReady()) {
|
|
40
46
|
TimeUnit.MILLISECONDS.sleep(300);
|
|
41
47
|
limit--;
|
|
42
48
|
}
|
|
43
|
-
}catch (Exception e){
|
|
49
|
+
} catch (Exception e) {
|
|
44
50
|
LoggerFactory.getDevLogger().e(e.getMessage());
|
|
45
51
|
}
|
|
46
52
|
}
|
|
@@ -7,6 +7,7 @@ import android.content.pm.ActivityInfo;
|
|
|
7
7
|
import android.content.pm.PackageManager;
|
|
8
8
|
import android.os.Build;
|
|
9
9
|
|
|
10
|
+
import androidx.annotation.NonNull;
|
|
10
11
|
import androidx.annotation.Nullable;
|
|
11
12
|
import androidx.core.app.NotificationManagerCompat;
|
|
12
13
|
import androidx.core.content.ContextCompat;
|
|
@@ -39,6 +40,10 @@ import com.facebook.react.bridge.ReactMethod;
|
|
|
39
40
|
import com.facebook.react.bridge.WritableArray;
|
|
40
41
|
import com.facebook.react.bridge.WritableMap;
|
|
41
42
|
import com.facebook.react.bridge.WritableNativeMap;
|
|
43
|
+
import com.facebook.react.module.annotations.ReactModule;
|
|
44
|
+
import com.google.android.gms.tasks.OnCompleteListener;
|
|
45
|
+
import com.google.android.gms.tasks.Task;
|
|
46
|
+
import com.google.firebase.messaging.FirebaseMessaging;
|
|
42
47
|
import com.google.firebase.messaging.RemoteMessage;
|
|
43
48
|
|
|
44
49
|
import org.json.JSONException;
|
|
@@ -55,8 +60,10 @@ import java.util.concurrent.ConcurrentHashMap;
|
|
|
55
60
|
* Copyright (c) 2019 MAPP.
|
|
56
61
|
*/
|
|
57
62
|
@SuppressWarnings("ALL")
|
|
63
|
+
@ReactModule(name = RNMappPluginModule.NAME)
|
|
58
64
|
public class RNMappPluginModule extends ReactContextBaseJavaModule {
|
|
59
65
|
|
|
66
|
+
public static final String NAME = "RNMappPluginModule";
|
|
60
67
|
private final ReactApplicationContext reactContext;
|
|
61
68
|
private Map<Callback, String> mFeedSubscriberMap = new ConcurrentHashMap<>();
|
|
62
69
|
private Map<Callback, Boolean> mCallbackWasCalledMap = new ConcurrentHashMap<>();
|
|
@@ -70,7 +77,7 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule {
|
|
|
70
77
|
|
|
71
78
|
@Override
|
|
72
79
|
public String getName() {
|
|
73
|
-
return
|
|
80
|
+
return NAME;
|
|
74
81
|
}
|
|
75
82
|
|
|
76
83
|
@Override
|
|
@@ -163,8 +170,9 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule {
|
|
|
163
170
|
if (remoteMessage != null) {
|
|
164
171
|
Appoxee.instance().setRemoteMessage(remoteMessage);
|
|
165
172
|
promise.resolve(true);
|
|
173
|
+
} else {
|
|
174
|
+
promise.resolve(false);
|
|
166
175
|
}
|
|
167
|
-
promise.resolve(false);
|
|
168
176
|
}
|
|
169
177
|
|
|
170
178
|
@ReactMethod
|
|
@@ -186,10 +194,11 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule {
|
|
|
186
194
|
|
|
187
195
|
@ReactMethod
|
|
188
196
|
public void getToken(Promise promise) {
|
|
189
|
-
|
|
197
|
+
FirebaseMessaging.getInstance().getToken().addOnCompleteListener(new OnCompleteListener<String>() {
|
|
190
198
|
@Override
|
|
191
|
-
public void
|
|
192
|
-
|
|
199
|
+
public void onComplete(@NonNull Task<String> task) {
|
|
200
|
+
String token = task.getResult();
|
|
201
|
+
promise.resolve(token);
|
|
193
202
|
}
|
|
194
203
|
});
|
|
195
204
|
}
|
|
@@ -445,7 +454,7 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule {
|
|
|
445
454
|
public void inAppMarkAsRead(Integer templateId, String eventId) {
|
|
446
455
|
Appoxee.instance().triggerStatistcs((getCurrentActivity()), getInAppStatisticsRequestObject(templateId,
|
|
447
456
|
eventId,
|
|
448
|
-
InAppStatistics.INBOX_INBOX_MESSAGE_READ_KEY,
|
|
457
|
+
InAppStatistics.INBOX_INBOX_MESSAGE_READ_KEY, -1, null, null));
|
|
449
458
|
}
|
|
450
459
|
|
|
451
460
|
@ReactMethod
|
|
@@ -453,7 +462,7 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule {
|
|
|
453
462
|
Appoxee.instance().triggerStatistcs((reactContext.getApplicationContext()),
|
|
454
463
|
getInAppStatisticsRequestObject(templateId,
|
|
455
464
|
eventId,
|
|
456
|
-
InAppStatistics.INBOX_INBOX_MESSAGE_UNREAD_KEY,
|
|
465
|
+
InAppStatistics.INBOX_INBOX_MESSAGE_UNREAD_KEY, -1, null, null));
|
|
457
466
|
}
|
|
458
467
|
|
|
459
468
|
@ReactMethod
|
|
@@ -461,12 +470,12 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule {
|
|
|
461
470
|
Appoxee.instance().triggerStatistcs((reactContext.getApplicationContext()),
|
|
462
471
|
getInAppStatisticsRequestObject(templateId,
|
|
463
472
|
eventId,
|
|
464
|
-
InAppStatistics.INBOX_INBOX_MESSAGE_DELETED_KEY,
|
|
473
|
+
InAppStatistics.INBOX_INBOX_MESSAGE_DELETED_KEY, -1, null, null));
|
|
465
474
|
}
|
|
466
475
|
|
|
467
476
|
@ReactMethod
|
|
468
477
|
public void triggerStatistic(Integer templateId, String originalEventId,
|
|
469
|
-
String trackingKey,
|
|
478
|
+
String trackingKey, int displayMillis,
|
|
470
479
|
String reason, String link) {
|
|
471
480
|
Appoxee.instance()
|
|
472
481
|
.triggerStatistcs((reactContext.getApplicationContext()), getInAppStatisticsRequestObject(templateId,
|
|
@@ -514,7 +523,7 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule {
|
|
|
514
523
|
}
|
|
515
524
|
|
|
516
525
|
private static InAppStatistics getInAppStatisticsRequestObject(int templateId, String originalEventId,
|
|
517
|
-
String trackingKey,
|
|
526
|
+
String trackingKey, int displayMillis,
|
|
518
527
|
String reason, String link) {
|
|
519
528
|
|
|
520
529
|
InAppStatistics inAppStatistics = new InAppStatistics();
|
|
@@ -526,7 +535,10 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule {
|
|
|
526
535
|
Tracking tk = new Tracking();
|
|
527
536
|
tk.setTrackingKey(trackingKey);
|
|
528
537
|
TrackingAttributes ta = new TrackingAttributes();
|
|
529
|
-
|
|
538
|
+
int displayTime = displayMillis >= 0 ? displayMillis : -1;
|
|
539
|
+
if (displayTime > 0) {
|
|
540
|
+
ta.setTimeSinceDisplayMillis((long) displayMillis);
|
|
541
|
+
}
|
|
530
542
|
ta.setReason(reason);
|
|
531
543
|
ta.setLink(link);
|
|
532
544
|
tk.setTrackingAttributes(ta);
|
|
@@ -1,35 +1,52 @@
|
|
|
1
|
-
|
|
2
1
|
package com.reactlibrary;
|
|
3
2
|
|
|
4
|
-
import
|
|
5
|
-
import java.util.Collections;
|
|
6
|
-
import java.util.List;
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
7
4
|
|
|
8
5
|
import com.facebook.react.ReactPackage;
|
|
9
6
|
import com.facebook.react.bridge.NativeModule;
|
|
10
7
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
11
|
-
import com.facebook.react.
|
|
8
|
+
import com.facebook.react.module.model.ReactModuleInfo;
|
|
9
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider;
|
|
12
10
|
import com.facebook.react.uimanager.ViewManager;
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
import java.util.Collections;
|
|
13
|
+
import java.util.HashMap;
|
|
14
|
+
import java.util.List;
|
|
15
|
+
import java.util.Map;
|
|
16
|
+
|
|
18
17
|
public class RNMappPluginPackage implements ReactPackage {
|
|
18
|
+
|
|
19
|
+
@NonNull
|
|
19
20
|
@Override
|
|
20
|
-
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
|
21
|
-
|
|
22
|
-
modules.add(new RNMappPluginModule(reactContext));
|
|
23
|
-
return modules;
|
|
21
|
+
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
|
|
22
|
+
return Collections.singletonList(new RNMappPluginModule(reactContext));
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
@NonNull
|
|
26
|
+
@Override
|
|
27
|
+
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
|
|
28
28
|
return Collections.emptyList();
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
public ReactModuleInfoProvider getReactModuleInfoProvider() {
|
|
32
|
+
return () -> {
|
|
33
|
+
Map<String, ReactModuleInfo> moduleInfos = new HashMap<>();
|
|
34
|
+
|
|
35
|
+
moduleInfos.put(
|
|
36
|
+
RNMappPluginModule.NAME,
|
|
37
|
+
new ReactModuleInfo(
|
|
38
|
+
RNMappPluginModule.NAME,
|
|
39
|
+
RNMappPluginModule.NAME,
|
|
40
|
+
false, // canOverrideExistingModule
|
|
41
|
+
false, // needsEagerInit
|
|
42
|
+
true, // hasConstants
|
|
43
|
+
false, // isCxxModule
|
|
44
|
+
true // isTurboModule -> THIS IS IMPORTANT
|
|
45
|
+
)
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
return moduleInfos;
|
|
49
|
+
};
|
|
34
50
|
}
|
|
35
|
-
}
|
|
51
|
+
}
|
|
52
|
+
|
package/clean.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
echo "Cleaning React Native project caches..."
|
|
4
|
+
|
|
5
|
+
rm -rf \
|
|
6
|
+
node_modules \
|
|
7
|
+
yarn.lock \
|
|
8
|
+
package-lock.json \
|
|
9
|
+
android/.gradle \
|
|
10
|
+
android/build \
|
|
11
|
+
android/app/build \
|
|
12
|
+
android/.idea \
|
|
13
|
+
android/local.properties \
|
|
14
|
+
ios/Pods \
|
|
15
|
+
ios/build \
|
|
16
|
+
ios/DerivedData \
|
|
17
|
+
ios/.xcworkspace \
|
|
18
|
+
example/node_modules \
|
|
19
|
+
example/yarn.lock \
|
|
20
|
+
example/package-lock.json \
|
|
21
|
+
example/android/.gradle \
|
|
22
|
+
example/android/build \
|
|
23
|
+
example/android/app/build \
|
|
24
|
+
example/android/.idea \
|
|
25
|
+
example/android/local.properties \
|
|
26
|
+
example/ios/Pods \
|
|
27
|
+
example/ios/build \
|
|
28
|
+
example/ios/DerivedData \
|
|
29
|
+
example/ios/.xcworkspace
|
|
30
|
+
|
|
31
|
+
echo "Optionally removing global Xcode DerivedData..."
|
|
32
|
+
echo "To remove: rm -rf ~/Library/Developer/Xcode/DerivedData"
|
|
33
|
+
|
|
34
|
+
echo "✅ Cleanup complete."
|
package/ios/RNMappPluginModule.m
CHANGED
|
@@ -181,21 +181,29 @@ RCT_EXPORT_METHOD(getDeviceInfo:(RCTPromiseResolveBlock)resolve rejecter:(RCTPro
|
|
|
181
181
|
|
|
182
182
|
RCT_EXPORT_METHOD(getAttributeStringValue: (NSString *) key resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
183
183
|
[[Appoxee shared] fetchCustomFieldByKey:key withCompletionHandler:^(NSError * _Nullable appoxeeError, id _Nullable data) {
|
|
184
|
+
NSLog(@"%@", data);
|
|
184
185
|
if (!appoxeeError && [data isKindOfClass:[NSDictionary class]]) {
|
|
185
186
|
NSDictionary *dictionary = (NSDictionary *)data;
|
|
187
|
+
NSLog(@"%@", dictionary);
|
|
186
188
|
NSString *key = [[dictionary allKeys] firstObject];
|
|
187
189
|
id value = dictionary[key]; // can be of the following types: NSString || NSNumber || NSDate
|
|
190
|
+
NSLog(@"%@", value);
|
|
188
191
|
if ([value isKindOfClass: [NSString class]]) {
|
|
192
|
+
NSLog(@"value is string %@", value);
|
|
189
193
|
resolve(value);
|
|
190
194
|
} else if ([value isKindOfClass: [NSNumber class]]) {
|
|
195
|
+
NSLog(@"value is number %@", value);
|
|
191
196
|
NSString *str = ((NSNumber *)value).stringValue;
|
|
192
197
|
resolve(str);
|
|
193
198
|
} else if ([value isKindOfClass: [NSDate class]]) {
|
|
199
|
+
NSLog(@"value is date %@", value);
|
|
194
200
|
NSDate *date = (NSDate *)value;
|
|
195
201
|
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
|
|
196
202
|
[formatter setDateFormat: @"dd MMM yyyy HH:mm"];
|
|
197
203
|
NSString *stringFromDate = [formatter stringFromDate:date];
|
|
198
204
|
resolve(stringFromDate);
|
|
205
|
+
} else {
|
|
206
|
+
NSLog(@"value is non of types!");
|
|
199
207
|
}
|
|
200
208
|
} else {
|
|
201
209
|
reject(@"GET_ATTRIBUTE_FAIL", @"Failed to get atribute string value", appoxeeError);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-mapp-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Mapp SDK for React Native.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"keywords": [
|
|
@@ -14,13 +14,20 @@
|
|
|
14
14
|
"author": "Mapp",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"react": "19.0.0",
|
|
18
|
-
"react-native": ">=0.
|
|
17
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
18
|
+
"react-native": ">=0.72.0 <0.80.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
+
"@react-native-community/cli": "^18.0.0",
|
|
22
|
+
"@react-native/codegen": "^0.79.3",
|
|
21
23
|
"jest": "^28.1.3",
|
|
22
24
|
"react": "19.0.0",
|
|
23
|
-
"react-native": "
|
|
25
|
+
"react-native": "0.79.3",
|
|
26
|
+
"react-native-gradle-plugin": "^0.71.19"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"generate:codegen": "react-native codegen specs",
|
|
30
|
+
"build:android": "cd android && ./gradlew assembleDebug"
|
|
24
31
|
},
|
|
25
32
|
"repository": {
|
|
26
33
|
"type": "git",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface Spec extends TurboModule {
|
|
5
|
+
exampleMethod(param: string): void;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('MappEngagePlugin');
|