Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:OpenFlutter/fluwx into dev
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	pubspec.yaml
  • Loading branch information
JarvanMo committed Nov 22, 2020
2 parents e210c9d + 7b74b14 commit 37c7526
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.4.0
* 支持compressThumbnail
* 升级OkHttp

## 2.3.1
* 修复Android 11无法分享图片的问题

Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.8'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'top.zibin:Luban:1.1.8'
implementation 'com.squareup.okhttp3:okhttp:4.8.0'
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
testImplementation 'junit:junit:4.12'
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ internal interface FluwxShareHandler : CoroutineScope {
sourceByteArray.isEmpty() -> {
WXImageObject()
}
sourceByteArray.size > 500 * 1024 -> {
else -> {
WXImageObject().apply {
if (supportFileProvider && targetHigherThanN) {
setImagePath(getFileContentUri(sourceByteArray.toCacheFile(context, sourceImage.suffix)))
Expand All @@ -147,9 +147,6 @@ internal interface FluwxShareHandler : CoroutineScope {
}
}
}
else -> {
WXImageObject(sourceByteArray)
}
}
val msg = WXMediaMessage()
msg.mediaObject = imageObject
Expand Down
1 change: 1 addition & 0 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ if (localPropertiesFile.exists()) {

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {

throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

Expand Down
2 changes: 2 additions & 0 deletions ios/Classes/FluwxAuthHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@
- (void)authByQRCode:(FlutterMethodCall *)call result:(FlutterResult)result;

- (void)stopAuthByQRCode:(FlutterMethodCall *)call result:(FlutterResult)result;

- (void)handAuthByPhoneLogin:(FlutterMethodCall*)call result:(FlutterResult)result;
@end
10 changes: 10 additions & 0 deletions ios/Classes/FluwxAuthHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ - (instancetype)initWithRegistrar:(NSObject <FlutterPluginRegistrar> *)registrar
return self;
}

- (void)handleAuthByPhoneLogin:(FlutterMethodCall*)call result:(FlutterResult)result{
UIViewController *vc = UIApplication.sharedApplication.keyWindow.rootViewController;
SendAuthReq *authReq = [[SendAuthReq alloc]init];
authReq.scope = call.arguments[@"scope"];
authReq.state = (call.arguments[@"state"] == (id) [NSNull null]) ? nil : call.arguments[@"state"];
[WXApi sendAuthReq:authReq viewController:vc delegate:[FluwxResponseHandler defaultManager] completion:^(BOOL success) {
result(@(success));
}];
}

- (void)handleAuth:(FlutterMethodCall *)call result:(FlutterResult)result {
NSString *openId = call.arguments[@"openId"];

Expand Down
3 changes: 3 additions & 0 deletions ios/Classes/FluwxPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
[self handleSubscribeWithCall:call result:result];
} else if ([@"autoDeduct" isEqualToString:call.method]) {
[self handleAutoDeductWithCall:call result:result];
}else if([@"authByPhoneLogin" isEqualToString:call.method]){
[_fluwxAuthHandler handleAuthByPhoneLogin:call result:result];
} else if ([call.method hasPrefix:@"share"]) {
[_fluwxShareHandler handleShare:call result:result];
} else {
Expand Down Expand Up @@ -178,6 +180,7 @@ - (void)handleAutoDeductWithCall:(FlutterMethodCall *)call result:(FlutterResult
}];
}


- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [WXApi handleOpenURL:url delegate:[FluwxResponseHandler defaultManager]];
}
Expand Down
7 changes: 7 additions & 0 deletions lib/src/fluwx_iml.dart
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,10 @@ Future _methodHandler(MethodCall methodCall) {
_weChatResponseEventHandlerController.add(response);
return Future.value();
}

///IOS only
Future<bool> authWeChatByPhoneLogin(
{@required String scope, String state}) async {
return await _channel
.invokeMethod("authByPhoneLogin", {"scope": scope, "state": state});
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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.
version: 2.3.1
version: 2.4.0
homepage: https://github.com/JarvanMo/fluwx

environment:
Expand Down

0 comments on commit 37c7526

Please sign in to comment.