shakebug-react-native 2.4.11 → 2.4.12

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shakebug-react-native",
3
3
  "title": "shakebug-react-native",
4
- "version": "2.4.11",
4
+ "version": "2.4.12",
5
5
  "description": "Shakebug allows users to report the bug from your mobile phone for your application. Here users just need to shake their mobile and all the data regarding bugs & crashes can be seen by developers through their log in panel easily",
6
6
  "main": "src/index.tsx",
7
7
  "types": "src/index.tsx",
@@ -63,7 +63,7 @@ global.isScreeenShotTaken = false;
63
63
  global.restrictedViews = [];
64
64
  global.currentScreen = ""
65
65
  global.isShakebugSDKOpen = false;
66
- global.sdk_version = "2.4.11";
66
+ global.sdk_version = "2.4.12";
67
67
  global.app_lunch_count = 0;
68
68
  global.POPUP_LAUNCH_THRESHOLD = 3;
69
69
  global.POPUP_COOLDOWN_DAYS = 2;
@@ -288,31 +288,14 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
288
288
 
289
289
  global.app_lunch_count = (parseInt(KEY_APP_LAUNCH_COUNT) + 1);
290
290
 
291
- if (global.app_lunch_count >= POPUP_LAUNCH_THRESHOLD && global.allowReview) {
292
- if (LAST_POPUP_TIME && LAST_POPUP_TIME != "" && IS_REVIEW_SUBMITTED != "true") {
293
- const now = Date.now(); // current timestamp in milliseconds
294
- const sevenDaysInMs = global.POPUP_COOLDOWN_DAYS * 24 * 60 * 60 * 1000; // 7 days in milliseconds
295
-
296
- const afterDaysTimestamp = now + sevenDaysInMs;
297
-
298
- if (LAST_POPUP_TIME > afterDaysTimestamp) {
299
- setTimeout(() => { setShowModal(true) }, 15000);
300
- }
301
-
302
- }
303
- else if (IS_REVIEW_SUBMITTED != "true") {
304
- setTimeout(() => { setShowModal(true) }, 15000);
305
- }
306
- }
307
-
308
291
  if (Platform.OS == 'android') {
309
292
  if (Android_appkey && Android_appkey.trim().length > 0) {
310
293
  try {
311
294
  const ismauReached = await ShakebugSDKSharedPreferencesModule.getString('mauReachedTime');
312
295
  if (!ismauReached) {
313
- MatchKeyFunc(Android_appkey);
296
+ await MatchKeyFunc(Android_appkey);
314
297
  } else if (parseInt(ismauReached) < new Date().getTime()) {
315
- MatchKeyFunc(Android_appkey);
298
+ await MatchKeyFunc(Android_appkey);
316
299
  ShakebugSDKSharedPreferencesModule.setString("mauReachedTime", "");
317
300
  } else {
318
301
  log.debug("------------------------------------------------------------------------------------------");
@@ -330,9 +313,9 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
330
313
  try {
331
314
  const ismauReached = await ShakebugSDKSharedPreferencesModule.getString('mauReachedTime');
332
315
  if (!ismauReached) {
333
- MatchKeyFunc(iOS_appkey);
316
+ await MatchKeyFunc(iOS_appkey);
334
317
  } else if (parseInt(ismauReached) < new Date().getTime()) {
335
- MatchKeyFunc(iOS_appkey);
318
+ await MatchKeyFunc(iOS_appkey);
336
319
  ShakebugSDKSharedPreferencesModule.setString("mauReachedTime", "");
337
320
  } else {
338
321
  log.debug("------------------------------------------------------------------------------------------");
@@ -346,6 +329,29 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
346
329
  log.warn("Please provide valid ios appkey");
347
330
  }
348
331
  }
332
+
333
+ if (global.app_lunch_count >= POPUP_LAUNCH_THRESHOLD && global.allowReview) {
334
+ if (LAST_POPUP_TIME && LAST_POPUP_TIME != "" && IS_REVIEW_SUBMITTED != "true") {
335
+ const now = Date.now(); // current timestamp in milliseconds
336
+ const cooldownInMs = global.POPUP_COOLDOWN_DAYS * 24 * 60 * 60 * 1000;
337
+
338
+ if (now - parseInt(LAST_POPUP_TIME) >= cooldownInMs) {
339
+ setTimeout(() => {
340
+ if (global.allowReview) {
341
+ setShowModal(true);
342
+ }
343
+ }, 15000);
344
+ }
345
+
346
+ }
347
+ else if (IS_REVIEW_SUBMITTED != "true") {
348
+ setTimeout(() => {
349
+ if (global.allowReview) {
350
+ setShowModal(true);
351
+ }
352
+ }, 15000);
353
+ }
354
+ }
349
355
  }
350
356
 
351
357
  let i = 0;
@@ -433,7 +439,7 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
433
439
  else {
434
440
  global.AllowVideo = false;
435
441
  global.total_video = total_video;
436
- global.used_video - used_video;
442
+ global.used_video = used_video;
437
443
  }
438
444
 
439
445
  if (total_mau.toString() == used_mau.toString()) {
@@ -519,7 +525,7 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
519
525
  }
520
526
  catch (err) {
521
527
  log.error("Err", err)
522
- if (err = "Network request failed") {
528
+ if (err === "Network request failed" || err?.message === "Network request failed") {
523
529
  log.warn("Please check your internet connection")
524
530
  }
525
531
  }
@@ -602,7 +608,7 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
602
608
  }}
603
609
  />
604
610
 
605
- <ReviewModal color={ThemeColor} visible={showModal} onClose={() => { setShowModal(false) }} />
611
+ <ReviewModal color={ThemeColor} visible={showModal && allowReviewFlag && global.allowReview} onClose={() => { setShowModal(false) }} />
606
612
  </View>
607
613
  </ShakebugContext.Provider>
608
614
  )