mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-01-10 21:54:10 +01:00
composer tweaks
This commit is contained in:
parent
6435b40a51
commit
e5bb521502
@ -60,8 +60,6 @@ struct StatusEditorAccessoryView: View {
|
||||
#if os(visionOS)
|
||||
HStack(spacing: 8) {
|
||||
actionsView
|
||||
characterCountView
|
||||
.padding(.leading, 16)
|
||||
}
|
||||
#else
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
@ -71,8 +69,6 @@ struct StatusEditorAccessoryView: View {
|
||||
.padding(.horizontal, .layoutPadding)
|
||||
}
|
||||
Spacer()
|
||||
characterCountView
|
||||
.padding(.trailing, .layoutPadding)
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -228,6 +224,18 @@ struct StatusEditorAccessoryView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
viewModel.insertStatusText(text: "#")
|
||||
} label: {
|
||||
Image(systemName: "number")
|
||||
}
|
||||
|
||||
Button {
|
||||
viewModel.insertStatusText(text: "@")
|
||||
} label: {
|
||||
Image(systemName: "at")
|
||||
}
|
||||
|
||||
Button {
|
||||
isLanguageSheetDisplayed.toggle()
|
||||
@ -432,21 +440,7 @@ struct StatusEditorAccessoryView: View {
|
||||
}
|
||||
.presentationDetents([.medium])
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var characterCountView: some View {
|
||||
let value = (currentInstance.instance?.configuration?.statuses.maxCharacters ?? 500) + focusedSEVM.statusTextCharacterLength
|
||||
|
||||
Text("\(value)")
|
||||
.foregroundColor(value < 0 ? .red : .secondary)
|
||||
.font(.scaledCallout)
|
||||
.accessibilityLabel("accessibility.editor.button.characters-remaining")
|
||||
.accessibilityValue("\(value)")
|
||||
.accessibilityRemoveTraits(.isStaticText)
|
||||
.accessibilityAddTraits(.updatesFrequently)
|
||||
.accessibilityRespondsToUserInteraction(false)
|
||||
}
|
||||
|
||||
|
||||
private var recentlyUsedLanguages: [Language] {
|
||||
preferences.recentlyUsedLanguages.compactMap { isoCode in
|
||||
Language.allAvailableLanguages.first { $0.isoCode == isoCode }
|
||||
|
@ -19,6 +19,7 @@ struct StatusEditorCoreView: View {
|
||||
@Environment(Theme.self) private var theme
|
||||
@Environment(UserPreferences.self) private var preferences
|
||||
@Environment(CurrentAccount.self) private var currentAccount
|
||||
@Environment(CurrentInstance.self) private var currentInstance
|
||||
@Environment(AppAccountsManager.self) private var appAccounts
|
||||
@Environment(Client.self) private var client
|
||||
#if targetEnvironment(macCatalyst)
|
||||
@ -42,6 +43,7 @@ struct StatusEditorCoreView: View {
|
||||
VStack(spacing: 0) {
|
||||
accountHeaderView
|
||||
textInput
|
||||
characterCountView
|
||||
StatusEditorMediaView(viewModel: viewModel, editingMediaContainer: $editingMediaContainer)
|
||||
embeddedStatus
|
||||
pollView
|
||||
@ -138,6 +140,25 @@ struct StatusEditorCoreView: View {
|
||||
.padding(.horizontal)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ViewBuilder
|
||||
private var characterCountView: some View {
|
||||
let value = (currentInstance.instance?.configuration?.statuses.maxCharacters ?? 500) + viewModel.statusTextCharacterLength
|
||||
HStack {
|
||||
Spacer()
|
||||
Text("\(value)")
|
||||
.foregroundColor(value < 0 ? .red : .secondary)
|
||||
.font(.scaledCallout)
|
||||
.accessibilityLabel("accessibility.editor.button.characters-remaining")
|
||||
.accessibilityValue("\(value)")
|
||||
.accessibilityRemoveTraits(.isStaticText)
|
||||
.accessibilityAddTraits(.updatesFrequently)
|
||||
.accessibilityRespondsToUserInteraction(false)
|
||||
.padding(.trailing, 8)
|
||||
.padding(.bottom, 8)
|
||||
}
|
||||
}
|
||||
|
||||
private func setupViewModel() {
|
||||
viewModel.client = client
|
||||
|
@ -235,6 +235,7 @@ import SwiftUI
|
||||
string.mutableString.insert(text, at: selectedRange.location)
|
||||
statusText = string
|
||||
selectedRange = NSRange(location: selectedRange.location + text.utf16.count, length: 0)
|
||||
processText()
|
||||
}
|
||||
|
||||
func replaceTextWith(text: String, inRange: NSRange) {
|
||||
|
Loading…
Reference in New Issue
Block a user