Skip to content

Commit

Permalink
Merge pull request #204 from code4romania/add-new-link
Browse files Browse the repository at this point in the history
Safety guide link
  • Loading branch information
CristiHabliuc authored Sep 23, 2020
2 parents d586bdd + 4d5d3fc commit b08973e
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 6 deletions.
4 changes: 2 additions & 2 deletions MonitorizareVot.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.";
1 change: 1 addition & 0 deletions MonitorizareVot/Localizations/ro.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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ă.";
Expand Down
2 changes: 2 additions & 0 deletions MonitorizareVot/MVAnalytics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ enum MVAnalyticsEvent {
case tapCall
case tapContact
case tapGuide
case tapSafetyGuide
case internetDown
case tapChangeStation(fromScreen: String)
case tapManualSync
Expand All @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions MonitorizareVot/RemoteConfigManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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"
}
}
Expand Down
16 changes: 16 additions & 0 deletions MonitorizareVot/Settings/MenuViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand All @@ -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)
Expand All @@ -57,6 +59,8 @@ class MenuViewController: MVViewController {
handleChangeSectionButtonAction()
case guideButton:
presentGuideViewController()
case safetyGuideButton:
presentSafetyGuideViewController()
case callButton:
performCall()
case aboutButton:
Expand Down Expand Up @@ -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 {
Expand Down
27 changes: 23 additions & 4 deletions MonitorizareVot/Settings/MenuViewController.xib
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<outlet property="changeStationButton" destination="BWC-8F-7Nk" id="8jO-B4-2MK"/>
<outlet property="guideButton" destination="XIC-bH-fSh" id="dT8-y1-CJG"/>
<outlet property="logoutButton" destination="uj4-Ll-qEA" id="uk4-E8-ngb"/>
<outlet property="safetyGuideButton" destination="2aA-cD-rHH" id="Iqp-4t-pPm"/>
<outlet property="titleLabel" destination="C4X-EU-Tfa" id="oaF-HK-YtZ"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
Expand Down Expand Up @@ -60,7 +61,7 @@
<rect key="frame" x="16" y="20" width="343" height="504"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="HAw-U5-Ep1">
<rect key="frame" x="0.0" y="0.0" width="343" height="256"/>
<rect key="frame" x="0.0" y="0.0" width="343" height="312"/>
<subviews>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="eKJ-V3-Kmh">
<rect key="frame" x="0.0" y="-32" width="343" height="32"/>
Expand Down Expand Up @@ -135,8 +136,26 @@
<action selector="handleMenuButtonTap:" destination="-1" eventType="touchUpInside" id="sNP-jm-aoe"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Apo-Bx-YWZ">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2aA-cD-rHH">
<rect key="frame" x="0.0" y="148" width="343" height="52"/>
<constraints>
<constraint firstAttribute="height" constant="52" id="YFu-DM-Jz3"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="16"/>
<inset key="contentEdgeInsets" minX="16" minY="0.0" maxX="0.0" maxY="0.0"/>
<inset key="titleEdgeInsets" minX="16" minY="0.0" maxX="0.0" maxY="0.0"/>
<state key="normal" title="Safety guide" image="icon-menu-guide">
<color key="titleColor" red="0.20000000000000001" green="0.24313725489999999" blue="0.28235294119999998" alpha="1" colorSpace="calibratedRGB"/>
</state>
<state key="highlighted" backgroundImage="bg-menu-item-selected">
<color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="handleMenuButtonTap:" destination="-1" eventType="touchUpInside" id="HEf-Zi-5Jz"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Apo-Bx-YWZ">
<rect key="frame" x="0.0" y="204" width="343" height="52"/>
<constraints>
<constraint firstAttribute="height" constant="52" id="64L-b7-1cz"/>
</constraints>
Expand All @@ -154,7 +173,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="xgH-W5-sUV">
<rect key="frame" x="0.0" y="204" width="343" height="52"/>
<rect key="frame" x="0.0" y="260" width="343" height="52"/>
<constraints>
<constraint firstAttribute="height" constant="52" id="3Ts-ig-REs"/>
</constraints>
Expand All @@ -174,7 +193,7 @@
</subviews>
</stackView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="26t-qT-zRj">
<rect key="frame" x="0.0" y="256" width="343" height="196"/>
<rect key="frame" x="0.0" y="312" width="343" height="140"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="uj4-Ll-qEA">
Expand Down

0 comments on commit b08973e

Please sign in to comment.