提交 4857505b authored 作者: JarvanMo's avatar JarvanMo

Merge branch 'dev' of https://github.com/OpenFlutter/fluwx into dev

# Conflicts: # doc/QA_CN.md
...@@ -20,4 +20,6 @@ example/android/.project ...@@ -20,4 +20,6 @@ example/android/.project
example/android/.settings/org.eclipse.buildship.core.prefs example/android/.settings/org.eclipse.buildship.core.prefs
example/android/app/.classpath example/android/app/.classpath
example/android/app/.project example/android/app/.project
example/android/app/.settings/org.eclipse.buildship.core.prefs example/android/app/.settings/org.eclipse.buildship.core.prefs
\ No newline at end of file example/Podfile.lock
.last_build_id
\ No newline at end of file
## 2.5.0
* App获取开放标签<wx-open-launch-app>中的extinfo数据
## 2.4.2 ## 2.4.2
* Fix #317 * Fix #317
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<activity <activity
android:name=".wxapi.FluwxWXEntryActivity" android:name=".wxapi.FluwxWXEntryActivity"
android:launchMode="singleTask" android:launchMode="singleTask"
android:taskAffinity="${applicationId}"
android:theme="@style/DisablePreviewTheme" /> android:theme="@style/DisablePreviewTheme" />
<activity-alias <activity-alias
...@@ -17,6 +18,7 @@ ...@@ -17,6 +18,7 @@
android:exported="true" android:exported="true"
android:launchMode="singleTop" android:launchMode="singleTop"
android:targetActivity="com.jarvan.fluwx.wxapi.FluwxWXEntryActivity" android:targetActivity="com.jarvan.fluwx.wxapi.FluwxWXEntryActivity"
android:taskAffinity="${applicationId}"
android:theme="@style/DisablePreviewTheme"> android:theme="@style/DisablePreviewTheme">
<intent-filter> <intent-filter>
......
...@@ -24,6 +24,7 @@ public class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { ...@@ -24,6 +24,7 @@ public class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
val channel = MethodChannel(registrar.messenger(), "com.jarvanmo/fluwx") val channel = MethodChannel(registrar.messenger(), "com.jarvanmo/fluwx")
val authHandler = FluwxAuthHandler(channel) val authHandler = FluwxAuthHandler(channel)
FluwxResponseHandler.setMethodChannel(channel) FluwxResponseHandler.setMethodChannel(channel)
FluwxRequestHandler.setMethodChannel(channel)
WXAPiHandler.setContext(registrar.activity().applicationContext) WXAPiHandler.setContext(registrar.activity().applicationContext)
channel.setMethodCallHandler(FluwxPlugin().apply { channel.setMethodCallHandler(FluwxPlugin().apply {
this.authHandler = authHandler this.authHandler = authHandler
...@@ -42,6 +43,7 @@ public class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { ...@@ -42,6 +43,7 @@ public class FluwxPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
val channel = MethodChannel(flutterPluginBinding.binaryMessenger, "com.jarvanmo/fluwx") val channel = MethodChannel(flutterPluginBinding.binaryMessenger, "com.jarvanmo/fluwx")
channel.setMethodCallHandler(this) channel.setMethodCallHandler(this)
FluwxResponseHandler.setMethodChannel(channel) FluwxResponseHandler.setMethodChannel(channel)
FluwxRequestHandler.setMethodChannel(channel)
authHandler = FluwxAuthHandler(channel) authHandler = FluwxAuthHandler(channel)
shareHandler = FluwxShareHandlerEmbedding(flutterPluginBinding.flutterAssets, flutterPluginBinding.applicationContext) shareHandler = FluwxShareHandlerEmbedding(flutterPluginBinding.flutterAssets, flutterPluginBinding.applicationContext)
} }
......
/*
* Copyright (C) 2020 The OpenFlutter Organization
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jarvan.fluwx.handlers
import com.tencent.mm.opensdk.modelmsg.ShowMessageFromWX
import io.flutter.plugin.common.MethodChannel
import com.tencent.mm.opensdk.modelbase.BaseReq
object FluwxRequestHandler {
private var channel: MethodChannel? = null
fun setMethodChannel(channel: MethodChannel) {
FluwxRequestHandler.channel = channel
}
fun handleRequest(req: BaseReq) {
when (req) {
is ShowMessageFromWX.Req -> hanleWXShowMessageFromWX(req)
}
}
private fun hanleWXShowMessageFromWX(req: ShowMessageFromWX.Req) {
val result = mapOf(
"extMsg" to req.message.messageExt, )
channel?.invokeMethod("onWXShowMessageFromWX", result)
}
}
\ No newline at end of file
...@@ -19,9 +19,11 @@ import android.app.Activity ...@@ -19,9 +19,11 @@ import android.app.Activity
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import com.jarvan.fluwx.handlers.FluwxResponseHandler import com.jarvan.fluwx.handlers.FluwxResponseHandler
import com.jarvan.fluwx.handlers.FluwxRequestHandler
import com.jarvan.fluwx.handlers.WXAPiHandler import com.jarvan.fluwx.handlers.WXAPiHandler
import com.tencent.mm.opensdk.modelbase.BaseReq import com.tencent.mm.opensdk.modelbase.BaseReq
import com.tencent.mm.opensdk.modelbase.BaseResp import com.tencent.mm.opensdk.modelbase.BaseResp
import com.tencent.mm.opensdk.modelmsg.ShowMessageFromWX
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler
...@@ -61,6 +63,7 @@ open class FluwxWXEntryActivity : Activity(), IWXAPIEventHandler { ...@@ -61,6 +63,7 @@ open class FluwxWXEntryActivity : Activity(), IWXAPIEventHandler {
// 稳定复现场景:微信版本为7.0.5,小程序SDK为2.7.7 // 稳定复现场景:微信版本为7.0.5,小程序SDK为2.7.7
if (baseReq.type == 4) { if (baseReq.type == 4) {
// com.tencent.mm.opensdk.constants.ConstantsAPI.COMMAND_SHOWMESSAGE_FROM_WX = 4 // com.tencent.mm.opensdk.constants.ConstantsAPI.COMMAND_SHOWMESSAGE_FROM_WX = 4
FluwxRequestHandler.handleRequest(baseReq)
startSpecifiedActivity() startSpecifiedActivity()
} }
} }
......
...@@ -5,11 +5,11 @@ Actually, almost every result from functions like `shareToWeChat` or `payWithWeC ...@@ -5,11 +5,11 @@ Actually, almost every result from functions like `shareToWeChat` or `payWithWeC
So if you want get the real result you shall do like this: So if you want get the real result you shall do like this:
```dart ```dart
weChatResponseEventHandler.listen((res) { fluwx.weChatResponseEventHandler.listen((res) {
if (res is WeChatPaymentResponse) { if (res is fluwx.WeChatPaymentResponse) {
// do something here // do something here
} }
}); });
``` ```
Take a look at subclasses of `BaseWeChatResponse` for help. Take a look at subclasses of `BaseWeChatResponse` for help.
......
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
为了获取真实的回调,你应该这样做: 为了获取真实的回调,你应该这样做:
```dart ```dart
weChatResponseEventHandler.listen((res) { fluwx.weChatResponseEventHandler.listen((res) {
if (res is WeChatPaymentResponse) { if (res is fluwx.WeChatPaymentResponse) {
// do something here // do something here
} }
}); });
``` ```
> 笔记: 如果你的 `errCode = -1`, 那请阅读微信官方文档,因为-1的原因数不胜数. > 笔记: 如果你的 `errCode = -1`, 那请阅读微信官方文档,因为-1的原因数不胜数.
......
差异被折叠。
...@@ -26,4 +26,4 @@ SPEC CHECKSUMS: ...@@ -26,4 +26,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d
COCOAPODS: 1.9.1 COCOAPODS: 1.10.0
...@@ -73,7 +73,7 @@ packages: ...@@ -73,7 +73,7 @@ packages:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "2.4.0" version: "2.4.2"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
......
...@@ -212,5 +212,10 @@ FlutterMethodChannel *fluwxMethodChannel = nil; ...@@ -212,5 +212,10 @@ FlutterMethodChannel *fluwxMethodChannel = nil;
[_delegate managerDidRecvLaunchFromWXReq:launchReq]; [_delegate managerDidRecvLaunchFromWXReq:launchReq];
} }
} }
LaunchFromWXReq *launchFromWXReq = (LaunchFromWXReq *) req;
NSDictionary *result = @{
@"extMsg": launchFromWXReq.message.messageExt
};
[fluwxMethodChannel invokeMethod:@"onWXShowMessageFromWX" arguments:result];
} }
@end @end
...@@ -40,6 +40,8 @@ Map<String, _WeChatResponseInvoker> _nameAndResponseMapper = { ...@@ -40,6 +40,8 @@ Map<String, _WeChatResponseInvoker> _nameAndResponseMapper = {
WeChatAuthGotQRCodeResponse.fromMap(argument), WeChatAuthGotQRCodeResponse.fromMap(argument),
"onQRCodeScanned": (Map argument) => "onQRCodeScanned": (Map argument) =>
WeChatQRCodeScannedResponse.fromMap(argument), WeChatQRCodeScannedResponse.fromMap(argument),
"onWXShowMessageFromWX": (Map argument) =>
WeChatShowMessageFromWXRequest.fromMap(argument),
}; };
class BaseWeChatResponse { class BaseWeChatResponse {
...@@ -173,6 +175,15 @@ class WeChatQRCodeScannedResponse extends BaseWeChatResponse { ...@@ -173,6 +175,15 @@ class WeChatQRCodeScannedResponse extends BaseWeChatResponse {
: super._(map[_errCode], map[_errStr]); : super._(map[_errCode], map[_errStr]);
} }
// 获取微信打开App时携带的参数
class WeChatShowMessageFromWXRequest extends BaseWeChatResponse {
final String extMsg;
WeChatShowMessageFromWXRequest.fromMap(Map map)
: extMsg = map["extMsg"],
super._(0, '');
}
///WechatAuth_Err_OK(0), ///WechatAuth_Err_OK(0),
///WechatAuth_Err_NormalErr(-1), ///WechatAuth_Err_NormalErr(-1),
///WechatAuth_Err_NetworkErr(-2), ///WechatAuth_Err_NetworkErr(-2),
......
name: fluwx name: fluwx
description: The capability of implementing WeChat SDKs in Flutter. With Fluwx, developers can use WeChatSDK easily, such as sharing, payment, lanuch mini program and etc. description: The capability of implementing WeChat SDKs in Flutter. With Fluwx, developers can use WeChatSDK easily, such as sharing, payment, lanuch mini program and etc.
version: 2.4.2 version: 2.5.0
homepage: https://github.com/JarvanMo/fluwx homepage: https://github.com/JarvanMo/fluwx
environment: environment:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论