shakebug-react-native 2.4.3 → 2.4.5

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/README.md CHANGED
@@ -49,12 +49,7 @@ Or if you prefer to use Yarn instead of npm:
49
49
  <key>NSPhotoLibraryUsageDescription</key>
50
50
  <string></string>
51
51
  ```
52
- 2. Manage Architecture:
53
- ```bash
54
- ENV['RCT_NEW_ARCH_ENABLED'] = '0'
55
- ```
56
-
57
- 3. CocoaPods installation:
52
+ 2. CocoaPods installation:
58
53
 
59
54
  ```bash
60
55
  cd ios && pod install && cd ..
@@ -162,6 +157,26 @@ export default App = () => {
162
157
 
163
158
  ```
164
159
 
160
+ Add Custom User
161
+
162
+ You can attach a custom user's details (like ID, name, email, country, and other info) to the bug reports and events using the `addCustomUser` method.
163
+
164
+ ```javascript
165
+
166
+ import { Button } from 'react-native';
167
+ import { addCustomUser } from 'react-native-shakebug';
168
+
169
+ export default App = () => {
170
+ return(
171
+ <Button
172
+ title='Prees'
173
+ onPress={() => {
174
+ addCustomUser("user_id", "John Doe", "john@example.com", "US", "Any other info")
175
+ }}
176
+ />
177
+ )
178
+ }
179
+
165
180
  ## Properties
166
181
 
167
182
  <table>
@@ -252,6 +267,16 @@ export default App = () => {
252
267
  <td>If you want add event to any screen or activity use following method</td>
253
268
  <td>addEventKey("Key_name", value)</td>
254
269
  </tr>
270
+ <tr>
271
+ <td>fetchRemoteCodeValue</td>
272
+ <td>Fetch dynamic configuration values based on predefined keys</td>
273
+ <td>fetchRemoteCodeValue("key")</td>
274
+ </tr>
275
+ <tr>
276
+ <td>addCustomUser</td>
277
+ <td>Add custom user details to reports and events</td>
278
+ <td>addCustomUser(id, name, email, country, other)</td>
279
+ </tr>
255
280
  </table>
256
281
 
257
282
  ## Documentation
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.3",
4
+ "version": "2.4.5",
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": {
@@ -28,22 +28,7 @@ Pod::Spec.new do |s|
28
28
  if respond_to?(:install_modules_dependencies, true)
29
29
  install_modules_dependencies(s)
30
30
  else
31
- s.dependency "React-Core"
32
-
33
-
34
- if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
35
- s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
36
- s.pod_target_xcconfig = {
37
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
38
- "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
39
- "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
40
- }
41
- s.dependency "React-Codegen"
42
- s.dependency "RCT-Folly"
43
- s.dependency "RCTRequired"
44
- s.dependency "RCTTypeSafety"
45
- s.dependency "ReactCommon/turbomodule/core"
46
- end
31
+ s.dependency "React-Core"
47
32
  end
48
33
  end
49
34
 
@@ -17,7 +17,7 @@ async function AddReviewApi(rating, review, applicationsid, session_id) {
17
17
  formData.append("review", review?.trim());
18
18
  formData.append("session_id", session_id);
19
19
  formData.append("appVersion", global.sdk_version);
20
- formData.append("custom_user_id", Custom_User_Id);
20
+ formData.append("custom_user_id", Custom_User_Id || "");
21
21
 
22
22
  const response = await fetch(BASE_URL, {
23
23
  method: 'POST',
package/src/APIs/Event.js CHANGED
@@ -5,7 +5,7 @@ import NetInfo from "../../NetInfo/src";
5
5
  const BASE_URL = global.ShakebugSDKEndPointURL;
6
6
  const API_KEY = global.ShakebugSDKEndPointURLheaderKey;
7
7
 
8
- async function EventApi(application_id, name, value) {
8
+ async function EventApi(application_id, name, value, session_id) {
9
9
  try {
10
10
 
11
11
  const { ShakebugSDKSharedPreferencesModule } = NativeModules;
@@ -17,6 +17,7 @@ async function EventApi(application_id, name, value) {
17
17
  formData.append("applicationsid", application_id);
18
18
  formData.append("name", name);
19
19
  formData.append("value", value);
20
+ formData.append("session_id", session_id);
20
21
  formData.append("custom_user_id", Custom_User_Id || "")
21
22
  formData.append("sdk_version", global.sdk_version)
22
23
 
@@ -4,7 +4,7 @@ import DeviceInfo from "../../DeviceInfo";
4
4
  const BASE_URL = global.ShakebugSDKEndPointURL;
5
5
  const API_KEY = global.ShakebugSDKEndPointURLheaderKey;
6
6
 
7
- async function FetchRemoteCodeAPI(config_key, applicationsid) {
7
+ async function FetchRemoteCodeAPI(config_key, applicationsid, session_id) {
8
8
 
9
9
  try {
10
10
  const { ShakebugSDKSharedPreferencesModule } = NativeModules;
@@ -18,7 +18,8 @@ async function FetchRemoteCodeAPI(config_key, applicationsid) {
18
18
  formData.append("config_key", config_key);
19
19
  formData.append("sdkversion", global.sdk_version);
20
20
  formData.append("appVersion", DeviceInfo?.getVersion());
21
- formData.append("custom_user_id", Custom_User_Id);
21
+ formData.append("session_id", session_id);
22
+ formData.append("custom_user_id", Custom_User_Id || "");
22
23
 
23
24
  const response = await fetch(BASE_URL, {
24
25
  method: "POST",
@@ -23,14 +23,16 @@ export const NavigationProvider = ({ children }) => {
23
23
  }
24
24
  };
25
25
 
26
- React.useEffect(() => {
27
- if (navigationState && navigationState.length > 0) {
28
- setFocusedScreen(navigationState[navigationState.length - 1].name);
29
- }
30
- return () => {
31
- setFocusedScreen('');
32
- };
33
- }, [navigationState]);
26
+ useFocusEffect(
27
+ React.useCallback(() => {
28
+ if (navigationState && navigationState.length > 0) {
29
+ setFocusedScreen(navigationState[navigationState.length - 1].name);
30
+ }
31
+ return () => {
32
+ setFocusedScreen('');
33
+ };
34
+ }, [navigationState])
35
+ );
34
36
 
35
37
  return (
36
38
  <NavigationContext.Provider value={{ navigationState, navigate, goBack, focusedScreen, goToScreenAtIndex}}>
@@ -301,10 +301,9 @@ const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitl
301
301
  }, 200)
302
302
  }
303
303
 
304
- if (Platform.OS == 'android' && global.isRecording == false && global.isTrigger == false && isBugReportingEnabled() && !global.isShakebugSDKOpen) {
304
+ if (Platform.OS == 'android' && global.isRecording == false && global.isTrigger == false && isBugReportingEnabled()) {
305
305
  if (calculate.toFixed(2) >= 18) {
306
306
  if (global.isAndroidValid == true && global.application_id != "" && global.application_id != undefined && global.isTrigger == false) {
307
- global.isShakebugSDKOpen = true; // Lock immediately to prevent double navigation
308
307
  setIsScreenShot(true)
309
308
  let ImgUrl = null;
310
309
  try {
@@ -316,10 +315,10 @@ const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitl
316
315
  if (ImgUrl != undefined || ImgUrl != null) {
317
316
  subscription.unsubscribe();
318
317
  global.IsBackground = false
318
+ global.isShakebugSDKOpen = true
319
319
  navigate("FirstScreen", { img: `${ImgUrl}`, themeColor: `${themeColor}`, SDKScreenTitle: `${SDKScreenTitle}` })
320
320
  }
321
321
  else {
322
- global.isShakebugSDKOpen = false;
323
322
  setIsScreenShot(false)
324
323
  }
325
324
  }
@@ -329,10 +328,9 @@ const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitl
329
328
  }
330
329
  }
331
330
  }
332
- else if (Platform.OS == 'ios' && global.isRecording == false && global.isTrigger == false && isBugReportingEnabled() && !global.isShakebugSDKOpen) {
331
+ else if (Platform.OS == 'ios' && global.isRecording == false && global.isTrigger == false && isBugReportingEnabled()) {
333
332
  if (calculate.toFixed(2) >= 2.00) {
334
333
  if (global.isIOSValid == true && global.application_id != "" && global.application_id != undefined) {
335
- global.isShakebugSDKOpen = true; // Lock immediately to prevent double navigation
336
334
  setIsScreenShot(true)
337
335
 
338
336
  let ImgUrl = null;
@@ -350,10 +348,10 @@ const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitl
350
348
  }
351
349
  if (ImgUrl != undefined || ImgUrl != null) {
352
350
  subscription.unsubscribe();
351
+ global.isShakebugSDKOpen = true
353
352
  navigate("FirstScreen", { img: `${ImgUrl}`, themeColor: `${themeColor}`, SDKScreenTitle: `${SDKScreenTitle}` })
354
353
  }
355
354
  else {
356
- global.isShakebugSDKOpen = false;
357
355
  setIsScreenShot(false)
358
356
  }
359
357
 
@@ -285,11 +285,11 @@ const AddDetailsScreen = ({ media, updateParent, mediaType, themeColor, SDKScree
285
285
  }
286
286
 
287
287
  return (
288
- <SafeAreaView style={{ flex: 1, width: Dimensions.get('window').width, height: Dimensions.get('window').height, backgroundColor: themeColor, paddingTop: Platform.OS == 'android' && DeviceInfo?.getSystemVersion() > 14 ? StatusBar.currentHeight : 0 , paddingBottom: Platform.OS == 'android' && DeviceInfo?.getSystemVersion() > 14 ? StatusBar.currentHeight : 0}}>
288
+ <SafeAreaView style={{ width: "100%", height: "100%", backgroundColor: themeColor, paddingTop: Platform.OS == 'android' ? DeviceInfo?.getSystemVersion() > 14 && StatusBar.currentHeight : 0 , paddingBottom: Platform.OS == 'android' ? DeviceInfo?.getSystemVersion() > 14 && StatusBar.currentHeight : 0}}>
289
289
  <StatusBar backgroundColor={ThemeColor} hidden={false} />
290
290
  <KeyboardAvoidingWrapper>
291
291
  <>
292
- <View style={{ flex: 1, width: '100%', height: '100%', backgroundColor: "#ffffff" }}>
292
+ <View style={{ width: "100%", height: "100%", backgroundColor: "#ffffff" }}>
293
293
  <View style={{ height: '6%', padding: 5, paddingHorizontal: 15, backgroundColor: ThemeColor, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }}>
294
294
  <TouchableOpacity
295
295
  style={{
@@ -309,10 +309,10 @@ const FirstScreen = ({ img, themeColor, SDKScreenTitle }) => {
309
309
  // backgroundColor: "#181818"
310
310
 
311
311
  return (
312
- <SafeAreaView style={{ flex: 1, width: Dimensions.get('window').width, height: Dimensions.get('window').height, backgroundColor: themeColor, paddingTop: Platform.OS == 'android' && DeviceInfo?.getSystemVersion() > 14 ? StatusBar.currentHeight : 0 , paddingBottom: Platform.OS == 'android' && DeviceInfo?.getSystemVersion() > 14 ? StatusBar.currentHeight : 0}}>
312
+ <SafeAreaView style={{ width: "100%", height: '100%', backgroundColor: themeColor, paddingTop: Platform.OS == 'android' ? DeviceInfo?.getSystemVersion() > 14 && StatusBar.currentHeight : 0 , paddingBottom: Platform.OS == 'android' ? DeviceInfo?.getSystemVersion() > 14 && StatusBar.currentHeight : 0}}>
313
313
  <StatusBar backgroundColor={ThemeColor} />
314
314
 
315
- <View style={{ flex: 1, width: '100%', height: '100%', backgroundColor: "#e4fdfd" }}>
315
+ <View style={{ width: "100%", height: "100%", backgroundColor: "#e4fdfd" }}>
316
316
  <View style={{ height: '6%', padding: 5, paddingHorizontal: 15, backgroundColor: ThemeColor, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }}>
317
317
  <TouchableOpacity
318
318
  style={{
@@ -53,7 +53,7 @@ global.isScreeenShotTaken = false;
53
53
  global.restrictedViews = [];
54
54
  global.currentScreen = ""
55
55
  global.isShakebugSDKOpen = false;
56
- global.sdk_version = "2.4.3";
56
+ global.sdk_version = "2.4.5";
57
57
  global.app_lunch_count = 0;
58
58
  global.POPUP_LAUNCH_THRESHOLD = 3;
59
59
  global.POPUP_COOLDOWN_DAYS = 2;
@@ -76,14 +76,16 @@ const NavigationContainer = ({ screens, setFocusedScreen }) => {
76
76
  const animation = React.useRef(new Animated.Value(0)).current;
77
77
  const { width } = Dimensions.get('window');
78
78
 
79
- React.useEffect(() => {
80
- if (navigationState && navigationState.length > 0) {
81
- setFocusedScreen(navigationState[navigationState.length - 1].name);
82
- }
83
- return () => {
84
- setFocusedScreen('');
85
- };
86
- }, [navigationState, setFocusedScreen]);
79
+ useFocusEffect(
80
+ React.useCallback(() => {
81
+ if (navigationState && navigationState.length > 0) {
82
+ setFocusedScreen(navigationState[navigationState.length - 1].name);
83
+ }
84
+ return () => {
85
+ setFocusedScreen('');
86
+ };
87
+ }, [navigationState, setFocusedScreen])
88
+ );
87
89
 
88
90
  React.useEffect(() => {
89
91
  Animated.timing(animation, {
@@ -466,7 +468,7 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
466
468
  setAllowCrashFlag(global.allowCrashReport);
467
469
  setAllowEventFlag(global.allowEvent);
468
470
  setAllowReviewFlag(global.allowReview);
469
- setAllowSessionFlag(global.allowSession); log.debug("------------------------------------------------------------------------------------------");
471
+ setAllowSessionFlag(global.allowSession); log.debug("------------------------------------------------------------------------------------------");
470
472
  log.info('API response:', message);
471
473
  log.debug("------------------------------------------------------------------------------------------");
472
474
  if (global.allowSession) { StartSession(); }
@@ -540,8 +542,6 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
540
542
  <View
541
543
  style={{
542
544
  flex: 1,
543
- width: '100%',
544
- height: '100%'
545
545
  }}
546
546
  >
547
547
  <GlobalStateProvider>
@@ -614,7 +614,7 @@ export const AddEvent = async (name, value) => {
614
614
 
615
615
  if (global.application_id != "") {
616
616
  try {
617
- const { success, message } = await EventApi(global.application_id, name, value);
617
+ const { success, message } = await EventApi(global.application_id, name, value, global.session_id);
618
618
  if (success) {
619
619
  log.debug("------------------------------------------------------------------------------------------")
620
620
  log.info('API response:', message);
@@ -638,18 +638,9 @@ export const AddEvent = async (name, value) => {
638
638
  const styles = StyleSheet.create({
639
639
  container: {
640
640
  flex: 1,
641
- width: Dimensions.get('window').width,
642
- height: Dimensions.get('window').height,
643
641
  position: 'relative',
644
642
  },
645
643
  screen: {
646
- flex: 1,
647
- width: Dimensions.get('window').width,
648
- height: Dimensions.get('window').height,
649
- position: 'absolute',
650
- top: 0,
651
- bottom: 0,
652
- left: 0,
653
- right: 0,
644
+ ...StyleSheet.absoluteFillObject,
654
645
  },
655
646
  });
@@ -8,7 +8,7 @@ const TutorialScreen = () => {
8
8
  const { goBack } = useNavigation();
9
9
 
10
10
  return (
11
- <SafeAreaView style={{ flex: 1, width: '100%', height: '100%', backgroundColor: '#FFF', alignItems: 'center', justifyContent: 'center' }}>
11
+ <SafeAreaView style={{ width: '100%', height: '100%', backgroundColor: '#FFF', alignItems: 'center', justifyContent: 'center' }}>
12
12
  <StatusBar
13
13
  backgroundColor='#fff'
14
14
  barStyle={'dark-content'}
package/src/index.tsx CHANGED
@@ -125,7 +125,7 @@ export const addCustomUser = (id, name, email, country, other) => {
125
125
 
126
126
  export const fetchRemoteCodeValue = async (key: String) => {
127
127
  try {
128
- const result = await FetchRemoteCodeAPI(key, global.application_id);
128
+ const result = await FetchRemoteCodeAPI(key, global.application_id, global.session_id);
129
129
 
130
130
  if (result?.success) {
131
131
  return result?.data