Skip to content

Commit

Permalink
minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
immortal-forest committed Mar 17, 2024
1 parent ea35f55 commit 17d2d6d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ class MediumWidget : GlanceAppWidget() {
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
Bundle.EMPTY
)
loadImage(image.value.uri)
CoroutineScope(Dispatchers.IO).launch {
loadImage(context, id, image.value.uri)
}
},
{ context, id ->
updateUI(context, id)
Expand All @@ -127,15 +129,19 @@ class MediumWidget : GlanceAppWidget() {
}

private fun connectToSpotify() {
spotifyHelper.disconnect()
spotifyHelper.connectToSpotify(
onConnect = { context, id, appRemote ->
spotifyAppRemote = appRemote
updateUI(context, id)
listenToUpdates(context, id)
CoroutineScope(Dispatchers.IO).launch {
listenToUpdates(context, id)
}
},
onError = { context, id ->
paused.value = true
updateUI(context, id)
connectToSpotify()
},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ class SmallWidget : GlanceAppWidget() {
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
Bundle.EMPTY
)
loadImage(image.value.uri)
CoroutineScope(Dispatchers.IO).launch {
loadImage(context, id, image.value.uri)
}
},
{ context, id ->
updateUI(context, id)
Expand All @@ -123,15 +125,19 @@ class SmallWidget : GlanceAppWidget() {
}

private fun connectToSpotify() {
spotifyHelper.disconnect()
spotifyHelper.connectToSpotify(
onConnect = { context, id, appRemote ->
spotifyAppRemote = appRemote
updateUI(context, id)
listenToUpdates(context, id)
CoroutineScope(Dispatchers.IO).launch {
listenToUpdates(context, id)
}
},
onError = { context, id ->
paused.value = true
updateUI(context, id)
connectToSpotify()
},
)

Expand Down

0 comments on commit 17d2d6d

Please sign in to comment.