提交 daca43e4 authored 作者: JarvanMo's avatar JarvanMo

support OpenCustomerServiceChat on ios

上级 3c7356b0
...@@ -2,17 +2,11 @@ PODS: ...@@ -2,17 +2,11 @@ PODS:
- Flutter (1.0.0) - Flutter (1.0.0)
- fluwx (0.0.1): - fluwx (0.0.1):
- Flutter - Flutter
- WechatOpenSDK (= 1.8.7.1)
- WechatOpenSDK (1.8.7.1)
DEPENDENCIES: DEPENDENCIES:
- Flutter (from `Flutter`) - Flutter (from `Flutter`)
- fluwx (from `.symlinks/plugins/fluwx/ios`) - fluwx (from `.symlinks/plugins/fluwx/ios`)
SPEC REPOS:
trunk:
- WechatOpenSDK
EXTERNAL SOURCES: EXTERNAL SOURCES:
Flutter: Flutter:
:path: Flutter :path: Flutter
...@@ -20,9 +14,8 @@ EXTERNAL SOURCES: ...@@ -20,9 +14,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/fluwx/ios" :path: ".symlinks/plugins/fluwx/ios"
SPEC CHECKSUMS: SPEC CHECKSUMS:
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
fluwx: 07a55ed66bf3a4961e836a2a411b02dcada32902 fluwx: c64c2b84b965279aaa251a80b5b6a1cd0ef7bd45
WechatOpenSDK: 6a4d1436c15b3b5fe2a0bd383f3046010186da44
PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d
......
...@@ -149,7 +149,6 @@ ...@@ -149,7 +149,6 @@
97C146EC1CF9000F007C117D /* Resources */, 97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */, 9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
193B0A2F7BBE7B22CD4D85EA /* [CP] Embed Pods Frameworks */,
); );
buildRules = ( buildRules = (
); );
...@@ -207,24 +206,6 @@ ...@@ -207,24 +206,6 @@
/* End PBXResourcesBuildPhase section */ /* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */
193B0A2F7BBE7B22CD4D85EA /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../Flutter/Flutter.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#import <Flutter/Flutter.h> #import <Flutter/Flutter.h>
#import "FluwxPlugin.h" #import "FluwxPlugin.h"
#import "WXApiRequestHandler.h" #import "WXApiRequestHandler.h"
#import <WechatOpenSDK/WechatAuthSDK.h> #import "WechatAuthSDK.h"
@class FluwxStringUtil; @class FluwxStringUtil;
......
...@@ -74,6 +74,8 @@ FlutterMethodChannel *channel = nil; ...@@ -74,6 +74,8 @@ FlutterMethodChannel *channel = nil;
[self handelGetExtMsgWithCall:call result:result]; [self handelGetExtMsgWithCall:call result:result];
} else if ([call.method hasPrefix:@"share"]) { } else if ([call.method hasPrefix:@"share"]) {
[_fluwxShareHandler handleShare:call result:result]; [_fluwxShareHandler handleShare:call result:result];
} else if ([@"openWeChatCustomerServiceChat" isEqualToString:call.method]) {
[self checkWeChatInstallation:call result:result];
} else { } else {
result(FlutterMethodNotImplemented); result(FlutterMethodNotImplemented);
} }
...@@ -109,6 +111,12 @@ FlutterMethodChannel *channel = nil; ...@@ -109,6 +111,12 @@ FlutterMethodChannel *channel = nil;
result(@([WXApi isWXAppInstalled])); result(@([WXApi isWXAppInstalled]));
} }
- (void)openWeChatCustomerServiceChat:(FlutterMethodCall *)call result:(FlutterResult)result {
NSString *url = call.arguments[@"url"];
NSString *corpId = call.arguments[@"corpId"];
result(@([WXApi isWXAppInstalled]));
}
- (void)handlePayment:(FlutterMethodCall *)call result:(FlutterResult)result { - (void)handlePayment:(FlutterMethodCall *)call result:(FlutterResult)result {
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#import <Flutter/Flutter.h> #import <Flutter/Flutter.h>
#import <Flutter/Flutter.h> #import <Flutter/Flutter.h>
#import <WechatOpenSDK/WXApi.h> #import "WXApi.h"
#import <WechatOpenSDK/WXApiObject.h> #import "WXApiObject.h"
@protocol WXApiManagerDelegate <NSObject> @protocol WXApiManagerDelegate <NSObject>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#import <Flutter/Flutter.h> #import <Flutter/Flutter.h>
#import "FluwxStringUtil.h" #import "FluwxStringUtil.h"
#import <WechatOpenSDK/WXApiObject.h> #import "WXApiObject.h"
#import "FluwxResponseHandler.h" #import "FluwxResponseHandler.h"
@implementation FluwxResponseHandler @implementation FluwxResponseHandler
...@@ -189,6 +189,20 @@ FlutterMethodChannel *fluwxMethodChannel = nil; ...@@ -189,6 +189,20 @@ FlutterMethodChannel *fluwxMethodChannel = nil;
}; };
[fluwxMethodChannel invokeMethod:@"onWXOpenBusinessWebviewResponse" arguments:result]; [fluwxMethodChannel invokeMethod:@"onWXOpenBusinessWebviewResponse" arguments:result];
} else if ([resp isKindOfClass:[WXOpenCustomerServiceResp class]])
{
WXOpenCustomerServiceResp *customerResp = (WXOpenCustomerServiceResp *) resp;
NSDictionary *result = @{
description: [FluwxStringUtil nilToEmpty:customerResp.description],
errStr: [FluwxStringUtil nilToEmpty:resp.errStr],
errCode: @(customerResp.errCode),
type: @(customerResp.type),
@"extMsg":[FluwxStringUtil nilToEmpty:customerResp.extMsg]
};
[fluwxMethodChannel invokeMethod:@"onWXOpenBusinessWebviewResponse" arguments:result];
// 相关错误信息
} }
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// //
// //
#import <WechatOpenSDK/WXApiObject.h> #import "WXApiObject.h"
@interface SendMessageToWXReq (requestWithTextOrMediaMessage) @interface SendMessageToWXReq (requestWithTextOrMediaMessage)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <WechatOpenSDK/WXApiObject.h> #import "WXApiObject.h"
#import "FluwxResponseHandler.h" #import "FluwxResponseHandler.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
...@@ -144,6 +144,10 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -144,6 +144,10 @@ NS_ASSUME_NONNULL_BEGIN
Package:(NSString *)package Package:(NSString *)package
Sign:(NSString *)sign Sign:(NSString *)sign
completion:(void (^ __nullable)(BOOL success))completion; completion:(void (^ __nullable)(BOOL success))completion;
+ (void)openCustomerService:(NSString *)url
CorpId:(NSString *)corpId
completion:(void (^ __nullable)(BOOL success))completion;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
// Created by mo on 2020/3/7. // Created by mo on 2020/3/7.
// //
#import <WechatOpenSDK/WXApi.h> #import "WXApi.h"
#import "WXApiRequestHandler.h" #import "WXApiRequestHandler.h"
#import "SendMessageToWXReq+requestWithTextOrMediaMessage.h" #import "SendMessageToWXReq+requestWithTextOrMediaMessage.h"
#import "WXMediaMessage+messageConstruct.h" #import "WXMediaMessage+messageConstruct.h"
#import "FluwxStringUtil.h" #import "FluwxStringUtil.h"
#import <WechatOpenSDK/WXApiObject.h> #import "WXApiObject.h"
@implementation WXApiRequestHandler @implementation WXApiRequestHandler
...@@ -400,4 +400,10 @@ ...@@ -400,4 +400,10 @@
[WXApi sendReq:req completion:completion]; [WXApi sendReq:req completion:completion];
} }
+ (void)openCustomerService:(NSString *)url CorpId:(NSString *)corpId completion:(void (^)(BOOL))completion{
WXOpenCustomerServiceReq *req = [[WXOpenCustomerServiceReq alloc] init];
req.corpid = corpId; //企业ID
req.url = url; //客服URL
[WXApi sendReq:req completion:completion];
}
@end @end
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// Created by Jeason on 15/7/14. // Created by Jeason on 15/7/14.
// //
// //
#import <WechatOpenSDK/WXApiObject.h> #import "WXApiObject.h"
@interface WXMediaMessage (messageConstruct) @interface WXMediaMessage (messageConstruct)
......
...@@ -17,7 +17,7 @@ A new Flutter plugin for Wechat SDK. ...@@ -17,7 +17,7 @@ A new Flutter plugin for Wechat SDK.
s.public_header_files = 'Classes/public/*.h' s.public_header_files = 'Classes/public/*.h'
s.static_framework = true s.static_framework = true
s.dependency 'Flutter' s.dependency 'Flutter'
s.dependency 'WechatOpenSDK', '1.8.7.1' # s.dependency 'WechatOpenSDK', '1.8.7.1'
# s.dependency 'OpenWeChatSDK','~> 1.8.3+10' # s.dependency 'OpenWeChatSDK','~> 1.8.3+10'
# s.xcconfig = { 'HEADER_SEARCH_PATHS' => "${PODS_ROOT}/Headers/Public/#{s.name}" } # s.xcconfig = { 'HEADER_SEARCH_PATHS' => "${PODS_ROOT}/Headers/Public/#{s.name}" }
......
...@@ -128,8 +128,11 @@ class WeChatPaymentResponse extends BaseWeChatResponse { ...@@ -128,8 +128,11 @@ class WeChatPaymentResponse extends BaseWeChatResponse {
} }
class WeChatOpenCustomerServiceChatResponse extends BaseWeChatResponse { class WeChatOpenCustomerServiceChatResponse extends BaseWeChatResponse {
final String? extMsg;
WeChatOpenCustomerServiceChatResponse.fromMap(Map map) WeChatOpenCustomerServiceChatResponse.fromMap(Map map)
:super._(map[_errCode], map[_errStr]); : extMsg = map["extMsg"],
super._(map[_errCode], map[_errStr]);
} }
class WeChatSubscribeMsgResponse extends BaseWeChatResponse { class WeChatSubscribeMsgResponse extends BaseWeChatResponse {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论