mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-26 10:58:24 +01:00
Minor cleanup
Also add POST_NOTIFICATIONS permissions to make Android Studio stop complaining about it.
This commit is contained in:
parent
2d56ad1ad9
commit
b37b3767f3
@ -21,6 +21,8 @@
|
|||||||
<!-- To view extension packages in API 30+ -->
|
<!-- To view extension packages in API 30+ -->
|
||||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".App"
|
android:name=".App"
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package eu.kanade.domain.track.service
|
package eu.kanade.domain.track.service
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.core.preference.PreferenceStore
|
import eu.kanade.tachiyomi.core.preference.PreferenceStore
|
||||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys
|
|
||||||
import eu.kanade.tachiyomi.data.track.TrackService
|
import eu.kanade.tachiyomi.data.track.TrackService
|
||||||
import eu.kanade.tachiyomi.data.track.anilist.Anilist
|
import eu.kanade.tachiyomi.data.track.anilist.Anilist
|
||||||
|
|
||||||
@ -9,18 +8,26 @@ class TrackPreferences(
|
|||||||
private val preferenceStore: PreferenceStore,
|
private val preferenceStore: PreferenceStore,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun trackUsername(sync: TrackService) = preferenceStore.getString(PreferenceKeys.trackUsername(sync.id), "")
|
fun trackUsername(sync: TrackService) = preferenceStore.getString(trackUsername(sync.id), "")
|
||||||
|
|
||||||
fun trackPassword(sync: TrackService) = preferenceStore.getString(PreferenceKeys.trackPassword(sync.id), "")
|
fun trackPassword(sync: TrackService) = preferenceStore.getString(trackPassword(sync.id), "")
|
||||||
|
|
||||||
fun setTrackCredentials(sync: TrackService, username: String, password: String) {
|
fun setTrackCredentials(sync: TrackService, username: String, password: String) {
|
||||||
trackUsername(sync).set(username)
|
trackUsername(sync).set(username)
|
||||||
trackPassword(sync).set(password)
|
trackPassword(sync).set(password)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun trackToken(sync: TrackService) = preferenceStore.getString(PreferenceKeys.trackToken(sync.id), "")
|
fun trackToken(sync: TrackService) = preferenceStore.getString(trackToken(sync.id), "")
|
||||||
|
|
||||||
fun anilistScoreType() = preferenceStore.getString("anilist_score_type", Anilist.POINT_10)
|
fun anilistScoreType() = preferenceStore.getString("anilist_score_type", Anilist.POINT_10)
|
||||||
|
|
||||||
fun autoUpdateTrack() = preferenceStore.getBoolean("pref_auto_update_manga_sync_key", true)
|
fun autoUpdateTrack() = preferenceStore.getBoolean("pref_auto_update_manga_sync_key", true)
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun trackUsername(syncId: Long) = "pref_mangasync_username_$syncId"
|
||||||
|
|
||||||
|
private fun trackPassword(syncId: Long) = "pref_mangasync_password_$syncId"
|
||||||
|
|
||||||
|
private fun trackToken(syncId: Long) = "track_token_$syncId"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ class DownloadQueue(
|
|||||||
updatedRelay.call(Unit)
|
updatedRelay.call(Unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getActiveDownloads(): Observable<Download> =
|
private fun getActiveDownloads(): Observable<Download> =
|
||||||
Observable.from(this).filter { download -> download.status == Download.State.DOWNLOADING }
|
Observable.from(this).filter { download -> download.status == Download.State.DOWNLOADING }
|
||||||
|
|
||||||
@Deprecated("Use getStatusAsFlow instead")
|
@Deprecated("Use getStatusAsFlow instead")
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
package eu.kanade.tachiyomi.data.preference
|
|
||||||
|
|
||||||
import androidx.preference.PreferenceDataStore
|
|
||||||
|
|
||||||
class EmptyPreferenceDataStore : PreferenceDataStore() {
|
|
||||||
|
|
||||||
override fun getBoolean(key: String?, defValue: Boolean): Boolean {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun putBoolean(key: String?, value: Boolean) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getInt(key: String?, defValue: Int): Int {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun putInt(key: String?, value: Int) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getLong(key: String?, defValue: Long): Long {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun putLong(key: String?, value: Long) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getFloat(key: String?, defValue: Float): Float {
|
|
||||||
return 0f
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun putFloat(key: String?, value: Float) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getString(key: String?, defValue: String?): String? {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun putString(key: String?, value: String?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getStringSet(key: String?, defValues: Set<String>?): Set<String>? {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun putStringSet(key: String?, values: Set<String>?) {
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,10 +6,4 @@ package eu.kanade.tachiyomi.data.preference
|
|||||||
object PreferenceKeys {
|
object PreferenceKeys {
|
||||||
|
|
||||||
const val dateFormat = "app_date_format"
|
const val dateFormat = "app_date_format"
|
||||||
|
|
||||||
fun trackUsername(syncId: Long) = "pref_mangasync_username_$syncId"
|
|
||||||
|
|
||||||
fun trackPassword(syncId: Long) = "pref_mangasync_password_$syncId"
|
|
||||||
|
|
||||||
fun trackToken(syncId: Long) = "track_token_$syncId"
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package eu.kanade.tachiyomi.extension.model
|
package eu.kanade.tachiyomi.extension.model
|
||||||
|
|
||||||
sealed class LoadResult {
|
sealed class LoadResult {
|
||||||
|
|
||||||
class Success(val extension: Extension.Installed) : LoadResult()
|
class Success(val extension: Extension.Installed) : LoadResult()
|
||||||
class Untrusted(val extension: Extension.Untrusted) : LoadResult()
|
class Untrusted(val extension: Extension.Untrusted) : LoadResult()
|
||||||
object Error : LoadResult()
|
object Error : LoadResult()
|
||||||
|
@ -31,7 +31,6 @@ import eu.kanade.tachiyomi.util.system.openInBrowser
|
|||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import eu.kanade.tachiyomi.widget.preference.TrackerPreference
|
import eu.kanade.tachiyomi.widget.preference.TrackerPreference
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
|
||||||
|
|
||||||
class SettingsTrackingController :
|
class SettingsTrackingController :
|
||||||
SettingsController(),
|
SettingsController(),
|
||||||
@ -104,7 +103,7 @@ class SettingsTrackingController :
|
|||||||
): TrackerPreference {
|
): TrackerPreference {
|
||||||
return add(
|
return add(
|
||||||
TrackerPreference(context).apply {
|
TrackerPreference(context).apply {
|
||||||
key = Keys.trackUsername(service.id)
|
key = TrackPreferences.trackUsername(service.id)
|
||||||
titleRes = service.nameRes()
|
titleRes = service.nameRes()
|
||||||
iconRes = service.getLogo()
|
iconRes = service.getLogo()
|
||||||
iconColor = service.getLogoColor()
|
iconColor = service.getLogoColor()
|
||||||
@ -148,7 +147,7 @@ class SettingsTrackingController :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun updatePreference(id: Long) {
|
private fun updatePreference(id: Long) {
|
||||||
val pref = findPreference(Keys.trackUsername(id)) as? TrackerPreference
|
val pref = findPreference(TrackPreferences.trackUsername(id)) as? TrackerPreference
|
||||||
pref?.notifyChanged()
|
pref?.notifyChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user