Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/CD-deploy-github-releases.yml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 1 addition & 1 deletion Space_Mapper/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 15 additions & 3 deletions Space_Mapper/lib/ui/web_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<JavascriptChannel> jsChannels = [
JavascriptChannel(
name: 'Print',
onMessageReceived: (JavascriptMessage message) {
print(message.message);
}),
].toSet();

class MyWebView extends StatefulWidget {
@override
_MyWebViewState createState() => _MyWebViewState();
Expand Down Expand Up @@ -32,9 +46,7 @@ class _MyWebViewState extends State<MyWebView> {
// 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);
Expand Down