Skip to content

Commit cfed504

Browse files
committed
Merged in release/17.1.1 (pull request #94)
Release/17.1.1
2 parents d182b02 + ef55dfc commit cfed504

16 files changed

Lines changed: 110 additions & 74 deletions

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ If your app is running on old architecture you should use Shake RN SDK 17.0.x.
2727

2828
### Install Shake
2929

30+
#### React Native CLI
31+
3032
Execute the npm install command in your terminal:
3133
```bash
3234
npm install @shakebugs/react-native-shake
@@ -37,6 +39,17 @@ Install pods from the project root directory:
3739
cd ios && pod install && cd ..
3840
```
3941

42+
#### Expo
43+
44+
If you are using Expo, recommended way to install packages is by using `expo install` command:
45+
46+
```bash
47+
npm install @shakebugs/react-native-shake
48+
```
49+
50+
Shake is not supported in Expo Go, you need to set up [development builds](https://docs.expo.dev/develop/development-builds/create-a-build/)
51+
in order to use Shake with Expo.
52+
4053
### Start Shake
4154

4255
Call `Shake.start()` method in the *index.js* file.

example/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
22

33
<uses-permission android:name="android.permission.INTERNET" />
4+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
45

56
<application
67
android:name="com.shakebugs.react.example.MainApplication"
@@ -22,8 +23,5 @@
2223
<category android:name="android.intent.category.LAUNCHER" />
2324
</intent-filter>
2425
</activity>
25-
<meta-data
26-
android:name="com.google.android.geo.API_KEY"
27-
android:value="AIzaSyAdw2aCW8-Dg7fOOWRNfT43iH1Xjj4_uqg" />
2826
</application>
2927
</manifest>

example/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ buildscript {
33
buildToolsVersion = "35.0.0"
44
minSdkVersion = 24
55
compileSdkVersion = 35
6-
targetSdkVersion = 34
6+
targetSdkVersion = 35
77
ndkVersion = "26.1.10909125"
88
kotlinVersion = "1.9.24"
99
}

example/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { AppRegistry, Platform } from 'react-native';
22
import App from './src/App';
33
import { name as appName } from './app.json';
4-
import Shake from 'react-native-shake';
4+
import Shake from '@shakebugs/react-native-shake';
55

66
import messaging from '@react-native-firebase/messaging';
77

example/ios/Podfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ PODS:
13221322
- ReactCodegen
13231323
- ReactCommon/turbomodule/bridging
13241324
- ReactCommon/turbomodule/core
1325-
- Shake-Staging (~> 17.0.0-rc)
1325+
- Shake-Staging (~> 17.1.0-rc)
13261326
- Yoga
13271327
- React-nativeconfig (0.76.3)
13281328
- React-NativeModulesApple (0.76.3):
@@ -1605,7 +1605,7 @@ PODS:
16051605
- RNFBApp
16061606
- RNFS (2.20.0):
16071607
- React-Core
1608-
- Shake-Staging (17.0.2-rc.1616)
1608+
- Shake-Staging (17.1.0-rc.1618)
16091609
- SocketRocket (0.7.1)
16101610
- Yoga (0.0.0)
16111611

@@ -1885,7 +1885,7 @@ SPEC CHECKSUMS:
18851885
React-logger: 2736a90a3fdaed3dab1e2e9c5a5e9b3be00c287d
18861886
React-Mapbuffer: 12bbf447b326f0de8a472998eceafbdc4f43ca4e
18871887
React-microtasksnativemodule: 6483158af194b5bca6cc3c842451019c45100d80
1888-
react-native-shake: 4a7db319452f3b0c01adb15780cac3ba165baf5f
1888+
react-native-shake: fecbf5c3907abaf9857c18cbba411b59db3afbee
18891889
React-nativeconfig: f2bddc1e6c2eb793c065b37e12c513fdea88afef
18901890
React-NativeModulesApple: 43be3b84598af78efe8fcdbad90033caef83af43
18911891
React-perflogger: 2991d4258277af250eb7a2705980ebb3ef9ba85e
@@ -1918,7 +1918,7 @@ SPEC CHECKSUMS:
19181918
RNFBApp: 72b96921c64702d51eca9f3ed579c1777efd0d7e
19191919
RNFBMessaging: 2ad5a47bd81da9f2d65188292d24115f40cbba74
19201920
RNFS: 89de7d7f4c0f6bafa05343c578f61118c8282ed8
1921-
Shake-Staging: 969f693866a68e0ca7572b7c6b97388bbcb6697c
1921+
Shake-Staging: f77d61b3b376dbb23bfff829725ed49666ca5040
19221922
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
19231923
Yoga: e6c2f5a192a47cd0c5523ec8c4f7eca01d15d077
19241924

example/src/DarkModeObserver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useColorScheme } from 'react-native';
22
import { useEffect } from 'react';
3-
import Shake, { ShakeTheme } from 'react-native-shake';
3+
import Shake, { ShakeTheme } from '@shakebugs/react-native-shake';
44

55
const DarkModeObserver = (props: any) => {
66
const colorScheme = useColorScheme();

example/src/ui/shake/MainScreen.tsx

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import Shake, {
1919
ShakeTextInput,
2020
ShakeTheme,
2121
ShakeTitle,
22-
} from 'react-native-shake';
22+
} from '@shakebugs/react-native-shake';
2323
import RNFS from 'react-native-fs';
2424
import Button from '../core/Button';
2525
import Title from '../core/Title';
@@ -131,7 +131,7 @@ const MainScreen = () => {
131131
// const oldForm = Shake.getShakeForm();
132132
// oldForm.components = oldForm.components.filter(c => c.type !== 'inspect');
133133

134-
const pickerItems: Array<ShakePickerItem> = [
134+
const pickerItems: ShakePickerItem[] = [
135135
new ShakePickerItem('Mouse', 'Mouse', null, 'mouse'),
136136
new ShakePickerItem('Keyboard', 'Keyboard', null, 'keyboard'),
137137
new ShakePickerItem('Display', 'Display', null, 'display'),
@@ -206,22 +206,28 @@ const MainScreen = () => {
206206
};
207207

208208
const setNotificationEventsFilter = () => {
209-
Shake.setNotificationEventsFilter((notificationEvent) => {
210-
notificationEvent.setDescription('data_redacted');
211-
notificationEvent.setTitle('data_redacted');
212-
213-
return notificationEvent;
214-
});
209+
Shake.setNotificationEventsFilter(
210+
(
211+
notificationEvent: NotificationEventBuilder
212+
): NotificationEventBuilder | null => {
213+
notificationEvent.setDescription('data_redacted');
214+
notificationEvent.setTitle('data_redacted');
215+
216+
return notificationEvent;
217+
}
218+
);
215219
};
216220

217221
const setNetworkRequestsFilter = () => {
218-
Shake.setNetworkRequestsFilter((networkRequest) => {
219-
networkRequest.setResponseBody('data_redacted');
220-
networkRequest.setRequestBody('data_redacted');
221-
networkRequest.setDate(new Date());
222-
223-
return networkRequest;
224-
});
222+
Shake.setNetworkRequestsFilter(
223+
(networkRequest: NetworkRequestBuilder): NetworkRequestBuilder | null => {
224+
networkRequest.setResponseBody('data_redacted');
225+
networkRequest.setRequestBody('data_redacted');
226+
networkRequest.setDate(new Date());
227+
228+
return networkRequest;
229+
}
230+
);
225231
};
226232

227233
const showNotificationsSettings = () => {

ios/Shake.mm

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,20 +719,30 @@ - (NSDictionary*)mapToNetworkRequestToDict:(JS::NativeShake::NetworkRequest &)na
719719
NSDictionary *networkRequest = [[NSDictionary alloc] init];
720720
NSString *requestBody = nativeNetworkRequest.requestBody() ?: @"";
721721
NSData *data = [requestBody dataUsingEncoding:NSUTF8StringEncoding];
722+
NSNumber* statusCode = [self parseIntegerFromString:nativeNetworkRequest.statusCode()];
723+
722724
networkRequest = @{
723725
@"url": nativeNetworkRequest.url() ?: @"",
724726
@"method": nativeNetworkRequest.method() ?: @"",
725727
@"responseBody": nativeNetworkRequest.responseBody() ?: @"",
726-
@"statusCode": nativeNetworkRequest.statusCode() ?: @"",
728+
@"statusCode": statusCode ?: 0,
727729
@"requestBody": data,
728730
@"requestHeaders": nativeNetworkRequest.requestHeaders() ?: @{},
729731
@"duration": [NSNumber numberWithDouble:nativeNetworkRequest.duration() ?: 0],
730732
@"responseHeaders": nativeNetworkRequest.responseHeaders() ?: @{},
731733
@"timestamp": nativeNetworkRequest.timestamp() ?: @""
732734
};
735+
733736
return networkRequest;
734737
}
735738

739+
- (NSNumber *)parseIntegerFromString:(NSString *)string {
740+
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
741+
formatter.numberStyle = NSNumberFormatterNoStyle;
742+
743+
return [formatter numberFromString:string];
744+
}
745+
736746
- (NSDictionary*)mapToNotificationEvent:(JS::NativeShake::NotificationEvent &)nativeNotification
737747
{
738748
NSDictionary *notificationEvent = [[NSDictionary alloc] init];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "react-native-shake",
2+
"name": "@shakebugs/react-native-shake",
33
"title": "React Native Shake SDK",
44
"version": "17.0.0",
55
"description": "Shake SDK wrapper",

react-native.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module.exports = {
66
platforms: {
77
android: {
88
cmakeListsPath: 'generated/jni/CMakeLists.txt',
9+
packageImportPath: 'import com.shakebugs.react.ShakePackage;',
910
},
1011
},
1112
},

0 commit comments

Comments
 (0)