diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift index fed934868..d101bb750 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift @@ -67,14 +67,22 @@ import Views .sheet(item: $viewModel.itemForHighlightsView) { item in HighlightsListView(itemObjectID: item.objectID, hasHighlightMutations: $hasHighlightMutations) } + .sheet(isPresented: $viewModel.showCommunityModal) { + CommunityModal() + } .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .barLeading) { - Image.smallOmnivoreLogo - .renderingMode(.template) - .resizable() - .frame(width: 24, height: 24) - .foregroundColor(.appGrayTextContrast) + Button(action: { + viewModel.showCommunityModal = true + }, label: { + Image.smallOmnivoreLogo + .renderingMode(.template) + .resizable() + .frame(width: 24, height: 24) + .foregroundColor(.appGrayTextContrast) + }) + .transition(.scale) } ToolbarItem(placement: .barTrailing) { Button("", action: {}) diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift index a1b9914b8..e61a373c9 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift @@ -33,6 +33,7 @@ import Views @Published var linkIsActive = false @Published var showLabelsSheet = false + @Published var showCommunityModal = false @AppStorage(UserDefaultKey.lastSelectedLinkedItemFilter.rawValue) var appliedFilter = LinkedItemFilter.inbox.rawValue diff --git a/apple/OmnivoreKit/Sources/Views/CommunityModal.swift b/apple/OmnivoreKit/Sources/Views/CommunityModal.swift new file mode 100644 index 000000000..9d7c4afd5 --- /dev/null +++ b/apple/OmnivoreKit/Sources/Views/CommunityModal.swift @@ -0,0 +1,73 @@ +// +// CommunityModal.swift +// +// +// Created by Jackson Harper on 12/7/22. +// + +import Foundation +import StoreKit +import SwiftUI + +let tweetUrl = "https://twitter.com/intent/tweet?text=I%20recently%20started%20using%20@OmnivoreApp%20as%20a%20free,%20open-source%20read-it-later%20app.%20Check%20it%20out:%20https://omnivore.app" + +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. + """ + + public init() {} + + public var body: some View { + VStack(spacing: 0) { + VStack(alignment: .leading) { + Text("Help build the Omnivore Community") + .font(.textToSpeechRead) + .foregroundColor(Color.appGrayTextContrast) + .frame(maxWidth: .infinity, alignment: .leading) + + HStack { + TextChip(text: "¡ Help Wanted !", color: Color.red) + .frame(alignment: .leading) + TextChip(text: "¡ Community !", color: Color.green) + .frame(alignment: .leading) + } + } + + // ScrollView { + Text((try? AttributedString(markdown: message, + options: AttributedString.MarkdownParsingOptions(interpretedSyntax: .inlineOnlyPreservingWhitespace))) ?? "") + .foregroundColor(Color.appGrayText) + .accentColor(.blue) + .padding(.top, 16) + + Group { + Button(action: { + if let scene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene { + SKStoreReviewController.requestReview(in: scene) + } + }, label: { Text("Review on the AppStore") }) + + if let url = URL(string: tweetUrl) { + Link("Tweet about Omnivore", destination: url) + } + + if let url = URL(string: "https://github.com/omnivore-app/omnivore") { + Link("Star on GitHub", destination: url) + } + } + .frame(maxWidth: .infinity, alignment: .leading) + .padding(.top, 16) + + Spacer() + + Button(action: { + dismiss() + }, label: { Text("Dismiss") }) + .buttonStyle(PlainButtonStyle()) + }.padding() + } +}