Skip to content

Navigation Menu

Sign in
Sign up

fix no reponse bug and added favorite #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
uyson wants to merge 2 commits into reactnativecn:master
base: master
Choose a base branch
Loading
from uyson:master
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ public void shareToSession(ReadableMap data, Callback callback){
_share(SendMessageToWX.Req.WXSceneSession, data, callback);
}

@ReactMethod
public void favorite(ReadableMap data, Callback callback){
_share(SendMessageToWX.Req.WXSceneFavorite, data, callback);
}

@ReactMethod
public void pay(ReadableMap data, Callback callback){
PayReq payReq = new PayReq();
Expand Down
6 changes: 5 additions & 1 deletion index.js
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ function wrapApi(nativeFunc) {
const nativeSendAuthRequest = wrapApi(WeChatAPI.login);
const nativeShareToTimelineRequest = wrapApi(WeChatAPI.shareToTimeline);
const nativeShareToSessionRequest = wrapApi(WeChatAPI.shareToSession);
const nativeFavoriteRequest = wrapApi(WeChatAPI.favorite);
const nativePayRequest = wrapApi(WeChatAPI.pay);

export function login(config) {
Expand All @@ -108,7 +109,10 @@ export function shareToSession(data) {
return nativeShareToSessionRequest(data)
.then(() => waitForResponse("SendMessageToWX.Resp"));
}

export function favorite (data) {
return nativeFavoriteRequest(data)
.then(() => waitForResponse("SendMessageToWX.Resp"));
}
export function pay(data) {
return nativePayRequest(data)
.then(() => waitForResponse("Pay.Resp"));
Expand Down
11 changes: 7 additions & 4 deletions ios/RCTWeChatAPI/RCTWeChatAPI.m
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ - (void)dealloc
{
[self shareToWeixinWithData:data scene:WXSceneSession callback:callback];
}
//微信收藏
RCT_EXPORT_METHOD(favorite:(NSDictionary *)data
:(RCTResponseSenderBlock)callback)
{
[self shareToWeixinWithData:data scene:WXSceneFavorite callback:callback];
}

RCT_EXPORT_METHOD(pay:(NSDictionary *)data
:(RCTResponseSenderBlock)callback)
Expand Down Expand Up @@ -187,10 +193,7 @@ - (void)shareToWeixinWithData:(NSDictionary *)aData image:(UIImage *)aImage scen
}

BOOL success = [WXApi sendReq:req];
if (success == NO)
{
callback(@[INVOKE_FAILED]);
}
callback(@[success ? [NSNull null] : INVOKE_FAILED]);
}


Expand Down

AltStyle によって変換されたページ (->オリジナル) /