From d971d7a2c2511775713cdba7f886a8341461c798 Mon Sep 17 00:00:00 2001 From: leits Date: Thu, 18 Feb 2021 20:47:59 +0100 Subject: [PATCH] Reorganize about section --- MeetingBar/Constants.swift | 4 +- MeetingBar/Views/Preferences/GeneralTab.swift | 142 +++++++++++------- 2 files changed, 92 insertions(+), 54 deletions(-) diff --git a/MeetingBar/Constants.swift b/MeetingBar/Constants.swift index c10ab114..4fb39fc5 100644 --- a/MeetingBar/Constants.swift +++ b/MeetingBar/Constants.swift @@ -82,7 +82,9 @@ enum CreateMeetingServices: String, Codable, CaseIterable { enum Links { static var patreon = URL(string: "https://www.patreon.com/meetingbar")! - static var manual = URL(string: "https://meetingbar.onrender.com/manual?utm_source=app")! + static var github = URL(string: "https://github.com/leits/MeetingBar")! + static var telegram = URL(string: "https://t.me/leits")! + static var twitter = URL(string: "https://twitter.com/leits_dev")! static var emailMe = URL(string: "mailto:leits.dev@gmail.com?subject=MeetingBar")! static var calendarPreferences = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_Calendars")! } diff --git a/MeetingBar/Views/Preferences/GeneralTab.swift b/MeetingBar/Views/Preferences/GeneralTab.swift index 2ad16286..602fa490 100644 --- a/MeetingBar/Views/Preferences/GeneralTab.swift +++ b/MeetingBar/Views/Preferences/GeneralTab.swift @@ -56,39 +56,61 @@ struct ShortcutsSection: View { struct PatronageAppSection: View { @State var showingPatronageModal = false + @State var showingContactModal = false + + @Default(.isInstalledFromAppStore) var isInstalledFromAppStore var body: some View { VStack(alignment: .leading, spacing: 15) { VStack(alignment: .center) { - Spacer() - VStack(alignment: .center) { - Image(nsImage: NSImage(named: EventTitleIconFormat.appicon.rawValue)!).resizable() - .frame(width: 120.0, height: 120.0) - Text("MeetingBar").font(.system(size: 20)).bold() - if Bundle.main.infoDictionary != nil { - Text("Version \(Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "unknown")").foregroundColor(.gray) - } - } Spacer() HStack { - Button(action: { self.showingPatronageModal.toggle() }) { - Text("Patronage") - }.sheet(isPresented: $showingPatronageModal) { - PatronageModal() - } - Spacer() -// Button(action: openManual) { -// Text("Manual") -// Image(nsImage: NSImage(named: NSImage.followLinkFreestandingTemplateName)!) -// } + VStack(alignment: .center) { + Image(nsImage: NSImage(named: EventTitleIconFormat.appicon.rawValue)!).resizable() + .frame(width: 120.0, height: 120.0) + Text("MeetingBar").font(.system(size: 20)).bold() + if Bundle.main.infoDictionary != nil { + Text("Version \(Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "unknown")").foregroundColor(.gray) + } + }.frame(minWidth: 0, maxWidth: .infinity) + VStack { + Spacer() + Text("MeetingBar is open-source app created by Andrii Leitsius\nThe app aims to make your experience with online meetings smoother and easier").multilineTextAlignment(.center) + Spacer() + + HStack { + Spacer() + Button(action: clickPatronage) { + Text("Patronage") + }.sheet(isPresented: $showingPatronageModal) { + PatronageModal() + } + Spacer() + Button(action: { Links.github.openInDefaultBrowser() }) { + Text("GitHub") + } + Spacer() + Button(action: { self.showingContactModal.toggle() }) { + Text("Contact") + }.sheet(isPresented: $showingContactModal) { + ContactModal() + } + Spacer() + } + Spacer() + }.frame(minWidth: 360, maxWidth: .infinity) } + Spacer() } } } - func openManual() { - NSLog("Open manual") - Links.manual.openInDefaultBrowser() + func clickPatronage() { + if isInstalledFromAppStore { + self.showingPatronageModal.toggle() + } else { + Links.patreon.openInDefaultBrowser() + } } } @@ -98,15 +120,10 @@ struct PatronageModal: View { @State var products: [String] = [] @Default(.patronageDuration) var patronageDuration - @Default(.isInstalledFromAppStore) var isInstalledFromAppStore var body: some View { VStack { Spacer() - VStack(alignment: .leading) { - Text("MeetingBar is open-source app created by Andrii Leitsius. The app aims to make your experience with online meetings smoother and easier.") - } - Divider() HStack { VStack(alignment: .leading) { HStack { @@ -115,36 +132,28 @@ struct PatronageModal: View { }.frame(width: 120) Spacer() VStack(alignment: .leading) { - if isInstalledFromAppStore { - Button(action: { purchasePatronage(patronageProducts.threeMonth) }) { - Text("3 Month - 2.99 USD").frame(width: 150) - } - Button(action: { purchasePatronage(patronageProducts.sixMonth) }) { - Text("6 Month - 5.99 USD").frame(width: 150) - } - Button(action: { purchasePatronage(patronageProducts.twelveMonth) }) { - Text("12 Month - 11.99 USD").frame(width: 150) - } - Text("These one-time purchases do not auto-renew.").font(.system(size: 10)) - } else { - Button(action: self.supportOnPatreon) { - Text("on Patreon").frame(width: 150) - } + Button(action: { purchasePatronage(patronageProducts.threeMonth) }) { + Text("3 Month - 2.99 USD").frame(width: 150) + } + Button(action: { purchasePatronage(patronageProducts.sixMonth) }) { + Text("6 Month - 5.99 USD").frame(width: 150) } + Button(action: { purchasePatronage(patronageProducts.twelveMonth) }) { + Text("12 Month - 11.99 USD").frame(width: 150) + } + Text("These one-time purchases do not auto-renew.").font(.system(size: 10)) }.frame(maxWidth: .infinity) } - Divider() - Spacer() if patronageDuration > 0 { - Text("Thanks! You support MeetingBar for \(patronageDuration) Month! 🎉") - Spacer() Divider() + Spacer() + Text("Thanks! You support MeetingBar for \(patronageDuration) Month! 🎉") } + Spacer() + Divider() HStack { - if isInstalledFromAppStore { - Button(action: restorePatronagePurchases) { - Text("Restore Purchases") - } + Button(action: restorePatronagePurchases) { + Text("Restore Purchases") } Spacer() Button(action: { @@ -155,9 +164,36 @@ struct PatronageModal: View { } }.padding().frame(width: 400, height: 300) } +} + +struct ContactModal: View { + @Environment(\.presentationMode) var presentationMode - func supportOnPatreon() { - NSLog("Click supportOnPatreon") - Links.patreon.openInDefaultBrowser() + var body: some View { + VStack { + Spacer() + Text("If you have any questions or feedback,\nfeel free to contact me:") + Spacer() + + Button(action: { Links.emailMe.openInDefaultBrowser() }) { + Text("email").frame(width: 80) + } + Button(action: { Links.twitter.openInDefaultBrowser() }) { + Text("twitter").frame(width: 80) + } + Button(action: { Links.telegram.openInDefaultBrowser() }) { + Text("telegram").frame(width: 80) + } + Spacer() + Divider() + HStack { + Spacer() + Button(action: { + self.presentationMode.wrappedValue.dismiss() + }) { + Text("Close") + } + } + }.padding().frame(width: 300, height: 220) } }