mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-01-06 17:40:30 +05:30
commit
52ce834003
@ -1,5 +1,6 @@
|
|||||||
package com.github.libretube
|
package com.github.libretube
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.app.NotificationChannel
|
import android.app.NotificationChannel
|
||||||
import android.app.NotificationManager
|
import android.app.NotificationManager
|
||||||
@ -13,6 +14,10 @@ import com.fasterxml.jackson.core.type.TypeReference
|
|||||||
import com.fasterxml.jackson.databind.ObjectMapper
|
import com.fasterxml.jackson.databind.ObjectMapper
|
||||||
import com.github.libretube.api.CronetHelper
|
import com.github.libretube.api.CronetHelper
|
||||||
import com.github.libretube.api.RetrofitInstance
|
import com.github.libretube.api.RetrofitInstance
|
||||||
|
import com.github.libretube.constants.BACKGROUND_CHANNEL_ID
|
||||||
|
import com.github.libretube.constants.DOWNLOAD_CHANNEL_ID
|
||||||
|
import com.github.libretube.constants.PIPED_API_URL
|
||||||
|
import com.github.libretube.constants.PUSH_CHANNEL_ID
|
||||||
import com.github.libretube.constants.PreferenceKeys
|
import com.github.libretube.constants.PreferenceKeys
|
||||||
import com.github.libretube.db.DatabaseHolder
|
import com.github.libretube.db.DatabaseHolder
|
||||||
import com.github.libretube.db.obj.WatchHistoryItem
|
import com.github.libretube.db.obj.WatchHistoryItem
|
||||||
@ -100,6 +105,7 @@ class MyApp : Application() {
|
|||||||
/**
|
/**
|
||||||
* Initializes the required [NotificationChannel]s for the app.
|
* Initializes the required [NotificationChannel]s for the app.
|
||||||
*/
|
*/
|
||||||
|
@SuppressLint("InlinedApi")
|
||||||
private fun initializeNotificationChannels() {
|
private fun initializeNotificationChannels() {
|
||||||
createNotificationChannel(
|
createNotificationChannel(
|
||||||
DOWNLOAD_CHANNEL_ID,
|
DOWNLOAD_CHANNEL_ID,
|
||||||
@ -149,13 +155,13 @@ class MyApp : Application() {
|
|||||||
val username = legacyUserPrefs.getString("username", "")!!
|
val username = legacyUserPrefs.getString("username", "")!!
|
||||||
if (username != "") {
|
if (username != "") {
|
||||||
PreferenceHelper.setUsername(username)
|
PreferenceHelper.setUsername(username)
|
||||||
legacyUserPrefs.edit().putString("username", "")
|
legacyUserPrefs.edit().putString("username", "").apply()
|
||||||
}
|
}
|
||||||
val legacyTokenPrefs = getSharedPreferences("token", Context.MODE_PRIVATE)
|
val legacyTokenPrefs = getSharedPreferences("token", Context.MODE_PRIVATE)
|
||||||
val token = legacyUserPrefs.getString("token", "")!!
|
val token = legacyUserPrefs.getString("token", "")!!
|
||||||
if (token != "") {
|
if (token != "") {
|
||||||
PreferenceHelper.setToken(token)
|
PreferenceHelper.setToken(token)
|
||||||
legacyTokenPrefs.edit().putString("token", "")
|
legacyTokenPrefs.edit().putString("token", "").apply()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +183,7 @@ class MyApp : Application() {
|
|||||||
)
|
)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
}
|
}
|
||||||
prefs.edit().putString("watch_history", "").commit()
|
prefs.edit().putString("watch_history", "").apply()
|
||||||
}
|
}
|
||||||
val legacyWatchPositions = prefs.getString("watch_positions", "")
|
val legacyWatchPositions = prefs.getString("watch_positions", "")
|
||||||
if (legacyWatchPositions != "") {
|
if (legacyWatchPositions != "") {
|
||||||
@ -189,12 +195,12 @@ class MyApp : Application() {
|
|||||||
)
|
)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
}
|
}
|
||||||
prefs.edit().remove("watch_positions").commit()
|
prefs.edit().remove("watch_positions").apply()
|
||||||
}
|
}
|
||||||
prefs.edit()
|
prefs.edit()
|
||||||
.remove("custom_instances")
|
.remove("custom_instances")
|
||||||
.remove("local_subscriptions")
|
.remove("local_subscriptions")
|
||||||
.commit()
|
.apply()
|
||||||
}.start()
|
}.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user