Skip to content

Commit

Permalink
feat: bugsnag (#99)
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Christophe <[email protected]>
  • Loading branch information
jcdrouin21 authored May 8, 2023
1 parent 9ace1ad commit ae94a1a
Show file tree
Hide file tree
Showing 17 changed files with 2,353 additions and 18 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,14 @@ jobs:
# Actual environment variables are not being picked up
# by the build so they're put into an .env file.
- name: Create environment settings
if: env.MEDIATOR_URL != null
if: env.MEDIATOR_URL != null || env.BUGSNAG_API_KEY != null
working-directory: app
env:
MEDIATOR_URL: ${{ secrets.MEDIATOR_URL }}
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
run: |
echo "MEDIATOR_URL=${MEDIATOR_URL}" >.env
echo "MEDIATOR_URL=${MEDIATOR_URL}" >.env |
echo "BUGSNAG_API_KEY=${BUGSNAG_API_KEY}" >>.env
# https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development
- name: Create Provisioning Profile
if: github.ref_name == 'main' && needs.check-ios-secrets.outputs.isReleaseBuild == 'true'
Expand Down Expand Up @@ -301,12 +303,14 @@ jobs:
# Actual environment variables are not being picked up
# by the build so they're put into an .env file.
- name: Create environment settings
if: env.MEDIATOR_URL != null
if: env.MEDIATOR_URL != null || env.BUGSNAG_API_KEY != null
working-directory: app
env:
MEDIATOR_URL: ${{ secrets.MEDIATOR_URL }}
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
run: |
echo "MEDIATOR_URL=${MEDIATOR_URL}" >.env
echo "MEDIATOR_URL=${MEDIATOR_URL}" >.env |
echo "BUGSNAG_API_KEY=${BUGSNAG_API_KEY}" >>.env
- name: Android debug build
if: github.ref_name != 'main' || needs.check-android-secrets.outputs.isReleaseBuild != 'true'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ app/patches/react-native-gifted-chat*.patch
# xcode
xcuserdata/
.npmrc
app/ios/tmp.xcconfig
8 changes: 7 additions & 1 deletion app/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: "com.android.application"
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

import com.android.build.OutputFile

Expand Down Expand Up @@ -93,6 +94,7 @@ project.ext.react = [
]

apply from: "../../node_modules/react-native/react.gradle"
apply plugin: "com.bugsnag.android.gradle"
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

/**
Expand Down Expand Up @@ -155,6 +157,7 @@ android {


missingDimensionStrategy 'react-native-camera', 'general'
manifestPlaceholders = [API_KEY: project.env.get("BUGSNAG_API_KEY")]
}
splits {
abi {
Expand Down Expand Up @@ -237,5 +240,8 @@ task copyDownloadableDepsToLibs(type: Copy) {
into 'libs'
}

apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

bugsnag {
uploadReactNativeMappings = true
}
1 change: 1 addition & 0 deletions app/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@
<data android:scheme="qcwallet"/>
</intent-filter>
</activity>
<meta-data android:name="com.bugsnag.android.API_KEY" android:value="${API_KEY}" />
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ca.qc.gouv.portefeuilleqc;

import com.bugsnag.android.Bugsnag;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
Expand Down Expand Up @@ -44,6 +45,7 @@ public ReactNativeHost getReactNativeHost() {
@Override
public void onCreate() {
super.onCreate();
Bugsnag.start(this);
SoLoader.init(this, /* native exopackage */ false);
}
}
Expand Down
1 change: 1 addition & 0 deletions app/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.2.1")
classpath("com.bugsnag:bugsnag-android-gradle-plugin:7.+")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
20 changes: 17 additions & 3 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import '@formatjs/intl-datetimeformat/polyfill'
import '@formatjs/intl-datetimeformat/locale-data/en' // locale-data for en
import '@formatjs/intl-datetimeformat/add-all-tz' // Add ALL tz data

import BugsnagPluginReactNavigation from '@bugsnag/plugin-react-navigation'
import Bugsnag from '@bugsnag/react-native'
import { NavigationContainer } from '@react-navigation/native'
import React from 'react'
import { AppRegistry } from 'react-native'
Expand All @@ -31,6 +33,16 @@ const { theme } = qcwallet

const { ColorPallet } = theme

Bugsnag.start({
plugins: [new BugsnagPluginReactNavigation()],
})

const ErrorBoundary = Bugsnag.getPlugin('react').createErrorBoundary(React)

const { createNavigationContainer } = Bugsnag.getPlugin('reactNavigation')

const BugsnagNavigationContainer = createNavigationContainer(NavigationContainer)

const navigationTheme = {
dark: true,
colors: {
Expand All @@ -45,9 +57,11 @@ const navigationTheme = {

const Base = () => {
return (
<NavigationContainer theme={navigationTheme}>
<App />
</NavigationContainer>
<BugsnagNavigationContainer theme={navigationTheme}>
<ErrorBoundary>
<App />
</ErrorBoundary>
</BugsnagNavigationContainer>
)
}
AppRegistry.registerComponent(appName, () => Base)
21 changes: 20 additions & 1 deletion app/ios/AriesBifold.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
56A83D5C27D95E24002FE8FE /* BCSans-BoldItalic.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "BCSans-BoldItalic.ttf"; path = "../src/assets/fonts/BCSans-BoldItalic.ttf"; sourceTree = "<group>"; };
56A83D5D27D95E24002FE8FE /* BCSans-Italic.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "BCSans-Italic.ttf"; path = "../src/assets/fonts/BCSans-Italic.ttf"; sourceTree = "<group>"; };
62AD74D113A13E6D7ECD73DC /* Pods-AriesBifold.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AriesBifold.release.xcconfig"; path = "Target Support Files/Pods-AriesBifold/Pods-AriesBifold.release.xcconfig"; sourceTree = "<group>"; };
6F99AD4C2A0572BB0073B4BF /* Config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
6FAA896629281E3E002D887C /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
6FAA896B29281E60002D887C /* fr-CA */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "fr-CA"; path = "fr-CA.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = AriesBifold/LaunchScreen.storyboard; sourceTree = "<group>"; };
Expand Down Expand Up @@ -166,6 +167,7 @@
83CBB9F61A601CBA00E9B192 = {
isa = PBXGroup;
children = (
6F99AD4C2A0572BB0073B4BF /* Config.xcconfig */,
566FB1F1273B158E003E9BEE /* Media.xcassets */,
13B07FAE1A68108700A75B9A /* AriesBifold */,
00E356EF1AD99517003FC87E /* AriesBifoldTests */,
Expand Down Expand Up @@ -237,6 +239,7 @@
F5B7D67D9BBF4C5FE692BB29 /* [CP] Embed Pods Frameworks */,
EB396EB204E0E4C9F6307F29 /* [CP] Copy Pods Resources */,
433E774026557E1B00F569EE /* Embed Frameworks */,
9D840F3D7FAB4E2AA01DCE7C /* Upload source maps to Bugsnag */,
);
buildRules = (
);
Expand Down Expand Up @@ -323,7 +326,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\n\nexport NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n";
shellScript = "export EXTRA_PACKAGER_ARGS=\"--sourcemap-output $TMPDIR/$(md5 -qs \"$CONFIGURATION_BUILD_DIR\")-main.jsbundle.map\"\nset -e\n\nexport NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n";
};
4EC0E8613979411464217753 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
Expand Down Expand Up @@ -381,6 +384,20 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AriesBifold-AriesBifoldTests/Pods-AriesBifold-AriesBifoldTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
9D840F3D7FAB4E2AA01DCE7C /* Upload source maps to Bugsnag */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Upload source maps to Bugsnag";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
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";
};
B9A54C90D3BE82CD93B12CE2 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -638,6 +655,7 @@
};
83CBBA201A601CBA00E9B192 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 6F99AD4C2A0572BB0073B4BF /* Config.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
Expand Down Expand Up @@ -703,6 +721,7 @@
};
83CBBA211A601CBA00E9B192 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 6F99AD4C2A0572BB0073B4BF /* Config.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1210"
version = "1.3">
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<PreActions>
<ExecutionAction
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Run Script"
scriptText = "# Type a script or drag a script file from your workspace to insert its path.&#10;&quot;${SRCROOT}/../node_modules/react-native-config/ios/ReactNativeConfig/BuildXCConfig.rb&quot; &quot;${SRCROOT}/..&quot; &quot;${SRCROOT}/tmp.xcconfig&quot;&#10;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "BCWallet.app"
BlueprintName = "AriesBifold"
ReferencedContainer = "container:AriesBifold.xcodeproj">
</BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PreActions>
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
Expand Down
5 changes: 4 additions & 1 deletion app/ios/AriesBifold/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import <Bugsnag/Bugsnag.h>
#import "AppDelegate.h"

#import <React/RCTBridge.h>
Expand All @@ -10,7 +11,9 @@ @implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
[Bugsnag start];

RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"QCWallet"
initialProperties:nil];
Expand Down
5 changes: 5 additions & 0 deletions app/ios/AriesBifold/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,10 @@
</array>
</dict>
</array>
<key>bugsnag</key>
<dict>
<key>apiKey</key>
<string>$(BUGSNAG_API_KEY)</string>
</dict>
</dict>
</plist>
10 changes: 10 additions & 0 deletions app/ios/Config.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//
// Config.xcconfig
// AriesBifold
//
// Created by [email protected] on 2023-05-05.
//

// Configuration settings file format documentation can be found at:
// https://help.apple.com/xcode/#/dev745c5c974
#include? "tmp.xcconfig"
8 changes: 7 additions & 1 deletion app/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
- CatCrypto (0.3.2)
- CocoaAsyncSocket (7.6.5)
- DoubleConversion (1.1.6)
Expand Down Expand Up @@ -387,6 +389,7 @@ PODS:

DEPENDENCIES:
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
- "BugsnagReactNative (from `../node_modules/@bugsnag/react-native`)"
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`)
Expand Down Expand Up @@ -458,6 +461,8 @@ SPEC REPOS:
EXTERNAL SOURCES:
boost:
:podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec"
BugsnagReactNative:
:path: "../node_modules/@bugsnag/react-native"
DoubleConversion:
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
FBLazyVector:
Expand Down Expand Up @@ -571,6 +576,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost: a7c83b31436843459a1961bfd74b96033dc77234
BugsnagReactNative: bf6f4ebababa8536726b3014c7d3e4af8c53d488
CatCrypto: a477899b6be4954e75be4897e732da098cc0a5a8
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
Expand Down Expand Up @@ -634,4 +640,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: ac6fb920404abfaf943a3b94ff54624a7f9c89e8

COCOAPODS: 1.11.3
COCOAPODS: 1.12.1
Loading

0 comments on commit ae94a1a

Please sign in to comment.