Skip to content

Commit

Permalink
Refactor FXIOS-7301 - Help to remove 1 closure_body_length violation …
Browse files Browse the repository at this point in the history
…from UITestAppDelegate.swift (1/3) #21333

* Extract webserver port config to a new function

* Use the new function

* Change access modifier
  • Loading branch information
ionixjunior authored Aug 14, 2024
1 parent eb41f4c commit ecc6357
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions firefox-ios/Client/Application/UITestAppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@ class UITestAppDelegate: AppDelegate, FeatureFlaggable {

launchArguments.forEach { arg in
if arg.starts(with: LaunchArguments.ServerPort) {
let portString = arg.replacingOccurrences(of: LaunchArguments.ServerPort, with: "")
if let port = Int(portString) {
AppInfo.webserverPort = port
} else {
fatalError("Failed to set web server port override.")
}
configureWebserverPort(arg)
}

if arg.starts(with: LaunchArguments.LoadDatabasePrefix) {
Expand Down Expand Up @@ -200,6 +195,15 @@ class UITestAppDelegate: AppDelegate, FeatureFlaggable {
return profile
}

private func configureWebserverPort(_ arg: String) {
let portString = arg.replacingOccurrences(of: LaunchArguments.ServerPort, with: "")
if let port = Int(portString) {
AppInfo.webserverPort = port
} else {
fatalError("Failed to set web server port override.")
}
}

override func application(
_ application: UIApplication,
willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
Expand Down

0 comments on commit ecc6357

Please sign in to comment.