Add push notification settings in profile context menu
This commit is contained in:
parent
0f4fccf1a5
commit
de4346c47e
|
@ -78,6 +78,13 @@ extension View {
|
|||
SettingsTabs(popToRootTab: .constant(.settings))
|
||||
.withEnvironments()
|
||||
.preferredColorScheme(Theme.shared.selectedScheme == .dark ? .dark : .light)
|
||||
case .accountPushNotficationsSettings:
|
||||
if let subscription = PushNotificationsService.shared.subscriptions.first(where: { $0.account.token == AppAccountsManager.shared.currentAccount.oauthToken }) {
|
||||
PushNotificationsView(subscription: subscription)
|
||||
.withEnvironments()
|
||||
} else {
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,5 +95,6 @@ extension View {
|
|||
.environmentObject(CurrentInstance.shared)
|
||||
.environmentObject(Theme.shared)
|
||||
.environmentObject(AppAccountsManager.shared)
|
||||
.environmentObject(PushNotificationsService.shared)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,10 +107,8 @@ struct SettingsTabs: View {
|
|||
}
|
||||
Link(destination: URL(string: UIApplication.openSettingsURLString)!) {
|
||||
Label("settings.system", systemImage: "gear")
|
||||
// Tint our label black, so that it matches the other NavigationLink instead of
|
||||
// defaulting to highlighted like a Link
|
||||
.tint(.black)
|
||||
}
|
||||
.tint(theme.labelColor)
|
||||
}
|
||||
.listRowBackground(theme.primaryBackgroundColor)
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ public struct AccountDetailView: View {
|
|||
@State private var isCurrentUser: Bool = false
|
||||
@State private var isCreateListAlertPresented: Bool = false
|
||||
@State private var createListTitle: String = ""
|
||||
|
||||
@State private var isEditingAccount: Bool = false
|
||||
@State private var isEditingFilters: Bool = false
|
||||
|
||||
|
@ -520,6 +521,12 @@ public struct AccountDetailView: View {
|
|||
Label("account.action.edit-filters", systemImage: "line.3.horizontal.decrease.circle")
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
routerPath.presentedSheet = .accountPushNotficationsSettings
|
||||
} label: {
|
||||
Label("settings.push.navigation-title", systemImage: "bell")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,27 +19,31 @@ public struct FiltersListView: View {
|
|||
public var body: some View {
|
||||
NavigationStack {
|
||||
Form {
|
||||
Section {
|
||||
if isLoading && filters.isEmpty {
|
||||
ProgressView()
|
||||
} else {
|
||||
ForEach(filters) { filter in
|
||||
NavigationLink(destination: EditFilterView(filter: filter)) {
|
||||
VStack(alignment: .leading) {
|
||||
Text(filter.title)
|
||||
.font(.scaledSubheadline)
|
||||
Text("\(filter.context.map{ $0.name }.joined(separator: ", "))")
|
||||
.font(.scaledBody)
|
||||
.foregroundColor(.gray)
|
||||
if !isLoading && filters.isEmpty {
|
||||
EmptyView()
|
||||
} else {
|
||||
Section {
|
||||
if isLoading && filters.isEmpty {
|
||||
ProgressView()
|
||||
} else {
|
||||
ForEach(filters) { filter in
|
||||
NavigationLink(destination: EditFilterView(filter: filter)) {
|
||||
VStack(alignment: .leading) {
|
||||
Text(filter.title)
|
||||
.font(.scaledSubheadline)
|
||||
Text("\(filter.context.map{ $0.name }.joined(separator: ", "))")
|
||||
.font(.scaledBody)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.onDelete { indexes in
|
||||
deleteFilter(indexes: indexes)
|
||||
.onDelete { indexes in
|
||||
deleteFilter(indexes: indexes)
|
||||
}
|
||||
}
|
||||
}
|
||||
.listRowBackground(theme.primaryBackgroundColor)
|
||||
}
|
||||
.listRowBackground(theme.primaryBackgroundColor)
|
||||
|
||||
Section {
|
||||
NavigationLink(destination: EditFilterView(filter: nil)) {
|
||||
|
|
|
@ -30,10 +30,12 @@ public enum SheetDestinations: Identifiable {
|
|||
case addRemoteLocalTimeline
|
||||
case statusEditHistory(status: String)
|
||||
case settings
|
||||
case accountPushNotficationsSettings
|
||||
|
||||
public var id: String {
|
||||
switch self {
|
||||
case .editStatusEditor, .newStatusEditor, .replyToStatusEditor, .quoteStatusEditor, .mentionStatusEditor, .settings:
|
||||
case .editStatusEditor, .newStatusEditor, .replyToStatusEditor, .quoteStatusEditor,
|
||||
.mentionStatusEditor, .settings, .accountPushNotficationsSettings:
|
||||
return "statusEditor"
|
||||
case .listEdit:
|
||||
return "listEdit"
|
||||
|
|
Loading…
Reference in New Issue