Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import io.bitdrift.capture.replay.SessionReplayConfiguration
* any external 3rd party library integration
* @param enableNativeCrashReporting When set to true will capture native NDK crashes automatically.
* Requires enableFatalIssueReporting to be true. Note: This is a temporary flag and may be removed in future versions.
* @param sleepMode SleepMode.ACTIVE if Capture should initialize in minimal activity mode
* @param sleepMode SleepMode.ENABLED if Capture should initialize in minimal activity mode
*/
data class Configuration
@JvmOverloads
constructor(
val sessionReplayConfiguration: SessionReplayConfiguration? = SessionReplayConfiguration(),
val enableFatalIssueReporting: Boolean = true,
val enableNativeCrashReporting: Boolean = false,
val sleepMode: SleepMode = SleepMode.INACTIVE,
val sleepMode: SleepMode = SleepMode.DISABLED,
)
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ internal class LoggerImpl(
network,
preferences,
localErrorReporter,
configuration.sleepMode == SleepMode.ACTIVE,
configuration.sleepMode == SleepMode.ENABLED,
)

check(loggerId != -1L) { "initialization of the rust logger failed" }
Expand Down Expand Up @@ -410,7 +410,7 @@ internal class LoggerImpl(
}

override fun setSleepMode(sleepMode: SleepMode) {
CaptureJniLibrary.setSleepModeEnabled(this.loggerId, sleepMode == SleepMode.ACTIVE)
CaptureJniLibrary.setSleepModeEnabled(this.loggerId, sleepMode == SleepMode.ENABLED)
}

@JvmName("logFields")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ package io.bitdrift.capture
*/
enum class SleepMode {
/** Capture will operate in minimal activity mode */
ACTIVE,
ENABLED,

/** Capture will operate normally */
INACTIVE,
DISABLED,
}
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class SdkRepository(
}

fun setSleepModeEnabled(enabled: Boolean) {
val mode = if (enabled) SleepMode.ACTIVE else SleepMode.INACTIVE
val mode = if (enabled) SleepMode.ENABLED else SleepMode.DISABLED
Logger.setSleepMode(mode)
sharedPreferences.edit { putBoolean(PREFS_SLEEP_MODE_ENABLED, enabled) }
}
Expand Down
4 changes: 2 additions & 2 deletions platform/swift/source/LoggerBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ final class LoggerBridge: LoggerBridging {
model,
network,
errorReporting,
sleepMode == SleepMode.active
sleepMode == SleepMode.enabled
)

if loggerID == -1 {
Expand Down Expand Up @@ -267,7 +267,7 @@ final class LoggerBridge: LoggerBridging {
}

func setSleepMode(_ mode: SleepMode) {
capture_set_sleep_mode(self.loggerID, mode == .active)
capture_set_sleep_mode(self.loggerID, mode == .enabled)
}

func processCrashReports() {
Expand Down
2 changes: 1 addition & 1 deletion platform/swift/source/LoggerBridgingFactoryProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protocol LoggerBridgingFactoryProvider {
/// - parameter model: The host device model.
/// - parameter network: The interface to use for network operations.
/// - parameter errorReporting: The interface to use for reporting errors.
/// - parameter sleepMode: .active if sleep mode should be initialized now
/// - parameter sleepMode: .enabled if sleep mode should be initialized now
///
/// - returns: The logger bridging instance.
func makeLogger(
Expand Down
4 changes: 2 additions & 2 deletions platform/swift/source/LoggerObjc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public final class LoggerObjc: NSObject {
/// Bitdrift.
/// Defaults to Bitdrift's hosted Compose API base URL.
/// - parameter enableURLSessionIntegration: A flag indicating if automatic URLSession capture is enabled.
/// - parameter sleepMode: .active if Capture should be initialized in minimal activity mode.
/// - parameter sleepMode: .enabled if Capture should be initialized in minimal activity mode.
/// - parameter enableFatalIssueReporting: true if Capture should enable Fatal Issue Reporting.
@objc
public static func start(
Expand All @@ -188,7 +188,7 @@ public final class LoggerObjc: NSObject {
// swiftlint:disable:next force_unwrapping use_static_string_url_init
apiURL: URL = URL(string: "https://api.bitdrift.io")!,
enableURLSessionIntegration: Bool = true,
sleepMode: SleepMode = .inactive,
sleepMode: SleepMode = .disabled,
enableFatalIssueReporting: Bool = true
) {
let logger = Capture.Logger
Expand Down
6 changes: 3 additions & 3 deletions platform/swift/source/features/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public struct Configuration {
/// The session replay configuration. Pass `nil` to disable session replay.
public var sessionReplayConfiguration: SessionReplayConfiguration?

/// .active if Capture should initialize in minimal activity mode
/// .enabled if Capture should initialize in minimal activity mode
public var sleepMode: SleepMode

/// true if Capture should enable Fatal Issue Reporting
Expand All @@ -21,11 +21,11 @@ public struct Configuration {
/// Initializes a new instance of the Capture configuration.
///
/// - parameter sessionReplayConfiguration: The session replay configuration to use. Passing `nil` disables the feature.
/// - parameter sleepMode: .active if Capture should initialize in minimal activity mode
/// - parameter sleepMode: .enabled if Capture should initialize in minimal activity mode
/// - parameter enableFatalIssueReporting: true if Capture should enable Fatal Issue Reporting
public init(
sessionReplayConfiguration: SessionReplayConfiguration? = .init(),
sleepMode: SleepMode = .inactive,
sleepMode: SleepMode = .disabled,
enableFatalIssueReporting: Bool = true
) {
self.sessionReplayConfiguration = sessionReplayConfiguration
Expand Down
4 changes: 2 additions & 2 deletions platform/swift/source/features/SleepMode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

@objc(CAPSleepMode)
public enum SleepMode: Int8 {
case active
case inactive
case enabled
case disabled
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ final class ConfigurationTests: XCTestCase {

func testConfigurationDefaultValues() {
let config = Configuration()
XCTAssertEqual(config.sleepMode, SleepMode.inactive)
XCTAssertEqual(config.sleepMode, SleepMode.disabled)
}

func testConfigurationFailure() {
Expand Down
4 changes: 2 additions & 2 deletions test/platform/swift/unit_integration/core/LoggerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ final class LoggerTests: XCTestCase {
withAPIKey: "some_key",
loggerBridgingFactoryProvider: MockLoggerBridgingFactory(logger: bridge)
)
logger.setSleepMode(.active)
XCTAssertEqual(bridge.sleepMode, .active)
logger.setSleepMode(.enabled)
XCTAssertEqual(bridge.sleepMode, .enabled)
}

func testErrorLogging() throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ open class BaseNetworkingTestCase: XCTestCase {
model: "",
network: network,
errorReporting: MockRemoteErrorReporter(),
sleepMode: .inactive
sleepMode: .disabled
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public final class MockLoggerBridging {

public private(set) var errors: [HandledError] = []

public private(set) var sleepMode: SleepMode = .inactive
public private(set) var sleepMode: SleepMode = .disabled

public var shouldLogAppUpdateEvent = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public final class MockLogging {
/// A closure that's called every time a log is emitted by the logger.
public var onLog: (_ log: Log) -> Void = { _ in }
/// The sleep mode state
public private(set) var sleepMode: SleepMode = .inactive
public private(set) var sleepMode: SleepMode = .disabled
}

extension MockLogging: Logging {
Expand Down
Loading