diff --git a/.flutter b/.flutter index 994429713..efbf63d9c 160000 --- a/.flutter +++ b/.flutter @@ -1 +1 @@ -Subproject commit 9944297138845a94256f1cf37beb88ff9a8e811a +Subproject commit efbf63d9c66b9f6ec30e9ad4611189aa80003d31 diff --git a/.github/workflows/android_build.yml b/.github/workflows/android_build.yml index c31172ce0..0135e5417 100644 --- a/.github/workflows/android_build.yml +++ b/.github/workflows/android_build.yml @@ -7,7 +7,7 @@ on: branches: [master, f-droid] env: - NODE_VERSION: 16.13.1 + NODE_VERSION: 18.14.2 JAVA_VERSION: 12.x jobs: diff --git a/.github/workflows/android_integration_test.yml b/.github/workflows/android_integration_test.yml index cfa3b7b7d..420e77498 100644 --- a/.github/workflows/android_integration_test.yml +++ b/.github/workflows/android_integration_test.yml @@ -7,7 +7,7 @@ on: branches: [master, f-droid] env: - NODE_VERSION: 16.13.1 + NODE_VERSION: 18.14.2 JAVA_VERSION: 12.x ARTIFACT_PATH: ./screenshots @@ -29,7 +29,7 @@ jobs: # lower api-levels would be supported but the webView that is pre-installed on these images does not. api-level: [29] # 30 is broken for now, 29 is way too flaky include: - - os: macos-latest + - os: macos-13 # needs to be the `id` from the devices given by `avdmanager list device` device: "pixel_3a" # disable for now. it takes ages to build and launch the app and the upper limit of @@ -88,6 +88,7 @@ jobs: - name: Start colima a docker runtime for MacOs run: | brew install docker + brew install colima colima start - name: Run encointer-node diff --git a/.github/workflows/ios_integration_test.yml b/.github/workflows/ios_integration_test.yml index 70bb167cb..84db418fd 100644 --- a/.github/workflows/ios_integration_test.yml +++ b/.github/workflows/ios_integration_test.yml @@ -2,12 +2,14 @@ name: IOS CI on: push: - branches: [master, f-droid] + branches: [ master, f-droid ] + tags: + - "*" pull_request: - branches: [master, f-droid] + branches: [ master, f-droid ] env: - NODE_VERSION: 16.13.1 + NODE_VERSION: 18.14.2 JAVA_VERSION: 12.x ARTIFACT_PATH: ./screenshots @@ -21,19 +23,26 @@ jobs: access_token: ${{ secrets.GITHUB_TOKEN }} ios_device_test: - runs-on: macos-latest + runs-on: macos-13 timeout-minutes: 60 strategy: matrix: + # See up to date screenshots specifications for Appstores: + # https://developer.apple.com/help/app-store-connect/reference/screenshot-specifications/ include: - - device: "iPhone 11 Pro Max" + - device: "iPhone 14 Pro Max" record_video: true + # With this flag we can run the CI against different node versions to check compatibility. + docker_tag: "1.5.1" - device: "iPhone 8 Plus" record_video: false - - device: "iPad Pro (12.9-inch) (3rd generation)" + docker_tag: "1.5.1" + - device: "iPad Pro (12.9-inch) (6th generation)" record_video: false + docker_tag: "1.5.1" - device: "iPad Pro (12.9-inch) (2nd generation)" record_video: false + docker_tag: "1.5.1" fail-fast: false steps: # Setup Environment @@ -53,11 +62,17 @@ jobs: - name: "Create Simulator if iPad Pro 2nd gen" if: ${{ matrix.device == 'iPad Pro (12.9-inch) (2nd generation)' }} - run: xcrun simctl create "iPad Pro (12.9-inch) (2nd generation)" "com.apple.CoreSimulator.SimDeviceType.iPad-Pro--12-9-inch---2nd-generation-" "com.apple.CoreSimulator.SimRuntime.iOS-16-2" + # Unfortunately it is not deterministic if the 16.2 or the 16.4 runtime is available + run: | + xcrun simctl create "iPad Pro (12.9-inch) (2nd generation)" "com.apple.CoreSimulator.SimDeviceType.iPad-Pro--12-9-inch---2nd-generation-" "com.apple.CoreSimulator.SimRuntime.iOS-16-4" || \ + xcrun simctl create "iPad Pro (12.9-inch) (2nd generation)" "com.apple.CoreSimulator.SimDeviceType.iPad-Pro--12-9-inch---2nd-generation-" "com.apple.CoreSimulator.SimRuntime.iOS-16-2" - - name: "Create Simulator if iPad Pro 3rd gen" - if: ${{ matrix.device == 'iPad Pro (12.9-inch) (3rd generation)' }} - run: xcrun simctl create "iPad Pro (12.9-inch) (3rd generation)" "com.apple.CoreSimulator.SimDeviceType.iPad-Pro--12-9-inch---3rd-generation-" "com.apple.CoreSimulator.SimRuntime.iOS-16-2" + - name: "Create Simulator if iPad 8 Plus" + if: ${{ matrix.device == 'iPhone 8 Plus' }} + # Unfortunately it is not deterministic if the 16.2 or the 16.4 runtime is available + run: | + xcrun simctl create "iPhone 8 Plus" "com.apple.CoreSimulator.SimDeviceType.iPhone-8-Plus" "com.apple.CoreSimulator.SimRuntime.iOS-16-4" || \ + xcrun simctl create "iPhone 8 Plus" "com.apple.CoreSimulator.SimDeviceType.iPhone-8-Plus" "com.apple.CoreSimulator.SimRuntime.iOS-16-2" # JS Stuff - uses: actions/setup-node@v3 @@ -76,13 +91,14 @@ jobs: - name: Start colima a docker runtime for MacOs run: | brew install docker + brew install colima colima start - name: Run encointer-node - run: ./scripts/docker_run_encointer_node_notee.sh & + run: ./scripts/docker_run_encointer_node_notee.sh ${{ matrix.docker_tag }} & - name: Bootstrap Demo Community - run: ./scripts/docker_run_encointer_client_bootstrap_demo_community.sh + run: ./scripts/docker_run_encointer_client_bootstrap_demo_community.sh ${{ matrix.docker_tag }} - name: "Start Simulator" working-directory: ./scripts @@ -90,8 +106,15 @@ jobs: DEVICE_ID: ${{ matrix.device }} run: source ./ios_emulator.sh - # Run Tests - - name: "Flutter driver test and record video" + - name: Run integration tests with printscreens in all languages + if: startsWith(github.ref, 'refs/tags/') + run: ./scripts/multi_language_screenshot_ci_test.sh + env: + TEMP_DIR: ${{ env.ARTIFACT_PATH }} + RECORD: ${{ matrix.record_video }} + + - name: Run integration tests with printscreens in en only + if: startsWith(github.ref , 'refs/tags/') != true run: ./scripts/ios_integration_test.sh env: TEMP_DIR: ${{ env.ARTIFACT_PATH }} diff --git a/.github/workflows/js_ci.yml b/.github/workflows/js_ci.yml index f9d9aa85d..719208810 100644 --- a/.github/workflows/js_ci.yml +++ b/.github/workflows/js_ci.yml @@ -7,13 +7,16 @@ on: branches: [master, f-droid] env: - NODE_VERSION: 16.13.1 + NODE_VERSION: 18.14.2 JAVA_VERSION: 12.x jobs: integration-tests: runs-on: ubuntu-latest timeout-minutes: 30 + strategy: + matrix: + docker_tag: [ "1.5.1" ] steps: # Setup Environment - uses: actions/checkout@v3 @@ -24,10 +27,10 @@ jobs: node-version: ${{ env.NODE_VERSION }} - name: Run encointer-node - run: ./scripts/docker_run_encointer_node_notee.sh & + run: ./scripts/docker_run_encointer_node_notee.sh ${{ matrix.docker_tag }} & - name: Bootstrap Demo Community - run: ./scripts/docker_run_encointer_client_bootstrap_demo_community.sh + run: ./scripts/docker_run_encointer_client_bootstrap_demo_community.sh ${{ matrix.docker_tag }} - name: Test JS # We don't really have unit tests in the JS part. Most tests need a local node running. @@ -36,6 +39,30 @@ jobs: yarn install yarn test + build-js: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + # Setup Environment + - uses: actions/checkout@v3 + + # JS Stuff + - uses: actions/setup-node@v3 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Build JS + run: | + cd app/js_service_encointer + yarn install + yarn build + + - name: "Upload JS binary" + uses: actions/upload-artifact@v3 + with: + name: main.js + path: ./app/js_service_encointer/dist/main.js + e2e-tests: runs-on: ubuntu-latest timeout-minutes: 30 diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index f92f0944a..3fee34750 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -32,6 +32,11 @@ jobs: - name: "Analyze Code" run: ./flutterw pub global run melos analyze-check + - name: "Check translations" + run: | + cd app && ./../flutterw gen-l10n && cd .. + ./scripts/check_translations.sh ./app/.untranslated-messages.txt + - name: "Run unit tests Encointer" run: ./flutterw pub global run melos unit-test-app-exclude-encointer-node-e2e diff --git a/.gitignore b/.gitignore index cb135d1a5..47b5c2801 100644 --- a/.gitignore +++ b/.gitignore @@ -53,4 +53,7 @@ app/android/fastlane/metadata/android/en-US/images/phoneScreenshots/ /source # printscreens generated in tests -/screenshots \ No newline at end of file +/screenshots + +# Contains missing translations if any, otherwise it is an empty json: '{}' +app/.untranslated-messages.txt diff --git a/.vscode/launch.json b/.vscode/launch.json index c07e45577..ea6102ef9 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,7 +7,7 @@ "version": "0.2.0", "configurations": [ { - "name": "encointer-wallet-flutter", + "name": "encointer-wallet-flutter: Android", "request": "launch", "type": "dart", "program": "app/lib/main.dart", @@ -18,6 +18,12 @@ "lib/main.dart" ], }, + { + "name": "encointer-wallet-flutter: iOS", + "request": "launch", + "type": "dart", + "program": "app/lib/main.dart", + }, { "name": "encointer-wallet-flutter (profile mode)", "request": "launch", diff --git a/.vscode/settings.json b/.vscode/settings.json index 50473f629..1d6b45533 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,5 @@ "dart.flutterSdkPath": ".flutter", "dart.lineLength": 120, "git.ignoreLimitWarning": true, - "explorer.autoReveal": false, + "explorer.autoReveal": true, } \ No newline at end of file diff --git a/README.md b/README.md index e4d246ffa..238413479 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,8 @@ Encointer wallet and client for mobile phones

### Requirements -- Dart sdk: ">=2.19.0 <3.0.0" -- Flutter: "3.7.3" +- Dart sdk: ">=3.0.1 <3.0.0" +- Flutter: "3.13.0" - Android: minSdkVersion 17 - iOS: --ios-language swift, Xcode version >= 14.0.0 diff --git a/app/android/app/build.gradle b/app/android/app/build.gradle index acdb4ccce..c2038c071 100644 --- a/app/android/app/build.gradle +++ b/app/android/app/build.gradle @@ -30,6 +30,11 @@ android { ndkVersion flutter.ndkVersion compileOptions { + // Flag to enable support for the new language API, see #1165. + coreLibraryDesugaringEnabled true + // Older androids ( < API 26) use Java 7 + // Sets Java compatibility to Java 8 + // Needed to run JAVA 8 for backwards compatibility with Androids older than API 26, see #1165. sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } @@ -43,6 +48,7 @@ android { } defaultConfig { + multiDexEnabled true // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "org.encointer.wallet" // You can update the following values to match your application needs. @@ -95,4 +101,10 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation 'com.jakewharton.threetenabp:threetenabp:1.4.6' + // Fixes bug for newer ( > API 26) android versions + // Bug: Failed to transform window-java-1.0.0-beta04.jar (androidx.window:window-java:1.0.0-beta04) + implementation 'androidx.window:window:1.0.0' + implementation 'androidx.window:window-java:1.0.0' + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' } diff --git a/app/android/app/src/main/AndroidManifest.xml b/app/android/app/src/main/AndroidManifest.xml index 4336fc152..d43b38738 100644 --- a/app/android/app/src/main/AndroidManifest.xml +++ b/app/android/app/src/main/AndroidManifest.xml @@ -11,8 +11,11 @@ android:icon="@mipmap/launcher_icon" android:allowBackup="false" android:usesCleartextTraffic="true"> + + + diff --git a/app/android/app/src/main/kotlin/org/encointer/wallet/MainActivity.kt b/app/android/app/src/main/kotlin/org/encointer/wallet/MainActivity.kt new file mode 100644 index 000000000..bef51dd88 --- /dev/null +++ b/app/android/app/src/main/kotlin/org/encointer/wallet/MainActivity.kt @@ -0,0 +1,19 @@ +package org.encointer.wallet + +import androidx.annotation.NonNull +import io.flutter.embedding.android.FlutterFragmentActivity +import io.flutter.embedding.engine.FlutterEngine +import io.flutter.plugins.GeneratedPluginRegistrant +import com.jakewharton.threetenabp.AndroidThreeTen + +class MainActivity: FlutterFragmentActivity() { + // You do not need to override onCreate() in order to invoke + // GeneratedPluginRegistrant. Flutter now does that on your behalf. + override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { + GeneratedPluginRegistrant.registerWith(flutterEngine); + // Initialize AndroidThreeTen for older versions of android instead + // of java.time, in API 26 or newer versions java.time is used + // older versions will use AndroidThreeTen + AndroidThreeTen.init(this); + } +} \ No newline at end of file diff --git a/app/android/app/src/main/res/drawable-hdpi/splash.png b/app/android/app/src/main/res/drawable-hdpi/splash.png new file mode 100644 index 000000000..8fbafc928 Binary files /dev/null and b/app/android/app/src/main/res/drawable-hdpi/splash.png differ diff --git a/app/android/app/src/main/res/drawable-mdpi/splash.png b/app/android/app/src/main/res/drawable-mdpi/splash.png new file mode 100644 index 000000000..c4bed7927 Binary files /dev/null and b/app/android/app/src/main/res/drawable-mdpi/splash.png differ diff --git a/app/android/app/src/main/res/drawable-v21/background.png b/app/android/app/src/main/res/drawable-v21/background.png new file mode 100644 index 000000000..3107d37fa Binary files /dev/null and b/app/android/app/src/main/res/drawable-v21/background.png differ diff --git a/app/android/app/src/main/res/drawable-v21/launch_background.xml b/app/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 000000000..3cc4948a1 --- /dev/null +++ b/app/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/app/android/app/src/main/res/drawable-xhdpi/splash.png b/app/android/app/src/main/res/drawable-xhdpi/splash.png new file mode 100644 index 000000000..3c37dc11f Binary files /dev/null and b/app/android/app/src/main/res/drawable-xhdpi/splash.png differ diff --git a/app/android/app/src/main/res/drawable-xxhdpi/splash.png b/app/android/app/src/main/res/drawable-xxhdpi/splash.png new file mode 100644 index 000000000..79ae4a4fc Binary files /dev/null and b/app/android/app/src/main/res/drawable-xxhdpi/splash.png differ diff --git a/app/android/app/src/main/res/drawable-xxxhdpi/splash.png b/app/android/app/src/main/res/drawable-xxxhdpi/splash.png new file mode 100644 index 000000000..026dea90a Binary files /dev/null and b/app/android/app/src/main/res/drawable-xxxhdpi/splash.png differ diff --git a/app/android/app/src/main/res/drawable/app_icon.png b/app/android/app/src/main/res/drawable/app_icon.png deleted file mode 100644 index fe9fc0a73..000000000 Binary files a/app/android/app/src/main/res/drawable/app_icon.png and /dev/null differ diff --git a/app/android/app/src/main/res/drawable/app_icon_encointer_colored.png b/app/android/app/src/main/res/drawable/app_icon_encointer_colored.png deleted file mode 100644 index 666659e7e..000000000 Binary files a/app/android/app/src/main/res/drawable/app_icon_encointer_colored.png and /dev/null differ diff --git a/app/android/app/src/main/res/drawable/background.png b/app/android/app/src/main/res/drawable/background.png new file mode 100644 index 000000000..3107d37fa Binary files /dev/null and b/app/android/app/src/main/res/drawable/background.png differ diff --git a/app/android/app/src/main/res/drawable/launch_background.xml b/app/android/app/src/main/res/drawable/launch_background.xml index 49e8e9af4..3cc4948a1 100644 --- a/app/android/app/src/main/res/drawable/launch_background.xml +++ b/app/android/app/src/main/res/drawable/launch_background.xml @@ -1,12 +1,9 @@ - - - - - + + + + diff --git a/app/android/app/src/main/res/drawable/launcher_icon.png b/app/android/app/src/main/res/drawable/launcher_icon.png deleted file mode 100644 index 188371790..000000000 Binary files a/app/android/app/src/main/res/drawable/launcher_icon.png and /dev/null differ diff --git a/app/android/app/src/main/res/values-night/styles.xml b/app/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 000000000..dbc9ea9f1 --- /dev/null +++ b/app/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,22 @@ + + + + + + + diff --git a/app/android/app/src/main/res/values/styles.xml b/app/android/app/src/main/res/values/styles.xml index c745a5ef2..74082f9c3 100644 --- a/app/android/app/src/main/res/values/styles.xml +++ b/app/android/app/src/main/res/values/styles.xml @@ -4,6 +4,10 @@ @drawable/launch_background + false + false + false + shortEdges + +`,l=` + +`,c=` +