From 42604eefdfc973bcec26c61d05e776a57d94e31d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Ho=C3=9F?= Date: Sun, 14 May 2017 23:03:33 +0200 Subject: [PATCH 1/8] . --- README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 README.md diff --git a/README.md b/README.md old mode 100755 new mode 100644 From aaaeeac332da0fc32b584b0c61da6facc35496e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Ho=C3=9F?= Date: Mon, 15 May 2017 23:21:46 +0200 Subject: [PATCH 2/8] add direct feedback button in app info screen that directly sends a mail from within the app and also adds some device/version info (issue #4) --- .../Additional Files/GlobalValues.swift | 1 + MateMonkey/Additional Files/Info.plist | 2 +- .../Additional Files/VisibleStrings.swift | 2 + MateMonkey/Base.lproj/Main.storyboard | 25 ++++++++--- .../Controllers/AppInfoViewController.swift | 43 ++++++++++++++++++- 5 files changed, 65 insertions(+), 8 deletions(-) diff --git a/MateMonkey/Additional Files/GlobalValues.swift b/MateMonkey/Additional Files/GlobalValues.swift index 4cd3135..cef6f5a 100644 --- a/MateMonkey/Additional Files/GlobalValues.swift +++ b/MateMonkey/Additional Files/GlobalValues.swift @@ -21,6 +21,7 @@ struct GlobalValues { static let homepageURL: String = "https://matemonkey.com" static let twitterURL: String = "https://twitter.com/matemonkeycom" static let appStoreReviewURL: String = "itms-apps://itunes.apple.com/app/id1202602103?action=write-review" + static let feedbackEmail: String = "matemonkey@jurassicturtle.com" // MARK: - Filter View size constants diff --git a/MateMonkey/Additional Files/Info.plist b/MateMonkey/Additional Files/Info.plist index 7dbc244..d94d4d7 100644 --- a/MateMonkey/Additional Files/Info.plist +++ b/MateMonkey/Additional Files/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0 + 1.0.1 CFBundleVersion 9 ITSAppUsesNonExemptEncryption diff --git a/MateMonkey/Additional Files/VisibleStrings.swift b/MateMonkey/Additional Files/VisibleStrings.swift index b0fb3fa..b4eb25b 100644 --- a/MateMonkey/Additional Files/VisibleStrings.swift +++ b/MateMonkey/Additional Files/VisibleStrings.swift @@ -53,4 +53,6 @@ struct VisibleStrings { static let bannerMessageDealerUpdated = NSLocalizedString("Dealer successfully updated.", comment: "Message displayed in a banner at the top of the screen when a dealer's information has been updated.") static let bannerMessageDealerUpdateFailed = NSLocalizedString("Dealer could not be updated.", comment: "Message displayed in a banner at the top of the screen when a dealer's information failed to update.") + // MARK: - Feedback email + static let feedbackSubject = NSLocalizedString("Matemonkey Feedback", comment: "The subject line for an email with feedback the user can send.") } diff --git a/MateMonkey/Base.lproj/Main.storyboard b/MateMonkey/Base.lproj/Main.storyboard index 6aea240..f02b2e9 100644 --- a/MateMonkey/Base.lproj/Main.storyboard +++ b/MateMonkey/Base.lproj/Main.storyboard @@ -484,7 +484,7 @@ Lines - @@ -530,20 +540,23 @@ iOS App created by Peter Hoß + - + + + - + diff --git a/MateMonkey/Controllers/AppInfoViewController.swift b/MateMonkey/Controllers/AppInfoViewController.swift index 9cd8ae1..b141fe8 100644 --- a/MateMonkey/Controllers/AppInfoViewController.swift +++ b/MateMonkey/Controllers/AppInfoViewController.swift @@ -7,7 +7,7 @@ // import UIKit -import StoreKit +import MessageUI class AppInfoViewController: UIViewController { @@ -38,6 +38,20 @@ class AppInfoViewController: UIViewController { @IBAction func twitterButtonTapped(_ sender: UIButton) { openURLFromString(GlobalValues.twitterURL) } + + @IBAction func feedbackButtonTapped(_ sender: UIButton) { + + let emailAddress = GlobalValues.feedbackEmail + let addressArray = [emailAddress] + let mailController = MFMailComposeViewController() + mailController.setToRecipients(addressArray) + mailController.setSubject(VisibleStrings.feedbackSubject) + mailController.setMessageBody("\n\n\n\n\n" + getDeviceInfoString(), isHTML: false) + mailController.mailComposeDelegate = self + + present(mailController, animated: true, completion: nil) + + } @IBAction func rateButtonTapped(_ sender: UIButton) { openURLFromString(GlobalValues.appStoreReviewURL) @@ -74,4 +88,31 @@ class AppInfoViewController: UIViewController { } } + func getDeviceInfoString() -> String { + if let versionString = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String { + if let buildString = Bundle.main.infoDictionary?["CFBundleVersion"] as? String { + let systemName = UIDevice.current.systemName + let systemVersion = UIDevice.current.systemVersion + var currentLanguage = "(unknown)" + if let language = Bundle.main.preferredLocalizations.first { + currentLanguage = language + } + + let deviceInfo = "MateMonkey version " + versionString + "(" + buildString + ")\nOperating System: " + systemName + " " + systemVersion + "\nLanguage: " + currentLanguage + + return deviceInfo + } else { + return "" + } + } else { + return "" + } + } +} + +extension AppInfoViewController: MFMailComposeViewControllerDelegate { + func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) { + // Not much to do here except dismiss the VC (we don't care whatever the user did) + self.dismiss(animated: true, completion: nil) + } } From 97e8c61bab44e262d8287de1e5b363be6f90672f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Ho=C3=9F?= Date: Tue, 16 May 2017 21:07:43 +0200 Subject: [PATCH 3/8] fix for issue #2: add sanitizing function for phone numbers --- .../Controllers/DealerDetailViewController.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/MateMonkey/Controllers/DealerDetailViewController.swift b/MateMonkey/Controllers/DealerDetailViewController.swift index 93ed9a5..766d58c 100644 --- a/MateMonkey/Controllers/DealerDetailViewController.swift +++ b/MateMonkey/Controllers/DealerDetailViewController.swift @@ -64,7 +64,7 @@ class DealerDetailViewController: UIViewController { @IBAction func phoneNumberPressed(_ sender: UIButton) { if let phoneNumber = dealerToDisplay?.address.phone { - let phoneString = "tel://" + phoneNumber.replacingOccurrences(of: " ", with: "") + let phoneString = "tel://" + sanitizedPhoneNumber(phoneNumber) if let phoneURL = URL(string: phoneString) { if UIApplication.shared.canOpenURL(phoneURL) { let phoneConfirmationAlert: UIAlertController = UIAlertController(title: VisibleStrings.callAlertTitle, message: VisibleStrings.callAlertMessage, preferredStyle: .alert) @@ -134,6 +134,15 @@ class DealerDetailViewController: UIViewController { self.present(invalidAlert, animated: true, completion: nil) } + + private func sanitizedPhoneNumber(_ phoneNumber: String) -> String { + let removedSpaces = phoneNumber.replacingOccurrences(of: " ", with: "") + let removedSlashes = removedSpaces.replacingOccurrences(of: "/", with: "") + let removedBackslashes = removedSlashes.replacingOccurrences(of: "\\", with: "") + + let sanitizedNumber = removedBackslashes + return sanitizedNumber + } // MARK: - Navigation From ac877ae59a7ebf21c166fe75a1af7607669d30ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Ho=C3=9F?= Date: Tue, 16 May 2017 21:10:46 +0200 Subject: [PATCH 4/8] fix for issue #6: enabled filters always have a white text color --- MateMonkey/MMFilterDealerButton.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/MateMonkey/MMFilterDealerButton.swift b/MateMonkey/MMFilterDealerButton.swift index 9694783..6afc0d1 100644 --- a/MateMonkey/MMFilterDealerButton.swift +++ b/MateMonkey/MMFilterDealerButton.swift @@ -35,6 +35,7 @@ class MMFilterDealerButton: UIButton { func updateButtonSettings() { if self.filterSelected { self.backgroundColor = self.color + self.setTitleColor(UIColor.white, for: UIControlState.normal) } else { self.backgroundColor = desaturateColor(self.color) if (self.typeTag == .restaurant || self.typeTag == .bar || self.typeTag == .hackerspace || self.typeTag == .club) { From df0d0f62b556aa3657f2a028c3df177f0a9af8de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Ho=C3=9F?= Date: Tue, 16 May 2017 22:50:19 +0200 Subject: [PATCH 5/8] fix for issue #1: scroll up the edit view when editing website and notes of a dealer to avoid them being hidden on smaller screens --- .../de.lproj/InfoPlist.strings | 2 +- .../en.lproj/InfoPlist.strings | 2 +- MateMonkey/Base.lproj/Main.storyboard | 22 +++++++++---------- .../EditDealerViewController.swift | 17 ++++++++++++++ 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/MateMonkey/Additional Files/de.lproj/InfoPlist.strings b/MateMonkey/Additional Files/de.lproj/InfoPlist.strings index 5b9e9d7..c865b7c 100644 --- a/MateMonkey/Additional Files/de.lproj/InfoPlist.strings +++ b/MateMonkey/Additional Files/de.lproj/InfoPlist.strings @@ -2,7 +2,7 @@ "CFBundleName" = "MateMonkey"; /* (No Commment) */ -"CFBundleShortVersionString" = "1.0"; +"CFBundleShortVersionString" = "1.0.1"; /* (No Commment) */ "NSLocationWhenInUseUsageDescription" = "Dies wird benötigt, um dir Matehändler in deiner Nähe anzuzeigen."; diff --git a/MateMonkey/Additional Files/en.lproj/InfoPlist.strings b/MateMonkey/Additional Files/en.lproj/InfoPlist.strings index ee45b1b..18e32be 100644 --- a/MateMonkey/Additional Files/en.lproj/InfoPlist.strings +++ b/MateMonkey/Additional Files/en.lproj/InfoPlist.strings @@ -2,7 +2,7 @@ "CFBundleName" = "MateMonkey"; /* (No Commment) */ -"CFBundleShortVersionString" = "1.0"; +"CFBundleShortVersionString" = "1.0.1"; /* (No Comment) */ "NSLocationWhenInUseUsageDescription" = "This is needed to find Mate dealers near you."; diff --git a/MateMonkey/Base.lproj/Main.storyboard b/MateMonkey/Base.lproj/Main.storyboard index f02b2e9..e5597ec 100644 --- a/MateMonkey/Base.lproj/Main.storyboard +++ b/MateMonkey/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -248,14 +248,14 @@ Lines - + - + @@ -265,7 +265,7 @@ Lines - +