mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 00:10:32 +05:30
Fix the wrong error on the subscriptions page
This commit is contained in:
parent
b499eb0358
commit
3b13cc4efb
@ -100,18 +100,21 @@ class BackgroundMode : Service() {
|
|||||||
*/
|
*/
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
if (Build.VERSION.SDK_INT >= 26) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
val channelId = BACKGROUND_CHANNEL_ID
|
|
||||||
val channel = NotificationChannel(
|
val channel = NotificationChannel(
|
||||||
channelId,
|
BACKGROUND_CHANNEL_ID,
|
||||||
"Background Service",
|
"Background Service",
|
||||||
NotificationManager.IMPORTANCE_DEFAULT
|
NotificationManager.IMPORTANCE_DEFAULT
|
||||||
)
|
)
|
||||||
val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
||||||
notificationManager.createNotificationChannel(channel)
|
notificationManager.createNotificationChannel(channel)
|
||||||
val notification: Notification = Notification.Builder(this, channelId)
|
|
||||||
|
// see https://developer.android.com/reference/android/app/Service#startForeground(int,%20android.app.Notification)
|
||||||
|
val notification: Notification = Notification.Builder(this, BACKGROUND_CHANNEL_ID)
|
||||||
.setContentTitle(getString(R.string.app_name))
|
.setContentTitle(getString(R.string.app_name))
|
||||||
.setContentText(getString(R.string.playingOnBackground)).build()
|
.setContentText(getString(R.string.playingOnBackground))
|
||||||
|
.build()
|
||||||
|
|
||||||
startForeground(PLAYER_NOTIFICATION_ID, notification)
|
startForeground(PLAYER_NOTIFICATION_ID, notification)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,10 @@ class SubscriptionsFragment : BaseFragment() {
|
|||||||
|
|
||||||
// listen for error responses
|
// listen for error responses
|
||||||
viewModel.errorResponse.observe(viewLifecycleOwner) {
|
viewModel.errorResponse.observe(viewLifecycleOwner) {
|
||||||
if (it) Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
|
if (it) {
|
||||||
|
Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show()
|
||||||
|
viewModel.errorResponse.value = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel.videoFeed.observe(viewLifecycleOwner) {
|
viewModel.videoFeed.observe(viewLifecycleOwner) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user