shakebug-react-native 2.3.8 → 2.3.9

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.3.8",
4
+ "version": "2.3.9",
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
  "scripts": {
@@ -27,7 +27,7 @@ async function MatchKeyApi(appkey, BundleId) {
27
27
  const total_video = data.response_data.total_video;
28
28
  const used_video = data.response_data.used_video;
29
29
  const video_duration = data.response_data.video_duration;
30
- return { success: true, application_id, total_mau, used_mau, total_video, used_video, video_duration, message: data.msg };
30
+ return { success: true, application_id, total_mau, used_mau, total_video, used_video, video_duration, shakebug_type: data.response_data.shakebug_type, message: data.msg };
31
31
  } else {
32
32
  return { success: false, message: data.msg };
33
33
  }
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import { Modal, View, Text, TextInput, TouchableOpacity, StyleSheet, Image, KeyboardAvoidingView, ScrollView, TouchableWithoutFeedback, Keyboard, NativeModules } from 'react-native';
3
- import { AddReviewApi } from 'shakebug-react-native/src/APIs/AddReview';
3
+ import { AddReviewApi } from '../APIs/AddReview';
4
4
 
5
5
  const ReviewModal = ({ visible, onClose, onSubmit, color }) => {
6
6
 
@@ -12,7 +12,7 @@ console.ignoredYellowBox = ["Warning: Each", "Warning: Failed", "Possible", "WAR
12
12
 
13
13
  import { logger, consoleTransport } from "react-native-logs";
14
14
  import { ActivityIndicator } from 'react-native';
15
- import { useGlobalState } from 'shakebug-react-native/src/Componanats/GlobalStateContext';
15
+ import { useGlobalState } from './GlobalStateContext';
16
16
 
17
17
  LogBox.ignoreAllLogs()
18
18
 
@@ -10,9 +10,9 @@ import { ActivityIndicator } from 'react-native';
10
10
  import { UIManager } from 'react-native';
11
11
  import { ScrollView } from 'react-native';
12
12
  import KeyboardAvoidingWrapper from '../Componanats/KeyboardAvoidingWrapper';
13
- import { useGlobalState } from 'shakebug-react-native/src/Componanats/GlobalStateContext';
14
- import CustomeAlert from 'shakebug-react-native/src/Componanats/CustomAlert';
15
- import NetInfo from 'shakebug-react-native/NetInfo/src';
13
+ import { useGlobalState } from '../Componanats/GlobalStateContext';
14
+ import CustomeAlert from '../Componanats/CustomAlert';
15
+ import NetInfo from '../../NetInfo/src';
16
16
  import DeviceInfo from '../../DeviceInfo';
17
17
 
18
18
  console.ignoredYellowBox = ["Warning: Each", "Warning: Failed", "Non-serializable"];
@@ -5,12 +5,12 @@ import { ShakebugCapture, captureScreen } from '../index';
5
5
  import { launchImageLibrary } from '../../ImageOrVedioPicker/src/index';
6
6
  import { logger, consoleTransport } from "react-native-logs";
7
7
  import { NativeModules } from 'react-native';
8
- import { useNavigation } from '../../src/Componanats/NavigationContext';
9
- import { Localization } from '../../src/Componanats/localization';
8
+ import { useNavigation } from '../Componanats/NavigationContext';
9
+ import { Localization } from '../Componanats/localization';
10
10
  import { ActivityIndicator } from 'react-native';
11
11
  import DeviceInfo from '../../DeviceInfo';
12
12
  import { useGlobalState } from '../Componanats/GlobalStateContext.js';
13
- import CustomeAlert from 'shakebug-react-native/src/Componanats/CustomAlert.js';
13
+ import CustomeAlert from '../Componanats/CustomAlert.js';
14
14
 
15
15
  console.disableYellowBox = true;
16
16
  console.ignoredYellowBox = ["Warning: Each", "Warning: Failed", "Possible"];
@@ -19,8 +19,8 @@ import { setGlobalErrorHandler } from '../Componanats/ErrorHandler';
19
19
  import { NavigationProvider, useNavigation } from '../Componanats/NavigationContext';
20
20
  import { Localization } from '../Componanats/localization';
21
21
  import { GlobalStateProvider, useGlobalState } from '../Componanats/GlobalStateContext';
22
- import CustomeAlert from 'shakebug-react-native/src/Componanats/CustomAlert';
23
- import ReviewModal from 'shakebug-react-native/src/Componanats/ReviewModal';
22
+ import CustomeAlert from '../Componanats/CustomAlert';
23
+ import ReviewModal from '../Componanats/ReviewModal';
24
24
  import { SafeAreaView } from 'react-native-safe-area-context';
25
25
 
26
26
  console.ignoredYellowBox = ["Warning: Each", "Warning: Failed"];
@@ -53,11 +53,19 @@ global.isScreeenShotTaken = false;
53
53
  global.restrictedViews = [];
54
54
  global.currentScreen = ""
55
55
  global.isShakebugSDKOpen = false;
56
- global.sdk_version = "2.3.8";
56
+ global.sdk_version = "2.3.9";
57
57
  global.app_lunch_count = 0;
58
58
  global.POPUP_LAUNCH_THRESHOLD = 3;
59
59
  global.POPUP_COOLDOWN_DAYS = 2;
60
60
  global.KEY_REVIEW_SUBMITTED = false;
61
+ // Initialize feature flags with defaults (allow all)
62
+ global.allowBugReport = true;
63
+ global.allowCrashReport = true;
64
+ global.allowEvent = true;
65
+ global.allowReview = true;
66
+ global.allowSession = true;
67
+ global.shakebug_type = "1"; // default allow all
68
+
61
69
 
62
70
  const ShakebugContext = React.createContext();
63
71
 
@@ -147,6 +155,12 @@ const ShakeScreen = () => {
147
155
 
148
156
  function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirstTime, ShakebugThemeColor, changeSDKScreenTitle, allowToReportBugByShakingMobile, allowToReportBugByScreenCapture, allowCrashReport, ShakebugLanguage, makeLogEnabled, setShakebugSDKEndPointURL }) {
149
157
 
158
+ const [allowBugReport, setAllowBugReport] = useState(true);
159
+ const [allowCrashFlag, setAllowCrashFlag] = useState(true);
160
+ const [allowEventFlag, setAllowEventFlag] = useState(true);
161
+ const [allowReviewFlag, setAllowReviewFlag] = useState(true);
162
+ const [allowSessionFlag, setAllowSessionFlag] = useState(true);
163
+
150
164
  const { ShakebugSDKSharedPreferencesModule } = NativeModules;
151
165
 
152
166
  const ThemeColor = ShakebugThemeColor ? ShakebugThemeColor : "#1dd3e3";
@@ -237,7 +251,7 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
237
251
 
238
252
  global.app_lunch_count = (parseInt(KEY_APP_LAUNCH_COUNT) + 1);
239
253
 
240
- if (global.app_lunch_count >= POPUP_LAUNCH_THRESHOLD) {
254
+ if (global.app_lunch_count >= POPUP_LAUNCH_THRESHOLD && global.allowReview) {
241
255
  if (LAST_POPUP_TIME && LAST_POPUP_TIME != "" && IS_REVIEW_SUBMITTED != "true") {
242
256
  const now = Date.now(); // current timestamp in milliseconds
243
257
  const sevenDaysInMs = global.POPUP_COOLDOWN_DAYS * 24 * 60 * 60 * 1000; // 7 days in milliseconds
@@ -365,7 +379,7 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
365
379
  try {
366
380
  let BundleId = DeviceInfo.getBundleId();
367
381
 
368
- const { success, application_id: newApplication_id, message, total_mau, used_mau, total_video, used_video, video_duration } = await MatchKeyApi(appkey, BundleId);
382
+ const { success, application_id: newApplication_id, message, total_mau, used_mau, total_video, used_video, video_duration, shakebug_type } = await MatchKeyApi(appkey, BundleId);
369
383
 
370
384
  global.videoDuration = video_duration;
371
385
 
@@ -395,11 +409,64 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
395
409
  else {
396
410
  global.isIOSValid = true
397
411
  }
398
- global.application_id = newApplication_id
399
- log.debug("------------------------------------------------------------------------------------------")
412
+ global.application_id = newApplication_id;
413
+ // Set feature flags based on shakebug_type (supports comma‑separated codes)
414
+ // Reset all flags to false initially
415
+ global.allowBugReport = false;
416
+ global.allowCrashReport = false;
417
+ global.allowEvent = false;
418
+ global.allowReview = false;
419
+ global.allowSession = false;
420
+ // Helper to enable a specific flag
421
+ const enableFlag = (code) => {
422
+ switch (code) {
423
+ case "0":
424
+ // Disable all – already false
425
+ break;
426
+ case "1":
427
+ // Enable all
428
+ global.allowBugReport = true;
429
+ global.allowCrashReport = true;
430
+ global.allowEvent = true;
431
+ global.allowReview = true;
432
+ global.allowSession = true;
433
+ break;
434
+ case "2":
435
+ global.allowBugReport = true;
436
+ break;
437
+ case "3":
438
+ global.allowCrashReport = true;
439
+ break;
440
+ case "4":
441
+ global.allowEvent = true;
442
+ break;
443
+ case "5":
444
+ global.allowReview = true;
445
+ break;
446
+ case "6":
447
+ global.allowSession = true;
448
+ break;
449
+ default:
450
+ // ignore unknown codes
451
+ break;
452
+ }
453
+ };
454
+ // Split the incoming string and enable flags for each code
455
+ if (shakebug_type) {
456
+ const codes = String(shakebug_type).split(',').map(c => c.trim());
457
+ codes.forEach(enableFlag);
458
+ }
459
+ // Store raw type for reference
460
+ global.shakebug_type = shakebug_type;
461
+ // Update React state so UI re‑renders with new flags
462
+ setAllowBugReport(global.allowBugReport);
463
+ setAllowCrashFlag(global.allowCrashReport);
464
+ setAllowEventFlag(global.allowEvent);
465
+ setAllowReviewFlag(global.allowReview);
466
+ setAllowSessionFlag(global.allowSession); log.debug("------------------------------------------------------------------------------------------");
400
467
  log.info('API response:', message);
401
- log.debug("------------------------------------------------------------------------------------------")
402
- StartSession()
468
+ log.debug("------------------------------------------------------------------------------------------");
469
+ if (global.allowSession) { StartSession(); }
403
470
  } else {
404
471
  if (Platform.OS == "android") {
405
472
  global.isAndroidValid = false
@@ -461,9 +528,9 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
461
528
  showTutorialScreenFirstTime,
462
529
  FirstScreenTitle,
463
530
  SecondScreenTitle,
464
- allowToReportBugByShakingMobile,
465
- allowToReportBugByScreenCapture,
466
- allowCrashReport,
531
+ allowToReportBugByShaking: allowToReportBugByShakingMobile && allowBugReport,
532
+ allowToReportBugByScreenCapture: allowToReportBugByScreenCapture && allowBugReport,
533
+ allowCrashReport: allowCrashReport && allowCrashFlag,
467
534
  ShakebugLanguage
468
535
  }}>
469
536
  <View
@@ -534,6 +601,10 @@ export const AddEvent = async (name, value) => {
534
601
 
535
602
  var log = logger.createLogger(defaultConfig);
536
603
 
604
+ if (!global.allowEvent) {
605
+ log.warn("Event reporting is disabled by shakebug_type");
606
+ return;
607
+ }
537
608
 
538
609
  if (global.application_id != "") {
539
610
  try {
@@ -566,4 +637,4 @@ const styles = StyleSheet.create({
566
637
  screen: {
567
638
  ...StyleSheet.absoluteFillObject,
568
639
  },
569
- });
640
+ });