mirror of
https://github.com/OpenFlutter/fluwx.git
synced 2025-05-20 00:36:43 +08:00
fix runnable
This commit is contained in:
@ -2,14 +2,12 @@ package com.jarvan.fluwx
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.annotation.NonNull
|
|
||||||
import com.jarvan.fluwx.handlers.FluwxAuthHandler
|
import com.jarvan.fluwx.handlers.FluwxAuthHandler
|
||||||
import com.jarvan.fluwx.handlers.FluwxRequestHandler
|
import com.jarvan.fluwx.handlers.FluwxRequestHandler
|
||||||
import com.jarvan.fluwx.handlers.FluwxShareHandler
|
import com.jarvan.fluwx.handlers.FluwxShareHandler
|
||||||
import com.jarvan.fluwx.handlers.FluwxShareHandlerEmbedding
|
import com.jarvan.fluwx.handlers.FluwxShareHandlerEmbedding
|
||||||
import com.jarvan.fluwx.handlers.PermissionHandler
|
import com.jarvan.fluwx.handlers.PermissionHandler
|
||||||
import com.jarvan.fluwx.handlers.WXAPiHandler
|
import com.jarvan.fluwx.handlers.WXAPiHandler
|
||||||
import com.jarvan.fluwx.utils.KEY_FLUWX_REQUEST_INFO_EXT_MSG
|
|
||||||
import com.jarvan.fluwx.utils.WXApiUtils
|
import com.jarvan.fluwx.utils.WXApiUtils
|
||||||
import com.jarvan.fluwx.utils.readWeChatCallbackIntent
|
import com.jarvan.fluwx.utils.readWeChatCallbackIntent
|
||||||
import com.tencent.mm.opensdk.modelbase.BaseReq
|
import com.tencent.mm.opensdk.modelbase.BaseReq
|
||||||
@ -362,8 +360,8 @@ class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware,
|
|||||||
req?.let {
|
req?.let {
|
||||||
if (FluwxConfigurations.interruptWeChatRequestByFluwx) {
|
if (FluwxConfigurations.interruptWeChatRequestByFluwx) {
|
||||||
when (req) {
|
when (req) {
|
||||||
is ShowMessageFromWX.Req -> handleWXShowMessageFromWX(req)
|
is ShowMessageFromWX.Req -> handleShowMessageFromWX(req)
|
||||||
is LaunchFromWX.Req -> handleWXLaunchFromWX(req)
|
is LaunchFromWX.Req -> handleLaunchFromWX(req)
|
||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -374,7 +372,7 @@ class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun handleWXShowMessageFromWX(req: ShowMessageFromWX.Req) {
|
private fun handleShowMessageFromWX(req: ShowMessageFromWX.Req) {
|
||||||
val result = mapOf(
|
val result = mapOf(
|
||||||
"extMsg" to req.message.messageExt,
|
"extMsg" to req.message.messageExt,
|
||||||
"messageAction" to req.message.messageAction,
|
"messageAction" to req.message.messageAction,
|
||||||
@ -387,13 +385,14 @@ class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware,
|
|||||||
fluwxChannel?.invokeMethod("onWXShowMessageFromWX", result)
|
fluwxChannel?.invokeMethod("onWXShowMessageFromWX", result)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleWXLaunchFromWX(req: LaunchFromWX.Req) {
|
private fun handleLaunchFromWX(req: LaunchFromWX.Req) {
|
||||||
val result = mapOf(
|
val result = mapOf(
|
||||||
"extMsg" to req.messageExt,
|
"extMsg" to req.messageExt,
|
||||||
"messageAction" to req.messageAction,
|
"messageAction" to req.messageAction,
|
||||||
"lang" to req.lang,
|
"lang" to req.lang,
|
||||||
"country" to req.country,
|
"country" to req.country,
|
||||||
)
|
)
|
||||||
|
extMsg = req.message.messageExt
|
||||||
|
|
||||||
fluwxChannel?.invokeMethod("onWXLaunchFromWX", result)
|
fluwxChannel?.invokeMethod("onWXLaunchFromWX", result)
|
||||||
}
|
}
|
||||||
|
@ -58,10 +58,6 @@ const NSString *lang = @"lang";
|
|||||||
const NSString *country = @"country";
|
const NSString *country = @"country";
|
||||||
const NSString *description = @"description";
|
const NSString *description = @"description";
|
||||||
|
|
||||||
|
|
||||||
FluwxWXReqRunnable _initialWXReqRunnable;
|
|
||||||
|
|
||||||
|
|
||||||
BOOL handleOpenURLByFluwx = YES;
|
BOOL handleOpenURLByFluwx = YES;
|
||||||
|
|
||||||
NSObject <FlutterPluginRegistrar> *_fluwxRegistrar;
|
NSObject <FlutterPluginRegistrar> *_fluwxRegistrar;
|
||||||
@ -1036,7 +1032,7 @@ NSObject <FlutterPluginRegistrar> *_fluwxRegistrar;
|
|||||||
[_channel invokeMethod:@"onWXShowMessageFromWX" arguments:result];
|
[_channel invokeMethod:@"onWXShowMessageFromWX" arguments:result];
|
||||||
} else {
|
} else {
|
||||||
__weak typeof(self) weakSelf = self;
|
__weak typeof(self) weakSelf = self;
|
||||||
_initialWXReqRunnable = ^() {
|
_attemptToResumeMsgFromWxRunnable = ^() {
|
||||||
__strong typeof(weakSelf) strongSelf = weakSelf;
|
__strong typeof(weakSelf) strongSelf = weakSelf;
|
||||||
[strongSelf->_channel invokeMethod:@"onWXShowMessageFromWX" arguments:result];
|
[strongSelf->_channel invokeMethod:@"onWXShowMessageFromWX" arguments:result];
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user