Skip to content

Commit 48f00cd

Browse files
authored
💎Bump version to 8.2.4
Exposes environment variable to be set in android and ios for the APP TOKEN Renames the token inside the script to INSTABUG_APP_TOKEN
1 parent 231dcdd commit 48f00cd

File tree

6 files changed

+64
-28
lines changed

6 files changed

+64
-28
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,29 @@ If your app doesn’t already access the microphone or photo library, we recomme
174174
175175
**The permission alert for accessing the microphone/photo library will NOT appear unless users attempt to attach a voice note/photo while using Instabug.**
176176
177+
178+
## Auto Uploading Source Map Files
179+
180+
For your app crashes to show up with a fully symbolicated stack trace, we will automatically generate the source map files and upload them to your dashboard on release build. To do so, we rely on your app token being explicitly added to `Instabug.startWithToken('YOUR_APP_TOKEN')` in JavaScript.
181+
182+
If your app token is defined as a constant or you have different tokens for both iOS and Android apps, set the token as shown below.
183+
184+
1. In Android, go to the `build.gradle` file of the library and you will find below code, replace `YOUR_APP_TOKEN` with your app token from the dashboard.
185+
186+
```java
187+
task upload_sourcemap(type: Exec) {
188+
environment "INSTABUG_APP_TOKEN", "YOUR_APP_TOKEN"
189+
commandLine 'sh', './upload_sourcemap.sh'
190+
}
191+
```
192+
193+
2. In iOS, go to the build phases of the project, you will find a build phase called `Upload Sourcemap`. Expand it you will find below lines of code, replace `YOUR_APP_TOKEN` with your token from the dashboard.
194+
195+
```bash
196+
export INSTABUG_APP_TOKEN="YOUR_APP_TOKEN"
197+
bash "../node_modules/instabug-reactnative/ios/upload_sourcemap.sh"
198+
```
199+
177200
## Documentation
178201
179202
For more details about the supported APIs and how to use them, check our [**Documentation**](https://docs.instabug.com/docs/react-native-overview).

android/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ dependencies {
3131
}
3232

3333
task upload_sourcemap(type: Exec) {
34+
environment "INSTABUG_APP_TOKEN", "YOUR_APP_TOKEN"
3435
commandLine 'sh', './upload_sourcemap.sh'
3536
}
3637

android/upload_sourcemap.sh

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
cd ..
33
cd ..
44
cd ..
5+
if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
6+
. "$HOME/.nvm/nvm.sh"
7+
elif [[ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]]; then
8+
. "$(brew --prefix nvm)/nvm.sh"
9+
fi
10+
export NODE_BINARY=node
511
#Generate android sourcemap
612
react-native bundle --platform android \
713
--entry-file index.js \
@@ -10,22 +16,24 @@ react-native bundle --platform android \
1016
--sourcemap-output ./android-sourcemap.json &&
1117
zip ./android-sourcemap.zip ./android-sourcemap.json
1218

13-
echo "Instabug: Looking for Token..."
14-
if [ ! "${APP_TOKEN}" ]; then
15-
APP_TOKEN=$(grep -r --exclude-dir={node_modules,ios,android} 'Instabug.startWithToken(\"[0-9a-zA-Z]*\"' ./ -m 1 | grep -o '\"[0-9a-zA-Z]*\"' | cut -d "\"" -f 2)
16-
fi
19+
if [ ${INSTABUG_APP_TOKEN} == "YOUR_APP_TOKEN" ]; then
20+
echo "Instabug: Looking for Token..."
21+
if [ ! "${INSTABUG_APP_TOKEN}" ]; then
22+
INSTABUG_APP_TOKEN=$(grep -r --exclude-dir={node_modules,ios,android} 'Instabug.startWithToken(\"[0-9a-zA-Z]*\"' ./ -m 1 | grep -o '\"[0-9a-zA-Z]*\"' | cut -d "\"" -f 2)
23+
fi
1724

18-
if [ ! "${APP_TOKEN}" ]; then
19-
APP_TOKEN=$(grep -r --exclude-dir={node_modules,ios,android} "Instabug.startWithToken(\'[0-9a-zA-Z]*\'" ./ -m 1 | grep -o "\'[0-9a-zA-Z]*\'" | cut -d "\"" -f 2)
25+
if [ ! "${INSTABUG_APP_TOKEN}" ]; then
26+
INSTABUG_APP_TOKEN=$(grep -r --exclude-dir={node_modules,ios,android} "Instabug.startWithToken(\'[0-9a-zA-Z]*\'" ./ -m 1 | grep -o "\'[0-9a-zA-Z]*\'" | cut -d "\"" -f 2)
27+
fi
2028
fi
2129

22-
if [ ! "${APP_TOKEN}" ] || [ -z "${APP_TOKEN}" ];then
23-
echo "Instabug: err: APP_TOKEN not found. Make sure you've added the SDK initialization line Instabug.startWithToken"
24-
exit 0
25-
else
26-
echo "Instabug: Uploading files..."
27-
#Upload android sourcemap
28-
curl -X POST 'https://api.instabug.com/api/sdk/v3/symbols_files' -F "symbols_file=@./android-sourcemap.json" -F "application_token=${APP_TOKEN}" -F "platform=react_native" -F "os=android"
2930

30-
echo
31+
if [ ! "${INSTABUG_APP_TOKEN}" ] || [ -z "${INSTABUG_APP_TOKEN}" ] || [ "${INSTABUG_APP_TOKEN}" == "YOUR_APP_TOKEN" ];then
32+
echo "Instabug: err: INSTABUG_APP_TOKEN not found. Make sure you've added the SDK initialization line Instabug.startWithToken Or added it to the environment variable in the gradle"
33+
exit 0
34+
else
35+
echo "Instabug: Uploading files..."
36+
#Upload ios sourcemap
37+
curl -X POST 'https://api.instabug.com/api/sdk/v3/symbols_files' -F "symbols_file=@./ios-sourcemap.json" -F "application_token=${INSTABUG_APP_TOKEN}" -F "platform=react_native" -F "os=ios"
38+
echo
3139
fi

ios/upload_sourcemap.sh

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,24 @@ react-native bundle --platform ios \
1515
--sourcemap-output ./ios-sourcemap.json &&
1616
zip ./ios-sourcemap.zip ./ios-sourcemap.json
1717

18-
echo "Instabug: Looking for Token..."
19-
if [ ! "${APP_TOKEN}" ]; then
20-
APP_TOKEN=$(grep -r --exclude-dir={node_modules,ios,android} 'Instabug.startWithToken(\"[0-9a-zA-Z]*\"' ./ -m 1 | grep -o '\"[0-9a-zA-Z]*\"' | cut -d "\"" -f 2)
21-
fi
18+
if [ ${INSTABUG_APP_TOKEN} == "YOUR_APP_TOKEN" ]; then
19+
echo "Instabug: Looking for Token..."
20+
if [ ! "${INSTABUG_APP_TOKEN}" ]; then
21+
INSTABUG_APP_TOKEN=$(grep -r --exclude-dir={node_modules,ios,android} 'Instabug.startWithToken(\"[0-9a-zA-Z]*\"' ./ -m 1 | grep -o '\"[0-9a-zA-Z]*\"' | cut -d "\"" -f 2)
22+
fi
2223

23-
if [ ! "${APP_TOKEN}" ]; then
24-
APP_TOKEN=$(grep -r --exclude-dir={node_modules,ios,android} "Instabug.startWithToken(\'[0-9a-zA-Z]*\'" ./ -m 1 | grep -o "\'[0-9a-zA-Z]*\'" | cut -d "\"" -f 2)
24+
if [ ! "${INSTABUG_APP_TOKEN}" ]; then
25+
INSTABUG_APP_TOKEN=$(grep -r --exclude-dir={node_modules,ios,android} "Instabug.startWithToken(\'[0-9a-zA-Z]*\'" ./ -m 1 | grep -o "\'[0-9a-zA-Z]*\'" | cut -d "\"" -f 2)
26+
fi
2527
fi
2628

27-
if [ ! "${APP_TOKEN}" ] || [ -z "${APP_TOKEN}" ];then
28-
echo "Instabug: err: APP_TOKEN not found. Make sure you've added the SDK initialization line Instabug.startWithToken"
29-
exit 0
29+
30+
if [ ! "${INSTABUG_APP_TOKEN}" ] || [ -z "${INSTABUG_APP_TOKEN}" ] || [ "${INSTABUG_APP_TOKEN}" == "YOUR_APP_TOKEN" ];then
31+
echo "Instabug: err: INSTABUG_APP_TOKEN not found. Make sure you've added the SDK initialization line Instabug.startWithToken Or added it to the environment variable in the gradle"
32+
exit 0
3033
else
31-
echo "Instabug: Uploading files..."
32-
#Upload ios sourcemap
33-
curl -X POST 'https://api.instabug.com/api/sdk/v3/symbols_files' -F "symbols_file=@./ios-sourcemap.json" -F "application_token=${APP_TOKEN}" -F "platform=react_native" -F "os=ios"
34-
echo
34+
echo "Instabug: Uploading files..."
35+
#Upload ios sourcemap
36+
curl -X POST 'https://api.instabug.com/api/sdk/v3/symbols_files' -F "symbols_file=@./ios-sourcemap.json" -F "application_token=${INSTABUG_APP_TOKEN}" -F "platform=react_native" -F "os=ios"
37+
echo
3538
fi

link.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
INSTABUG_UPLOAD_NAME = "Upload Sourcemap"
2525

2626
INSTABUG_UPLOAD_SCRIPT = <<-SCRIPTEND
27+
export INSTABUG_APP_TOKEN="YOUR_APP_TOKEN"
2728
bash "../node_modules/instabug-reactnative/ios/upload_sourcemap.sh"
2829
SCRIPTEND
2930

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "instabug-reactnative",
3-
"version": "8.2.3",
3+
"version": "8.2.4",
44
"description": "React Native plugin for integrating the Instabug SDK",
55
"main": "index.js",
66
"types": "index.d.ts",

0 commit comments

Comments
 (0)