Skip to content

Commit

Permalink
Reorganize about section
Browse files Browse the repository at this point in the history
  • Loading branch information
leits committed Feb 18, 2021
1 parent 22b76f8 commit d971d7a
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 54 deletions.
4 changes: 3 additions & 1 deletion MeetingBar/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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:[email protected]?subject=MeetingBar")!
static var calendarPreferences = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_Calendars")!
}
Expand Down
142 changes: 89 additions & 53 deletions MeetingBar/Views/Preferences/GeneralTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
}

Expand All @@ -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 {
Expand All @@ -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: {
Expand All @@ -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)
}
}

0 comments on commit d971d7a

Please sign in to comment.