diff --git a/CHANGELOG.md b/CHANGELOG.md index ea4bd4ba..ed91e340 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ -## 0.2.2 +## 0.3.0 * 回调方式发生变化,由Map变更为实体类。 -* iOS的SDK更换为'OpenWeChatSDK',并升级到了1.8.3。 +* iOS的WeChatSDK更换为内部依赖,并升级到了1.8.3。 * 修复iOS支付返回结果缺少*returnKey*的问题。 +* API现在更加友善了。 +* 对swift支持更友好了。 ## 0.2.1 * 修复在Android处理网络图片后缀不对的问题。 diff --git a/README.md b/README.md index 6053e76b..5323c065 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,7 @@ implementation 'top.zibin:Luban:1.1.8' implementation 'com.squareup.okhttp3:okhttp:3.11.0' ``` - For iOS: - ```podspec - s.dependency 'WechatOpenSDK','~> 1.8.2' - ``` + For Flutter:
Flutter 0.8.2 • channel beta • https://github.com/flutter/flutter.git
Framework • revision 5ab9e70727 (11 days ago) • 2018-09-07 12:33:05 -0700
@@ -42,30 +39,19 @@ add the following in your `pubspec.yaml` file: ```yaml dependencies: - fluwx: ^0.2.1 + fluwx: ^0.3.0 ``` -## Init Fluwx +## Register WeChatSDK via Fluwx Before using`Fluwx`,you should init `FLuwx`: ```dart - Fluwx.register(appId:"wxd930ea5d5a258f4f",doOnAndroid: true,doOnIOS: true,enableMTA: false); - ``` - - `appId`:the appId you applied from WeChat. - - `doOnAndroid`:whether init for Android. - - `doOnIOS`:whether init for iOS - - Each param isn't necessary.However,if `appId`is blank, or `doOnAndroid: false`, or `doOnIOS: false`,you must register your `WXApi` on the particular platform in order to ensure `Fluwx` can work. - After tha,add the following code before using `Fluwx` on the particular platform: - For Android: - ```kotlin - FluwxShareHandler.setWXApi(wxapi) - ``` - For iOS: - ```objective-c -isWeChatRegistered = YES; + import 'package:fluwx/fluwx.dart' as fluwx; + fluwx.register(appId:"wxd930ea5d5a258f4f"); ``` + + > NOTE:Although we can register WXApi via Fluwx,but there's still some work you have to do on the particular platform.For example, creat a `WXEntryActivity` for android and add a URLSchema for iOS. ### More diff --git a/README_CN.md b/README_CN.md index 60b0796d..b025c05f 100644 --- a/README_CN.md +++ b/README_CN.md @@ -27,10 +27,7 @@ QQ群:892398530。 implementation 'top.zibin:Luban:1.1.8' implementation 'com.squareup.okhttp3:okhttp:3.11.0' ``` - iOS部分涉及到的技术: - ```podspec - s.dependency 'WechatOpenSDK','~> 1.8.2' - ``` + Flutter版本信息
Flutter 0.8.2 • channel beta • https://github.com/flutter/flutter.git
Framework • revision 5ab9e70727 (11 days ago) • 2018-09-07 12:33:05 -0700
@@ -44,29 +41,18 @@ QQ群:892398530。 在`pubspec.yaml`文件中添加如下代码: ```yaml dependencies: - fluwx: ^0.2.1 + fluwx: ^0.3.0 ``` ## 初始化 使用`Fluwx`前,需要进行初始化操作: ```dart - Fluwx.register(appId:"wxd930ea5d5a258f4f",doOnAndroid: true,doOnIOS: true,enableMTA: false); - ``` - - `appId`:在微信平台申请的appId。 - - `doOnAndroid`:是否在android平台上执行此操作。 - - `doOnIOS`:是否在iOS平台上执行此操作。
- 每一个字段都是非必须的,但是如果不传`appId`或`doOnAndroid: false`或者`doOnIOS: false`,请务必手动注册`WXApi`以保证`Fluwx`正常工作。 - 注册完成后,请在使用`Fluwx`前在对应平台添加如下代码: - Android上: - ```kotlin - FluwxShareHandler.setWXApi(wxapi) - ``` - iOS上: - ```objective-c -isWeChatRegistered = YES; + import 'package:fluwx/fluwx.dart' as fluwx; + fluwx.register(appId:"wxd930ea5d5a258f4f"); ``` + > 注意:尽管可以通过Fluwx完成微信注册,但一些操作依然需要在对应平台进行设置,如配置iOS的URLSchema,Android上的WXEntryActivity等。 ### 传送门 diff --git a/doc/RESPONSE.md b/doc/RESPONSE.md index eb39c9b9..326fad68 100644 --- a/doc/RESPONSE.md +++ b/doc/RESPONSE.md @@ -61,10 +61,18 @@ override the following function in`AppDelegate.m`: ### Flutter We can get the reponse from WeChat after sharing and etc: ```dart - _fluwx.response.listen((response){ - //do something - }); + fluwx.responseFromShare.listen((response){ + //do something + }); + fluwx.responseFromAuth.listen((response){ + //do something + }); + fluwx.responseFromPayment.listen((response){ + //do something + }); ``` +> NOTE:If the field starts with "android" or "iOS", it means that only android or iOS has the field. + The type of return value is `WeChatResponse`,and `type` is an enum: ```dart enum WeChatResponseType { diff --git a/doc/RESPONSE_CN.md b/doc/RESPONSE_CN.md index 7affd2a1..c196405f 100644 --- a/doc/RESPONSE_CN.md +++ b/doc/RESPONSE_CN.md @@ -59,16 +59,15 @@ ### Flutter ```dart - _fluwx.response.listen((response){ - //do something - }); + fluwx.responseFromShare.listen((response){ + //do something + }); + fluwx.responseFromAuth.listen((response){ + //do something + }); + fluwx.responseFromPayment.listen((response){ + //do something + }); ``` -从微信回调的值为`WeChatResponse`,其实`type`字段为枚举: -```dart -enum WeChatResponseType { - SHARE, - AUTH, - PAYMENT } -``` -`result`为微信回传的值,其类型为`Map`,具体返回值请参阅微信官方文档,但均额外包含一个 -`platform`字段,其值为`android`或者`iOS`,以便开发者作差异化处理。 + +> 注意:如果一个字段以*android*或者*iOS*开头,那么意味这个字段只存在于*android*或者*iOS*。 diff --git a/doc/SEND_AUTH.md b/doc/SEND_AUTH.md index 7bce1362..641d3d79 100644 --- a/doc/SEND_AUTH.md +++ b/doc/SEND_AUTH.md @@ -1,6 +1,7 @@ ## Send Auth We'll get a `code` by sending auth: ```dart + import 'package:fluwx/fluwx.dart' as fluwx; fluwx.sendAuth(WeChatSendAuthModel( scope: "snsapi_userinfo", state:"wechat_sdk_demo_test", diff --git a/doc/SEND_AUTH_CN.md b/doc/SEND_AUTH_CN.md index 656c6b18..cdcdd2e2 100644 --- a/doc/SEND_AUTH_CN.md +++ b/doc/SEND_AUTH_CN.md @@ -1,6 +1,7 @@ ## 发送Auth验证 `Fluwx`目前只支持获取`code`,若要获取`access_token`请在服务器端完成。 ```dart + import 'package:fluwx/fluwx.dart' as fluwx; fluwx.sendAuth(WeChatSendAuthModel( scope: "snsapi_userinfo", state:"wechat_sdk_demo_test", diff --git a/doc/USING_SWIFT.md b/doc/USING_SWIFT.md index 9d8f6009..fd9588e3 100644 --- a/doc/USING_SWIFT.md +++ b/doc/USING_SWIFT.md @@ -1,16 +1,5 @@ ## Using Swift? -`fluwx` supports `swift` since 2.0.0. However,before using swift, there's still a little work to do. -If anyone has better solutions, tell me please or open a PR. - -## Allow Non-modular Includes - -There is an exception called `include non-modular headers` if compiling `fluwx` directly. - -We have to allow non-modular includes to support swift,open your target and allow non-modular : - -![allow_non_modular_includes](../arts/allow_non_modular_includes.png) - - +`fluwx` supports `swift` since 2.0.0. ## Response diff --git a/doc/USING_SWIFT_CN.md b/doc/USING_SWIFT_CN.md index 2f7f70ad..2d6109af 100644 --- a/doc/USING_SWIFT_CN.md +++ b/doc/USING_SWIFT_CN.md @@ -1,14 +1,5 @@ ## 使用Swift? -`fluwx` 从*2.0.0*开始支持 `swift`。 但是在使用swift之前, 我们还有一些工作要做。 -如果有人知道更好的方式,请告诉我或者提一个PR。 - -## Allow Non-modular Includes - -当我们使用swift编译`fluwx`的时候会报一个错误: `include non-modular headers`。 -为了支持swift,我们不得不允许*non-modular includes*,打开你的target设置: - -![allow_non_modular_includes](../arts/allow_non_modular_includes.png) - +`fluwx` 从*2.0.0*开始支持 `swift`。 diff --git a/doc/WXPay.md b/doc/WXPay.md index ce4e5a51..05aaecf3 100644 --- a/doc/WXPay.md +++ b/doc/WXPay.md @@ -3,7 +3,7 @@ ### Pay ```dart -Fluwx fluwx = new Fluwx(); +import 'package:fluwx/fluwx.dart' as fluwx; fluwx.pay(WeChatPayModel( appId: 'wxd930ea5d5a258f4f', partnerId: '1900000109', diff --git a/doc/WXPay_CN.md b/doc/WXPay_CN.md index 35f43a0b..ef3ef6cc 100644 --- a/doc/WXPay_CN.md +++ b/doc/WXPay_CN.md @@ -4,7 +4,7 @@ ### 拉起支付 ```dart -Fluwx fluwx = new Fluwx(); +import 'package:fluwx/fluwx.dart' as fluwx; fluwx.pay(WeChatPayModel( appId: 'wxd930ea5d5a258f4f', partnerId: '1900000109', diff --git a/pubspec.yaml b/pubspec.yaml index f64f82ff..b0cb0148 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: fluwx description: A implement of WeChatSDK on Flutter.Let's make it easier with Fluwx. -version: 0.2.1 +version: 0.3.0 author: JarvanMo homepage: https://github.com/JarvanMo/fluwx