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

fix #599

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