Fix actions buttons

This commit is contained in:
Philipp Heckel 2022-05-28 21:27:16 -04:00
parent 412332a53b
commit 575e2dbe67
2 changed files with 19 additions and 5 deletions

View file

@ -60,7 +60,9 @@ struct NotificationListView: View {
}
}
ToolbarItem(placement: .principal) {
Text(subscription.displayName()).font(.headline)
Text(subscription.displayName())
.font(.headline)
.lineLimit(1)
}
ToolbarItem(placement: .navigationBarTrailing) {
if (self.editMode == .active) {
@ -221,8 +223,9 @@ struct NotificationListView: View {
notificationCenter.getDeliveredNotifications { notifications in
let ids = notifications
.filter { notification in
if let topic = notification.request.content.userInfo["topic"] as? String {
return topic == subscription.topic // TODO: This is not enough for selfhosted servers
let userInfo = notification.request.content.userInfo
if let baseUrl = userInfo["base_url"] as? String, let topic = userInfo["topic"] as? String {
return baseUrl == subscription.baseUrl && topic == subscription.topic
}
return false
}
@ -291,11 +294,21 @@ struct NotificationRowView: View {
Button(action.label) {
ActionExecutor.execute(action)
}
.buttonStyle(.bordered)
.buttonStyle(.borderedProminent)
} else {
Button(action.label) {
Button(action: {
ActionExecutor.execute(action)
}) {
Text(action.label)
.padding(EdgeInsets(top: 10.0, leading: 10.0, bottom: 10.0, trailing: 10.0))
.foregroundColor(.white)
.overlay(
RoundedRectangle(cornerRadius: 10)
.stroke(Color.white, lineWidth: 2)
)
}
.background(Color.accentColor)
.cornerRadius(10)
}
}
}

View file

@ -174,5 +174,6 @@ struct SubscriptionsListView_Previews: PreviewProvider {
SubscriptionListView()
.environment(\.managedObjectContext, store.context)
.environmentObject(store)
.environmentObject(AppDelegate())
}
}