react-native-mapp-plugin 1.0.11-beta1 → 1.0.11-beta12

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/Mapp.js CHANGED
@@ -117,8 +117,8 @@ export class Mapp {
117
117
  tenantID: string
118
118
  ) {
119
119
  if (Platform.OS == "ios") {
120
- RNMappPluginModule.engageInapp(server);
121
- return RNMappPluginModule.autoengage(server);
120
+ RNMappPluginModule.autoengage(server);
121
+ return RNMappPluginModule.engageInapp(server);
122
122
  }
123
123
  return RNMappPluginModule.engage(
124
124
  sdkKey,
@@ -182,8 +182,21 @@ export class Mapp {
182
182
  * iOS only
183
183
  */
184
184
  static showNotificationAlertView() {
185
- return RNMappPluginModule.showNotificationAlertView();
186
- }
185
+ if (Platform.OS === "ios") {
186
+ return RNMappPluginModule.showNotificationAlertView();
187
+ }
188
+
189
+ }
190
+
191
+ /**
192
+ * Display notifications even app is in foreground .
193
+ * iOS only
194
+ */
195
+ static setShowNotificationsAtForeground(value: boolean) {
196
+ if (Platform.OS === "ios") {
197
+ return RNMappPluginModule.setShowNotificationsAtForeground(value);
198
+ }
199
+ }
187
200
 
188
201
  /**
189
202
  * Set Custom Attribute
@@ -260,6 +273,14 @@ export class Mapp {
260
273
  return RNMappPluginModule.removeBadgeNumber();
261
274
  }
262
275
 
276
+ static startGeofencing():Promise<string> {
277
+ return RNMappPluginModule.startGeofencing();
278
+ }
279
+
280
+ static stopGeofencing() : Promise<string>{
281
+ return RNMappPluginModule.stopGeofencing();
282
+ }
283
+
263
284
  static startGeoFencing() {
264
285
  return RNMappPluginModule.startGeoFencing();
265
286
  }
@@ -16,14 +16,17 @@ Pod::Spec.new do |s|
16
16
  s.source = { :git => "https://github.com/MappCloud/React-native-plugin", :tag => "#{s.version}" }
17
17
 
18
18
  s.source_files = "ios/**/*.{h,c,m,swift}"
19
- s.vendored_framework = "ios/Frameworks/AppoxeeSDK.framework", "ios/Frameworks/AppoxeeLocationServices.framework", "ios/Frameworks/AppoxeeInapp.framework"
20
- s.resources = "ios/Frameworks/AppoxeeSDKResources.bundle", "ios/Frameworks/AppoxeeInappResources.bundle"
21
- s.preserve_path = "ios/Frameworks/"
19
+ #s.vendored_framework = "ios/Frameworks/AppoxeeSDK.xcframework", "ios/Frameworks/AppoxeeLocationServices.framework", "ios/Frameworks/AppoxeeInapp.framework"
20
+ #s.resources = "ios/Frameworks/AppoxeeSDKResources.bundle", "ios/Frameworks/AppoxeeInappResources.bundle"
21
+ #s.preserve_path = "ios/Frameworks/"
22
22
  # s.public_header_files = "ios/Frameworks/AppoxeeSDK.framework/Headers/"
23
23
  s.requires_arc = true
24
24
  s.frameworks = "WebKit"
25
25
  s.library = 'sqlite3'
26
- s.dependency "React"
26
+ s.dependency "React"
27
+ s.dependency "MappSDK"
28
+ s.dependency "MappSDKInapp"
29
+ s.dependency "MappSDKGeotargeting"
27
30
 
28
31
  end
29
32
 
package/__package.json CHANGED
@@ -3,10 +3,6 @@
3
3
  "version": "1.0.3beta12",
4
4
  "description": "Mapp SDK for React Native.",
5
5
  "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1",
8
- "postinstall": "./iospatch.sh"
9
- },
10
6
  "keywords": [
11
7
  "react-native",
12
8
  "react",
@@ -18,12 +14,12 @@
18
14
  "author": "Mapp",
19
15
  "license": "MIT",
20
16
  "peerDependencies": {
21
- "react": "^16.8.1",
17
+ "react": "^18.0.0",
22
18
  "react-native": ">=0.60.0-rc.0 <1.0.x"
23
19
  },
24
20
  "devDependencies": {
25
21
  "jest": "^24.9.0",
26
- "react": "^16.9.0",
22
+ "react": "^18.0.0",
27
23
  "react-native": "^0.61.5"
28
24
  },
29
25
  "repository": {
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <classpath>
3
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-16/"/>
3
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/>
4
4
  <classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
5
5
  <classpathentry kind="output" path="bin/default"/>
6
6
  </classpath>
@@ -1,11 +1,11 @@
1
1
  arguments=
2
2
  auto.sync=false
3
3
  build.scans.enabled=false
4
- connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(7.0-rc-1))
4
+ connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(7.1.1))
5
5
  connection.project.dir=
6
6
  eclipse.preferences.version=1
7
7
  gradle.user.home=
8
- java.home=C\:/Program Files/Java/jdk-16.0.2
8
+ java.home=/Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home
9
9
  jvm.arguments=
10
10
  offline.mode=false
11
11
  override.workspace.settings=true
@@ -35,12 +35,12 @@ def safeExtGet(prop, fallback) {
35
35
  }
36
36
 
37
37
  android {
38
- compileSdkVersion safeExtGet('compileSdkVersion', 29)
39
- buildToolsVersion safeExtGet('buildToolsVersion', '29.0.2')
38
+ compileSdkVersion safeExtGet('compileSdkVersion', 31)
39
+ buildToolsVersion safeExtGet('buildToolsVersion', '30.0.3')
40
40
 
41
41
  defaultConfig {
42
42
  minSdkVersion safeExtGet('minSdkVersion', 19)
43
- targetSdkVersion safeExtGet('targetSdkVersion', 29)
43
+ targetSdkVersion safeExtGet('targetSdkVersion', 31)
44
44
  versionCode 1
45
45
  versionName '1.0'
46
46
  }
@@ -54,12 +54,7 @@ android {
54
54
  }
55
55
 
56
56
  dependencies {
57
-
58
57
  implementation('com.facebook.react:react-native:+')
59
- implementation('com.google.android.gms:play-services-location:16.0.0')
60
- {
61
- exclude group: 'com.android.support'
62
- }
63
58
  implementation 'com.android.support:appcompat-v7:28.0.0'
64
59
  implementation 'com.google.code.gson:gson:2.8.5'
65
60
  implementation 'com.google.dagger:dagger:2.24'
@@ -69,8 +64,12 @@ dependencies {
69
64
  {
70
65
  exclude group: 'com.android.support'
71
66
  }
72
- api('com.google.android.gms:play-services-location:16.0.0')
67
+ api('com.google.android.gms:play-services-location:18.0.0')
68
+ {
69
+ exclude group: 'com.android.support'
70
+ }
73
71
  implementation 'androidx.media:media:1.0.1'
74
72
  implementation 'androidx.legacy:legacy-support-v13:1.0.0'
75
- implementation 'com.mapp.sdk:mapp-android:6.0.17-special8'
76
- }
73
+ implementation 'com.mapp.sdk:mapp-android:6.0.17-special17'
74
+ }
75
+
@@ -25,7 +25,7 @@
25
25
  </receiver>
26
26
  <activity
27
27
  android:name=".HelperActivity"
28
- android:exported="true"
28
+ android:exported="false"
29
29
  android:theme="@style/HelperActivityStyle">
30
30
 
31
31
  <intent-filter android:label="mapp">
@@ -42,7 +42,8 @@
42
42
  </intent-filter>
43
43
 
44
44
  </activity>
45
- <service android:name=".MessageService">
45
+ <service android:name=".MessageService"
46
+ android:exported="false">
46
47
  <intent-filter>
47
48
  <action android:name="com.google.firebase.MESSAGING_EVENT" />
48
49
  </intent-filter>
@@ -26,7 +26,7 @@ public class ActivityListener extends Activity {
26
26
  launchIntent.setData(intent.getData());
27
27
  launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
28
28
  startActivity(launchIntent);
29
- Appoxee.handleRichPush(Appoxee.instance().getLastActivity(),intent);
29
+ Appoxee.handleRichPush(this,intent);
30
30
  finish();
31
31
  }
32
32
 
@@ -1,19 +1,12 @@
1
1
  package com.reactlibrary;
2
2
 
3
3
  import android.app.Activity;
4
- import android.content.Context;
4
+ import android.content.ComponentName;
5
5
  import android.content.Intent;
6
6
  import android.content.pm.PackageManager;
7
- import android.os.Build;
8
7
  import android.os.Bundle;
9
- import android.os.Handler;
10
- import android.os.Looper;
11
- import android.os.ResultReceiver;
12
- import androidx.annotation.NonNull;
13
- import androidx.annotation.Nullable;
14
- import androidx.annotation.WorkerThread;
15
- import androidx.core.content.ContextCompat;
16
8
 
9
+ import androidx.annotation.Nullable;
17
10
 
18
11
  import java.util.Objects;
19
12
 
@@ -23,22 +16,6 @@ import java.util.Objects;
23
16
  */
24
17
  public class HelperActivity extends Activity {
25
18
 
26
- @NonNull
27
- public static final String PERMISSIONS_EXTRA = "com.mapp.PERMISSIONS_EXTRA";
28
-
29
- @NonNull
30
- public static final String RESULT_RECEIVER_EXTRA = "com.mapp.RESULT_RECEIVER_EXTRA";
31
-
32
- @NonNull
33
- public static final String RESULT_INTENT_EXTRA = "com.mapp.RESULT_INTENT_EXTRA";
34
-
35
-
36
- @NonNull
37
- public static final String START_ACTIVITY_INTENT_EXTRA = "com.mapp.START_ACTIVITY_INTENT_EXTRA";
38
-
39
- private ResultReceiver resultReceiver;
40
- private static int requestCode = 0;
41
-
42
19
  @Override
43
20
  public final void onCreate(@Nullable Bundle savedInstanceState) {
44
21
  super.onCreate(savedInstanceState);
@@ -49,27 +26,23 @@ public class HelperActivity extends Activity {
49
26
  finish();
50
27
  return;
51
28
  }
52
- if (intent.getAction() != null)
53
- if (!intent.getAction().equals("")) {
29
+
30
+ ComponentName name = intent.getComponent();
31
+ String packageName = getPackageName();
32
+
33
+ if (Objects.equals(name.getPackageName(), packageName)) {
34
+ if (intent.getAction() != null && !intent.getAction().equals("")) {
54
35
  Intent launchIntent = getDefaultActivityIntent();
55
- launchIntent.putExtra("action", intent.getAction());
56
- launchIntent.setData(intent.getData());
57
- launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
58
- startActivity(launchIntent);
59
- EventEmitter.shared().sendEvent(new IntentNotificationEvent(Objects.requireNonNull(intent.getData()), intent.getAction()));
60
- finish();
61
- }
62
- if (savedInstanceState == null) {
63
- Intent startActivityIntent = intent.getParcelableExtra(START_ACTIVITY_INTENT_EXTRA);
64
- String[] permissions = intent.getStringArrayExtra(PERMISSIONS_EXTRA);
36
+ ComponentName launcherComponent = launchIntent.getComponent();
37
+
38
+ if (Objects.equals(launcherComponent.getPackageName(), packageName)) {
39
+ launchIntent.putExtra("action", intent.getAction());
40
+ launchIntent.setData(intent.getData());
41
+ launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
42
+ startActivity(launchIntent);
43
+ }
65
44
 
66
- if (startActivityIntent != null) {
67
- resultReceiver = intent.getParcelableExtra(RESULT_RECEIVER_EXTRA);
68
- startActivityForResult(startActivityIntent, ++requestCode);
69
- } else if (Build.VERSION.SDK_INT >= 23 && permissions != null) {
70
- resultReceiver = intent.getParcelableExtra(RESULT_RECEIVER_EXTRA);
71
- requestPermissions(permissions, ++requestCode);
72
- } else {
45
+ EventEmitter.shared().sendEvent(new IntentNotificationEvent(Objects.requireNonNull(intent.getData()), intent.getAction()));
73
46
  finish();
74
47
  }
75
48
  }
@@ -86,169 +59,14 @@ public class HelperActivity extends Activity {
86
59
  if (intent == null) {
87
60
  return;
88
61
  }
89
- if (intent.getAction() != null)
90
- if (!intent.getAction().equals("")) {
91
- EventEmitter.shared().sendEvent(new IntentNotificationEvent(Objects.requireNonNull(intent.getData()), intent.getAction()));
92
- }
93
- }
94
-
95
- @Override
96
- protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
97
- if (resultReceiver != null) {
98
- Bundle bundledData = new Bundle();
99
- bundledData.putParcelable(RESULT_INTENT_EXTRA, data);
100
- resultReceiver.send(resultCode, bundledData);
101
- }
102
-
103
- super.onActivityResult(requestCode, resultCode, data);
104
- this.finish();
105
- }
106
-
107
- @Override
108
- public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
109
- if (resultReceiver != null) {
110
- Bundle bundledData = new Bundle();
111
- bundledData.putIntArray(RESULT_INTENT_EXTRA, grantResults);
112
- resultReceiver.send(Activity.RESULT_OK, bundledData);
113
- }
114
-
115
- super.onRequestPermissionsResult(requestCode, permissions, grantResults);
116
- finish();
117
- }
118
-
119
- /**
120
- * Requests permissions.
121
- *
122
- * @param context The application context.
123
- * @param permissions The permissions to request.
124
- * @return The result from requesting permissions.
125
- */
126
- @WorkerThread
127
- @NonNull
128
- public static int[] requestPermissions(@NonNull Context context, @NonNull String... permissions) {
129
- context = context.getApplicationContext();
130
- boolean permissionsDenied = false;
131
-
132
- final int[] result = new int[permissions.length];
133
- for (int i = 0; i < result.length; i++) {
134
- result[i] = ContextCompat.checkSelfPermission(context, permissions[i]);
135
- if (result[i] == PackageManager.PERMISSION_DENIED) {
136
- permissionsDenied = true;
137
- }
138
- }
139
-
140
- if (!permissionsDenied || Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
141
- return result;
142
- }
143
-
144
- ResultReceiver receiver = new ResultReceiver(new Handler(Looper.getMainLooper())) {
145
- @Override
146
- public void onReceiveResult(int resultCode, Bundle resultData) {
147
- int[] receiverResults = resultData.getIntArray(HelperActivity.RESULT_INTENT_EXTRA);
148
- if (receiverResults != null && receiverResults.length == result.length) {
149
- System.arraycopy(receiverResults, 0, result, 0, result.length);
150
- }
151
-
152
- synchronized (result) {
153
- result.notify();
154
- }
155
- }
156
- };
157
-
158
- Intent startingIntent = new Intent(context, HelperActivity.class)
159
- .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
160
- .setPackage(context.getPackageName())
161
- .putExtra(HelperActivity.PERMISSIONS_EXTRA, permissions)
162
- .putExtra(HelperActivity.RESULT_RECEIVER_EXTRA, receiver);
163
-
164
- synchronized (result) {
165
- context.startActivity(startingIntent);
166
- try {
167
- result.wait();
168
- } catch (InterruptedException e) {
169
- Thread.currentThread().interrupt();
170
- }
171
- }
172
-
173
- return result;
174
- }
175
-
176
- /**
177
- * Starts an activity for a result.
178
- *
179
- * @param context The application context.
180
- * @param intent The activity to start.
181
- * @return The result of the activity in a ActivityResult object.
182
- */
183
- @NonNull
184
- @WorkerThread
185
- public static ActivityResult startActivityForResult(@NonNull Context context, @NonNull Intent intent) {
186
- context = context.getApplicationContext();
187
- final ActivityResult result = new ActivityResult();
188
-
189
- ResultReceiver receiver = new ResultReceiver(new Handler(Looper.getMainLooper())) {
190
- @Override
191
- public void onReceiveResult(int resultCode, Bundle resultData) {
192
- result.setResult(resultCode, (Intent) resultData.getParcelable(HelperActivity.RESULT_INTENT_EXTRA));
193
- synchronized (result) {
194
- result.notify();
195
- }
196
- }
197
- };
198
62
 
199
- Intent startingIntent = new Intent(context, HelperActivity.class)
200
- .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
201
- .setPackage(context.getPackageName())
202
- .putExtra(HelperActivity.START_ACTIVITY_INTENT_EXTRA, intent)
203
- .putExtra(HelperActivity.RESULT_RECEIVER_EXTRA, receiver);
63
+ ComponentName name = intent.getComponent();
64
+ String packageName = getPackageName();
204
65
 
205
- synchronized (result) {
206
- context.startActivity(startingIntent);
207
- try {
208
- result.wait();
209
- } catch (InterruptedException e) {
210
- Thread.currentThread().interrupt();
211
- return new ActivityResult();
66
+ if (Objects.equals(name.getPackageName(), packageName)) {
67
+ if (intent.getAction() != null && !intent.getAction().equals("")) {
68
+ EventEmitter.shared().sendEvent(new IntentNotificationEvent(Objects.requireNonNull(intent.getData()), intent.getAction()));
212
69
  }
213
70
  }
214
-
215
- return result;
216
- }
217
-
218
- /**
219
- * Wraps the result code and data from starting an activity
220
- * for a result.
221
- */
222
- public static class ActivityResult {
223
-
224
- private int resultCode = Activity.RESULT_CANCELED;
225
- private Intent intent;
226
-
227
- /**
228
- * Gets the result intent.
229
- *
230
- * @return The result intent from the activity.
231
- */
232
- @Nullable
233
- public Intent getIntent() {
234
- return intent;
235
- }
236
-
237
- /**
238
- * Gets the result code from the activity.
239
- *
240
- * @return The result code from the activity.
241
- */
242
- public int getResultCode() {
243
- return resultCode;
244
- }
245
-
246
- private void setResult(int resultCode, @Nullable Intent intent) {
247
- this.resultCode = resultCode;
248
- this.intent = intent;
249
- }
250
-
251
71
  }
252
-
253
- }
254
-
72
+ }
@@ -49,6 +49,4 @@ public class IntentNotificationEvent implements Event {
49
49
  this.message = message;
50
50
  this.type = type;
51
51
  }
52
-
53
-
54
52
  }
@@ -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 = 10;
23
- try {
24
- while (AppoxeeServiceAdapter.getInstance() == null || !AppoxeeServiceAdapter.getInstance().isQueryReady() || limit != 0) {
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 = 10;
37
- try {
38
- while (AppoxeeServiceAdapter.getInstance() == null || !AppoxeeServiceAdapter.getInstance().isQueryReady() || limit != 0) {
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
  }
@@ -8,6 +8,7 @@ import android.content.pm.PackageManager;
8
8
  import android.os.Build;
9
9
  import android.util.Log;
10
10
 
11
+ import androidx.annotation.Nullable;
11
12
  import androidx.core.app.NotificationManagerCompat;
12
13
  import androidx.core.content.ContextCompat;
13
14
 
@@ -22,6 +23,7 @@ import com.appoxee.internal.inapp.model.MessageContext;
22
23
  import com.appoxee.internal.inapp.model.Tracking;
23
24
  import com.appoxee.internal.inapp.model.TrackingAttributes;
24
25
  import com.appoxee.internal.service.AppoxeeServiceAdapter;
26
+ import com.appoxee.internal.util.ResultCallback;
25
27
  import com.appoxee.push.NotificationMode;
26
28
  import com.appoxee.push.PushData;
27
29
  import com.facebook.react.bridge.Arguments;
@@ -109,7 +111,7 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule {
109
111
  @ReactMethod
110
112
  public void setRemoteMessage(String msgJson) {
111
113
  RemoteMessage remoteMessage = getRemoteMessage(msgJson);
112
- if (remoteMessage != null && Appoxee.instance() != null) {
114
+ if (remoteMessage != null) {
113
115
  Appoxee.instance().setRemoteMessage(remoteMessage);
114
116
  }
115
117
  }
@@ -127,7 +129,6 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule {
127
129
 
128
130
  @ReactMethod
129
131
  public void setToken(String token) {
130
- if (Appoxee.instance() != null)
131
132
  Appoxee.instance().setToken(token);
132
133
  }
133
134
 
@@ -285,63 +286,38 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule {
285
286
  }
286
287
 
287
288
  @ReactMethod
288
- public void startGeoFencing() {
289
+ public void startGeofencing(final Promise promise) {
290
+ Appoxee.instance().startGeoFencing(new ResultCallback<String>() {
291
+ @Override
292
+ public void onResult(@Nullable String result) {
293
+ promise.resolve(result);
294
+ }
295
+ });
296
+ }
289
297
 
290
- Appoxee.instance().startGeoFencing();
291
- // if (Build.VERSION.SDK_INT < 23) {
292
- // Appoxee.instance().startGeoFencing();
293
- // } else if (Build.VERSION.SDK_INT <= 28) {
294
- // RequestPermissionsTask task = new RequestPermissionsTask(getReactApplicationContext(),
295
- // new RequestPermissionsTask.Callback() {
296
- // @Override
297
- // public void onResult(boolean enabled) {
298
- // if (enabled) {
299
- //
300
- // Appoxee.instance().startGeoFencing();
301
- // }
302
- // }
303
- // });
304
- // task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION);
305
- //
306
- // } else if (Build.VERSION.SDK_INT == 29) {
307
- // RequestPermissionsTask task = new RequestPermissionsTask(getReactApplicationContext(),
308
- // new RequestPermissionsTask.Callback() {
309
- // @Override
310
- // public void onResult(boolean enabled) {
311
- // if (enabled) {
312
- //
313
- // Appoxee.instance().startGeoFencing();
314
- // }
315
- // }
316
- // });
317
- // task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_BACKGROUND_LOCATION);
318
- //
319
- // } else if (Build.VERSION.SDK_INT == 30) {
320
- // RequestPermissionsTask task = new RequestPermissionsTask(getReactApplicationContext(),
321
- // new RequestPermissionsTask.Callback() {
322
- // @Override
323
- // public void onResult(boolean enabled) {
324
- // if (enabled) {
325
- // Appoxee.instance().startGeoFencing();
326
- // RequestPermissionsTask task2 = new RequestPermissionsTask(getReactApplicationContext(),
327
- // new RequestPermissionsTask.Callback() {
328
- // @Override
329
- // public void onResult(boolean enabled) {
330
- // if (enabled) {
331
- // Appoxee.instance().startGeoFencing();
332
- // }
333
- // }
334
- // });
335
- // task2.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, Manifest.permission.ACCESS_BACKGROUND_LOCATION);
336
- //
337
- // }
338
- // }
339
- // });
340
- // task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION);
341
- // }
298
+ @ReactMethod
299
+ public void stopGeofencing(final Promise promise) {
300
+ Appoxee.instance().stopGeoFencing(new ResultCallback<String>() {
301
+ @Override
302
+ public void onResult(@Nullable String result) {
303
+ promise.resolve(result);
304
+ }
305
+ });
306
+ }
342
307
 
308
+ /**
309
+ * This method is deprecated in Java. Use method {@link #startGeofencing(ResultCallback)}}
310
+ */
311
+ @ReactMethod
312
+ @Deprecated()
313
+ public void startGeoFencing() {
314
+ Appoxee.instance().startGeoFencing();
343
315
  }
344
316
 
317
+ /**
318
+ * Deprecated in Java. Use method {@link #stopGeofencing(ResultCallback)}
319
+ */
320
+ @Deprecated
345
321
  @ReactMethod
346
322
  public void stopGeoFencing() {
347
323
  Appoxee.instance().stopGeoFencing();
@@ -369,8 +345,6 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule {
369
345
  promise.resolve(messageToJson(message));
370
346
  }
371
347
  });
372
-
373
-
374
348
  }
375
349
 
376
350
  @ReactMethod
@@ -6,9 +6,9 @@
6
6
  //
7
7
 
8
8
  #import <Foundation/Foundation.h>
9
- #import <AppoxeeSDK/AppoxeeSDK.h>
10
- #import <AppoxeeInapp/AppoxeeInapp.h>
11
- #import <AppoxeeLocationServices/AppoxeeLocationManager.h>
9
+ #import "AppoxeeSDK.h"
10
+ #import "AppoxeeInapp.h"
11
+ #import "AppoxeeLocationManager.h"
12
12
  #import <React/RCTEventEmitter.h>
13
13
 
14
14
  NS_ASSUME_NONNULL_BEGIN
@@ -1,8 +1,8 @@
1
1
  #import <React/RCTBridgeModule.h>
2
2
  #import <React/RCTEventEmitter.h>
3
- #import <AppoxeeSDK/AppoxeeSDK.h>
4
- #import <AppoxeeInapp/AppoxeeInapp.h>
5
- #import <AppoxeeLocationServices/AppoxeeLocationManager.h>
3
+ #import "AppoxeeSDK.h"
4
+ #import "AppoxeeInapp.h"
5
+ #import "AppoxeeLocationManager.h"
6
6
  #import <UserNotifications/UNUserNotificationCenter.h>
7
7
 
8
8
  @interface RNMappPluginModule : NSObject <RCTBridgeModule,AppoxeeInappDelegate, AppoxeeNotificationDelegate, AppoxeeLocationManagerDelegate >
@@ -13,6 +13,14 @@
13
13
  return [RNMappEventEmmiter shared].bridge;
14
14
  }
15
15
 
16
+ - (void)setCallableJSModules:(RCTCallableJSModules *)callableJSModules {
17
+ [RNMappEventEmmiter shared].callableJSModules = callableJSModules;
18
+ }
19
+
20
+ - (RCTCallableJSModules *)callableJSModules {
21
+ return [RNMappEventEmmiter shared].callableJSModules;
22
+ }
23
+
16
24
  - (dispatch_queue_t)methodQueue {
17
25
  return dispatch_get_main_queue();
18
26
  }
@@ -96,6 +104,10 @@ RCT_EXPORT_METHOD(setPostponeNotificationRequest: (BOOL) postpone) {
96
104
  [[Appoxee shared] setPostponeNotificationRequest:postpone];
97
105
  }
98
106
 
107
+ RCT_EXPORT_METHOD(setShowNotificationsAtForeground: (BOOL) value) {
108
+ [[Appoxee shared] setShowNotificationsOnForeground:value];
109
+ }
110
+
99
111
  RCT_EXPORT_METHOD(showNotificationAlertView) {
100
112
  [[Appoxee shared] showNotificationAlertDialog];
101
113
  }
package/package.json CHANGED
@@ -1,12 +1,8 @@
1
1
  {
2
2
  "name": "react-native-mapp-plugin",
3
- "version": "1.0.11-beta1",
3
+ "version": "1.0.11-beta12",
4
4
  "description": "Mapp SDK for React Native.",
5
5
  "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1",
8
- "postinstall": "./iospatch.sh"
9
- },
10
6
  "keywords": [
11
7
  "react-native",
12
8
  "react",
@@ -18,13 +14,13 @@
18
14
  "author": "Mapp",
19
15
  "license": "MIT",
20
16
  "peerDependencies": {
21
- "react": "^16.8.1",
17
+ "react": "^18.0.0",
22
18
  "react-native": ">=0.60.0-rc.0 <1.0.x"
23
19
  },
24
20
  "devDependencies": {
25
- "jest": "^24.9.0",
26
- "react": "^16.9.0",
27
- "react-native": "^0.61.5"
21
+ "jest": "^28.1.3",
22
+ "react": "18.0.0",
23
+ "react-native": "0.69.4"
28
24
  },
29
25
  "repository": {
30
26
  "type": "git",
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/temp" />
6
- <excludeFolder url="file://$MODULE_DIR$/.tmp" />
7
- <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
- </content>
9
- <orderEntry type="inheritedJdk" />
10
- <orderEntry type="sourceFolder" forTests="false" />
11
- </component>
12
- </module>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/React-native-plugin.iml" filepath="$PROJECT_DIR$/.idea/React-native-plugin.iml" />
6
- </modules>
7
- </component>
8
- </project>
package/.idea/vcs.xml DELETED
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- <mapping directory="$PROJECT_DIR$/iostemp" vcs="Git" />
6
- </component>
7
- </project>
@@ -1,151 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ChangeListManager">
4
- <list default="true" id="8b4f258a-c093-494f-afe5-5f5a25c90893" name="Default Changelist" comment="">
5
- <change beforePath="$PROJECT_DIR$/android/src/main/java/com/reactlibrary/MessageService.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/reactlibrary/MessageService.java" afterDir="false" />
6
- <change beforePath="$PROJECT_DIR$/android/src/main/java/com/reactlibrary/RNMappPluginModule.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/reactlibrary/RNMappPluginModule.java" afterDir="false" />
7
- <change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
8
- </list>
9
- <option name="SHOW_DIALOG" value="false" />
10
- <option name="HIGHLIGHT_CONFLICTS" value="true" />
11
- <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
12
- <option name="LAST_RESOLUTION" value="IGNORE" />
13
- </component>
14
- <component name="Git.Settings">
15
- <option name="RECENT_BRANCH_BY_REPOSITORY">
16
- <map>
17
- <entry key="$PROJECT_DIR$" value="windows_build" />
18
- </map>
19
- </option>
20
- <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
21
- </component>
22
- <component name="ProjectId" id="1uwOd50jND4RNgNpsC9FcxMd94j" />
23
- <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
24
- <component name="ProjectViewState">
25
- <option name="hideEmptyMiddlePackages" value="true" />
26
- <option name="showLibraryContents" value="true" />
27
- </component>
28
- <component name="PropertiesComponent">
29
- <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
30
- <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
31
- <property name="WebServerToolWindowFactoryState" value="false" />
32
- <property name="nodejs_package_manager_path" value="npm" />
33
- <property name="vue.rearranger.settings.migration" value="true" />
34
- </component>
35
- <component name="RunManager" selected="Shell Script.iospatch.sh">
36
- <configuration name="iospatch.sh" type="ShConfigurationType" temporary="true">
37
- <option name="INDEPENDENT_SCRIPT_PATH" value="true" />
38
- <option name="SCRIPT_PATH" value="$PROJECT_DIR$/iospatch.sh" />
39
- <option name="SCRIPT_OPTIONS" value="" />
40
- <option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
41
- <option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
42
- <option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
43
- <option name="INTERPRETER_PATH" value="/bin/zsh" />
44
- <option name="INTERPRETER_OPTIONS" value="" />
45
- <option name="EXECUTE_IN_TERMINAL" value="true" />
46
- <envs />
47
- <method v="2" />
48
- </configuration>
49
- <configuration name="postinstall" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
50
- <package-json value="$PROJECT_DIR$/package.json" />
51
- <command value="run" />
52
- <scripts>
53
- <script value="postinstall" />
54
- </scripts>
55
- <node-interpreter value="project" />
56
- <envs />
57
- <method v="2" />
58
- </configuration>
59
- <recent_temporary>
60
- <list>
61
- <item itemvalue="Shell Script.iospatch.sh" />
62
- <item itemvalue="npm.postinstall" />
63
- </list>
64
- </recent_temporary>
65
- </component>
66
- <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
67
- <component name="TaskManager">
68
- <task active="true" id="Default" summary="Default task">
69
- <changelist id="8b4f258a-c093-494f-afe5-5f5a25c90893" name="Default Changelist" comment="" />
70
- <created>1625573269544</created>
71
- <option name="number" value="Default" />
72
- <option name="presentableId" value="Default" />
73
- <updated>1625573269544</updated>
74
- <workItem from="1625573273033" duration="26000" />
75
- <workItem from="1625580406053" duration="4000" />
76
- <workItem from="1625659434437" duration="279000" />
77
- <workItem from="1632413120138" duration="665000" />
78
- <workItem from="1632874987690" duration="1182000" />
79
- <workItem from="1632917248275" duration="2037000" />
80
- <workItem from="1632991423561" duration="15597000" />
81
- <workItem from="1633566225798" duration="599000" />
82
- <workItem from="1634673153825" duration="3131000" />
83
- <workItem from="1635406438746" duration="1187000" />
84
- <workItem from="1635764727836" duration="3806000" />
85
- </task>
86
- <task id="LOCAL-00001" summary="new version">
87
- <created>1632917445507</created>
88
- <option name="number" value="00001" />
89
- <option name="presentableId" value="LOCAL-00001" />
90
- <option name="project" value="LOCAL" />
91
- <updated>1632917445507</updated>
92
- </task>
93
- <task id="LOCAL-00002" summary="new version">
94
- <created>1633017006065</created>
95
- <option name="number" value="00002" />
96
- <option name="presentableId" value="LOCAL-00002" />
97
- <option name="project" value="LOCAL" />
98
- <updated>1633017006065</updated>
99
- </task>
100
- <task id="LOCAL-00003" summary="new version">
101
- <created>1633076795243</created>
102
- <option name="number" value="00003" />
103
- <option name="presentableId" value="LOCAL-00003" />
104
- <option name="project" value="LOCAL" />
105
- <updated>1633076795243</updated>
106
- </task>
107
- <task id="LOCAL-00004" summary="Update script to run on all linux systems">
108
- <created>1634673619666</created>
109
- <option name="number" value="00004" />
110
- <option name="presentableId" value="LOCAL-00004" />
111
- <option name="project" value="LOCAL" />
112
- <updated>1634673619666</updated>
113
- </task>
114
- <task id="LOCAL-00005" summary="Update script to run on all linux systems">
115
- <created>1635407568834</created>
116
- <option name="number" value="00005" />
117
- <option name="presentableId" value="LOCAL-00005" />
118
- <option name="project" value="LOCAL" />
119
- <updated>1635407568834</updated>
120
- </task>
121
- <option name="localTasksCounter" value="6" />
122
- <servers />
123
- </component>
124
- <component name="TypeScriptGeneratedFilesManager">
125
- <option name="version" value="3" />
126
- </component>
127
- <component name="Vcs.Log.Tabs.Properties">
128
- <option name="TAB_STATES">
129
- <map>
130
- <entry key="MAIN">
131
- <value>
132
- <State>
133
- <option name="COLUMN_ID_WIDTH">
134
- <map>
135
- <entry key="Table.Default.Author.ColumnIdWidth" value="129" />
136
- <entry key="Table.Default.Date.ColumnIdWidth" value="129" />
137
- </map>
138
- </option>
139
- </State>
140
- </value>
141
- </entry>
142
- </map>
143
- </option>
144
- <option name="oldMeFiltersMigrated" value="true" />
145
- </component>
146
- <component name="VcsManagerConfiguration">
147
- <MESSAGE value="new version" />
148
- <MESSAGE value="Update script to run on all linux systems" />
149
- <option name="LAST_COMMIT_MESSAGE" value="Update script to run on all linux systems" />
150
- </component>
151
- </project>
@@ -1,58 +0,0 @@
1
- package com.reactlibrary;
2
-
3
- import android.content.Context;
4
- import android.content.pm.PackageManager;
5
- import android.os.AsyncTask;
6
- import androidx.annotation.NonNull;
7
- import androidx.annotation.Nullable;
8
-
9
- /**
10
- * Created by Aleksandar Marinkovic on 2019-05-15.
11
- * Copyright (c) 2019 MAPP.
12
- */
13
-
14
-
15
- class RequestPermissionsTask extends AsyncTask<String, Void, Boolean> {
16
-
17
- private final Context context;
18
- private Callback callback;
19
-
20
- /**
21
- * Callback when with the result.
22
- */
23
- public interface Callback {
24
- void onResult(boolean enabled);
25
- }
26
-
27
- /**
28
- * Creates a request permissions task.
29
- *
30
- * @param context The application context.
31
- * @param callback The callback.
32
- */
33
- RequestPermissionsTask(@NonNull Context context, @Nullable Callback callback) {
34
- this.context = context;
35
- this.callback = callback;
36
- }
37
-
38
- @Override
39
- protected Boolean doInBackground(String... strings) {
40
- int[] result = HelperActivity.requestPermissions(context, strings);
41
- for (int element : result) {
42
- if (element == PackageManager.PERMISSION_GRANTED) {
43
- return true;
44
- }
45
- }
46
-
47
- return false;
48
- }
49
-
50
- @Override
51
- protected void onPostExecute(Boolean result) {
52
- if (callback != null) {
53
- callback.onResult(result);
54
- }
55
- }
56
- }
57
-
58
-
package/iospatch.sh DELETED
@@ -1,13 +0,0 @@
1
- #!/bin/sh
2
- chmod u+x
3
- if [ -d ios/Frameworks ]; then
4
-
5
- if [ ! -d iostemp ]; then
6
- mkdir -p iostemp;
7
- fi
8
-
9
- git clone https://github.com/MappCloud/React-native-plugin --depth 1 --branch=master iostemp
10
- cp -RPn iostemp/ios/Frameworks ios
11
- rm -rf iostemp
12
- echo "Finished pathching iOS"
13
- fi