From 2005d2c6dbf0a5cc649e099eb0a5518e4490d448 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Tue, 27 Dec 2022 21:18:49 +0800 Subject: [PATCH] Prompt users to open the community modal once. Add twitter option --- .../Sources/App/Views/Home/HomeFeedViewIOS.swift | 12 +++++++++++- .../Sources/Utils/UserDefaultKeys.swift | 1 + .../OmnivoreKit/Sources/Views/CommunityModal.swift | 14 ++++++++++---- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift index 3acbe96e3..d49e3257e 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift @@ -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: {}) diff --git a/apple/OmnivoreKit/Sources/Utils/UserDefaultKeys.swift b/apple/OmnivoreKit/Sources/Utils/UserDefaultKeys.swift index a5ce0ec7f..cb73d48d7 100644 --- a/apple/OmnivoreKit/Sources/Utils/UserDefaultKeys.swift +++ b/apple/OmnivoreKit/Sources/Utils/UserDefaultKeys.swift @@ -26,4 +26,5 @@ public enum UserDefaultKey: String { case shouldShowNewFeaturePrimer case notificationsEnabled case deviceTokenID + case shouldPromptCommunityModal } diff --git a/apple/OmnivoreKit/Sources/Views/CommunityModal.swift b/apple/OmnivoreKit/Sources/Views/CommunityModal.swift index 3f9d6c162..437d8a959 100644 --- a/apple/OmnivoreKit/Sources/Views/CommunityModal.swift +++ b/apple/OmnivoreKit/Sources/Views/CommunityModal.swift @@ -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) }