Prompt users to open the community modal once. Add twitter option

This commit is contained in:
Jackson Harper
2022-12-27 21:18:49 +08:00
parent 75798212e0
commit 2005d2c6db
3 changed files with 22 additions and 5 deletions

View File

@ -17,6 +17,7 @@ import Views
@EnvironmentObject var audioController: AudioController
@AppStorage(UserDefaultKey.homeFeedlayoutPreference.rawValue) var prefersListLayout = false
@AppStorage(UserDefaultKey.shouldPromptCommunityModal.rawValue) var shouldPromptCommunityModal = true
@ObservedObject var viewModel: HomeFeedViewModel
func loadItems(isRefresh: Bool) {
@ -69,6 +70,9 @@ import Views
}
.sheet(isPresented: $viewModel.showCommunityModal) {
CommunityModal()
.onAppear {
shouldPromptCommunityModal = false
}
}
.navigationBarTitleDisplayMode(.inline)
.toolbar {
@ -81,8 +85,14 @@ import Views
.resizable()
.frame(width: 24, height: 24)
.foregroundColor(.appGrayTextContrast)
.overlay(alignment: .topTrailing, content: {
if shouldPromptCommunityModal {
Circle()
.fill(Color.red)
.frame(width: 6, height: 6)
}
})
})
.transition(.scale)
}
ToolbarItem(placement: .barTrailing) {
Button("", action: {})

View File

@ -26,4 +26,5 @@ public enum UserDefaultKey: String {
case shouldShowNewFeaturePrimer
case notificationsEnabled
case deviceTokenID
case shouldPromptCommunityModal
}

View File

@ -15,8 +15,10 @@ public struct CommunityModal: View {
@Environment(\.dismiss) private var dismiss
let message: String = """
Thank you for being a member of the Omnivore Community. Omnivore relies on help from \
our community to grow. Below are a few simple things you can do to help us build a better Omnivore.
Thank you for being a member of the Omnivore Community.
Omnivore relies on help from our community to grow. Below are a few simple
things you can do to help us build a better Omnivore.
"""
public init() {}
@ -30,9 +32,9 @@ public struct CommunityModal: View {
.frame(maxWidth: .infinity, alignment: .leading)
HStack {
TextChip(text: "Help Wanted", color: Color.red)
TextChip(text: "Help Wanted", color: Color.appBackground)
.frame(alignment: .leading)
TextChip(text: "Community", color: Color.appCtaYellow)
TextChip(text: "Community", color: Color.green)
.frame(alignment: .leading)
}
}
@ -56,6 +58,10 @@ public struct CommunityModal: View {
Link("Tweet about Omnivore", destination: url)
}
if let url = URL(string: "https://twitter.com/omnivoreapp") {
Link("Follow us on Twitter", destination: url)
}
if let url = URL(string: "https://discord.gg/h2z5rppzz9") {
Link("Join us on Discord", destination: url)
}