提交 408c89ea authored 作者: JarvanMo's avatar JarvanMo

reformat code

上级 0ca4864c
...@@ -105,8 +105,8 @@ class FluwxPlugin(private val registrar: Registrar, channel: MethodChannel) : Me ...@@ -105,8 +105,8 @@ class FluwxPlugin(private val registrar: Registrar, channel: MethodChannel) : Me
return return
} }
if ("openWXApp" == call.method){ if ("openWXApp" == call.method) {
val isSent = WXAPiHandler.wxApi?.openWXApp()?:false val isSent = WXAPiHandler.wxApi?.openWXApp() ?: false
result.success(isSent) result.success(isSent)
return return
} }
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package com.jarvan.fluwx.handler package com.jarvan.fluwx.handler
import android.util.Log
import com.tencent.mm.opensdk.diffdev.DiffDevOAuthFactory import com.tencent.mm.opensdk.diffdev.DiffDevOAuthFactory
import com.tencent.mm.opensdk.diffdev.OAuthErrCode import com.tencent.mm.opensdk.diffdev.OAuthErrCode
import com.tencent.mm.opensdk.diffdev.OAuthListener import com.tencent.mm.opensdk.diffdev.OAuthListener
...@@ -81,7 +80,7 @@ internal class FluwxAuthHandler(private val methodChannel: MethodChannel) { ...@@ -81,7 +80,7 @@ internal class FluwxAuthHandler(private val methodChannel: MethodChannel) {
result.success(qrCodeAuth.stopAuth()) result.success(qrCodeAuth.stopAuth())
} }
fun removeAllListeners(){ fun removeAllListeners() {
qrCodeAuth.removeAllListeners() qrCodeAuth.removeAllListeners()
} }
......
...@@ -3,13 +3,13 @@ package com.jarvan.fluwx.handler ...@@ -3,13 +3,13 @@ package com.jarvan.fluwx.handler
import com.tencent.mm.opensdk.modelbiz.WXOpenBusinessWebview import com.tencent.mm.opensdk.modelbiz.WXOpenBusinessWebview
import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel import io.flutter.plugin.common.MethodChannel
import java.util.HashMap import java.util.*
class FluwxAutoDeductHandler { class FluwxAutoDeductHandler {
fun signAutoDeduct(call: MethodCall, result: MethodChannel.Result) { fun signAutoDeduct(call: MethodCall, result: MethodChannel.Result) {
val appId:String = call.argument<String>("appid") ?: "" val appId: String = call.argument<String>("appid") ?: ""
val mchId = call.argument<String>("mch_id") ?: "" val mchId = call.argument<String>("mch_id") ?: ""
val planId = call.argument<String>("plan_id") ?: "" val planId = call.argument<String>("plan_id") ?: ""
val contractCode = call.argument<String>("contract_code") ?: "" val contractCode = call.argument<String>("contract_code") ?: ""
...@@ -20,9 +20,9 @@ class FluwxAutoDeductHandler { ...@@ -20,9 +20,9 @@ class FluwxAutoDeductHandler {
val sign = call.argument<String>("sign") ?: "" val sign = call.argument<String>("sign") ?: ""
val timestamp = call.argument<String>("timestamp") ?: "" val timestamp = call.argument<String>("timestamp") ?: ""
val returnApp = call.argument<String>("return_app") ?: "" val returnApp = call.argument<String>("return_app") ?: ""
val businessType = call.argument<Int>("businessType")?:12 val businessType = call.argument<Int>("businessType") ?: 12
val map = HashMap<String,String>() val map = HashMap<String, String>()
map["appid"] = appId map["appid"] = appId
map["mch_id"] = mchId map["mch_id"] = mchId
map["plan_id"] = planId map["plan_id"] = planId
......
...@@ -25,7 +25,7 @@ object FluwxRequestHandler { ...@@ -25,7 +25,7 @@ object FluwxRequestHandler {
registrar = reg registrar = reg
} }
fun getRegistrar():PluginRegistry.Registrar?{ fun getRegistrar(): PluginRegistry.Registrar? {
return registrar; return registrar;
} }
......
...@@ -133,7 +133,7 @@ object FluwxResponseHandler { ...@@ -133,7 +133,7 @@ object FluwxResponseHandler {
} }
private fun handlerWXOpenBusinessWebviewResponse(response:WXOpenBusinessWebview.Resp){ private fun handlerWXOpenBusinessWebviewResponse(response: WXOpenBusinessWebview.Resp) {
val result = mapOf( val result = mapOf(
WechatPluginKeys.PLATFORM to WechatPluginKeys.ANDROID, WechatPluginKeys.PLATFORM to WechatPluginKeys.ANDROID,
errCode to response.errCode, errCode to response.errCode,
......
...@@ -168,8 +168,8 @@ internal class FluwxShareHandler { ...@@ -168,8 +168,8 @@ internal class FluwxShareHandler {
private suspend fun getThumbnailByteArray(imageData: ByteArray): ByteArray { private suspend fun getThumbnailByteArray(imageData: ByteArray): ByteArray {
return GlobalScope.async(Dispatchers.Default, CoroutineStart.DEFAULT) { return GlobalScope.async(Dispatchers.Default, CoroutineStart.DEFAULT) {
val bitmap = BitmapFactory.decodeByteArray(imageData,0,imageData.size) val bitmap = BitmapFactory.decodeByteArray(imageData, 0, imageData.size)
val bmp = ThumbnailCompressUtil.createScaledBitmapWithRatio(bitmap,WeChatThumbnailUtil.SHARE_IMAGE_THUMB_LENGTH,false) val bmp = ThumbnailCompressUtil.createScaledBitmapWithRatio(bitmap, WeChatThumbnailUtil.SHARE_IMAGE_THUMB_LENGTH, false)
if (bmp == null) { if (bmp == null) {
byteArrayOf() byteArrayOf()
} else { } else {
...@@ -190,11 +190,9 @@ internal class FluwxShareHandler { ...@@ -190,11 +190,9 @@ internal class FluwxShareHandler {
} }
val imgObj = if (byteArray != null && byteArray.isNotEmpty()) { val imgObj = if (byteArray != null && byteArray.isNotEmpty()) {
if (byteArray.size > 512 * 1024){ if (byteArray.size > 512 * 1024) {
val input = ByteArrayInputStream(byteArray) val input = ByteArrayInputStream(byteArray)
val suffix = when { val suffix = when {
...@@ -203,11 +201,11 @@ internal class FluwxShareHandler { ...@@ -203,11 +201,11 @@ internal class FluwxShareHandler {
else -> imagePath.substring(imagePath.lastIndexOf(".")) else -> imagePath.substring(imagePath.lastIndexOf("."))
} }
val file = ShareImageUtil.inputStreamToFile(input,suffix,registrar!!.context()) val file = ShareImageUtil.inputStreamToFile(input, suffix, registrar!!.context())
WXImageObject().apply { WXImageObject().apply {
setImagePath(file.absolutePath) setImagePath(file.absolutePath)
} }
}else{ } else {
WXImageObject(byteArray) WXImageObject(byteArray)
} }
......
...@@ -15,24 +15,19 @@ ...@@ -15,24 +15,19 @@
*/ */
package com.jarvan.fluwx.utils; package com.jarvan.fluwx.utils;
import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.content.res.AssetFileDescriptor; import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.provider.MediaStore;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.jarvan.fluwx.constant.WeChatPluginImageSchema; import com.jarvan.fluwx.constant.WeChatPluginImageSchema;
import com.jarvan.fluwx.constant.WechatPluginKeys; import com.jarvan.fluwx.constant.WechatPluginKeys;
import java.io.ByteArrayInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
...@@ -136,7 +131,7 @@ public class ShareImageUtil { ...@@ -136,7 +131,7 @@ public class ShareImageUtil {
if (externalFile == null) { if (externalFile == null) {
return null; return null;
} }
file = new File(externalFile.getAbsolutePath()+File.separator+UUID.randomUUID().toString()+suffix); file = new File(externalFile.getAbsolutePath() + File.separator + UUID.randomUUID().toString() + suffix);
// file = File.createTempFile(UUID.randomUUID().toString(), suffix); // file = File.createTempFile(UUID.randomUUID().toString(), suffix);
...@@ -177,11 +172,9 @@ public class ShareImageUtil { ...@@ -177,11 +172,9 @@ public class ShareImageUtil {
} }
private static InputStream openStream(String url) { private static InputStream openStream(String url) {
if(!url.startsWith("https") && !url.startsWith("http")){ if (!url.startsWith("https") && !url.startsWith("http")) {
url = "http://"+url; url = "http://" + url;
} }
OkHttpClient okHttpClient = new OkHttpClient.Builder().build(); OkHttpClient okHttpClient = new OkHttpClient.Builder().build();
Request request = new Request.Builder().url(url).get().build(); Request request = new Request.Builder().url(url).get().build();
......
...@@ -84,7 +84,7 @@ public class WeChatThumbnailUtil { ...@@ -84,7 +84,7 @@ public class WeChatThumbnailUtil {
public static byte[] thumbnailForCommon(String thumbnail, PluginRegistry.Registrar registrar) { public static byte[] thumbnailForCommon(String thumbnail, PluginRegistry.Registrar registrar) {
File file; File file;
if(thumbnail == null || thumbnail.isEmpty()) { if (thumbnail == null || thumbnail.isEmpty()) {
return null; return null;
} else if (thumbnail.startsWith(WeChatPluginImageSchema.SCHEMA_ASSETS)) { } else if (thumbnail.startsWith(WeChatPluginImageSchema.SCHEMA_ASSETS)) {
file = getAssetFile(thumbnail, registrar); file = getAssetFile(thumbnail, registrar);
...@@ -227,8 +227,8 @@ public class WeChatThumbnailUtil { ...@@ -227,8 +227,8 @@ public class WeChatThumbnailUtil {
private static File downloadImage(String url) { private static File downloadImage(String url) {
if(!url.startsWith("https") && !url.startsWith("http")){ if (!url.startsWith("https") && !url.startsWith("http")) {
url = "http://"+url; url = "http://" + url;
} }
File result = null; File result = null;
......
...@@ -62,7 +62,7 @@ open class FluwxWXEntryActivity : Activity(), IWXAPIEventHandler { ...@@ -62,7 +62,7 @@ open class FluwxWXEntryActivity : Activity(), IWXAPIEventHandler {
// FIXME: 可能是官方的Bug,从微信拉起APP的Intent类型不对,无法跳转回Flutter Activity // FIXME: 可能是官方的Bug,从微信拉起APP的Intent类型不对,无法跳转回Flutter Activity
// 稳定复现场景:微信版本为7.0.5,小程序SDK为2.7.7 // 稳定复现场景:微信版本为7.0.5,小程序SDK为2.7.7
val activity = FluwxRequestHandler.getRegistrar()?.activity() val activity = FluwxRequestHandler.getRegistrar()?.activity()
if (baseReq.type == 4 && activity is Activity){ if (baseReq.type == 4 && activity is Activity) {
// com.tencent.mm.opensdk.constants.ConstantsAPI.COMMAND_SHOWMESSAGE_FROM_WX = 4 // com.tencent.mm.opensdk.constants.ConstantsAPI.COMMAND_SHOWMESSAGE_FROM_WX = 4
startActivity(Intent(this, activity::class.java)) startActivity(Intent(this, activity::class.java))
finish() finish()
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#import "FluwxPaymentHandler.h" #import "FluwxPaymentHandler.h"
#import "FluwxMethods.h" #import "FluwxMethods.h"
#import "FluwxKeys.h"
#import "FluwxWXApiHandler.h" #import "FluwxWXApiHandler.h"
#import "FluwxShareHandler.h" #import "FluwxShareHandler.h"
#import "FluwxLaunchMiniProgramHandler.h" #import "FluwxLaunchMiniProgramHandler.h"
......
...@@ -7,5 +7,6 @@ ...@@ -7,5 +7,6 @@
extern NSString *const resultDone; extern NSString *const resultDone;
extern NSString *const resultErrorNeedWeChat; extern NSString *const resultErrorNeedWeChat;
extern NSString *const resultMessageNeedWeChat; extern NSString *const resultMessageNeedWeChat;
@interface CallResults : NSObject @interface CallResults : NSObject
@end @end
\ No newline at end of file
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
NSString *const resultDone = @"done"; NSString *const resultDone = @"done";
NSString *const resultErrorNeedWeChat = @"wxapi not configured"; NSString *const resultErrorNeedWeChat = @"wxapi not configured";
NSString *const resultMessageNeedWeChat = @"please config wxapi first"; NSString *const resultMessageNeedWeChat = @"please config wxapi first";
@implementation CallResults { @implementation CallResults {
} }
......
...@@ -19,14 +19,14 @@ NSString *const fluwxKeyDescription = @"description"; ...@@ -19,14 +19,14 @@ NSString *const fluwxKeyDescription = @"description";
NSString *const fluwxKeyPackage = @"?package="; NSString *const fluwxKeyPackage = @"?package=";
NSString *const fluwxKeyMessageExt =@"messageExt"; NSString *const fluwxKeyMessageExt = @"messageExt";
NSString *const fluwxKeyMediaTagName = @"mediaTagName "; NSString *const fluwxKeyMediaTagName = @"mediaTagName ";
NSString *const fluwxKeyMessageAction = @"messageAction"; NSString *const fluwxKeyMessageAction = @"messageAction";
NSString *const fluwxKeyPlatform = @"platform"; NSString *const fluwxKeyPlatform = @"platform";
NSString *const fluwxKeyIOS=@"iOS"; NSString *const fluwxKeyIOS = @"iOS";
NSString *const fluwxKeyResult=@"result"; NSString *const fluwxKeyResult = @"result";
@implementation FluwxKeys { @implementation FluwxKeys {
......
...@@ -14,6 +14,7 @@ NSString *const shareVideo = @"shareVideo"; ...@@ -14,6 +14,7 @@ NSString *const shareVideo = @"shareVideo";
NSString *const shareWebPage = @"shareWebPage"; NSString *const shareWebPage = @"shareWebPage";
NSString *const shareMiniProgram = @"shareMiniProgram"; NSString *const shareMiniProgram = @"shareMiniProgram";
NSString *const LaunchMiniProgram = @"launchMiniProgram"; NSString *const LaunchMiniProgram = @"launchMiniProgram";
@implementation FluwxMethods { @implementation FluwxMethods {
......
...@@ -53,7 +53,7 @@ FlutterMethodChannel *_fluwxMethodChannel = nil; ...@@ -53,7 +53,7 @@ FlutterMethodChannel *_fluwxMethodChannel = nil;
} }
- (void)onAuthGotQrcode:(UIImage *)image { - (void)onAuthGotQrcode:(UIImage *)image {
NSData * imageData = UIImagePNGRepresentation(image); NSData *imageData = UIImagePNGRepresentation(image);
// if (imageData == nil) { // if (imageData == nil) {
// imageData = UIImageJPEGRepresentation(image, 1); // imageData = UIImageJPEGRepresentation(image, 1);
// } // }
...@@ -62,9 +62,9 @@ FlutterMethodChannel *_fluwxMethodChannel = nil; ...@@ -62,9 +62,9 @@ FlutterMethodChannel *_fluwxMethodChannel = nil;
} }
- (void)onAuthFinish:(int)errCode AuthCode:(nullable NSString *)authCode { - (void)onAuthFinish:(int)errCode AuthCode:(nullable NSString *)authCode {
NSDictionary *errorCode = @{@"errCode":@(errCode)}; NSDictionary *errorCode = @{@"errCode": @(errCode)};
NSMutableDictionary *result = [NSMutableDictionary dictionaryWithDictionary:errorCode]; NSMutableDictionary *result = [NSMutableDictionary dictionaryWithDictionary:errorCode];
if(authCode != nil){ if (authCode != nil) {
result[@"authCode"] = authCode; result[@"authCode"] = authCode;
} }
[_fluwxMethodChannel invokeMethod:@"onAuthByQRCodeFinished" arguments:result]; [_fluwxMethodChannel invokeMethod:@"onAuthByQRCodeFinished" arguments:result];
......
...@@ -19,12 +19,12 @@ ...@@ -19,12 +19,12 @@
return self; return self;
} }
-(void)handleAutoDeductWithCall:(FlutterMethodCall *)call result:(FlutterResult)result { - (void)handleAutoDeductWithCall:(FlutterMethodCall *)call result:(FlutterResult)result {
NSDictionary *params = call.arguments; NSDictionary *params = call.arguments;
NSMutableDictionary *paramsFromDart = [NSMutableDictionary dictionaryWithDictionary:call.arguments]; NSMutableDictionary *paramsFromDart = [NSMutableDictionary dictionaryWithDictionary:call.arguments];
[paramsFromDart removeObjectForKey:@"businessType"]; [paramsFromDart removeObjectForKey:@"businessType"];
WXOpenBusinessWebViewReq *req = [[WXOpenBusinessWebViewReq alloc] init]; WXOpenBusinessWebViewReq *req = [[WXOpenBusinessWebViewReq alloc] init];
NSNumber * businessType = call.arguments[@"businessType"]; NSNumber *businessType = call.arguments[@"businessType"];
req.businessType = [businessType unsignedIntValue]; req.businessType = [businessType unsignedIntValue];
req.queryInfoDic = paramsFromDart; req.queryInfoDic = paramsFromDart;
BOOL b = [WXApi sendReq:req]; BOOL b = [WXApi sendReq:req];
...@@ -32,23 +32,22 @@ ...@@ -32,23 +32,22 @@
result(@(b)); result(@(b));
} }
-(NSString *)convertToJsonData:(NSDictionary *)dict - (NSString *)convertToJsonData:(NSDictionary *)dict {
{
NSError *error; NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:&error]; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:&error];
NSString *jsonString; NSString *jsonString;
if (!jsonData) { if (!jsonData) {
NSLog(@"%@",error); NSLog(@"%@", error);
}else{ } else {
jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding]; jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
} }
NSMutableString *mutStr = [NSMutableString stringWithString:jsonString]; NSMutableString *mutStr = [NSMutableString stringWithString:jsonString];
// NSRange range = {0,jsonString.length}; // NSRange range = {0,jsonString.length};
// //去掉字符串中的空格 // //去掉字符串中的空格
// [mutStr replaceOccurrencesOfString:@" " withString:@"" options:NSLiteralSearch range:range]; // [mutStr replaceOccurrencesOfString:@" " withString:@"" options:NSLiteralSearch range:range];
NSRange range2 = {0,mutStr.length}; NSRange range2 = {0, mutStr.length};
//去掉字符串中的换行符 //去掉字符串中的换行符
[mutStr replaceOccurrencesOfString:@"\n" withString:@"" options:NSLiteralSearch range:range2]; [mutStr replaceOccurrencesOfString:@"\n" withString:@"" options:NSLiteralSearch range:range2];
......
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
NSNumber *typeInt = call.arguments[@"miniProgramType"]; NSNumber *typeInt = call.arguments[@"miniProgramType"];
WXMiniProgramType miniProgramType = WXMiniProgramTypeRelease; WXMiniProgramType miniProgramType = WXMiniProgramTypeRelease;
if([typeInt isEqualToNumber:@1]){ if ([typeInt isEqualToNumber:@1]) {
miniProgramType =WXMiniProgramTypeTest; miniProgramType = WXMiniProgramTypeTest;
} else if([typeInt isEqualToNumber:@2]){ } else if ([typeInt isEqualToNumber:@2]) {
miniProgramType = WXMiniProgramTypePreview; miniProgramType = WXMiniProgramTypePreview;
} }
......
...@@ -3,16 +3,12 @@ ...@@ -3,16 +3,12 @@
// //
#import "FluwxPaymentHandler.h" #import "FluwxPaymentHandler.h"
#import "ThumbnailHelper.h"
#import "NSStringWrapper.h"
#import "CallResults.h" #import "CallResults.h"
#import "FluwxKeys.h" #import "FluwxKeys.h"
#import "StringToWeChatScene.h"
#import "FluwxMethods.h"
@implementation FluwxPaymentHandler @implementation FluwxPaymentHandler
- (instancetype)initWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar { - (instancetype)initWithRegistrar:(NSObject <FlutterPluginRegistrar> *)registrar {
self = [super init]; self = [super init];
return self; return self;
...@@ -27,8 +23,7 @@ ...@@ -27,8 +23,7 @@
} }
NSNumber *timestamp = call.arguments[@"timeStamp"];
NSNumber * timestamp = call.arguments[@"timeStamp"];
NSString *partnerId = call.arguments[@"partnerId"]; NSString *partnerId = call.arguments[@"partnerId"];
NSString *prepayId = call.arguments[@"prepayId"]; NSString *prepayId = call.arguments[@"prepayId"];
......
...@@ -53,7 +53,7 @@ NSObject <FlutterPluginRegistrar> *_registrar; ...@@ -53,7 +53,7 @@ NSObject <FlutterPluginRegistrar> *_registrar;
[self shareMusic:call result:result]; [self shareMusic:call result:result];
} else if ([shareVideo isEqualToString:call.method]) { } else if ([shareVideo isEqualToString:call.method]) {
[self shareVideo:call result:result]; [self shareVideo:call result:result];
} else if([shareMiniProgram isEqualToString:call.method]){ } else if ([shareMiniProgram isEqualToString:call.method]) {
[self shareMiniProgram:call result:result]; [self shareMiniProgram:call result:result];
} }
...@@ -70,7 +70,7 @@ NSObject <FlutterPluginRegistrar> *_registrar; ...@@ -70,7 +70,7 @@ NSObject <FlutterPluginRegistrar> *_registrar;
- (void)shareImage:(FlutterMethodCall *)call result:(FlutterResult)result { - (void)shareImage:(FlutterMethodCall *)call result:(FlutterResult)result {
NSString *imagePath = call.arguments[fluwxKeyImage]; NSString *imagePath = call.arguments[fluwxKeyImage];
if ([StringUtil isBlank:imagePath]) { if ([StringUtil isBlank:imagePath]) {
NSData *imageData = ((FlutterStandardTypedData)call.arguments[fluwxKeyImageData]).data; NSData *imageData = ((FlutterStandardTypedData) call.arguments[fluwxKeyImageData]).data;
[self shareMemoryImage:call result:result imageData:imageData]; [self shareMemoryImage:call result:result imageData:imageData];
} else if ([imagePath hasPrefix:SCHEMA_ASSETS]) { } else if ([imagePath hasPrefix:SCHEMA_ASSETS]) {
[self shareAssetImage:call result:result imagePath:imagePath]; [self shareAssetImage:call result:result imagePath:imagePath];
...@@ -97,7 +97,7 @@ NSObject <FlutterPluginRegistrar> *_registrar; ...@@ -97,7 +97,7 @@ NSObject <FlutterPluginRegistrar> *_registrar;
dispatch_queue_t globalQueue = dispatch_get_global_queue(0, 0); dispatch_queue_t globalQueue = dispatch_get_global_queue(0, 0);
dispatch_async(globalQueue, ^{ dispatch_async(globalQueue, ^{
if(thumbnailImage == nil) if (thumbnailImage == nil)
*thumbnailImage = [self getThumbnail:thumbnail size:32 * 1024]; *thumbnailImage = [self getThumbnail:thumbnail size:32 * 1024];
...@@ -209,7 +209,6 @@ NSObject <FlutterPluginRegistrar> *_registrar; ...@@ -209,7 +209,6 @@ NSObject <FlutterPluginRegistrar> *_registrar;
} }
- (void)shareAssetImage:(FlutterMethodCall *)call result:(FlutterResult)result imagePath:(NSString *)imagePath { - (void)shareAssetImage:(FlutterMethodCall *)call result:(FlutterResult)result imagePath:(NSString *)imagePath {
...@@ -347,7 +346,7 @@ NSObject <FlutterPluginRegistrar> *_registrar; ...@@ -347,7 +346,7 @@ NSObject <FlutterPluginRegistrar> *_registrar;
} }
- (void)shareMiniProgram:(FlutterMethodCall *)call result:(FlutterResult)result { - (void)shareMiniProgram:(FlutterMethodCall *)call result:(FlutterResult)result {
dispatch_queue_t globalQueue = dispatch_get_global_queue(0,0); dispatch_queue_t globalQueue = dispatch_get_global_queue(0, 0);
dispatch_async(globalQueue, ^{ dispatch_async(globalQueue, ^{
NSString *thumbnail = call.arguments[fluwxKeyThumbnail]; NSString *thumbnail = call.arguments[fluwxKeyThumbnail];
...@@ -382,9 +381,9 @@ NSObject <FlutterPluginRegistrar> *_registrar; ...@@ -382,9 +381,9 @@ NSObject <FlutterPluginRegistrar> *_registrar;
NSNumber *typeInt = call.arguments[@"miniProgramType"]; NSNumber *typeInt = call.arguments[@"miniProgramType"];
WXMiniProgramType miniProgramType = WXMiniProgramTypeRelease; WXMiniProgramType miniProgramType = WXMiniProgramTypeRelease;
if([typeInt isEqualToNumber:@1]){ if ([typeInt isEqualToNumber:@1]) {
miniProgramType =WXMiniProgramTypeTest; miniProgramType = WXMiniProgramTypeTest;
} else if([typeInt isEqualToNumber:@2]){ } else if ([typeInt isEqualToNumber:@2]) {
miniProgramType = WXMiniProgramTypePreview; miniProgramType = WXMiniProgramTypePreview;
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
isWeChatRegistered = [WXApi registerApp:appId enableMTA:[call.arguments[@"enableMTA"] boolValue]]; isWeChatRegistered = [WXApi registerApp:appId enableMTA:[call.arguments[@"enableMTA"] boolValue]];
UInt64 typeFlag = MMAPP_SUPPORT_TEXT | MMAPP_SUPPORT_PICTURE | MMAPP_SUPPORT_LOCATION | MMAPP_SUPPORT_VIDEO |MMAPP_SUPPORT_AUDIO | MMAPP_SUPPORT_WEBPAGE | MMAPP_SUPPORT_DOC | MMAPP_SUPPORT_DOCX | MMAPP_SUPPORT_PPT | MMAPP_SUPPORT_PPTX | MMAPP_SUPPORT_XLS | MMAPP_SUPPORT_XLSX | MMAPP_SUPPORT_PDF; UInt64 typeFlag = MMAPP_SUPPORT_TEXT | MMAPP_SUPPORT_PICTURE | MMAPP_SUPPORT_LOCATION | MMAPP_SUPPORT_VIDEO | MMAPP_SUPPORT_AUDIO | MMAPP_SUPPORT_WEBPAGE | MMAPP_SUPPORT_DOC | MMAPP_SUPPORT_DOCX | MMAPP_SUPPORT_PPT | MMAPP_SUPPORT_PPTX | MMAPP_SUPPORT_XLS | MMAPP_SUPPORT_XLSX | MMAPP_SUPPORT_PDF;
[WXApi registerAppSupportContentFlag:typeFlag]; [WXApi registerAppSupportContentFlag:typeFlag];
result(@{fluwxKeyPlatform: fluwxKeyIOS, fluwxKeyResult: @(isWeChatRegistered)}); result(@{fluwxKeyPlatform: fluwxKeyIOS, fluwxKeyResult: @(isWeChatRegistered)});
} }
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
if (!isWeChatRegistered) { if (!isWeChatRegistered) {
result([FlutterError errorWithCode:resultErrorNeedWeChat message:@"please config wxapi first" details:nil]); result([FlutterError errorWithCode:resultErrorNeedWeChat message:@"please config wxapi first" details:nil]);
return; return;
}else{ } else {
result(@([WXApi isWXAppInstalled])); result(@([WXApi isWXAppInstalled]));
} }
} }
......
...@@ -7,11 +7,13 @@ ...@@ -7,11 +7,13 @@
// //
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#define JavaNotFound -1 #define JavaNotFound -1
@interface NSString(Wrapper)
@interface NSString (Wrapper)
/** Return the char value at the specified index. */ /** Return the char value at the specified index. */
- (unichar) charAt:(int)index; - (unichar)charAt:(int)index;
/** /**
* Compares two strings lexicographically. * Compares two strings lexicographically.
...@@ -19,46 +21,46 @@ ...@@ -19,46 +21,46 @@
* a value less than 0 if this string is lexicographically less than the string argument; * a value less than 0 if this string is lexicographically less than the string argument;
* and a value greater than 0 if this string is lexicographically greater than the string argument. * and a value greater than 0 if this string is lexicographically greater than the string argument.
*/ */
- (int) compareTo:(NSString*) anotherString; - (int)compareTo:(NSString *)anotherString;
- (int) compareToIgnoreCase:(NSString*) str; - (int)compareToIgnoreCase:(NSString *)str;
- (BOOL) contains:(NSString*) str; - (BOOL)contains:(NSString *)str;
- (BOOL) startsWith:(NSString*)prefix; - (BOOL)startsWith:(NSString *)prefix;
- (BOOL) endsWith:(NSString*)suffix; - (BOOL)endsWith:(NSString *)suffix;
- (BOOL) equals:(NSString*) anotherString; - (BOOL)equals:(NSString *)anotherString;
- (BOOL) equalsIgnoreCase:(NSString*) anotherString; - (BOOL)equalsIgnoreCase:(NSString *)anotherString;
- (int) indexOfChar:(unichar)ch; - (int)indexOfChar:(unichar)ch;
- (int) indexOfChar:(unichar)ch fromIndex:(int)index; - (int)indexOfChar:(unichar)ch fromIndex:(int)index;
- (int) indexOfString:(NSString*)str; - (int)indexOfString:(NSString *)str;
- (int) indexOfString:(NSString*)str fromIndex:(int)index; - (int)indexOfString:(NSString *)str fromIndex:(int)index;
- (int) lastIndexOfChar:(unichar)ch; - (int)lastIndexOfChar:(unichar)ch;
- (int) lastIndexOfChar:(unichar)ch fromIndex:(int)index; - (int)lastIndexOfChar:(unichar)ch fromIndex:(int)index;
- (int) lastIndexOfString:(NSString*)str; - (int)lastIndexOfString:(NSString *)str;
- (int) lastIndexOfString:(NSString*)str fromIndex:(int)index; - (int)lastIndexOfString:(NSString *)str fromIndex:(int)index;
- (NSString *) substringFromIndex:(int)beginIndex toIndex:(int)endIndex; - (NSString *)substringFromIndex:(int)beginIndex toIndex:(int)endIndex;
- (NSString *) toLowerCase; - (NSString *)toLowerCase;
- (NSString *) toUpperCase; - (NSString *)toUpperCase;
- (NSString *) trim; - (NSString *)trim;
- (NSString *) replaceAll:(NSString*)origin with:(NSString*)replacement; - (NSString *)replaceAll:(NSString *)origin with:(NSString *)replacement;
- (NSArray *) split:(NSString*) separator; - (NSArray *)split:(NSString *)separator;
@end @end
...@@ -8,12 +8,11 @@ ...@@ -8,12 +8,11 @@
#import "NSStringWrapper.h" #import "NSStringWrapper.h"
@implementation NSString(Wrapper) @implementation NSString (Wrapper)
/** Java-like method. Returns the char value at the specified index. */ /** Java-like method. Returns the char value at the specified index. */
- (unichar) charAt:(int)index { - (unichar)charAt:(int)index {
return [self characterAtIndex:index]; return [self characterAtIndex:index];
} }
...@@ -23,42 +22,42 @@ ...@@ -23,42 +22,42 @@
* a value less than 0 if this string is lexicographically less than the string argument; * a value less than 0 if this string is lexicographically less than the string argument;
* and a value greater than 0 if this string is lexicographically greater than the string argument. * and a value greater than 0 if this string is lexicographically greater than the string argument.
*/ */
- (int) compareTo:(NSString*) anotherString { - (int)compareTo:(NSString *)anotherString {
return [self compare:anotherString]; return [self compare:anotherString];
} }
/** Java-like method. Compares two strings lexicographically, ignoring case differences. */ /** Java-like method. Compares two strings lexicographically, ignoring case differences. */
- (int) compareToIgnoreCase:(NSString*) str { - (int)compareToIgnoreCase:(NSString *)str {
return [self compare:str options:NSCaseInsensitiveSearch]; return [self compare:str options:NSCaseInsensitiveSearch];
} }
/** Java-like method. Returns true if and only if this string contains the specified sequence of char values. */ /** Java-like method. Returns true if and only if this string contains the specified sequence of char values. */
- (BOOL) contains:(NSString*) str { - (BOOL)contains:(NSString *)str {
NSRange range = [self rangeOfString:str]; NSRange range = [self rangeOfString:str];
return (range.location != NSNotFound); return (range.location != NSNotFound);
} }
- (BOOL) startsWith:(NSString*)prefix { - (BOOL)startsWith:(NSString *)prefix {
return [self hasPrefix:prefix]; return [self hasPrefix:prefix];
} }
- (BOOL) endsWith:(NSString*)suffix { - (BOOL)endsWith:(NSString *)suffix {
return [self hasSuffix:suffix]; return [self hasSuffix:suffix];
} }
- (BOOL) equals:(NSString*) anotherString { - (BOOL)equals:(NSString *)anotherString {
return [self isEqualToString:anotherString]; return [self isEqualToString:anotherString];
} }
- (BOOL) equalsIgnoreCase:(NSString*) anotherString { - (BOOL)equalsIgnoreCase:(NSString *)anotherString {
return [[self toLowerCase] equals:[anotherString toLowerCase]]; return [[self toLowerCase] equals:[anotherString toLowerCase]];
} }
- (int) indexOfChar:(unichar)ch{ - (int)indexOfChar:(unichar)ch {
return [self indexOfChar:ch fromIndex:0]; return [self indexOfChar:ch fromIndex:0];
} }
- (int) indexOfChar:(unichar)ch fromIndex:(int)index{ - (int)indexOfChar:(unichar)ch fromIndex:(int)index {
int len = self.length; int len = self.length;
for (int i = index; i < len; ++i) { for (int i = index; i < len; ++i) {
if (ch == [self charAt:i]) { if (ch == [self charAt:i]) {
...@@ -68,7 +67,7 @@ ...@@ -68,7 +67,7 @@
return JavaNotFound; return JavaNotFound;
} }
- (int) indexOfString:(NSString*)str { - (int)indexOfString:(NSString *)str {
NSRange range = [self rangeOfString:str]; NSRange range = [self rangeOfString:str];
if (range.location == NSNotFound) { if (range.location == NSNotFound) {
return JavaNotFound; return JavaNotFound;
...@@ -76,7 +75,7 @@ ...@@ -76,7 +75,7 @@
return range.location; return range.location;
} }
- (int) indexOfString:(NSString*)str fromIndex:(int)index { - (int)indexOfString:(NSString *)str fromIndex:(int)index {
NSRange fromRange = NSMakeRange(index, self.length - index); NSRange fromRange = NSMakeRange(index, self.length - index);
NSRange range = [self rangeOfString:str options:NSLiteralSearch range:fromRange]; NSRange range = [self rangeOfString:str options:NSLiteralSearch range:fromRange];
if (range.location == NSNotFound) { if (range.location == NSNotFound) {
...@@ -85,9 +84,9 @@ ...@@ -85,9 +84,9 @@
return range.location; return range.location;
} }
- (int) lastIndexOfChar:(unichar)ch { - (int)lastIndexOfChar:(unichar)ch {
int len = self.length; int len = self.length;
for (int i = len-1; i >=0; --i) { for (int i = len - 1; i >= 0; --i) {
if ([self charAt:i] == ch) { if ([self charAt:i] == ch) {
return i; return i;
} }
...@@ -95,7 +94,7 @@ ...@@ -95,7 +94,7 @@
return JavaNotFound; return JavaNotFound;
} }
- (int) lastIndexOfChar:(unichar)ch fromIndex:(int)index { - (int)lastIndexOfChar:(unichar)ch fromIndex:(int)index {
int len = self.length; int len = self.length;
if (index >= len) { if (index >= len) {
index = len - 1; index = len - 1;
...@@ -108,7 +107,7 @@ ...@@ -108,7 +107,7 @@
return JavaNotFound; return JavaNotFound;
} }
- (int) lastIndexOfString:(NSString*)str { - (int)lastIndexOfString:(NSString *)str {
NSRange range = [self rangeOfString:str options:NSBackwardsSearch]; NSRange range = [self rangeOfString:str options:NSBackwardsSearch];
if (range.location == NSNotFound) { if (range.location == NSNotFound) {
return JavaNotFound; return JavaNotFound;
...@@ -116,7 +115,7 @@ ...@@ -116,7 +115,7 @@
return range.location; return range.location;
} }
- (int) lastIndexOfString:(NSString*)str fromIndex:(int)index { - (int)lastIndexOfString:(NSString *)str fromIndex:(int)index {
NSRange fromRange = NSMakeRange(0, index); NSRange fromRange = NSMakeRange(0, index);
NSRange range = [self rangeOfString:str options:NSBackwardsSearch range:fromRange]; NSRange range = [self rangeOfString:str options:NSBackwardsSearch range:fromRange];
if (range.location == NSNotFound) { if (range.location == NSNotFound) {
...@@ -125,7 +124,7 @@ ...@@ -125,7 +124,7 @@
return range.location; return range.location;
} }
- (NSString *) substringFromIndex:(int)beginIndex toIndex:(int)endIndex { - (NSString *)substringFromIndex:(int)beginIndex toIndex:(int)endIndex {
if (endIndex <= beginIndex) { if (endIndex <= beginIndex) {
return @""; return @"";
} }
...@@ -133,23 +132,23 @@ ...@@ -133,23 +132,23 @@
return [self substringWithRange:range]; return [self substringWithRange:range];
} }
- (NSString *) toLowerCase { - (NSString *)toLowerCase {
return [self lowercaseString]; return [self lowercaseString];
} }
- (NSString *) toUpperCase { - (NSString *)toUpperCase {
return [self uppercaseString]; return [self uppercaseString];
} }
- (NSString *) trim { - (NSString *)trim {
return [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; return [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
} }
- (NSString *) replaceAll:(NSString*)origin with:(NSString*)replacement { - (NSString *)replaceAll:(NSString *)origin with:(NSString *)replacement {
return [self stringByReplacingOccurrencesOfString:origin withString:replacement]; return [self stringByReplacingOccurrencesOfString:origin withString:replacement];
} }
- (NSArray *) split:(NSString*) separator { - (NSArray *)split:(NSString *)separator {
return [self componentsSeparatedByString:separator]; return [self componentsSeparatedByString:separator];
} }
......
...@@ -6,5 +6,5 @@ ...@@ -6,5 +6,5 @@
#import "WXApiObject.h" #import "WXApiObject.h"
@interface StringToWeChatScene : NSObject @interface StringToWeChatScene : NSObject
+ (enum WXScene) toScene : (NSString *) string; + (enum WXScene)toScene:(NSString *)string;
@end @end
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
@implementation StringToWeChatScene @implementation StringToWeChatScene
+ (enum WXScene) toScene:(NSString *)string { + (enum WXScene)toScene:(NSString *)string {
if ([string isEqualToString:@"WeChatScene.TIMELINE"]) { if ([string isEqualToString:@"WeChatScene.TIMELINE"]) {
return WXSceneTimeline; return WXSceneTimeline;
}else if ([string isEqualToString:@"WeChatScene.FAVORITE"]) { } else if ([string isEqualToString:@"WeChatScene.FAVORITE"]) {
return WXSceneFavorite; return WXSceneFavorite;
} else { } else {
return WXSceneSession; return WXSceneSession;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
@interface StringUtil : NSObject @interface StringUtil : NSObject
+ (BOOL) isBlank:(NSString *)string; + (BOOL)isBlank:(NSString *)string;
+ (NSString *) nilToEmpty:(NSString *) string;
+ (NSString *)nilToEmpty:(NSString *)string;
@end @end
\ No newline at end of file
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
@implementation StringUtil @implementation StringUtil
+ (BOOL) isBlank:(NSString *)string { + (BOOL)isBlank:(NSString *)string {
if (string == nil) { if (string == nil) {
...@@ -26,6 +26,6 @@ ...@@ -26,6 +26,6 @@
} }
+ (NSString *)nilToEmpty:(NSString *)string { + (NSString *)nilToEmpty:(NSString *)string {
return string == nil?@"":string; return string == nil ? @"" : string;
} }
@end @end
\ No newline at end of file
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
@implementation ThumbnailHelper @implementation ThumbnailHelper
+ (UIImage *)compressImage:(UIImage *)image toByte:(NSUInteger)maxLength isPNG:(BOOL) isPNG{ + (UIImage *)compressImage:(UIImage *)image toByte:(NSUInteger)maxLength isPNG:(BOOL)isPNG {
// Compress by quality // Compress by quality
CGFloat compression = 1; CGFloat compression = 1;
NSData *data = UIImageJPEGRepresentation(image, compression); NSData *data = UIImageJPEGRepresentation(image, compression);
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
} }
} }
UIImage *resultImage ; UIImage *resultImage;
if(isPNG){ if (isPNG) {
NSData *tmp = UIImagePNGRepresentation([UIImage imageWithData:data]); NSData *tmp = UIImagePNGRepresentation([UIImage imageWithData:data]);
resultImage = [UIImage imageWithData:tmp]; resultImage = [UIImage imageWithData:tmp];
} else { } else {
...@@ -42,9 +42,9 @@ ...@@ -42,9 +42,9 @@
NSUInteger lastDataLength = 0; NSUInteger lastDataLength = 0;
while (data.length > maxLength && data.length != lastDataLength) { while (data.length > maxLength && data.length != lastDataLength) {
lastDataLength = data.length; lastDataLength = data.length;
CGFloat ratio = (CGFloat)maxLength / data.length; CGFloat ratio = (CGFloat) maxLength / data.length;
CGSize size = CGSizeMake((NSUInteger)(resultImage.size.width * sqrtf(ratio)), CGSize size = CGSizeMake((NSUInteger) (resultImage.size.width * sqrtf(ratio)),
(NSUInteger)(resultImage.size.height * sqrtf(ratio))); // Use NSUInteger to prevent white blank (NSUInteger) (resultImage.size.height * sqrtf(ratio))); // Use NSUInteger to prevent white blank
UIGraphicsBeginImageContext(size); UIGraphicsBeginImageContext(size);
[resultImage drawInRect:CGRectMake(0, 0, size.width, size.height)]; [resultImage drawInRect:CGRectMake(0, 0, size.width, size.height)];
resultImage = UIGraphicsGetImageFromCurrentImageContext(); resultImage = UIGraphicsGetImageFromCurrentImageContext();
...@@ -56,34 +56,33 @@ ...@@ -56,34 +56,33 @@
} }
- (UIImage*)scaleFromImage:(UIImage*)image width:(CGSize)newSize { - (UIImage *)scaleFromImage:(UIImage *)image width:(CGSize)newSize {
CGSize imageSize = image.size; CGSize imageSize = image.size;
CGFloat width = imageSize.width; CGFloat width = imageSize.width;
CGFloat height = imageSize.height; CGFloat height = imageSize.height;
if (width <= newSize.width && height <= newSize.height){ if (width <= newSize.width && height <= newSize.height) {
return image; return image;
} }
if (width == 0 || height == 0){ if (width == 0 || height == 0) {
return image; return image;
} }
CGFloat widthFactor = newSize.width / width; CGFloat widthFactor = newSize.width / width;
CGFloat heightFactor = newSize.height / height; CGFloat heightFactor = newSize.height / height;
CGFloat scaleFactor = (widthFactor<heightFactor?widthFactor:heightFactor); CGFloat scaleFactor = (widthFactor < heightFactor ? widthFactor : heightFactor);
CGFloat scaledWidth = width * scaleFactor; CGFloat scaledWidth = width * scaleFactor;
CGFloat scaledHeight = height * scaleFactor; CGFloat scaledHeight = height * scaleFactor;
CGSize targetSize = CGSizeMake(scaledWidth,scaledHeight); CGSize targetSize = CGSizeMake(scaledWidth, scaledHeight);
UIGraphicsBeginImageContext(targetSize); UIGraphicsBeginImageContext(targetSize);
[image drawInRect:CGRectMake(0,0,scaledWidth,scaledHeight)]; [image drawInRect:CGRectMake(0, 0, scaledWidth, scaledHeight)];
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext(); UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext(); UIGraphicsEndImageContext();
return newImage; return newImage;
} }
@end @end
\ No newline at end of file
...@@ -12,8 +12,11 @@ ...@@ -12,8 +12,11 @@
@class StringUtil; @class StringUtil;
@interface FluwxAuthHandler : NSObject <WechatAuthAPIDelegate> @interface FluwxAuthHandler : NSObject <WechatAuthAPIDelegate>
-(instancetype) initWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar methodChannel:(FlutterMethodChannel *)flutterMethodChannel; - (instancetype)initWithRegistrar:(NSObject <FlutterPluginRegistrar> *)registrar methodChannel:(FlutterMethodChannel *)flutterMethodChannel;
- (void)handleAuth:(FlutterMethodCall *)call result:(FlutterResult)result; - (void)handleAuth:(FlutterMethodCall *)call result:(FlutterResult)result;
- (void)authByQRCode:(FlutterMethodCall *)call result:(FlutterResult)result; - (void)authByQRCode:(FlutterMethodCall *)call result:(FlutterResult)result;
-(void) stopAuthByQRCode:(FlutterMethodCall *)call result:(FlutterResult)result;
- (void)stopAuthByQRCode:(FlutterMethodCall *)call result:(FlutterResult)result;
@end @end
...@@ -11,8 +11,9 @@ ...@@ -11,8 +11,9 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface FluwxAutoDeductHandler : NSObject @interface FluwxAutoDeductHandler : NSObject
-(instancetype) initWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar; - (instancetype)initWithRegistrar:(NSObject <FlutterPluginRegistrar> *)registrar;
-(void)handleAutoDeductWithCall:(FlutterMethodCall *)call result:(FlutterResult)result;
- (void)handleAutoDeductWithCall:(FlutterMethodCall *)call result:(FlutterResult)result;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
@class StringUtil; @class StringUtil;
@interface FluwxLaunchMiniProgramHandler : NSObject @interface FluwxLaunchMiniProgramHandler : NSObject
-(instancetype) initWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar; - (instancetype)initWithRegistrar:(NSObject <FlutterPluginRegistrar> *)registrar;
- (void)handleLaunchMiniProgram:(FlutterMethodCall *)call result:(FlutterResult)result; - (void)handleLaunchMiniProgram:(FlutterMethodCall *)call result:(FlutterResult)result;
@end @end
\ No newline at end of file
...@@ -7,10 +7,12 @@ ...@@ -7,10 +7,12 @@
#import "FluwxPlugin.h" #import "FluwxPlugin.h"
#import "WXApiRequestHandler.h" #import "WXApiRequestHandler.h"
#import "WXApi.h" #import "WXApi.h"
@class StringUtil; @class StringUtil;
@interface FluwxPaymentHandler : NSObject @interface FluwxPaymentHandler : NSObject
-(instancetype) initWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar; - (instancetype)initWithRegistrar:(NSObject <FlutterPluginRegistrar> *)registrar;
- (void)handlePayment:(FlutterMethodCall *)call result:(FlutterResult)result; - (void)handlePayment:(FlutterMethodCall *)call result:(FlutterResult)result;
@end @end
...@@ -16,14 +16,11 @@ ...@@ -16,14 +16,11 @@
#import <Flutter/Flutter.h> #import <Flutter/Flutter.h>
extern BOOL isWeChatRegistered; extern BOOL isWeChatRegistered;
extern BOOL handleOpenURLByFluwx; extern BOOL handleOpenURLByFluwx;
@interface FluwxPlugin : NSObject<FlutterPlugin> { @interface FluwxPlugin : NSObject <FlutterPlugin> {
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#import "WXApiObject.h" #import "WXApiObject.h"
#import "WXApi.h" #import "WXApi.h"
@protocol WXApiManagerDelegate <NSObject> @protocol WXApiManagerDelegate <NSObject>
@optional @optional
...@@ -44,12 +45,12 @@ ...@@ -44,12 +45,12 @@
- (void)managerDidRecvPaymentResponse:(PayResp *)response; - (void)managerDidRecvPaymentResponse:(PayResp *)response;
@end @end
@interface FluwxResponseHandler : NSObject<WXApiDelegate> @interface FluwxResponseHandler : NSObject <WXApiDelegate>
@property (nonatomic, assign) id<WXApiManagerDelegate> delegate; @property(nonatomic, assign) id <WXApiManagerDelegate> delegate;
+ (instancetype)defaultManager; + (instancetype)defaultManager;
- (void) setMethodChannel:(FlutterMethodChannel *) flutterMethodChannel; - (void)setMethodChannel:(FlutterMethodChannel *)flutterMethodChannel;
@end @end
...@@ -7,9 +7,11 @@ ...@@ -7,9 +7,11 @@
#import <Flutter/Flutter.h> #import <Flutter/Flutter.h>
#import "FluwxPlugin.h" #import "FluwxPlugin.h"
#import "WXApiRequestHandler.h" #import "WXApiRequestHandler.h"
@class StringUtil; @class StringUtil;
@interface FluwxShareHandler : NSObject @interface FluwxShareHandler : NSObject
-(instancetype) initWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar; - (instancetype)initWithRegistrar:(NSObject <FlutterPluginRegistrar> *)registrar;
- (void)handleShare:(FlutterMethodCall *)call result:(FlutterResult)result; - (void)handleShare:(FlutterMethodCall *)call result:(FlutterResult)result;
@end @end
...@@ -11,8 +11,9 @@ ...@@ -11,8 +11,9 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface FluwxSubscribeMsgHandler : NSObject @interface FluwxSubscribeMsgHandler : NSObject
-(instancetype) initWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar; - (instancetype)initWithRegistrar:(NSObject <FlutterPluginRegistrar> *)registrar;
-(void)handleSubscribeWithCall:(FlutterMethodCall *)call result:(FlutterResult)result;
- (void)handleSubscribeWithCall:(FlutterMethodCall *)call result:(FlutterResult)result;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
#import <Flutter/Flutter.h> #import <Flutter/Flutter.h>
@interface FluwxWXApiHandler : NSObject @interface FluwxWXApiHandler : NSObject
- (void)registerApp:(FlutterMethodCall *)call result:(FlutterResult)result; - (void)registerApp:(FlutterMethodCall *)call result:(FlutterResult)result;
- (void)checkWeChatInstallation:(FlutterMethodCall *)call result:(FlutterResult)result; - (void)checkWeChatInstallation:(FlutterMethodCall *)call result:(FlutterResult)result;
@end @end
\ No newline at end of file
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
#pragma mark - WXApiDelegate #pragma mark - WXApiDelegate
/*! @brief 接收并处理来自微信终端程序的事件消息 /*! @brief 接收并处理来自微信终端程序的事件消息
* *
* 接收并处理来自微信终端程序的事件消息,期间微信界面会切换到第三方应用程序。 * 接收并处理来自微信终端程序的事件消息,期间微信界面会切换到第三方应用程序。
...@@ -26,8 +27,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -26,8 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
* 可能收到的请求有GetMessageFromWXReq、ShowMessageFromWXReq等。 * 可能收到的请求有GetMessageFromWXReq、ShowMessageFromWXReq等。
* @param req 具体请求内容,是自动释放的 * @param req 具体请求内容,是自动释放的
*/ */
- (void)onReq:(BaseReq*)req; - (void)onReq:(BaseReq *)req;
/*! @brief 发送一个sendReq后,收到微信的回应 /*! @brief 发送一个sendReq后,收到微信的回应
...@@ -36,7 +36,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -36,7 +36,7 @@ NS_ASSUME_NONNULL_BEGIN
* 可能收到的处理结果有SendMessageToWXResp、SendAuthResp等。 * 可能收到的处理结果有SendMessageToWXResp、SendAuthResp等。
* @param resp具体的回应内容,是自动释放的 * @param resp具体的回应内容,是自动释放的
*/ */
- (void)onResp:(BaseResp*)resp; - (void)onResp:(BaseResp *)resp;
@end @end
...@@ -44,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -44,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN
@protocol WXApiLogDelegate <NSObject> @protocol WXApiLogDelegate <NSObject>
- (void)onLog:(NSString*)log logLevel:(WXLogLevel)level; - (void)onLog:(NSString *)log logLevel:(WXLogLevel)level;
@end @end
...@@ -88,7 +88,6 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -88,7 +88,6 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)registerAppSupportContentFlag:(UInt64)typeFlag; + (void)registerAppSupportContentFlag:(UInt64)typeFlag;
/*! @brief 处理微信通过URL启动App时传递的数据 /*! @brief 处理微信通过URL启动App时传递的数据
* *
* 需要在 application:openURL:sourceApplication:annotation:或者application:handleOpenURL中调用。 * 需要在 application:openURL:sourceApplication:annotation:或者application:handleOpenURL中调用。
...@@ -96,8 +95,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -96,8 +95,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param delegate WXApiDelegate对象,用来接收微信触发的消息。 * @param delegate WXApiDelegate对象,用来接收微信触发的消息。
* @return 成功返回YES,失败返回NO。 * @return 成功返回YES,失败返回NO。
*/ */
+ (BOOL)handleOpenURL:(NSURL *)url delegate:(nullable id<WXApiDelegate>)delegate; + (BOOL)handleOpenURL:(NSURL *)url delegate:(nullable id <WXApiDelegate>)delegate;
/*! @brief 检查微信是否已被用户安装 /*! @brief 检查微信是否已被用户安装
...@@ -107,7 +105,6 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -107,7 +105,6 @@ NS_ASSUME_NONNULL_BEGIN
+ (BOOL)isWXAppInstalled; + (BOOL)isWXAppInstalled;
/*! @brief 判断当前微信的版本是否支持OpenApi /*! @brief 判断当前微信的版本是否支持OpenApi
* *
* @return 支持返回YES,不支持返回NO。 * @return 支持返回YES,不支持返回NO。
...@@ -115,7 +112,6 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -115,7 +112,6 @@ NS_ASSUME_NONNULL_BEGIN
+ (BOOL)isWXAppSupportApi; + (BOOL)isWXAppSupportApi;
/*! @brief 获取微信的itunes安装地址 /*! @brief 获取微信的itunes安装地址
* *
* @return 微信的安装地址字符串。 * @return 微信的安装地址字符串。
...@@ -123,7 +119,6 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -123,7 +119,6 @@ NS_ASSUME_NONNULL_BEGIN
+ (NSString *)getWXAppInstallUrl; + (NSString *)getWXAppInstallUrl;
/*! @brief 获取当前微信SDK的版本号 /*! @brief 获取当前微信SDK的版本号
* *
* @return 返回当前微信SDK的版本号 * @return 返回当前微信SDK的版本号
...@@ -131,7 +126,6 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -131,7 +126,6 @@ NS_ASSUME_NONNULL_BEGIN
+ (NSString *)getApiVersion; + (NSString *)getApiVersion;
/*! @brief 打开微信 /*! @brief 打开微信
* *
* @return 成功返回YES,失败返回NO。 * @return 成功返回YES,失败返回NO。
...@@ -139,7 +133,6 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -139,7 +133,6 @@ NS_ASSUME_NONNULL_BEGIN
+ (BOOL)openWXApp; + (BOOL)openWXApp;
/*! @brief 发送请求到微信,等待微信返回onResp /*! @brief 发送请求到微信,等待微信返回onResp
* *
* 函数调用后,会切换到微信的界面。第三方应用程序等待微信返回onResp。微信在异步处理完成后一定会调用onResp。支持以下类型 * 函数调用后,会切换到微信的界面。第三方应用程序等待微信返回onResp。微信在异步处理完成后一定会调用onResp。支持以下类型
...@@ -147,7 +140,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -147,7 +140,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param req 具体的发送请求,在调用函数后,请自己释放。 * @param req 具体的发送请求,在调用函数后,请自己释放。
* @return 成功返回YES,失败返回NO。 * @return 成功返回YES,失败返回NO。
*/ */
+ (BOOL)sendReq:(BaseReq*)req; + (BOOL)sendReq:(BaseReq *)req;
/*! @brief 发送Auth请求到微信,支持用户没安装微信,等待微信返回onResp /*! @brief 发送Auth请求到微信,支持用户没安装微信,等待微信返回onResp
* *
...@@ -157,7 +150,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -157,7 +150,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param delegate WXApiDelegate对象,用来接收微信触发的消息。 * @param delegate WXApiDelegate对象,用来接收微信触发的消息。
* @return 成功返回YES,失败返回NO。 * @return 成功返回YES,失败返回NO。
*/ */
+ (BOOL)sendAuthReq:(SendAuthReq*)req viewController:(UIViewController*)viewController delegate:(nullable id<WXApiDelegate>)delegate; + (BOOL)sendAuthReq:(SendAuthReq *)req viewController:(UIViewController *)viewController delegate:(nullable id <WXApiDelegate>)delegate;
/*! @brief 收到微信onReq的请求,发送对应的应答给微信,并切换到微信界面 /*! @brief 收到微信onReq的请求,发送对应的应答给微信,并切换到微信界面
...@@ -167,7 +160,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -167,7 +160,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param resp 具体的应答内容,调用函数后,请自己释放 * @param resp 具体的应答内容,调用函数后,请自己释放
* @return 成功返回YES,失败返回NO。 * @return 成功返回YES,失败返回NO。
*/ */
+ (BOOL)sendResp:(BaseResp*)resp; + (BOOL)sendResp:(BaseResp *)resp;
/*! @brief WXApi的成员函数,接受微信的log信息。byBlock /*! @brief WXApi的成员函数,接受微信的log信息。byBlock
...@@ -185,7 +178,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -185,7 +178,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param level 打印log的级别 * @param level 打印log的级别
* @param logDelegate 打印log的回调代理, * @param logDelegate 打印log的回调代理,
*/ */
+ (void)startLogByLevel:(WXLogLevel)level logDelegate:(id<WXApiLogDelegate>)logDelegate; + (void)startLogByLevel:(WXLogLevel)level logDelegate:(id <WXApiLogDelegate>)logDelegate;
/*! @brief 停止打印log,会清理block或者delegate为空,释放block /*! @brief 停止打印log,会清理block或者delegate为空,释放block
* @param * @param
......
...@@ -24,7 +24,6 @@ enum WXErrCode { ...@@ -24,7 +24,6 @@ enum WXErrCode {
}; };
/*! @brief 请求发送场景 /*! @brief 请求发送场景
* *
*/ */
...@@ -41,7 +40,6 @@ enum WXAPISupport { ...@@ -41,7 +40,6 @@ enum WXAPISupport {
}; };
/*! @brief 跳转profile类型 /*! @brief 跳转profile类型
* *
*/ */
...@@ -67,7 +65,6 @@ enum WXMPWebviewType { ...@@ -67,7 +65,6 @@ enum WXMPWebviewType {
}; };
/*! @brief 应用支持接收微信的文件类型 /*! @brief 应用支持接收微信的文件类型
* *
*/ */
...@@ -93,7 +90,7 @@ typedef NS_ENUM(UInt64, enAppSupportContentFlag) { ...@@ -93,7 +90,7 @@ typedef NS_ENUM(UInt64, enAppSupportContentFlag) {
/*! @brief log的级别 /*! @brief log的级别
* *
*/ */
typedef NS_ENUM(NSInteger,WXLogLevel) { typedef NS_ENUM(NSInteger, WXLogLevel) {
WXLogLevelNormal = 0, // 打印日常的日志 WXLogLevelNormal = 0, // 打印日常的日志
WXLogLevelDetail = 1, // 打印详细的日志 WXLogLevelDetail = 1, // 打印详细的日志
}; };
...@@ -105,36 +102,36 @@ typedef NS_ENUM(NSInteger,WXLogLevel) { ...@@ -105,36 +102,36 @@ typedef NS_ENUM(NSInteger,WXLogLevel) {
typedef void(^WXLogBolock)(NSString *log); typedef void(^WXLogBolock)(NSString *log);
#pragma mark - BaseReq #pragma mark - BaseReq
/*! @brief 该类为微信终端SDK所有请求类的基类 /*! @brief 该类为微信终端SDK所有请求类的基类
* *
*/ */
@interface BaseReq : NSObject @interface BaseReq : NSObject
/** 请求类型 */ /** 请求类型 */
@property (nonatomic, assign) int type; @property(nonatomic, assign) int type;
/** 由用户微信号和AppID组成的唯一标识,发送请求时第三方程序必须填写,用于校验微信用户是否换号登录*/ /** 由用户微信号和AppID组成的唯一标识,发送请求时第三方程序必须填写,用于校验微信用户是否换号登录*/
@property (nonatomic, copy) NSString *openID; @property(nonatomic, copy) NSString *openID;
@end @end
#pragma mark - BaseResp #pragma mark - BaseResp
/*! @brief 该类为微信终端SDK所有响应类的基类 /*! @brief 该类为微信终端SDK所有响应类的基类
* *
*/ */
@interface BaseResp : NSObject @interface BaseResp : NSObject
/** 错误码 */ /** 错误码 */
@property (nonatomic, assign) int errCode; @property(nonatomic, assign) int errCode;
/** 错误提示字符串 */ /** 错误提示字符串 */
@property (nonatomic, copy) NSString *errStr; @property(nonatomic, copy) NSString *errStr;
/** 响应类型 */ /** 响应类型 */
@property (nonatomic, assign) int type; @property(nonatomic, assign) int type;
@end @end
#pragma mark - WXMediaMessage #pragma mark - WXMediaMessage
@class WXMediaMessage; @class WXMediaMessage;
...@@ -148,22 +145,23 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -148,22 +145,23 @@ typedef void(^WXLogBolock)(NSString *log);
@interface PayReq : BaseReq @interface PayReq : BaseReq
/** 商家向财付通申请的商家id */ /** 商家向财付通申请的商家id */
@property (nonatomic, copy) NSString *partnerId; @property(nonatomic, copy) NSString *partnerId;
/** 预支付订单 */ /** 预支付订单 */
@property (nonatomic, copy) NSString *prepayId; @property(nonatomic, copy) NSString *prepayId;
/** 随机串,防重发 */ /** 随机串,防重发 */
@property (nonatomic, copy) NSString *nonceStr; @property(nonatomic, copy) NSString *nonceStr;
/** 时间戳,防重发 */ /** 时间戳,防重发 */
@property (nonatomic, assign) UInt32 timeStamp; @property(nonatomic, assign) UInt32 timeStamp;
/** 商家根据财付通文档填写的数据和签名 */ /** 商家根据财付通文档填写的数据和签名 */
@property (nonatomic, copy) NSString *package; @property(nonatomic, copy) NSString *package;
/** 商家根据微信开放平台文档对数据做的签名 */ /** 商家根据微信开放平台文档对数据做的签名 */
@property (nonatomic, copy) NSString *sign; @property(nonatomic, copy) NSString *sign;
@end @end
#pragma mark - PayResp #pragma mark - PayResp
/*! @brief 微信终端返回给第三方的关于支付结果的结构体 /*! @brief 微信终端返回给第三方的关于支付结果的结构体
* *
* 微信终端返回给第三方的关于支付结果的结构体 * 微信终端返回给第三方的关于支付结果的结构体
...@@ -171,12 +169,13 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -171,12 +169,13 @@ typedef void(^WXLogBolock)(NSString *log);
@interface PayResp : BaseResp @interface PayResp : BaseResp
/** 财付通返回给商家的信息 */ /** 财付通返回给商家的信息 */
@property (nonatomic, copy) NSString *returnKey; @property(nonatomic, copy) NSString *returnKey;
@end @end
#pragma mark - WXOfflinePay #pragma mark - WXOfflinePay
/*! @brief 第三方向微信终端发起离线支付 /*! @brief 第三方向微信终端发起离线支付
* *
* 第三方向微信终端发起离线支付的消息结构体 * 第三方向微信终端发起离线支付的消息结构体
...@@ -196,8 +195,8 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -196,8 +195,8 @@ typedef void(^WXLogBolock)(NSString *log);
#endif #endif
#pragma mark - SendAuthReq #pragma mark - SendAuthReq
/*! @brief 第三方程序向微信终端请求认证的消息结构 /*! @brief 第三方程序向微信终端请求认证的消息结构
* *
* 第三方程序要向微信申请认证,并请求某些权限,需要调用WXApi的sendReq成员函数, * 第三方程序要向微信申请认证,并请求某些权限,需要调用WXApi的sendReq成员函数,
...@@ -209,14 +208,15 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -209,14 +208,15 @@ typedef void(^WXLogBolock)(NSString *log);
* @see SendAuthResp * @see SendAuthResp
* @note scope字符串长度不能超过1K * @note scope字符串长度不能超过1K
*/ */
@property (nonatomic, copy) NSString *scope; @property(nonatomic, copy) NSString *scope;
/** 第三方程序本身用来标识其请求的唯一性,最后跳转回第三方程序时,由微信终端回传。 /** 第三方程序本身用来标识其请求的唯一性,最后跳转回第三方程序时,由微信终端回传。
* @note state字符串长度不能超过1K * @note state字符串长度不能超过1K
*/ */
@property (nonatomic, copy) NSString *state; @property(nonatomic, copy) NSString *state;
@end @end
#pragma mark - SendAuthResp #pragma mark - SendAuthResp
/*! @brief 微信处理完第三方程序的认证和权限申请后向第三方程序回送的处理结果。 /*! @brief 微信处理完第三方程序的认证和权限申请后向第三方程序回送的处理结果。
* *
* 第三方程序要向微信申请认证,并请求某些权限,需要调用WXApi的sendReq成员函数,向微信终端发送一个SendAuthReq消息结构。 * 第三方程序要向微信申请认证,并请求某些权限,需要调用WXApi的sendReq成员函数,向微信终端发送一个SendAuthReq消息结构。
...@@ -224,18 +224,18 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -224,18 +224,18 @@ typedef void(^WXLogBolock)(NSString *log);
* @see onResp * @see onResp
*/ */
@interface SendAuthResp : BaseResp @interface SendAuthResp : BaseResp
@property (nonatomic, copy, nullable) NSString *code; @property(nonatomic, copy, nullable) NSString *code;
/** 第三方程序发送时用来标识其请求的唯一性的标志,由第三方程序调用sendReq时传入,由微信终端回传 /** 第三方程序发送时用来标识其请求的唯一性的标志,由第三方程序调用sendReq时传入,由微信终端回传
* @note state字符串长度不能超过1K * @note state字符串长度不能超过1K
*/ */
@property (nonatomic, copy, nullable) NSString *state; @property(nonatomic, copy, nullable) NSString *state;
@property (nonatomic, copy, nullable) NSString *lang; @property(nonatomic, copy, nullable) NSString *lang;
@property (nonatomic, copy, nullable) NSString *country; @property(nonatomic, copy, nullable) NSString *country;
@end @end
#pragma mark - SendMessageToWXReq #pragma mark - SendMessageToWXReq
/*! @brief 第三方程序发送消息至微信终端程序的消息结构体 /*! @brief 第三方程序发送消息至微信终端程序的消息结构体
* *
* 第三方程序向微信发送信息需要传入SendMessageToWXReq结构体,信息类型包括文本消息和多媒体消息, * 第三方程序向微信发送信息需要传入SendMessageToWXReq结构体,信息类型包括文本消息和多媒体消息,
...@@ -246,24 +246,25 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -246,24 +246,25 @@ typedef void(^WXLogBolock)(NSString *log);
/** 发送消息的文本内容 /** 发送消息的文本内容
* @note 文本长度必须大于0且小于10K * @note 文本长度必须大于0且小于10K
*/ */
@property (nonatomic, copy) NSString *text; @property(nonatomic, copy) NSString *text;
/** 发送消息的多媒体内容 /** 发送消息的多媒体内容
* @see WXMediaMessage * @see WXMediaMessage
*/ */
@property (nonatomic, strong) WXMediaMessage *message; @property(nonatomic, strong) WXMediaMessage *message;
/** 发送消息的类型,包括文本消息和多媒体消息两种,两者只能选择其一,不能同时发送文本和多媒体消息 */ /** 发送消息的类型,包括文本消息和多媒体消息两种,两者只能选择其一,不能同时发送文本和多媒体消息 */
@property (nonatomic, assign) BOOL bText; @property(nonatomic, assign) BOOL bText;
/** 发送的目标场景,可以选择发送到会话(WXSceneSession)或者朋友圈(WXSceneTimeline)。 默认发送到会话。 /** 发送的目标场景,可以选择发送到会话(WXSceneSession)或者朋友圈(WXSceneTimeline)。 默认发送到会话。
* @see WXScene * @see WXScene
*/ */
@property (nonatomic, assign) int scene; @property(nonatomic, assign) int scene;
/** 指定发送消息的人 /** 指定发送消息的人
* @note WXSceneSpecifiedSession时有效 * @note WXSceneSpecifiedSession时有效
*/ */
@property (nonatomic, copy, nullable) NSString *toUserOpenId; @property(nonatomic, copy, nullable) NSString *toUserOpenId;
@end @end
#pragma mark - SendMessageToWXResp #pragma mark - SendMessageToWXResp
/*! @brief 微信终端向第三方程序返回的SendMessageToWXReq处理结果。 /*! @brief 微信终端向第三方程序返回的SendMessageToWXReq处理结果。
* *
* 第三方程序向微信终端发送SendMessageToWXReq后,微信发送回来的处理结果,该结果用SendMessageToWXResp表示。 * 第三方程序向微信终端发送SendMessageToWXReq后,微信发送回来的处理结果,该结果用SendMessageToWXResp表示。
...@@ -274,21 +275,21 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -274,21 +275,21 @@ typedef void(^WXLogBolock)(NSString *log);
@end @end
#pragma mark - GetMessageFromWXReq #pragma mark - GetMessageFromWXReq
/*! @brief 微信终端向第三方程序请求提供内容的消息结构体。 /*! @brief 微信终端向第三方程序请求提供内容的消息结构体。
* *
* 微信终端向第三方程序请求提供内容,微信终端会向第三方程序发送GetMessageFromWXReq消息结构体, * 微信终端向第三方程序请求提供内容,微信终端会向第三方程序发送GetMessageFromWXReq消息结构体,
* 需要第三方程序调用sendResp返回一个GetMessageFromWXResp消息结构体。 * 需要第三方程序调用sendResp返回一个GetMessageFromWXResp消息结构体。
*/ */
@interface GetMessageFromWXReq : BaseReq @interface GetMessageFromWXReq : BaseReq
@property (nonatomic, strong) NSString *lang; @property(nonatomic, strong) NSString *lang;
@property (nonatomic, strong) NSString *country; @property(nonatomic, strong) NSString *country;
@end @end
#pragma mark - GetMessageFromWXResp #pragma mark - GetMessageFromWXResp
/*! @brief 微信终端向第三方程序请求提供内容,第三方程序向微信终端返回的消息结构体。 /*! @brief 微信终端向第三方程序请求提供内容,第三方程序向微信终端返回的消息结构体。
* *
* 微信终端向第三方程序请求提供内容,第三方程序调用sendResp向微信终端返回一个GetMessageFromWXResp消息结构体。 * 微信终端向第三方程序请求提供内容,第三方程序调用sendResp向微信终端返回一个GetMessageFromWXResp消息结构体。
...@@ -297,18 +298,18 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -297,18 +298,18 @@ typedef void(^WXLogBolock)(NSString *log);
/** 向微信终端提供的文本内容 /** 向微信终端提供的文本内容
@note 文本长度必须大于0且小于10K @note 文本长度必须大于0且小于10K
*/ */
@property (nonatomic, strong) NSString *text; @property(nonatomic, strong) NSString *text;
/** 向微信终端提供的多媒体内容。 /** 向微信终端提供的多媒体内容。
* @see WXMediaMessage * @see WXMediaMessage
*/ */
@property (nonatomic, strong) WXMediaMessage *message; @property(nonatomic, strong) WXMediaMessage *message;
/** 向微信终端提供内容的消息类型,包括文本消息和多媒体消息两种,两者只能选择其一,不能同时发送文本和多媒体消息 */ /** 向微信终端提供内容的消息类型,包括文本消息和多媒体消息两种,两者只能选择其一,不能同时发送文本和多媒体消息 */
@property (nonatomic, assign) BOOL bText; @property(nonatomic, assign) BOOL bText;
@end @end
#pragma mark - ShowMessageFromWXReq #pragma mark - ShowMessageFromWXReq
/*! @brief 微信通知第三方程序,要求第三方程序显示的消息结构体。 /*! @brief 微信通知第三方程序,要求第三方程序显示的消息结构体。
* *
* 微信需要通知第三方程序显示或处理某些内容时,会向第三方程序发送ShowMessageFromWXReq消息结构体。 * 微信需要通知第三方程序显示或处理某些内容时,会向第三方程序发送ShowMessageFromWXReq消息结构体。
...@@ -318,14 +319,14 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -318,14 +319,14 @@ typedef void(^WXLogBolock)(NSString *log);
/** 微信终端向第三方程序发送的要求第三方程序处理的多媒体内容 /** 微信终端向第三方程序发送的要求第三方程序处理的多媒体内容
* @see WXMediaMessage * @see WXMediaMessage
*/ */
@property (nonatomic, strong) WXMediaMessage *message; @property(nonatomic, strong) WXMediaMessage *message;
@property (nonatomic, copy) NSString *lang; @property(nonatomic, copy) NSString *lang;
@property (nonatomic, copy) NSString *country; @property(nonatomic, copy) NSString *country;
@end @end
#pragma mark - ShowMessageFromWXResp #pragma mark - ShowMessageFromWXResp
/*! @brief 微信通知第三方程序,要求第三方程序显示或处理某些消息,第三方程序处理完后向微信终端发送的处理结果。 /*! @brief 微信通知第三方程序,要求第三方程序显示或处理某些消息,第三方程序处理完后向微信终端发送的处理结果。
* *
* 微信需要通知第三方程序显示或处理某些内容时,会向第三方程序发送ShowMessageFromWXReq消息结构体。 * 微信需要通知第三方程序显示或处理某些内容时,会向第三方程序发送ShowMessageFromWXReq消息结构体。
...@@ -336,19 +337,20 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -336,19 +337,20 @@ typedef void(^WXLogBolock)(NSString *log);
#pragma mark - LaunchFromWXReq #pragma mark - LaunchFromWXReq
/*! @brief 微信终端打开第三方程序携带的消息结构体 /*! @brief 微信终端打开第三方程序携带的消息结构体
* *
* 微信向第三方发送的结构体,第三方不需要返回 * 微信向第三方发送的结构体,第三方不需要返回
*/ */
@interface LaunchFromWXReq : BaseReq @interface LaunchFromWXReq : BaseReq
@property (nonatomic, strong) WXMediaMessage *message; @property(nonatomic, strong) WXMediaMessage *message;
@property (nonatomic, copy) NSString *lang; @property(nonatomic, copy) NSString *lang;
@property (nonatomic, copy) NSString *country; @property(nonatomic, copy) NSString *country;
@end @end
#pragma mark - OpenTempSessionReq #pragma mark - OpenTempSessionReq
/* ! @brief 第三方通知微信,打开临时会话 /* ! @brief 第三方通知微信,打开临时会话
* *
* 第三方通知微信,打开临时会话 * 第三方通知微信,打开临时会话
...@@ -357,14 +359,15 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -357,14 +359,15 @@ typedef void(^WXLogBolock)(NSString *log);
/** 需要打开的用户名 /** 需要打开的用户名
* @attention 长度不能超过512字节 * @attention 长度不能超过512字节
*/ */
@property (nonatomic, copy) NSString *username; @property(nonatomic, copy) NSString *username;
/** 开发者自定义参数,拉起临时会话后会发给开发者后台,可以用于识别场景 /** 开发者自定义参数,拉起临时会话后会发给开发者后台,可以用于识别场景
* @attention 长度不能超过32位 * @attention 长度不能超过32位
*/ */
@property (nonatomic, copy) NSString *sessionFrom; @property(nonatomic, copy) NSString *sessionFrom;
@end @end
#pragma mark - OpenTempSessionResp #pragma mark - OpenTempSessionResp
/*! @brief 微信终端向第三方程序返回的OpenTempSessionReq处理结果。 /*! @brief 微信终端向第三方程序返回的OpenTempSessionReq处理结果。
* *
* 第三方程序向微信终端发送OpenTempSessionReq后,微信发送回来的处理结果,该结果用OpenTempSessionResp表示。 * 第三方程序向微信终端发送OpenTempSessionReq后,微信发送回来的处理结果,该结果用OpenTempSessionResp表示。
...@@ -374,8 +377,8 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -374,8 +377,8 @@ typedef void(^WXLogBolock)(NSString *log);
@end @end
#pragma mark - OpenWebviewReq #pragma mark - OpenWebviewReq
/* ! @brief 第三方通知微信启动内部浏览器,打开指定网页 /* ! @brief 第三方通知微信启动内部浏览器,打开指定网页
* *
* 第三方通知微信启动内部浏览器,打开指定Url对应的网页 * 第三方通知微信启动内部浏览器,打开指定Url对应的网页
...@@ -389,6 +392,7 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -389,6 +392,7 @@ typedef void(^WXLogBolock)(NSString *log);
@end @end
#pragma mark - OpenWebviewResp #pragma mark - OpenWebviewResp
/*! @brief 微信终端向第三方程序返回的OpenWebviewReq处理结果 /*! @brief 微信终端向第三方程序返回的OpenWebviewReq处理结果
* *
* 第三方程序向微信终端发送OpenWebviewReq后,微信发送回来的处理结果,该结果用OpenWebviewResp表示 * 第三方程序向微信终端发送OpenWebviewReq后,微信发送回来的处理结果,该结果用OpenWebviewResp表示
...@@ -398,8 +402,8 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -398,8 +402,8 @@ typedef void(^WXLogBolock)(NSString *log);
@end @end
#pragma mark - WXOpenBusinessWebViewReq #pragma mark - WXOpenBusinessWebViewReq
/*! @brief 第三方通知微信启动内部浏览器,打开指定业务的网页 /*! @brief 第三方通知微信启动内部浏览器,打开指定业务的网页
* *
* *
...@@ -409,16 +413,17 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -409,16 +413,17 @@ typedef void(^WXLogBolock)(NSString *log);
/** 网页业务类型 /** 网页业务类型
* @attention * @attention
*/ */
@property (nonatomic, assign) UInt32 businessType; @property(nonatomic, assign) UInt32 businessType;
/** 网页业务参数 /** 网页业务参数
* @attention * @attention
*/ */
@property (nonatomic, strong, nullable) NSDictionary *queryInfoDic; @property(nonatomic, strong, nullable) NSDictionary *queryInfoDic;
@end @end
#pragma mark - WXOpenBusinessWebViewResp #pragma mark - WXOpenBusinessWebViewResp
/*! @brief 微信终端向第三方程序返回的WXOpenBusinessWebViewResp处理结果。 /*! @brief 微信终端向第三方程序返回的WXOpenBusinessWebViewResp处理结果。
* *
* 第三方程序向微信终端发送WXOpenBusinessWebViewReq后,微信发送回来的处理结果,该结果用WXOpenBusinessWebViewResp表示。 * 第三方程序向微信终端发送WXOpenBusinessWebViewReq后,微信发送回来的处理结果,该结果用WXOpenBusinessWebViewResp表示。
...@@ -427,17 +432,18 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -427,17 +432,18 @@ typedef void(^WXLogBolock)(NSString *log);
/** 第三方程序自定义简单数据,微信终端会回传给第三方程序处理 /** 第三方程序自定义简单数据,微信终端会回传给第三方程序处理
* @attention 长度不能超过2k * @attention 长度不能超过2k
*/ */
@property (nonatomic, copy) NSString *result; @property(nonatomic, copy) NSString *result;
/** 网页业务类型 /** 网页业务类型
* @attention * @attention
*/ */
@property (nonatomic, assign) UInt32 businessType; @property(nonatomic, assign) UInt32 businessType;
@end @end
#pragma mark - OpenRankListReq #pragma mark - OpenRankListReq
/* ! @brief 第三方通知微信,打开硬件排行榜 /* ! @brief 第三方通知微信,打开硬件排行榜
* *
* 第三方通知微信,打开硬件排行榜 * 第三方通知微信,打开硬件排行榜
...@@ -447,6 +453,7 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -447,6 +453,7 @@ typedef void(^WXLogBolock)(NSString *log);
@end @end
#pragma mark - OpenRanklistResp #pragma mark - OpenRanklistResp
/*! @brief 微信终端向第三方程序返回的OpenRankListReq处理结果。 /*! @brief 微信终端向第三方程序返回的OpenRankListReq处理结果。
* *
* 第三方程序向微信终端发送OpenRankListReq后,微信发送回来的处理结果,该结果用OpenRankListResp表示。 * 第三方程序向微信终端发送OpenRankListReq后,微信发送回来的处理结果,该结果用OpenRankListResp表示。
...@@ -456,8 +463,8 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -456,8 +463,8 @@ typedef void(^WXLogBolock)(NSString *log);
@end @end
#pragma mark - JumpToBizProfileReq #pragma mark - JumpToBizProfileReq
/* ! @brief 第三方通知微信,打开指定微信号profile页面 /* ! @brief 第三方通知微信,打开指定微信号profile页面
* *
* 第三方通知微信,打开指定微信号profile页面 * 第三方通知微信,打开指定微信号profile页面
...@@ -466,21 +473,21 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -466,21 +473,21 @@ typedef void(^WXLogBolock)(NSString *log);
/** 跳转到该公众号的profile /** 跳转到该公众号的profile
* @attention 长度不能超过512字节 * @attention 长度不能超过512字节
*/ */
@property (nonatomic, copy) NSString *username; @property(nonatomic, copy) NSString *username;
/** 如果用户加了该公众号为好友,extMsg会上传到服务器 /** 如果用户加了该公众号为好友,extMsg会上传到服务器
* @attention 长度不能超过1024字节 * @attention 长度不能超过1024字节
*/ */
@property (nonatomic, copy, nullable) NSString *extMsg; @property(nonatomic, copy, nullable) NSString *extMsg;
/** /**
* 跳转的公众号类型 * 跳转的公众号类型
* @see WXBizProfileType * @see WXBizProfileType
*/ */
@property (nonatomic, assign) int profileType; @property(nonatomic, assign) int profileType;
@end @end
#pragma mark - JumpToBizWebviewReq #pragma mark - JumpToBizWebviewReq
/* ! @brief 第三方通知微信,打开指定usrname的profile网页版 /* ! @brief 第三方通知微信,打开指定usrname的profile网页版
* *
*/ */
...@@ -506,23 +513,23 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -506,23 +513,23 @@ typedef void(^WXLogBolock)(NSString *log);
/** 卡id /** 卡id
* @attention 长度不能超过1024字节 * @attention 长度不能超过1024字节
*/ */
@property (nonatomic, copy) NSString *cardId; @property(nonatomic, copy) NSString *cardId;
/** ext信息 /** ext信息
* @attention 长度不能超过2024字节 * @attention 长度不能超过2024字节
*/ */
@property (nonatomic, copy, nullable) NSString *extMsg; @property(nonatomic, copy, nullable) NSString *extMsg;
/** /**
* @attention 卡的状态,req不需要填。resp:0为未添加,1为已添加。 * @attention 卡的状态,req不需要填。resp:0为未添加,1为已添加。
*/ */
@property (nonatomic, assign) UInt32 cardState; @property(nonatomic, assign) UInt32 cardState;
/** /**
* @attention req不需要填,chooseCard返回的。 * @attention req不需要填,chooseCard返回的。
*/ */
@property (nonatomic, copy) NSString *encryptCode; @property(nonatomic, copy) NSString *encryptCode;
/** /**
* @attention req不需要填,chooseCard返回的。 * @attention req不需要填,chooseCard返回的。
*/ */
@property (nonatomic, copy) NSString *appID; @property(nonatomic, copy) NSString *appID;
@end; @end;
#pragma mark - WXInvoiceItem #pragma mark - WXInvoiceItem
...@@ -531,27 +538,28 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -531,27 +538,28 @@ typedef void(^WXLogBolock)(NSString *log);
/** 卡id /** 卡id
* @attention 长度不能超过1024字节 * @attention 长度不能超过1024字节
*/ */
@property (nonatomic, copy) NSString *cardId; @property(nonatomic, copy) NSString *cardId;
/** ext信息 /** ext信息
* @attention 长度不能超过2024字节 * @attention 长度不能超过2024字节
*/ */
@property (nonatomic, copy, nullable) NSString *extMsg; @property(nonatomic, copy, nullable) NSString *extMsg;
/** /**
* @attention 卡的状态,req不需要填。resp:0为未添加,1为已添加。 * @attention 卡的状态,req不需要填。resp:0为未添加,1为已添加。
*/ */
@property (nonatomic, assign) UInt32 cardState; @property(nonatomic, assign) UInt32 cardState;
/** /**
* @attention req不需要填,chooseCard返回的。 * @attention req不需要填,chooseCard返回的。
*/ */
@property (nonatomic, copy) NSString *encryptCode; @property(nonatomic, copy) NSString *encryptCode;
/** /**
* @attention req不需要填,chooseCard返回的。 * @attention req不需要填,chooseCard返回的。
*/ */
@property (nonatomic, copy) NSString *appID; @property(nonatomic, copy) NSString *appID;
@end @end
#pragma mark - AddCardToWXCardPackageReq #pragma mark - AddCardToWXCardPackageReq
/* ! @brief 请求添加卡券至微信卡包 /* ! @brief 请求添加卡券至微信卡包
* *
*/ */
...@@ -560,12 +568,13 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -560,12 +568,13 @@ typedef void(^WXLogBolock)(NSString *log);
/** 卡列表 /** 卡列表
* @attention 个数不能超过40个 类型WXCardItem * @attention 个数不能超过40个 类型WXCardItem
*/ */
@property (nonatomic, strong) NSArray *cardAry; @property(nonatomic, strong) NSArray *cardAry;
@end @end
#pragma mark - AddCardToWXCardPackageResp #pragma mark - AddCardToWXCardPackageResp
/** ! @brief 微信返回第三方添加卡券结果 /** ! @brief 微信返回第三方添加卡券结果
* *
*/ */
...@@ -574,85 +583,93 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -574,85 +583,93 @@ typedef void(^WXLogBolock)(NSString *log);
/** 卡列表 /** 卡列表
* @attention 个数不能超过40个 类型WXCardItem * @attention 个数不能超过40个 类型WXCardItem
*/ */
@property (nonatomic, strong) NSArray *cardAry; @property(nonatomic, strong) NSArray *cardAry;
@end @end
#pragma mark - WXChooseCardReq #pragma mark - WXChooseCardReq
/* ! @brief 请求从微信选取卡券 /* ! @brief 请求从微信选取卡券
* *
*/ */
@interface WXChooseCardReq : BaseReq @interface WXChooseCardReq : BaseReq
@property (nonatomic, copy) NSString *appID; @property(nonatomic, copy) NSString *appID;
@property (nonatomic, assign) UInt32 shopID; @property(nonatomic, assign) UInt32 shopID;
@property (nonatomic, assign) UInt32 canMultiSelect; @property(nonatomic, assign) UInt32 canMultiSelect;
@property (nonatomic, copy) NSString *cardType; @property(nonatomic, copy) NSString *cardType;
@property (nonatomic, copy) NSString *cardTpID; @property(nonatomic, copy) NSString *cardTpID;
@property (nonatomic, copy) NSString *signType; @property(nonatomic, copy) NSString *signType;
@property (nonatomic, copy) NSString *cardSign; @property(nonatomic, copy) NSString *cardSign;
@property (nonatomic, assign) UInt32 timeStamp; @property(nonatomic, assign) UInt32 timeStamp;
@property (nonatomic, copy) NSString *nonceStr; @property(nonatomic, copy) NSString *nonceStr;
@end @end
#pragma mark - WXChooseCardResp #pragma mark - WXChooseCardResp
/** ! @brief 微信返回第三方请求选择卡券结果 /** ! @brief 微信返回第三方请求选择卡券结果
* *
*/ */
@interface WXChooseCardResp : BaseResp @interface WXChooseCardResp : BaseResp
@property (nonatomic, strong ) NSArray* cardAry; @property(nonatomic, strong) NSArray *cardAry;
@end @end
#pragma mark - WXChooseInvoiceReq #pragma mark - WXChooseInvoiceReq
/* ! @brief 请求从微信选取发票 /* ! @brief 请求从微信选取发票
* *
*/ */
@interface WXChooseInvoiceReq : BaseReq @interface WXChooseInvoiceReq : BaseReq
@property (nonatomic, copy) NSString *appID; @property(nonatomic, copy) NSString *appID;
@property (nonatomic, assign) UInt32 shopID; @property(nonatomic, assign) UInt32 shopID;
@property (nonatomic, copy) NSString *signType; @property(nonatomic, copy) NSString *signType;
@property (nonatomic, copy) NSString *cardSign; @property(nonatomic, copy) NSString *cardSign;
@property (nonatomic, assign) UInt32 timeStamp; @property(nonatomic, assign) UInt32 timeStamp;
@property (nonatomic, copy) NSString *nonceStr; @property(nonatomic, copy) NSString *nonceStr;
@end @end
#pragma mark - WXChooseInvoiceResp #pragma mark - WXChooseInvoiceResp
/** ! @brief 微信返回第三方请求选择发票结果 /** ! @brief 微信返回第三方请求选择发票结果
* *
*/ */
@interface WXChooseInvoiceResp : BaseResp @interface WXChooseInvoiceResp : BaseResp
@property (nonatomic, strong) NSArray* cardAry; @property(nonatomic, strong) NSArray *cardAry;
@end @end
#pragma mark - WXSubscriptionReq #pragma mark - WXSubscriptionReq
@interface WXSubscribeMsgReq : BaseReq @interface WXSubscribeMsgReq : BaseReq
@property (nonatomic, assign) UInt32 scene; @property(nonatomic, assign) UInt32 scene;
@property (nonatomic, copy) NSString *templateId; @property(nonatomic, copy) NSString *templateId;
@property (nonatomic, copy, nullable) NSString *reserved; @property(nonatomic, copy, nullable) NSString *reserved;
@end @end
#pragma mark - WXSubscriptionReq #pragma mark - WXSubscriptionReq
@interface WXSubscribeMsgResp : BaseResp @interface WXSubscribeMsgResp : BaseResp
@property (nonatomic, copy) NSString *templateId; @property(nonatomic, copy) NSString *templateId;
@property (nonatomic, assign) UInt32 scene; @property(nonatomic, assign) UInt32 scene;
@property (nonatomic, copy) NSString *action; @property(nonatomic, copy) NSString *action;
@property (nonatomic, copy) NSString *reserved; @property(nonatomic, copy) NSString *reserved;
@property (nonatomic, copy, nullable) NSString *openId; @property(nonatomic, copy, nullable) NSString *openId;
@end @end
#pragma mark - WXSubscribeMiniProgramMsg #pragma mark - WXSubscribeMiniProgramMsg
/** ! @brief 微信返回第三方请求选择发票结果 /** ! @brief 微信返回第三方请求选择发票结果
* *
*/ */
@interface WXSubscribeMiniProgramMsgReq : BaseReq @interface WXSubscribeMiniProgramMsgReq : BaseReq
@property (nonatomic, copy) NSString *miniProgramAppid; @property(nonatomic, copy) NSString *miniProgramAppid;
@end @end
#pragma mark - WXSubscriptionReq #pragma mark - WXSubscriptionReq
@interface WXSubscribeMiniProgramMsgResp : BaseResp @interface WXSubscribeMiniProgramMsgResp : BaseResp
@property(nonatomic, copy) NSString *openId; // 小程序openid @property(nonatomic, copy) NSString *openId; // 小程序openid
...@@ -662,9 +679,10 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -662,9 +679,10 @@ typedef void(^WXLogBolock)(NSString *log);
@end @end
#pragma mark - WXinvoiceAuthInsertReq #pragma mark - WXinvoiceAuthInsertReq
@interface WXInvoiceAuthInsertReq : BaseReq @interface WXInvoiceAuthInsertReq : BaseReq
@property (nonatomic, copy) NSString *urlString; @property(nonatomic, copy) NSString *urlString;
@end @end
...@@ -672,35 +690,39 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -672,35 +690,39 @@ typedef void(^WXLogBolock)(NSString *log);
@interface WXInvoiceAuthInsertResp : BaseResp @interface WXInvoiceAuthInsertResp : BaseResp
@property (nonatomic, copy) NSString *wxOrderId; @property(nonatomic, copy) NSString *wxOrderId;
@end @end
#pragma mark - WXNontaxPayReq #pragma mark - WXNontaxPayReq
@interface WXNontaxPayReq:BaseReq
@property (nonatomic, copy) NSString *urlString; @interface WXNontaxPayReq : BaseReq
@property(nonatomic, copy) NSString *urlString;
@end @end
#pragma mark - WXNontaxPayResp #pragma mark - WXNontaxPayResp
@interface WXNontaxPayResp : BaseResp @interface WXNontaxPayResp : BaseResp
@property (nonatomic, copy) NSString *wxOrderId; @property(nonatomic, copy) NSString *wxOrderId;
@end @end
#pragma mark - WXPayInsuranceReq #pragma mark - WXPayInsuranceReq
@interface WXPayInsuranceReq : BaseReq @interface WXPayInsuranceReq : BaseReq
@property (nonatomic, copy) NSString *urlString; @property(nonatomic, copy) NSString *urlString;
@end @end
#pragma mark - WXPayInsuranceResp #pragma mark - WXPayInsuranceResp
@interface WXPayInsuranceResp : BaseResp @interface WXPayInsuranceResp : BaseResp
@property (nonatomic, copy) NSString *wxOrderId; @property(nonatomic, copy) NSString *wxOrderId;
@end @end
...@@ -717,28 +739,28 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -717,28 +739,28 @@ typedef void(^WXLogBolock)(NSString *log);
/** 标题 /** 标题
* @note 长度不能超过512字节 * @note 长度不能超过512字节
*/ */
@property (nonatomic, copy) NSString *title; @property(nonatomic, copy) NSString *title;
/** 描述内容 /** 描述内容
* @note 长度不能超过1K * @note 长度不能超过1K
*/ */
@property (nonatomic, copy) NSString *description; @property(nonatomic, copy) NSString *description;
/** 缩略图数据 /** 缩略图数据
* @note 大小不能超过32K * @note 大小不能超过32K
*/ */
@property (nonatomic, strong, nullable) NSData *thumbData; @property(nonatomic, strong, nullable) NSData *thumbData;
/** /**
* @note 长度不能超过64字节 * @note 长度不能超过64字节
*/ */
@property (nonatomic, copy, nullable) NSString *mediaTagName; @property(nonatomic, copy, nullable) NSString *mediaTagName;
/** /**
* *
*/ */
@property (nonatomic, copy, nullable) NSString *messageExt; @property(nonatomic, copy, nullable) NSString *messageExt;
@property (nonatomic, copy, nullable) NSString *messageAction; @property(nonatomic, copy, nullable) NSString *messageAction;
/** /**
* 多媒体数据对象,可以为WXImageObject,WXMusicObject,WXVideoObject,WXWebpageObject等。 * 多媒体数据对象,可以为WXImageObject,WXMusicObject,WXVideoObject,WXWebpageObject等。
*/ */
@property (nonatomic, strong) id mediaObject; @property(nonatomic, strong) id mediaObject;
/*! @brief 设置消息缩略图的方法 /*! @brief 设置消息缩略图的方法
* *
...@@ -750,8 +772,8 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -750,8 +772,8 @@ typedef void(^WXLogBolock)(NSString *log);
@end @end
#pragma mark - WXImageObject #pragma mark - WXImageObject
/*! @brief 多媒体消息中包含的图片数据对象 /*! @brief 多媒体消息中包含的图片数据对象
* *
* 微信终端和第三方程序之间传递消息中包含的图片数据对象。 * 微信终端和第三方程序之间传递消息中包含的图片数据对象。
...@@ -768,12 +790,13 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -768,12 +790,13 @@ typedef void(^WXLogBolock)(NSString *log);
/** 图片真实数据内容 /** 图片真实数据内容
* @note 大小不能超过25M * @note 大小不能超过25M
*/ */
@property (nonatomic, strong) NSData *imageData; @property(nonatomic, strong) NSData *imageData;
@end @end
#pragma mark - WXMusicObject #pragma mark - WXMusicObject
/*! @brief 多媒体消息中包含的音乐数据对象 /*! @brief 多媒体消息中包含的音乐数据对象
* *
* 微信终端和第三方程序之间传递消息中包含的音乐数据对象。 * 微信终端和第三方程序之间传递消息中包含的音乐数据对象。
...@@ -790,26 +813,26 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -790,26 +813,26 @@ typedef void(^WXLogBolock)(NSString *log);
/** 音乐网页的url地址 /** 音乐网页的url地址
* @note 长度不能超过10K * @note 长度不能超过10K
*/ */
@property (nonatomic, copy) NSString *musicUrl; @property(nonatomic, copy) NSString *musicUrl;
/** 音乐lowband网页的url地址 /** 音乐lowband网页的url地址
* @note 长度不能超过10K * @note 长度不能超过10K
*/ */
@property (nonatomic, copy) NSString *musicLowBandUrl; @property(nonatomic, copy) NSString *musicLowBandUrl;
/** 音乐数据url地址 /** 音乐数据url地址
* @note 长度不能超过10K * @note 长度不能超过10K
*/ */
@property (nonatomic, copy) NSString *musicDataUrl; @property(nonatomic, copy) NSString *musicDataUrl;
/**音乐lowband数据url地址 /**音乐lowband数据url地址
* @note 长度不能超过10K * @note 长度不能超过10K
*/ */
@property (nonatomic, copy) NSString *musicLowBandDataUrl; @property(nonatomic, copy) NSString *musicLowBandDataUrl;
@end @end
#pragma mark - WXVideoObject #pragma mark - WXVideoObject
/*! @brief 多媒体消息中包含的视频数据对象 /*! @brief 多媒体消息中包含的视频数据对象
* *
* 微信终端和第三方程序之间传递消息中包含的视频数据对象。 * 微信终端和第三方程序之间传递消息中包含的视频数据对象。
...@@ -826,17 +849,17 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -826,17 +849,17 @@ typedef void(^WXLogBolock)(NSString *log);
/** 视频网页的url地址 /** 视频网页的url地址
* @note 长度不能超过10K * @note 长度不能超过10K
*/ */
@property (nonatomic, copy) NSString *videoUrl; @property(nonatomic, copy) NSString *videoUrl;
/** 视频lowband网页的url地址 /** 视频lowband网页的url地址
* @note 长度不能超过10K * @note 长度不能超过10K
*/ */
@property (nonatomic, copy) NSString *videoLowBandUrl; @property(nonatomic, copy) NSString *videoLowBandUrl;
@end @end
#pragma mark - WXWebpageObject #pragma mark - WXWebpageObject
/*! @brief 多媒体消息中包含的网页数据对象 /*! @brief 多媒体消息中包含的网页数据对象
* *
* 微信终端和第三方程序之间传递消息中包含的网页数据对象。 * 微信终端和第三方程序之间传递消息中包含的网页数据对象。
...@@ -852,13 +875,13 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -852,13 +875,13 @@ typedef void(^WXLogBolock)(NSString *log);
/** 网页的url地址 /** 网页的url地址
* @note 不能为空且长度不能超过10K * @note 不能为空且长度不能超过10K
*/ */
@property (nonatomic, copy) NSString *webpageUrl; @property(nonatomic, copy) NSString *webpageUrl;
@end @end
#pragma mark - WXAppExtendObject #pragma mark - WXAppExtendObject
/*! @brief 多媒体消息中包含的App扩展数据对象 /*! @brief 多媒体消息中包含的App扩展数据对象
* *
* 第三方程序向微信终端发送包含WXAppExtendObject的多媒体消息, * 第三方程序向微信终端发送包含WXAppExtendObject的多媒体消息,
...@@ -876,21 +899,21 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -876,21 +899,21 @@ typedef void(^WXLogBolock)(NSString *log);
/** 若第三方程序不存在,微信终端会打开该url所指的App下载地址 /** 若第三方程序不存在,微信终端会打开该url所指的App下载地址
* @note 长度不能超过10K * @note 长度不能超过10K
*/ */
@property (nonatomic, copy) NSString *url; @property(nonatomic, copy) NSString *url;
/** 第三方程序自定义简单数据,微信终端会回传给第三方程序处理 /** 第三方程序自定义简单数据,微信终端会回传给第三方程序处理
* @note 长度不能超过2K * @note 长度不能超过2K
*/ */
@property (nonatomic, copy, nullable) NSString *extInfo; @property(nonatomic, copy, nullable) NSString *extInfo;
/** App文件数据,该数据发送给微信好友,微信好友需要点击后下载数据,微信终端会回传给第三方程序处理 /** App文件数据,该数据发送给微信好友,微信好友需要点击后下载数据,微信终端会回传给第三方程序处理
* @note 大小不能超过10M * @note 大小不能超过10M
*/ */
@property (nonatomic, strong, nullable) NSData *fileData; @property(nonatomic, strong, nullable) NSData *fileData;
@end @end
#pragma mark - WXEmoticonObject #pragma mark - WXEmoticonObject
/*! @brief 多媒体消息中包含的表情数据对象 /*! @brief 多媒体消息中包含的表情数据对象
* *
* 微信终端和第三方程序之间传递消息中包含的表情数据对象。 * 微信终端和第三方程序之间传递消息中包含的表情数据对象。
...@@ -907,13 +930,13 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -907,13 +930,13 @@ typedef void(^WXLogBolock)(NSString *log);
/** 表情真实数据内容 /** 表情真实数据内容
* @note 大小不能超过10M * @note 大小不能超过10M
*/ */
@property (nonatomic, strong) NSData *emoticonData; @property(nonatomic, strong) NSData *emoticonData;
@end @end
#pragma mark - WXFileObject #pragma mark - WXFileObject
/*! @brief 多媒体消息中包含的文件数据对象 /*! @brief 多媒体消息中包含的文件数据对象
* *
* @see WXMediaMessage * @see WXMediaMessage
...@@ -929,17 +952,18 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -929,17 +952,18 @@ typedef void(^WXLogBolock)(NSString *log);
/** 文件后缀名 /** 文件后缀名
* @note 长度不超过64字节 * @note 长度不超过64字节
*/ */
@property (nonatomic, copy) NSString *fileExtension; @property(nonatomic, copy) NSString *fileExtension;
/** 文件真实数据内容 /** 文件真实数据内容
* @note 大小不能超过10M * @note 大小不能超过10M
*/ */
@property (nonatomic, strong) NSData *fileData; @property(nonatomic, strong) NSData *fileData;
@end @end
#pragma mark - WXLocationObject #pragma mark - WXLocationObject
/*! @brief 多媒体消息中包含的地理位置数据对象 /*! @brief 多媒体消息中包含的地理位置数据对象
* *
* 微信终端和第三方程序之间传递消息中包含的地理位置数据对象。 * 微信终端和第三方程序之间传递消息中包含的地理位置数据对象。
...@@ -956,12 +980,13 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -956,12 +980,13 @@ typedef void(^WXLogBolock)(NSString *log);
/** 地理位置信息 /** 地理位置信息
* @note 经纬度 * @note 经纬度
*/ */
@property (nonatomic, assign) double lng; //经度 @property(nonatomic, assign) double lng; //经度
@property (nonatomic, assign) double lat; //纬度 @property(nonatomic, assign) double lat; //纬度
@end @end
#pragma mark - WXTextObject #pragma mark - WXTextObject
/*! @brief 多媒体消息中包含的文本数据对象 /*! @brief 多媒体消息中包含的文本数据对象
* *
* 微信终端和第三方程序之间传递消息中包含的文本数据对象。 * 微信终端和第三方程序之间传递消息中包含的文本数据对象。
...@@ -978,7 +1003,7 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -978,7 +1003,7 @@ typedef void(^WXLogBolock)(NSString *log);
/** 地理位置信息 /** 地理位置信息
* @note 文本内容 * @note 文本内容
*/ */
@property (nonatomic, copy) NSString *contentText; @property(nonatomic, copy) NSString *contentText;
@end @end
...@@ -995,28 +1020,28 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -995,28 +1020,28 @@ typedef void(^WXLogBolock)(NSString *log);
/** 低版本网页链接 /** 低版本网页链接
* @attention 长度不能超过1024字节 * @attention 长度不能超过1024字节
*/ */
@property (nonatomic, copy) NSString *webpageUrl; @property(nonatomic, copy) NSString *webpageUrl;
/** 小程序username */ /** 小程序username */
@property (nonatomic, copy) NSString *userName; @property(nonatomic, copy) NSString *userName;
/** 小程序页面的路径 /** 小程序页面的路径
* @attention 不填默认拉起小程序首页 * @attention 不填默认拉起小程序首页
*/ */
@property (nonatomic, copy, nullable) NSString *path; @property(nonatomic, copy, nullable) NSString *path;
/** 小程序新版本的预览图 /** 小程序新版本的预览图
* @attention 大小不能超过128k * @attention 大小不能超过128k
*/ */
@property (nonatomic, strong, nullable) NSData *hdImageData; @property(nonatomic, strong, nullable) NSData *hdImageData;
/** 是否使用带 shareTicket 的转发 */ /** 是否使用带 shareTicket 的转发 */
@property (nonatomic, assign) BOOL withShareTicket; @property(nonatomic, assign) BOOL withShareTicket;
/** 分享小程序的版本 /** 分享小程序的版本
* @attention (正式,开发,体验) * @attention (正式,开发,体验)
*/ */
@property (nonatomic, assign) WXMiniProgramType miniProgramType; @property(nonatomic, assign) WXMiniProgramType miniProgramType;
@end @end
...@@ -1031,37 +1056,39 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -1031,37 +1056,39 @@ typedef void(^WXLogBolock)(NSString *log);
+ (WXLaunchMiniProgramReq *)object; + (WXLaunchMiniProgramReq *)object;
/** 小程序username */ /** 小程序username */
@property (nonatomic, copy) NSString *userName; @property(nonatomic, copy) NSString *userName;
/** 小程序页面的路径 /** 小程序页面的路径
* @attention 不填默认拉起小程序首页 * @attention 不填默认拉起小程序首页
*/ */
@property (nonatomic, copy, nullable) NSString *path; @property(nonatomic, copy, nullable) NSString *path;
/** 分享小程序的版本 /** 分享小程序的版本
* @attention (正式,开发,体验) * @attention (正式,开发,体验)
*/ */
@property (nonatomic, assign) WXMiniProgramType miniProgramType; @property(nonatomic, assign) WXMiniProgramType miniProgramType;
/** ext信息 /** ext信息
* @attention json格式 * @attention json格式
*/ */
@property (nonatomic, copy, nullable) NSString *extMsg; @property(nonatomic, copy, nullable) NSString *extMsg;
@end @end
#pragma mark - WXLaunchMiniProgramResp #pragma mark - WXLaunchMiniProgramResp
/*! @brief 微信终端向第三方程序返回的WXLaunchMiniProgramReq处理结果。 /*! @brief 微信终端向第三方程序返回的WXLaunchMiniProgramReq处理结果。
* *
* 第三方程序向微信终端发送WXLaunchMiniProgramReq后,微信发送回来的处理结果,该结果用WXLaunchMiniProgramResp表示。 * 第三方程序向微信终端发送WXLaunchMiniProgramReq后,微信发送回来的处理结果,该结果用WXLaunchMiniProgramResp表示。
*/ */
@interface WXLaunchMiniProgramResp : BaseResp @interface WXLaunchMiniProgramResp : BaseResp
@property (nonatomic, copy, nullable) NSString *extMsg; @property(nonatomic, copy, nullable) NSString *extMsg;
@end @end
#pragma mark - WXOpenBusinessViewReq #pragma mark - WXOpenBusinessViewReq
/*! @brief WXOpenBusinessViewReq对象, 可实现第三方通知微信启动,打开业务页面 /*! @brief WXOpenBusinessViewReq对象, 可实现第三方通知微信启动,打开业务页面
* *
* @note 返回的WXOpenBusinessViewReq对象是自动释放的 * @note 返回的WXOpenBusinessViewReq对象是自动释放的
...@@ -1073,16 +1100,16 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -1073,16 +1100,16 @@ typedef void(^WXLogBolock)(NSString *log);
/** 业务类型 /** 业务类型
*/ */
@property (nonatomic, copy) NSString *businessType; @property(nonatomic, copy) NSString *businessType;
/** 业务参数 /** 业务参数
*/ */
@property (nonatomic, copy, nullable) NSString *query; @property(nonatomic, copy, nullable) NSString *query;
/** ext信息 /** ext信息
* @note 选填,json格式 * @note 选填,json格式
*/ */
@property (nonatomic, copy, nullable) NSString *extInfo; @property(nonatomic, copy, nullable) NSString *extInfo;
@end @end
...@@ -1091,11 +1118,12 @@ typedef void(^WXLogBolock)(NSString *log); ...@@ -1091,11 +1118,12 @@ typedef void(^WXLogBolock)(NSString *log);
/** 业务类型 /** 业务类型
*/ */
@property (nonatomic, copy) NSString *businessType; @property(nonatomic, copy) NSString *businessType;
/** 业务返回数据 /** 业务返回数据
*/ */
@property (nonatomic, copy, nullable) NSString *extMsg; @property(nonatomic, copy, nullable) NSString *extMsg;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
timestamp:(UInt32)timestamp; timestamp:(UInt32)timestamp;
+ (BOOL) sendPayment:(NSString *)appId + (BOOL)sendPayment:(NSString *)appId
PartnerId:(NSString *)partnerId PartnerId:(NSString *)partnerId
PrepayId:(NSString *)prepayId PrepayId:(NSString *)prepayId
NonceStr:(NSString *)nonceStr NonceStr:(NSString *)nonceStr
......
...@@ -20,7 +20,7 @@ enum AuthErrCode { ...@@ -20,7 +20,7 @@ enum AuthErrCode {
WechatAuth_Err_Timeout = -5, //超时 WechatAuth_Err_Timeout = -5, //超时
}; };
@protocol WechatAuthAPIDelegate<NSObject> @protocol WechatAuthAPIDelegate <NSObject>
@optional @optional
- (void)onAuthGotQrcode:(UIImage *)image; //得到二维码 - (void)onAuthGotQrcode:(UIImage *)image; //得到二维码
...@@ -29,12 +29,12 @@ enum AuthErrCode { ...@@ -29,12 +29,12 @@ enum AuthErrCode {
@end @end
@interface WechatAuthSDK : NSObject{ @interface WechatAuthSDK : NSObject {
NSString *_sdkVersion; NSString *_sdkVersion;
__weak id<WechatAuthAPIDelegate> _delegate; __weak id <WechatAuthAPIDelegate> _delegate;
} }
@property(nonatomic, weak, nullable) id<WechatAuthAPIDelegate> delegate; @property(nonatomic, weak, nullable) id <WechatAuthAPIDelegate> delegate;
@property(nonatomic, readonly) NSString *sdkVersion; //authSDK版本号 @property(nonatomic, readonly) NSString *sdkVersion; //authSDK版本号
/*! @brief 发送登录请求,等待WechatAuthAPIDelegate回调 /*! @brief 发送登录请求,等待WechatAuthAPIDelegate回调
......
...@@ -179,7 +179,7 @@ FlutterMethodChannel *fluwxMethodChannel = nil; ...@@ -179,7 +179,7 @@ FlutterMethodChannel *fluwxMethodChannel = nil;
fluwxKeyPlatform: fluwxKeyIOS, fluwxKeyPlatform: fluwxKeyIOS,
}; };
[fluwxMethodChannel invokeMethod:@"onPayResponse" arguments:result]; [fluwxMethodChannel invokeMethod:@"onPayResponse" arguments:result];
} else if([resp isKindOfClass:[WXOpenBusinessWebViewResp class]]){ } else if ([resp isKindOfClass:[WXOpenBusinessWebViewResp class]]) {
WXOpenBusinessWebViewResp *businessResp = (WXOpenBusinessWebViewResp *) resp; WXOpenBusinessWebViewResp *businessResp = (WXOpenBusinessWebViewResp *) resp;
NSDictionary *result = @{ NSDictionary *result = @{
...@@ -188,7 +188,7 @@ FlutterMethodChannel *fluwxMethodChannel = nil; ...@@ -188,7 +188,7 @@ FlutterMethodChannel *fluwxMethodChannel = nil;
errCode: @(businessResp.errCode), errCode: @(businessResp.errCode),
type: businessResp.type == nil ? @5 : @(businessResp.type), type: businessResp.type == nil ? @5 : @(businessResp.type),
@"resultInfo": businessResp.result, @"resultInfo": businessResp.result,
@"businessType":@(businessResp.businessType), @"businessType": @(businessResp.businessType),
fluwxKeyPlatform: fluwxKeyIOS, fluwxKeyPlatform: fluwxKeyIOS,
}; };
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
// //
// //
#import <Foundation/Foundation.h>
#import "WXApi.h" #import "WXApi.h"
#import "WXApiRequestHandler.h" #import "WXApiRequestHandler.h"
#import "SendMessageToWXReq+requestWithTextOrMediaMessage.h" #import "SendMessageToWXReq+requestWithTextOrMediaMessage.h"
...@@ -95,10 +94,10 @@ ...@@ -95,10 +94,10 @@
if ([StringUtil isBlank:musicURL]) { if ([StringUtil isBlank:musicURL]) {
ext.musicLowBandUrl = musicLowBandUrl; ext.musicLowBandUrl = musicLowBandUrl;
ext.musicLowBandDataUrl = (musicLowBandDataUrl == (id) [NSNull null]) ? nil : musicLowBandDataUrl ; ext.musicLowBandDataUrl = (musicLowBandDataUrl == (id) [NSNull null]) ? nil : musicLowBandDataUrl;
} else { } else {
ext.musicUrl = musicURL; ext.musicUrl = musicURL;
ext.musicDataUrl = (dataURL == (id) [NSNull null]) ? nil : dataURL ; ext.musicDataUrl = (dataURL == (id) [NSNull null]) ? nil : dataURL;
} }
...@@ -207,7 +206,7 @@ ...@@ -207,7 +206,7 @@
InScene:(enum WXScene)scene { InScene:(enum WXScene)scene {
WXMiniProgramObject *ext = [WXMiniProgramObject object]; WXMiniProgramObject *ext = [WXMiniProgramObject object];
ext.webpageUrl = (webpageUrl == (id) [NSNull null]) ? nil : webpageUrl; ext.webpageUrl = (webpageUrl == (id) [NSNull null]) ? nil : webpageUrl;
ext.userName =(userName == (id) [NSNull null]) ? nil : userName ; ext.userName = (userName == (id) [NSNull null]) ? nil : userName;
ext.path = (path == (id) [NSNull null]) ? nil : path; ext.path = (path == (id) [NSNull null]) ? nil : path;
ext.hdImageData = (hdImageData == (id) [NSNull null]) ? nil : hdImageData; ext.hdImageData = (hdImageData == (id) [NSNull null]) ? nil : hdImageData;
ext.withShareTicket = withShareTicket; ext.withShareTicket = withShareTicket;
...@@ -389,7 +388,6 @@ ...@@ -389,7 +388,6 @@
} }
+ (BOOL)sendPayment:(NSString *)appId PartnerId:(NSString *)partnerId PrepayId:(NSString *)prepayId NonceStr:(NSString *)nonceStr Timestamp:(UInt32)timestamp Package:(NSString *)package Sign:(NSString *)sign { + (BOOL)sendPayment:(NSString *)appId PartnerId:(NSString *)partnerId PrepayId:(NSString *)prepayId NonceStr:(NSString *)nonceStr Timestamp:(UInt32)timestamp Package:(NSString *)package Sign:(NSString *)sign {
PayReq *req = [[PayReq alloc] init]; PayReq *req = [[PayReq alloc] init];
...@@ -402,8 +400,6 @@ ...@@ -402,8 +400,6 @@
req.sign = sign; req.sign = sign;
return [WXApi sendReq:req]; return [WXApi sendReq:req];
} }
......
...@@ -37,7 +37,11 @@ abstract class WeChatShareModel { ...@@ -37,7 +37,11 @@ abstract class WeChatShareModel {
final String mediaTagName; final String mediaTagName;
final WeChatScene scene; final WeChatScene scene;
WeChatShareModel({this.messageExt, this.messageAction, this.mediaTagName, this.scene: WeChatScene.SESSION}); WeChatShareModel(
{this.messageExt,
this.messageAction,
this.mediaTagName,
this.scene: WeChatScene.SESSION});
Map toMap(); Map toMap();
} }
...@@ -51,10 +55,20 @@ class WeChatShareTextModel extends WeChatShareModel { ...@@ -51,10 +55,20 @@ class WeChatShareTextModel extends WeChatShareModel {
final String transaction; final String transaction;
///transaction only works on Android. ///transaction only works on Android.
WeChatShareTextModel({String text, String transaction, WeChatScene scene, String messageExt, String messageAction, String mediaTagName}) WeChatShareTextModel(
{String text,
String transaction,
WeChatScene scene,
String messageExt,
String messageAction,
String mediaTagName})
: this.text = text ?? "", : this.text = text ?? "",
this.transaction = transaction ?? "text", this.transaction = transaction ?? "text",
super(mediaTagName: mediaTagName, messageAction: messageAction, messageExt: messageExt, scene: scene); super(
mediaTagName: mediaTagName,
messageAction: messageAction,
messageExt: messageExt,
scene: scene);
@override @override
Map toMap() { Map toMap() {
...@@ -114,7 +128,11 @@ class WeChatShareMiniProgramModel extends WeChatShareModel { ...@@ -114,7 +128,11 @@ class WeChatShareMiniProgramModel extends WeChatShareModel {
assert(webPageUrl != null && webPageUrl.isNotEmpty), assert(webPageUrl != null && webPageUrl.isNotEmpty),
assert(userName != null && userName.isNotEmpty), assert(userName != null && userName.isNotEmpty),
assert(path != null && path.isNotEmpty), assert(path != null && path.isNotEmpty),
super(mediaTagName: mediaTagName, messageAction: messageAction, messageExt: messageExt, scene: scene); super(
mediaTagName: mediaTagName,
messageAction: messageAction,
messageExt: messageExt,
scene: scene);
@override @override
Map toMap() { Map toMap() {
...@@ -158,7 +176,11 @@ class WeChatShareImageModel extends WeChatShareModel { ...@@ -158,7 +176,11 @@ class WeChatShareImageModel extends WeChatShareModel {
this.thumbnail = thumbnail ?? "", this.thumbnail = thumbnail ?? "",
assert(image != null), assert(image != null),
this.imageData = null, this.imageData = null,
super(mediaTagName: mediaTagName, messageAction: messageAction, messageExt: messageExt, scene: scene); super(
mediaTagName: mediaTagName,
messageAction: messageAction,
messageExt: messageExt,
scene: scene);
WeChatShareImageModel.fromFile( WeChatShareImageModel.fromFile(
File imageFile, { File imageFile, {
...@@ -174,7 +196,11 @@ class WeChatShareImageModel extends WeChatShareModel { ...@@ -174,7 +196,11 @@ class WeChatShareImageModel extends WeChatShareModel {
this.transaction = transaction ?? "text", this.transaction = transaction ?? "text",
this.thumbnail = thumbnail ?? "", this.thumbnail = thumbnail ?? "",
this.imageData = null, this.imageData = null,
super(mediaTagName: mediaTagName, messageAction: messageAction, messageExt: messageExt, scene: scene); super(
mediaTagName: mediaTagName,
messageAction: messageAction,
messageExt: messageExt,
scene: scene);
WeChatShareImageModel.fromUint8List({ WeChatShareImageModel.fromUint8List({
@required this.imageData, @required this.imageData,
...@@ -190,7 +216,11 @@ class WeChatShareImageModel extends WeChatShareModel { ...@@ -190,7 +216,11 @@ class WeChatShareImageModel extends WeChatShareModel {
this.thumbnail = thumbnail ?? "", this.thumbnail = thumbnail ?? "",
this.image = "", this.image = "",
assert(imageData != null), assert(imageData != null),
super(mediaTagName: mediaTagName, messageAction: messageAction, messageExt: messageExt, scene: scene); super(
mediaTagName: mediaTagName,
messageAction: messageAction,
messageExt: messageExt,
scene: scene);
@override @override
Map toMap() { Map toMap() {
...@@ -237,7 +267,11 @@ class WeChatShareMusicModel extends WeChatShareModel { ...@@ -237,7 +267,11 @@ class WeChatShareMusicModel extends WeChatShareModel {
}) : this.transaction = transaction ?? "text", }) : this.transaction = transaction ?? "text",
this.thumbnail = thumbnail ?? "", this.thumbnail = thumbnail ?? "",
assert(musicUrl != null || musicLowBandUrl != null), assert(musicUrl != null || musicLowBandUrl != null),
super(mediaTagName: mediaTagName, messageAction: messageAction, messageExt: messageExt, scene: scene); super(
mediaTagName: mediaTagName,
messageAction: messageAction,
messageExt: messageExt,
scene: scene);
@override @override
Map toMap() { Map toMap() {
...@@ -287,7 +321,11 @@ class WeChatShareVideoModel extends WeChatShareModel { ...@@ -287,7 +321,11 @@ class WeChatShareVideoModel extends WeChatShareModel {
this.thumbnail = thumbnail ?? "", this.thumbnail = thumbnail ?? "",
assert(videoUrl != null || videoLowBandUrl != null), assert(videoUrl != null || videoLowBandUrl != null),
assert(thumbnail != null), assert(thumbnail != null),
super(mediaTagName: mediaTagName, messageAction: messageAction, messageExt: messageExt, scene: scene); super(
mediaTagName: mediaTagName,
messageAction: messageAction,
messageExt: messageExt,
scene: scene);
@override @override
Map toMap() { Map toMap() {
...@@ -326,7 +364,11 @@ class WeChatShareWebPageModel extends WeChatShareModel { ...@@ -326,7 +364,11 @@ class WeChatShareWebPageModel extends WeChatShareModel {
}) : this.transaction = transaction ?? "text", }) : this.transaction = transaction ?? "text",
assert(webPage != null), assert(webPage != null),
assert(thumbnail != null), assert(thumbnail != null),
super(mediaTagName: mediaTagName, messageAction: messageAction, messageExt: messageExt, scene: scene); super(
mediaTagName: mediaTagName,
messageAction: messageAction,
messageExt: messageExt,
scene: scene);
@override @override
Map toMap() { Map toMap() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论