diff --git a/android/app/build.gradle b/android/app/build.gradle index 95b53c724..7f038fe1a 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -204,6 +204,7 @@ dependencies { implementation 'androidx.media:media:1.6.0' implementation 'androidx.multidex:multidex:2.0.1' implementation 'androidx.security:security-crypto:1.1.0-alpha06' + implementation 'androidx.work:work-runtime-ktx:2.8.1' implementation 'com.caverock:androidsvg-aar:1.4' implementation 'com.commonsware.cwac:document:0.5.0' diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 67d85efed..09b752faf 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -40,11 +40,6 @@ This change eventually prevents building the app with Flutter v3.7.11. - @@ -251,12 +246,6 @@ This change eventually prevents building the app with Flutter v3.7.11. - - - msg.arg1 = startId - msg.data = msgData - serviceHandler?.sendMessage(msg) - } - - return START_NOT_STICKY - } - - private fun detachAndStop() { - analysisServiceBinder.detach() - stopSelf() - } - - private fun initChannels(context: Context) { - val engine = flutterEngine - engine ?: throw Exception("Flutter engine is not initialized") - - val messenger = engine.dartExecutor - - // channels for analysis - - // dart -> platform -> dart - // - need Context - MethodChannel(messenger, DeviceHandler.CHANNEL).setMethodCallHandler(DeviceHandler(context)) - MethodChannel(messenger, GeocodingHandler.CHANNEL).setMethodCallHandler(GeocodingHandler(context)) - MethodChannel(messenger, MediaStoreHandler.CHANNEL).setMethodCallHandler(MediaStoreHandler(context)) - MethodChannel(messenger, MetadataFetchHandler.CHANNEL).setMethodCallHandler(MetadataFetchHandler(context)) - MethodChannel(messenger, StorageHandler.CHANNEL).setMethodCallHandler(StorageHandler(context)) - - // result streaming: dart -> platform ->->-> dart - // - need Context - StreamsChannel(messenger, ImageByteStreamHandler.CHANNEL).setStreamHandlerFactory { args -> ImageByteStreamHandler(context, args) } - StreamsChannel(messenger, MediaStoreStreamHandler.CHANNEL).setStreamHandlerFactory { args -> MediaStoreStreamHandler(context, args) } - - // channel for service management - backgroundChannel = MethodChannel(messenger, BACKGROUND_CHANNEL).apply { - setMethodCallHandler { call, result -> onMethodCall(call, result) } - } - } - - private fun onMethodCall(call: MethodCall, result: MethodChannel.Result) { - when (call.method) { - "initialized" -> { - Log.d(LOG_TAG, "background channel is ready") - result.success(null) - } - "updateNotification" -> { - val title = call.argument("title") - val message = call.argument("message") - val notification = buildNotification(title, message) - NotificationManagerCompat.from(this).notify(NOTIFICATION_ID, notification) - result.success(null) - } - "refreshApp" -> { - analysisServiceBinder.refreshApp() - result.success(null) - } - "stop" -> { - detachAndStop() - result.success(null) - } - else -> result.notImplemented() - } - } - - private fun buildNotification(title: String? = null, message: String? = null): Notification { - val pendingIntentFlags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT - } else { - PendingIntent.FLAG_UPDATE_CURRENT - } - val stopServiceIntent = Intent(this, AnalysisService::class.java).let { - it.putExtra(KEY_COMMAND, COMMAND_STOP) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - PendingIntent.getForegroundService(this, STOP_SERVICE_REQUEST, it, pendingIntentFlags) - } else { - PendingIntent.getService(this, STOP_SERVICE_REQUEST, it, pendingIntentFlags) - } - } - val openAppIntent = Intent(this, MainActivity::class.java).let { - PendingIntent.getActivity(this, OPEN_FROM_ANALYSIS_SERVICE, it, pendingIntentFlags) - } - val stopAction = NotificationCompat.Action.Builder( - R.drawable.ic_outline_stop_24, - getString(R.string.analysis_notification_action_stop), - stopServiceIntent - ).build() - val icon = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) R.drawable.ic_notification else R.mipmap.ic_launcher_round - return NotificationCompat.Builder(this, CHANNEL_ANALYSIS) - .setContentTitle(title ?: getText(R.string.analysis_notification_default_title)) - .setContentText(message) - .setBadgeIconType(NotificationCompat.BADGE_ICON_NONE) - .setSmallIcon(icon) - .setContentIntent(openAppIntent) - .setPriority(NotificationCompat.PRIORITY_LOW) - .addAction(stopAction) - .build() - } - - private inner class ServiceHandler(looper: Looper) : Handler(looper) { - override fun handleMessage(msg: Message) { - val data = msg.data - when (data.getString(KEY_COMMAND)) { - COMMAND_START -> { - runBlocking { - FlutterUtils.runOnUiThread { - val entryIds = data.getIntArray(KEY_ENTRY_IDS)?.toList() - backgroundChannel?.invokeMethod( - "start", hashMapOf( - "entryIds" to entryIds, - "force" to data.getBoolean(KEY_FORCE), - ) - ) - } - } - } - COMMAND_STOP -> { - // unconditionally stop the service - runBlocking { - FlutterUtils.runOnUiThread { - backgroundChannel?.invokeMethod("stop", null) - } - } - detachAndStop() - } - else -> { - } - } - } - } - - companion object { - private val LOG_TAG = LogUtils.createTag() - private const val BACKGROUND_CHANNEL = "deckers.thibault/aves/analysis_service_background" - const val SHARED_PREFERENCES_KEY = "analysis_service" - const val CALLBACK_HANDLE_KEY = "callback_handle" - - const val NOTIFICATION_ID = 1 - const val STOP_SERVICE_REQUEST = 1 - const val CHANNEL_ANALYSIS = "analysis" - - const val KEY_COMMAND = "command" - const val COMMAND_START = "start" - const val COMMAND_STOP = "stop" - const val KEY_ENTRY_IDS = "entry_ids" - const val KEY_FORCE = "force" - } -} - -class AnalysisServiceBinder : Binder() { - private val listeners = hashSetOf() - - fun startListening(listener: AnalysisServiceListener) = listeners.add(listener) - - fun stopListening(listener: AnalysisServiceListener) = listeners.remove(listener) - - fun refreshApp() { - val localListeners = listeners.toSet() - for (listener in localListeners) { - try { - listener.refreshApp() - } catch (e: Exception) { - Log.e(LOG_TAG, "failed to notify listener=$listener", e) - } - } - } - - fun detach() { - val localListeners = listeners.toSet() - for (listener in localListeners) { - try { - listener.detachFromActivity() - } catch (e: Exception) { - Log.e(LOG_TAG, "failed to detach listener=$listener", e) - } - } - } - - companion object { - private val LOG_TAG = LogUtils.createTag() - } -} - -interface AnalysisServiceListener { - fun refreshApp() - fun detachFromActivity() -} \ No newline at end of file diff --git a/android/app/src/main/kotlin/deckers/thibault/aves/AnalysisWorker.kt b/android/app/src/main/kotlin/deckers/thibault/aves/AnalysisWorker.kt new file mode 100644 index 000000000..ec8ffb8ef --- /dev/null +++ b/android/app/src/main/kotlin/deckers/thibault/aves/AnalysisWorker.kt @@ -0,0 +1,173 @@ +package deckers.thibault.aves + +import android.app.PendingIntent +import android.content.Context +import android.content.Intent +import android.os.Build +import android.util.Log +import androidx.core.app.NotificationChannelCompat +import androidx.core.app.NotificationCompat +import androidx.core.app.NotificationManagerCompat +import androidx.work.CoroutineWorker +import androidx.work.ForegroundInfo +import androidx.work.WorkManager +import androidx.work.WorkerParameters +import app.loup.streams_channel.StreamsChannel +import deckers.thibault.aves.channel.calls.DeviceHandler +import deckers.thibault.aves.channel.calls.GeocodingHandler +import deckers.thibault.aves.channel.calls.MediaStoreHandler +import deckers.thibault.aves.channel.calls.MetadataFetchHandler +import deckers.thibault.aves.channel.calls.StorageHandler +import deckers.thibault.aves.channel.streams.ImageByteStreamHandler +import deckers.thibault.aves.channel.streams.MediaStoreStreamHandler +import deckers.thibault.aves.utils.FlutterUtils +import deckers.thibault.aves.utils.LogUtils +import io.flutter.embedding.engine.FlutterEngine +import io.flutter.plugin.common.MethodCall +import io.flutter.plugin.common.MethodChannel +import kotlinx.coroutines.runBlocking +import kotlin.coroutines.Continuation +import kotlin.coroutines.resume +import kotlin.coroutines.resumeWithException +import kotlin.coroutines.suspendCoroutine + +class AnalysisWorker(context: Context, parameters: WorkerParameters) : CoroutineWorker(context, parameters) { + private var workCont: Continuation? = null + private var flutterEngine: FlutterEngine? = null + private var backgroundChannel: MethodChannel? = null + + override suspend fun doWork(): Result { + createNotificationChannel() + setForeground(createForegroundInfo()) + suspendCoroutine { cont -> + workCont = cont + onStart() + } + return Result.success() + } + + private fun onStart() { + Log.i(LOG_TAG, "Start analysis worker") + runBlocking { + FlutterUtils.initFlutterEngine(applicationContext, SHARED_PREFERENCES_KEY, CALLBACK_HANDLE_KEY) { + flutterEngine = it + } + } + + try { + initChannels(applicationContext) + + runBlocking { + FlutterUtils.runOnUiThread { + backgroundChannel?.invokeMethod( + "start", hashMapOf( + "entryIds" to inputData.getIntArray(KEY_ENTRY_IDS)?.toList(), + "force" to inputData.getBoolean(KEY_FORCE, false), + ) + ) + } + } + } catch (e: Exception) { + Log.e(LOG_TAG, "failed to initialize worker", e) + workCont?.resumeWithException(e) + } + } + + private fun initChannels(context: Context) { + val engine = flutterEngine + engine ?: throw Exception("Flutter engine is not initialized") + + val messenger = engine.dartExecutor + + // channels for analysis + + // dart -> platform -> dart + // - need Context + MethodChannel(messenger, DeviceHandler.CHANNEL).setMethodCallHandler(DeviceHandler(context)) + MethodChannel(messenger, GeocodingHandler.CHANNEL).setMethodCallHandler(GeocodingHandler(context)) + MethodChannel(messenger, MediaStoreHandler.CHANNEL).setMethodCallHandler(MediaStoreHandler(context)) + MethodChannel(messenger, MetadataFetchHandler.CHANNEL).setMethodCallHandler(MetadataFetchHandler(context)) + MethodChannel(messenger, StorageHandler.CHANNEL).setMethodCallHandler(StorageHandler(context)) + + // result streaming: dart -> platform ->->-> dart + // - need Context + StreamsChannel(messenger, ImageByteStreamHandler.CHANNEL).setStreamHandlerFactory { args -> ImageByteStreamHandler(context, args) } + StreamsChannel(messenger, MediaStoreStreamHandler.CHANNEL).setStreamHandlerFactory { args -> MediaStoreStreamHandler(context, args) } + + // channel for service management + backgroundChannel = MethodChannel(messenger, BACKGROUND_CHANNEL).apply { + setMethodCallHandler { call, result -> onMethodCall(call, result) } + } + } + + private fun onMethodCall(call: MethodCall, result: MethodChannel.Result) { + when (call.method) { + "initialized" -> { + Log.d(LOG_TAG, "Analysis background channel is ready") + result.success(null) + } + + "updateNotification" -> { + val title = call.argument("title") + val message = call.argument("message") + setForegroundAsync(createForegroundInfo(title, message)) + result.success(null) + } + + "stop" -> { + workCont?.resume(null) + result.success(null) + } + + else -> result.notImplemented() + } + } + + private fun createNotificationChannel() { + val channel = NotificationChannelCompat.Builder(NOTIFICATION_CHANNEL, NotificationManagerCompat.IMPORTANCE_LOW) + .setName(applicationContext.getText(R.string.analysis_channel_name)) + .setShowBadge(false) + .build() + NotificationManagerCompat.from(applicationContext).createNotificationChannel(channel) + } + + private fun createForegroundInfo(title: String? = null, message: String? = null): ForegroundInfo { + val pendingIntentFlags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT + } else { + PendingIntent.FLAG_UPDATE_CURRENT + } + val openAppIntent = Intent(applicationContext, MainActivity::class.java).let { + PendingIntent.getActivity(applicationContext, MainActivity.OPEN_FROM_ANALYSIS_SERVICE, it, pendingIntentFlags) + } + val stopAction = NotificationCompat.Action.Builder( + R.drawable.ic_outline_stop_24, + applicationContext.getString(R.string.analysis_notification_action_stop), + WorkManager.getInstance(applicationContext).createCancelPendingIntent(id) + ).build() + val icon = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) R.drawable.ic_notification else R.mipmap.ic_launcher_round + val notification = NotificationCompat.Builder(applicationContext, NOTIFICATION_CHANNEL) + .setContentTitle(title ?: applicationContext.getText(R.string.analysis_notification_default_title)) + .setContentText(message) + .setBadgeIconType(NotificationCompat.BADGE_ICON_NONE) + .setSmallIcon(icon) + .setContentIntent(openAppIntent) + .setPriority(NotificationCompat.PRIORITY_LOW) + .addAction(stopAction) + .build() + return ForegroundInfo(NOTIFICATION_ID, notification) + } + + companion object { + private val LOG_TAG = LogUtils.createTag() + private const val BACKGROUND_CHANNEL = "deckers.thibault/aves/analysis_service_background" + const val SHARED_PREFERENCES_KEY = "analysis_service" + const val CALLBACK_HANDLE_KEY = "callback_handle" + + const val NOTIFICATION_CHANNEL = "analysis" + const val NOTIFICATION_ID = 1 + + const val KEY_ENTRY_IDS = "entry_ids" + const val KEY_FORCE = "force" + } +} diff --git a/android/app/src/main/kotlin/deckers/thibault/aves/MainActivity.kt b/android/app/src/main/kotlin/deckers/thibault/aves/MainActivity.kt index 06fec0e9f..2e46d64d2 100644 --- a/android/app/src/main/kotlin/deckers/thibault/aves/MainActivity.kt +++ b/android/app/src/main/kotlin/deckers/thibault/aves/MainActivity.kt @@ -170,7 +170,6 @@ open class MainActivity : FlutterFragmentActivity() { override fun onStop() { Log.i(LOG_TAG, "onStop") - analysisHandler.detachFromActivity() super.onStop() } diff --git a/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/AnalysisHandler.kt b/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/AnalysisHandler.kt index e44d0e5b8..ade45f3c5 100644 --- a/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/AnalysisHandler.kt +++ b/android/app/src/main/kotlin/deckers/thibault/aves/channel/calls/AnalysisHandler.kt @@ -1,32 +1,30 @@ package deckers.thibault.aves.channel.calls -import android.app.Activity -import android.content.ComponentName import android.content.Context -import android.content.Intent -import android.content.ServiceConnection -import android.os.Build -import android.os.IBinder -import android.util.Log -import deckers.thibault.aves.AnalysisService -import deckers.thibault.aves.AnalysisServiceBinder -import deckers.thibault.aves.AnalysisServiceListener -import deckers.thibault.aves.utils.ContextUtils.isMyServiceRunning -import deckers.thibault.aves.utils.LogUtils +import androidx.core.app.ComponentActivity +import androidx.work.ExistingWorkPolicy +import androidx.work.OneTimeWorkRequestBuilder +import androidx.work.WorkInfo +import androidx.work.WorkManager +import androidx.work.workDataOf +import deckers.thibault.aves.AnalysisWorker +import deckers.thibault.aves.utils.FlutterUtils import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodChannel import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking -class AnalysisHandler(private val activity: Activity, private val onAnalysisCompleted: () -> Unit) : MethodChannel.MethodCallHandler, AnalysisServiceListener { + +class AnalysisHandler(private val activity: ComponentActivity, private val onAnalysisCompleted: () -> Unit) : MethodChannel.MethodCallHandler { private val ioScope = CoroutineScope(SupervisorJob() + Dispatchers.IO) override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) { when (call.method) { "registerCallback" -> ioScope.launch { Coresult.safe(call, result, ::registerCallback) } - "startService" -> Coresult.safe(call, result, ::startAnalysis) + "startAnalysis" -> Coresult.safe(call, result, ::startAnalysis) else -> result.notImplemented() } } @@ -38,9 +36,9 @@ class AnalysisHandler(private val activity: Activity, private val onAnalysisComp return } - activity.getSharedPreferences(AnalysisService.SHARED_PREFERENCES_KEY, Context.MODE_PRIVATE) + activity.getSharedPreferences(AnalysisWorker.SHARED_PREFERENCES_KEY, Context.MODE_PRIVATE) .edit() - .putLong(AnalysisService.CALLBACK_HANDLE_KEY, callbackHandle) + .putLong(AnalysisWorker.CALLBACK_HANDLE_KEY, callbackHandle) .apply() result.success(true) } @@ -55,20 +53,18 @@ class AnalysisHandler(private val activity: Activity, private val onAnalysisComp // can be null or empty val entryIds = call.argument>("entryIds") - if (!activity.isMyServiceRunning(AnalysisService::class.java)) { - val intent = Intent(activity, AnalysisService::class.java) - .putExtra(AnalysisService.KEY_COMMAND, AnalysisService.COMMAND_START) - .putExtra(AnalysisService.KEY_ENTRY_IDS, entryIds?.toIntArray()) - .putExtra(AnalysisService.KEY_FORCE, force) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - // Foreground services cannot start from background, but the service here may start fine - // while the current lifecycle state (via `ProcessLifecycleOwner.get().lifecycle.currentState`) - // is only `INITIALIZED`, so we should not preemptively return when the state is below `STARTED`. - activity.startForegroundService(intent) - } else { - activity.startService(intent) - } - } + WorkManager.getInstance(activity).enqueueUniqueWork( + ANALYSIS_WORK_NAME, + ExistingWorkPolicy.KEEP, + OneTimeWorkRequestBuilder().apply { + setInputData( + workDataOf( + AnalysisWorker.KEY_ENTRY_IDS to entryIds?.toIntArray(), + AnalysisWorker.KEY_FORCE to force, + ) + ) + }.build() + ) attachToActivity() result.success(null) } @@ -76,44 +72,22 @@ class AnalysisHandler(private val activity: Activity, private val onAnalysisComp private var attached = false fun attachToActivity() { - if (activity.isMyServiceRunning(AnalysisService::class.java)) { - val intent = Intent(activity, AnalysisService::class.java) - activity.bindService(intent, connection, Context.BIND_AUTO_CREATE) + if (!attached) { attached = true - } - } - - override fun detachFromActivity() { - if (attached) { - attached = false - activity.unbindService(connection) - } - } - - override fun refreshApp() { - if (attached) { - onAnalysisCompleted() - } - } - - private val connection = object : ServiceConnection { - var binder: AnalysisServiceBinder? = null - - override fun onServiceConnected(name: ComponentName, service: IBinder) { - Log.i(LOG_TAG, "Analysis service connected") - binder = service as AnalysisServiceBinder - binder?.startListening(this@AnalysisHandler) - } - - override fun onServiceDisconnected(name: ComponentName) { - Log.i(LOG_TAG, "Analysis service disconnected") - binder?.stopListening(this@AnalysisHandler) - binder = null + WorkManager.getInstance(activity).getWorkInfosForUniqueWorkLiveData(ANALYSIS_WORK_NAME).observe(activity) { list -> + if (list.any { it.state == WorkInfo.State.SUCCEEDED }) { + runBlocking { + FlutterUtils.runOnUiThread { + onAnalysisCompleted() + } + } + } + } } } companion object { - private val LOG_TAG = LogUtils.createTag() const val CHANNEL = "deckers.thibault/aves/analysis" + private const val ANALYSIS_WORK_NAME = "analysis_work" } } diff --git a/android/app/src/main/res/values-ar/strings.xml b/android/app/src/main/res/values-ar/strings.xml index d55481fb9..a5e1a1c3b 100644 --- a/android/app/src/main/res/values-ar/strings.xml +++ b/android/app/src/main/res/values-ar/strings.xml @@ -5,7 +5,6 @@ البحث الفيديوهات فحص الوسائط - فحص الصور والفيديوهات يتم فحص الوسائط إيقاف \ No newline at end of file diff --git a/android/app/src/main/res/values-ckb/strings.xml b/android/app/src/main/res/values-ckb/strings.xml index 13c4df775..fb8b36a87 100644 --- a/android/app/src/main/res/values-ckb/strings.xml +++ b/android/app/src/main/res/values-ckb/strings.xml @@ -6,7 +6,6 @@ گەڕان ڤیدیۆ گەڕان بۆ فایل - گەڕان بۆ وێنە و ڤیدیۆ گەڕان بۆ فایلەکان وەستاندن \ No newline at end of file diff --git a/android/app/src/main/res/values-cs/strings.xml b/android/app/src/main/res/values-cs/strings.xml index 02638c56a..556ce9d94 100644 --- a/android/app/src/main/res/values-cs/strings.xml +++ b/android/app/src/main/res/values-cs/strings.xml @@ -5,7 +5,6 @@ Hledat Videa Prohledat média - Prohledat obrázky a videa Prohledávání médií Zastavit Fotorámeček diff --git a/android/app/src/main/res/values-de/strings.xml b/android/app/src/main/res/values-de/strings.xml index 1ecb251c5..67f33df47 100644 --- a/android/app/src/main/res/values-de/strings.xml +++ b/android/app/src/main/res/values-de/strings.xml @@ -6,7 +6,6 @@ Suche Videos Analyse von Medien - Bilder & Videos scannen Medien scannen Abbrechen Sicherer Modus diff --git a/android/app/src/main/res/values-el/strings.xml b/android/app/src/main/res/values-el/strings.xml index 2635a337b..0e29952cc 100644 --- a/android/app/src/main/res/values-el/strings.xml +++ b/android/app/src/main/res/values-el/strings.xml @@ -6,7 +6,6 @@ Αναζήτηση Βίντεο Σάρωση πολυμέσων - Σάρωση εικόνων & Βίντεο Σάρωση στοιχείων Διακοπή \ No newline at end of file diff --git a/android/app/src/main/res/values-es/strings.xml b/android/app/src/main/res/values-es/strings.xml index b2364e4dd..9fbcf09b4 100644 --- a/android/app/src/main/res/values-es/strings.xml +++ b/android/app/src/main/res/values-es/strings.xml @@ -6,7 +6,6 @@ Búsqueda Vídeos Explorar medios - Explorar imágenes & videos Explorando medios Anular Modo seguro diff --git a/android/app/src/main/res/values-eu/strings.xml b/android/app/src/main/res/values-eu/strings.xml index 92a69bac7..732dd1c98 100644 --- a/android/app/src/main/res/values-eu/strings.xml +++ b/android/app/src/main/res/values-eu/strings.xml @@ -3,7 +3,6 @@ Bilatu Bideoak Argazki-markoa - Irudiak eta bideoak eskaneatu Horma-papera Media eskaneatu Gelditu diff --git a/android/app/src/main/res/values-fa/strings.xml b/android/app/src/main/res/values-fa/strings.xml index 5b1e2f8ea..e69a7f2b5 100644 --- a/android/app/src/main/res/values-fa/strings.xml +++ b/android/app/src/main/res/values-fa/strings.xml @@ -2,7 +2,6 @@ ویدئو ها کنکاش رسانه - کنکاش تصاویر و ویدئو ها جستجو کاغذدیواری در حال کنکاش رسانه‌ها diff --git a/android/app/src/main/res/values-fr/strings.xml b/android/app/src/main/res/values-fr/strings.xml index 0243698d8..fa821f4ea 100644 --- a/android/app/src/main/res/values-fr/strings.xml +++ b/android/app/src/main/res/values-fr/strings.xml @@ -6,7 +6,6 @@ Recherche Vidéos Analyse des images - Analyse des images & vidéos Analyse des images Annuler Mode sans échec diff --git a/android/app/src/main/res/values-gl/strings.xml b/android/app/src/main/res/values-gl/strings.xml index 6be7c113e..1049c3728 100644 --- a/android/app/src/main/res/values-gl/strings.xml +++ b/android/app/src/main/res/values-gl/strings.xml @@ -6,7 +6,6 @@ Procura Vídeos Escaneo multimedia - Escanealas imaxes e os vídeos Escaneando medios Pare \ No newline at end of file diff --git a/android/app/src/main/res/values-hi/strings.xml b/android/app/src/main/res/values-hi/strings.xml index 615529ee1..0447c8eb1 100644 --- a/android/app/src/main/res/values-hi/strings.xml +++ b/android/app/src/main/res/values-hi/strings.xml @@ -8,5 +8,4 @@ मीडिया जाँचे ऐवीज वीडियो - छवि & वीडियो जाँचे \ No newline at end of file diff --git a/android/app/src/main/res/values-hu/strings.xml b/android/app/src/main/res/values-hu/strings.xml index 5d4734530..4475c608f 100644 --- a/android/app/src/main/res/values-hu/strings.xml +++ b/android/app/src/main/res/values-hu/strings.xml @@ -8,6 +8,5 @@ Fotó keret Biztonsági üzemmód Tartalom keresése - Képek és videók keresése Média beolvasása \ No newline at end of file diff --git a/android/app/src/main/res/values-id/strings.xml b/android/app/src/main/res/values-id/strings.xml index c8067fc0e..29fc0d54c 100644 --- a/android/app/src/main/res/values-id/strings.xml +++ b/android/app/src/main/res/values-id/strings.xml @@ -6,7 +6,6 @@ Cari Video Pindai media - Pindai gambar & video Memindai media Berhenti Mode aman diff --git a/android/app/src/main/res/values-it/strings.xml b/android/app/src/main/res/values-it/strings.xml index 1f254b126..ac62cd864 100644 --- a/android/app/src/main/res/values-it/strings.xml +++ b/android/app/src/main/res/values-it/strings.xml @@ -6,7 +6,6 @@ Ricerca Video Scansione media - Scansione immagini & videos Scansione in corso Annulla Modalità provvisoria diff --git a/android/app/src/main/res/values-iw/strings.xml b/android/app/src/main/res/values-iw/strings.xml index fa2bc3053..8cee373a7 100644 --- a/android/app/src/main/res/values-iw/strings.xml +++ b/android/app/src/main/res/values-iw/strings.xml @@ -6,7 +6,6 @@ חיפוש סרטים סריקת מדיה - סרוק תמונות וסרטים סורק מדיה הפסק \ No newline at end of file diff --git a/android/app/src/main/res/values-ja/strings.xml b/android/app/src/main/res/values-ja/strings.xml index 7204d99c5..d5f7e4ed4 100644 --- a/android/app/src/main/res/values-ja/strings.xml +++ b/android/app/src/main/res/values-ja/strings.xml @@ -6,7 +6,6 @@ 検索 動画 メディアスキャン - 画像と動画をスキャン メディアをスキャン中 停止 セーフモード diff --git a/android/app/src/main/res/values-ko/strings.xml b/android/app/src/main/res/values-ko/strings.xml index 0c064c633..9f19c1398 100644 --- a/android/app/src/main/res/values-ko/strings.xml +++ b/android/app/src/main/res/values-ko/strings.xml @@ -6,7 +6,6 @@ 검색 동영상 미디어 분석 - 사진과 동영상 분석 미디어 분석 취소 안전 모드 diff --git a/android/app/src/main/res/values-lt/strings.xml b/android/app/src/main/res/values-lt/strings.xml index b1ce60a3c..d20202da5 100644 --- a/android/app/src/main/res/values-lt/strings.xml +++ b/android/app/src/main/res/values-lt/strings.xml @@ -1,6 +1,5 @@ - Nuskaityti paveikslėlius ir vaizdo įrašus Ekrano paveikslėlis Vaizdo įrašai Aves diff --git a/android/app/src/main/res/values-nb-rNO/strings.xml b/android/app/src/main/res/values-nb-rNO/strings.xml index d1759646b..f9ec90655 100644 --- a/android/app/src/main/res/values-nb-rNO/strings.xml +++ b/android/app/src/main/res/values-nb-rNO/strings.xml @@ -3,7 +3,6 @@ Aves Videoer Mediaskanning - Skann bilder og videoer Skanning av media Bilderamme Bakgrunnsbilde diff --git a/android/app/src/main/res/values-nl/strings.xml b/android/app/src/main/res/values-nl/strings.xml index b8015ce4f..aae728ba9 100644 --- a/android/app/src/main/res/values-nl/strings.xml +++ b/android/app/src/main/res/values-nl/strings.xml @@ -6,7 +6,6 @@ Zoeken Video’s Media indexeren - Indexeren van afdbeeldingen & video’s Indexeren van media Stop \ No newline at end of file diff --git a/android/app/src/main/res/values-nn/strings.xml b/android/app/src/main/res/values-nn/strings.xml index 8f62f5869..615c9eb6b 100644 --- a/android/app/src/main/res/values-nn/strings.xml +++ b/android/app/src/main/res/values-nn/strings.xml @@ -6,7 +6,6 @@ Søk Videoar Mediasøking - Søk igjennom bilete og videoar Søkjer igjennom media Stogg \ No newline at end of file diff --git a/android/app/src/main/res/values-pl/strings.xml b/android/app/src/main/res/values-pl/strings.xml index ed2f0b129..f88e6931e 100644 --- a/android/app/src/main/res/values-pl/strings.xml +++ b/android/app/src/main/res/values-pl/strings.xml @@ -4,7 +4,6 @@ Szukaj Wideo Przeskanuj multimedia - Przeskanuj obrazy oraz wideo Skanowanie multimediów Zatrzymaj Aves diff --git a/android/app/src/main/res/values-pt/strings.xml b/android/app/src/main/res/values-pt/strings.xml index 17abf2439..0e887b1bb 100644 --- a/android/app/src/main/res/values-pt/strings.xml +++ b/android/app/src/main/res/values-pt/strings.xml @@ -6,7 +6,6 @@ Procurar Vídeos Digitalização de mídia - Digitalizar imagens & vídeos Digitalizando mídia Pare \ No newline at end of file diff --git a/android/app/src/main/res/values-ro/strings.xml b/android/app/src/main/res/values-ro/strings.xml index bb3475bf8..e498222a8 100644 --- a/android/app/src/main/res/values-ro/strings.xml +++ b/android/app/src/main/res/values-ro/strings.xml @@ -5,7 +5,6 @@ Tapet Videoclipuri Scanare media - Scanați imagini și videoclipuri Scanarea suporturilor Stop Căutare diff --git a/android/app/src/main/res/values-ru/strings.xml b/android/app/src/main/res/values-ru/strings.xml index 84259422b..a0e991e96 100644 --- a/android/app/src/main/res/values-ru/strings.xml +++ b/android/app/src/main/res/values-ru/strings.xml @@ -6,7 +6,6 @@ Поиск Видео Сканировать медия - Сканировать изображения и видео Сканирование медиа Стоп Безопасный режим diff --git a/android/app/src/main/res/values-sk/strings.xml b/android/app/src/main/res/values-sk/strings.xml index 08fd7dbe9..9a8ac434a 100644 --- a/android/app/src/main/res/values-sk/strings.xml +++ b/android/app/src/main/res/values-sk/strings.xml @@ -7,6 +7,5 @@ Videá Zastaviť Skenovanie médií - Skenovanie obrázkov & videí Skenovanie média \ No newline at end of file diff --git a/android/app/src/main/res/values-th/strings.xml b/android/app/src/main/res/values-th/strings.xml index b582dd0f7..2ac92953e 100644 --- a/android/app/src/main/res/values-th/strings.xml +++ b/android/app/src/main/res/values-th/strings.xml @@ -6,7 +6,6 @@ ค้นหา วิดีโอ สแกนสื่อบันเทิง - สแกนรูปภาพและวิดีโอ กำลังสแกนสื่อบันเทิง หยุด \ No newline at end of file diff --git a/android/app/src/main/res/values-tr/strings.xml b/android/app/src/main/res/values-tr/strings.xml index a358643e8..e516cc30b 100644 --- a/android/app/src/main/res/values-tr/strings.xml +++ b/android/app/src/main/res/values-tr/strings.xml @@ -6,7 +6,6 @@ Arama Videolar Medya tarama - Görüntüleri ve videoları tarayın Medya taranıyor Durdur \ No newline at end of file diff --git a/android/app/src/main/res/values-uk/strings.xml b/android/app/src/main/res/values-uk/strings.xml index b6c0c0a68..71b3f03aa 100644 --- a/android/app/src/main/res/values-uk/strings.xml +++ b/android/app/src/main/res/values-uk/strings.xml @@ -5,7 +5,6 @@ Пошук Відео Сканувати медіа - Сканувати зображення та відео Стоп Фоторамка Сканування медіа diff --git a/android/app/src/main/res/values-zh-rTW/strings.xml b/android/app/src/main/res/values-zh-rTW/strings.xml index 8071ccad2..7de20ea26 100644 --- a/android/app/src/main/res/values-zh-rTW/strings.xml +++ b/android/app/src/main/res/values-zh-rTW/strings.xml @@ -7,6 +7,5 @@ 相框 搜尋 媒體掃描 - 掃描圖片和影片 停止 \ No newline at end of file diff --git a/android/app/src/main/res/values-zh/strings.xml b/android/app/src/main/res/values-zh/strings.xml index 7b454e26b..e6ed4d076 100644 --- a/android/app/src/main/res/values-zh/strings.xml +++ b/android/app/src/main/res/values-zh/strings.xml @@ -6,7 +6,6 @@ 搜索 视频 媒体扫描 - 扫描图像 & 视频 正在扫描媒体库 停止 \ No newline at end of file diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index f0f317c96..e77df79e1 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -7,7 +7,6 @@ Search Videos Media scan - Scan images & videos Scanning media Stop \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index d06c9b9c7..8a5a133bb 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,6 +1,6 @@ buildscript { ext { - kotlin_version = '1.8.0' + kotlin_version = '1.8.21' agp_version = '7.4.2' glide_version = '4.15.1' huawei_agconnect_version = '1.8.0.300' diff --git a/lib/services/analysis_service.dart b/lib/services/analysis_service.dart index dde0d5675..50fea1499 100644 --- a/lib/services/analysis_service.dart +++ b/lib/services/analysis_service.dart @@ -31,7 +31,7 @@ class AnalysisService { static Future startService({required bool force, List? entryIds}) async { await reportService.log('Start analysis service${entryIds != null ? ' for ${entryIds.length} items' : ''}'); try { - await _platform.invokeMethod('startService', { + await _platform.invokeMethod('startAnalysis', { 'entryIds': entryIds, 'force': force, }); @@ -155,7 +155,6 @@ class Analyzer { void _onSourceStateChanged() { if (_source.isReady) { - _refreshApp(); _serviceStateNotifier.value = AnalyzerState.stopping; } } @@ -179,14 +178,6 @@ class Analyzer { } } - Future _refreshApp() async { - try { - await _channel.invokeMethod('refreshApp'); - } on PlatformException catch (e, stack) { - await reportService.recordError(e, stack); - } - } - Future _stopPlatformService() async { try { await _channel.invokeMethod('stop'); diff --git a/plugins/aves_screen_state/android/build.gradle b/plugins/aves_screen_state/android/build.gradle index 31eaba649..4aae7446c 100644 --- a/plugins/aves_screen_state/android/build.gradle +++ b/plugins/aves_screen_state/android/build.gradle @@ -2,7 +2,7 @@ group 'deckers.thibault.aves.aves_screen_state' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.8.0' + ext.kotlin_version = '1.8.21' repositories { google() mavenCentral()