提交 f5dddd46 authored 作者: JarvanMo's avatar JarvanMo

rm registerApp(RegisterModel),use register instead

上级 e11401f0
...@@ -23,7 +23,7 @@ class _MyAppState extends State<MyApp> { ...@@ -23,7 +23,7 @@ class _MyAppState extends State<MyApp> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
Fluwx.registerApp(RegisterModel(appId: "wxd930ea5d5a258f4f")); Fluwx.register(appId:"wxd930ea5d5a258f4f",doOnAndroid: true,doOnIOS: true,enableMTA: false);
} }
// Platform messages are asynchronous, so we initialize in an async method. // Platform messages are asynchronous, so we initialize in an async method.
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
library fluwx; library fluwx;
export 'src/fluwx_class.dart'; export 'src/fluwx_class.dart';
export 'src/models/flutter_register_model.dart';
export 'src/models/wechat_pay_model.dart'; export 'src/models/wechat_pay_model.dart';
export 'src/models/wechat_response.dart'; export 'src/models/wechat_response.dart';
export 'src/models/wechat_send_auth_model.dart'; export 'src/models/wechat_send_auth_model.dart';
......
...@@ -17,7 +17,6 @@ import 'dart:async'; ...@@ -17,7 +17,6 @@ import 'dart:async';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'models/flutter_register_model.dart';
import 'models/wechat_pay_model.dart'; import 'models/wechat_pay_model.dart';
import 'models/wechat_response.dart'; import 'models/wechat_response.dart';
import 'models/wechat_send_auth_model.dart'; import 'models/wechat_send_auth_model.dart';
...@@ -56,9 +55,20 @@ class Fluwx { ...@@ -56,9 +55,20 @@ class Fluwx {
Stream<WeChatResponse> get response => _responseController.stream; Stream<WeChatResponse> get response => _responseController.stream;
///the [model] should not be null ///[appId] is not necessary.
static Future registerApp(RegisterModel model) async { ///if [doOnIOS] is true ,fluwx will register WXApi on iOS.
return await _channel.invokeMethod("registerApp", model.toMap()); ///if [doOnAndroid] is true, fluwx will register WXApi on Android.
static Future register(
{String appId,
bool doOnIOS: true,
doOnAndroid: true,
enableMTA: false}) async {
return await _channel.invokeMethod("registerApp", {
"appId": appId,
"iOS": doOnIOS,
"android": doOnAndroid,
"enableMTA": enableMTA
});
} }
///we don't need the response any longer. ///we don't need the response any longer.
...@@ -70,7 +80,7 @@ class Fluwx { ...@@ -70,7 +80,7 @@ class Fluwx {
// return await _channel.invokeMethod("unregisterApp", model.toMap()); // return await _channel.invokeMethod("unregisterApp", model.toMap());
// } // }
///the [model] can not be null ///the [WeChatShareModel] can not be null
///see [WeChatShareWebPageModel] ///see [WeChatShareWebPageModel]
/// [WeChatShareTextModel] /// [WeChatShareTextModel]
///[WeChatShareVideoModel] ///[WeChatShareVideoModel]
......
/*
* Copyright (C) 2018 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.
*/
class RegisterModel {
final String appId;
final bool doOnIOS;
final bool doOnAndroid;
final bool enableMTA;
///[appId] is not necessary.
///if [doOnIOS] is true ,fluwx will register WXApi on iOS.
///if [doOnAndroid] is true, fluwx will register WXApi on Android.
RegisterModel(
{this.appId,
this.doOnIOS: true,
this.doOnAndroid: true,
this.enableMTA = false});
Map toMap() {
return {
"appId": appId,
"iOS": doOnIOS,
"android": doOnAndroid,
"enableMTA": enableMTA
};
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论