Skip to content

Commit a7b55c0

Browse files
authored
Merge branch 'master' into fix/network-logger-defensive-coding
2 parents e5a2b89 + ff8b588 commit a7b55c0

File tree

7 files changed

+85
-63
lines changed

7 files changed

+85
-63
lines changed

.circleci/config.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,8 @@ jobs:
1414
- checkout:
1515
path: ~/project
1616

17-
- restore_cache:
18-
key: yarn-v1-{{ checksum "yarn.lock" }}-{{ arch }}
19-
20-
- restore_cache:
21-
key: node-v1-{{ checksum "package.json" }}-{{ arch }}
22-
2317
- run: yarn
2418

25-
- save_cache:
26-
key: yarn-v1-{{ checksum "yarn.lock" }}-{{ arch }}
27-
paths:
28-
- ~/.cache/yarn
29-
30-
- save_cache:
31-
key: node-v1-{{ checksum "package.json" }}-{{ arch }}
32-
paths:
33-
- node_modules
34-
3519
- run:
3620
name: jest tests
3721
command: |

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## master
22

33
* Fixes a crash caused by the network logger when the object passed is too large
4+
* Adds source map upload script support for environment variables use inside Info.plist
45

56
## v9.1.9 (2020-10-01)
67

README.md

Lines changed: 47 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -113,46 +113,6 @@ import Instabug from 'instabug-reactnative';
113113
}
114114
}
115115
```
116-
## Update Guide
117-
### Updating to versions 8.0-8.4.x
118-
119-
When updating to version 8.0 through 8.4.x, you'll need to perform the steps below.
120-
121-
1. Unlink Instabug
122-
```bash
123-
react-native unlink instabug-reactnative
124-
```
125-
126-
2. Install the new version of Instabug
127-
```bash
128-
npm install instabug-reactnative
129-
```
130-
131-
3. Link Instabug
132-
```bash
133-
react-native link instabug-reactnative
134-
```
135-
136-
### Updating to version 8.5
137-
138-
_Only for apps using React Native >= 0.60. If you're using a lower version, you don't need to perform any extra steps when updating._
139-
140-
Version 8.5 adds support for React Native 0.60. To use Instabug 8.5 with React Native 0.60, you'll need to perform the following steps.
141-
142-
1. Unlink Instabug
143-
```bash
144-
react-native unlink instabug-reactnative
145-
```
146-
147-
2. Install the new version of Instabug
148-
```bash
149-
npm install instabug-reactnative
150-
```
151-
152-
3. Add Instabug to your project
153-
```bash
154-
react-native add-instabug
155-
```
156116
157117
## Microphone and Photo Library Usage Description (iOS Only)
158118
@@ -201,9 +161,9 @@ NetworkLogger.setEnabled(false);
201161
202162
Instabug Repro Steps are enabled by default. It captures a screenshot of each screen the user navigates to. These screens are attached to the BugReport when sent.
203163
204-
We support the 2 most popular React Native navigation libraries:
164+
We support the two most popular React Native navigation libraries:
205165
206-
* **react-navigation**
166+
* **[react-navigation](https://github.com/react-navigation/react-navigation)**
207167
208168
* **v5**
209169
set the `onStateChange` to `Instabug.onStateChange` in your NavigationContainer as follows:
@@ -222,9 +182,10 @@ We support the 2 most popular React Native navigation libraries:
222182
onNavigationStateChange={ Instabug.onNavigationStateChange } />
223183
);
224184
```
225-
* **react-native-navigation**
226185
227-
Register `Instabug.componentDidAppearListener` listener using:
186+
* **[react-native-navigation](https://github.com/wix/react-native-navigation)**
187+
188+
Register `Instabug.componentDidAppearListener` listener using:
228189
```javascript
229190
Navigation.events().registerComponentDidAppearListener( Instabug.componentDidAppearListener );
230191
```
@@ -241,9 +202,51 @@ You can disable Repro Steps using the following API:
241202
Instabug.setReproStepsMode(Instabug.reproStepsMode.disabled);
242203
```
243204
205+
## Update Guide
206+
### Updating to versions 8.0-8.4.x
207+
208+
When updating to version 8.0 through 8.4.x, you'll need to perform the steps below.
209+
210+
1. Unlink Instabug
211+
```bash
212+
react-native unlink instabug-reactnative
213+
```
214+
215+
2. Install the new version of Instabug
216+
```bash
217+
npm install instabug-reactnative
218+
```
219+
220+
3. Link Instabug
221+
```bash
222+
react-native link instabug-reactnative
223+
```
224+
225+
### Updating to version 8.5
226+
227+
_Only for apps using React Native >= 0.60. If you're using a lower version, you don't need to perform any extra steps when updating._
228+
229+
Version 8.5 adds support for React Native 0.60. To use Instabug 8.5 with React Native 0.60, you'll need to perform the following steps.
230+
231+
1. Unlink Instabug
232+
```bash
233+
react-native unlink instabug-reactnative
234+
```
235+
236+
2. Install the new version of Instabug
237+
```bash
238+
npm install instabug-reactnative
239+
```
240+
241+
3. Add Instabug to your project
242+
```bash
243+
react-native add-instabug
244+
```
245+
244246
## Features that are not supported yet
245247
246248
- Push Notification Support for In-App Messaging
249+
- [User Steps](https://help.instabug.com/en/articles/2515300-instabug-report-logs-user-steps).
247250
248251
## Documentation
249252

__tests__/index.spec.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ describe('Instabug Module', () => {
7474
setIBGLogPrintsToConsole.resetHistory();
7575
setPushNotificationsEnabled.resetHistory();
7676
log.resetHistory();
77+
setSdkDebugLogsLevel.resetHistory();
7778
setDebugEnabled.resetHistory();
7879
enable.resetHistory();
7980
disable.resetHistory();
@@ -367,13 +368,24 @@ describe('Instabug Module', () => {
367368

368369
});
369370

370-
it('should call the native method setSdkDebugLogsLevel', () => {
371+
it('should call the native method setSdkDebugLogsLevel on iOS', () => {
371372
const debugLevel = Instabug.sdkDebugLogsLevel.sdkDebugLogsLevelVerbose;
373+
374+
Platform.OS = 'ios';
372375
Instabug.setSdkDebugLogsLevel(debugLevel);
373376

374377
expect(setSdkDebugLogsLevel.calledOnceWithExactly(debugLevel)).toBe(true);
375378
});
376379

380+
it('should not call the native method setSdkDebugLogsLevel on Android', () => {
381+
const debugLevel = Instabug.sdkDebugLogsLevel.sdkDebugLogsLevelVerbose;
382+
383+
Platform.OS = 'android';
384+
Instabug.setSdkDebugLogsLevel(debugLevel);
385+
386+
expect(setSdkDebugLogsLevel.notCalled).toBe(true);
387+
});
388+
377389
it('should call the native method setUserAttribute', () => {
378390

379391
const key = 'age';

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ const InstabugModule = {
165165
*
166166
*/
167167
setSdkDebugLogsLevel(sdkDebugLogsLevel) {
168-
Instabug.setSdkDebugLogsLevel(sdkDebugLogsLevel);
168+
if (Platform.OS === 'ios') {
169+
Instabug.setSdkDebugLogsLevel(sdkDebugLogsLevel);
170+
}
169171
},
170172

171173
/* istanbul ignore next */

ios/RNInstabug/InstabugReactBridge.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,11 @@ - (dispatch_queue_t)methodQueue {
252252
}
253253

254254
RCT_EXPORT_METHOD(getUserAttribute:(NSString *)key callback:(RCTResponseSenderBlock)callback) {
255+
@try {
255256
callback(@[[Instabug userAttributeForKey:key]]);
257+
} @catch (NSException *exception) {
258+
callback(@[[NSNull null]]);
259+
}
256260
}
257261

258262
RCT_EXPORT_METHOD(removeUserAttribute:(NSString *)key) {

ios/upload_sourcemap.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cd ${PROJECT_DIR}
33
cd ..
44
if [ -s "$HOME/.nvm/nvm.sh" ]; then
55
. "$HOME/.nvm/nvm.sh"
6-
elif [ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]; then
6+
elif [ -x "$(command -v brew)" ] && [ -s "$(brew --prefix nvm)/nvm.sh" ]; then
77
. "$(brew --prefix nvm)/nvm.sh"
88
fi
99
export NODE_BINARY=node
@@ -23,13 +23,29 @@ else
2323
echo "CFBundleVersion could not be found, please upload the sourcemap files manually"
2424
exit 0
2525
fi
26+
INSTABUG_APP_VERSION_CODE_ENV=$(grep -o '$(.*)' <<< $INSTABUG_APP_VERSION_CODE | cut -d "(" -f2 | cut -d ")" -f1)
27+
if !([ ! "${INSTABUG_APP_VERSION_CODE_ENV}" ] || [ -z "${INSTABUG_APP_VERSION_CODE_ENV}" ]); then
28+
INSTABUG_APP_VERSION_CODE=${!INSTABUG_APP_VERSION_CODE_ENV}
29+
if [ ! "${INSTABUG_APP_VERSION_CODE}" ] || [ -z "${INSTABUG_APP_VERSION_CODE}" ]; then
30+
echo "Environment variable $INSTABUG_APP_VERSION_CODE_ENV was specified inside Info.plist but was not found, please upload the sourcemap files manually"
31+
exit 0
32+
fi
33+
fi
2634
fi
2735
if [ ! "${INSTABUG_APP_VERSION_NAME}" ] || [ -z "${INSTABUG_APP_VERSION_NAME}" ]; then
2836
INSTABUG_APP_VERSION_NAME=$( defaults read ${PRODUCT_SETTINGS_PATH} CFBundleShortVersionString )
2937
if [ ! "${INSTABUG_APP_VERSION_NAME}" ] || [ -z "${INSTABUG_APP_VERSION_NAME}" ]; then
3038
echo "CFBundleShortVersionString could not be found, please upload the sourcemap files manually"
3139
exit 0
3240
fi
41+
INSTABUG_APP_VERSION_NAME_ENV=$(grep -o '$(.*)' <<< $INSTABUG_APP_VERSION_NAME | cut -d "(" -f2 | cut -d ")" -f1)
42+
if !([ ! "${INSTABUG_APP_VERSION_NAME_ENV}" ] || [ -z "${INSTABUG_APP_VERSION_NAME_ENV}" ]); then
43+
INSTABUG_APP_VERSION_NAME=${!INSTABUG_APP_VERSION_NAME_ENV}
44+
if [ ! "${INSTABUG_APP_VERSION_NAME}" ] || [ -z "${INSTABUG_APP_VERSION_NAME}" ]; then
45+
echo "Environment variable $INSTABUG_APP_VERSION_NAME_ENV was specified inside Info.plist but was not found, please upload the sourcemap files manually"
46+
exit 0
47+
fi
48+
fi
3349
fi
3450
VERSION='{"code":"'"$INSTABUG_APP_VERSION_CODE"'","name":"'"$INSTABUG_APP_VERSION_NAME"'"}'
3551
echo "Instabug: Token found" "\""${INSTABUG_APP_TOKEN}"\""

0 commit comments

Comments
 (0)