mirror of
https://github.com/little-snow-fox/react-native-wechat-lib.git
synced 2025-12-06 15:26:49 +08:00
🔨IOS support, Troubleshoot errors caused by compatibility problems with the old and new SDKS
This commit is contained in:
parent
aaa4f0785e
commit
0be3244535
@ -12,8 +12,6 @@
|
|||||||
#define NOT_REGISTERED (@"registerApp required.")
|
#define NOT_REGISTERED (@"registerApp required.")
|
||||||
#define INVOKE_FAILED (@"WeChat API invoke returns false.")
|
#define INVOKE_FAILED (@"WeChat API invoke returns false.")
|
||||||
|
|
||||||
@implementation RCTWeChat
|
|
||||||
|
|
||||||
@synthesize bridge = _bridge;
|
@synthesize bridge = _bridge;
|
||||||
|
|
||||||
RCT_EXPORT_MODULE()
|
RCT_EXPORT_MODULE()
|
||||||
@ -231,7 +229,7 @@ RCT_EXPORT_METHOD(shareText:(NSDictionary *)data
|
|||||||
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
||||||
req.bText = YES;
|
req.bText = YES;
|
||||||
req.text = data[@"text"];
|
req.text = data[@"text"];
|
||||||
req.scene = [data[@"scene"] integerValue];
|
req.scene = [data[@"scene"] intValue];
|
||||||
void ( ^ completion )( BOOL );
|
void ( ^ completion )( BOOL );
|
||||||
completion = ^( BOOL success )
|
completion = ^( BOOL success )
|
||||||
{
|
{
|
||||||
@ -278,7 +276,7 @@ RCT_EXPORT_METHOD(shareFile:(NSDictionary *)data
|
|||||||
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
||||||
req.bText = NO;
|
req.bText = NO;
|
||||||
req.message = message;
|
req.message = message;
|
||||||
req.scene = [data[@"scene"] integerValue];
|
req.scene = [data[@"scene"] intValue];
|
||||||
void ( ^ completion )( BOOL );
|
void ( ^ completion )( BOOL );
|
||||||
completion = ^( BOOL success )
|
completion = ^( BOOL success )
|
||||||
{
|
{
|
||||||
@ -322,7 +320,7 @@ RCT_EXPORT_METHOD(shareImage:(NSDictionary *)data
|
|||||||
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
||||||
req.bText = NO;
|
req.bText = NO;
|
||||||
req.message = message;
|
req.message = message;
|
||||||
req.scene = [data[@"scene"] integerValue];
|
req.scene = [data[@"scene"] intValue];
|
||||||
// [WXApi sendReq:req];
|
// [WXApi sendReq:req];
|
||||||
void ( ^ completion )( BOOL );
|
void ( ^ completion )( BOOL );
|
||||||
completion = ^( BOOL success )
|
completion = ^( BOOL success )
|
||||||
@ -367,7 +365,7 @@ RCT_EXPORT_METHOD(shareLocalImage:(NSDictionary *)data
|
|||||||
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
||||||
req.bText = NO;
|
req.bText = NO;
|
||||||
req.message = message;
|
req.message = message;
|
||||||
req.scene = [data[@"scene"] integerValue];
|
req.scene = [data[@"scene"] intValue];
|
||||||
// [WXApi sendReq:req];
|
// [WXApi sendReq:req];
|
||||||
void ( ^ completion )( BOOL );
|
void ( ^ completion )( BOOL );
|
||||||
completion = ^( BOOL success )
|
completion = ^( BOOL success )
|
||||||
@ -401,7 +399,7 @@ RCT_EXPORT_METHOD(shareMusic:(NSDictionary *)data
|
|||||||
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
||||||
req.bText = NO;
|
req.bText = NO;
|
||||||
req.message = message;
|
req.message = message;
|
||||||
req.scene = [data[@"scene"] integerValue];
|
req.scene = [data[@"scene"] intValue];
|
||||||
void ( ^ completion )( BOOL );
|
void ( ^ completion )( BOOL );
|
||||||
completion = ^( BOOL success )
|
completion = ^( BOOL success )
|
||||||
{
|
{
|
||||||
@ -430,7 +428,7 @@ RCT_EXPORT_METHOD(shareVideo:(NSDictionary *)data
|
|||||||
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
||||||
req.bText = NO;
|
req.bText = NO;
|
||||||
req.message = message;
|
req.message = message;
|
||||||
req.scene = [data[@"scene"] integerValue];
|
req.scene = [data[@"scene"] intValue];
|
||||||
void ( ^ completion )( BOOL );
|
void ( ^ completion )( BOOL );
|
||||||
completion = ^( BOOL success )
|
completion = ^( BOOL success )
|
||||||
{
|
{
|
||||||
@ -458,7 +456,7 @@ RCT_EXPORT_METHOD(shareWebpage:(NSDictionary *)data
|
|||||||
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
||||||
req.bText = NO;
|
req.bText = NO;
|
||||||
req.message = message;
|
req.message = message;
|
||||||
req.scene = [data[@"scene"] integerValue];
|
req.scene = [data[@"scene"] intValue];
|
||||||
void ( ^ completion )( BOOL );
|
void ( ^ completion )( BOOL );
|
||||||
completion = ^( BOOL success )
|
completion = ^( BOOL success )
|
||||||
{
|
{
|
||||||
@ -483,7 +481,8 @@ RCT_EXPORT_METHOD(shareMiniProgram:(NSDictionary *)data
|
|||||||
object.hdImageData = [self compressImage: image toByte:131072];
|
object.hdImageData = [self compressImage: image toByte:131072];
|
||||||
}
|
}
|
||||||
object.withShareTicket = data[@"withShareTicket"];
|
object.withShareTicket = data[@"withShareTicket"];
|
||||||
object.miniProgramType = [data[@"miniProgramType"] integerValue];
|
int miniProgramType = [data[@"miniProgramType"] integerValue];
|
||||||
|
object.miniProgramType = [self integerToWXMiniProgramType:miniProgramType];
|
||||||
WXMediaMessage *message = [WXMediaMessage message];
|
WXMediaMessage *message = [WXMediaMessage message];
|
||||||
message.title = data[@"title"];
|
message.title = data[@"title"];
|
||||||
message.description = data[@"description"];
|
message.description = data[@"description"];
|
||||||
@ -534,7 +533,9 @@ RCT_EXPORT_METHOD(launchMiniProgram:(NSDictionary *)data
|
|||||||
// 拉起小程序页面的可带参路径,不填默认拉起小程序首页
|
// 拉起小程序页面的可带参路径,不填默认拉起小程序首页
|
||||||
launchMiniProgramReq.path = data[@"path"];
|
launchMiniProgramReq.path = data[@"path"];
|
||||||
// 拉起小程序的类型
|
// 拉起小程序的类型
|
||||||
launchMiniProgramReq.miniProgramType = [data[@"miniProgramType"] integerValue];
|
int miniProgramType = [data[@"miniProgramType"] integerValue];
|
||||||
|
launchMiniProgramReq.miniProgramType = [self integerToWXMiniProgramType:miniProgramType];
|
||||||
|
// launchMiniProgramReq.miniProgramType = [data[@"miniProgramType"] integerValue];
|
||||||
void ( ^ completion )( BOOL );
|
void ( ^ completion )( BOOL );
|
||||||
completion = ^( BOOL success )
|
completion = ^( BOOL success )
|
||||||
{
|
{
|
||||||
@ -644,5 +645,21 @@ RCT_EXPORT_METHOD(pay:(NSDictionary *)data
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(WXMiniProgramType) integerToWXMiniProgramType:(int)value {
|
||||||
|
WXMiniProgramType type = WXMiniProgramTypeRelease;
|
||||||
|
switch (value) {
|
||||||
|
case 0:
|
||||||
|
type = WXMiniProgramTypeRelease;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
type = WXMiniProgramTypeTest;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
type = WXMiniProgramTypePreview;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-native-wechat-lib",
|
"name": "react-native-wechat-lib",
|
||||||
"version": "3.0.1",
|
"version": "3.0.2",
|
||||||
"description": "test",
|
"description": "test",
|
||||||
"main": "lib/commonjs/index",
|
"main": "lib/commonjs/index",
|
||||||
"module": "lib/module/index",
|
"module": "lib/module/index",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user