Fix unable to Toast on QS tiles being clicked error (#2776)

* Fix unable to Toast on QS tiles being clicked error

* Review comments
This commit is contained in:
Daniel Shokouhi 2022-08-13 17:36:32 -07:00 committed by GitHub
parent 03a356f147
commit d3c22cf341
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -149,8 +149,14 @@ abstract class TileExtensions : TileService() {
Log.d(TAG, "Service call sent for tile ID: $tileId")
} catch (e: Exception) {
Log.e(TAG, "Unable to call service for tile ID: $tileId", e)
Toast.makeText(context, commonR.string.service_call_failure, Toast.LENGTH_SHORT)
.show()
withContext(Dispatchers.Main) {
Toast.makeText(
context,
commonR.string.service_call_failure,
Toast.LENGTH_SHORT
)
.show()
}
}
}
tile.state = Tile.STATE_INACTIVE
@ -159,7 +165,14 @@ abstract class TileExtensions : TileService() {
tile.state = Tile.STATE_UNAVAILABLE
tile.updateTile()
Log.d(TAG, "No tile data found for tile ID: $tileId")
Toast.makeText(context, commonR.string.tile_data_missing, Toast.LENGTH_SHORT).show()
withContext(Dispatchers.Main) {
Toast.makeText(
context,
commonR.string.tile_data_missing,
Toast.LENGTH_SHORT
)
.show()
}
}
}