2020-02-22 11:21:27 +08:00
|
|
|
|
//
|
|
|
|
|
// AppDelegate.m
|
|
|
|
|
// demo
|
|
|
|
|
//
|
|
|
|
|
// Created by 杨涛 on 2020/2/6.
|
|
|
|
|
// Copyright © 2020 finogeeks. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#import "AppDelegate.h"
|
|
|
|
|
#import "ViewController.h"
|
2020-12-04 14:09:34 +08:00
|
|
|
|
#import "FINExtensionHelper.h"
|
2020-12-18 09:28:26 +08:00
|
|
|
|
#import "FINDemoClientHelper.h"
|
2020-02-22 11:21:27 +08:00
|
|
|
|
|
|
|
|
|
#import <FinApplet/FinApplet.h>
|
2021-08-19 19:47:47 +08:00
|
|
|
|
#import <WechatOpenSDK/WXApi.h>
|
2020-02-22 11:21:27 +08:00
|
|
|
|
|
|
|
|
|
@interface AppDelegate ()
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
@implementation AppDelegate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
|
|
|
|
// Override point for customization after application launch.
|
|
|
|
|
|
2021-08-19 19:47:47 +08:00
|
|
|
|
// servers.plist维护了不同应用,初始化finclip的参数(因为微信支付需要绑定一个可用的账号)
|
|
|
|
|
NSString *bundleId = [NSBundle mainBundle].bundleIdentifier;
|
|
|
|
|
NSString *path = [[NSBundle mainBundle] pathForResource:@"servers" ofType:@"plist"];
|
|
|
|
|
NSDictionary *servers = [NSDictionary dictionaryWithContentsOfFile:path];
|
|
|
|
|
NSDictionary *data = servers[bundleId];
|
|
|
|
|
NSString *appKey = data[@"appKey"];
|
|
|
|
|
NSString *appSecret = data[@"appSecret"];
|
|
|
|
|
NSString *apiServer = data[@"apiServer"];
|
|
|
|
|
NSString *apiPrefix = data[@"apiPrefix"];
|
|
|
|
|
FATApiCryptType cryptType = [data[@"cryptType"] isEqualToString:@"MD5"] ? FATApiCryptTypeMD5 : FATApiCryptTypeSM;
|
2020-02-22 11:21:27 +08:00
|
|
|
|
|
2021-08-19 19:47:47 +08:00
|
|
|
|
FATConfig *config = [FATConfig configWithAppSecret:appSecret appKey:appKey];
|
|
|
|
|
config.apiServer = apiServer;
|
|
|
|
|
config.apiPrefix = apiPrefix;
|
|
|
|
|
config.cryptType = cryptType;
|
2020-02-22 11:21:27 +08:00
|
|
|
|
[[FATClient sharedClient] initWithConfig:config error:nil];
|
2021-07-19 10:23:05 +08:00
|
|
|
|
[[FATClient sharedClient] setEnableLog:YES];
|
2020-02-22 11:21:27 +08:00
|
|
|
|
|
2020-12-18 09:28:26 +08:00
|
|
|
|
[FATClient sharedClient].delegate = [FINDemoClientHelper sharedHelper];
|
2021-08-19 19:47:47 +08:00
|
|
|
|
// 注入自定义api
|
|
|
|
|
[[FINExtensionHelper sharedHelper] registerCustomApis];
|
2020-12-18 09:28:26 +08:00
|
|
|
|
|
2021-08-19 19:47:47 +08:00
|
|
|
|
// 该appID【wx85663af68a0cbbc8】绑定的应用为凡泰助手,若要生效,请修改BundleID为com.finogeeks.mop.finosprite
|
|
|
|
|
[WXApi registerApp:@"wx85663af68a0cbbc8" universalLink:apiServer];
|
2020-12-04 14:09:34 +08:00
|
|
|
|
|
2020-02-22 11:21:27 +08:00
|
|
|
|
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
|
|
|
self.window.backgroundColor = [UIColor whiteColor];
|
|
|
|
|
self.window.rootViewController = [[ViewController alloc] init];
|
|
|
|
|
[self.window makeKeyAndVisible];
|
|
|
|
|
|
|
|
|
|
return YES;
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-19 19:47:47 +08:00
|
|
|
|
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options {
|
|
|
|
|
if ([url.scheme isEqualToString:@"wx85663af68a0cbbc8"]) {
|
|
|
|
|
return [WXApi handleOpenURL:url delegate:(id<WXApiDelegate> _Nullable)[FINExtensionHelper sharedHelper]];
|
|
|
|
|
}
|
|
|
|
|
return YES;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-22 11:21:27 +08:00
|
|
|
|
@end
|