Commit 4365b06d authored by xgz's avatar xgz

去掉京东sdkios部分

parent 1de50ba2
#import <Foundation/Foundation.h>
#import <Flutter/Flutter.h>
NS_ASSUME_NONNULL_BEGIN
@interface FlutterKeplerHandler : NSObject
//初始化
- (void)initKepler:(FlutterMethodCall *)call result:(FlutterResult)result;
// * 通过URL打开任意商品页面
- (void)keplerPageWithURL:(FlutterMethodCall *)call result:(FlutterResult)result;
//设置进度条颜色
- (void)setKeplerProgressBarColor:(FlutterMethodCall *)call result:(FlutterResult)result;
@end
NS_ASSUME_NONNULL_END
#import "FlutterKeplerHandler.h"
#import <JDKeplerSDK/JDKeplerSDK.h>
@implementation FlutterKeplerHandler
//初始化开普勒
- (void)initKepler:(FlutterMethodCall *)call result:(FlutterResult)result {
NSString *appKey = call.arguments[@"appKey"];
NSString *appSecret = call.arguments[@"appSecret"];
NSLog (@"appKey is :%@", appKey);
NSLog (@"appSecret is :%@", appSecret);
[[KeplerApiManager sharedKPService]asyncInitSdk:appKey secretKey:appSecret sucessCallback:^(){
NSLog (@"success");
result(@"{status:1}");
}failedCallback:^(NSError *error){
NSLog (@"fail");
result(@"{status:0}");
}];
}
- (void)keplerPageWithURL:(FlutterMethodCall *)call result:(FlutterResult)result {
NSString *url = call.arguments[@"url"];
// NSInteger jumpType = [call.arguments[@"jumpType"] integerValue];
NSInteger jumpType = [[NSNumber numberWithInt:1] integerValue];
// NSDictionary *userInfo = [FlutterKeplerTools nullToNil:call.arguments[@"userInfo"]];
UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
if ([[UIApplication sharedApplication]canOpenURL:[NSURL URLWithString:[NSString stringWithFormat:@"openapp.jdmobile://"]]]) {//判断是否安装京东app
// [ [KeplerApiManager sharedKPService]openKeplerPageWithURL:url userInfo:nil successCallback:^{
// NSLog (@"success");
// result(@"{status:1}");
// } failedCallback:^(NSInteger code, NSString * _Nonnull url) {
// NSLog (@"fail");
// result(@"{status:0}");
// }];
[[KeplerApiManager sharedKPService] openKeplerPageWithURL:url userInfo:nil hiddenNavigationBar:true];
result(@"{status:1}");
}else{
result(@"{status:0}");
}
}
@end
#import "JdsdkPlugin.h"
#import "FlutterKeplerHandler.h"
@interface JdsdkPlugin()
@property(nonatomic,strong) FlutterKeplerHandler *keplerHandler;
@end
......@@ -18,27 +16,10 @@
[registrar addMethodCallDelegate:instance channel:channel];
}
- (instancetype)initWithRegistrar:(NSObject <FlutterPluginRegistrar> *)registrar {
NSLog(@"initWithRegistrar");
self = [super init];
if (self) {
self.keplerHandler = [[FlutterKeplerHandler alloc]init];
}
return self;
}
- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
if ([@"getPlatformVersion" isEqualToString:call.method]) {
result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]);
} else if ([@"init" isEqualToString:call.method]) {
NSLog(@"init flutter");
[_keplerHandler initKepler:call result:result];
}else if ([@"openUrl" isEqualToString:call.method]) {
[_keplerHandler keplerPageWithURL:call result:result];
}else {
} else {
result(FlutterMethodNotImplemented);
}
}
......
//
// JDKeplerSDK.h
// JDKeplerSDK
//
// Created by JD.K on 16/3/15.
// Copyright © 2016年 JD.K. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for JDKeplerSDK.
FOUNDATION_EXPORT double JDKeplerSDKVersionNumber;
//! Project version string for JDKeplerSDK.
FOUNDATION_EXPORT const unsigned char JDKeplerSDKVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <JDKeplerSDK/PublicHeader.h>
#import<JDKeplerSDK/KeplerApiManager.h>
framework module JDKeplerSDK {
umbrella header "JDKeplerSDK.h"
export *
module * { export * }
}
8Ns95
\ No newline at end of file
......@@ -18,13 +18,8 @@ A new Flutter plugin.
s.dependency 'Flutter'
# 京东导入
# s.vendored_frameworks = 'Framework/*.framework'
s.vendored_frameworks ="JDKepler/*.framework"
# s.resource = ''
s.platform = :ios, '10.0'
s.static_framework = true
# Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment