From a42cec97f33b694da0bf62728f119b88b6e3ad66 Mon Sep 17 00:00:00 2001 From: Donovan Preston Date: Tue, 19 Feb 2019 12:35:37 -0500 Subject: [PATCH] Fix #1145 Fix the back button after logging in. (#1158) To do so, we clear the webview history once the login process is complete so that the intermediate redirect urls used by the login process are not in the history. Also, update the versions of some of the libraries we use. --- android/app/build.gradle | 2 +- .../src/main/java/org/mozilla/sendandroid/MainActivity.kt | 6 +++++- android/build.gradle | 6 +++--- android/gradle/wrapper/gradle-wrapper.properties | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 23d15734..e6c53b0c 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,7 +26,7 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'com.android.support:appcompat-v7:27.1.1' - implementation 'com.android.support.constraint:constraint-layout:1.1.2' + implementation 'com.android.support.constraint:constraint-layout:1.1.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' diff --git a/android/app/src/main/java/org/mozilla/sendandroid/MainActivity.kt b/android/app/src/main/java/org/mozilla/sendandroid/MainActivity.kt index 41eaaf66..43ad74db 100644 --- a/android/app/src/main/java/org/mozilla/sendandroid/MainActivity.kt +++ b/android/app/src/main/java/org/mozilla/sendandroid/MainActivity.kt @@ -167,7 +167,11 @@ class MainActivity : AppCompatActivity(), AdvancedWebView.Listener { val toPass = "{\"accessToken\": \"${accessToken}\", \"keys\": '${keys}', \"avatar\": \"${avatar}\", \"displayName\": \"${displayName}\", \"email\": \"${email}\", \"uid\": \"${uid}\"}" mToCall = "finishLogin(${toPass})" this@MainActivity.runOnUiThread({ - // But then we also reload this here because we need to make sure onPageFinished runs after mToCall has been set. + // Clear the history so that the user can't use the back button to see broken pages + // that were inserted into the history by the login process. + mWebView!!.clearHistory() + + // We also reload this here because we need to make sure onPageFinished runs after mToCall has been set. // We can't guarantee that onPageFinished wasn't already called at this point. mWebView!!.loadUrl("file:///android_asset/android.html") }) diff --git a/android/build.gradle b/android/build.gradle index 3335a693..a20018c7 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,15 +1,15 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.2.60' + ext.kotlin_version = '1.3.21' ext.android_components_version = '0.26.0' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.60" + classpath 'com.android.tools.build:gradle:3.3.1' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 79409098..5d0c12e4 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Oct 11 12:20:52 EDT 2018 +#Tue Feb 19 08:34:25 EST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip