Skip to content

Commit

Permalink
Make Glia.configuration private(set)
Browse files Browse the repository at this point in the history
  • Loading branch information
Egor Egorov authored and github-review-helper committed Oct 25, 2023
1 parent 74d5ab4 commit 1a1b4e0
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 12 deletions.
3 changes: 2 additions & 1 deletion GliaWidgets/Public/Glia/Glia.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public class Glia {
var uiConfig: RemoteConfiguration?
var assetsBuilder: RemoteConfiguration.AssetsBuilder = .standard

var configuration: Configuration?
private(set) var configuration: Configuration?

init(environment: Environment) {
self.environment = environment
Expand Down Expand Up @@ -375,6 +375,7 @@ extension Glia {

#if DEBUG
extension Glia {
/// Used for unit tests only
var isConfigured: Bool {
configuration != nil
}
Expand Down
4 changes: 0 additions & 4 deletions GliaWidgets/Sources/Interactor/Interactor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ class Interactor {
self.environment = environment
}

deinit {
print("☠️", Self.self, ObjectIdentifier(self))
}

func addObserver(_ observer: AnyObject, handler: @escaping EventHandler) {
guard !observers.contains(where: { $0().0 === observer }) else { return }
observers.append { [weak observer] in (observer, handler) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ extension ChatViewModelTests {
}
let interactorMock = Interactor.mock(environment: interactorEnv)
interactorMock.state = .engaged(nil)
// interactorMock.isConfigurationPerformed = true

var env = ChatViewModel.Environment.failing()
env.fileManager.fileExistsAtPath = { _ in true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ extension ChatViewModelTests {
}
let interactorMock = Interactor.mock(environment: interactorEnv)
interactorMock.state = .engaged(nil)
// interactorMock.isConfigurationPerformed = true

viewModel = .mock(interactor: interactorMock, environment: env)

Expand All @@ -80,7 +79,6 @@ extension ChatViewModelTests {

let interactorMock = Interactor.mock(environment: interactorEnv)
interactorMock.state = .none
// interactorMock.isConfigurationPerformed = true

var env = ChatViewModel.Environment.failing()
env.fileManager.fileExistsAtPath = { _ in true }
Expand Down Expand Up @@ -136,7 +134,6 @@ extension ChatViewModelTests {
}
let interactorMock = Interactor.mock(environment: interactorEnv)
interactorMock.state = .engaged(nil)
// interactorMock.isConfigurationPerformed = true
let viewModel = ChatViewModel.mock(interactor: interactorMock, environment: env)

let messagesSectionIndex = 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ extension ChatViewModelTests {
interactorEnv.coreSdk.queueForEngagement = { _, _ in }
interactorEnv.coreSdk.configureWithInteractor = { _ in }
let interactorMock = Interactor.mock(environment: interactorEnv)
// interactorMock.isConfigurationPerformed = true

var env = ChatViewModel.Environment.failing()
env.fileManager.fileExistsAtPath = { _ in true }
Expand Down
4 changes: 2 additions & 2 deletions GliaWidgetsTests/Sources/Glia/GliaTests+StartEngagement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ extension GliaTests {
}

environment.coreSdk.localeProvider.getRemoteString = { _ in "" }
environment.coreSdk.configureWithInteractor = { _ in }
environment.coreSdk.configureWithConfiguration = { _, completion in
environment.coreSDKConfigurator.configureWithInteractor = { _ in }
environment.coreSDKConfigurator.configureWithConfiguration = { _, completion in
// Simulating what happens in the Widgets when the configuration gets done
Glia.sharedInstance.stringProviding = StringProviding(
getRemoteString: environment.coreSdk.localeProvider.getRemoteString
Expand Down

0 comments on commit 1a1b4e0

Please sign in to comment.