Skip to content

Commit b185985

Browse files
committed
💎 Bump version to 8.1.5
2 parents 422f71e + 4e074ef commit b185985

File tree

10 files changed

+104
-10
lines changed

10 files changed

+104
-10
lines changed

android/build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,13 @@ dependencies {
2929
exclude group: 'com.android.support:appcompat-v7'
3030
}
3131
}
32+
33+
task upload_sourcemap(type: Exec) {
34+
commandLine 'sh', './upload_sourcemap.sh'
35+
}
36+
37+
tasks.whenTaskAdded { task ->
38+
if (task.name == 'preReleaseBuild') {
39+
task.dependsOn upload_sourcemap
40+
}
41+
}

android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,9 +1666,8 @@ public void run() {
16661666
@ReactMethod
16671667
public void hasChats(Callback callback) {
16681668
boolean hasChats = Replies.hasChats();
1669-
if (hasChats) {
1670-
callback.invoke();
1671-
}
1669+
callback.invoke(hasChats);
1670+
16721671
}
16731672

16741673
@ReactMethod

android/upload_sourcemap.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
cd ..
3+
cd ..
4+
cd ..
5+
#Generate android sourcemap
6+
react-native bundle --platform android \
7+
--entry-file index.js \
8+
--dev false \
9+
--bundle-output ./android/main.jsbundle \
10+
--sourcemap-output ./android-sourcemap.json &&
11+
zip ./android-sourcemap.zip ./android-sourcemap.json
12+
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
17+
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)
20+
fi
21+
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 1
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"
29+
30+
echo
31+
fi

ios/RNInstabug/InstabugReactBridge.m

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,8 @@ - (dispatch_queue_t)methodQueue {
567567

568568
RCT_EXPORT_METHOD(hasChats:(RCTResponseSenderBlock) callback) {
569569
BOOL hasChats = IBGReplies.hasChats;
570-
if (hasChats) {
571-
callback(nil);
572-
573-
}
570+
callback(@[@(hasChats)]);
571+
574572
}
575573

576574
RCT_EXPORT_METHOD(showReplies) {

ios/upload_sourcemap.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
cd "${SRCROOT}"
3+
cd ..
4+
if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
5+
. "$HOME/.nvm/nvm.sh"
6+
elif [[ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]]; then
7+
. "$(brew --prefix nvm)/nvm.sh"
8+
fi
9+
export NODE_BINARY=node
10+
#Generate ios sourcemap
11+
react-native bundle --platform ios \
12+
--entry-file index.js \
13+
--dev false \
14+
--bundle-output ./ios/main.jsbundle \
15+
--sourcemap-output ./ios-sourcemap.json &&
16+
zip ./ios-sourcemap.zip ./ios-sourcemap.json
17+
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
22+
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)
25+
fi
26+
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 1
30+
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
35+
fi

link.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Instabug.framework/strip-frameworks.sh"
2222
SCRIPTEND
2323

24+
INSTABUG_UPLOAD_NAME = "Upload Sourcemap"
25+
26+
INSTABUG_UPLOAD_SCRIPT = <<-SCRIPTEND
27+
bash "../node_modules/instabug-reactnative/ios/upload_sourcemap.sh"
28+
SCRIPTEND
29+
2430
# Get useful variables
2531
project = Xcodeproj::Project.open(project_location)
2632
frameworks_group = project.groups.find { |group| group.display_name == 'Frameworks' }
@@ -68,6 +74,11 @@
6874
#Add New Run Script Phase to Build Phases
6975
phase = target.new_shell_script_build_phase(INSTABUG_PHASE_NAME)
7076
phase.shell_script = INSTABUG_PHASE_SCRIPT
77+
78+
#Add New Run Script Phase to Build Phases
79+
upload_build_phase = target.new_shell_script_build_phase(INSTABUG_UPLOAD_NAME)
80+
upload_build_phase.shell_script = INSTABUG_UPLOAD_SCRIPT
81+
upload_build_phase.run_only_for_deployment_postprocessing = '1'
7182
end
7283

7384
# Save Xcode project

link_bridge.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const exec = require('child_process').exec;
2+
exec("ruby ./node_modules/instabug-reactnative/link.rb || echo \"Ruby doesn't exist, if you're building this for Android only, then feel free to ignore this error, otherwise please install Ruby and run 'react-native link instabug-reactnative' again\"");

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "instabug-reactnative",
3-
"version": "8.1.4",
3+
"version": "8.1.5",
44
"description": "React Native plugin for integrating the Instabug SDK",
55
"main": "index.js",
66
"types": "index.d.ts",
@@ -24,8 +24,8 @@
2424
"homepage": "https://github.com/Instabug/instabug-reactnative#readme",
2525
"rnpm": {
2626
"commands": {
27-
"postlink": "ruby ./node_modules/instabug-reactnative/link.rb || echo \"Ruby doesn't exist, if you're building this for Android only, then feel free to ignore this error, otherwise please install Ruby and run 'react-native link instabug-reactnative' again\"",
28-
"preunlink": "ruby ./node_modules/instabug-reactnative/unlink.rb || echo \"Ruby doesn't exist, if you're building this for Android only, then feel free to ignore this error, otherwise please install Ruby and run 'react-native link instabug-reactnative' again\""
27+
"postlink": "node node_modules/instabug-reactnative/link_bridge.js",
28+
"preunlink": "node node_modules/instabug-reactnative/unlink_bridge.js"
2929
},
3030
"android": {
3131
"packageInstance": "\t\tnew RNInstabugReactnativePackage.Builder(\"YOUR_ANDROID_APPLICATION_TOKEN\",MainApplication.this)\n\t\t\t\t\t\t\t.setInvocationEvent(\"shake\")\n\t\t\t\t\t\t\t.setPrimaryColor(\"#1D82DC\")\n\t\t\t\t\t\t\t.setFloatingEdge(\"left\")\n\t\t\t\t\t\t\t.setFloatingButtonOffsetFromTop(250)\n\t\t\t\t\t\t\t.build()"

unlink.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
INSTABUG_PHASE_NAME = "Strip Frameworks"
1818

19+
INSTABUG_UPLOAD_NAME = "Upload Sourcemap"
20+
1921
# Get useful variables
2022
project = Xcodeproj::Project.open(project_location)
2123
frameworks_group = project.groups.find { |group| group.display_name == 'Frameworks' }
@@ -45,6 +47,10 @@
4547
#Delete New Run Script Phase from Build Phases
4648
shell_script_build_phase = target.shell_script_build_phases.find { |build_phase| build_phase.to_s == INSTABUG_PHASE_NAME }
4749
target.build_phases.delete(shell_script_build_phase)
50+
51+
#Delete New Run Script Phase from Build Phases
52+
shell_script_build_phase = target.shell_script_build_phases.find { |build_phase| build_phase.to_s == INSTABUG_UPLOAD_NAME }
53+
target.build_phases.delete(shell_script_build_phase)
4854
end
4955

5056
# Save Xcode project

unlink_bridge.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const exec = require('child_process').exec;
2+
exec("ruby ./node_modules/instabug-reactnative/unlink.rb || echo \"Ruby doesn't exist, if you're building this for Android only, then feel free to ignore this error, otherwise please install Ruby and run 'react-native link instabug-reactnative' again\"");

0 commit comments

Comments
 (0)