Skip to content

Commit 1dba2de

Browse files
committed
Clean
1 parent 8fec733 commit 1dba2de

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ android {
88
applicationId "com.compassconnections.app"
99
minSdkVersion rootProject.ext.minSdkVersion
1010
targetSdkVersion rootProject.ext.targetSdkVersion
11-
versionCode 4
11+
versionCode 5
1212
versionName "1.0"
1313
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1414
aaptOptions {

capacitor.config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import type { CapacitorConfig } from '@capacitor/cli';
22

3-
const LOCAL_ANDROID = process.env.NEXT_PUBLIC_LOCAL_ANDROID === '1'
4-
console.log("LOCAL_ANDROID in CapacitorConfig", LOCAL_ANDROID)
3+
const WEBVIEW_DEV_PHONE = process.env.NEXT_PUBLIC_WEBVIEW_DEV_PHONE === '1'
4+
const LOCAL_ANDROID = WEBVIEW_DEV_PHONE || process.env.NEXT_PUBLIC_LOCAL_ANDROID === '1'
5+
const LOCAL_URL = WEBVIEW_DEV_PHONE ? '192.168.1.3' : '10.0.2.2'
6+
console.log("CapacitorConfig", {LOCAL_ANDROID, WEBVIEW_DEV_PHONE})
57

68
const config: CapacitorConfig = {
79
appId: 'com.compassconnections.app',
810
appName: 'Compass',
911
webDir: 'web/out',
10-
server: LOCAL_ANDROID ? { url: 'http://10.0.2.2:3000', cleartext: true } : {}
12+
server: LOCAL_ANDROID ? { url: `http://${LOCAL_URL}:3000`, cleartext: true } : {}
1113
};
1214

1315
export default config;

common/src/envs/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {DEV_CONFIG} from './dev'
22
import {PROD_CONFIG} from './prod'
33
import {isProd} from "common/envs/is-prod";
4-
import {HOSTING_ENV, IS_LOCAL, IS_LOCAL_ANDROID} from "common/hosting/constants";
4+
import {HOSTING_ENV, IS_LOCAL, IS_LOCAL_ANDROID, IS_WEBVIEW_DEV_PHONE} from "common/hosting/constants";
55

66
export const MAX_DESCRIPTION_LENGTH = 100000
77
export const MAX_ANSWER_LENGTH = 240
@@ -42,7 +42,7 @@ console.debug(`Running in ${HOSTING_ENV} (${ENV})`,);
4242
// }
4343

4444
export const LOCAL_WEB_DOMAIN = `localhost:3000`
45-
export const LOCAL_BACKEND_DOMAIN = `${IS_LOCAL_ANDROID ? '10.0.2.2' : 'localhost'}:8088`
45+
export const LOCAL_BACKEND_DOMAIN = `${IS_WEBVIEW_DEV_PHONE ? '192.168.1.3' : IS_LOCAL_ANDROID ? '10.0.2.2' : 'localhost'}:8088`
4646

4747
export const DOMAIN = IS_LOCAL ? LOCAL_WEB_DOMAIN : ENV_CONFIG.domain
4848
export const DEPLOYED_WEB_URL = `https://www.${ENV_CONFIG.domain}`

common/src/hosting/constants.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
export const IS_LOCAL_ANDROID = process.env.NEXT_PUBLIC_LOCAL_ANDROID === '1'
1+
export const IS_WEBVIEW_DEV_PHONE = process.env.NEXT_PUBLIC_WEBVIEW_DEV_PHONE === '1'
2+
export const IS_LOCAL_ANDROID = IS_WEBVIEW_DEV_PHONE || process.env.NEXT_PUBLIC_LOCAL_ANDROID === '1'
23
export const IS_WEBVIEW = !!process.env.NEXT_PUBLIC_WEBVIEW
34
export const IS_GOOGLE_CLOUD = !!process.env.GOOGLE_CLOUD_PROJECT
45
export const IS_VERCEL = !!process.env.NEXT_PUBLIC_VERCEL
@@ -11,4 +12,4 @@ if (IS_LOCAL && !process.env.ENVIRONMENT && !process.env.NEXT_PUBLIC_FIREBASE_EN
1112
process.env.ENVIRONMENT = 'DEV'
1213
}
1314

14-
console.log('IS_LOCAL_ANDROID', IS_LOCAL_ANDROID)
15+
// console.log('IS_LOCAL_ANDROID', IS_LOCAL_ANDROID)

scripts/build_sync_android.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ yarn build-web
1010

1111
source web/.env
1212

13+
export NEXT_PUBLIC_WEBVIEW_DEV_PHONE=1
14+
1315
npx cap sync android
1416

1517
# To generate icons

web/pages/_app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if (Capacitor.isNativePlatform()) {
2323
// Note sure it's doing anything, though, need to check
2424
StatusBar.setOverlaysWebView({overlay: false}).catch(console.warn)
2525
// StatusBar.setStyle({style: Style.Light}).catch(console.warn)
26-
App.addListener('backButton', ({canGoBack}) => {
26+
App.addListener('backButton', () => {
2727
window.dispatchEvent(new CustomEvent('appBackButton'))
2828
})
2929
}

0 commit comments

Comments
 (0)