@@ -21,6 +21,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
21
21
22
22
public static var gitVC = [ String: GitViewController] ( )
23
23
public static var gitProgress : GitProgress ?
24
+
25
+ // MARK: Static Properties
26
+ static let applicationShortcutUserInfoIconKey = " applicationShortcutUserInfoIconKey "
24
27
25
28
func application( _ application: UIApplication , didFinishLaunchingWithOptions launchOptions: [ UIApplication . LaunchOptionsKey : Any ] ? ) -> Bool {
26
29
var shouldPerformAdditionalDelegateHandling = true
@@ -108,16 +111,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
108
111
func applicationWillEnterForeground( _ application: UIApplication ) {
109
112
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
110
113
}
111
-
112
- func applicationDidBecomeActive( _ application: UIApplication ) {
113
- // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
114
-
115
- guard let shortcut = launchedShortcutItem else { return }
116
- _ = handleShortCutItem ( shortcut)
117
-
118
- // Reset which shortcut was chosen for next time.
119
- launchedShortcutItem = nil
120
- }
121
114
122
115
func application( _ application: UIApplication , willFinishLaunchingWithOptions launchOptions: [ UIApplication . LaunchOptionsKey : Any ] ? = nil ) -> Bool {
123
116
if let iCloudDocumentsURL = FileManager . default. url ( forUbiquityContainerIdentifier: nil ) ? . appendingPathComponent ( " Documents " ) . standardized,
@@ -134,43 +127,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
134
127
}
135
128
136
129
func application( _ application: UIApplication , performActionFor shortcutItem: UIApplicationShortcutItem , completionHandler: @escaping ( Bool ) -> Void ) {
137
- let handledShortCutItem = handleShortCutItem ( shortcutItem)
138
- completionHandler ( handledShortCutItem)
139
- }
140
-
141
- // MARK: Static Properties
142
- static let applicationShortcutUserInfoIconKey = " applicationShortcutUserInfoIconKey "
143
-
144
- func handleShortCutItem( _ shortcutItem: UIApplicationShortcutItem ) -> Bool {
145
- var handled = false
146
- guard ShortcutIdentifier ( fullType: shortcutItem. type) != nil else { return false }
147
- guard let shortCutType = shortcutItem. type as String ? else { return false }
148
-
149
- let vc = UIApplication . getVC ( )
150
-
151
- switch shortCutType {
152
- case ShortcutIdentifier . makeNew. type:
153
- vc. createNote ( )
154
-
155
- handled = true
156
- break
157
- case ShortcutIdentifier . clipboard. type:
158
- vc. createNote ( pasteboard: true )
159
-
160
- handled = true
161
- break
162
- case ShortcutIdentifier . search. type:
163
- vc. loadViewIfNeeded ( )
164
- vc. popViewController ( )
165
- vc. loadSearchController ( )
166
- handled = true
167
- break
168
- default :
169
-
170
- break
130
+
131
+ if ShortcutIdentifier ( fullType: shortcutItem. type) == . search {
132
+ UIApplication . getVC ( ) . enableSearchFocus ( )
171
133
}
172
-
173
- return handled
134
+
135
+ UIApplication . getVC ( ) . handleShortCutItem ( shortcutItem)
136
+ completionHandler ( true )
174
137
}
175
138
176
139
func application( _ app: UIApplication , open url: URL , options: [ UIApplication . OpenURLOptionsKey : Any ] = [ : ] ) -> Bool {
@@ -191,6 +154,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
191
154
note = storage. getBy ( title: id)
192
155
if !vc. isLoadedDB, note == nil {
193
156
vc. restoreFindID = id
157
+ return true
194
158
}
195
159
}
196
160
}
0 commit comments