Merge pull request #1631 from Bnyro/master

Fix the wrong error on the subscriptions page
This commit is contained in:
Bnyro 2022-10-21 18:35:58 +02:00 committed by GitHub
commit 441087d871
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -100,18 +100,21 @@ class BackgroundMode : Service() {
*/
override fun onCreate() {
super.onCreate()
if (Build.VERSION.SDK_INT >= 26) {
val channelId = BACKGROUND_CHANNEL_ID
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel = NotificationChannel(
channelId,
BACKGROUND_CHANNEL_ID,
"Background Service",
NotificationManager.IMPORTANCE_DEFAULT
)
val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
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))
.setContentText(getString(R.string.playingOnBackground)).build()
.setContentText(getString(R.string.playingOnBackground))
.build()
startForeground(PLAYER_NOTIFICATION_ID, notification)
}
}

View File

@ -62,7 +62,10 @@ class SubscriptionsFragment : BaseFragment() {
// listen for error responses
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) {