shakebug-react-native 1.0.19 → 2.0.0

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.
@@ -0,0 +1,11 @@
1
+ //
2
+ // ShakebugSDKCustomScreenCapture.h
3
+ // RoomTap_admin
4
+ //
5
+ // Created by ideveloper2 on 28/11/24.
6
+ //
7
+
8
+ #import <React/RCTBridgeModule.h>
9
+
10
+ @interface ShakebugSDKCustomScreenCapture : NSObject <RCTBridgeModule>
11
+ @end
@@ -0,0 +1,71 @@
1
+ //
2
+ // ShakebugSDKCustomScreenCapture.m
3
+ // Shakebug
4
+ //
5
+ // Created by ideveloper2 on 28/11/24.
6
+ // Copyright © 2024 Facebook. All rights reserved.
7
+ //
8
+
9
+ #import "ShakebugSDKCustomScreenCapture.h"
10
+ #import <UIKit/UIKit.h>
11
+
12
+ @implementation ShakebugSDKCustomScreenCapture
13
+
14
+ RCT_EXPORT_MODULE();
15
+
16
+ RCT_EXPORT_METHOD(captureScreen:(RCTPromiseResolveBlock)resolve
17
+ rejecter:(RCTPromiseRejectBlock)reject)
18
+ {
19
+ // Ensure all UI operations run on the main thread
20
+ dispatch_async(dispatch_get_main_queue(), ^{
21
+ @try {
22
+ // Get all windows of the application
23
+ NSArray<UIWindow *> *windows = [UIApplication sharedApplication].windows;
24
+ if (windows.count == 0) {
25
+ reject(@"no_windows", @"No windows available to capture", nil);
26
+ return;
27
+ }
28
+
29
+ // Create a context for capturing all windows
30
+ UIScreen *mainScreen = [UIScreen mainScreen];
31
+ UIGraphicsBeginImageContextWithOptions(mainScreen.bounds.size, NO, mainScreen.scale);
32
+
33
+ // Render each window onto the context
34
+ for (UIWindow *window in windows) {
35
+ if (![window isHidden]) { // Skip hidden windows
36
+ [window drawViewHierarchyInRect:mainScreen.bounds afterScreenUpdates:YES];
37
+ }
38
+ }
39
+
40
+ // Get the final image from the context
41
+ UIImage *capturedImage = UIGraphicsGetImageFromCurrentImageContext();
42
+ UIGraphicsEndImageContext();
43
+
44
+ if (!capturedImage) {
45
+ reject(@"capture_error", @"Failed to create image context", nil);
46
+ return;
47
+ }
48
+
49
+ // Convert the image to PNG data
50
+ NSData *imageData = UIImagePNGRepresentation(capturedImage);
51
+ NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"screenshot.png"];
52
+
53
+ BOOL success = [imageData writeToFile:filePath atomically:YES];
54
+ if (!success) {
55
+ reject(@"file_error", @"Failed to save the screenshot file", nil);
56
+ return;
57
+ }
58
+
59
+ // Resolve with the file path
60
+ resolve(filePath);
61
+ }
62
+ @catch (NSException *exception) {
63
+ NSString *errorDetails = [NSString stringWithFormat:@"Exception: %@", exception.reason];
64
+ NSLog(@"Capture Screen Exception: %@", errorDetails);
65
+ reject(@"capture_error", errorDetails, nil);
66
+ }
67
+ });
68
+ }
69
+
70
+ @end
71
+
@@ -50,6 +50,7 @@
50
50
  095DA0822B909E8900E2DD76 /* EnvironmentUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 095DA0812B909E8900E2DD76 /* EnvironmentUtil.m */; };
51
51
  095DA0862B909EF600E2DD76 /* RNDeviceInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 095DA0852B909EF600E2DD76 /* RNDeviceInfo.m */; };
52
52
  0961C6572B8F406800A68E20 /* MicrophonePermissionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0961C6562B8F406800A68E20 /* MicrophonePermissionManager.m */; };
53
+ 0966B3812CF8894C00BB9F76 /* ShakebugSDKCustomScreenCapture.m in Sources */ = {isa = PBXBuildFile; fileRef = 0966B3802CF8894C00BB9F76 /* ShakebugSDKCustomScreenCapture.m */; };
53
54
  096BF6242BD38C1A0069623C /* ShakebugSDKVideoPlayerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 096BF6232BD38C1A0069623C /* ShakebugSDKVideoPlayerView.m */; };
54
55
  096BF6272BD38C5A0069623C /* ShakebugSDKVideoPlayerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 096BF6262BD38C5A0069623C /* ShakebugSDKVideoPlayerManager.m */; };
55
56
  09B93D4E2BDB6D2200FBED4F /* VideoTrim.m in Sources */ = {isa = PBXBuildFile; fileRef = 09B93D4D2BDB6D2200FBED4F /* VideoTrim.m */; };
@@ -165,6 +166,8 @@
165
166
  095DA0872B909F1C00E2DD76 /* RNDeviceInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNDeviceInfo.h; sourceTree = "<group>"; };
166
167
  0961C6552B8F400F00A68E20 /* MicrophonePermissionManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MicrophonePermissionManager.h; sourceTree = "<group>"; };
167
168
  0961C6562B8F406800A68E20 /* MicrophonePermissionManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MicrophonePermissionManager.m; sourceTree = "<group>"; };
169
+ 0966B37F2CF8892700BB9F76 /* ShakebugSDKCustomScreenCapture.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ShakebugSDKCustomScreenCapture.h; sourceTree = "<group>"; };
170
+ 0966B3802CF8894C00BB9F76 /* ShakebugSDKCustomScreenCapture.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ShakebugSDKCustomScreenCapture.m; sourceTree = "<group>"; };
168
171
  096BF6222BD38BFF0069623C /* ShakebugSDKVideoPlayerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ShakebugSDKVideoPlayerView.h; sourceTree = "<group>"; };
169
172
  096BF6232BD38C1A0069623C /* ShakebugSDKVideoPlayerView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ShakebugSDKVideoPlayerView.m; sourceTree = "<group>"; };
170
173
  096BF6252BD38C410069623C /* ShakebugSDKVideoPlayerManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ShakebugSDKVideoPlayerManager.h; sourceTree = "<group>"; };
@@ -388,6 +391,15 @@
388
391
  path = DeviceInfo;
389
392
  sourceTree = "<group>";
390
393
  };
394
+ 0966B37D2CF8883500BB9F76 /* CustomScreenShot */ = {
395
+ isa = PBXGroup;
396
+ children = (
397
+ 0966B37F2CF8892700BB9F76 /* ShakebugSDKCustomScreenCapture.h */,
398
+ 0966B3802CF8894C00BB9F76 /* ShakebugSDKCustomScreenCapture.m */,
399
+ );
400
+ path = CustomScreenShot;
401
+ sourceTree = "<group>";
402
+ };
391
403
  096BF6212BD38BF20069623C /* VideoPlayer */ = {
392
404
  isa = PBXGroup;
393
405
  children = (
@@ -490,6 +502,7 @@
490
502
  58B511D21A9E6C8500147676 = {
491
503
  isa = PBXGroup;
492
504
  children = (
505
+ 0966B37D2CF8883500BB9F76 /* CustomScreenShot */,
493
506
  09ECCD2B2C00A72F000F0BE9 /* SketchCanvas */,
494
507
  09B93D5D2BDB8E6100FBED4F /* Thumbnaill */,
495
508
  09B93D4C2BDB6D1700FBED4F /* TrimVideo */,
@@ -659,6 +672,7 @@
659
672
  0946E5F72B98786E00C1E846 /* LocationModule.m in Sources */,
660
673
  092244972B870CFC009E7378 /* RNSensorsGyroscope.m in Sources */,
661
674
  0946E5E02B98769800C1E846 /* ImagePickerManager.m in Sources */,
675
+ 0966B3812CF8894C00BB9F76 /* ShakebugSDKCustomScreenCapture.m in Sources */,
662
676
  09B93D512BDB766100FBED4F /* ShakebugSDKVideoTrim.swift in Sources */,
663
677
  0946E5D82B98769800C1E846 /* RNViewShot.m in Sources */,
664
678
  0946E5DB2B98769800C1E846 /* RNSensorsAccelerometer.m in Sources */,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shakebug-react-native",
3
3
  "title": "shakebug-react-native",
4
- "version": "1.0.19",
4
+ "version": "2.0.0",
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": {
@@ -17,7 +17,8 @@
17
17
  "crash",
18
18
  "errors",
19
19
  "reporting",
20
- "feedback"
20
+ "feedback",
21
+ "tool"
21
22
  ],
22
23
  "author": {
23
24
  "name": "Softnoesis Pvt. Ltd.",
@@ -1,3 +1,4 @@
1
+ import { NativeModules } from "react-native";
1
2
  import DeviceInfo from "../../DeviceInfo";
2
3
  import { getLocales } from "../../GetLocals/src";
3
4
 
@@ -9,6 +10,8 @@ async function SessionStartApi(latitude, longitude, application_id) {
9
10
  let city = "";
10
11
  let state = ""
11
12
 
13
+ const { ShakebugSDKSharedPreferencesModule } = NativeModules;
14
+
12
15
  if (latitude != "" && latitude != undefined && longitude != "" && longitude != undefined) {
13
16
  try {
14
17
  await fetch(
@@ -22,13 +25,29 @@ async function SessionStartApi(latitude, longitude, application_id) {
22
25
  }
23
26
  catch (err) {
24
27
  // console.log("err", err)
25
- throw err
28
+ // throw err
26
29
  }
27
30
  }
28
31
 
29
32
  let locals = getLocales()
30
33
 
31
- let uuid = await DeviceInfo.getUniqueId()
34
+ let uuid = null;
35
+ let idFromStorege = await ShakebugSDKSharedPreferencesModule.getString("uuid");
36
+
37
+ console.log("idFromStorege", idFromStorege);
38
+
39
+ if (idFromStorege == "" || idFromStorege == undefined) {
40
+ let id = await DeviceInfo.getUniqueId();
41
+ ShakebugSDKSharedPreferencesModule.setString("uuid", id)
42
+ uuid = id;
43
+ }
44
+ else {
45
+ uuid = idFromStorege;
46
+ }
47
+
48
+ console.log("uuid", uuid);
49
+
50
+
32
51
 
33
52
  let system_version = await DeviceInfo.getSystemVersion()
34
53
 
@@ -18,7 +18,7 @@ LogBox.ignoreAllLogs()
18
18
 
19
19
  const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitle, allowToReportBugByShaking, allowToReportBugByScreenCapture, allowCrashReport }) => {
20
20
 
21
- const { ShakebugSDKScreenShotDetector, ShakebugSDKSharedPreferencesModule } = NativeModules;
21
+ const { ShakebugSDKScreenShotDetector, ShakebugSDKSharedPreferencesModule, ShakebugSDKCustomScreenCapture} = NativeModules;
22
22
 
23
23
  const { navigate, focusedScreen, goToScreenAtIndex } = useNavigation();
24
24
 
@@ -321,7 +321,14 @@ const ShakeFunction = ({ children, themeColor, showTutorialScreen, SDKScreenTitl
321
321
  if (calculate.toFixed(2) >= 2.00) {
322
322
  if (global.isIOSValid == true && global.application_id != "" && global.application_id != undefined) {
323
323
  setIsScreenShot(true)
324
- const ImgUrl = await ref.current.capture()
324
+ let ImgUrl = await ref.current.capture()
325
+ try {
326
+ const filePath = await ShakebugSDKCustomScreenCapture.captureScreen();
327
+ ImgUrl = filePath
328
+ }
329
+ catch (e) {
330
+ console.log("e", e);
331
+ }
325
332
  if (ImgUrl != undefined || ImgUrl != null) {
326
333
  subscription.unsubscribe();
327
334
  global.isShakebugSDKOpen = true
@@ -281,7 +281,7 @@ const AddDetailsScreen = ({ media, updateParent, mediaType, themeColor, SDKScree
281
281
  }
282
282
 
283
283
  return (
284
- <SafeAreaView style={{ width: "100%", height: Dimensions.get('screen').height - StatusBar.currentHeight, backgroundColor: themeColor, marginTop: Platform.OS == 'ios' ? StatusBar.currentHeight : 0, paddingBottom: 0 }}>
284
+ <SafeAreaView style={{ width: "100%", height: Dimensions.get('window').height, backgroundColor: themeColor, marginTop: Platform.OS == 'ios' ? StatusBar.currentHeight : 0, paddingBottom: 0 }}>
285
285
  <StatusBar backgroundColor={ThemeColor} hidden={false} />
286
286
  <KeyboardAvoidingWrapper>
287
287
  <>
@@ -418,7 +418,7 @@ const AddDetailsScreen = ({ media, updateParent, mediaType, themeColor, SDKScree
418
418
  </View>
419
419
 
420
420
  <View style={{ alignItems: 'flex-end', marginHorizontal: 15, marginTop: '1%' }}>
421
- <Text style={{ fontSize: 16, color: "black" }}>© <Text>ShakeBug v1.0</Text></Text>
421
+ <Text style={{ fontSize: 12, color: "gray", fontWeight: '300' }}>© <Text>ShakeBug v2.0</Text></Text>
422
422
  </View>
423
423
 
424
424
  </View>
@@ -310,7 +310,7 @@ const FirstScreen = ({ img, themeColor, SDKScreenTitle }) => {
310
310
  // backgroundColor: "#181818"
311
311
 
312
312
  return (
313
- <SafeAreaView style={{ width: "100%", height: Dimensions.get('screen').height - StatusBar.currentHeight, backgroundColor: themeColor, marginTop: Platform.OS == 'ios' ? StatusBar.currentHeight : 0}}>
313
+ <SafeAreaView style={{ width: "100%", height: Dimensions.get('window').height, backgroundColor: themeColor, marginTop: Platform.OS == 'ios' ? StatusBar.currentHeight : 0}}>
314
314
  <StatusBar backgroundColor={ThemeColor} />
315
315
 
316
316
  <View style={{ width: "100%", height: "100%", backgroundColor: "#e4fdfd" }}>