Skip to content

Commit

Permalink
Setup fastlane for iOS
Browse files Browse the repository at this point in the history
Refs #45

Changes:
 - Fix Player screen style for iPhoneX
 - Reduce wait time when scanning & connecting to bluetooth in the
   simulator to 0.5 seconds
 - Comment out Firebase code setup in AppDelegate (WIP)
 - Replace sentry lib with latest version of @sentry/react-native
 - Remove Sentry code setup in AppDelegate (WIP)
 - Temporarily disable Sentry crash reporting for iOS in
   CrashReporting service (WIP)
 - Fix XCode schemes including Beta and Production
 - Fix fastlane config files
 - Update PlayerScreen test snapshot
  • Loading branch information
chico committed Feb 4, 2020
1 parent 2d11b55 commit 2c869f8
Show file tree
Hide file tree
Showing 18 changed files with 305 additions and 224 deletions.
3 changes: 3 additions & 0 deletions App/Modules/Play/Player/Styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import { StyleSheet } from 'react-native'

import { Styles, Colors, Metrics } from 'App/Themes'

import { isIphoneX } from 'App/Services/Properties'

export default StyleSheet.create({
...Styles,
header: {
margin: Metrics.unit * 2,
marginTop: (isIphoneX) ? Metrics.unit * 4 : Metrics.unit * 2,
marginBottom: 0,
flexDirection: 'row'
},
Expand Down
8 changes: 4 additions & 4 deletions App/Services/Bluetooth/Simulator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ const list = async () => {
}

const scan = async () => {
// Wait 2 seconds to mimic scanning
await new Promise(resolve => setTimeout(resolve, 2000))
// Wait 0.5 seconds to mimic scanning
await new Promise(resolve => setTimeout(resolve, 500))
return {devices: simulator.devices.concat(simulator.unpairedDevices), error: null}
}

const connect = async (device) => {
// Wait 2 seconds to mimic connecting
await new Promise(resolve => setTimeout(resolve, 2000))
// Wait 0.5 seconds to mimic connecting
await new Promise(resolve => setTimeout(resolve, 500))

if (device && device.id === '2') {
return {connected: false, error: {message: 'Not able to connect'}}
Expand Down
20 changes: 13 additions & 7 deletions App/Services/CrashReporting/index.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
import Config from 'react-native-config'
import { Sentry, SentrySeverity } from 'react-native-sentry'
import { Platform } from 'react-native'
import { Sentry, SentrySeverity } from '@sentry/react-native'

import { enrichProperties } from 'App/Services/Properties'

// TODO Fix for iOS
const isCrashReportingEnabled = () => {
return (!__DEV__ && Platform.OS !== 'ios')
}

export const initCrashReporting = () => {
if (!__DEV__) {
Sentry.config(Config.SENTRY_URL).install()
if (isCrashReportingEnabled()) {
Sentry.init({dsn: Config.SENTRY_URL})
}
}

export const captureUser = (user) => {
if (!user) {
return
}
if (!__DEV__) {
if (isCrashReportingEnabled()) {
Sentry.setUserContext({
// email: user.email, // TODO Probably NOT a good idea to share the user's email with Sentry for security purposes
userID: user.id,
Expand All @@ -23,7 +29,7 @@ export const captureUser = (user) => {
}

export const resetUser = () => {
if (!__DEV__) {
if (isCrashReportingEnabled()) {
Sentry.setUserContext({
// email: null, // TODO See TODO in captureUser method
userID: null,
Expand All @@ -36,7 +42,7 @@ export const captureAPIError = (message, errorResponse) => {
console.warn(message)
console.warn(errorResponse)

if (!__DEV__) {
if (isCrashReportingEnabled()) {
const extra = (errorResponse)
? { errorResponse }
: {}
Expand All @@ -51,7 +57,7 @@ export const captureException = (message, e) => {
console.error(message)
console.error(e)

if (!__DEV__) {
if (isCrashReportingEnabled()) {
const extra = { message }
Sentry.captureException(e, {
extra: enrichProperties(extra)
Expand Down
1 change: 1 addition & 0 deletions Tests/Modules/Play/Player/__snapshots__/PlayerTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ exports[`Player Component renders correctly 1`] = `
"flexDirection": "row",
"margin": 16,
"marginBottom": 0,
"marginTop": 32,
}
}
>
Expand Down
3 changes: 2 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ project.ext.react = [
]

apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/@sentry/react-native/sentry.gradle"
// apply from: "../../node_modules/react-native-sentry/sentry.gradle" // TODO getting bad sentry url

// See https://github.com/luggit/react-native-config#setup
Expand Down Expand Up @@ -171,13 +172,13 @@ android {
}

dependencies {
implementation project(':@sentry_react-native')
implementation project(':react-native-webview')
compile project(':react-native-ble-plx')
compile project(':react-native-bluetooth-serial')
compile project(':react-native-video')
compile project(':react-native-linear-gradient')
compile project(':react-native-app-settings')
compile project(':react-native-sentry')
implementation(project(':react-native-firebase')) {
transitive = false
}
Expand Down
4 changes: 2 additions & 2 deletions android/app/src/main/java/com/ottodiy/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import android.app.Application;

import com.facebook.react.ReactApplication;
import io.sentry.RNSentryPackage;
import com.reactnativecommunity.webview.RNCWebViewPackage;
import com.polidea.reactnativeble.BlePackage;
import com.rusel.RCTBluetoothSerial.RCTBluetoothSerialPackage;
import com.brentvatne.react.ReactVideoPackage;
import com.BV.LinearGradient.LinearGradientPackage;
import com.krazylabs.OpenAppSettingsPackage;
import io.sentry.RNSentryPackage;
import io.invertase.firebase.RNFirebasePackage;
import io.invertase.firebase.auth.RNFirebaseAuthPackage;
import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
Expand Down Expand Up @@ -40,13 +40,13 @@ public boolean getUseDeveloperSupport() {
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNSentryPackage(),
new RNCWebViewPackage(),
new BlePackage(),
new RCTBluetoothSerialPackage(),
new ReactVideoPackage(),
new LinearGradientPackage(),
new OpenAppSettingsPackage(),
new RNSentryPackage(),
new RNFirebasePackage(),
new RNFirebaseAuthPackage(),
new RNFirebaseMessagingPackage(),
Expand Down
4 changes: 2 additions & 2 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
rootProject.name = 'CodeAndRobots'
include ':@sentry_react-native'
project(':@sentry_react-native').projectDir = new File(rootProject.projectDir, '../node_modules/@sentry/react-native/android')
include ':react-native-webview'
project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android')
include ':react-native-ble-plx'
Expand All @@ -11,8 +13,6 @@ include ':react-native-linear-gradient'
project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android')
include ':react-native-app-settings'
project(':react-native-app-settings').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-app-settings/android')
include ':react-native-sentry'
project(':react-native-sentry').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sentry/android')
include ':react-native-firebase'
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')
include ':react-native-version-number'
Expand Down
Loading

0 comments on commit 2c869f8

Please sign in to comment.