-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into cleanup-demo-files
- Loading branch information
Showing
16 changed files
with
145 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
Braintree.xcworkspace/xcshareddata/swiftpm/Package.resolved
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"pins" : [ | ||
{ | ||
"identity" : "paypalcheckout-ios", | ||
"kind" : "remoteSourceControl", | ||
"location" : "https://github.com/paypal/paypalcheckout-ios/", | ||
"state" : { | ||
"revision" : "7c6750e1316c6a3d656e90497271de68c63219f1", | ||
"version" : "1.1.0" | ||
} | ||
} | ||
], | ||
"version" : 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import Foundation | ||
|
||
@UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { | ||
|
||
private let returnURLScheme = "com.braintreepayments.Demo.payments" | ||
private let processInfoArgs = ProcessInfo.processInfo.arguments | ||
private let userDefaults = UserDefaults.standard | ||
|
||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { | ||
registerDefaultsFromSettings() | ||
persistDemoSettings() | ||
BTAppContextSwitcher.sharedInstance.returnURLScheme = returnURLScheme | ||
|
||
userDefaults.setValue(true, forKey: "magnes.debug.mode") | ||
|
||
return true | ||
} | ||
|
||
func registerDefaultsFromSettings() { | ||
if processInfoArgs.contains("-EnvironmentSandbox") { | ||
userDefaults.set(BraintreeDemoEnvironment.sandbox.rawValue, forKey: BraintreeDemoSettings.EnvironmentDefaultsKey) | ||
} else if processInfoArgs.contains("-EnvironmentProduction") { | ||
userDefaults.set(BraintreeDemoEnvironment.production.rawValue, forKey: BraintreeDemoSettings.EnvironmentDefaultsKey) | ||
} | ||
|
||
if processInfoArgs.contains("-ClientToken") { | ||
userDefaults.set(BraintreeDemoAuthType.clientToken.rawValue, forKey: BraintreeDemoSettings.AuthorizationTypeDefaultsKey) | ||
} else if processInfoArgs.contains("-TokenizationKey") { | ||
userDefaults.set(BraintreeDemoAuthType.tokenizationKey.rawValue, forKey: BraintreeDemoSettings.AuthorizationTypeDefaultsKey) | ||
} else if processInfoArgs.contains("-MockedPayPalTokenizationKey") { | ||
userDefaults.set(BraintreeDemoAuthType.mockedPayPalTokenizationKey.rawValue, forKey: BraintreeDemoSettings.AuthorizationTypeDefaultsKey) | ||
} else if processInfoArgs.contains("-UITestHardcodedClientToken") { | ||
userDefaults.set(BraintreeDemoAuthType.uiTestHardcodedClientToken.rawValue, forKey: BraintreeDemoSettings.AuthorizationTypeDefaultsKey) | ||
} | ||
|
||
userDefaults.removeObject(forKey: "BraintreeDemoSettingsAuthorizationOverride") | ||
processInfoArgs.forEach { arg in | ||
if arg.contains("-Integration:") { | ||
let testIntegration = arg.replacingOccurrences(of: "-Integration:", with: "") | ||
userDefaults.setValue(testIntegration, forKey: "BraintreeDemoSettingsIntegration") | ||
} else if arg.contains("-Authorization:") { | ||
let testIntegration = arg.replacingOccurrences(of: "-Authorization:", with: "") | ||
userDefaults.setValue(testIntegration, forKey: "BraintreeDemoSettingsAuthorizationOverride") | ||
} | ||
} | ||
|
||
if processInfoArgs.contains("-ClientTokenVersion2") { | ||
userDefaults.set("2", forKey: "BraintreeDemoSettingsClientTokenVersionDefaultsKey") | ||
} else if processInfoArgs.contains("-ClientTokenVersion3") { | ||
userDefaults.set("3", forKey: "BraintreeDemoSettingsClientTokenVersionDefaultsKey") | ||
} | ||
} | ||
|
||
func persistDemoSettings() { | ||
guard let settingsBundle = Bundle.main.path(forResource: "Settings", ofType: "bundle"), | ||
let settings = NSDictionary(contentsOfFile: settingsBundle.appending("/Root.plist")) else { | ||
print("Could not find Settings.bundle") | ||
return | ||
} | ||
|
||
if let preferences = settings.object(forKey: "PreferenceSpecifiers") as? Array<[String: Any]> { | ||
var defaultsToRegister: [String: Any] = [:] | ||
preferences.forEach { prefSpecification in | ||
print(prefSpecification) | ||
if let key = prefSpecification["Key"] as? String, prefSpecification.keys.contains("DefaultValue") { | ||
defaultsToRegister[key] = prefSpecification["DefaultValue"] | ||
} | ||
} | ||
|
||
userDefaults.register(defaults: defaultsToRegister) | ||
} | ||
} | ||
|
||
// MARK: - UISceneSession lifecycle | ||
|
||
func application( | ||
_ application: UIApplication, | ||
configurationForConnecting connectingSceneSession: UISceneSession, | ||
options: UIScene.ConnectionOptions | ||
) -> UISceneConfiguration { | ||
// Called when a new scene session is being created. | ||
// Use this method to select a configuration to create the new scene with. | ||
UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import Foundation | ||
|
||
class SceneDelegate: UIResponder, UIWindowSceneDelegate { | ||
|
||
var window: UIWindow? | ||
|
||
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | ||
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. | ||
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene. | ||
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). | ||
|
||
if let windowScene = scene as? UIWindowScene { | ||
window = UIWindow(windowScene: windowScene) | ||
window?.rootViewController = UINavigationController(rootViewController: BraintreeDemoContainmentViewController()) | ||
window?.makeKeyAndVisible() | ||
} | ||
} | ||
|
||
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) { | ||
URLContexts.forEach { urlContext in | ||
let url = urlContext.url | ||
if url.scheme?.localizedCaseInsensitiveCompare("com.braintreepayments.Demo.payments") == .orderedSame { | ||
_ = BTAppContextSwitcher.sharedInstance.handleOpenURL(context: urlContext) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,6 @@ | |
<array> | ||
<integer>0</integer> | ||
<integer>1</integer> | ||
<integer>2</integer> | ||
</array> | ||
</dict> | ||
<dict> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#import "BraintreeDemoBaseViewController.h" | ||
#import <BraintreeVenmo/BraintreeVenmo-Swift.h> | ||
#import "BraintreeDemoPaymentButtonBaseViewController.h" | ||
#import "BraintreeDemoContainmentViewController.h" |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.