Compare commits

...

139 Commits

Author SHA1 Message Date
Avinash Lingaloo
e0aad59773 iOS/Gekidou/Package.resolved 2022-11-02 10:44:02 +04:00
Avinash Lingaloo
09c379c548 Update @sentry+react-native+4.6.1.patch 2022-11-02 10:43:37 +04:00
Avinash Lingaloo
ccca219ec2 Update project.pbxproj 2022-11-01 16:12:24 +04:00
Avinash Lingaloo
a7e1624a02 pod install 2022-11-01 14:59:55 +04:00
Avinash Lingaloo
e431d1d558 build ios 431 2022-11-01 13:51:15 +04:00
Avinash Lingaloo
833bcb02fa Merge branch 'android-pr-sentry' into gekidou-sentry-install 2022-11-01 13:46:22 +04:00
Avinash Lingaloo
fe527a3ec6 Update @sentry+react-native+4.6.1.patch 2022-11-01 13:26:38 +04:00
Avinash Lingaloo
bbf328cb93 test build 431 2022-11-01 12:06:30 +04:00
Avinash Lingaloo
222a51ae6f update fastlane 2022-11-01 12:00:32 +04:00
Avinash Lingaloo
3b967434aa revert unnecessary changes 2022-11-01 11:33:17 +04:00
Avinash Lingaloo
0cac047a4c Create @sentry+react-native+4.6.1.patch 2022-11-01 11:30:08 +04:00
Avinash Lingaloo
e6b139d526 trials
Update config.yml

Update Fastfile

Update Fastfile

Update Fastfile

trying out gradle build scans

Revert "trying out gradle build scans"

This reverts commit 4a0f412025.

maxWorker 2

Update Fastfile

Update Fastfile

removes gradle cache step

revert changes

Update Fastfile

test

Update Fastfile

Update config.yml

Update Fastfile

Update @sentry+react-native+4.6.0.patch

Create @sentry+react-native+4.6.0.patch

update patch package
2022-11-01 11:30:08 +04:00
Avinash Lingaloo
343e22f9e4 Create @sentry+react-native+4.6.1.patch 2022-11-01 10:44:30 +04:00
Avinash Lingaloo
5885c0aced Delete @sentry+react-native+4.6.1.patch 2022-11-01 10:35:06 +04:00
Avinash Lingaloo
eea69f9c61 update patch package 2022-11-01 10:26:52 +04:00
Avinash Lingaloo
04a807a153 Update @sentry+react-native+4.6.0.patch
Create @sentry+react-native+4.6.0.patch
2022-10-31 17:40:52 +04:00
Avinash Lingaloo
3015dff322 Update Fastfile 2022-10-31 16:16:10 +04:00
Avinash Lingaloo
5ce793dcb1 Update config.yml 2022-10-31 15:41:06 +04:00
Avinash Lingaloo
9b8738877c Update Fastfile 2022-10-31 14:46:26 +04:00
Avinash Lingaloo
1aec12ecac Update Fastfile
test
2022-10-31 14:43:14 +04:00
Avinash Lingaloo
d1fa198f93 revert changes 2022-10-31 13:24:24 +04:00
Avinash Lingaloo
a6b28a74af removes gradle cache step 2022-10-31 09:23:37 +04:00
Avinash Lingaloo
764d48ee48 Update Fastfile 2022-10-30 17:21:36 +04:00
Avinash Lingaloo
f3abc3a7ed Update Fastfile 2022-10-30 17:10:55 +04:00
Avinash Lingaloo
13b1cdfee6 maxWorker 2 2022-10-30 16:49:59 +04:00
Avinash Lingaloo
4f0df2ded3 Revert "trying out gradle build scans"
This reverts commit 4a0f412025.
2022-10-30 16:29:26 +04:00
Avinash Lingaloo
4a0f412025 trying out gradle build scans 2022-10-30 16:18:56 +04:00
Avinash Lingaloo
78a94f0f7e Update Fastfile 2022-10-30 16:08:55 +04:00
Avinash Lingaloo
0287b58b92 Update Fastfile 2022-10-30 15:46:40 +04:00
Avinash Lingaloo
90b0c275b3 Update Fastfile 2022-10-30 15:36:45 +04:00
Avinash Lingaloo
bd8e31e62f Update config.yml 2022-10-30 14:39:20 +04:00
Avinash Lingaloo
7687c3bc8c Merge branch 'gekidou' into gekidou-sentry-install 2022-10-30 14:09:36 +04:00
Avinash Lingaloo
c1e7c04e17 Update servers.ts 2022-10-18 16:54:01 +04:00
Avinash Lingaloo
2fc35f4c46 Delete @sentry+react-native+4.6.0.patch 2022-10-18 16:27:55 +04:00
Avinash Lingaloo
a2589bb0d0 ensuring personally identifiable information is not sent 2022-10-18 16:15:24 +04:00
Avinash Lingaloo
be1e9b2db1 revert circleci config.yml 2022-10-18 16:15:04 +04:00
Avinash Lingaloo
55293172da adding context to Sentry logging 2022-10-18 10:24:22 +04:00
Avinash Lingaloo
6adf861054 enriching events 2022-10-17 17:05:14 +04:00
Avinash Lingaloo
70dffc349f revert error_handling.ts 2022-10-17 15:04:15 +04:00
Avinash Lingaloo
ea37527412 Update sentry.ts 2022-10-17 12:42:09 +04:00
Avinash Lingaloo
99a236fc40 Update project.pbxproj 2022-10-17 11:23:10 +04:00
Avinash Lingaloo
11fd493c81 Merge branch 'gekidou' into gekidou-sentry-install 2022-10-17 11:15:39 +04:00
Avinash Lingaloo
e3dd270f7d reverting changes 2022-10-17 10:03:35 +04:00
Avinash Lingaloo
3fdb07479f Merge branch 'android-pr-sentry' into gekidou-sentry-install 2022-10-17 09:59:19 +04:00
Avinash Lingaloo
7328918825 Update @sentry+react-native+4.6.0.patch 2022-10-14 20:02:34 +04:00
Avinash Lingaloo
ecb394755c test 2022-10-14 19:47:20 +04:00
Avinash Lingaloo
e0abda7fb6 Update @sentry+react-native+4.6.0.patch 2022-10-14 19:25:11 +04:00
Avinash Lingaloo
13532993e0 Update @sentry+react-native+4.6.0.patch 2022-10-14 13:26:11 +04:00
Avinash Lingaloo
f971b29ba5 Update @sentry+react-native+4.6.0.patch 2022-10-14 12:53:19 +04:00
Avinash Lingaloo
fc6b720ce8 Create @sentry+react-native+4.6.0.patch 2022-10-14 12:24:42 +04:00
Avinash Lingaloo
7d057daaf1 Delete @sentry+react-native+4.6.0.patch 2022-10-14 12:22:19 +04:00
Avinash Lingaloo
decb020b7d Update @sentry+react-native+4.6.0.patch 2022-10-14 11:11:16 +04:00
Avinash Lingaloo
841f64c61a debugging locally
Update Fastfile
2022-10-07 21:20:20 +04:00
Avinash Lingaloo
7c02415ab6 Update Fastfile 2022-10-07 20:52:06 +04:00
Avinash Lingaloo
0c42f51bbe update patch file 2022-10-07 20:33:26 +04:00
Avinash Lingaloo
fc316acee3 Create @sentry+react-native+4.6.0.patch 2022-10-07 19:55:54 +04:00
Avinash Lingaloo
e6809bbacf Update gradle.properties 2022-10-07 16:41:46 +04:00
Avinash Lingaloo
ace7641dc5 Update config.yml 2022-10-07 16:27:25 +04:00
Avinash Lingaloo
b3cc0508a7 Update Fastfile 2022-10-07 16:25:56 +04:00
Avinash Lingaloo
0fe00f5013 Update Fastfile 2022-10-07 15:42:53 +04:00
Avinash Lingaloo
7d57e1bcef log level debug 2022-10-07 15:10:27 +04:00
Avinash Lingaloo
baeff34bfe increasing memory for this job 2022-10-07 14:43:56 +04:00
Avinash Lingaloo
384ea6d2f2 Revert "Update config.yml"
This reverts commit c791c4f7fd.
2022-10-07 14:22:04 +04:00
Avinash Lingaloo
c791c4f7fd Update config.yml 2022-10-07 14:17:30 +04:00
Avinash Lingaloo
9015a8d13d no daemon for android 2022-10-07 13:58:58 +04:00
Avinash Lingaloo
bd5e305c0c update fastfile. Daemon might make CI build unstable
https://docs.gradle.org/current/userguide/gradle_daemon.html
2022-10-07 11:47:18 +04:00
Avinash Lingaloo
9b4632f146 update sentry version 2022-10-07 11:22:30 +04:00
Avinash Lingaloo
cb54cd3e2b removes patch file for sentry 2022-10-07 11:19:45 +04:00
Avinash Lingaloo
c636475122 Install sentry cli earlier 2022-10-07 11:08:07 +04:00
Avinash Lingaloo
15fc901968 Merge branch 'android-pr-sentry' of https://github.com/mattermost/mattermost-mobile into android-pr-sentry 2022-10-07 10:09:23 +04:00
Avinash Lingaloo
05abffdd91 Update Fastfile 2022-10-07 10:05:30 +04:00
Avinash Lingaloo
4316ea0c41 Update Fastfile
Update Fastfile

Update Fastfile

Update Fastfile
2022-10-07 09:13:15 +04:00
Avinash Lingaloo
829aa2c815 Update Fastfile 2022-10-07 09:11:22 +04:00
Avinash Lingaloo
2221c0b9e1 Update Fastfile 2022-10-07 08:58:11 +04:00
Avinash Lingaloo
323b3b5f11 Update Fastfile 2022-10-07 08:48:56 +04:00
Avinash Lingaloo
7a84abbea5 Update Fastfile 2022-10-06 20:22:49 +04:00
Avinash Lingaloo
9d516b8e9b going back to test automatic sourcemap generation 2022-10-06 17:30:46 +04:00
Avinash Lingaloo
8a2475714e Update config.yml
update CircleCI yml file

Update Gemfile.lock

Update project.pbxproj

update circle ci jobs with Sentry task

remove sentry steps on native side

Update config.yml

Update config.yml

Update config.yml
2022-10-06 17:24:56 +04:00
Avinash Lingaloo
28f5906358 Update config.yml 2022-10-06 17:03:57 +04:00
Avinash Lingaloo
93d1827e15 Update config.yml 2022-10-06 16:54:32 +04:00
Avinash Lingaloo
a731a878e6 Update config.yml 2022-10-06 16:53:04 +04:00
Avinash Lingaloo
c0e2eebaef Merge branch 'android-pr-sentry' of https://github.com/mattermost/mattermost-mobile into android-pr-sentry 2022-10-06 16:47:50 +04:00
Avinash Lingaloo
32b64664e4 Update config.yml 2022-10-06 16:46:16 +04:00
Avinash Lingaloo
23c54f170e updates config.yml
Update config.yml

bypass build android for testing purposes

Update config.yml

Update config.yml

Update config.yml

Update config.yml

Revert "Update config.yml"

This reverts commit 67525b755c.

Update config.yml

Update config.yml

Update config.yml

Update config.yml

Update config.yml

Update config.yml

Update config.yml

Update config.yml
2022-10-06 16:45:04 +04:00
Avinash Lingaloo
69b32f689c Update config.yml 2022-10-06 16:44:02 +04:00
Avinash Lingaloo
4072f44295 Update config.yml 2022-10-06 16:40:02 +04:00
Avinash Lingaloo
1d8740ae94 Update config.yml 2022-10-06 16:38:08 +04:00
Avinash Lingaloo
9d013b3add Update config.yml 2022-10-06 16:01:14 +04:00
Avinash Lingaloo
b9e7e10e81 Update config.yml 2022-10-06 15:49:22 +04:00
Avinash Lingaloo
ca5ccbe19d Update config.yml 2022-10-06 15:41:40 +04:00
Avinash Lingaloo
299359913f Update config.yml 2022-10-06 15:36:20 +04:00
Avinash Lingaloo
f3e32e7eeb Update config.yml 2022-10-06 15:35:41 +04:00
Avinash Lingaloo
a7b1cf5a8d Update config.yml 2022-10-06 15:24:47 +04:00
Avinash Lingaloo
92551f9dcc Revert "Update config.yml"
This reverts commit 67525b755c.
2022-10-06 15:24:26 +04:00
Avinash Lingaloo
67525b755c Update config.yml 2022-10-06 15:22:54 +04:00
Avinash Lingaloo
b9bb817fed Update config.yml 2022-10-06 15:08:47 +04:00
Avinash Lingaloo
a88dc96af7 Update config.yml 2022-10-06 14:20:02 +04:00
Avinash Lingaloo
5bc0afdc70 Update config.yml 2022-10-06 14:04:29 +04:00
Avinash Lingaloo
ba9b0b3a12 bypass build android for testing purposes 2022-10-06 13:47:21 +04:00
Avinash Lingaloo
a6ad2daa6c Update config.yml 2022-10-06 13:38:50 +04:00
Avinash Lingaloo
cc7082dd9a Merge branch 'gekidou-sentry-install' into android-pr-sentry 2022-10-05 17:21:11 +04:00
Avinash Lingaloo
f4b4e409bb Update config.yml 2022-10-05 17:21:01 +04:00
Avinash Lingaloo
1e713fe48f Merge branch 'gekidou-sentry-install' into android-pr-sentry 2022-10-05 16:58:23 +04:00
Avinash Lingaloo
a7d560bb84 Update config.yml 2022-10-05 16:57:52 +04:00
Avinash Lingaloo
cb5d9f2c99 Update config.yml 2022-10-05 16:55:37 +04:00
Avinash Lingaloo
f04064f475 Merge branch 'gekidou-sentry-install' into android-pr-sentry 2022-10-05 16:53:51 +04:00
Avinash Lingaloo
a5f7c1b66e Update config.yml 2022-10-05 16:53:27 +04:00
Avinash Lingaloo
cb0de55e34 Merge branch 'gekidou-sentry-install' into android-pr-sentry 2022-10-05 16:51:54 +04:00
Avinash Lingaloo
94ae570873 remove sentry steps on native side 2022-10-05 16:51:08 +04:00
Avinash Lingaloo
be6029eb94 update circle ci jobs with Sentry task 2022-10-05 16:49:51 +04:00
Avinash Lingaloo
3089686137 Update project.pbxproj 2022-10-05 13:28:27 +04:00
Avinash Lingaloo
5fa0160ff2 Update Gemfile.lock 2022-10-05 12:38:34 +04:00
Avinash Lingaloo
4a9d186857 Update Gemfile.lock 2022-10-05 12:32:33 +04:00
Avinash Lingaloo
151598f425 Update build.gradle 2022-10-05 11:59:50 +04:00
Avinash Lingaloo
f88761e00c update CircleCI yml file 2022-10-05 11:39:38 +04:00
Avinash Lingaloo
4849aff01a Update project.pbxproj 2022-10-04 11:06:43 +04:00
Avinash Lingaloo
144dc23524 Update config.json 2022-10-03 17:04:39 +04:00
Avinash Lingaloo
dda0a9b210 reverted build.gradle version and fastlane/Gemfile.lock 2022-10-03 15:02:15 +04:00
Avinash Lingaloo
ccc11a5e3e removed hard coded value 2022-10-03 14:59:44 +04:00
Avinash Lingaloo
aa8cef1631 Merge branch 'gekidou' into gekidou-sentry-install 2022-10-03 14:54:57 +04:00
Avinash Lingaloo
dd3e993a93 Merge branch 'gekidou' into gekidou-sentry-install 2022-09-18 12:38:32 +04:00
Avinash Lingaloo
c9665d75c1 update build number 2022-09-18 12:36:59 +04:00
Avinash Lingaloo
958378603b update scripts 2022-09-18 12:36:51 +04:00
Avinash Lingaloo
dce5b8dc49 Update Gemfile.lock 2022-09-18 12:31:12 +04:00
Avinash Lingaloo
bd6c877037 hardcoding SENTRY_ENABLED on native side 2022-09-18 11:32:45 +04:00
Avinash Lingaloo
5b2ac6dd11 update sentry.ts 2022-09-16 23:38:54 +04:00
Avinash Lingaloo
797fbe030e remove invalid build settings value 2022-09-15 16:04:39 +04:00
Avinash Lingaloo
19cde79717 update error_handling.ts 2022-09-15 15:35:43 +04:00
Avinash Lingaloo
a2ba20478a Update settings.tsx 2022-09-15 12:44:09 +04:00
Avinash Lingaloo
1e2f0622da reverting hardcoded values - part 1 2022-09-15 12:41:44 +04:00
Avinash Lingaloo
8a60ae5bf5 Update uploadDebugSymbols.sh 2022-09-15 12:11:56 +04:00
Avinash Lingaloo
bd1cb1494c adding instrumentation for react-native-navigation 2022-09-15 10:28:11 +04:00
Avinash Lingaloo
81d73b960b fix build.gradle 2022-09-14 17:13:28 +04:00
Avinash Lingaloo
f8d5cb99af sentry wizard - ios upload debug symbols to Sentry 2022-09-14 14:52:16 +04:00
Avinash Lingaloo
e60d11772d updating Sentry to v4.3.0 2022-09-14 11:54:17 +04:00
Avinash Lingaloo
9b8cb9e9fa Update build.gradle 2022-09-14 11:54:17 +04:00
Avinash Lingaloo
838008c274 hardcoding values
hardcoding errors in settings.tsx
2022-09-14 11:54:17 +04:00
Avinash Lingaloo
a85522af90 bypassing the error_handling and hardcoding sentryUtils 2022-09-12 18:16:26 +04:00
Avinash Lingaloo
ff2df3559d ios setup 2022-09-12 15:34:33 +04:00
11 changed files with 48241 additions and 153 deletions

View File

@@ -562,14 +562,18 @@ workflows:
- /^build-ios-beta-\d+$/
- build-android-pr:
context: mattermost-mobile-android-pr
context:
- mattermost-mobile-android-pr
- mattermost-mobile-sentry
requires:
- test
filters:
branches:
only: /^(build|android)-pr-.*/
- build-ios-pr:
context: mattermost-mobile-ios-pr
context:
- mattermost-mobile-ios-pr
- mattermost-mobile-sentry
requires:
- test
filters:
@@ -605,7 +609,7 @@ workflows:
# - /^build-ios-\d+$/
# - /^build-ios-beta-\d+$/
# - /^build-ios-sim-\d+$/
# - github-release:
# context: mattermost-mobile-unsigned
# requires:

View File

@@ -85,15 +85,6 @@ project.ext.react = [
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
if (System.getenv("SENTRY_ENABLED") == "true") {
project.ext.sentryCli = [
logLevel: "error",
flavorAware: false
]
apply from: "../../node_modules/@sentry/react-native/sentry.gradle"
}
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
@@ -145,7 +136,7 @@ android {
applicationId "com.mattermost.rnbeta"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 430
versionCode 431
versionName "2.0.0"
testBuildType System.getProperty('testBuildType', 'debug')
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
@@ -378,6 +369,15 @@ task copyDownloadableDepsToLibs(type: Copy) {
into 'libs'
}
if (System.getenv("SENTRY_ENABLED") == "true") {
project.ext.sentryCli = [
logLevel: "error",
flavorAware: false
]
apply from: "../../node_modules/@sentry/react-native/sentry.gradle"
}
apply plugin: 'com.google.gms.google-services'
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

View File

@@ -3,6 +3,7 @@
import {useManagedConfig} from '@mattermost/react-native-emm';
import {useIsFocused, useNavigation, useRoute} from '@react-navigation/native';
import * as Sentry from '@sentry/react-native';
import React, {useCallback, useEffect} from 'react';
import {useIntl} from 'react-intl';
import {BackHandler, DeviceEventEmitter, StyleSheet, ToastAndroid} from 'react-native';
@@ -13,9 +14,13 @@ import FreezeScreen from '@components/freeze_screen';
import TeamSidebar from '@components/team_sidebar';
import {Navigation as NavigationConstants, Screens} from '@constants';
import {useTheme} from '@context/theme';
import DatabaseManager from '@database/manager';
import {subscribeActiveServers} from '@database/subscription/servers';
import {useIsTablet} from '@hooks/device';
import {resetToTeams} from '@screens/navigation';
import NavigationStore from '@store/navigation_store';
import ServersModel from '@typings/database/models/app/servers';
import {getBuildTags, getExtraContext, getUserContext} from '@utils/sentry';
import AdditionalTabletView from './additional_tablet_view';
import CategoriesList from './categories_list';
@@ -111,6 +116,32 @@ const ChannelListScreen = (props: ChannelProps) => {
return () => back.remove();
}, [handleBackPress]);
useEffect(() => {
const activeServerUrlObserver = async (servers: ServersModel[]) => {
const server = servers?.length ? servers.reduce((a, b) => (b.lastActiveAt > a.lastActiveAt ? b : a)) : undefined;
if (server) {
const database = DatabaseManager.serverDatabases[server.url]?.database;
if (database) {
const userContext = await getUserContext(database);
Sentry.setContext('User-Information', userContext);
const buildContext = await getBuildTags(database);
Sentry.setContext('App-Build Information', buildContext);
const extraContext = await getExtraContext(database);
Sentry.setContext('Server-Information', extraContext);
}
}
};
const subscription = subscribeActiveServers(activeServerUrlObserver);
return () => {
subscription?.unsubscribe();
};
}, []);
return (
<FreezeScreen freeze={!isFocused}>
{<Animated.View style={top}/>}

View File

@@ -1,26 +1,22 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {Database} from '@nozbe/watermelondb';
import {Alert} from 'react-native';
import {
setJSExceptionHandler,
// setNativeExceptionHandler
} from 'react-native-exception-handler';
import {setJSExceptionHandler} from 'react-native-exception-handler';
import {DEFAULT_LOCALE, getTranslations, t} from '@i18n';
import {dismissAllModals} from '@screens/navigation';
import {ClientError} from '@utils/client_error';
import {
captureException,
captureJSException,
initializeSentry,
LOGGER_NATIVE,
} from '@utils/sentry';
import {captureException, captureJSException, initializeSentry, LOGGER_NATIVE} from '@utils/sentry';
import {logWarning} from './log';
class JavascriptAndNativeErrorHandler {
private activeServerDatabase: Database | undefined;
private errorContext: any;
initializeErrorHandling = () => {
initializeSentry();
setJSExceptionHandler(this.errorHandler, false);
@@ -30,7 +26,7 @@ class JavascriptAndNativeErrorHandler {
nativeErrorHandler = (e: string) => {
logWarning('Handling native error ' + e);
captureException(e, LOGGER_NATIVE);
captureException(e, {logger: LOGGER_NATIVE, ...this.errorContext});
};
errorHandler = (e: Error | ClientError, isFatal: boolean) => {
@@ -42,7 +38,8 @@ class JavascriptAndNativeErrorHandler {
}
logWarning('Handling Javascript error', e, isFatal);
captureJSException(e, isFatal);
captureJSException(e, isFatal, {logger: LOGGER_NATIVE, ...this.errorContext});
if (isFatal && e instanceof Error) {
const translations = getTranslations(DEFAULT_LOCALE);

View File

@@ -1,13 +1,21 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {Database, Q} from '@nozbe/watermelondb';
import {Breadcrumb} from '@sentry/types';
import {Platform} from 'react-native';
import {Navigation} from 'react-native-navigation';
import Config from '@assets/config.json';
import {MM_TABLES} from '@constants/database';
import {getCurrentChannel} from '@queries/servers/channel';
import {getConfig, getCurrentTeamId} from '@queries/servers/system';
import {getCurrentUser} from '@queries/servers/user';
import MyChannelModel from '@typings/database/models/servers/my_channel';
import MyTeamModel from '@typings/database/models/servers/my_team';
import {ClientError} from './client_error';
import {logError, logWarning} from './log';
import {logWarning} from './log';
export const BREADCRUMB_UNCAUGHT_APP_ERROR = 'uncaught-app-error';
export const BREADCRUMB_UNCAUGHT_NON_ERROR = 'uncaught-non-error';
@@ -17,6 +25,7 @@ export const LOGGER_JAVASCRIPT_WARNING = 'javascript_warning';
export const LOGGER_NATIVE = 'native';
let Sentry: any;
export function initializeSentry() {
if (!Config.SentryEnabled) {
return;
@@ -33,7 +42,21 @@ export function initializeSentry() {
return;
}
Sentry.init({dsn, ...Config.SentryOptions});
Sentry.init({
dsn,
tracesSampleRate: 0.2,
integrations: [
new Sentry.ReactNativeTracing({
// Pass instrumentation to be used as `routingInstrumentation`
routingInstrumentation: new Sentry.ReactNativeNavigationInstrumentation(
Navigation,
),
}),
],
sendDefaultPii: false,
...Config.SentryOptions,
});
}
function getDsn() {
@@ -46,24 +69,20 @@ function getDsn() {
return '';
}
export function captureException(error: Error | string, logger: string) {
export function captureException(error: Error | string, errorContext: any) {
if (!Config.SentryEnabled) {
return;
}
if (!error || !logger) {
logWarning('captureException called with missing arguments', error, logger);
if (!error || !errorContext) {
logWarning('captureException called with missing arguments', error, errorContext);
return;
}
// TODO: Get current server config and other relevant data
capture(() => {
Sentry.captureException(error, {logger});
});
Sentry.captureException(error, {...errorContext});
}
export function captureJSException(error: Error | ClientError, isFatal: boolean) {
export function captureJSException(error: Error | ClientError, isFatal: boolean, errorContext: any) {
if (!Config.SentryEnabled) {
return;
}
@@ -76,7 +95,10 @@ export function captureJSException(error: Error | ClientError, isFatal: boolean)
if (error instanceof ClientError) {
captureClientErrorAsBreadcrumb(error, isFatal);
} else {
captureException(error, LOGGER_JAVASCRIPT);
captureException(error, {
logger: LOGGER_JAVASCRIPT,
...errorContext,
});
}
}
@@ -120,128 +142,83 @@ function captureClientErrorAsBreadcrumb(error: ClientError, isFatal: boolean) {
}
}
// Wrapper function to any calls to Sentry so that we can gather any necessary extra data
// before sending.
function capture(captureFunc: () => void, config?: ClientConfig) {
if (config?.EnableDiagnostics !== 'true') {
return;
}
try {
let hasUserContext = false;
const userContext = getUserContext();
if (userContext) {
hasUserContext = true;
Sentry.setUserContext(userContext);
}
const extraContext = getExtraContext();
if (Object.keys(extraContext).length) {
Sentry.setExtraContext(extraContext);
}
const buildTags = getBuildTags();
if (buildTags) {
Sentry.setTagsContext(buildTags);
}
if (hasUserContext) {
logWarning('Capturing with Sentry at ' + getDsn() + '...');
captureFunc();
} else {
logWarning('No user context, skipping capture');
}
} catch (e) {
// Don't want this to get into an infinite loop again...
logError('Exception occurred while sending to Sentry');
logError(e);
}
}
function getUserContext() {
// TODO: Get current user data from active database
export const getUserContext = async (database: Database) => {
const currentUser = {
id: 'currentUserId',
locale: 'en',
roles: 'multi-server-test-role',
};
if (!currentUser) {
return null;
const user = await getCurrentUser(database);
if (user) {
currentUser.id = user.id;
currentUser.locale = user.locale;
currentUser.roles = user.roles;
}
return {
userID: currentUser.id, // This can be changed to id after we upgrade to Sentry >= 0.14.10,
userID: currentUser.id,
email: '',
username: '',
extra: {
locale: currentUser.locale,
roles: currentUser.roles,
},
locale: currentUser.locale,
roles: currentUser.roles,
};
}
};
function getExtraContext() {
const context = {};
export const getExtraContext = async (database: Database) => {
const context = {
config: {},
currentChannel: {},
currentTeam: {},
};
// TODO: Add context based on the active database
const config = await getConfig(database);
if (config) {
context.config = {
BuildDate: config.BuildDate,
BuildEnterpriseReady: config.BuildEnterpriseReady,
BuildHash: config.BuildHash,
BuildHashEnterprise: config.BuildHashEnterprise,
BuildNumber: config.BuildNumber,
};
}
const currentTeamId = await getCurrentTeamId(database);
const myTeam = await database.get<MyTeamModel>(MM_TABLES.SERVER.MY_TEAM).query(Q.where('id', currentTeamId)).fetch();
const teamRoles = myTeam?.[0]?.roles;
context.currentTeam = {
TeamId: currentTeamId,
TeamRoles: teamRoles,
};
// const currentTeam = getCurrentTeam(state);
// if (currentTeam) {
// context.currentTeam = {
// id: currentTeam.id,
// };
// }
// const currentTeamMember = getCurrentTeamMembership(state);
// if (currentTeamMember) {
// context.currentTeamMember = {
// roles: currentTeamMember.roles,
// };
// }
// const currentChannel = getCurrentChannel(state);
// if (currentChannel) {
// context.currentChannel = {
// id: currentChannel.id,
// type: currentChannel.type,
// };
// }
// const currentChannelMember = getMyCurrentChannelMembership(state);
// if (currentChannelMember) {
// context.currentChannelMember = {
// roles: currentChannelMember.roles,
// };
// }
// const config = getConfig(state);
// if (config) {
// context.config = {
// BuildDate: config.BuildDate,
// BuildEnterpriseReady: config.BuildEnterpriseReady,
// BuildHash: config.BuildHash,
// BuildHashEnterprise: config.BuildHashEnterprise,
// BuildNumber: config.BuildNumber,
// };
// }
const channel = await getCurrentChannel(database);
let channelRoles;
if (channel) {
const myChannel = await database.get<MyChannelModel>(MM_TABLES.SERVER.MY_CHANNEL).query(Q.where('id', channel.id)).fetch();
channelRoles = myChannel?.[0]?.roles;
context.currentChannel = {
ChannelId: channel?.id,
ChannelRoles: channelRoles,
ChannelType: channel?.type,
};
}
return context;
}
};
function getBuildTags() {
let tags;
export const getBuildTags = async (database: Database) => {
const tags = {
serverBuildHash: '',
serverBuildNumber: '',
};
// TODO: Add context based on the active database
// const config = getConfig(state);
// if (config) {
// tags = {
// serverBuildHash: config.BuildHash,
// serverBuildNumber: config.BuildNumber,
// };
// }
const config = await getConfig(database);
if (config) {
tags.serverBuildHash = config.BuildHash;
tags.serverBuildNumber = config.BuildNumber;
}
return tags;
}
};

View File

@@ -177,7 +177,7 @@ lane :upload_file_to_s3 do |options|
extension = os_type == "android" ? "*.apk" : "*.ipa"
build_folder_path = Dir[File.expand_path('..')].first
files = []
unless options[:file].nil? || options[:file].empty?
files.push("#{build_folder_path}/#{options[:file]}")
else
@@ -194,7 +194,7 @@ lane :upload_file_to_s3 do |options|
pr_file = File.basename(files.first)
plist_file = "#{File.basename(files.first, '.*')}.plist"
else
version_number = os_type == "android" ?
version_number = os_type == "android" ?
android_get_version_name(gradle_file: './android/app/build.gradle') :
get_version_number(xcodeproj: './ios/Mattermost.xcodeproj', target: 'Mattermost')
build_number = os_type == "android" ?
@@ -207,7 +207,7 @@ lane :upload_file_to_s3 do |options|
s3_folder = is_build_pr ?
"#{ENV['AWS_FOLDER_NAME']}/#{ENV['BRANCH_TO_BUILD']}" :
"#{ENV['AWS_FOLDER_NAME']}/#{version_number}/#{build_number}"
s3 = Aws::S3::Resource.new(region: s3_region)
s3_bucket = s3.bucket(s3_bucket_name)
mutex = Mutex.new
@@ -254,7 +254,7 @@ lane :upload_file_to_s3 do |options|
:install_url => install_url
})
end
if options[:file] == 'Mattermost-simulator-x86_64.app.zip'
pretext = '#### New iOS build for VM/Simulator'
msg = "Download link: #{links.first}"
@@ -741,7 +741,7 @@ platform :android do
properties: {
'separateApk' => ENV["SEPARATE_APKS"] || false,
'universalApk' => ENV["SEPARATE_APKS"] || false,
}
},
)
end
@@ -850,14 +850,14 @@ def get_apple_api_key
f.write("\n") unless index == p8_array.length - 1
end
end
api_key = app_store_connect_api_key(
key_id: ENV['IOS_API_KEY_ID'],
issuer_id: ENV['IOS_API_ISSUER_ID'],
key_filepath: "./#{api_key_path}",
in_house: ENV['IOS_IN_HOUSE'] == 'true', # optional but may be required if using match/sigh
)
File.delete("../#{api_key_path}")
end

View File

@@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/stephencelis/SQLite.swift.git",
"state": {
"branch": null,
"revision": "9af51e2edf491c0ea632e369a6566e09b65aa333",
"version": "0.13.0"
"revision": "2c4af8526e112e3a23df141e988d08a28e475ecd",
"version": "0.14.0"
}
}
]

View File

@@ -12,7 +12,8 @@ if [[ "${SENTRY_ENABLED}" = "true" ]]; then
./makeSentryProperties.sh
export SENTRY_PROPERTIES=sentry.properties
../node_modules/@sentry/cli/bin/sentry-cli react-native xcode ./react-native-xcode.sh
../node_modules/@sentry/cli/bin/sentry-cli react-native xcode \
../node_modules/react-native/scripts/react-native-xcode.sh
else
echo "Sentry native integration is not enabled"
../node_modules/react-native/scripts/react-native-xcode.sh

View File

@@ -6,7 +6,8 @@ if [[ "${SENTRY_ENABLED}" = "true" ]]; then
./makeSentryProperties.sh
export SENTRY_PROPERTIES=sentry.properties
../node_modules/@sentry/cli/bin/sentry-cli upload-dsym
../node_modules/@sentry/cli/bin/sentry-cli upload-dif "$DWARF_DSYM_FOLDER_PATH"
else
echo "Not uploading debugging symbols to Sentry because Sentry is disabled"
fi

View File

@@ -21,5 +21,6 @@ module.exports = (async () => {
assetExts: assetExts.filter((ext) => ext !== 'svg'),
sourceExts: [...sourceExts, 'svg'],
},
maxWorkers: 2,
};
})();

File diff suppressed because one or more lines are too long