Merge branch 'v2.4' into q-beta

This commit is contained in:
Mygod
2019-06-01 07:58:55 +08:00
4 changed files with 16 additions and 9 deletions

View File

@@ -64,11 +64,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.1.0-beta01'
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'
@@ -96,7 +96,7 @@ dependencies {
}
testImplementation 'junit:junit:4.12'
androidTestImplementation "androidx.room:room-testing:$roomVersion"
androidTestImplementation 'androidx.test:runner:1.2.0-beta01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-beta01'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.1-beta01'
}

View File

@@ -191,6 +191,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)
}

View File

@@ -194,8 +194,13 @@ class WifiApDialogFragment : AlertDialogFragment<WifiApDialogFragment.Arg, WifiA
false
}
R.id.share_qr -> {
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

View File

@@ -70,9 +70,9 @@ fun frequencyToChannel(frequency: Int) = when (frequency % 5) {
else -> throw IllegalArgumentException("Invalid frequency $frequency")
}
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("([\\\\\":;,])")