shakebug-react-native 2.3.1 → 2.3.3
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 +2 -1
- package/src/APIs/AddIssue.js +12 -5
- package/src/APIs/StartSession.js +2 -4
- package/src/Componanats/ErrorHandler.js +7 -8
- package/src/Componanats/ShakeFunction.js +14 -30
- package/src/Screens/Shakebug.js +81 -96
- package/src/index.tsx +1 -1
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.
|
|
4
|
+
"version": "2.3.3",
|
|
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": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"readmeFilename": "README.md",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@react-navigation/native": "^6.1.9",
|
|
32
|
+
"html2canvas": "^1.4.1",
|
|
32
33
|
"react-native-logs": "^5.1.0",
|
|
33
34
|
"rxjs": "^7.8.1",
|
|
34
35
|
"typescript": "^5.3.3"
|
package/src/APIs/AddIssue.js
CHANGED
|
@@ -12,11 +12,14 @@ async function AddIssueApi(session_id, application_id, path, isVideo, desc, emai
|
|
|
12
12
|
|
|
13
13
|
const Custom_User_Id = await ShakebugSDKSharedPreferencesModule.getString('custom_user_id')
|
|
14
14
|
|
|
15
|
+
let i = 0;
|
|
15
16
|
let internetType = "";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
NetInfo.addEventListener(stat => {
|
|
18
|
+
if (i == 0) {
|
|
19
|
+
internetType = stat.type
|
|
20
|
+
}
|
|
21
|
+
i++
|
|
22
|
+
})
|
|
20
23
|
|
|
21
24
|
let batteryLevel = parseFloat(await DeviceInfo.getBatteryLevel() * 100).toFixed(0);
|
|
22
25
|
let architecture = await DeviceInfo.supportedAbis();
|
|
@@ -28,7 +31,11 @@ async function AddIssueApi(session_id, application_id, path, isVideo, desc, emai
|
|
|
28
31
|
let osversion = await DeviceInfo.getSystemVersion()
|
|
29
32
|
const type = isVideo ? 'video/mp4' : 'image/jpg';
|
|
30
33
|
const name = isVideo ? 'video.mp4' : 'photo.jpg';
|
|
31
|
-
|
|
34
|
+
|
|
35
|
+
let media = path;
|
|
36
|
+
if (Platform.OS === 'android' && !media.startsWith('file://') && !media.startsWith('content://') && !media.startsWith('http')) {
|
|
37
|
+
media = `file://${path}`;
|
|
38
|
+
}
|
|
32
39
|
|
|
33
40
|
|
|
34
41
|
const formData = new FormData();
|
package/src/APIs/StartSession.js
CHANGED
|
@@ -14,11 +14,8 @@ async function SessionStartApi(latitude, longitude, application_id) {
|
|
|
14
14
|
|
|
15
15
|
if (latitude != "" && latitude != undefined && longitude != "" && longitude != undefined) {
|
|
16
16
|
try {
|
|
17
|
-
let BundleId = DeviceInfo.getBundleId ? DeviceInfo.getBundleId() : "UnknownApp";
|
|
18
|
-
|
|
19
17
|
await fetch(
|
|
20
18
|
`https://nominatim.openstreetmap.org/reverse?format=json&lat=${latitude}&lon=${longitude}`,
|
|
21
|
-
{ headers: { 'User-Agent': `Shakebug-SDK-Mobile-${BundleId}` } }
|
|
22
19
|
)
|
|
23
20
|
.then(response => response.json())
|
|
24
21
|
.then(async data => {
|
|
@@ -96,7 +93,8 @@ async function SessionStartApi(latitude, longitude, application_id) {
|
|
|
96
93
|
return { success: false, message: data.msg };
|
|
97
94
|
}
|
|
98
95
|
} catch (error) {
|
|
99
|
-
|
|
96
|
+
// console.error('Error fetching data:', error);
|
|
97
|
+
// throw error;
|
|
100
98
|
}
|
|
101
99
|
}
|
|
102
100
|
|
|
@@ -15,11 +15,14 @@ const AddCrashApi = async (desc) => {
|
|
|
15
15
|
let memory = await DeviceInfo.getTotalMemory() - await DeviceInfo.getUsedMemory()
|
|
16
16
|
let osversion = await DeviceInfo.getSystemVersion()
|
|
17
17
|
|
|
18
|
+
let i = 0;
|
|
18
19
|
let internetType = "";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
NetInfo.addEventListener(stat => {
|
|
21
|
+
if (i == 0) {
|
|
22
|
+
internetType = stat.type
|
|
23
|
+
}
|
|
24
|
+
i++
|
|
25
|
+
})
|
|
23
26
|
|
|
24
27
|
const arr = {
|
|
25
28
|
session_id: global.session_id,
|
|
@@ -69,12 +72,8 @@ const setGlobalErrorHandler = () => {
|
|
|
69
72
|
// Function to handle unhandled promise rejections
|
|
70
73
|
const captureUnhandledRejections = () => {
|
|
71
74
|
// Listen for unhandled promise rejections
|
|
72
|
-
const originalHandler = window.onunhandledrejection;
|
|
73
75
|
window.onunhandledrejection = (reason, promise) => {
|
|
74
76
|
logError(reason, false);
|
|
75
|
-
if (typeof originalHandler === 'function') {
|
|
76
|
-
originalHandler(reason, promise);
|
|
77
|
-
}
|
|
78
77
|
};
|
|
79
78
|
};
|
|
80
79
|
|
|
@@ -16,8 +16,6 @@ import { useGlobalState } from 'shakebug-react-native/src/Componanats/GlobalStat
|
|
|
16
16
|
|
|
17
17
|
LogBox.ignoreAllLogs()
|
|
18
18
|
|
|
19
|
-
let stopWatchIntervalId = null;
|
|
20
|
-
|
|
21
19
|
const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitle, allowToReportBugByShaking, allowToReportBugByScreenCapture, allowCrashReport }) => {
|
|
22
20
|
|
|
23
21
|
const { ShakebugSDKScreenShotDetector, ShakebugSDKSharedPreferencesModule, ShakebugSDKCustomScreenCapture} = NativeModules;
|
|
@@ -35,7 +33,7 @@ const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitl
|
|
|
35
33
|
|
|
36
34
|
useEffect(() => {
|
|
37
35
|
const subscription = DeviceEventEmitter.addListener('ScreenshotTaken', async () => {
|
|
38
|
-
if (allowToReportBugByScreenCapture == true && global.isFeatureEnabled
|
|
36
|
+
if (allowToReportBugByScreenCapture == true && (!global.isFeatureEnabled || global.isFeatureEnabled('4'))) {
|
|
39
37
|
if (!global.isScreenShotDetected && global.application_id != "" && global.application_id != undefined) {
|
|
40
38
|
OpenShakebug()
|
|
41
39
|
}
|
|
@@ -51,7 +49,7 @@ const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitl
|
|
|
51
49
|
const subscription = screenShotEmitter.addListener(
|
|
52
50
|
'ScreenshotTaken',
|
|
53
51
|
(event) => {
|
|
54
|
-
if (allowToReportBugByScreenCapture == true && global.isFeatureEnabled
|
|
52
|
+
if (allowToReportBugByScreenCapture == true && (!global.isFeatureEnabled || global.isFeatureEnabled('4'))) {
|
|
55
53
|
// setIsScreenShot(true)
|
|
56
54
|
if (!global.isScreenShotDetected && global.application_id != "" && global.application_id != undefined) {
|
|
57
55
|
OpenShakebug()
|
|
@@ -134,7 +132,7 @@ const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitl
|
|
|
134
132
|
iscrashSaveed = await ShakebugSDKSharedPreferencesModule.getString('iscrashSaveed')
|
|
135
133
|
const Custom_User_Id = await ShakebugSDKSharedPreferencesModule.getString('custom_user_id')
|
|
136
134
|
|
|
137
|
-
if (iscrashSaveed.length > 10 && allowCrashReport
|
|
135
|
+
if (iscrashSaveed.length > 10 && allowCrashReport) {
|
|
138
136
|
|
|
139
137
|
let data = JSON.parse(iscrashSaveed)
|
|
140
138
|
|
|
@@ -197,7 +195,7 @@ const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitl
|
|
|
197
195
|
global.isDraw = false;
|
|
198
196
|
global.isShow = false;
|
|
199
197
|
startTimeRef.current = null
|
|
200
|
-
|
|
198
|
+
clearInterval(intervalId);
|
|
201
199
|
setIsLoading(false)
|
|
202
200
|
global.isRecording = false;
|
|
203
201
|
navigate("AddDetailsScreen", { media: res.result.outputURL, mediaType: 'Recordvideo', themeColor: themeColor, SDKScreenTitle: `${SDKScreenTitle}` })
|
|
@@ -234,13 +232,13 @@ const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitl
|
|
|
234
232
|
return () => {
|
|
235
233
|
// AppState.removeEventListener('change', handleAppStateChange);
|
|
236
234
|
AppStateListener.remove()
|
|
237
|
-
|
|
235
|
+
clearInterval(intervalId);
|
|
238
236
|
};
|
|
239
237
|
}, []);
|
|
240
238
|
|
|
241
239
|
const startTimer = () => {
|
|
242
240
|
startTimeRef.current = Date.now();
|
|
243
|
-
|
|
241
|
+
intervalId = setInterval(() => {
|
|
244
242
|
if (global.isRecording) {
|
|
245
243
|
const elapsed = Math.floor((Date.now() - startTimeRef.current) / 1000);
|
|
246
244
|
updateTimer(elapsed);
|
|
@@ -253,7 +251,7 @@ const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitl
|
|
|
253
251
|
const sec = parseInt(elapsed % 60);
|
|
254
252
|
|
|
255
253
|
if (elapsed == global.videoDuration) {
|
|
256
|
-
|
|
254
|
+
clearInterval(intervalId);
|
|
257
255
|
setTimeout(() => {
|
|
258
256
|
Stop()
|
|
259
257
|
}, 1000)
|
|
@@ -271,7 +269,7 @@ const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitl
|
|
|
271
269
|
global.isDraw = false;
|
|
272
270
|
global.isShow = false;
|
|
273
271
|
startTimeRef.current = null
|
|
274
|
-
|
|
272
|
+
clearInterval(intervalId);
|
|
275
273
|
})
|
|
276
274
|
}
|
|
277
275
|
|
|
@@ -284,14 +282,10 @@ const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitl
|
|
|
284
282
|
let xdata = 0;
|
|
285
283
|
let ydata = 0;
|
|
286
284
|
let zdata = 0;
|
|
287
|
-
let isMounted = true;
|
|
288
|
-
let localSubscription = null;
|
|
289
|
-
let localPollingInterval = null;
|
|
290
285
|
|
|
291
286
|
DeviceInfo.isEmulator().then(res => {
|
|
292
|
-
if (!
|
|
293
|
-
|
|
294
|
-
localSubscription = accelerometer.subscribe(async ({ x, y, z, timestamp }) => {
|
|
287
|
+
if (!res && isRecording == false && allowToReportBugByShaking !== false && (!global.isFeatureEnabled || global.isFeatureEnabled('2'))) {
|
|
288
|
+
const subscription = accelerometer.subscribe(async ({ x, y, z, timestamp }) => {
|
|
295
289
|
|
|
296
290
|
let calculate = Math.sqrt(x * x + y * y + z * z);
|
|
297
291
|
|
|
@@ -310,7 +304,7 @@ const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitl
|
|
|
310
304
|
const ImgUrl = await ref.current.capture()
|
|
311
305
|
if (!isShow) {
|
|
312
306
|
if (ImgUrl != undefined || ImgUrl != null) {
|
|
313
|
-
|
|
307
|
+
subscription.unsubscribe();
|
|
314
308
|
global.IsBackground = false
|
|
315
309
|
global.isShakebugSDKOpen = true
|
|
316
310
|
navigate("FirstScreen", { img: `${ImgUrl}`, themeColor: `${themeColor}`, SDKScreenTitle: `${SDKScreenTitle}` })
|
|
@@ -339,7 +333,7 @@ const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitl
|
|
|
339
333
|
|
|
340
334
|
}
|
|
341
335
|
if (ImgUrl != undefined || ImgUrl != null) {
|
|
342
|
-
|
|
336
|
+
subscription.unsubscribe();
|
|
343
337
|
global.isShakebugSDKOpen = true
|
|
344
338
|
navigate("FirstScreen", { img: `${ImgUrl}`, themeColor: `${themeColor}`, SDKScreenTitle: `${SDKScreenTitle}` })
|
|
345
339
|
}
|
|
@@ -356,7 +350,7 @@ const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitl
|
|
|
356
350
|
})
|
|
357
351
|
|
|
358
352
|
if (isFocused == false) {
|
|
359
|
-
|
|
353
|
+
subscription.unsubscribe()
|
|
360
354
|
xdata = 0;
|
|
361
355
|
ydata = 0;
|
|
362
356
|
zdata = 0;
|
|
@@ -365,7 +359,7 @@ const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitl
|
|
|
365
359
|
}
|
|
366
360
|
}
|
|
367
361
|
else {
|
|
368
|
-
|
|
362
|
+
setInterval(() => {
|
|
369
363
|
if (global.isTrigger == true && global.isShakebugOpen == false) {
|
|
370
364
|
global.isShakebugOpen = true;
|
|
371
365
|
global.isTrigger = true;
|
|
@@ -375,16 +369,6 @@ const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitl
|
|
|
375
369
|
}
|
|
376
370
|
})
|
|
377
371
|
|
|
378
|
-
return () => {
|
|
379
|
-
isMounted = false;
|
|
380
|
-
if (localSubscription) {
|
|
381
|
-
localSubscription.unsubscribe();
|
|
382
|
-
}
|
|
383
|
-
if (localPollingInterval) {
|
|
384
|
-
clearInterval(localPollingInterval);
|
|
385
|
-
}
|
|
386
|
-
};
|
|
387
|
-
|
|
388
372
|
}, [isFocused])
|
|
389
373
|
|
|
390
374
|
const OpenShakebug = async () => {
|
package/src/Screens/Shakebug.js
CHANGED
|
@@ -24,7 +24,6 @@ import { SafeAreaView } from 'react-native-safe-area-context';
|
|
|
24
24
|
|
|
25
25
|
console.ignoredYellowBox = ["Warning: Each", "Warning: Failed"];
|
|
26
26
|
|
|
27
|
-
export const ShakebugPropsContext = React.createContext({});
|
|
28
27
|
|
|
29
28
|
global.session_id = "";
|
|
30
29
|
global.application_id = "";
|
|
@@ -58,13 +57,13 @@ global.app_lunch_count = 0;
|
|
|
58
57
|
global.POPUP_LAUNCH_THRESHOLD = 3;
|
|
59
58
|
global.POPUP_COOLDOWN_DAYS = 2;
|
|
60
59
|
global.KEY_REVIEW_SUBMITTED = false;
|
|
61
|
-
global.shakebug_type = "";
|
|
62
|
-
|
|
63
|
-
global.
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
global.shakebug_type = "1";
|
|
61
|
+
global.isFeatureEnabled = (featureCode) => {
|
|
62
|
+
if (!global.shakebug_type) return true;
|
|
63
|
+
const types = global.shakebug_type.split(',');
|
|
64
|
+
if (types.includes('0')) return false;
|
|
66
65
|
if (types.includes('1')) return true;
|
|
67
|
-
return types.includes(
|
|
66
|
+
return types.includes(featureCode);
|
|
68
67
|
};
|
|
69
68
|
|
|
70
69
|
function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirstTime, ShakebugThemeColor, changeSDKScreenTitle, allowToReportBugByShakingMobile, allowToReportBugByScreenCapture, allowCrashReport, ShakebugLanguage, makeLogEnabled, setShakebugSDKEndPointURL }) {
|
|
@@ -165,13 +164,13 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
|
|
|
165
164
|
|
|
166
165
|
const afterDaysTimestamp = now + sevenDaysInMs;
|
|
167
166
|
|
|
168
|
-
if (LAST_POPUP_TIME > afterDaysTimestamp
|
|
169
|
-
setShowModal(true)
|
|
167
|
+
if (LAST_POPUP_TIME > afterDaysTimestamp) {
|
|
168
|
+
if (!global.isFeatureEnabled || global.isFeatureEnabled('6')) setShowModal(true)
|
|
170
169
|
}
|
|
171
170
|
|
|
172
171
|
}
|
|
173
|
-
else if (IS_REVIEW_SUBMITTED != "true"
|
|
174
|
-
setShowModal(true)
|
|
172
|
+
else if (IS_REVIEW_SUBMITTED != "true") {
|
|
173
|
+
if (!global.isFeatureEnabled || global.isFeatureEnabled('6')) setShowModal(true)
|
|
175
174
|
}
|
|
176
175
|
}
|
|
177
176
|
|
|
@@ -246,7 +245,7 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
|
|
|
246
245
|
}
|
|
247
246
|
|
|
248
247
|
let i = 0;
|
|
249
|
-
|
|
248
|
+
NetInfo.addEventListener(state => {
|
|
250
249
|
if (i == 0) {
|
|
251
250
|
if (state.isConnected == true) {
|
|
252
251
|
fetchData()
|
|
@@ -258,12 +257,6 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
|
|
|
258
257
|
}
|
|
259
258
|
i++;
|
|
260
259
|
})
|
|
261
|
-
|
|
262
|
-
return () => {
|
|
263
|
-
if (unsubscribe) {
|
|
264
|
-
unsubscribe();
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
260
|
}, [Android_appkey, iOS_appkey])
|
|
268
261
|
|
|
269
262
|
|
|
@@ -279,7 +272,7 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
|
|
|
279
272
|
StartSession()
|
|
280
273
|
}
|
|
281
274
|
else if (nextAppState == "background" || nextAppState == 'inactive') {
|
|
282
|
-
if (global.session_id != "" && global.IsBackground == 'true'
|
|
275
|
+
if (global.session_id != "" && global.IsBackground == 'true') {
|
|
283
276
|
async function FetchEndSessionData() {
|
|
284
277
|
try {
|
|
285
278
|
const { success, message } = await SessionEndApi(global.session_id);
|
|
@@ -322,9 +315,11 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
|
|
|
322
315
|
const { success, application_id: newApplication_id, message, total_mau, used_mau, total_video, used_video, video_duration, shakebug_type } = await MatchKeyApi(appkey, BundleId);
|
|
323
316
|
|
|
324
317
|
global.videoDuration = video_duration;
|
|
325
|
-
global.shakebug_type = shakebug_type || "";
|
|
326
318
|
|
|
327
319
|
if (success) {
|
|
320
|
+
if (shakebug_type) {
|
|
321
|
+
global.shakebug_type = shakebug_type.toString();
|
|
322
|
+
}
|
|
328
323
|
if (total_video == "Unlimited") {
|
|
329
324
|
global.AllowVideo = true;
|
|
330
325
|
}
|
|
@@ -378,7 +373,8 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
|
|
|
378
373
|
|
|
379
374
|
// For call Startsesstion and get session id
|
|
380
375
|
const StartSession = async () => {
|
|
381
|
-
if (global.
|
|
376
|
+
if (global.isFeatureEnabled && !global.isFeatureEnabled('3')) return;
|
|
377
|
+
if (global.session_id == "") {
|
|
382
378
|
try {
|
|
383
379
|
const { success, session_id: newSessionId, message } = await SessionStartApi(global.latitude, global.longitude, global.application_id);
|
|
384
380
|
if (success) {
|
|
@@ -405,9 +401,67 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
|
|
|
405
401
|
})
|
|
406
402
|
}
|
|
407
403
|
|
|
404
|
+
// For shakeFunctionscreen with childern as props
|
|
405
|
+
const ShakeScreen = () => {
|
|
406
|
+
|
|
407
|
+
DeviceInfo.isEmulator()
|
|
408
|
+
.then(res => {
|
|
409
|
+
global.isRealDevice = !res
|
|
410
|
+
})
|
|
411
|
+
|
|
412
|
+
return (
|
|
413
|
+
<ShakeFunction isRealDevice={global.isRealDevice} themeColor={ThemeColor} showTutorialScreen={showTutorialScreenFirstTime} SDKScreenTitle={[FirstScreenTitle, SecondScreenTitle]} allowToReportBugByShaking={allowToReportBugByShakingMobile} allowToReportBugByScreenCapture={allowToReportBugByScreenCapture} allowCrashReport={allowCrashReport} ShakebugLanguage={ShakebugLanguage}>
|
|
414
|
+
{children}
|
|
415
|
+
</ShakeFunction>
|
|
416
|
+
)
|
|
417
|
+
}
|
|
418
|
+
|
|
408
419
|
// For handel error globaly
|
|
409
420
|
setGlobalErrorHandler()
|
|
410
421
|
|
|
422
|
+
const { width } = Dimensions.get('window');
|
|
423
|
+
|
|
424
|
+
// For register all screen
|
|
425
|
+
const screens = {
|
|
426
|
+
ShakebugHome: ShakeScreen,
|
|
427
|
+
TutorialScreen: TutorialScreen,
|
|
428
|
+
FirstScreen: FirstScreen,
|
|
429
|
+
TrimVideoScreen: TrimVideoScreen,
|
|
430
|
+
AddDetailsScreen: AddDetailsScreen
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
// For navigation in register screen
|
|
434
|
+
const NavigationContainer = () => {
|
|
435
|
+
const { navigationState } = useNavigation();
|
|
436
|
+
const animation = React.useRef(new Animated.Value(0)).current;
|
|
437
|
+
|
|
438
|
+
React.useEffect(() => {
|
|
439
|
+
Animated.timing(animation, {
|
|
440
|
+
toValue: navigationState.length - 1,
|
|
441
|
+
duration: 300,
|
|
442
|
+
useNativeDriver: true,
|
|
443
|
+
}).start();
|
|
444
|
+
}, [navigationState]);
|
|
445
|
+
|
|
446
|
+
return (
|
|
447
|
+
<View style={styles.container}>
|
|
448
|
+
{navigationState.map((screen, index) => {
|
|
449
|
+
const ScreenComponent = screens[screen.name];
|
|
450
|
+
const translateX = animation.interpolate({
|
|
451
|
+
inputRange: [index - 1, index, index + 1],
|
|
452
|
+
outputRange: [width, 0, -width],
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
return (
|
|
456
|
+
<Animated.View key={index} style={[styles.screen, { transform: [{ translateX }] }]}>
|
|
457
|
+
<ScreenComponent {...screen.params} />
|
|
458
|
+
</Animated.View>
|
|
459
|
+
);
|
|
460
|
+
})}
|
|
461
|
+
</View>
|
|
462
|
+
);
|
|
463
|
+
};
|
|
464
|
+
|
|
411
465
|
return (
|
|
412
466
|
<View
|
|
413
467
|
style={{
|
|
@@ -415,13 +469,11 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
|
|
|
415
469
|
height: '100%'
|
|
416
470
|
}}
|
|
417
471
|
>
|
|
418
|
-
<
|
|
419
|
-
<
|
|
420
|
-
<
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
</GlobalStateProvider>
|
|
424
|
-
</ShakebugPropsContext.Provider>
|
|
472
|
+
<GlobalStateProvider>
|
|
473
|
+
<NavigationProvider>
|
|
474
|
+
<NavigationContainer />
|
|
475
|
+
</NavigationProvider>
|
|
476
|
+
</GlobalStateProvider>
|
|
425
477
|
|
|
426
478
|
<CustomeAlert
|
|
427
479
|
isVisible={isAlert}
|
|
@@ -438,79 +490,12 @@ function Shakebug({ children, Android_appkey, iOS_appkey, showTutorialScreenFirs
|
|
|
438
490
|
)
|
|
439
491
|
}
|
|
440
492
|
|
|
441
|
-
const ShakeScreenInner = () => {
|
|
442
|
-
const props = React.useContext(ShakebugPropsContext);
|
|
443
|
-
|
|
444
|
-
useEffect(() => {
|
|
445
|
-
DeviceInfo.isEmulator()
|
|
446
|
-
.then(res => {
|
|
447
|
-
global.isRealDevice = !res
|
|
448
|
-
})
|
|
449
|
-
}, []);
|
|
450
|
-
|
|
451
|
-
return (
|
|
452
|
-
<ShakeFunction
|
|
453
|
-
isRealDevice={global.isRealDevice}
|
|
454
|
-
themeColor={props.ThemeColor}
|
|
455
|
-
showTutorialScreen={props.showTutorialScreenFirstTime}
|
|
456
|
-
SDKScreenTitle={[props.FirstScreenTitle, props.SecondScreenTitle]}
|
|
457
|
-
allowToReportBugByShaking={props.allowToReportBugByShakingMobile}
|
|
458
|
-
allowToReportBugByScreenCapture={props.allowToReportBugByScreenCapture}
|
|
459
|
-
allowCrashReport={props.allowCrashReport}
|
|
460
|
-
ShakebugLanguage={props.ShakebugLanguage}
|
|
461
|
-
>
|
|
462
|
-
{props.children}
|
|
463
|
-
</ShakeFunction>
|
|
464
|
-
)
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
const screens = {
|
|
468
|
-
ShakebugHome: ShakeScreenInner,
|
|
469
|
-
TutorialScreen: TutorialScreen,
|
|
470
|
-
FirstScreen: FirstScreen,
|
|
471
|
-
TrimVideoScreen: TrimVideoScreen,
|
|
472
|
-
AddDetailsScreen: AddDetailsScreen
|
|
473
|
-
};
|
|
474
|
-
|
|
475
|
-
const NavigationContainerComponent = () => {
|
|
476
|
-
const { width } = Dimensions.get('window');
|
|
477
|
-
const { navigationState } = useNavigation();
|
|
478
|
-
const animation = React.useRef(new Animated.Value(0)).current;
|
|
479
|
-
|
|
480
|
-
React.useEffect(() => {
|
|
481
|
-
Animated.timing(animation, {
|
|
482
|
-
toValue: navigationState.length - 1,
|
|
483
|
-
duration: 300,
|
|
484
|
-
useNativeDriver: true,
|
|
485
|
-
}).start();
|
|
486
|
-
}, [navigationState]);
|
|
487
|
-
|
|
488
|
-
return (
|
|
489
|
-
<View style={styles.container}>
|
|
490
|
-
{navigationState.map((screen, index) => {
|
|
491
|
-
const ScreenComponent = screens[screen.name];
|
|
492
|
-
const translateX = animation.interpolate({
|
|
493
|
-
inputRange: [index - 1, index, index + 1],
|
|
494
|
-
outputRange: [width, 0, -width],
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
return (
|
|
498
|
-
<Animated.View key={index} style={[styles.screen, { transform: [{ translateX }] }]}>
|
|
499
|
-
<ScreenComponent {...screen.params} />
|
|
500
|
-
</Animated.View>
|
|
501
|
-
);
|
|
502
|
-
})}
|
|
503
|
-
</View>
|
|
504
|
-
);
|
|
505
|
-
};
|
|
506
|
-
|
|
507
493
|
|
|
508
494
|
export default Shakebug;
|
|
509
495
|
|
|
510
496
|
// For add event api
|
|
511
497
|
export const AddEvent = async (name, value) => {
|
|
512
|
-
|
|
513
|
-
if (!global.isFeatureEnabled?.('5')) return;
|
|
498
|
+
if (global.isFeatureEnabled && !global.isFeatureEnabled('5')) return;
|
|
514
499
|
|
|
515
500
|
const defaultConfig = {
|
|
516
501
|
levels: {
|