提交 45b4bbfb authored 作者: JarvanMo's avatar JarvanMo

ios AppDelegate 调整

上级 6e751a2f
......@@ -17,14 +17,15 @@
// return [WXApi handleOpenURL:url delegate:[FluwxResponseHandler defaultManager]];
//}
//
//
//- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
// [super application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
// return [WXApi handleOpenURL:url delegate:[FluwxResponseHandler defaultManager]];
//}
}
//// NOTE: 9.0以后使用新API接口
//- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options
//{
//
// [super application:app openURL:url options:options];
// return [WXApi handleOpenURL:url delegate:[FluwxResponseHandler defaultManager]];
//}
......
import UIKit
import Flutter
import fluwx
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
override func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return WXApi.handleOpen(url, delegate: FluwxResponseHandler.defaultManager())
}
// NOTE: 9.0以后使用新API接口
override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return WXApi.handleOpen(url, delegate: FluwxResponseHandler.defaultManager())
}
}
//
// Generated file. Do not edit.
//
#ifndef GeneratedPluginRegistrant_h
#define GeneratedPluginRegistrant_h
#import <Flutter/Flutter.h>
@interface GeneratedPluginRegistrant : NSObject
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry;
@end
#endif /* GeneratedPluginRegistrant_h */
//
// Generated file. Do not edit.
//
#import "GeneratedPluginRegistrant.h"
#import <fluwx/FluwxPlugin.h>
@implementation GeneratedPluginRegistrant
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
[FluwxPlugin registerWithRegistrar:[registry registrarForPlugin:@"FluwxPlugin"]];
}
@end
#import "GeneratedPluginRegistrant.h"
......@@ -26,8 +26,7 @@ FluwxLaunchMiniProgramHandler *_fluwxLaunchMiniProgramHandler;
FluwxSubscribeMsgHandler *_fluwxSubscribeMsgHandler;
FluwxAutoDeductHandler *_fluwxAutoDeductHandler;
- (void)dealloc
{
- (void)dealloc {
// [[NSNotificationCenter defaultCenter] removeObserver:self];
}
......@@ -51,20 +50,18 @@ FluwxAutoDeductHandler *_fluwxAutoDeductHandler;
// object:nil];
if (self) {
_fluwxShareHandler = [[FluwxShareHandler alloc] initWithRegistrar:registrar];
_fluwxAuthHandler = [[FluwxAuthHandler alloc] initWithRegistrar:registrar methodChannel:flutterMethodChannel] ;
_fluwxAuthHandler = [[FluwxAuthHandler alloc] initWithRegistrar:registrar methodChannel:flutterMethodChannel];
_fluwxWXApiHandler = [[FluwxWXApiHandler alloc] init];
_fluwxPaymentHandler = [[FluwxPaymentHandler alloc] initWithRegistrar:registrar];
_fluwxLaunchMiniProgramHandler = [[FluwxLaunchMiniProgramHandler alloc] initWithRegistrar:registrar];
_fluwxSubscribeMsgHandler = [[FluwxSubscribeMsgHandler alloc] initWithRegistrar:registrar];
_fluwxAutoDeductHandler =[[FluwxAutoDeductHandler alloc] initWithRegistrar:registrar];
_fluwxAutoDeductHandler = [[FluwxAutoDeductHandler alloc] initWithRegistrar:registrar];
}
return self;
}
- (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result {
......@@ -73,48 +70,48 @@ FluwxAutoDeductHandler *_fluwxAutoDeductHandler;
return;
}
if([@"isWeChatInstalled" isEqualToString :call.method]){
if ([@"isWeChatInstalled" isEqualToString:call.method]) {
[_fluwxWXApiHandler checkWeChatInstallation:call result:result];
return;
}
if([@"sendAuth" isEqualToString :call.method]){
if ([@"sendAuth" isEqualToString:call.method]) {
[_fluwxAuthHandler handleAuth:call result:result];
return;
}
if([@"payWithFluwx" isEqualToString :call.method]){
if ([@"payWithFluwx" isEqualToString:call.method]) {
[_fluwxPaymentHandler handlePayment:call result:result];
return;
}
if([@"launchMiniProgram" isEqualToString :call.method]){
if ([@"launchMiniProgram" isEqualToString:call.method]) {
[_fluwxLaunchMiniProgramHandler handleLaunchMiniProgram:call result:result];
return;
}
if([@"subscribeMsg" isEqualToString: call.method]){
if ([@"subscribeMsg" isEqualToString:call.method]) {
[_fluwxSubscribeMsgHandler handleSubscribeWithCall:call result:result];
return;
}
if([@"authByQRCode" isEqualToString:call.method]){
if ([@"authByQRCode" isEqualToString:call.method]) {
[_fluwxAuthHandler authByQRCode:call result:result];
return;
}
if([@"stopAuthByQRCode" isEqualToString:call.method]){
if ([@"stopAuthByQRCode" isEqualToString:call.method]) {
[_fluwxAuthHandler stopAuthByQRCode:call result:result];
return;
}
if([@"autoDeduct" isEqualToString:call.method]){
if ([@"autoDeduct" isEqualToString:call.method]) {
[_fluwxAutoDeductHandler handleAutoDeductWithCall:call result:result];
return;
}
if([@"openWXApp" isEqualToString:call.method]){
if ([@"openWXApp" isEqualToString:call.method]) {
result(@([WXApi openWXApp]));
return;
}
......@@ -132,22 +129,20 @@ FluwxAutoDeductHandler *_fluwxAutoDeductHandler;
[WXApi handleOpenURL:url delegate:[FluwxResponseHandler defaultManager]];
return NO;
}
// NOTE: 9.0以后使用新API接口
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options
{
[WXApi handleOpenURL:url delegate:[FluwxResponseHandler defaultManager]];
return NO;
// NOTE: 9.0以后使用新API接口
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *, id> *)options {
return [WXApi handleOpenURL:url delegate:[FluwxResponseHandler defaultManager]];
}
-(BOOL)handleOpenURL:(NSNotification *)aNotification {
- (BOOL)handleOpenURL:(NSNotification *)aNotification {
if(handleOpenURLByFluwx){
NSString * aURLString = [aNotification userInfo][@"url"];
NSURL * aURL = [NSURL URLWithString:aURLString];
if (handleOpenURLByFluwx) {
NSString *aURLString = [aNotification userInfo][@"url"];
NSURL *aURL = [NSURL URLWithString:aURLString];
return [WXApi handleOpenURL:aURL delegate:[FluwxResponseHandler defaultManager]];
} else{
} else {
return NO;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论