Skip to content

Commit

Permalink
Fixes Swift format/lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
travis79 committed Apr 16, 2021
1 parent 1088d61 commit 974806e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
1 change: 0 additions & 1 deletion components/nimbus/ios/Nimbus/NimbusApi.swift
Expand Up @@ -118,7 +118,6 @@ public protocol NimbusUserConfiguration {
/// - Returns A list of `AvailableExperiment`s
///
func getAvailableExperiments() -> [AvailableExperiment]

}

/// Notifications emitted by the `NotificationCenter`.
Expand Down
52 changes: 28 additions & 24 deletions components/nimbus/ios/Nimbus/NimbusCreate.swift
Expand Up @@ -20,7 +20,7 @@ public let defaultErrorReporter: NimbusErrorReporter = { err in
}
}

extension Nimbus {
public extension Nimbus {
/// Create an instance of `Nimbus`.
///
/// - Parameters:
Expand All @@ -32,12 +32,13 @@ extension Nimbus {
/// - Returns an implementation of `NimbusApi`.
/// - Throws `NimbusError` if anything goes wrong with the Rust FFI or in the `NimbusClient` constructor.
///
public static func create(_ server: NimbusServerSettings?,
appSettings: NimbusAppSettings,
dbPath: String,
enabled: Bool = true,
errorReporter: @escaping NimbusErrorReporter = defaultErrorReporter) throws -> NimbusApi
{
static func create(
_ server: NimbusServerSettings?,
appSettings: NimbusAppSettings,
dbPath: String,
enabled: Bool = true,
errorReporter: @escaping NimbusErrorReporter = defaultErrorReporter
) throws -> NimbusApi {
guard enabled else {
return NimbusDisabled.shared
}
Expand All @@ -63,23 +64,26 @@ extension Nimbus {
return Nimbus(nimbusClient: nimbusClient, errorReporter: errorReporter)
}

public static func buildExperimentContext(_ appSettings: NimbusAppSettings,
bundle: Bundle = Bundle.main,
device: UIDevice = .current) -> AppContext
{
static func buildExperimentContext(
_ appSettings: NimbusAppSettings,
bundle: Bundle = Bundle.main,
device: UIDevice = .current
) -> AppContext {
let info = bundle.infoDictionary ?? [:]
return AppContext(appName: appSettings.appName,
appId: info["CFBundleIdentifier"] as? String ?? "unknown",
channel: appSettings.channel,
appVersion: info["CFBundleShortVersionString"] as? String,
appBuild: info["CFBundleVersion"] as? String,
architecture: Sysctl.machine, // Sysctl is from Glean.
deviceManufacturer: Sysctl.manufacturer,
deviceModel: Sysctl.model,
locale: getLocaleTag(), // from Glean utils
os: device.systemName,
osVersion: device.systemVersion,
androidSdkVersion: nil,
debugTag: "Nimbus.rs")
return AppContext(
appName: appSettings.appName,
appId: info["CFBundleIdentifier"] as? String ?? "unknown",
channel: appSettings.channel,
appVersion: info["CFBundleShortVersionString"] as? String,
appBuild: info["CFBundleVersion"] as? String,
architecture: Sysctl.machine, // Sysctl is from Glean.
deviceManufacturer: Sysctl.manufacturer,
deviceModel: Sysctl.model,
locale: getLocaleTag(), // from Glean utils
os: device.systemName,
osVersion: device.systemVersion,
androidSdkVersion: nil,
debugTag: "Nimbus.rs"
)
}
}

0 comments on commit 974806e

Please sign in to comment.