Skip to content

Commit

Permalink
Merge branch 'main' into cleanup-demo-files
Browse files Browse the repository at this point in the history
  • Loading branch information
scannillo committed Oct 9, 2023
2 parents 6b368f9 + b73df5a commit c1e8eab
Show file tree
Hide file tree
Showing 16 changed files with 145 additions and 217 deletions.
2 changes: 1 addition & 1 deletion Braintree.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Braintree"
s.version = "6.6.0"
s.version = "6.7.0"
s.summary = "Braintree iOS SDK: Helps you accept card and alternative payments in your iOS app."
s.description = <<-DESC
Braintree is a full-stack payments platform for developers
Expand Down
14 changes: 14 additions & 0 deletions Braintree.xcworkspace/xcshareddata/swiftpm/Package.resolved
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
}
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Braintree iOS SDK Release Notes

## unreleased
## 6.7.0 (2023-10-09)
* BraintreeCore
* Fix bug where `type` was always returned as `Unknown` in `fetchPaymentMethodNonces` (fixes #1099)
* Analytics
Expand Down
85 changes: 85 additions & 0 deletions Demo/Application/Base/AppDelegate.swift
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)
}
}
7 changes: 0 additions & 7 deletions Demo/Application/Base/BraintreeDemoAppDelegate.h

This file was deleted.

116 changes: 0 additions & 116 deletions Demo/Application/Base/BraintreeDemoAppDelegate.m

This file was deleted.

7 changes: 0 additions & 7 deletions Demo/Application/Base/BraintreeDemoSceneDelegate.h

This file was deleted.

52 changes: 0 additions & 52 deletions Demo/Application/Base/BraintreeDemoSceneDelegate.m

This file was deleted.

27 changes: 27 additions & 0 deletions Demo/Application/Base/SceneDelegate.swift
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)
}
}
}
}
1 change: 0 additions & 1 deletion Demo/Application/Base/Settings/Settings.bundle/Root.plist
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
<array>
<integer>0</integer>
<integer>1</integer>
<integer>2</integer>
</array>
</dict>
<dict>
Expand Down
6 changes: 3 additions & 3 deletions Demo/Application/Supporting Files/Braintree-Demo-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>6.6.0</string>
<string>6.7.0</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -56,7 +56,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>6.6.0</string>
<string>6.7.0</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>com.braintreepayments.Demo.payments</string>
Expand Down Expand Up @@ -84,7 +84,7 @@
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>BraintreeDemoSceneDelegate</string>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
</dict>
</array>
</dict>
Expand Down
1 change: 1 addition & 0 deletions Demo/Application/Supporting Files/Demo-Bridging-Header.h
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"
10 changes: 0 additions & 10 deletions Demo/Application/Supporting Files/main.m

This file was deleted.

Loading

0 comments on commit c1e8eab

Please sign in to comment.