minor fixes

This commit is contained in:
Thibault Deckers 2022-07-10 22:16:12 +02:00
parent d067c457be
commit 1d9d699998
21 changed files with 78 additions and 80 deletions

View file

@ -96,7 +96,7 @@ class SearchSuggestionsProvider : MethodChannel.MethodCallHandler, ContentProvid
} }
override fun notImplemented() { override fun notImplemented() {
cont.resumeWithException(NotImplementedError("getSuggestions")) cont.resumeWithException(Exception("not implemented"))
} }
}) })
} }

View file

@ -49,7 +49,7 @@ class AccessibilityHandler(private val contextWrapper: ContextWrapper) : MethodC
val originalTimeoutMillis = call.argument<Int>("originalTimeoutMillis") val originalTimeoutMillis = call.argument<Int>("originalTimeoutMillis")
val content = call.argument<List<String>>("content") val content = call.argument<List<String>>("content")
if (originalTimeoutMillis == null || content == null) { if (originalTimeoutMillis == null || content == null) {
result.error("getRecommendedTimeoutMillis-args", "failed because of missing arguments", null) result.error("getRecommendedTimeoutMillis-args", "missing arguments", null)
return return
} }

View file

@ -33,7 +33,7 @@ class AnalysisHandler(private val activity: Activity, private val onAnalysisComp
private fun registerCallback(call: MethodCall, result: MethodChannel.Result) { private fun registerCallback(call: MethodCall, result: MethodChannel.Result) {
val callbackHandle = call.argument<Number>("callbackHandle")?.toLong() val callbackHandle = call.argument<Number>("callbackHandle")?.toLong()
if (callbackHandle == null) { if (callbackHandle == null) {
result.error("registerCallback-args", "failed because of missing arguments", null) result.error("registerCallback-args", "missing arguments", null)
return return
} }
@ -47,7 +47,7 @@ class AnalysisHandler(private val activity: Activity, private val onAnalysisComp
private fun startAnalysis(call: MethodCall, result: MethodChannel.Result) { private fun startAnalysis(call: MethodCall, result: MethodChannel.Result) {
val force = call.argument<Boolean>("force") val force = call.argument<Boolean>("force")
if (force == null) { if (force == null) {
result.error("startAnalysis-args", "failed because of missing arguments", null) result.error("startAnalysis-args", "missing arguments", null)
return return
} }

View file

@ -142,7 +142,7 @@ class AppAdapterHandler(private val context: Context) : MethodCallHandler {
val packageName = call.argument<String>("packageName") val packageName = call.argument<String>("packageName")
val sizeDip = call.argument<Number>("sizeDip")?.toDouble() val sizeDip = call.argument<Number>("sizeDip")?.toDouble()
if (packageName == null || sizeDip == null) { if (packageName == null || sizeDip == null) {
result.error("getAppIcon-args", "failed because of missing arguments", null) result.error("getAppIcon-args", "missing arguments", null)
return return
} }
@ -208,7 +208,7 @@ class AppAdapterHandler(private val context: Context) : MethodCallHandler {
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
val label = call.argument<String>("label") val label = call.argument<String>("label")
if (uri == null) { if (uri == null) {
result.error("copyToClipboard-args", "failed because of missing arguments", null) result.error("copyToClipboard-args", "missing arguments", null)
return return
} }
@ -235,7 +235,7 @@ class AppAdapterHandler(private val context: Context) : MethodCallHandler {
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
val mimeType = call.argument<String>("mimeType") val mimeType = call.argument<String>("mimeType")
if (uri == null) { if (uri == null) {
result.error("edit-args", "failed because of missing arguments", null) result.error("edit-args", "missing arguments", null)
return return
} }
@ -252,7 +252,7 @@ class AppAdapterHandler(private val context: Context) : MethodCallHandler {
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
val mimeType = call.argument<String>("mimeType") val mimeType = call.argument<String>("mimeType")
if (uri == null) { if (uri == null) {
result.error("open-args", "failed because of missing arguments", null) result.error("open-args", "missing arguments", null)
return return
} }
@ -267,7 +267,7 @@ class AppAdapterHandler(private val context: Context) : MethodCallHandler {
private fun openMap(call: MethodCall, result: MethodChannel.Result) { private fun openMap(call: MethodCall, result: MethodChannel.Result) {
val geoUri = call.argument<String>("geoUri")?.let { Uri.parse(it) } val geoUri = call.argument<String>("geoUri")?.let { Uri.parse(it) }
if (geoUri == null) { if (geoUri == null) {
result.error("openMap-args", "failed because of missing arguments", null) result.error("openMap-args", "missing arguments", null)
return return
} }
@ -282,7 +282,7 @@ class AppAdapterHandler(private val context: Context) : MethodCallHandler {
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
val mimeType = call.argument<String>("mimeType") val mimeType = call.argument<String>("mimeType")
if (uri == null) { if (uri == null) {
result.error("setAs-args", "failed because of missing arguments", null) result.error("setAs-args", "missing arguments", null)
return return
} }
@ -298,7 +298,7 @@ class AppAdapterHandler(private val context: Context) : MethodCallHandler {
val title = call.argument<String>("title") val title = call.argument<String>("title")
val urisByMimeType = call.argument<Map<String, List<String>>>("urisByMimeType") val urisByMimeType = call.argument<Map<String, List<String>>>("urisByMimeType")
if (urisByMimeType == null) { if (urisByMimeType == null) {
result.error("setAs-args", "failed because of missing arguments", null) result.error("setAs-args", "missing arguments", null)
return return
} }
@ -378,7 +378,7 @@ class AppAdapterHandler(private val context: Context) : MethodCallHandler {
val filters = call.argument<List<String>>("filters") val filters = call.argument<List<String>>("filters")
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
if (label == null || (filters == null && uri == null)) { if (label == null || (filters == null && uri == null)) {
result.error("pin-args", "failed because of missing arguments", null) result.error("pin-args", "missing arguments", null)
return return
} }

View file

@ -138,7 +138,7 @@ class DebugHandler(private val context: Context) : MethodCallHandler {
private fun getBitmapFactoryInfo(call: MethodCall, result: MethodChannel.Result) { private fun getBitmapFactoryInfo(call: MethodCall, result: MethodChannel.Result) {
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
if (uri == null) { if (uri == null) {
result.error("getBitmapDecoderInfo-args", "failed because of missing arguments", null) result.error("getBitmapDecoderInfo-args", "missing arguments", null)
return return
} }
@ -167,7 +167,7 @@ class DebugHandler(private val context: Context) : MethodCallHandler {
val mimeType = call.argument<String>("mimeType") val mimeType = call.argument<String>("mimeType")
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
if (mimeType == null || uri == null) { if (mimeType == null || uri == null) {
result.error("getContentResolverMetadata-args", "failed because of missing arguments", null) result.error("getContentResolverMetadata-args", "missing arguments", null)
return return
} }
@ -224,7 +224,7 @@ class DebugHandler(private val context: Context) : MethodCallHandler {
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
val sizeBytes = call.argument<Number>("sizeBytes")?.toLong() val sizeBytes = call.argument<Number>("sizeBytes")?.toLong()
if (mimeType == null || uri == null) { if (mimeType == null || uri == null) {
result.error("getExifInterfaceMetadata-args", "failed because of missing arguments", null) result.error("getExifInterfaceMetadata-args", "missing arguments", null)
return return
} }
@ -250,7 +250,7 @@ class DebugHandler(private val context: Context) : MethodCallHandler {
private fun getMediaMetadataRetrieverMetadata(call: MethodCall, result: MethodChannel.Result) { private fun getMediaMetadataRetrieverMetadata(call: MethodCall, result: MethodChannel.Result) {
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
if (uri == null) { if (uri == null) {
result.error("getMediaMetadataRetrieverMetadata-args", "failed because of missing arguments", null) result.error("getMediaMetadataRetrieverMetadata-args", "missing arguments", null)
return return
} }
@ -276,7 +276,7 @@ class DebugHandler(private val context: Context) : MethodCallHandler {
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
val sizeBytes = call.argument<Number>("sizeBytes")?.toLong() val sizeBytes = call.argument<Number>("sizeBytes")?.toLong()
if (mimeType == null || uri == null) { if (mimeType == null || uri == null) {
result.error("getMetadataExtractorSummary-args", "failed because of missing arguments", null) result.error("getMetadataExtractorSummary-args", "missing arguments", null)
return return
} }
@ -319,7 +319,7 @@ class DebugHandler(private val context: Context) : MethodCallHandler {
val mimeType = call.argument<String>("mimeType") val mimeType = call.argument<String>("mimeType")
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
if (mimeType == null || uri == null) { if (mimeType == null || uri == null) {
result.error("getPixyMetadata-args", "failed because of missing arguments", null) result.error("getPixyMetadata-args", "missing arguments", null)
return return
} }
@ -340,7 +340,7 @@ class DebugHandler(private val context: Context) : MethodCallHandler {
private fun getTiffStructure(call: MethodCall, result: MethodChannel.Result) { private fun getTiffStructure(call: MethodCall, result: MethodChannel.Result) {
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
if (uri == null) { if (uri == null) {
result.error("getTiffStructure-args", "failed because of missing arguments", null) result.error("getTiffStructure-args", "missing arguments", null)
return return
} }

View file

@ -57,7 +57,7 @@ class EmbeddedDataHandler(private val context: Context) : MethodCallHandler {
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
val sizeBytes = call.argument<Number>("sizeBytes")?.toLong() val sizeBytes = call.argument<Number>("sizeBytes")?.toLong()
if (mimeType == null || uri == null) { if (mimeType == null || uri == null) {
result.error("getExifThumbnails-args", "failed because of missing arguments", null) result.error("getExifThumbnails-args", "missing arguments", null)
return return
} }
@ -88,7 +88,7 @@ class EmbeddedDataHandler(private val context: Context) : MethodCallHandler {
val sizeBytes = call.argument<Number>("sizeBytes")?.toLong() val sizeBytes = call.argument<Number>("sizeBytes")?.toLong()
val displayName = call.argument<String>("displayName") val displayName = call.argument<String>("displayName")
if (mimeType == null || uri == null || sizeBytes == null) { if (mimeType == null || uri == null || sizeBytes == null) {
result.error("extractMotionPhotoVideo-args", "failed because of missing arguments", null) result.error("extractMotionPhotoVideo-args", "missing arguments", null)
return return
} }
@ -108,7 +108,7 @@ class EmbeddedDataHandler(private val context: Context) : MethodCallHandler {
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
val displayName = call.argument<String>("displayName") val displayName = call.argument<String>("displayName")
if (uri == null) { if (uri == null) {
result.error("extractVideoEmbeddedPicture-args", "failed because of missing arguments", null) result.error("extractVideoEmbeddedPicture-args", "missing arguments", null)
return return
} }
@ -143,7 +143,7 @@ class EmbeddedDataHandler(private val context: Context) : MethodCallHandler {
val dataPropPath = call.argument<String>("propPath") val dataPropPath = call.argument<String>("propPath")
val embedMimeType = call.argument<String>("propMimeType") val embedMimeType = call.argument<String>("propMimeType")
if (mimeType == null || uri == null || dataPropPath == null || embedMimeType == null) { if (mimeType == null || uri == null || dataPropPath == null || embedMimeType == null) {
result.error("extractXmpDataProp-args", "failed because of missing arguments", null) result.error("extractXmpDataProp-args", "missing arguments", null)
return return
} }

View file

@ -35,7 +35,7 @@ class GeocodingHandler(private val context: Context) : MethodCallHandler {
val localeString = call.argument<String>("locale") val localeString = call.argument<String>("locale")
val maxResults = call.argument<Int>("maxResults") ?: 1 val maxResults = call.argument<Int>("maxResults") ?: 1
if (latitude == null || longitude == null) { if (latitude == null || longitude == null) {
result.error("getAddress-args", "failed because of missing arguments", null) result.error("getAddress-args", "missing arguments", null)
return return
} }

View file

@ -23,7 +23,7 @@ class GlobalSearchHandler(private val context: Context) : MethodCallHandler {
private fun registerCallback(call: MethodCall, result: MethodChannel.Result) { private fun registerCallback(call: MethodCall, result: MethodChannel.Result) {
val callbackHandle = call.argument<Number>("callbackHandle")?.toLong() val callbackHandle = call.argument<Number>("callbackHandle")?.toLong()
if (callbackHandle == null) { if (callbackHandle == null) {
result.error("registerCallback-args", "failed because of missing arguments", null) result.error("registerCallback-args", "missing arguments", null)
return return
} }

View file

@ -49,7 +49,7 @@ class MediaFileHandler(private val contextWrapper: ContextWrapper) : MethodCallH
val mimeType = call.argument<String>("mimeType") // MIME type is optional val mimeType = call.argument<String>("mimeType") // MIME type is optional
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
if (uri == null) { if (uri == null) {
result.error("getEntry-args", "failed because of missing arguments", null) result.error("getEntry-args", "missing arguments", null)
return return
} }
@ -77,7 +77,7 @@ class MediaFileHandler(private val contextWrapper: ContextWrapper) : MethodCallH
val defaultSizeDip = call.argument<Number>("defaultSizeDip")?.toDouble() val defaultSizeDip = call.argument<Number>("defaultSizeDip")?.toDouble()
if (uri == null || mimeType == null || dateModifiedSecs == null || rotationDegrees == null || isFlipped == null || widthDip == null || heightDip == null || defaultSizeDip == null) { if (uri == null || mimeType == null || dateModifiedSecs == null || rotationDegrees == null || isFlipped == null || widthDip == null || heightDip == null || defaultSizeDip == null) {
result.error("getThumbnail-args", "failed because of missing arguments", null) result.error("getThumbnail-args", "missing arguments", null)
return return
} }
@ -110,7 +110,7 @@ class MediaFileHandler(private val contextWrapper: ContextWrapper) : MethodCallH
val imageHeight = call.argument<Int>("imageHeight") val imageHeight = call.argument<Int>("imageHeight")
if (uri == null || mimeType == null || sampleSize == null || x == null || y == null || width == null || height == null || imageWidth == null || imageHeight == null) { if (uri == null || mimeType == null || sampleSize == null || x == null || y == null || width == null || height == null || imageWidth == null || imageHeight == null) {
result.error("getRegion-args", "failed because of missing arguments", null) result.error("getRegion-args", "missing arguments", null)
return return
} }
@ -146,7 +146,7 @@ class MediaFileHandler(private val contextWrapper: ContextWrapper) : MethodCallH
private fun cancelFileOp(call: MethodCall, result: MethodChannel.Result) { private fun cancelFileOp(call: MethodCall, result: MethodChannel.Result) {
val opId = call.argument<String>("opId") val opId = call.argument<String>("opId")
if (opId == null) { if (opId == null) {
result.error("cancelFileOp-args", "failed because of missing arguments", null) result.error("cancelFileOp-args", "missing arguments", null)
return return
} }
@ -164,7 +164,7 @@ class MediaFileHandler(private val contextWrapper: ContextWrapper) : MethodCallH
var destinationDir = call.argument<String>("destinationPath") var destinationDir = call.argument<String>("destinationPath")
val nameConflictStrategy = NameConflictStrategy.get(call.argument<String>("nameConflictStrategy")) val nameConflictStrategy = NameConflictStrategy.get(call.argument<String>("nameConflictStrategy"))
if (uri == null || desiredName == null || bytes == null || destinationDir == null || nameConflictStrategy == null) { if (uri == null || desiredName == null || bytes == null || destinationDir == null || nameConflictStrategy == null) {
result.error("captureFrame-args", "failed because of missing arguments", null) result.error("captureFrame-args", "missing arguments", null)
return return
} }

View file

@ -28,7 +28,7 @@ class MediaStoreHandler(private val context: Context) : MethodCallHandler {
private fun checkObsoleteContentIds(call: MethodCall, result: MethodChannel.Result) { private fun checkObsoleteContentIds(call: MethodCall, result: MethodChannel.Result) {
val knownContentIds = call.argument<List<Int?>>("knownContentIds") val knownContentIds = call.argument<List<Int?>>("knownContentIds")
if (knownContentIds == null) { if (knownContentIds == null) {
result.error("checkObsoleteContentIds-args", "failed because of missing arguments", null) result.error("checkObsoleteContentIds-args", "missing arguments", null)
return return
} }
result.success(MediaStoreImageProvider().checkObsoleteContentIds(context, knownContentIds)) result.success(MediaStoreImageProvider().checkObsoleteContentIds(context, knownContentIds))
@ -37,7 +37,7 @@ class MediaStoreHandler(private val context: Context) : MethodCallHandler {
private fun checkObsoletePaths(call: MethodCall, result: MethodChannel.Result) { private fun checkObsoletePaths(call: MethodCall, result: MethodChannel.Result) {
val knownPathById = call.argument<Map<Int?, String?>>("knownPathById") val knownPathById = call.argument<Map<Int?, String?>>("knownPathById")
if (knownPathById == null) { if (knownPathById == null) {
result.error("checkObsoletePaths-args", "failed because of missing arguments", null) result.error("checkObsoletePaths-args", "missing arguments", null)
return return
} }
result.success(MediaStoreImageProvider().checkObsoletePaths(context, knownPathById)) result.success(MediaStoreImageProvider().checkObsoletePaths(context, knownPathById))

View file

@ -33,7 +33,7 @@ class MetadataEditHandler(private val contextWrapper: ContextWrapper) : MethodCa
private fun rotate(call: MethodCall, result: MethodChannel.Result) { private fun rotate(call: MethodCall, result: MethodChannel.Result) {
val clockwise = call.argument<Boolean>("clockwise") val clockwise = call.argument<Boolean>("clockwise")
if (clockwise == null) { if (clockwise == null) {
result.error("rotate-args", "failed because of missing arguments", null) result.error("rotate-args", "missing arguments", null)
return return
} }
@ -48,7 +48,7 @@ class MetadataEditHandler(private val contextWrapper: ContextWrapper) : MethodCa
private fun editOrientation(call: MethodCall, result: MethodChannel.Result, op: ExifOrientationOp) { private fun editOrientation(call: MethodCall, result: MethodChannel.Result, op: ExifOrientationOp) {
val entryMap = call.argument<FieldMap>("entry") val entryMap = call.argument<FieldMap>("entry")
if (entryMap == null) { if (entryMap == null) {
result.error("editOrientation-args", "failed because of missing arguments", null) result.error("editOrientation-args", "missing arguments", null)
return return
} }
@ -78,7 +78,7 @@ class MetadataEditHandler(private val contextWrapper: ContextWrapper) : MethodCa
val fields = call.argument<List<String>>("fields") val fields = call.argument<List<String>>("fields")
val entryMap = call.argument<FieldMap>("entry") val entryMap = call.argument<FieldMap>("entry")
if (entryMap == null || fields == null) { if (entryMap == null || fields == null) {
result.error("editDate-args", "failed because of missing arguments", null) result.error("editDate-args", "missing arguments", null)
return return
} }
@ -107,7 +107,7 @@ class MetadataEditHandler(private val contextWrapper: ContextWrapper) : MethodCa
val entryMap = call.argument<FieldMap>("entry") val entryMap = call.argument<FieldMap>("entry")
val autoCorrectTrailerOffset = call.argument<Boolean>("autoCorrectTrailerOffset") val autoCorrectTrailerOffset = call.argument<Boolean>("autoCorrectTrailerOffset")
if (entryMap == null || metadata == null || autoCorrectTrailerOffset == null) { if (entryMap == null || metadata == null || autoCorrectTrailerOffset == null) {
result.error("editMetadata-args", "failed because of missing arguments", null) result.error("editMetadata-args", "missing arguments", null)
return return
} }
@ -134,7 +134,7 @@ class MetadataEditHandler(private val contextWrapper: ContextWrapper) : MethodCa
private fun removeTrailerVideo(call: MethodCall, result: MethodChannel.Result) { private fun removeTrailerVideo(call: MethodCall, result: MethodChannel.Result) {
val entryMap = call.argument<FieldMap>("entry") val entryMap = call.argument<FieldMap>("entry")
if (entryMap == null) { if (entryMap == null) {
result.error("removeTrailerVideo-args", "failed because of missing arguments", null) result.error("removeTrailerVideo-args", "missing arguments", null)
return return
} }
@ -162,7 +162,7 @@ class MetadataEditHandler(private val contextWrapper: ContextWrapper) : MethodCa
val types = call.argument<List<String>>("types") val types = call.argument<List<String>>("types")
val entryMap = call.argument<FieldMap>("entry") val entryMap = call.argument<FieldMap>("entry")
if (entryMap == null || types == null) { if (entryMap == null || types == null) {
result.error("removeTypes-args", "failed because of missing arguments", null) result.error("removeTypes-args", "missing arguments", null)
return return
} }

View file

@ -115,7 +115,7 @@ class MetadataFetchHandler(private val context: Context) : MethodCallHandler {
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
val sizeBytes = call.argument<Number>("sizeBytes")?.toLong() val sizeBytes = call.argument<Number>("sizeBytes")?.toLong()
if (mimeType == null || uri == null) { if (mimeType == null || uri == null) {
result.error("getAllMetadata-args", "failed because of missing arguments", null) result.error("getAllMetadata-args", "missing arguments", null)
return return
} }
@ -424,7 +424,7 @@ class MetadataFetchHandler(private val context: Context) : MethodCallHandler {
val path = call.argument<String>("path") val path = call.argument<String>("path")
val sizeBytes = call.argument<Number>("sizeBytes")?.toLong() val sizeBytes = call.argument<Number>("sizeBytes")?.toLong()
if (mimeType == null || uri == null) { if (mimeType == null || uri == null) {
result.error("getCatalogMetadata-args", "failed because of missing arguments", null) result.error("getCatalogMetadata-args", "missing arguments", null)
return return
} }
@ -691,7 +691,7 @@ class MetadataFetchHandler(private val context: Context) : MethodCallHandler {
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
val sizeBytes = call.argument<Number>("sizeBytes")?.toLong() val sizeBytes = call.argument<Number>("sizeBytes")?.toLong()
if (mimeType == null || uri == null) { if (mimeType == null || uri == null) {
result.error("getOverlayMetadata-args", "failed because of missing arguments", null) result.error("getOverlayMetadata-args", "missing arguments", null)
return return
} }
@ -761,7 +761,7 @@ class MetadataFetchHandler(private val context: Context) : MethodCallHandler {
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
val sizeBytes = call.argument<Number>("sizeBytes")?.toLong() val sizeBytes = call.argument<Number>("sizeBytes")?.toLong()
if (mimeType == null || uri == null) { if (mimeType == null || uri == null) {
result.error("getGeoTiffInfo-args", "failed because of missing arguments", null) result.error("getGeoTiffInfo-args", "missing arguments", null)
return return
} }
@ -802,7 +802,7 @@ class MetadataFetchHandler(private val context: Context) : MethodCallHandler {
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
val sizeBytes = call.argument<Number>("sizeBytes")?.toLong() val sizeBytes = call.argument<Number>("sizeBytes")?.toLong()
if (mimeType == null || uri == null || sizeBytes == null) { if (mimeType == null || uri == null || sizeBytes == null) {
result.error("getMultiPageInfo-args", "failed because of missing arguments", null) result.error("getMultiPageInfo-args", "missing arguments", null)
return return
} }
@ -824,7 +824,7 @@ class MetadataFetchHandler(private val context: Context) : MethodCallHandler {
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
val sizeBytes = call.argument<Number>("sizeBytes")?.toLong() val sizeBytes = call.argument<Number>("sizeBytes")?.toLong()
if (mimeType == null || uri == null) { if (mimeType == null || uri == null) {
result.error("getPanoramaInfo-args", "failed because of missing arguments", null) result.error("getPanoramaInfo-args", "missing arguments", null)
return return
} }
@ -863,7 +863,7 @@ class MetadataFetchHandler(private val context: Context) : MethodCallHandler {
val mimeType = call.argument<String>("mimeType") val mimeType = call.argument<String>("mimeType")
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
if (mimeType == null || uri == null) { if (mimeType == null || uri == null) {
result.error("getIptc-args", "failed because of missing arguments", null) result.error("getIptc-args", "missing arguments", null)
return return
} }
@ -888,7 +888,7 @@ class MetadataFetchHandler(private val context: Context) : MethodCallHandler {
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
val sizeBytes = call.argument<Number>("sizeBytes")?.toLong() val sizeBytes = call.argument<Number>("sizeBytes")?.toLong()
if (mimeType == null || uri == null) { if (mimeType == null || uri == null) {
result.error("getXmp-args", "failed because of missing arguments", null) result.error("getXmp-args", "missing arguments", null)
return return
} }
@ -918,7 +918,7 @@ class MetadataFetchHandler(private val context: Context) : MethodCallHandler {
private fun hasContentResolverProp(call: MethodCall, result: MethodChannel.Result) { private fun hasContentResolverProp(call: MethodCall, result: MethodChannel.Result) {
val prop = call.argument<String>("prop") val prop = call.argument<String>("prop")
if (prop == null) { if (prop == null) {
result.error("hasContentResolverProp-args", "failed because of missing arguments", null) result.error("hasContentResolverProp-args", "missing arguments", null)
return return
} }
@ -938,7 +938,7 @@ class MetadataFetchHandler(private val context: Context) : MethodCallHandler {
val uri = call.argument<String>("uri")?.let { Uri.parse(it) } val uri = call.argument<String>("uri")?.let { Uri.parse(it) }
val prop = call.argument<String>("prop") val prop = call.argument<String>("prop")
if (mimeType == null || uri == null || prop == null) { if (mimeType == null || uri == null || prop == null) {
result.error("getContentResolverProp-args", "failed because of missing arguments", null) result.error("getContentResolverProp-args", "missing arguments", null)
return return
} }
@ -992,7 +992,7 @@ class MetadataFetchHandler(private val context: Context) : MethodCallHandler {
val sizeBytes = call.argument<Number>("sizeBytes")?.toLong() val sizeBytes = call.argument<Number>("sizeBytes")?.toLong()
val field = call.argument<String>("field") val field = call.argument<String>("field")
if (mimeType == null || uri == null || field == null) { if (mimeType == null || uri == null || field == null) {
result.error("getDate-args", "failed because of missing arguments", null) result.error("getDate-args", "missing arguments", null)
return return
} }

View file

@ -91,7 +91,7 @@ class StorageHandler(private val context: Context) : MethodCallHandler {
private fun getFreeSpace(call: MethodCall, result: MethodChannel.Result) { private fun getFreeSpace(call: MethodCall, result: MethodChannel.Result) {
val path = call.argument<String>("path") val path = call.argument<String>("path")
if (path == null) { if (path == null) {
result.error("getFreeSpace-args", "failed because of missing arguments", null) result.error("getFreeSpace-args", "missing arguments", null)
return return
} }
@ -112,7 +112,7 @@ class StorageHandler(private val context: Context) : MethodCallHandler {
private fun getInaccessibleDirectories(call: MethodCall, result: MethodChannel.Result) { private fun getInaccessibleDirectories(call: MethodCall, result: MethodChannel.Result) {
val dirPaths = call.argument<List<String>>("dirPaths") val dirPaths = call.argument<List<String>>("dirPaths")
if (dirPaths == null) { if (dirPaths == null) {
result.error("getInaccessibleDirectories-args", "failed because of missing arguments", null) result.error("getInaccessibleDirectories-args", "missing arguments", null)
return return
} }
@ -126,7 +126,7 @@ class StorageHandler(private val context: Context) : MethodCallHandler {
private fun revokeDirectoryAccess(call: MethodCall, result: MethodChannel.Result) { private fun revokeDirectoryAccess(call: MethodCall, result: MethodChannel.Result) {
val path = call.argument<String>("path") val path = call.argument<String>("path")
if (path == null) { if (path == null) {
result.error("revokeDirectoryAccess-args", "failed because of missing arguments", null) result.error("revokeDirectoryAccess-args", "missing arguments", null)
return return
} }
@ -142,7 +142,7 @@ class StorageHandler(private val context: Context) : MethodCallHandler {
private fun deleteEmptyDirectories(call: MethodCall, result: MethodChannel.Result) { private fun deleteEmptyDirectories(call: MethodCall, result: MethodChannel.Result) {
val dirPaths = call.argument<List<String>>("dirPaths") val dirPaths = call.argument<List<String>>("dirPaths")
if (dirPaths == null) { if (dirPaths == null) {
result.error("deleteEmptyDirectories-args", "failed because of missing arguments", null) result.error("deleteEmptyDirectories-args", "missing arguments", null)
return return
} }
@ -167,7 +167,7 @@ class StorageHandler(private val context: Context) : MethodCallHandler {
private fun canInsertMedia(call: MethodCall, result: MethodChannel.Result) { private fun canInsertMedia(call: MethodCall, result: MethodChannel.Result) {
val directories = call.argument<List<FieldMap>>("directories") val directories = call.argument<List<FieldMap>>("directories")
if (directories == null) { if (directories == null) {
result.error("canInsertMedia-args", "failed because of missing arguments", null) result.error("canInsertMedia-args", "missing arguments", null)
return return
} }

View file

@ -29,7 +29,7 @@ class WallpaperHandler(private val contextWrapper: ContextWrapper) : MethodCallH
val home = call.argument<Boolean>("home") val home = call.argument<Boolean>("home")
val lock = call.argument<Boolean>("lock") val lock = call.argument<Boolean>("lock")
if (bytes == null || home == null || lock == null) { if (bytes == null || home == null || lock == null) {
result.error("setWallpaper-args", "failed because of missing arguments", null) result.error("setWallpaper-args", "missing arguments", null)
return return
} }

View file

@ -15,7 +15,7 @@ class ActivityWindowHandler(private val activity: Activity) : WindowHandler(acti
override fun keepScreenOn(call: MethodCall, result: MethodChannel.Result) { override fun keepScreenOn(call: MethodCall, result: MethodChannel.Result) {
val on = call.argument<Boolean>("on") val on = call.argument<Boolean>("on")
if (on == null) { if (on == null) {
result.error("keepOn-args", "failed because of missing arguments", null) result.error("keepOn-args", "missing arguments", null)
return return
} }
@ -32,7 +32,7 @@ class ActivityWindowHandler(private val activity: Activity) : WindowHandler(acti
override fun requestOrientation(call: MethodCall, result: MethodChannel.Result) { override fun requestOrientation(call: MethodCall, result: MethodChannel.Result) {
val orientation = call.argument<Int>("orientation") val orientation = call.argument<Int>("orientation")
if (orientation == null) { if (orientation == null) {
result.error("requestOrientation-args", "failed because of missing arguments", null) result.error("requestOrientation-args", "missing arguments", null)
return return
} }
activity.requestedOrientation = orientation activity.requestedOrientation = orientation
@ -46,7 +46,7 @@ class ActivityWindowHandler(private val activity: Activity) : WindowHandler(acti
override fun setCutoutMode(call: MethodCall, result: MethodChannel.Result) { override fun setCutoutMode(call: MethodCall, result: MethodChannel.Result) {
val use = call.argument<Boolean>("use") val use = call.argument<Boolean>("use")
if (use == null) { if (use == null) {
result.error("setCutoutMode-args", "failed because of missing arguments", null) result.error("setCutoutMode-args", "missing arguments", null)
return return
} }

View file

@ -56,7 +56,7 @@ class ActivityResultStreamHandler(private val activity: Activity, arguments: Any
private suspend fun requestDirectoryAccess() { private suspend fun requestDirectoryAccess() {
val path = args["path"] as String? val path = args["path"] as String?
if (path == null) { if (path == null) {
error("requestDirectoryAccess-args", "failed because of missing arguments", null) error("requestDirectoryAccess-args", "missing arguments", null)
return return
} }
@ -78,7 +78,7 @@ class ActivityResultStreamHandler(private val activity: Activity, arguments: Any
val uris = (args["uris"] as List<*>?)?.mapNotNull { if (it is String) Uri.parse(it) else null } val uris = (args["uris"] as List<*>?)?.mapNotNull { if (it is String) Uri.parse(it) else null }
val mimeTypes = (args["mimeTypes"] as List<*>?)?.mapNotNull { if (it is String) it else null } val mimeTypes = (args["mimeTypes"] as List<*>?)?.mapNotNull { if (it is String) it else null }
if (uris == null || uris.isEmpty() || mimeTypes == null || mimeTypes.size != uris.size) { if (uris == null || uris.isEmpty() || mimeTypes == null || mimeTypes.size != uris.size) {
error("requestMediaFileAccess-args", "failed because of missing arguments", null) error("requestMediaFileAccess-args", "missing arguments", null)
return return
} }
@ -112,7 +112,7 @@ class ActivityResultStreamHandler(private val activity: Activity, arguments: Any
val mimeType = args["mimeType"] as String? val mimeType = args["mimeType"] as String?
val bytes = args["bytes"] as ByteArray? val bytes = args["bytes"] as ByteArray?
if (name == null || mimeType == null || bytes == null) { if (name == null || mimeType == null || bytes == null) {
error("createFile-args", "failed because of missing arguments", null) error("createFile-args", "missing arguments", null)
return return
} }

View file

@ -87,7 +87,7 @@ class ImageByteStreamHandler(private val context: Context, private val arguments
val pageId = arguments["pageId"] as Int? val pageId = arguments["pageId"] as Int?
if (mimeType == null || uri == null) { if (mimeType == null || uri == null) {
error("streamImage-args", "failed because of missing arguments", null) error("streamImage-args", "missing arguments", null)
endOfStream() endOfStream()
return return
} }

View file

@ -143,7 +143,7 @@ class ImageOpStreamHandler(private val activity: Activity, private val arguments
val height = arguments["height"] as Int? val height = arguments["height"] as Int?
val nameConflictStrategy = NameConflictStrategy.get(arguments["nameConflictStrategy"] as String?) val nameConflictStrategy = NameConflictStrategy.get(arguments["nameConflictStrategy"] as String?)
if (destinationDir == null || mimeType == null || width == null || height == null || nameConflictStrategy == null) { if (destinationDir == null || mimeType == null || width == null || height == null || nameConflictStrategy == null) {
error("export-args", "failed because of missing arguments", null) error("export-args", "missing arguments", null)
return return
} }
@ -174,7 +174,7 @@ class ImageOpStreamHandler(private val activity: Activity, private val arguments
val nameConflictStrategy = NameConflictStrategy.get(arguments["nameConflictStrategy"] as String?) val nameConflictStrategy = NameConflictStrategy.get(arguments["nameConflictStrategy"] as String?)
val rawEntryMap = arguments["entriesByDestination"] as Map<*, *>? val rawEntryMap = arguments["entriesByDestination"] as Map<*, *>?
if (copy == null || nameConflictStrategy == null || rawEntryMap == null || rawEntryMap.isEmpty()) { if (copy == null || nameConflictStrategy == null || rawEntryMap == null || rawEntryMap.isEmpty()) {
error("move-args", "failed because of missing arguments", null) error("move-args", "missing arguments", null)
return return
} }
@ -207,7 +207,7 @@ class ImageOpStreamHandler(private val activity: Activity, private val arguments
val rawEntryMap = arguments["entriesToNewName"] as Map<*, *>? val rawEntryMap = arguments["entriesToNewName"] as Map<*, *>?
if (rawEntryMap == null || rawEntryMap.isEmpty()) { if (rawEntryMap == null || rawEntryMap.isEmpty()) {
error("rename-args", "failed because of missing arguments", null) error("rename-args", "missing arguments", null)
return return
} }

View file

@ -249,9 +249,9 @@ class AvesEntry {
bool get is360 => _catalogMetadata?.is360 ?? false; bool get is360 => _catalogMetadata?.is360 ?? false;
bool get isMediaStoreContentUri => uri.startsWith('content://media/'); bool get isMediaStoreContent => uri.startsWith('content://media/');
bool get canEdit => path != null && !trashed && isMediaStoreContentUri; bool get canEdit => path != null && !trashed && isMediaStoreContent;
bool get canEditDate => canEdit && (canEditExif || canEditXmp); bool get canEditDate => canEdit && (canEditExif || canEditXmp);

View file

@ -47,14 +47,14 @@ class _InteractiveFilterTileState<T extends CollectionFilter> extends State<Inte
final filter = gridItem.filter; final filter = gridItem.filter;
void onTap() { void onTap() {
final appMode = context.read<ValueNotifier<AppMode>>().value; final appMode = context.read<ValueNotifier<AppMode>?>()?.value;
switch (appMode) { switch (appMode) {
case AppMode.main: case AppMode.main:
case AppMode.pickCollectionFiltersExternal: case AppMode.pickCollectionFiltersExternal:
case AppMode.pickSingleMediaExternal: case AppMode.pickSingleMediaExternal:
case AppMode.pickMultipleMediaExternal: case AppMode.pickMultipleMediaExternal:
final selection = context.read<Selection<FilterGridItem<T>>>(); final selection = context.read<Selection<FilterGridItem<T>>?>();
if (selection.isSelecting) { if (selection != null && selection.isSelecting) {
selection.toggleSelection(gridItem); selection.toggleSelection(gridItem);
} else { } else {
_goToCollection(context, filter); _goToCollection(context, filter);
@ -68,6 +68,7 @@ class _InteractiveFilterTileState<T extends CollectionFilter> extends State<Inte
case AppMode.setWallpaper: case AppMode.setWallpaper:
case AppMode.slideshow: case AppMode.slideshow:
case AppMode.view: case AppMode.view:
case null:
break; break;
} }
} }

View file

@ -189,9 +189,7 @@ class _BasicInfoState extends State<_BasicInfo> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if (!entry.trashed) { if (!entry.trashed && entry.isMediaStoreContent) {
final isMediaContent = entry.uri.startsWith('content://media/external/');
if (isMediaContent) {
_ownerPackageLoader = metadataFetchService.hasContentResolverProp(ownerPackageNamePropKey).then((exists) { _ownerPackageLoader = metadataFetchService.hasContentResolverProp(ownerPackageNamePropKey).then((exists) {
return exists ? metadataFetchService.getContentResolverProp(entry, ownerPackageNamePropKey) : SynchronousFuture(null); return exists ? metadataFetchService.getContentResolverProp(entry, ownerPackageNamePropKey) : SynchronousFuture(null);
}); });
@ -201,7 +199,6 @@ class _BasicInfoState extends State<_BasicInfo> {
} }
} }
} }
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {