diff --git a/.github/workflows/CD-deploy-github-releases.yml b/.github/workflows/CD-deploy-github-releases.yml new file mode 100644 index 00000000..4c2478e8 --- /dev/null +++ b/.github/workflows/CD-deploy-github-releases.yml @@ -0,0 +1,48 @@ +name: Deploy App (Android) Release to Github Releases + +on: + push: + tags: + - '*' + +jobs: + + build: + if: github.event.base_ref == 'refs/heads/master' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-java@v1 + with: + java-version: '12.x' + - uses: subosito/flutter-action@v1 + with: + channel: 'stable' + + - name: Get flutter dependencies + run: flutter pub get + working-directory: Space_Mapper + + - name: Statically analyze the Dart code for any errors. + run: flutter analyze + working-directory: Space_Mapper + + - name: Run widget tests for our flutter project. + run: flutter test + working-directory: Space_Mapper + + - name: Build apk + run: flutter build apk --debug + working-directory: Space_Mapper + + - name: Build appbundle + run: flutter build appbundle --debug + working-directory: Space_Mapper + + - name: Create a Release in GitHub + uses: ncipollo/release-action@v1 + with: + artifacts: "././Space_Mapper/build/app/outputs/flutter-apk/app-debug.apk,././Space_Mapper/build/app/outputs/bundle/debug/app-debug.aab" + token: ${{ secrets.GH_TOKEN }} + tag: ${{ steps.version.outputs.content }} + commit: ${{ github.sha }} \ No newline at end of file diff --git a/Space_Mapper/android/build.gradle b/Space_Mapper/android/build.gradle index ebc6651c..7e10e3de 100644 --- a/Space_Mapper/android/build.gradle +++ b/Space_Mapper/android/build.gradle @@ -12,7 +12,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.6.3' + classpath 'com.android.tools.build:gradle:4.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/Space_Mapper/android/gradle/wrapper/gradle-wrapper.properties b/Space_Mapper/android/gradle/wrapper/gradle-wrapper.properties index bc24dcf0..939efa29 100644 --- a/Space_Mapper/android/gradle/wrapper/gradle-wrapper.properties +++ b/Space_Mapper/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip diff --git a/Space_Mapper/lib/ui/web_view.dart b/Space_Mapper/lib/ui/web_view.dart index 0667d40f..af41efad 100644 --- a/Space_Mapper/lib/ui/web_view.dart +++ b/Space_Mapper/lib/ui/web_view.dart @@ -3,6 +3,20 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:webview_flutter/webview_flutter.dart'; +const kAndroidUserAgent = + 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Mobile Safari/537.36'; +const String selectedUrl = 'https://ee.kobotoolbox.org/single/asCwpCjZ'; +const String userUUID_element = '/asRrkkAw4mUtpTDkjdzZzt/group_survey/userUUID'; +const String userUUID_label = userUUID_element + ':label'; + +final Set jsChannels = [ + JavascriptChannel( + name: 'Print', + onMessageReceived: (JavascriptMessage message) { + print(message.message); + }), +].toSet(); + class MyWebView extends StatefulWidget { @override _MyWebViewState createState() => _MyWebViewState(); @@ -32,9 +46,7 @@ class _MyWebViewState extends State { // to allow calling Scaffold.of(context) so we can show a snackbar. body: Builder(builder: (BuildContext context) { return WebView( - //initialUrl: 'https://ee.kobotoolbox.org/single/asCwpCjZ', //Original form for beta-testing - initialUrl: - 'https://ee.kobotoolbox.org/x/8528dfMs', //Form to upload a json file + initialUrl: selectedUrl, javascriptMode: JavascriptMode.unrestricted, onWebViewCreated: (WebViewController webViewController) { _controller.complete(webViewController);