Skip to content

Commit 11fefee

Browse files
committed
Use a queue to open url for responses
1 parent 092c083 commit 11fefee

File tree

3 files changed

+23
-37
lines changed

3 files changed

+23
-37
lines changed

SampleApp/CallbackURLKitDemo.xcodeproj/project.pbxproj

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@
133133
C4A4AA811C399A1500932E7D /* Frameworks */,
134134
C4A4AA821C399A1500932E7D /* Resources */,
135135
29D6102BC003EED9855ADBD4 /* [CP] Embed Pods Frameworks */,
136-
89741B56380A005A9DBA7783 /* [CP] Copy Pods Resources */,
137136
);
138137
buildRules = (
139138
);
@@ -153,7 +152,6 @@
153152
C4E32D651C3999AE005CD033 /* Frameworks */,
154153
C4E32D661C3999AE005CD033 /* Resources */,
155154
CCC8BBF076C969AA95C8AFF2 /* [CP] Embed Pods Frameworks */,
156-
3F536F998DC22ECAA96D50B8 /* [CP] Copy Pods Resources */,
157155
);
158156
buildRules = (
159157
);
@@ -229,58 +227,34 @@
229227
files = (
230228
);
231229
inputPaths = (
230+
"${SRCROOT}/Pods/Target Support Files/Pods-CallbackURLKitDemoOSX/Pods-CallbackURLKitDemoOSX-frameworks.sh",
231+
"${BUILT_PRODUCTS_DIR}/CallbackURLKit-macOS/CallbackURLKit.framework",
232232
);
233233
name = "[CP] Embed Pods Frameworks";
234234
outputPaths = (
235+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CallbackURLKit.framework",
235236
);
236237
runOnlyForDeploymentPostprocessing = 0;
237238
shellPath = /bin/sh;
238239
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CallbackURLKitDemoOSX/Pods-CallbackURLKitDemoOSX-frameworks.sh\"\n";
239240
showEnvVarsInLog = 0;
240241
};
241-
3F536F998DC22ECAA96D50B8 /* [CP] Copy Pods Resources */ = {
242-
isa = PBXShellScriptBuildPhase;
243-
buildActionMask = 2147483647;
244-
files = (
245-
);
246-
inputPaths = (
247-
);
248-
name = "[CP] Copy Pods Resources";
249-
outputPaths = (
250-
);
251-
runOnlyForDeploymentPostprocessing = 0;
252-
shellPath = /bin/sh;
253-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CallbackURLKitDemo/Pods-CallbackURLKitDemo-resources.sh\"\n";
254-
showEnvVarsInLog = 0;
255-
};
256242
415F2217D034A4A9F563E750 /* [CP] Check Pods Manifest.lock */ = {
257243
isa = PBXShellScriptBuildPhase;
258244
buildActionMask = 2147483647;
259245
files = (
260246
);
261247
inputPaths = (
248+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
249+
"${PODS_ROOT}/Manifest.lock",
262250
);
263251
name = "[CP] Check Pods Manifest.lock";
264252
outputPaths = (
253+
"$(DERIVED_FILE_DIR)/Pods-CallbackURLKitDemoOSX-checkManifestLockResult.txt",
265254
);
266255
runOnlyForDeploymentPostprocessing = 0;
267256
shellPath = /bin/sh;
268-
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
269-
showEnvVarsInLog = 0;
270-
};
271-
89741B56380A005A9DBA7783 /* [CP] Copy Pods Resources */ = {
272-
isa = PBXShellScriptBuildPhase;
273-
buildActionMask = 2147483647;
274-
files = (
275-
);
276-
inputPaths = (
277-
);
278-
name = "[CP] Copy Pods Resources";
279-
outputPaths = (
280-
);
281-
runOnlyForDeploymentPostprocessing = 0;
282-
shellPath = /bin/sh;
283-
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CallbackURLKitDemoOSX/Pods-CallbackURLKitDemoOSX-resources.sh\"\n";
257+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
284258
showEnvVarsInLog = 0;
285259
};
286260
CCC8BBF076C969AA95C8AFF2 /* [CP] Embed Pods Frameworks */ = {
@@ -289,9 +263,12 @@
289263
files = (
290264
);
291265
inputPaths = (
266+
"${SRCROOT}/Pods/Target Support Files/Pods-CallbackURLKitDemo/Pods-CallbackURLKitDemo-frameworks.sh",
267+
"${BUILT_PRODUCTS_DIR}/CallbackURLKit-iOS/CallbackURLKit.framework",
292268
);
293269
name = "[CP] Embed Pods Frameworks";
294270
outputPaths = (
271+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CallbackURLKit.framework",
295272
);
296273
runOnlyForDeploymentPostprocessing = 0;
297274
shellPath = /bin/sh;
@@ -304,13 +281,16 @@
304281
files = (
305282
);
306283
inputPaths = (
284+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
285+
"${PODS_ROOT}/Manifest.lock",
307286
);
308287
name = "[CP] Check Pods Manifest.lock";
309288
outputPaths = (
289+
"$(DERIVED_FILE_DIR)/Pods-CallbackURLKitDemo-checkManifestLockResult.txt",
310290
);
311291
runOnlyForDeploymentPostprocessing = 0;
312292
shellPath = /bin/sh;
313-
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
293+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
314294
showEnvVarsInLog = 0;
315295
};
316296
/* End PBXShellScriptBuildPhase section */

SampleApp/CallbackURLKitDemo/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import UIKit
1313

1414
@UIApplicationMain
1515
class AppDelegate: UIResponder, UIApplicationDelegate {
16-
16+
var window: UIWindow?
1717
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
1818
let manager = Manager.shared
1919
manager.callbackURLScheme = Manager.urlSchemes?.first

Sources/Manager.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ open class Manager {
4040
var requests: [RequestID: Request] = [:]
4141

4242
open var callbackURLScheme: String?
43+
44+
open var callbackQueue: DispatchQueue = .main
4345

4446
#if APP_EXTENSIONS
4547
/// In case of application extension, put your extensionContext here
@@ -126,7 +128,9 @@ open class Manager {
126128
var comp = URLComponents(url: url, resolvingAgainstBaseURL: false)!
127129
comp &= error.XCUErrorQuery
128130
if let newURL = comp.url {
129-
self.open(url: newURL)
131+
callbackQueue.async {
132+
self.open(url: newURL)
133+
}
130134
}
131135
return true
132136
}
@@ -139,7 +143,9 @@ open class Manager {
139143
var comp = URLComponents(url: url, resolvingAgainstBaseURL: false) {
140144
handler?(&comp)
141145
if let newURL = comp.url {
142-
self.open(url: newURL)
146+
callbackQueue.async {
147+
self.open(url: newURL)
148+
}
143149
}
144150
}
145151
}

0 commit comments

Comments
 (0)