From 73c60472803ef7350f560e0b5a8fc7647055c066 Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Fri, 18 Nov 2022 19:54:32 -0500 Subject: [PATCH] More deps updates --- app/build.gradle | 7 +++++-- app/src/main/java/io/heckel/ntfy/msg/DownloadManager.kt | 1 - app/src/main/java/io/heckel/ntfy/ui/DetailViewModel.kt | 2 +- app/src/main/java/io/heckel/ntfy/ui/MainViewModel.kt | 2 +- app/src/main/java/io/heckel/ntfy/ui/SettingsActivity.kt | 3 +-- build.gradle | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3a68722..666cef4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -59,6 +59,9 @@ android { kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8.toString() + freeCompilerArgs += [ + '-Xjvm-default=all-compatibility' // https://stackoverflow.com/a/71234042/1440785 + ] } } @@ -67,8 +70,8 @@ dependencies { implementation "androidx.appcompat:appcompat:1.4.2" implementation "androidx.core:core-ktx:1.9.0" implementation "androidx.constraintlayout:constraintlayout:2.1.4" - implementation "androidx.activity:activity-ktx:1.4.0" - implementation "androidx.fragment:fragment-ktx:1.4.1" + implementation "androidx.activity:activity-ktx:1.6.1" + implementation "androidx.fragment:fragment-ktx:1.5.4" implementation "androidx.work:work-runtime-ktx:2.7.1" implementation 'androidx.preference:preference-ktx:1.2.0' diff --git a/app/src/main/java/io/heckel/ntfy/msg/DownloadManager.kt b/app/src/main/java/io/heckel/ntfy/msg/DownloadManager.kt index 68cfb85..ab0dd2e 100644 --- a/app/src/main/java/io/heckel/ntfy/msg/DownloadManager.kt +++ b/app/src/main/java/io/heckel/ntfy/msg/DownloadManager.kt @@ -24,7 +24,6 @@ object DownloadManager { DownloadType.ATTACHMENT -> enqueueAttachment(context, notificationId, userAction) DownloadType.ICON -> enqueueIcon(context, notificationId) DownloadType.BOTH -> enqueueAttachmentAndIcon(context, notificationId, userAction) - else -> Log.w(DownloadManager.TAG, "This should never happen. No download type given") } } diff --git a/app/src/main/java/io/heckel/ntfy/ui/DetailViewModel.kt b/app/src/main/java/io/heckel/ntfy/ui/DetailViewModel.kt index c1ac041..8606a64 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/DetailViewModel.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/DetailViewModel.kt @@ -21,7 +21,7 @@ class DetailViewModel(private val repository: Repository) : ViewModel() { class DetailViewModelFactory(private val repository: Repository) : ViewModelProvider.Factory { @Suppress("UNCHECKED_CAST") - override fun create(modelClass: Class) = + override fun create(modelClass: Class): T = with(modelClass){ when { isAssignableFrom(DetailViewModel::class.java) -> DetailViewModel(repository) as T diff --git a/app/src/main/java/io/heckel/ntfy/ui/MainViewModel.kt b/app/src/main/java/io/heckel/ntfy/ui/MainViewModel.kt index 6f5f446..84857db 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/MainViewModel.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/MainViewModel.kt @@ -51,7 +51,7 @@ class SubscriptionsViewModel(private val repository: Repository) : ViewModel() { class SubscriptionsViewModelFactory(private val repository: Repository) : ViewModelProvider.Factory { @Suppress("UNCHECKED_CAST") - override fun create(modelClass: Class) = + override fun create(modelClass: Class): T = with(modelClass){ when { isAssignableFrom(SubscriptionsViewModel::class.java) -> SubscriptionsViewModel(repository) as T diff --git a/app/src/main/java/io/heckel/ntfy/ui/SettingsActivity.kt b/app/src/main/java/io/heckel/ntfy/ui/SettingsActivity.kt index a6a8469..cd5f20c 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/SettingsActivity.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/SettingsActivity.kt @@ -587,10 +587,9 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere throw Exception("Unexpected response ${response.code}") } val body = response.body?.string()?.trim() - if (body == null || body.isEmpty()) throw Exception("Return body is empty") + if (body.isNullOrEmpty()) throw Exception("Return body is empty") Log.d(TAG, "Logs uploaded successfully: $body") val resp = gson.fromJson(body.toString(), NopasteResponse::class.java) - val context = context ?: return@launch requireActivity().runOnUiThread { val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager val clip = ClipData.newPlainText("logs URL", resp.url) diff --git a/build.gradle b/build.gradle index 6bdf4ef..02141e5 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.6.10' + ext.kotlin_version = '1.6.21' repositories { google() jcenter()