mirror of
https://github.com/yattee/yattee.git
synced 2025-08-06 18:54:11 +00:00
Settings for iOS/macOS
This commit is contained in:
19
Shared/Modifiers/RedrawOnViewModifier.swift
Normal file
19
Shared/Modifiers/RedrawOnViewModifier.swift
Normal file
@@ -0,0 +1,19 @@
|
||||
import SwiftUI
|
||||
|
||||
struct RedrawOnViewModifier: ViewModifier {
|
||||
@State private var changeFlag: Bool
|
||||
|
||||
init(changeFlag: Bool) {
|
||||
self.changeFlag = changeFlag
|
||||
}
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
content.opacity(changeFlag ? 1 : 1)
|
||||
}
|
||||
}
|
||||
|
||||
extension View {
|
||||
func redrawOn(change flag: Bool) -> some View {
|
||||
modifier(RedrawOnViewModifier(changeFlag: flag))
|
||||
}
|
||||
}
|
@@ -2,13 +2,13 @@ import Foundation
|
||||
import SwiftUI
|
||||
|
||||
struct UnsubscribeAlertModifier: ViewModifier {
|
||||
@EnvironmentObject<NavigationState> private var navigationState
|
||||
@EnvironmentObject<Subscriptions> private var subscriptions
|
||||
@EnvironmentObject<NavigationModel> private var navigation
|
||||
@EnvironmentObject<SubscriptionsModel> private var subscriptions
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
.alert(unsubscribeAlertTitle, isPresented: $navigationState.presentingUnsubscribeAlert) {
|
||||
if let channel = navigationState.channelToUnsubscribe {
|
||||
.alert(unsubscribeAlertTitle, isPresented: $navigation.presentingUnsubscribeAlert) {
|
||||
if let channel = navigation.channelToUnsubscribe {
|
||||
Button("Unsubscribe", role: .destructive) {
|
||||
subscriptions.unsubscribe(channel.id)
|
||||
}
|
||||
@@ -17,7 +17,7 @@ struct UnsubscribeAlertModifier: ViewModifier {
|
||||
}
|
||||
|
||||
var unsubscribeAlertTitle: String {
|
||||
if let channel = navigationState.channelToUnsubscribe {
|
||||
if let channel = navigation.channelToUnsubscribe {
|
||||
return "Unsubscribe from \(channel.name)"
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user