提交 83b55186 authored 作者: JarvanMo's avatar JarvanMo

fix #599

上级 df3d9421
......@@ -3,7 +3,6 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Support WeChat query on Android P -->
<queries>
......
......@@ -179,7 +179,6 @@ class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware,
}
override fun onDetachedFromActivity() {
shareHandler?.permissionHandler = null
}
override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) {
......@@ -190,7 +189,6 @@ class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware,
// WXAPiHandler.setContext(binding.activity.applicationContext)
activityPluginBinding = binding
binding.addOnNewIntentListener(this)
shareHandler?.permissionHandler = PermissionHandler(binding.activity)
}
override fun onDetachedFromActivityForConfigChanges() {
......
......@@ -39,7 +39,6 @@ internal class FluwxShareHandlerEmbedding(private val flutterAssets: FlutterPlug
override val job: Job = Job()
override var permissionHandler: PermissionHandler? = null
}
internal interface FluwxShareHandler : CoroutineScope {
......@@ -119,11 +118,7 @@ internal interface FluwxShareHandler : CoroutineScope {
if (supportFileProvider && targetHigherThanN) {
setImagePath(getFileContentUri(sourceByteArray.toCacheFile(context, sourceImage.suffix)))
} else {
if (ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
setImagePath(sourceByteArray.toExternalCacheFile(context, sourceImage.suffix)?.absolutePath)
} else {
permissionHandler?.requestStoragePermission()
}
setImagePath(sourceByteArray.toExternalCacheFile(context, sourceImage.suffix)?.absolutePath)
}
}
}
......@@ -228,11 +223,7 @@ internal interface FluwxShareHandler : CoroutineScope {
if (supportFileProvider && targetHigherThanN) {
setFilePath(getFileContentUri(sourceByteArray.toCacheFile(context, sourceFile.suffix)))
} else {
if (ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
filePath = sourceByteArray.toExternalCacheFile(context, sourceFile.suffix)?.absolutePath
} else {
permissionHandler?.requestStoragePermission()
}
filePath = sourceByteArray.toExternalCacheFile(context, sourceFile.suffix)?.absolutePath
}
}
......@@ -312,8 +303,6 @@ internal interface FluwxShareHandler : CoroutineScope {
val job: Job
var permissionHandler: PermissionHandler?
fun onDestroy() = job.cancel()
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论