Skip to content

Commit

Permalink
IOS-2548 Remove SoulViewModuleAssembly
Browse files Browse the repository at this point in the history
  • Loading branch information
ignatovv committed Apr 8, 2024
1 parent af2f85c commit 03a2697
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 94 deletions.
4 changes: 0 additions & 4 deletions Anytype.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,6 @@
2E4D78B22A82907E00813A4F /* KeyPhraseMoreInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E4D78B12A82907E00813A4F /* KeyPhraseMoreInfoView.swift */; };
2E52DE672A1CDF3D00F16815 /* LineProgressBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E52DE662A1CDF3D00F16815 /* LineProgressBar.swift */; };
2E52DE692A1CDF5500F16815 /* LineProgressBarConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E52DE682A1CDF5500F16815 /* LineProgressBarConfiguration.swift */; };
2E52DE6C2A1CE77100F16815 /* SoulViewModuleAssembly.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E52DE6B2A1CE77100F16815 /* SoulViewModuleAssembly.swift */; };
2E52DE6E2A1CE7E700F16815 /* SoulViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E52DE6D2A1CE7E700F16815 /* SoulViewModel.swift */; };
2E52DE712A1CEAF700F16815 /* SoulView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E52DE702A1CEAF700F16815 /* SoulView.swift */; };
2E56F1332A0D410E00031167 /* anytype-shader-S.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 2E56F1322A0D410E00031167 /* anytype-shader-S.mp4 */; };
Expand Down Expand Up @@ -2767,7 +2766,6 @@
2E4D78B12A82907E00813A4F /* KeyPhraseMoreInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyPhraseMoreInfoView.swift; sourceTree = "<group>"; };
2E52DE662A1CDF3D00F16815 /* LineProgressBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LineProgressBar.swift; sourceTree = "<group>"; };
2E52DE682A1CDF5500F16815 /* LineProgressBarConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineProgressBarConfiguration.swift; sourceTree = "<group>"; };
2E52DE6B2A1CE77100F16815 /* SoulViewModuleAssembly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoulViewModuleAssembly.swift; sourceTree = "<group>"; };
2E52DE6D2A1CE7E700F16815 /* SoulViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoulViewModel.swift; sourceTree = "<group>"; };
2E52DE702A1CEAF700F16815 /* SoulView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoulView.swift; sourceTree = "<group>"; };
2E56F1322A0D410E00031167 /* anytype-shader-S.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = "anytype-shader-S.mp4"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -7394,7 +7392,6 @@
2E52DE6A2A1CE74500F16815 /* SoulView */ = {
isa = PBXGroup;
children = (
2E52DE6B2A1CE77100F16815 /* SoulViewModuleAssembly.swift */,
2E52DE702A1CEAF700F16815 /* SoulView.swift */,
2E52DE6D2A1CE7E700F16815 /* SoulViewModel.swift */,
);
Expand Down Expand Up @@ -11952,7 +11949,6 @@
12A52E0126CA7BF6000F0333 /* UIViewControllerExtensions.swift in Sources */,
12F14CD02758D09F00B976B5 /* RelationEditingViewModelBuilder.swift in Sources */,
2AB522082A14D0E7007DEE53 /* FileErrorEventHandler.swift in Sources */,
2E52DE6C2A1CE77100F16815 /* SoulViewModuleAssembly.swift in Sources */,
2AE155922A31BDF50049C387 /* RecentCompactListWidgetModuleAssembly.swift in Sources */,
3D932D5826317EFC00C7D1EA /* BaseFilePickerViewModel.swift in Sources */,
12AB96362800867B008E32EA /* StandardButtonModel.swift in Sources */,
Expand Down
6 changes: 1 addition & 5 deletions Anytype/Sources/PresentationLayer/Assemblies/ModulesDI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,7 @@ final class ModulesDI: ModulesDIProtocol {
func authKey() -> KeyPhraseViewModuleAssemblyProtocol {
return KeyPhraseViewModuleAssembly(uiHelpersDI: uiHelpersDI)
}

func authSoul() -> SoulViewModuleAssemblyProtocol {
return SoulViewModuleAssembly(serviceLocator: serviceLocator)
}


func authCreatingSoul() -> CreatingSoulViewModuleAssemblyProtocol {
return CreatingSoulViewModuleAssembly(serviceLocator: serviceLocator)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ protocol ModulesDIProtocol: AnyObject {
func settingsAppearance() -> SettingsAppearanceModuleAssemblyProtocol
func dashboardAlerts() -> DashboardAlertsAssemblyProtocol
func authKey() -> KeyPhraseViewModuleAssemblyProtocol
func authSoul() -> SoulViewModuleAssemblyProtocol
func authCreatingSoul() -> CreatingSoulViewModuleAssemblyProtocol
func setObjectCreationSettings() -> SetObjectCreationSettingsModuleAssemblyProtocol
func setViewSettingsList() -> SetViewSettingsListModuleAssemblyProtocol
Expand Down
2 changes: 1 addition & 1 deletion Anytype/Sources/PresentationLayer/Auth/Auth/AuthView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import AudioToolbox

struct AuthView: View {

@StateObject var model: AuthViewModel
@StateObject private var model: AuthViewModel

init(output: AuthViewModelOutput?) {
_model = StateObject(wrappedValue: AuthViewModel(output: output))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@ final class JoinFlowCoordinator: JoinFlowCoordinatorProtocol, JoinFlowOutput {
// MARK: - DI

private let keyViewModuleAssembly: KeyPhraseViewModuleAssemblyProtocol
private let soulViewModuleAssembly: SoulViewModuleAssemblyProtocol

init(
keyViewModuleAssembly: KeyPhraseViewModuleAssemblyProtocol,
soulViewModuleAssembly: SoulViewModuleAssemblyProtocol
keyViewModuleAssembly: KeyPhraseViewModuleAssemblyProtocol
) {
self.keyViewModuleAssembly = keyViewModuleAssembly
self.soulViewModuleAssembly = soulViewModuleAssembly
}

// MARK: - JoinFlowCoordinatorProtocol
Expand All @@ -32,7 +29,7 @@ final class JoinFlowCoordinator: JoinFlowCoordinatorProtocol, JoinFlowOutput {
func onStepChanged(_ step: JoinFlowStep, state: JoinFlowState, output: JoinFlowStepOutput) -> AnyView {
switch step {
case .soul:
return soulViewModuleAssembly.make(state: state, output: output)
return SoulView(state: state, output: output).eraseToAnyView()
case .key:
return keyViewModuleAssembly.make(state: state, output: output)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ final class JoinFlowCoordinatorAssembly: JoinFlowCoordinatorAssemblyProtocol {

@MainActor
func make() -> JoinFlowCoordinatorProtocol {
return JoinFlowCoordinator(
keyViewModuleAssembly: modulesDI.authKey(),
soulViewModuleAssembly: modulesDI.authSoul()
)
return JoinFlowCoordinator(keyViewModuleAssembly: modulesDI.authKey())
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import SwiftUI

struct SoulView: View {

@StateObject var model: SoulViewModel
@StateObject private var model: SoulViewModel

init(state: JoinFlowState, output: JoinFlowStepOutput?) {
_model = StateObject(wrappedValue: SoulViewModel(state: state, output: output))
}

var body: some View {
VStack(spacing: 0) {
Expand Down Expand Up @@ -68,18 +72,6 @@ struct SoulView: View {

struct JoinFlowInputView_Previews: PreviewProvider {
static var previews: some View {
SoulView(
model: SoulViewModel(
state: JoinFlowState(),
output: nil,
accountManager: DI.preview.serviceLocator.accountManager(),
objectActionsService: DI.preview.serviceLocator.objectActionsService(),
authService: DI.preview.serviceLocator.authService(),
seedService: DI.preview.serviceLocator.seedService(),
usecaseService: DI.preview.serviceLocator.usecaseService(),
workspaceService: DI.preview.serviceLocator.workspaceService(),
activeWorkspaceStorage: DI.preview.serviceLocator.activeWorkspaceStorage()
)
)
SoulView(state: JoinFlowState(), output: nil)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,26 @@ final class SoulViewModel: ObservableObject {

private let state: JoinFlowState
private weak var output: JoinFlowStepOutput?
private let accountManager: AccountManagerProtocol
private let objectActionsService: ObjectActionsServiceProtocol
private let authService: AuthServiceProtocol
private let seedService: SeedServiceProtocol
private let usecaseService: UsecaseServiceProtocol
private let workspaceService: WorkspaceServiceProtocol
private let activeWorkspaceStorage: ActiveWorkpaceStorageProtocol

init(
state: JoinFlowState,
output: JoinFlowStepOutput?,
accountManager: AccountManagerProtocol,
objectActionsService: ObjectActionsServiceProtocol,
authService: AuthServiceProtocol,
seedService: SeedServiceProtocol,
usecaseService: UsecaseServiceProtocol,
workspaceService: WorkspaceServiceProtocol,
activeWorkspaceStorage: ActiveWorkpaceStorageProtocol
) {
@Injected(\.accountManager)
private var accountManager: AccountManagerProtocol
@Injected(\.objectActionsService)
private var objectActionsService: ObjectActionsServiceProtocol
@Injected(\.authService)
private var authService: AuthServiceProtocol
@Injected(\.seedService)
private var seedService: SeedServiceProtocol
@Injected(\.usecaseService)
private var usecaseService: UsecaseServiceProtocol
@Injected(\.workspaceService)
private var workspaceService: WorkspaceServiceProtocol
@Injected(\.activeWorkspaceStorage)
private var activeWorkspaceStorage: ActiveWorkpaceStorageProtocol

init(state: JoinFlowState, output: JoinFlowStepOutput?) {
self.state = state
self.inputText = state.soul
self.output = output
self.accountManager = accountManager
self.objectActionsService = objectActionsService
self.authService = authService
self.seedService = seedService
self.usecaseService = usecaseService
self.workspaceService = workspaceService
self.activeWorkspaceStorage = activeWorkspaceStorage
}

func onAppear() {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import SwiftUI

struct ServerConfigurationView: View {

@StateObject var model: ServerConfigurationViewModel
@StateObject private var model: ServerConfigurationViewModel

init(output: ServerConfigurationModuleOutput?) {
_model = StateObject(wrappedValue: ServerConfigurationViewModel(output: output))
Expand Down

0 comments on commit 03a2697

Please sign in to comment.