Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-fluwx
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
openSourceLibrary
clx-fluwx
Commits
474a50e3
Unverified
提交
474a50e3
authored
10月 19, 2018
作者:
JarvanMo
提交者:
GitHub
10月 19, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #22 from tenfar/master
add WeChatLaunchMiniProgram
上级
b200e68c
572e003c
显示空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
158 行增加
和
3 行删除
+158
-3
cscope_conf.json
.vscode/cscope_conf.json
+14
-0
FluwxPlugin.m
ios/Classes/FluwxPlugin.m
+6
-1
FluwxMethods.h
ios/Classes/constants/FluwxMethods.h
+2
-0
FluwxMethods.m
ios/Classes/constants/FluwxMethods.m
+1
-1
FluwxLaunchMiniProgramHandler.m
ios/Classes/handler/FluwxLaunchMiniProgramHandler.m
+29
-0
FluwxLaunchMiniProgramHandler.h
ios/Classes/public/FluwxLaunchMiniProgramHandler.h
+12
-0
fluwx_class.dart
lib/src/fluwx_class.dart
+16
-1
wechat_launchminiprogram_model.dart
lib/src/models/wechat_launchminiprogram_model.dart
+30
-0
wechat_response.dart
lib/src/models/wechat_response.dart
+29
-0
wechat_type.dart
lib/src/wechat_type.dart
+19
-0
没有找到文件。
.vscode/cscope_conf.json
0 → 100644
浏览文件 @
474a50e3
{
"version"
:
"0.0.5"
,
"open_new_column"
:
"no"
,
"engine_configurations"
:
[
{
"cscope"
:
{
"paths"
:
[
"${workspaceRoot}"
]
}
}
]
}
\ No newline at end of file
ios/Classes/FluwxPlugin.m
浏览文件 @
474a50e3
...
...
@@ -8,6 +8,7 @@
#import "FluwxKeys.h"
#import "FluwxWXApiHandler.h"
#import "FluwxShareHandler.h"
#import "FluwxLaunchMiniProgramHandler.h"
@implementation
FluwxPlugin
...
...
@@ -49,6 +50,7 @@ FluwxPaymentHandler *_fluwxPaymentHandler;
_fluwxAuthHandler
=
[[
FluwxAuthHandler
alloc
]
initWithRegistrar
:
registrar
];
_fluwxWXApiHandler
=
[[
FluwxWXApiHandler
alloc
]
init
];
_fluwxPaymentHandler
=
[[
FluwxPaymentHandler
alloc
]
initWithRegistrar
:
registrar
];
_fluwxLaunchMiniProgramHandler
=
[[
FluwxLuanchMiniProgramHandler
alloc
]
initWithRegistrar
:
registrar
];
}
...
...
@@ -88,7 +90,10 @@ FluwxPaymentHandler *_fluwxPaymentHandler;
}
else
{
result
(
FlutterMethodNotImplemented
);
}
if
([
@"launchMiniProgram"
isEqualToString
:
call
.
method
]){
[
_fluwxLaunchMiniProgramHandler
handlerLaunchMiniProgram
:
call
result
:
result
];
return
;
}
}
...
...
ios/Classes/constants/FluwxMethods.h
浏览文件 @
474a50e3
...
...
@@ -13,6 +13,7 @@ extern NSString *const shareMusic;
extern
NSString
*
const
shareVideo
;
extern
NSString
*
const
shareWebPage
;
extern
NSString
*
const
shareMiniProgram
;
extern
NSString
*
const
launchMiniProgram
;
@interface
FluwxMethods
:
NSObject
@end
\ No newline at end of file
ios/Classes/constants/FluwxMethods.m
浏览文件 @
474a50e3
...
...
@@ -13,7 +13,7 @@ NSString *const shareMusic = @"shareMusic";
NSString
*
const
shareVideo
=
@"shareVideo"
;
NSString
*
const
shareWebPage
=
@"shareWebPage"
;
NSString
*
const
shareMiniProgram
=
@"shareMiniProgram"
;
NSString
*
const
LaunchMiniProgram
=
@"launchMiniProgram"
;
@implementation
FluwxMethods
{
...
...
ios/Classes/handler/FluwxLaunchMiniProgramHandler.m
0 → 100644
浏览文件 @
474a50e3
#import "FluwxLaunchMiniProgramHandler.h"
#import "CallResults.h"
#import "FluwxKeys.h"
#import "StringToWeChatScene.h"
#import "FluwxMethods.h"
#import "ThumbnailHelper.h"
#import "NSStringWrapper.h"
@implementation
FluwxLaunchMiniProgramHandler
-
(
instancetype
)
initWithRegistrar
:(
NSObject
<
FlutterPluginRegistrar
>
*
)
registrar
{
self
=
[
super
init
];
// if (self) {
//
// }
return
self
;
}
-
(
void
)
handleLaunchMiniProgram
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
{
NSString
*
userName
=
call
.
arguments
[
@"userName"
];
NSString
*
path
=
call
.
arguments
[
@"path"
];
WXMiniProgramType
*
miniProgramType
=
(
WXcall
.
arguments
[
@"miniProgramType"
]
[
WXApiRequestHandler
launchMiniProgramWithUserName
:
userName
path
:
path
type:
miniProgramType
;
}
@end
ios/Classes/public/FluwxLaunchMiniProgramHandler.h
0 → 100644
浏览文件 @
474a50e3
#import <Foundation/Foundation.h>
#import <Flutter/Flutter.h>
#import "FluwxPlugin.h"
#import "WXApi.h"
@class
StringUtil
;
@interface
FluwxLaunchMiniProgramHandler
:
NSObject
-
(
instancetype
)
initWithRegistrar
:(
NSObject
<
FlutterPluginRegistrar
>
*
)
registrar
;
-
(
void
)
handleLaunchMiniProgram
:(
FlutterMethodCall
*
)
call
result
:(
FlutterResult
)
result
;
@end
\ No newline at end of file
lib/src/fluwx_class.dart
浏览文件 @
474a50e3
...
...
@@ -20,6 +20,7 @@ import 'package:flutter/services.dart';
import
'models/wechat_response.dart'
;
import
'models/wechat_send_auth_model.dart'
;
import
'models/wechat_share_models.dart'
;
import
'models/wechat_launchminiprogram_model.dart'
;
import
'package:flutter/foundation.dart'
;
StreamController
<
WeChatShareResponse
>
_responseShareController
=
...
...
@@ -40,6 +41,9 @@ StreamController<WeChatPaymentResponse> _responsePaymentController =
Stream
<
WeChatPaymentResponse
>
get
responseFromPayment
=>
_responsePaymentController
.
stream
;
StreamController
<
WeChatLaunchMiniProgramResponse
>
_responseLaunchMiniProgramController
=
new
StreamController
.
broadcast
();
final
MethodChannel
_channel
=
const
MethodChannel
(
'com.jarvanmo/fluwx'
)
..
setMethodCallHandler
(
_handler
);
...
...
@@ -50,6 +54,9 @@ Future<dynamic> _handler(MethodCall methodCall) {
}
else
if
(
"onAuthResponse"
==
methodCall
.
method
)
{
_responseAuthController
.
add
(
WeChatAuthResponse
.
fromMap
(
methodCall
.
arguments
));
}
else
if
(
"onLaunchMiniProgramResponse"
==
methodCall
.
method
)
{
_responseLaunchMiniProgramController
.
add
(
WeChatLaunchMiniProgramResponse
.
fromMap
(
methodCall
.
arguments
));
}
else
if
(
"onPayResponse"
==
methodCall
.
method
)
{
_responsePaymentController
.
add
(
WeChatPaymentResponse
.
fromMap
(
methodCall
.
arguments
));
...
...
@@ -84,7 +91,7 @@ Future register(
}
///we don't need the response any longer if params are true.
void
dispose
(
{
shareResponse:
true
,
authResponse:
true
,
paymentResponse:
true
})
{
void
dispose
(
{
shareResponse:
true
,
authResponse:
true
,
paymentResponse:
true
,
launchMiniProgramResponse:
true
})
{
if
(
shareResponse
)
{
_responseShareController
.
close
();
}
...
...
@@ -92,6 +99,9 @@ void dispose({shareResponse: true, authResponse: true, paymentResponse: true}) {
if
(
authResponse
)
{
_responseAuthController
.
close
();
}
if
(
launchMiniProgramResponse
)
{
_responseLaunchMiniProgramController
.
close
();
}
if
(
paymentResponse
)
{
_responseAuthController
.
close
();
...
...
@@ -121,6 +131,11 @@ Future sendAuth(WeChatSendAuthModel model) async {
return
await
_channel
.
invokeMethod
(
"sendAuth"
,
model
.
toMap
());
}
Future
launchMiniProgram
(
WeChatLaunchMiniProgramModel
model
)
async
{
return
await
_channel
.
invokeMethod
(
"launchMiniProgram"
,
model
.
toMap
());
}
Future
isWeChatInstalled
(
)
async
{
return
await
_channel
.
invokeMethod
(
"isWeChatInstalled"
);
}
...
...
lib/src/models/wechat_launchminiprogram_model.dart
0 → 100644
浏览文件 @
474a50e3
/*
* 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.
*/
import
'package:flutter/foundation.dart'
;
import
'../wechat_type.dart'
;
class
WeChatLaunchMiniProgramModel
{
final
String
username
;
final
String
path
;
final
WXMiniProgramType
miniprogramtype
;
WeChatLaunchMiniProgramModel
({
@required
this
.
username
,
this
.
path
,
this
.
miniprogramtype
})
:
assert
(
username
!=
null
&&
username
.
trim
().
isNotEmpty
);
Map
toMap
()
{
return
{
"userName"
:
username
,
"path"
:
path
,
"miniProgramType"
:
miniprogramtype
};
}
}
\ No newline at end of file
lib/src/models/wechat_response.dart
浏览文件 @
474a50e3
...
...
@@ -76,6 +76,35 @@ class WeChatAuthResponse {
androidTransaction
=
map
[
"transaction"
];
}
class
WeChatLaunchMiniProgramResponse
{
final
String
errStr
;
final
int
type
;
final
int
errCode
;
final
String
androidOpenId
;
final
String
iOSDescription
;
final
String
country
;
final
String
lang
;
final
String
code
;
final
String
androidUrl
;
final
String
state
;
final
String
androidTransaction
;
WeChatLaunchMiniProgramResponse
.
fromMap
(
Map
map
)
:
errStr
=
map
[
"errStr"
],
type
=
map
[
"type"
],
errCode
=
map
[
"errCode"
],
androidOpenId
=
map
[
"openId"
],
iOSDescription
=
map
[
"description"
],
country
=
map
[
"country"
],
lang
=
map
[
"lang"
],
code
=
map
[
"code"
],
androidUrl
=
map
[
"url"
],
state
=
map
[
"state"
],
androidTransaction
=
map
[
"transaction"
];
}
class
WeChatPaymentResponse
{
final
String
errStr
;
final
int
type
;
...
...
lib/src/wechat_type.dart
0 → 100644
浏览文件 @
474a50e3
/*
* 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.
*/
///[WXMiniProgramType.RELEASE]正式版
///[WXMiniProgramType.TEST]测试版
///[WXMiniProgramType.PREVIEW]预览版
enum
WXMiniProgramType
{
RELEASE
,
TEST
,
PREVIEW
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论