From c0e40436df650195a82616ec1351fd27ea76099b Mon Sep 17 00:00:00 2001 From: Mygod Date: Sat, 1 Jun 2019 07:33:23 +0800 Subject: [PATCH 1/4] Update dependencies --- build.gradle | 2 +- mobile/build.gradle | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 5160a8b0..c3d52971 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ buildscript { } } dependencies { - classpath 'com.android.tools.build:gradle:3.4.0' + classpath 'com.android.tools.build:gradle:3.4.1' classpath 'com.github.ben-manes:gradle-versions-plugin:0.21.0' classpath 'com.google.gms:google-services:4.2.0' classpath 'io.fabric.tools:gradle:1.29.0' diff --git a/mobile/build.gradle b/mobile/build.gradle index 9acc422f..ffd72465 100644 --- a/mobile/build.gradle +++ b/mobile/build.gradle @@ -65,11 +65,11 @@ androidExtensions { } def aux = [ - 'com.crashlytics.sdk.android:crashlytics:2.10.0', + 'com.crashlytics.sdk.android:crashlytics:2.10.1', 'com.google.firebase:firebase-core:16.0.9', ] def lifecycleVersion = '2.0.0' -def roomVersion = '2.1.0-beta01' +def roomVersion = '2.1.0-rc01' dependencies { kapt "androidx.room:room-compiler:$roomVersion" implementation fileTree(dir: 'libs', include: ['*.jar']) @@ -83,7 +83,7 @@ dependencies { implementation "androidx.room:room-ktx:$roomVersion" implementation 'com.android.billingclient:billing:2.0.0' implementation 'com.github.topjohnwu.libsu:core:2.5.0' - implementation 'com.google.android.material:material:1.1.0-alpha06' + implementation 'com.google.android.material:material:1.1.0-alpha07' implementation 'com.jakewharton.timber:timber:4.7.1' implementation 'com.linkedin.dexmaker:dexmaker:2.25.0' implementation 'com.takisoft.preferencex:preferencex-simplemenu:1.0.0' @@ -97,7 +97,7 @@ dependencies { testImplementation "androidx.arch.core:core-testing:$lifecycleVersion" testImplementation 'junit:junit:4.12' androidTestImplementation "androidx.room:room-testing:$roomVersion" - androidTestImplementation 'androidx.test:runner:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' + androidTestImplementation 'androidx.test:runner:1.2.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.0' } From d168dea613673b4bb8361f1f7f1d17e064a905a4 Mon Sep 17 00:00:00 2001 From: Mygod Date: Sat, 1 Jun 2019 07:39:23 +0800 Subject: [PATCH 2/4] Refine apKeyManagement --- .../vpnhotspot/net/wifi/configuration/WifiConfiguration.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/configuration/WifiConfiguration.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/configuration/WifiConfiguration.kt index 661be180..33dfd469 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/configuration/WifiConfiguration.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/configuration/WifiConfiguration.kt @@ -65,9 +65,9 @@ fun channelToFrequency(channel: Int) = when (channel) { else -> throw IllegalArgumentException("Invalid channel $channel") } -val WifiConfiguration.apKeyManagement get() = allowedKeyManagement.nextSetBit(0).also { selected -> - check(selected >= 0) { "No key management selected" } +val WifiConfiguration.apKeyManagement get() = allowedKeyManagement.nextSetBit(0).let { selected -> check(allowedKeyManagement.nextSetBit(selected + 1) < 0) { "More than 1 key managements supplied" } + if (selected < 0) WifiConfiguration.KeyMgmt.NONE else selected // getAuthType returns NONE if nothing is selected } private val qrSanitizer = Regex("([\\\\\":;,])") From 8795941bab019cd975d3dd97de733ce1505a7426 Mon Sep 17 00:00:00 2001 From: Mygod Date: Sat, 1 Jun 2019 07:42:45 +0800 Subject: [PATCH 3/4] Prevent crash when sharing invalid Wi-Fi config --- .../net/wifi/configuration/WifiApDialogFragment.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/configuration/WifiApDialogFragment.kt b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/configuration/WifiApDialogFragment.kt index 1e8a292c..d0fef699 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/configuration/WifiApDialogFragment.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/net/wifi/configuration/WifiApDialogFragment.kt @@ -187,8 +187,13 @@ class WifiApDialogFragment : AlertDialogFragment { - QRCodeDialog().withArg(ret.configuration.toQRString()) - .show(fragmentManager ?: return false, "QRCodeDialog") + val qrString = try { + ret.configuration.toQRString() + } catch (e: IllegalArgumentException) { + SmartSnackbar.make(e).show() + return false + } + QRCodeDialog().withArg(qrString).show(fragmentManager ?: return false, "QRCodeDialog") true } else -> false From b7b4298fb4b576d1d790fd56cdc71ec898ff9f3c Mon Sep 17 00:00:00 2001 From: Mygod Date: Sat, 1 Jun 2019 07:48:26 +0800 Subject: [PATCH 4/4] Catch remote exceptions while setting wifi config --- .../main/java/be/mygod/vpnhotspot/manage/TetheringFragment.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetheringFragment.kt b/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetheringFragment.kt index 870bf533..e5bc35eb 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetheringFragment.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetheringFragment.kt @@ -189,6 +189,8 @@ class TetheringFragment : Fragment(), ServiceConnection, Toolbar.OnMenuItemClick WifiApManager.configuration = configuration } catch (e: IllegalArgumentException) { SmartSnackbar.make(R.string.configuration_rejected).show() + } catch (e: InvocationTargetException) { + SmartSnackbar.make(e.targetException).show() } else -> super.onActivityResult(requestCode, resultCode, data) }