mirror of
				https://github.com/yattee/yattee.git
				synced 2025-11-04 14:42:05 +00:00 
			
		
		
		
	Further subscribe buttons improvements
This commit is contained in:
		@@ -12,6 +12,7 @@ struct VideoDetails: View {
 | 
			
		||||
    @Binding var fullScreen: Bool
 | 
			
		||||
 | 
			
		||||
    @State private var subscribed = false
 | 
			
		||||
    @State private var subscriptionToggleButtonDisabled = false
 | 
			
		||||
    @State private var presentingUnsubscribeAlert = false
 | 
			
		||||
    @State private var presentingAddToPlaylist = false
 | 
			
		||||
    @State private var presentingShareSheet = false
 | 
			
		||||
@@ -254,27 +255,34 @@ struct VideoDetails: View {
 | 
			
		||||
                                            "Are you sure you want to unsubscribe from \(video!.channel.name)?"
 | 
			
		||||
                                        ),
 | 
			
		||||
                                        primaryButton: .destructive(Text("Unsubscribe")) {
 | 
			
		||||
                                            subscriptions.unsubscribe(video!.channel.id)
 | 
			
		||||
                                            subscriptionToggleButtonDisabled = true
 | 
			
		||||
 | 
			
		||||
                                            subscriptions.unsubscribe(video!.channel.id) {
 | 
			
		||||
                                                withAnimation {
 | 
			
		||||
                                                    subscriptionToggleButtonDisabled = false
 | 
			
		||||
                                                    subscribed.toggle()
 | 
			
		||||
                                                }
 | 
			
		||||
                                            }
 | 
			
		||||
                                        },
 | 
			
		||||
                                        secondaryButton: .cancel()
 | 
			
		||||
                                    )
 | 
			
		||||
                                }
 | 
			
		||||
                            } else {
 | 
			
		||||
                                Button("Subscribe") {
 | 
			
		||||
                                    subscriptions.subscribe(video!.channel.id)
 | 
			
		||||
                                    subscriptionToggleButtonDisabled = true
 | 
			
		||||
 | 
			
		||||
                                    subscriptions.subscribe(video!.channel.id) {
 | 
			
		||||
                                        withAnimation {
 | 
			
		||||
                                            subscriptionToggleButtonDisabled = false
 | 
			
		||||
                                            subscribed.toggle()
 | 
			
		||||
                                        }
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                                .backport
 | 
			
		||||
                                .tint(.blue)
 | 
			
		||||
                                .tint(subscriptionToggleButtonDisabled ? .gray : .blue)
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        .disabled(subscriptionToggleButtonDisabled)
 | 
			
		||||
                        .font(.system(size: 13))
 | 
			
		||||
                        .buttonStyle(.borderless)
 | 
			
		||||
                    }
 | 
			
		||||
 
 | 
			
		||||
@@ -150,7 +150,7 @@ struct ChannelVideosView: View {
 | 
			
		||||
                        subscriptionToggleButtonDisabled = true
 | 
			
		||||
 | 
			
		||||
                        subscriptions.unsubscribe(channel.id) {
 | 
			
		||||
                            self.subscriptionToggleButtonDisabled = false
 | 
			
		||||
                            subscriptionToggleButtonDisabled = false
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                } else {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user