Add dependency management, AvatarViewModel and placeholder rendering now in AvatarImage.

This commit is contained in:
David Langley
2021-08-17 10:19:41 +01:00
parent 31b4da8502
commit e09138b572
17 changed files with 103 additions and 72 deletions
@@ -64,9 +64,10 @@ final class RoomNotificationSettingsCoordinator: RoomNotificationSettingsCoordin
let viewController: UIViewController
if #available(iOS 14.0.0, *) {
let avatarService: AvatarServiceType = AvatarService(mediaManager: room.mxSession.mediaManager)
let view = RoomNotificationSettings(viewModel: roomNotificationSettingsViewModel, presentedModally: presentedModally)
.addDependency(avatarService)
let host = VectorHostingController(rootView: view)
host.add(dependency: AvatarService(mediaManager: room.mxSession.mediaManager))
viewController = host
} else {
viewController = RoomNotificationSettingsViewController.instantiate(with: roomNotificationSettingsViewModel)
@@ -90,8 +90,8 @@ struct RoomNotificationSettings_Previews: PreviewProvider {
NavigationView {
RoomNotificationSettings(viewModel: mockViewModel, presentedModally: true)
.navigationBarTitleDisplayMode(.inline)
.theme(ThemeIdentifier.dark.theme)
.addDependency(MockAvatarService.example)
.theme(ThemeIdentifier.dark)
}
}
}
@@ -44,7 +44,6 @@ struct RoomNotificationSettingsHeader: View {
@available(iOS 14.0, *)
struct RoomNotificationSettingsHeader_Previews: PreviewProvider {
static let image = UIImage(imageLiteralResourceName: "app_symbol")
static let name = "Element"
static var previews: some View {
RoomNotificationSettingsHeader(avatarData: MockAvatarInput.example, displayName: name)
@@ -57,7 +57,8 @@ struct VectorForm_Previews: PreviewProvider {
}
VectorForm {
FormPickerItem(title: "Item 1", selected: true)
}.theme(ThemeIdentifier.dark.theme)
}
.theme(ThemeIdentifier.dark)
}
}
}