Move toolbar content inline
For consistency, can search with "toolbar {".
This commit is contained in:
parent
23d184ae08
commit
992178bcd6
|
@ -69,28 +69,24 @@ struct AddHostView: View {
|
||||||
bindings: bindings
|
bindings: bindings
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}.themeSecondaryView()
|
}.toolbar {
|
||||||
.navigationTitle(L10n.AddProfile.Shared.title)
|
themeCloseItem(isPresented: bindings.$isPresented)
|
||||||
.toolbar(content: toolbar)
|
ToolbarItem(placement: .primaryAction) {
|
||||||
.alert(isPresented: $viewModel.isAskingOverwrite, content: alertOverwriteExistingProfile)
|
Button(nextString) {
|
||||||
.onAppear(perform: requestResourcePermissions)
|
if !viewModel.processedProfile.isPlaceholder {
|
||||||
.onDisappear(perform: dropResourcePermissions)
|
saveProfile()
|
||||||
}
|
} else {
|
||||||
|
processProfile(replacingExisting: false)
|
||||||
@ToolbarContentBuilder
|
}
|
||||||
private func toolbar() -> some ToolbarContent {
|
|
||||||
themeCloseItem(isPresented: bindings.$isPresented)
|
|
||||||
ToolbarItem(placement: .primaryAction) {
|
|
||||||
Button(nextString) {
|
|
||||||
if !viewModel.processedProfile.isPlaceholder {
|
|
||||||
saveProfile()
|
|
||||||
} else {
|
|
||||||
processProfile(replacingExisting: false)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}.alert(isPresented: $viewModel.isAskingOverwrite, content: alertOverwriteExistingProfile)
|
||||||
|
.onAppear(perform: requestResourcePermissions)
|
||||||
|
.onDisappear(perform: dropResourcePermissions)
|
||||||
|
.navigationTitle(L10n.AddProfile.Shared.title)
|
||||||
|
.themeSecondaryView()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private var processingView: some View {
|
private var processingView: some View {
|
||||||
AddProfileView.ProfileNameSection(
|
AddProfileView.ProfileNameSection(
|
||||||
|
|
|
@ -78,19 +78,16 @@ extension AddProviderView {
|
||||||
bindings: bindings
|
bindings: bindings
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}.navigationTitle(providerMetadata.fullName)
|
}.toolbar {
|
||||||
.toolbar(content: toolbar)
|
Button {
|
||||||
.alert(isPresented: $viewModel.isAskingOverwrite, content: alertOverwriteExistingProfile)
|
saveProfile(replacingExisting: false)
|
||||||
|
} label: {
|
||||||
|
themeSaveButtonLabel()
|
||||||
|
}
|
||||||
|
}.alert(isPresented: $viewModel.isAskingOverwrite, content: alertOverwriteExistingProfile)
|
||||||
|
.navigationTitle(providerMetadata.fullName)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func toolbar() -> some View {
|
|
||||||
Button {
|
|
||||||
saveProfile(replacingExisting: false)
|
|
||||||
} label: {
|
|
||||||
themeSaveButtonLabel()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private func alertOverwriteExistingProfile() -> Alert {
|
private func alertOverwriteExistingProfile() -> Alert {
|
||||||
return Alert(
|
return Alert(
|
||||||
title: Text(L10n.AddProfile.Shared.title),
|
title: Text(L10n.AddProfile.Shared.title),
|
||||||
|
|
|
@ -88,19 +88,14 @@ struct AddProviderView: View {
|
||||||
|
|
||||||
// hidden
|
// hidden
|
||||||
ForEach(providers, id: \.navigationId, content: providerNavigationLink)
|
ForEach(providers, id: \.navigationId, content: providerNavigationLink)
|
||||||
}.themeSecondaryView()
|
}.toolbar {
|
||||||
.navigationTitle(L10n.AddProfile.Shared.title)
|
themeCloseItem(isPresented: bindings.$isPresented)
|
||||||
.toolbar(content: toolbar)
|
}.sheet(isPresented: $viewModel.isPaywallPresented) {
|
||||||
.sheet(isPresented: $viewModel.isPaywallPresented) {
|
|
||||||
NavigationView {
|
NavigationView {
|
||||||
PaywallView(isPresented: $viewModel.isPaywallPresented)
|
PaywallView(isPresented: $viewModel.isPaywallPresented)
|
||||||
}.themeGlobal()
|
}.themeGlobal()
|
||||||
}
|
}.navigationTitle(L10n.AddProfile.Shared.title)
|
||||||
}
|
.themeSecondaryView()
|
||||||
|
|
||||||
@ToolbarContentBuilder
|
|
||||||
private func toolbar() -> some ToolbarContent {
|
|
||||||
themeCloseItem(isPresented: bindings.$isPresented)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var mainSection: some View {
|
private var mainSection: some View {
|
||||||
|
|
|
@ -55,27 +55,24 @@ struct DebugLogView: View {
|
||||||
ScrollViewReader { scrollProxy in
|
ScrollViewReader { scrollProxy in
|
||||||
ScrollView(showsIndicators: true) {
|
ScrollView(showsIndicators: true) {
|
||||||
contentView
|
contentView
|
||||||
}.toolbar(content: toolbar)
|
}.onAppear {
|
||||||
.onAppear {
|
|
||||||
refreshLog(scrollingToLatestWith: scrollProxy)
|
refreshLog(scrollingToLatestWith: scrollProxy)
|
||||||
}.onReceive(timer, perform: refreshLog)
|
}
|
||||||
|
}.toolbar {
|
||||||
|
if !isSharing {
|
||||||
|
Button(action: shareDebugLog) {
|
||||||
|
themeShareImage.asSystemImage
|
||||||
|
}.disabled(logLines.isEmpty)
|
||||||
|
} else {
|
||||||
|
ProgressView()
|
||||||
|
}
|
||||||
}.sheet(isPresented: $isSharing, content: sharingActivityView)
|
}.sheet(isPresented: $isSharing, content: sharingActivityView)
|
||||||
|
.edgesIgnoringSafeArea([.leading, .trailing])
|
||||||
|
.onReceive(timer, perform: refreshLog)
|
||||||
.navigationTitle(L10n.DebugLog.title)
|
.navigationTitle(L10n.DebugLog.title)
|
||||||
.themeDebugLogFont()
|
.themeDebugLogFont()
|
||||||
.edgesIgnoringSafeArea([.leading, .trailing])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
|
||||||
private func toolbar() -> some View {
|
|
||||||
if !isSharing {
|
|
||||||
Button(action: shareDebugLog) {
|
|
||||||
themeShareImage.asSystemImage
|
|
||||||
}.disabled(logLines.isEmpty)
|
|
||||||
} else {
|
|
||||||
ProgressView()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var contentView: some View {
|
private var contentView: some View {
|
||||||
LazyVStack {
|
LazyVStack {
|
||||||
ForEach(logLines.indices, id: \.self) {
|
ForEach(logLines.indices, id: \.self) {
|
||||||
|
|
|
@ -95,9 +95,21 @@ struct OrganizerView: View {
|
||||||
didHandleSubreddit: $didHandleSubreddit
|
didHandleSubreddit: $didHandleSubreddit
|
||||||
)
|
)
|
||||||
ProfilesList(alertType: $alertType)
|
ProfilesList(alertType: $alertType)
|
||||||
}.navigationTitle(Unlocalized.appName)
|
}.toolbar {
|
||||||
.toolbar(content: toolbar)
|
ToolbarItem(placement: .primaryAction) {
|
||||||
.sheet(item: $modalType, content: presentedModal)
|
AddMenu(
|
||||||
|
modalType: $modalType,
|
||||||
|
isHostFileImporterPresented: $isHostFileImporterPresented
|
||||||
|
)
|
||||||
|
}
|
||||||
|
ToolbarItem(placement: .navigation) {
|
||||||
|
SettingsMenu(
|
||||||
|
modalType: $modalType,
|
||||||
|
alertType: $alertType
|
||||||
|
)
|
||||||
|
// EditButton()
|
||||||
|
}
|
||||||
|
}.sheet(item: $modalType, content: presentedModal)
|
||||||
.alert(item: $alertType, content: presentedAlert)
|
.alert(item: $alertType, content: presentedAlert)
|
||||||
.fileImporter(
|
.fileImporter(
|
||||||
isPresented: $isHostFileImporterPresented,
|
isPresented: $isHostFileImporterPresented,
|
||||||
|
@ -105,28 +117,10 @@ struct OrganizerView: View {
|
||||||
allowsMultipleSelection: false,
|
allowsMultipleSelection: false,
|
||||||
onCompletion: onHostFileImporterResult
|
onCompletion: onHostFileImporterResult
|
||||||
).onOpenURL(perform: onOpenURL)
|
).onOpenURL(perform: onOpenURL)
|
||||||
}
|
.navigationTitle(Unlocalized.appName)
|
||||||
|
|
||||||
@ToolbarContentBuilder
|
|
||||||
private func toolbar() -> some ToolbarContent {
|
|
||||||
ToolbarItem(placement: .primaryAction) {
|
|
||||||
AddMenu(
|
|
||||||
modalType: $modalType,
|
|
||||||
isHostFileImporterPresented: $isHostFileImporterPresented
|
|
||||||
)
|
|
||||||
}
|
|
||||||
ToolbarItem(placement: .navigation) {
|
|
||||||
SettingsMenu(
|
|
||||||
modalType: $modalType,
|
|
||||||
alertType: $alertType
|
|
||||||
)
|
|
||||||
// EditButton()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Global handlers
|
|
||||||
|
|
||||||
extension OrganizerView {
|
extension OrganizerView {
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
|
@ -223,8 +217,6 @@ extension OrganizerView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Actions
|
|
||||||
|
|
||||||
extension OrganizerView {
|
extension OrganizerView {
|
||||||
private func presentSubscribeReddit() {
|
private func presentSubscribeReddit() {
|
||||||
alertType = .subscribeReddit
|
alertType = .subscribeReddit
|
||||||
|
|
|
@ -59,9 +59,8 @@ struct PaywallView: View {
|
||||||
feature: feature
|
feature: feature
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}.themeSecondaryView()
|
}.toolbar {
|
||||||
.toolbar {
|
|
||||||
themeCloseItem(isPresented: $isPresented)
|
themeCloseItem(isPresented: $isPresented)
|
||||||
}
|
}.themeSecondaryView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,11 +78,20 @@ struct ProfileView: View {
|
||||||
} else {
|
} else {
|
||||||
welcomeView
|
welcomeView
|
||||||
}
|
}
|
||||||
}.themeSecondaryView()
|
}.toolbar {
|
||||||
.navigationTitle(title)
|
// FIXME: toolbars, unroll single items
|
||||||
.toolbar(content: toolbar)
|
ToolbarItemGroup(placement: .navigationBarTrailing) {
|
||||||
.sheet(item: $modalType, content: presentedModal)
|
if !isDeleted {
|
||||||
|
MenuBar(
|
||||||
|
currentProfile: profileManager.currentProfile,
|
||||||
|
modalType: $modalType
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.sheet(item: $modalType, content: presentedModal)
|
||||||
.onAppear(perform: loadProfileIfNeeded)
|
.onAppear(perform: loadProfileIfNeeded)
|
||||||
|
.navigationTitle(title)
|
||||||
|
.themeSecondaryView()
|
||||||
}
|
}
|
||||||
|
|
||||||
private var title: String {
|
private var title: String {
|
||||||
|
@ -106,17 +115,6 @@ struct ProfileView: View {
|
||||||
WelcomeView()
|
WelcomeView()
|
||||||
}
|
}
|
||||||
|
|
||||||
private func toolbar() -> some ToolbarContent {
|
|
||||||
ToolbarItemGroup(placement: .navigationBarTrailing) {
|
|
||||||
if !isDeleted {
|
|
||||||
MenuBar(
|
|
||||||
currentProfile: profileManager.currentProfile,
|
|
||||||
modalType: $modalType
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private func presentedModal(_ modalType: ModalType) -> some View {
|
private func presentedModal(_ modalType: ModalType) -> some View {
|
||||||
switch modalType {
|
switch modalType {
|
||||||
|
|
|
@ -101,8 +101,17 @@ struct ProviderLocationView: View, ProviderProfileAvailability {
|
||||||
} else {
|
} else {
|
||||||
EmptyView()
|
EmptyView()
|
||||||
}
|
}
|
||||||
|
}.toolbar {
|
||||||
|
if #available(iOS 15, *) {
|
||||||
|
Button {
|
||||||
|
withAnimation {
|
||||||
|
isShowingFavorites.toggle()
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
themeFavoritesImage(isShowingFavorites).asSystemImage
|
||||||
|
}
|
||||||
|
}
|
||||||
}.navigationTitle(L10n.Provider.Location.title)
|
}.navigationTitle(L10n.Provider.Location.title)
|
||||||
.toolbar(content: toolbar)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var mainView: some View {
|
private var mainView: some View {
|
||||||
|
@ -120,21 +129,6 @@ struct ProviderLocationView: View, ProviderProfileAvailability {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
|
||||||
private func toolbar() -> some View {
|
|
||||||
if #available(iOS 15, *) {
|
|
||||||
Button {
|
|
||||||
withAnimation {
|
|
||||||
isShowingFavorites.toggle()
|
|
||||||
}
|
|
||||||
} label: {
|
|
||||||
themeFavoritesImage(isShowingFavorites).asSystemImage
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
self
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var categoriesView: some View {
|
private var categoriesView: some View {
|
||||||
ForEach(categories, content: categorySection)
|
ForEach(categories, content: categorySection)
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,9 +66,7 @@ struct ShortcutsView: View {
|
||||||
shortcutsSection
|
shortcutsSection
|
||||||
}
|
}
|
||||||
addSection
|
addSection
|
||||||
}.themeSecondaryView()
|
}.toolbar {
|
||||||
.navigationTitle(L10n.Organizer.Items.SiriShortcuts.caption)
|
|
||||||
.toolbar {
|
|
||||||
themeCloseItem(presentationMode: presentationMode)
|
themeCloseItem(presentationMode: presentationMode)
|
||||||
}.sheet(item: $modalType, content: presentedModal)
|
}.sheet(item: $modalType, content: presentedModal)
|
||||||
|
|
||||||
|
@ -81,6 +79,9 @@ struct ShortcutsView: View {
|
||||||
.onReceive(intentsManager.shouldDismissIntentView) { _ in
|
.onReceive(intentsManager.shouldDismissIntentView) { _ in
|
||||||
modalType = nil
|
modalType = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.navigationTitle(L10n.Organizer.Items.SiriShortcuts.caption)
|
||||||
|
.themeSecondaryView()
|
||||||
}
|
}
|
||||||
|
|
||||||
private var shortcutsSection: some View {
|
private var shortcutsSection: some View {
|
||||||
|
|
Loading…
Reference in New Issue