Skip to content

Commit 2db74bf

Browse files
committed
Update build scripts, constants, and Android configurations for improved web view handling and debugging
- Rename `proxy.ts` to `_proxy.ts` temporarily during build scripts and clean up backup files. - Adjust Compass URLs to consistently include "www." - Introduce WebView debugging toggle via `BuildConfig.ENABLE_WEBVIEW_DEBUG`. - Bump Android version code to 79 and enable `buildConfig` features.
1 parent 0d758eb commit 2db74bf

4 files changed

Lines changed: 21 additions & 5 deletions

File tree

android/app/build.gradle

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ android {
1111
applicationId "com.compassconnections.app"
1212
minSdkVersion rootProject.ext.minSdkVersion
1313
targetSdkVersion rootProject.ext.targetSdkVersion
14-
versionCode 78
14+
versionCode 79
1515
versionName "1.16.0"
1616
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1717
aaptOptions {
@@ -20,10 +20,17 @@ android {
2020
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
2121
}
2222
}
23+
buildFeatures {
24+
buildConfig = true
25+
}
2326
buildTypes {
2427
release {
2528
minifyEnabled false
2629
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
30+
buildConfigField "boolean", "ENABLE_WEBVIEW_DEBUG", "false"
31+
}
32+
debug {
33+
buildConfigField "boolean", "ENABLE_WEBVIEW_DEBUG", "true"
2734
}
2835
}
2936
}

android/app/src/main/java/com/compassconnections/app/MainActivity.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,9 @@ public void onCreate(Bundle savedInstanceState) {
216216
WebView webView = this.bridge.getWebView();
217217
webView.setWebViewClient(new BridgeWebViewClient(this.bridge));
218218

219-
// WebView.setWebContentsDebuggingEnabled(true);
220-
219+
if (BuildConfig.ENABLE_WEBVIEW_DEBUG) {
220+
WebView.setWebContentsDebuggingEnabled(true);
221+
}
221222
// Set a recognizable User-Agent (always reliable)
222223
WebSettings settings = webView.getSettings();
223224
settings.setUserAgentString(settings.getUserAgentString() + " CompassAppWebView");

common/src/envs/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export const LOCAL_WEB_DOMAIN = `localhost:3000`
5454
export const LOCAL_BACKEND_DOMAIN = `${IS_WEBVIEW_DEV_PHONE ? '192.168.1.3' : IS_LOCAL_ANDROID ? '10.0.2.2' : 'localhost'}:8088`
5555

5656
export const DOMAIN = IS_LOCAL ? LOCAL_WEB_DOMAIN : ENV_CONFIG.domain
57-
export const DEPLOYED_WEB_URL = `https://${ENV_CONFIG.domain}`
58-
export const WEB_URL = IS_LOCAL ? `http://${LOCAL_WEB_DOMAIN}` : `https://${DOMAIN}`
57+
export const DEPLOYED_WEB_URL = `https://www.${ENV_CONFIG.domain}`
58+
export const WEB_URL = IS_LOCAL ? `http://${LOCAL_WEB_DOMAIN}` : `https://www.${DOMAIN}`
5959
export const BACKEND_DOMAIN = IS_LOCAL ? LOCAL_BACKEND_DOMAIN : ENV_CONFIG.backendDomain
6060
export const FIREBASE_CONFIG = ENV_CONFIG.firebaseConfig
6161
export const PROJECT_ID = ENV_CONFIG.firebaseConfig.projectId

scripts/build_web_view.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,16 @@ sed -i.bak 's/\bgetStaticPaths\b/_getStaticPaths/g' $USERNAME_PAGE
4949
# rename getServerSideProps to _getServerSideProps
5050
sed -i.bak 's/\bgetServerSideProps\b/_getServerSideProps/g' $HOME_PAGE
5151

52+
# rename proxy to _proxy
53+
mv proxy.ts _proxy.ts
54+
5255
yarn build
5356

5457
sed -i.bak 's/\b_getStaticProps\b/getStaticProps/g' $USERNAME_PAGE
5558
sed -i.bak 's/\b_getStaticPaths\b/getStaticPaths/g' $USERNAME_PAGE
5659
sed -i.bak 's/\b_getServerSideProps\b/getServerSideProps/g' $HOME_PAGE
60+
61+
mv _proxy.ts proxy.ts
62+
63+
# Remove backup files
64+
rm -f "$USERNAME_PAGE.bak" "$HOME_PAGE.bak"

0 commit comments

Comments
 (0)