Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[issue-817] Add Bugsnag - Error Boundary #912

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,8 @@ dependencies {

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
apply plugin: "com.bugsnag.android.gradle"

bugsnag {
uploadReactNativeMappings = true
}
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@
<data android:scheme="https" android:host="mobile.subwallet.app" />
</intent-filter>
</activity>
<meta-data android:name="com.bugsnag.android.API_KEY" android:value="e91123b94303311113a6318f6b269502" />
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package app.subwallet.mobile;

import com.bugsnag.android.Bugsnag;
import android.app.Application;
import android.webkit.WebView;
import com.facebook.react.PackageList;
Expand Down Expand Up @@ -53,6 +54,7 @@ public ReactNativeHost getReactNativeHost() {
@Override
public void onCreate() {
super.onCreate();
Bugsnag.start(this);
WebView.setWebContentsDebuggingEnabled(true);
SoLoader.init(this, /* native exopackage */ false);
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
Expand Down
1 change: 1 addition & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ buildscript {
}
dependencies {
classpath("com.android.tools.build:gradle:7.3.1")
classpath("com.bugsnag:bugsnag-android-gradle-plugin:7.+")
classpath("com.facebook.react:react-native-gradle-plugin")
}
}
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import Bugsnag from '@bugsnag/react-native';
Bugsnag.start();

/**
* @format
*/
Expand Down
6 changes: 6 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
PODS:
- boost (1.76.0)
- BugsnagReactNative (7.20.2):
- React-Core
- BVLinearGradient (2.7.3):
- React-Core
- CocoaAsyncSocket (7.6.5)
Expand Down Expand Up @@ -558,6 +560,7 @@ PODS:

DEPENDENCIES:
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
- "BugsnagReactNative (from `../node_modules/@bugsnag/react-native`)"
- BVLinearGradient (from `../node_modules/react-native-linear-gradient`)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
Expand Down Expand Up @@ -682,6 +685,8 @@ SPEC REPOS:
EXTERNAL SOURCES:
boost:
:podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec"
BugsnagReactNative:
:path: "../node_modules/@bugsnag/react-native"
BVLinearGradient:
:path: "../node_modules/react-native-linear-gradient"
DoubleConversion:
Expand Down Expand Up @@ -825,6 +830,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost: 57d2868c099736d80fcd648bf211b4431e51a558
BugsnagReactNative: bf6f4ebababa8536726b3014c7d3e4af8c53d488
BVLinearGradient: fbe308a1d19a8133f69e033abc85d8008644f5e3
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
Expand Down
17 changes: 16 additions & 1 deletion ios/SubWalletMobile.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */,
E235C05ADACE081382539298 /* [CP] Copy Pods Resources */,
1764799301F34FBEA2A3EC74 /* Upload source maps to Bugsnag */,
);
buildRules = (
);
Expand Down Expand Up @@ -288,7 +289,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
shellScript = "export EXTRA_PACKAGER_ARGS=\"--sourcemap-output $TMPDIR/$(md5 -qs \"$CONFIGURATION_BUILD_DIR\")-main.jsbundle.map\"\nset -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
};
00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
Expand Down Expand Up @@ -421,6 +422,20 @@
shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n";
showEnvVarsInLog = 0;
};
1764799301F34FBEA2A3EC74 /* Upload source maps to Bugsnag */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
name = "Upload source maps to Bugsnag";
inputPaths = (
);
outputPaths = (
);
shellPath = /bin/sh;
shellScript = "SOURCE_MAP=\"$TMPDIR/$(md5 -qs \"$CONFIGURATION_BUILD_DIR\")-main.jsbundle.map\" ../node_modules/@bugsnag/react-native/bugsnag-react-native-xcode.sh";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down
5 changes: 4 additions & 1 deletion ios/SubWalletMobile/AppDelegate.mm
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import <Bugsnag/Bugsnag.h>
#import "AppDelegate.h"
#import <React/RCTLinkingManager.h>
#import <React/RCTBundleURLProvider.h>
Expand All @@ -7,7 +8,9 @@ @implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.moduleName = @"SubWalletMobile";
[Bugsnag start];

self.moduleName = @"SubWalletMobile";
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
[super application:application didFinishLaunchingWithOptions:launchOptions];
Expand Down
7 changes: 6 additions & 1 deletion ios/SubWalletMobile/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<key>NSCameraUsageDescription</key>
<string>Camera is used to capture QR code</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone is used to record audio</string>
<string>Microphone is used to record audio</string>
<key>NSFaceIDUsageDescription</key>
<string>Enabling Face ID allows you quick and secure access to your account.</string>
<key>NSLocationWhenInUseUsageDescription</key>
Expand Down Expand Up @@ -112,5 +112,10 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>bugsnag</key>
<dict>
<key>apiKey</key>
<string>e91123b94303311113a6318f6b269502</string>
</dict>
</dict>
</plist>
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"test": "jest"
},
"dependencies": {
"@bugsnag/react-native": "^7.20.2",
"@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/free-brands-svg-icons": "^6.2.1",
"@fortawesome/free-regular-svg-icons": "^6.2.1",
Expand Down Expand Up @@ -132,6 +133,7 @@
"@babel/plugin-transform-private-methods": "^7.22.5",
"@babel/preset-env": "^7.20.2",
"@babel/runtime": "^7.20.6",
"@bugsnag/source-maps": "^2.3.1",
"@polkadot/types": "^9.9.4",
"@react-native-community/eslint-config": "^3.2.0",
"@subwallet/chain-list": "^0.2.5",
Expand Down
2 changes: 2 additions & 0 deletions src/AppNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import { WrapperParamList } from 'routes/wrapper';
import { ManageAddressBook } from 'screens/Settings/AddressBook';
import { BuyToken } from 'screens/Home/Crypto/BuyToken';
import useCheckEmptyAccounts from 'hooks/useCheckEmptyAccounts';
import Bugsnag from '@bugsnag/react-native';

interface Props {
isAppReady: boolean;
Expand Down Expand Up @@ -145,6 +146,7 @@ const AppNavigator = ({ isAppReady }: Props) => {
};

const onError = (error: Error, stackTrace: string) => {
Bugsnag.notify(new Error(stackTrace));
console.warn('AppNavigator.tsx / Error boundary: ', error, stackTrace);
};

Expand Down
Loading
Loading