Only schedule a metadata task when saving to server

This commit is contained in:
Ming Ming 2022-09-11 15:58:25 +08:00
parent ddf059e609
commit a917458a07

View file

@ -340,7 +340,7 @@ class ImageProcessorService : Service() {
)
cmdTask = object : ImageProcessorCommandTask(applicationContext) {
override fun onPostExecute(result: MessageEvent) {
notifyResult(result)
notifyResult(result, cmd.isSaveToServer)
cmds.removeFirst()
stopSelf(cmd.startId)
cmdTask = null
@ -386,9 +386,13 @@ class ImageProcessorService : Service() {
}
}
private fun notifyResult(event: MessageEvent) {
private fun notifyResult(event: MessageEvent, shouldFireEvent: Boolean) {
if (event is ImageProcessorCompletedEvent) {
NativeEventChannelHandler.fire(ImageProcessorUploadSuccessEvent())
if (shouldFireEvent) {
NativeEventChannelHandler.fire(
ImageProcessorUploadSuccessEvent()
)
}
notificationManager.notify(
RESULT_NOTIFICATION_ID, buildResultNotification(event.result)
)