mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-12-24 14:02:53 +01:00
Editor: Allow to select account
This commit is contained in:
parent
75e9516089
commit
05053c661d
@ -10,8 +10,15 @@ public struct AppAccountsSelectorView: View {
|
||||
|
||||
@State private var accountsViewModel: [AppAccountViewModel] = []
|
||||
|
||||
public init(routeurPath: RouterPath) {
|
||||
private let accountCreationEnabled: Bool
|
||||
private let avatarSize: AvatarView.Size
|
||||
|
||||
public init(routeurPath: RouterPath,
|
||||
accountCreationEnabled: Bool = true,
|
||||
avatarSize: AvatarView.Size = .badge) {
|
||||
self.routeurPath = routeurPath
|
||||
self.accountCreationEnabled = accountCreationEnabled
|
||||
self.avatarSize = avatarSize
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
@ -35,15 +42,17 @@ public struct AppAccountsSelectorView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
Divider()
|
||||
Button {
|
||||
routeurPath.presentedSheet = .addAccount
|
||||
} label: {
|
||||
Label("Add Account", systemImage: "person.badge.plus")
|
||||
if accountCreationEnabled {
|
||||
Divider()
|
||||
Button {
|
||||
routeurPath.presentedSheet = .addAccount
|
||||
} label: {
|
||||
Label("Add Account", systemImage: "person.badge.plus")
|
||||
}
|
||||
}
|
||||
} label: {
|
||||
if let avatar = currentAccount.account?.avatar {
|
||||
AvatarView(url: avatar, size: .badge)
|
||||
AvatarView(url: avatar, size: avatarSize)
|
||||
} else {
|
||||
EmptyView()
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import PhotosUI
|
||||
import NukeUI
|
||||
import EmojiText
|
||||
import UIKit
|
||||
import AppAccount
|
||||
|
||||
public struct StatusEditorView: View {
|
||||
@EnvironmentObject private var preferences: UserPreferences
|
||||
@ -156,7 +157,9 @@ public struct StatusEditorView: View {
|
||||
private var accountHeaderView: some View {
|
||||
if let account = currentAccount.account {
|
||||
HStack {
|
||||
AvatarView(url: account.avatar, size: .status)
|
||||
AppAccountsSelectorView(routeurPath: RouterPath(),
|
||||
accountCreationEnabled: false,
|
||||
avatarSize: .status)
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
privacyMenu
|
||||
Text("@\(account.acct)")
|
||||
|
Loading…
Reference in New Issue
Block a user