react-native-mapp-plugin 1.0.11-beta6 → 1.0.11-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.
@@ -70,6 +70,6 @@ dependencies {
70
70
  }
71
71
  implementation 'androidx.media:media:1.0.1'
72
72
  implementation 'androidx.legacy:legacy-support-v13:1.0.0'
73
- implementation 'com.mapp.sdk:mapp-android:6.0.17-special14'
73
+ implementation 'com.mapp.sdk:mapp-android:6.0.17-special15'
74
74
  }
75
75
 
@@ -1,5 +1,7 @@
1
1
  package com.reactlibrary;
2
2
 
3
+ import androidx.annotation.NonNull;
4
+
3
5
  import com.appoxee.Appoxee;
4
6
  import com.appoxee.internal.logger.LoggerFactory;
5
7
  import com.appoxee.internal.service.AppoxeeServiceAdapter;
@@ -18,29 +20,25 @@ public class MessageService extends MappMessagingService {
18
20
  }
19
21
 
20
22
  @Override
21
- public void onMessageReceived(RemoteMessage remoteMessage) {
22
- int limit = 15;
23
- try {
24
- while (limit >= 0 && (AppoxeeServiceAdapter.getInstance() == null || !AppoxeeServiceAdapter.getInstance().isQueryReady())) {
25
- TimeUnit.MILLISECONDS.sleep(300);
26
- limit--;
27
- }
28
- super.onMessageReceived(remoteMessage);
29
- } catch (Exception e) {
30
- LoggerFactory.getDevLogger().e(e.getMessage());
31
- }
23
+ public void onMessageReceived(@NonNull RemoteMessage remoteMessage) {
24
+ waitInitialization();
25
+ super.onMessageReceived(remoteMessage);
32
26
  }
33
27
 
34
28
  @Override
35
29
  public void onNewToken(String s) {
36
- int limit = 15;
37
- try {
38
- while (limit >= 0 && (AppoxeeServiceAdapter.getInstance() == null || !AppoxeeServiceAdapter.getInstance().isQueryReady())) {
30
+ waitInitialization();
31
+ super.onNewToken(s);
32
+ }
33
+
34
+ private void waitInitialization(){
35
+ int limit=15;
36
+ try{
37
+ while (limit >= 0 && !Appoxee.instance().isReady()) {
39
38
  TimeUnit.MILLISECONDS.sleep(300);
40
39
  limit--;
41
40
  }
42
- super.onNewToken(s);
43
- } catch (Exception e) {
41
+ }catch (Exception e){
44
42
  LoggerFactory.getDevLogger().e(e.getMessage());
45
43
  }
46
44
  }
@@ -111,7 +111,7 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule {
111
111
  @ReactMethod
112
112
  public void setRemoteMessage(String msgJson) {
113
113
  RemoteMessage remoteMessage = getRemoteMessage(msgJson);
114
- if (remoteMessage != null && AppoxeeServiceAdapter.getInstance() != null) {
114
+ if (remoteMessage != null) {
115
115
  Appoxee.instance().setRemoteMessage(remoteMessage);
116
116
  }
117
117
  }
@@ -129,7 +129,6 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule {
129
129
 
130
130
  @ReactMethod
131
131
  public void setToken(String token) {
132
- if (AppoxeeServiceAdapter.getInstance() != null)
133
132
  Appoxee.instance().setToken(token);
134
133
  }
135
134
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-mapp-plugin",
3
- "version": "1.0.11-beta6",
3
+ "version": "1.0.11-beta7",
4
4
  "description": "Mapp SDK for React Native.",
5
5
  "main": "index.js",
6
6
  "scripts": {