Merge pull request #334 from mpretty-cyro/feature/appium-env-var-handling

Added basic handling for env vars provided by Appium
pull/1053/head
Morgan Pretty 5 months ago committed by GitHub
commit 907abf1d24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -7677,7 +7677,7 @@
CLANG_WARN__ARC_BRIDGE_CAST_NONARC = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
CURRENT_PROJECT_VERSION = 506;
CURRENT_PROJECT_VERSION = 507;
ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@ -7756,7 +7756,7 @@
CLANG_WARN__ARC_BRIDGE_CAST_NONARC = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CURRENT_PROJECT_VERSION = 506;
CURRENT_PROJECT_VERSION = 507;
ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;

@ -30,6 +30,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
// MARK: - Lifecycle
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Just in case we are running automated tests we should process environment variables
// before we do anything else
DeveloperSettingsViewModel.processUnitTestEnvVariablesIfNeeded()
Log.info("[AppDelegate] didFinishLaunchingWithOptions called.")
startTime = CACurrentMediaTime()

@ -550,6 +550,31 @@ class DeveloperSettingsViewModel: SessionTableViewModel, NavigatableStateHolder,
}
}
// MARK: - Automated Test Convenience
extension DeveloperSettingsViewModel {
static func processUnitTestEnvVariablesIfNeeded() {
#if targetEnvironment(simulator)
enum EnvironmentVariable: String {
case animationsEnabled
}
ProcessInfo.processInfo.environment.forEach { key, value in
guard let variable: EnvironmentVariable = EnvironmentVariable(rawValue: key) else { return }
switch variable {
case .animationsEnabled:
guard value == "false" else { return }
UIView.setAnimationsEnabled(false)
}
}
#endif
}
}
// MARK: - DocumentPickerResult
private class DocumentPickerResult: NSObject, UIDocumentPickerDelegate {
private let onResult: (URL?) -> Void

Loading…
Cancel
Save