shakebug-react-native 2.4.3 → 2.4.4
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 +32 -0
- package/package.json +1 -1
- package/src/APIs/AddReview.js +1 -1
- package/src/APIs/Event.js +2 -1
- package/src/APIs/FetchRemoteCodeAPI.js +3 -2
- package/src/Componanats/NavigationContext.js +10 -8
- package/src/Componanats/ShakeFunction.js +4 -6
- package/src/Screens/AddDetailsScreen.js +2 -2
- package/src/Screens/FirstScreen.js +2 -2
- package/src/Screens/Shakebug.js +14 -23
- package/src/Screens/TutorialScreen.js +1 -1
- package/src/index.tsx +1 -1
package/README.md
CHANGED
|
@@ -162,6 +162,28 @@ export default App = () => {
|
|
|
162
162
|
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
+
Add Custom User
|
|
166
|
+
|
|
167
|
+
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.
|
|
168
|
+
|
|
169
|
+
```javascript
|
|
170
|
+
|
|
171
|
+
import { Button } from 'react-native';
|
|
172
|
+
import { addCustomUser } from 'react-native-shakebug';
|
|
173
|
+
|
|
174
|
+
export default App = () => {
|
|
175
|
+
return(
|
|
176
|
+
<Button
|
|
177
|
+
title='Prees'
|
|
178
|
+
onPress={() => {
|
|
179
|
+
addCustomUser("user_id", "John Doe", "john@example.com", "US", "Any other info")
|
|
180
|
+
}}
|
|
181
|
+
/>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
|
|
165
187
|
## Properties
|
|
166
188
|
|
|
167
189
|
<table>
|
|
@@ -252,6 +274,16 @@ export default App = () => {
|
|
|
252
274
|
<td>If you want add event to any screen or activity use following method</td>
|
|
253
275
|
<td>addEventKey("Key_name", value)</td>
|
|
254
276
|
</tr>
|
|
277
|
+
<tr>
|
|
278
|
+
<td>fetchRemoteCodeValue</td>
|
|
279
|
+
<td>Fetch dynamic configuration values based on predefined keys</td>
|
|
280
|
+
<td>fetchRemoteCodeValue("key")</td>
|
|
281
|
+
</tr>
|
|
282
|
+
<tr>
|
|
283
|
+
<td>addCustomUser</td>
|
|
284
|
+
<td>Add custom user details to reports and events</td>
|
|
285
|
+
<td>addCustomUser(id, name, email, country, other)</td>
|
|
286
|
+
</tr>
|
|
255
287
|
</table>
|
|
256
288
|
|
|
257
289
|
## 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.
|
|
4
|
+
"version": "2.4.4",
|
|
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": {
|
package/src/APIs/AddReview.js
CHANGED
|
@@ -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("
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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()
|
|
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()
|
|
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={{
|
|
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={{
|
|
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={{
|
|
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={{
|
|
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={{
|
package/src/Screens/Shakebug.js
CHANGED
|
@@ -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.
|
|
56
|
+
global.sdk_version = "2.4.4";
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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);
|
|
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
|
-
|
|
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={{
|
|
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
|