damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

OnboardingContentSettings.swift (4177B)


      1 //
      2 //  OnboardingContentSettings.swift
      3 //  damus
      4 //
      5 //  Created by Daniel D’Aquino on 2025-05-19.
      6 //
      7 import SwiftUI
      8 
      9 extension OnboardingSuggestionsView {
     10     struct OnboardingContentSettings: View {
     11         var model: SuggestedUsersViewModel
     12         var next_page: (() -> Void)
     13         @ObservedObject var settings: UserSettingsStore
     14 
     15         @Binding var selectedInterests: Set<Interest>
     16 
     17         private var isNextEnabled: Bool { true }
     18 
     19         var body: some View {
     20             ScrollView {
     21                 VStack(spacing: 20) {
     22                     // Title
     23                     Text(NSLocalizedString("Other preferences", comment: "Screen title for content preferences screen during onboarding"))
     24                         .font(.largeTitle)
     25                         .fontWeight(.bold)
     26                         .multilineTextAlignment(.center)
     27                         .padding(.top)
     28                     
     29                     // Instruction subtitle
     30                     Text(NSLocalizedString("Tweak these settings to better match your preferences", comment: "Instructions for content preferences screen during onboarding"))
     31                         .font(.subheadline)
     32                         .foregroundColor(.secondary)
     33                         .multilineTextAlignment(.center)
     34                     
     35                     // Content preferences section with toggles
     36                     Section() {
     37                         VStack(alignment: .leading, spacing: 5) {
     38                             Toggle(NSLocalizedString("Hide notes with #nsfw tags", comment: "Setting to hide notes with not safe for work tags"), isOn: $settings.hide_nsfw_tagged_content)
     39                                 .toggleStyle(.switch)
     40                             
     41                             Text(NSLocalizedString("Notes with the #nsfw tag usually contains adult content or other \"Not safe for work\" content", comment: "Explanation of what NSFW means"))
     42                                 .font(.caption)
     43                                 .foregroundColor(.secondary)
     44                                 .padding(.bottom, 10)
     45                             
     46                             if !selectedInterests.contains(.bitcoin) {
     47                                 Toggle(
     48                                     NSLocalizedString("Show Bitcoin-heavy profile suggestions", comment: "Setting label during onboarding"),
     49                                     isOn: Binding(get: { !model.reduceBitcoinContent }, set: { model.reduceBitcoinContent = !$0 })
     50                                 )
     51                                 .toggleStyle(.switch)
     52                                 
     53                                 Text(NSLocalizedString("Some profiles tend to have a lot of Bitcoin-related content alongside their topics of interest. Disable this setting if you prefer to filter out follow suggestions that frequently talk about Bitcoin.", comment: "Explanation label for the 'Show Bitcoin-heavy profile suggestions' onboarding toggle setting"))
     54                                     .font(.caption)
     55                                     .foregroundColor(.secondary)
     56                             }
     57                         }
     58                         .padding()
     59                         .background(Color.secondary.opacity(0.1))
     60                         .cornerRadius(10)
     61                     }
     62                     .padding()
     63                     
     64                     Spacer()
     65                     
     66                     Button(action: {
     67                         self.next_page()
     68                     }, label: {
     69                         Text(NSLocalizedString("Next", comment: "Next button title"))
     70                             .foregroundColor(.white)
     71                             .frame(maxWidth: .infinity)
     72                     })
     73                     .buttonStyle(GradientButtonStyle())
     74                     .disabled(!isNextEnabled)
     75                     .opacity(isNextEnabled ? 1.0 : 0.5)
     76                     .padding([.leading, .trailing, .bottom])
     77                     .accessibilityIdentifier(AppAccessibilityIdentifiers.onboarding_content_settings_page_next_page.rawValue)
     78                 }
     79                 .padding()
     80             }
     81         }
     82     }
     83 }