mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-01-11 00:25:35 +00:00
Editor: Allow to select account
This commit is contained in:
parent
75e9516089
commit
05053c661d
2 changed files with 20 additions and 8 deletions
|
@ -10,8 +10,15 @@ public struct AppAccountsSelectorView: View {
|
||||||
|
|
||||||
@State private var accountsViewModel: [AppAccountViewModel] = []
|
@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.routeurPath = routeurPath
|
||||||
|
self.accountCreationEnabled = accountCreationEnabled
|
||||||
|
self.avatarSize = avatarSize
|
||||||
}
|
}
|
||||||
|
|
||||||
public var body: some View {
|
public var body: some View {
|
||||||
|
@ -35,15 +42,17 @@ public struct AppAccountsSelectorView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if accountCreationEnabled {
|
||||||
Divider()
|
Divider()
|
||||||
Button {
|
Button {
|
||||||
routeurPath.presentedSheet = .addAccount
|
routeurPath.presentedSheet = .addAccount
|
||||||
} label: {
|
} label: {
|
||||||
Label("Add Account", systemImage: "person.badge.plus")
|
Label("Add Account", systemImage: "person.badge.plus")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} label: {
|
} label: {
|
||||||
if let avatar = currentAccount.account?.avatar {
|
if let avatar = currentAccount.account?.avatar {
|
||||||
AvatarView(url: avatar, size: .badge)
|
AvatarView(url: avatar, size: avatarSize)
|
||||||
} else {
|
} else {
|
||||||
EmptyView()
|
EmptyView()
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import PhotosUI
|
||||||
import NukeUI
|
import NukeUI
|
||||||
import EmojiText
|
import EmojiText
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import AppAccount
|
||||||
|
|
||||||
public struct StatusEditorView: View {
|
public struct StatusEditorView: View {
|
||||||
@EnvironmentObject private var preferences: UserPreferences
|
@EnvironmentObject private var preferences: UserPreferences
|
||||||
|
@ -156,7 +157,9 @@ public struct StatusEditorView: View {
|
||||||
private var accountHeaderView: some View {
|
private var accountHeaderView: some View {
|
||||||
if let account = currentAccount.account {
|
if let account = currentAccount.account {
|
||||||
HStack {
|
HStack {
|
||||||
AvatarView(url: account.avatar, size: .status)
|
AppAccountsSelectorView(routeurPath: RouterPath(),
|
||||||
|
accountCreationEnabled: false,
|
||||||
|
avatarSize: .status)
|
||||||
VStack(alignment: .leading, spacing: 4) {
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
privacyMenu
|
privacyMenu
|
||||||
Text("@\(account.acct)")
|
Text("@\(account.acct)")
|
||||||
|
|
Loading…
Reference in a new issue