From 3da78163b0fb5cac065f17ab8eed59a615ee2d8a Mon Sep 17 00:00:00 2001 From: xiaoyi Date: Wed, 14 Jul 2021 14:28:42 +0800 Subject: [PATCH] feat: update ios delegate handler , remove taptap login editor folder --- Editor.meta | 3 --- Editor/TapLoginIOSProcessor.cs | 24 ----------------- Editor/TapLoginIOSProcessor.cs.meta | 3 --- Editor/TapTap.Login.Editor.asmdef | 16 ----------- Editor/TapTap.Login.Editor.asmdef.meta | 7 ----- Plugins/iOS/TapLoginDelegate.h | 16 +++++++++++ Plugins/iOS/TapLoginDelegate.h.meta | 27 +++++++++++++++++++ Plugins/iOS/TapLoginDelegate.mm | 33 +++++++++++++++++++++++ Plugins/iOS/TapLoginDelegate.mm.meta | 37 ++++++++++++++++++++++++++ 9 files changed, 113 insertions(+), 53 deletions(-) delete mode 100644 Editor.meta delete mode 100644 Editor/TapLoginIOSProcessor.cs delete mode 100644 Editor/TapLoginIOSProcessor.cs.meta delete mode 100644 Editor/TapTap.Login.Editor.asmdef delete mode 100644 Editor/TapTap.Login.Editor.asmdef.meta create mode 100644 Plugins/iOS/TapLoginDelegate.h create mode 100644 Plugins/iOS/TapLoginDelegate.h.meta create mode 100644 Plugins/iOS/TapLoginDelegate.mm create mode 100644 Plugins/iOS/TapLoginDelegate.mm.meta diff --git a/Editor.meta b/Editor.meta deleted file mode 100644 index 6b5494f..0000000 --- a/Editor.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 66c985194a5444c2a336b60bdb132f74 -timeCreated: 1617120951 \ No newline at end of file diff --git a/Editor/TapLoginIOSProcessor.cs b/Editor/TapLoginIOSProcessor.cs deleted file mode 100644 index 25e1d30..0000000 --- a/Editor/TapLoginIOSProcessor.cs +++ /dev/null @@ -1,24 +0,0 @@ -using TapTap.Common.Editor; -using UnityEditor; -using UnityEditor.Callbacks; -using UnityEngine; - -namespace TapTap.Login.Editor -{ - public static class TapLoginIOSProcessor - { - [PostProcessBuild(102)] - public static void OnPostprocessBuild(BuildTarget buildTarget, string path) - { - if (buildTarget != BuildTarget.iOS) return; - - var unityAppControllerPath = path + "/Classes/UnityAppController.mm"; - var unityAppController = new TapFileHelper(unityAppControllerPath); - unityAppController.WriteBelow(@"#import ", @"#import "); - unityAppController.WriteBelow( - @"id sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey], annotation = options[UIApplicationOpenURLOptionsAnnotationKey];", - @"if(url){[TapLoginHelper handleTapTapOpenURL:url];}"); - Debug.Log("TapLogin Change AppControler File!"); - } - } -} \ No newline at end of file diff --git a/Editor/TapLoginIOSProcessor.cs.meta b/Editor/TapLoginIOSProcessor.cs.meta deleted file mode 100644 index 5b770de..0000000 --- a/Editor/TapLoginIOSProcessor.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 50ded018333a4dc8ba19e7806c5bc693 -timeCreated: 1617120951 \ No newline at end of file diff --git a/Editor/TapTap.Login.Editor.asmdef b/Editor/TapTap.Login.Editor.asmdef deleted file mode 100644 index 8d5ef25..0000000 --- a/Editor/TapTap.Login.Editor.asmdef +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "TapTap.Login.Editor", - "references": [ - "TapTap.Common.Editor" - ], - "optionalUnityReferences": [], - "includePlatforms": [ - "Editor" - ], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [] -} \ No newline at end of file diff --git a/Editor/TapTap.Login.Editor.asmdef.meta b/Editor/TapTap.Login.Editor.asmdef.meta deleted file mode 100644 index b4da319..0000000 --- a/Editor/TapTap.Login.Editor.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: a9157d20880b14db485aa407a4532958 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Plugins/iOS/TapLoginDelegate.h b/Plugins/iOS/TapLoginDelegate.h new file mode 100644 index 0000000..78d854e --- /dev/null +++ b/Plugins/iOS/TapLoginDelegate.h @@ -0,0 +1,16 @@ +// +// TapDelegate.h +// Unity-iPhone +// +// Created by xe on 2021/7/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface TapLoginDelegate : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/Plugins/iOS/TapLoginDelegate.h.meta b/Plugins/iOS/TapLoginDelegate.h.meta new file mode 100644 index 0000000..d08f132 --- /dev/null +++ b/Plugins/iOS/TapLoginDelegate.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 1520c63afb87b41f282b202f5313765e +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Plugins/iOS/TapLoginDelegate.mm b/Plugins/iOS/TapLoginDelegate.mm new file mode 100644 index 0000000..dff776a --- /dev/null +++ b/Plugins/iOS/TapLoginDelegate.mm @@ -0,0 +1,33 @@ +// +// TapDelegate.m +// Unity-iPhone +// +// Created by xe on 2021/7/14. +// + +#import +#import +#import +#include "AppDelegateListener.h" +#include "LifeCycleListener.h" +#import "TapLoginDelegate.h" +#import + +@implementation TapLoginDelegate + ++(void) load{ + static dispatch_once_t onceToken; + dispatch_once(&onceToken,^{ + + NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; + [nc addObserverForName:kUnityOnOpenURL object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) { + if ([note.userInfo isKindOfClass: [NSMutableDictionary class]]) { + NSURL* url = [note.userInfo objectForKey:@"url"]; + [TapLoginHelper handleTapTapOpenURL:url]; + } + }]; + + }); +} + +@end diff --git a/Plugins/iOS/TapLoginDelegate.mm.meta b/Plugins/iOS/TapLoginDelegate.mm.meta new file mode 100644 index 0000000..d760293 --- /dev/null +++ b/Plugins/iOS/TapLoginDelegate.mm.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: 199b104d5cf2740eca32b1d48f6f59fc +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: