提交 269b5be3 authored 作者: JarvanMo's avatar JarvanMo

update doc

上级 289d6c50
...@@ -53,7 +53,7 @@ Before using`Fluwx`,you should init `FLuwx`: ...@@ -53,7 +53,7 @@ Before using`Fluwx`,you should init `FLuwx`:
> 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. > NOTE:Although we can register WXApi via Fluwx,but there's still some work you have to do on the particular platform.For example, add a URLSchema for iOS.
### More ### More
* [Share](./doc/SHARE.md) * [Share](./doc/SHARE.md)
......
...@@ -55,7 +55,7 @@ dependencies: ...@@ -55,7 +55,7 @@ dependencies:
``` ```
> 注意:尽管可以通过Fluwx完成微信注册,但一些操作依然需要在对应平台进行设置,如配置iOS的URLSchema,Android上的WXEntryActivity等。 > 注意:尽管可以通过Fluwx完成微信注册,但一些操作依然需要在对应平台进行设置,如配置iOS的URLSchema等。
### 传送门 ### 传送门
* [分享](./doc/SHARE_CN.md) * [分享](./doc/SHARE_CN.md)
......
...@@ -2,7 +2,10 @@ ...@@ -2,7 +2,10 @@
There's some work we have to do on the particular plaform(if you don't need this,just ignore). There's some work we have to do on the particular plaform(if you don't need this,just ignore).
### Android ### Android
For`Android`,create `WXEntryActivity`or`WXPayEntryActivity`,and override the following function: Fluwx will create `WXEntryActivity`or`WXPayEntryActivity` by itself since *0.4.0*. So the following
code isn't necessary.
~~For`Android`,create `WXEntryActivity`or`WXPayEntryActivity`,and override the following function:~~
```kotlin ```kotlin
public override fun onCreate(savedInstanceState: Bundle?) { public override fun onCreate(savedInstanceState: Bundle?) {
...@@ -25,9 +28,9 @@ For`Android`,create `WXEntryActivity`or`WXPayEntryActivity`,and override the fol ...@@ -25,9 +28,9 @@ For`Android`,create `WXEntryActivity`or`WXPayEntryActivity`,and override the fol
finish() finish()
} }
``` ```
You can also directly inherit `FluwxWXEntryActivity`,and then you can do nothing. ~~You can also directly inherit `FluwxWXEntryActivity`,and then you can do nothing.
For the rule of creating `WXEntryActivity`and`WXPayEntryActivity`,please read [example wxapi](https://github.com/OpenFlutter/fluwx/tree/master/example/android/app/src/main/kotlin/net/sourceforge/simcpux/wxapi ) For the rule of creating `WXEntryActivity`and`WXPayEntryActivity`,please read [example wxapi](https://github.com/OpenFlutter/fluwx/tree/master/example/android/app/src/main/kotlin/net/sourceforge/simcpux/wxapi )~~
,never forget to register your Activity in `AndroidManifest.mxl`: ~~,never forget to register your Activity in `AndroidManifest.mxl`:~~
```xml ```xml
<activity <activity
android:name="your.package.name.registered.on.wechat.wxapi.WXEntryActivity" android:name="your.package.name.registered.on.wechat.wxapi.WXEntryActivity"
...@@ -41,7 +44,45 @@ For the rule of creating `WXEntryActivity`and`WXPayEntryActivity`,please read [e ...@@ -41,7 +44,45 @@ For the rule of creating `WXEntryActivity`and`WXPayEntryActivity`,please read [e
android:launchMode="singleTop"/> android:launchMode="singleTop"/>
``` ```
#### However Customization Is Always Good
Well, sometimes you need to create `WXEntryActivity`and`WXPayEntryActivity` by yourself because your project isn't
a pure-flutter-project. The `WXEntryActivity`and`WXPayEntryActivity` must be under *packageName/wxapi/*,you
can inherit `FluwxWXEntryActivity` for convenience.Then register `WXEntryActivity`and`WXPayEntryActivity`in
`AndroidManifest.mxl`:
```
<activity android:name=".wxapi.WXEntryActivity"
android:theme="@style/DisablePreviewTheme"
/>
<activity android:name=".wxapi.WXPayEntryActivity"
android:theme="@style/DisablePreviewTheme"/>
<activity-alias
android:name="${applicationId}.wxapi.WXEntryActivity"
android:exported="true"
tools:replace="android:targetActivity"
android:targetActivity=".wxapi.WXEntryActivity"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="sdksample" />
</intent-filter>
</activity-alias>
<activity-alias
tools:replace="android:targetActivity"
android:name="${applicationId}.wxapi.WXPayEntryActivity"
android:exported="true"
android:targetActivity=".wxapi.WXPayEntryActivity"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="sdksample" />
</intent-filter>
</activity-alias>
```
### iOS ### iOS
override the following function in`AppDelegate`: override the following function in`AppDelegate`:
```objective-c ```objective-c
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
微信的回调也要根据平台的不同进行差异化处理(如果你不需要回调,请忽略)。 微信的回调也要根据平台的不同进行差异化处理(如果你不需要回调,请忽略)。
### Android ### Android
由于机制问题,`Android`端需要在`WXEntryActivity``WXPayEntryActivity`中添加如下代码: *0.4.0*开始,开发者不必手动添加`WXEntryActivity``WXPayEntryActivity`了,所以下面的不是必需要的了:
~~由于机制问题,`Android`端需要在`WXEntryActivity``WXPayEntryActivity`中添加如下代码:~~
```kotlin ```kotlin
public override fun onCreate(savedInstanceState: Bundle?) { public override fun onCreate(savedInstanceState: Bundle?) {
...@@ -25,8 +26,8 @@ ...@@ -25,8 +26,8 @@
finish() finish()
} }
``` ```
你也可以直接继承`FluwxWXEntryActivity` ~~你也可以直接继承`FluwxWXEntryActivity`。~~
`WXEntryActivity``WXPayEntryActivity`创建规则请参阅官方文档。具体可以参考[example wxapi](https://github.com/OpenFlutter/fluwx/tree/master/example/android/app/src/main/kotlin/net/sourceforge/simcpux/wxapi ) ~~`WXEntryActivity``WXPayEntryActivity`创建规则请参阅官方文档。具体可以参考[example wxapi](https://github.com/OpenFlutter/fluwx/tree/master/example/android/app/src/main/kotlin/net/sourceforge/simcpux/wxapi )~~
,也不要忘记在`AndroidManifest.mxl`中注册: ,也不要忘记在`AndroidManifest.mxl`中注册:
```xml ```xml
<activity <activity
...@@ -41,7 +42,42 @@ ...@@ -41,7 +42,42 @@
android:launchMode="singleTop"/> android:launchMode="singleTop"/>
``` ```
#### 但个性化总是好的
有的时候开者仍然需要手动创建`WXEntryActivity``WXPayEntryActivity`,比如这并不是一个纯净的Flutter的项目,仍有一部分需要
原生实现。`WXEntryActivity`and`WXPayEntryActivity` 必须在 *packageName/wxapi/*下面,方便起见,你可以直接继承 `FluwxWXEntryActivity`
然后在`AndroidManifest.mxl`中注册`WXEntryActivity`and`WXPayEntryActivity`:
<activity android:name=".wxapi.WXEntryActivity"
android:theme="@style/DisablePreviewTheme"
/>
<activity android:name=".wxapi.WXPayEntryActivity"
android:theme="@style/DisablePreviewTheme"/>
<activity-alias
android:name="${applicationId}.wxapi.WXEntryActivity"
android:exported="true"
tools:replace="android:targetActivity"
android:targetActivity=".wxapi.WXEntryActivity"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="sdksample" />
</intent-filter>
</activity-alias>
<activity-alias
tools:replace="android:targetActivity"
android:name="${applicationId}.wxapi.WXPayEntryActivity"
android:exported="true"
android:targetActivity=".wxapi.WXPayEntryActivity"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="sdksample" />
</intent-filter>
</activity-alias>
```
### iOS ### iOS
在你的`AppDelegate`中重写下面方法: 在你的`AppDelegate`中重写下面方法:
```objective-c ```objective-c
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论