diff --git a/.github/workflows/latest.yml b/.github/workflows/latest.yml index bba2dec9..1bcfb65e 100644 --- a/.github/workflows/latest.yml +++ b/.github/workflows/latest.yml @@ -129,20 +129,15 @@ jobs: run: | echo "GOOGLE_MAPS_API_KEY=${{ secrets.GOOGLE_MAPS_API_KEY }}" > .env chmod +x ./gradlew - bundle exec fastlane android build_apk - working-directory: android - - - name: Rename APK - run: - mv "./app/build/outputs/apk/release/app-release.apk" "./app/build/outputs/apk/release/latest.apk" + bundle exec fastlane android build_test_apk working-directory: android # Upload artifact - name: Upload build artifacts uses: actions/upload-artifact@v4 with: - name: latest.apk + name: app-latest.apk path: | - ${{ github.workspace }}/android/app/build/outputs/apk/release/latest.apk + ${{ github.workspace }}/android/app/build/outputs/apk/latest/app-latest.apk retention-days: 7 overwrite: true diff --git a/android/app/build.gradle b/android/app/build.gradle index fb9db3a9..cd8d0acc 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -132,6 +132,13 @@ android { debug { signingConfig signingConfigs.debug } + latest { + signingConfig signingConfigs.release + minifyEnabled enableProguardInReleaseBuilds + proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" + proguardFile "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro" + matchingFallbacks = ['release'] + } release { // Caution! In production, you need to generate your own keystore file. // see https://reactnative.dev/docs/signed-apk-android. diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index 1bbf9074..657f33aa 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -6,7 +6,6 @@ diff --git a/android/app/src/latest/AndroidManifest.xml b/android/app/src/latest/AndroidManifest.xml new file mode 100644 index 00000000..4b7ed4a4 --- /dev/null +++ b/android/app/src/latest/AndroidManifest.xml @@ -0,0 +1,9 @@ + + + + + diff --git a/android/app/src/main/res/xml/network_security_config.xml b/android/app/src/main/res/xml/network_security_config.xml index c7755e76..ae6c1889 100644 --- a/android/app/src/main/res/xml/network_security_config.xml +++ b/android/app/src/main/res/xml/network_security_config.xml @@ -2,6 +2,7 @@ 10.0.2.2 + 192.168.50.155 localhost \ No newline at end of file diff --git a/android/fastlane/Fastfile b/android/fastlane/Fastfile index 0944c8da..9fa47231 100644 --- a/android/fastlane/Fastfile +++ b/android/fastlane/Fastfile @@ -70,6 +70,20 @@ platform :android do "android.injected.signing.key.password" => ENV["SIGNING_KEY_PASSWORD"] }) end + + # Build APK only + desc "Android build APK for testing" + lane :build_test_apk do + # Gradle clean + gradle(task: 'clean', project_dir: './') + # Gradle sign aab -file + gradle(task: 'assemble', build_type: "Latest", project_dir: './',properties: { + "android.injected.signing.store.file" => ENV["KEYSTORE"], + "android.injected.signing.store.password" => ENV["SIGNING_STORE_PASSWORD"], + "android.injected.signing.key.alias" => ENV["SIGNING_KEY_ALIAS"], + "android.injected.signing.key.password" => ENV["SIGNING_KEY_PASSWORD"] + }) + end # Sign, build and deploy to Google Play Store desc "Sign, build, and deploy to Google Play Store" diff --git a/android/fastlane/README.md b/android/fastlane/README.md index cd8daf13..f4154697 100644 --- a/android/fastlane/README.md +++ b/android/fastlane/README.md @@ -31,6 +31,14 @@ Increment build and version number and push to repository - Build number = versi Android build APK +### android build_test_apk + +```sh +[bundle exec] fastlane android build_test_apk +``` + +Android build APK for testing + ### android build_sign_and_deploy ```sh diff --git a/mockserver/data/config/config.json b/mockserver/data/config/config.json index 9e26dfee..372cbb9e 100644 --- a/mockserver/data/config/config.json +++ b/mockserver/data/config/config.json @@ -1 +1,6 @@ -{} \ No newline at end of file +{ + "weather": { + "apiUrl": "http://localhost:3000/timeseries", + "useCardinalsForWindDirection": true + } +} \ No newline at end of file diff --git a/src/config/ConfigProvider.tsx b/src/config/ConfigProvider.tsx index 319edd9f..914f18ee 100644 --- a/src/config/ConfigProvider.tsx +++ b/src/config/ConfigProvider.tsx @@ -23,7 +23,9 @@ const ConfigProvider: React.FC = ({ const [shouldReload, setShouldReload] = useState(0); const reloadIntervalRef = useRef(null); - Config.setDefaultConfig(defaultConfig); + if (!Config.hasBeenSet) { + Config.setDefaultConfig(defaultConfig); + } if (timeout) { Config.setApiTimeout(timeout); diff --git a/src/config/DynamicConfig.ts b/src/config/DynamicConfig.ts index 5a06c9d4..29ab67c2 100644 --- a/src/config/DynamicConfig.ts +++ b/src/config/DynamicConfig.ts @@ -22,6 +22,8 @@ class DynamicConfig { private updated: number; + public hasBeenSet = false; + constructor() { this.apiUrl = undefined; this.updating = false; @@ -31,6 +33,8 @@ class DynamicConfig { public setDefaultConfig(defaultConfig: ConfigType) { this.config = defaultConfig; + this.hasBeenSet = true; + if (defaultConfig.dynamicConfig?.enabled) { let apiUrl = defaultConfig.dynamicConfig.apiUrl;