From 4d5d3fc66340f3787e0d2ea9b882eb434b8c65bd Mon Sep 17 00:00:00 2001 From: Cristi Habliuc Date: Wed, 23 Sep 2020 15:39:03 +0300 Subject: [PATCH] Added safety guide link in the menu screen; Bumped version for release --- MonitorizareVot.xcodeproj/project.pbxproj | 4 +-- .../Base.lproj/Localizable.strings | 1 + .../ro.lproj/Localizable.strings | 1 + MonitorizareVot/MVAnalytics.swift | 2 ++ MonitorizareVot/RemoteConfigManager.swift | 2 ++ .../Settings/MenuViewController.swift | 16 +++++++++++ .../Settings/MenuViewController.xib | 27 ++++++++++++++++--- 7 files changed, 47 insertions(+), 6 deletions(-) diff --git a/MonitorizareVot.xcodeproj/project.pbxproj b/MonitorizareVot.xcodeproj/project.pbxproj index 4ea0b91..0eca31f 100644 --- a/MonitorizareVot.xcodeproj/project.pbxproj +++ b/MonitorizareVot.xcodeproj/project.pbxproj @@ -1285,7 +1285,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MonitorizareVot/MonitorizareVot.entitlements; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 11; + CURRENT_PROJECT_VERSION = 12; INFOPLIST_FILE = MonitorizareVot/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1305,7 +1305,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MonitorizareVot/MonitorizareVot.entitlements; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 11; + CURRENT_PROJECT_VERSION = 12; INFOPLIST_FILE = MonitorizareVot/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; diff --git a/MonitorizareVot/Localizations/Base.lproj/Localizable.strings b/MonitorizareVot/Localizations/Base.lproj/Localizable.strings index f5cf8d1..c1d3b4c 100644 --- a/MonitorizareVot/Localizations/Base.lproj/Localizable.strings +++ b/MonitorizareVot/Localizations/Base.lproj/Localizable.strings @@ -103,6 +103,7 @@ "Menu.Button.ChangeLanguage" = "Change Language"; "Menu.Button.ContactUs" = "Contact us"; "Menu.Button.PrivacyPolicy" = "Privacy Policy"; +"Menu.Button.Safety" = "Safety Information"; "Text.About.Title" = "About the application"; "Text.About.Body" = "Vote Monitor is an application developed by Code for Romania.\n\nIt's the first election monitoring application in Romania and one of the few in the world. It's been used by independent observers starting with the presidential elections in 2016. In Poland it was used in 2018 during the first independently observed elections.\n\nThe applications' code is Open Source. Check it out on GitHub! [Kotlin](https://github.com/code4romania/mon-vot-android-kotlin) or [iOS](https://github.com/code4romania/monitorizare-vot-ios).\n\nCode for Romania is an NGO that develops pro-bono IT solutions with the purpose of solving some of the society's issues. If you want to support our activity, go to [our website](https://code4.ro/ro/), sign up as a volunteer or donate."; diff --git a/MonitorizareVot/Localizations/ro.lproj/Localizable.strings b/MonitorizareVot/Localizations/ro.lproj/Localizable.strings index fa3f176..68cb20c 100644 --- a/MonitorizareVot/Localizations/ro.lproj/Localizable.strings +++ b/MonitorizareVot/Localizations/ro.lproj/Localizable.strings @@ -103,6 +103,7 @@ "Menu.Button.ChangeLanguage" = "Schimbă limba"; "Menu.Button.ContactUs" = "Contactează-ne"; "Menu.Button.PrivacyPolicy" = "Politica de confidențialitate"; +"Menu.Button.Safety" = "Siguranța la vot"; "Text.About.Title" = "Despre aplicație"; "Text.About.Body" = "Monitorizare Vot este o aplicație realizată de Code for Romania.\n\nEste prima aplicație de monitorizare a alegerilor din România, și una dintre puținele din lume. A fost folosită, de către observatori, începând cu alegerile prezidențiale din 2016. În Polonia a fost folosită, în 2018, la primele lor alegeri observate independent.\n\nSursele de cod ale aplicației sunt deschise. Aruncă o privire pe GitHub! [Kotlin](https://github.com/code4romania/mon-vot-android-kotlin) sau [iOS](https://github.com/code4romania/monitorizare-vot-ios).\n\nCode for Romania este un ONG care dezvoltă pro-bono soluţii IT cu scopul de a rezolva probleme ale societăţii. Dacă vrei să sprijini activitatea noastră, intră pe [site-ul nostru](https://code4.ro/ro/), înscrie-te ca voluntar sau donează."; diff --git a/MonitorizareVot/MVAnalytics.swift b/MonitorizareVot/MVAnalytics.swift index 87cfe06..e3a01a5 100644 --- a/MonitorizareVot/MVAnalytics.swift +++ b/MonitorizareVot/MVAnalytics.swift @@ -27,6 +27,7 @@ enum MVAnalyticsEvent { case tapCall case tapContact case tapGuide + case tapSafetyGuide case internetDown case tapChangeStation(fromScreen: String) case tapManualSync @@ -51,6 +52,7 @@ enum MVAnalyticsEvent { case .addNoteForQuestion: return "note_question_add" case .tapCall: return "tap_call" case .tapGuide: return "tap_guide" + case .tapSafetyGuide: return "tap_safety_guide" case .internetDown: return "internet_down" case .tapChangeStation: return "tap_change_station" case .tapManualSync: return "tap_manual_sync" diff --git a/MonitorizareVot/RemoteConfigManager.swift b/MonitorizareVot/RemoteConfigManager.swift index 805ec29..dac84d3 100644 --- a/MonitorizareVot/RemoteConfigManager.swift +++ b/MonitorizareVot/RemoteConfigManager.swift @@ -17,6 +17,7 @@ enum RemoteConfigKey: String, CaseIterable { case privacyPolicyUrl = "privacy_policy_url" case callCenterPhone = "call_center_phone" case observerGuideUrl = "observer_guide_url" + case safetyGuideUrl = "safety_guide_url" case contactEmail = "contact_email" func defaultValue() -> Any { @@ -27,6 +28,7 @@ enum RemoteConfigKey: String, CaseIterable { case .privacyPolicyUrl: return "https://code4.ro/ro/codul-de-conduita/" case .callCenterPhone: return "0800080200" case .observerGuideUrl: return "https://fiecarevot.ro/wp-content/uploads/2019/11/Manual-prezidentiale.pdf" + case .safetyGuideUrl: return "" case .contactEmail: return "contact@code4.ro" } } diff --git a/MonitorizareVot/Settings/MenuViewController.swift b/MonitorizareVot/Settings/MenuViewController.swift index ca502ae..4a2bbe9 100644 --- a/MonitorizareVot/Settings/MenuViewController.swift +++ b/MonitorizareVot/Settings/MenuViewController.swift @@ -17,6 +17,7 @@ class MenuViewController: MVViewController { @IBOutlet private var changeStationButton: UIButton! @IBOutlet private var guideButton: UIButton! + @IBOutlet private var safetyGuideButton: UIButton! @IBOutlet private var callButton: UIButton! @IBOutlet private var aboutButton: UIButton! @IBOutlet private var logoutButton: UIButton! @@ -42,6 +43,7 @@ class MenuViewController: MVViewController { // closeButton.setTitle("Menu.Button.Close".localized, for: .normal) changeStationButton.setTitle("Menu.Button.ChangeStation".localized, for: .normal) guideButton.setTitle("Menu.Button.Guide".localized, for: .normal) + safetyGuideButton.setTitle("Menu.Button.Safety".localized, for: .normal) callButton.setTitle("Menu.Button.Call".localized, for: .normal) aboutButton.setTitle("Menu.Button.About".localized, for: .normal) logoutButton.setTitle("Menu.Button.Logout".localized, for: .normal) @@ -57,6 +59,8 @@ class MenuViewController: MVViewController { handleChangeSectionButtonAction() case guideButton: presentGuideViewController() + case safetyGuideButton: + presentSafetyGuideViewController() case callButton: performCall() case aboutButton: @@ -86,6 +90,18 @@ class MenuViewController: MVViewController { } } + @objc func presentSafetyGuideViewController() { + MVAnalytics.shared.log(event: .tapSafetyGuide) + if let urlString = RemoteConfigManager.shared.value(of: .safetyGuideUrl).stringValue, + let url = URL(string: urlString) { + let safariViewController = SFSafariViewController(url: url) + self.present(safariViewController, animated: true, completion: nil) + } else { + let error = UIAlertController.error(withMessage: "Safety guide not available right now") + present(error, animated: true, completion: nil) + } + } + @objc func performCall() { MVAnalytics.shared.log(event: .tapCall) if let phone = RemoteConfigManager.shared.value(of: .callCenterPhone).stringValue { diff --git a/MonitorizareVot/Settings/MenuViewController.xib b/MonitorizareVot/Settings/MenuViewController.xib index 05f4f90..e066852 100644 --- a/MonitorizareVot/Settings/MenuViewController.xib +++ b/MonitorizareVot/Settings/MenuViewController.xib @@ -16,6 +16,7 @@ + @@ -60,7 +61,7 @@ - +