Skip to content
This repository was archived by the owner on May 26, 2025. It is now read-only.

Commit b7c1255

Browse files
Merge pull request #173 from code4romania/develop
v2.1 release
2 parents 5034d9a + d21522c commit b7c1255

31 files changed

+472
-110
lines changed

.github/CONTRIBUTING.MD

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Monitorizare Vot - iOS app - Contributing guide
1+
# Vote Monitor - iOS - Contributing guide
22

33
:two_hearts: First off all, thank you for your interest in the project and for taking the time to contribute!
44

@@ -40,7 +40,8 @@ To send us a suggestion, just [open an issue](https://github.com/code4romania/mo
4040

4141
:computer: We'd love for you to get your hands dirty and code for the project.
4242

43-
If you are unsure where to begin contributing to the project, you can start by looking through these issues:
43+
If you are unsure where to begin contributing to the project, you can start by looking through these issues:
44+
[How to contribute](.github/WORKFLOW.MD)
4445
* [Good first issues](https://github.com/code4romania/monitorizare-vot-ios/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
4546
* [Help wanted](https://github.com/code4romania/monitorizare-vot-ios/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
4647

.github/WORKFLOW.MD

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@ Whether you're trying to give back to the open source community or collaborating
22

33
In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.
44

5+
## TL;DR
6+
7+
Steps (details below):
8+
1. Create issue if it doesn't exist
9+
2. Pull the latest `upstream/develop` into your fork
10+
3. Create feature branch in your fork
11+
4. Code it up
12+
5. Commit the changes (can put multiple commits since you'll be basing the PR off the branch)
13+
6. Push the changes to `origin/develop` (your fork)
14+
7. Create PR on Code4Romania repo basing `develop` <- `your fork/your feature branch`
15+
8. Enjoy success
16+
17+
Detailed instructions below.
18+
519
## Creating a Fork
620

721
Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or just head straight to the command line:
@@ -17,7 +31,7 @@ While this isn't an absolutely necessary step, if you plan on doing anything mor
1731

1832
```shell
1933
# Add 'upstream' repo to list of remotes
20-
git remote add upstream https://github.com/UPSTREAM-USER/ORIGINAL-PROJECT.git
34+
git remote add upstream https://github.com/code4romania/monitorizare-vot-ios.git
2135

2236
# Verify the new remote named 'upstream'
2337
git remote -v
@@ -33,17 +47,17 @@ git fetch upstream
3347
git branch -va
3448
```
3549

36-
Now, checkout your own master branch and merge the upstream repo's master branch:
50+
From this point onward, it's important to know that we use the `develop` branch for work and we only merge in `master` final releases. You can disregard the `master` branch completely for the purpose of contributing to the project. So checkout the `develop` branch and merge the upstream `develop` branch.
3751

3852
```shell
3953
# Checkout your master branch and merge upstream
40-
git checkout master
41-
git merge upstream/master
54+
git checkout develop
55+
git merge upstream/develop
4256
```
4357

44-
If there are no unique commits on the local master branch, git will simply perform a fast-forward. However, if you have been making changes on master (in the vast majority of cases you probably shouldn't be - [see the next section](#doing-your-work), you may have to deal with conflicts. When doing so, be careful to respect the changes made upstream.
58+
If there are no unique commits on the local branch, git will simply perform a fast-forward. However, if you have been making changes on develop (in the vast majority of cases you probably shouldn't be - [see the next section](#doing-your-work), you may have to deal with conflicts. When doing so, be careful to respect the changes made upstream.
4559

46-
Now, your local master branch is up-to-date with everything modified upstream.
60+
Now, your local develop branch is up-to-date with everything modified upstream.
4761

4862
## Doing Your Work
4963

@@ -54,7 +68,7 @@ To create a new branch and start working on it:
5468

5569
```shell
5670
# Checkout the master branch - you want your new branch to come from master
57-
git checkout master
71+
git checkout develop
5872

5973
# Create a new branch named newfeature (give your branch its own simple informative name)
6074
git branch newfeature
@@ -69,22 +83,22 @@ Now, go to town hacking away and making whatever changes you want to.
6983

7084
### Cleaning Up Your Work
7185

72-
Prior to submitting your pull request, you might want to do a few things to clean up your branch and make it as simple as possible for the original repo's maintainer to test, accept, and merge your work.
86+
__IMPORTANT:__ Prior to submitting your pull request, you might want to do a few things to clean up your branch and make it as simple as possible for the original repo's maintainer to test, accept, and merge your work.
7387

7488
If any commits have been made to the upstream master branch, you should rebase your development branch so that merging it will be a simple fast-forward that won't require any conflict resolution work.
7589

7690
```shell
7791
# Fetch upstream master and merge with your repo's master branch
7892
git fetch upstream
79-
git checkout master
80-
git merge upstream/master
93+
git checkout develop
94+
git merge upstream/develop
8195

8296
# If there were any new commits, rebase your development branch
8397
git checkout newfeature
84-
git rebase master
98+
git rebase develop
8599
```
86100

87-
Now, it may be desirable to squash some of your smaller commits down into a small number of larger more cohesive commits. You can do this with an interactive rebase:
101+
_Optionally_ it may be desirable to squash some of your smaller commits down into a small number of larger more cohesive commits. You can do this with an interactive rebase:
88102

89103
```shell
90104
# Rebase all commits on your development branch
@@ -94,10 +108,18 @@ git rebase -i master
94108

95109
This will open up a text editor where you can specify which commits to squash.
96110

111+
### TL;DR
112+
113+
Fetch from `upstream/develop` (the main repository's develop), commit and push to `origin/develop` (your fork's develop), then PR into `code4romania/develop` <- `<your_username>/newfeature`.
114+
Always fetch/merge `upstream/develop` into `origin/newfeature` before submitting the PR. This ensures that the reviewer will be able to merge your PR if approved.
115+
Also, keep an eye on any changes the reviewer might ask and don't delay their integration very much, otherwise your PR will become stale and it won't be merged anymore if it's too old and obsolete.
116+
97117
### Submitting
98118

99119
Once you've committed and pushed all of your changes to GitHub, go to the page for your fork on GitHub, select your development branch, and click the pull request button. If you need to make any adjustments to your pull request, just push the updates to GitHub. Your pull request will automatically track the changes on your development branch and update.
100120

121+
Make sure you're creating the PR so that your `feature` branch will be merged into the upstream's `develop` branch. Again, do not base it on master, but rather the `develop` branch.
122+
101123
## Accepting and Merging a Pull Request
102124

103125
Take note that unlike the previous sections which were written from the perspective of someone that created a fork and generated a pull request, this section is written from the perspective of the original repository owner who is handling an incoming pull request. Thus, where the "forker" was referring to the original repository as `upstream`, we're now looking at it as the owner of that original repository and the standard `origin` remote.

MonitorizareVot.xcodeproj/project.pbxproj

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
28735F83226B19F600B4DB0B /* CustomConfiguration.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 28735F82226B19F600B4DB0B /* CustomConfiguration.xcconfig */; };
3939
28735F84226B19F600B4DB0B /* CustomConfiguration.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 28735F82226B19F600B4DB0B /* CustomConfiguration.xcconfig */; };
4040
28735F85226B19F600B4DB0B /* CustomConfiguration.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 28735F82226B19F600B4DB0B /* CustomConfiguration.xcconfig */; };
41+
2879CA372381BA5E00CE4DC7 /* AppRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2879CA362381BA5E00CE4DC7 /* AppRouter.swift */; };
42+
2879CA3A2381C04F00CE4DC7 /* EmptyDetailsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2879CA382381C04F00CE4DC7 /* EmptyDetailsViewController.swift */; };
43+
2879CA3B2381C04F00CE4DC7 /* EmptyDetailsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2879CA392381C04F00CE4DC7 /* EmptyDetailsViewController.xib */; };
4144
28844A50233F6F3B00DEEA44 /* ChooserButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28844A4F233F6F3B00DEEA44 /* ChooserButton.swift */; };
4245
28844A52233F775E00DEEA44 /* SectionHUDViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28844A51233F775E00DEEA44 /* SectionHUDViewModel.swift */; };
4346
28844A56233F94FD00DEEA44 /* GenericPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28844A54233F94FD00DEEA44 /* GenericPickerViewController.swift */; };
@@ -166,6 +169,9 @@
166169
286D38652364398C0091B23F /* QuestionListViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = QuestionListViewController.xib; sourceTree = "<group>"; };
167170
286D3868236439990091B23F /* QuestionListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuestionListViewModel.swift; sourceTree = "<group>"; };
168171
28735F82226B19F600B4DB0B /* CustomConfiguration.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = CustomConfiguration.xcconfig; sourceTree = "<group>"; };
172+
2879CA362381BA5E00CE4DC7 /* AppRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppRouter.swift; sourceTree = "<group>"; };
173+
2879CA382381C04F00CE4DC7 /* EmptyDetailsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyDetailsViewController.swift; sourceTree = "<group>"; };
174+
2879CA392381C04F00CE4DC7 /* EmptyDetailsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EmptyDetailsViewController.xib; sourceTree = "<group>"; };
169175
28844A4F233F6F3B00DEEA44 /* ChooserButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChooserButton.swift; sourceTree = "<group>"; };
170176
28844A51233F775E00DEEA44 /* SectionHUDViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SectionHUDViewModel.swift; sourceTree = "<group>"; };
171177
28844A54233F94FD00DEEA44 /* GenericPickerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenericPickerViewController.swift; sourceTree = "<group>"; };
@@ -472,6 +478,8 @@
472478
28FB66B223699D7400336DBA /* TextEntryViewController.swift */,
473479
28FB66B323699D7400336DBA /* TextEntryViewController.xib */,
474480
289E1E9023604F9D000C92A0 /* MVViewController.swift */,
481+
2879CA382381C04F00CE4DC7 /* EmptyDetailsViewController.swift */,
482+
2879CA392381C04F00CE4DC7 /* EmptyDetailsViewController.xib */,
475483
);
476484
path = Utility;
477485
sourceTree = "<group>";
@@ -522,6 +530,7 @@
522530
28A4B775237364FE00E6D2A8 /* RemoteConfigManager.swift */,
523531
28DBDAA1236EDDCA004EAD83 /* NotificationsManager.swift */,
524532
28DBDAA5236F33CD004EAD83 /* MVAnalytics.swift */,
533+
2879CA362381BA5E00CE4DC7 /* AppRouter.swift */,
525534
);
526535
name = Utils;
527536
sourceTree = "<group>";
@@ -819,6 +828,7 @@
819828
28844A5D233F9AB700DEEA44 /* TimePickerViewController.xib in Resources */,
820829
28DBDABB23701DBD004EAD83 /* InfoPlist.strings in Resources */,
821830
289E1E8D235F2ABE000C92A0 /* FormSetTableCell.xib in Resources */,
831+
2879CA3B2381C04F00CE4DC7 /* EmptyDetailsViewController.xib in Resources */,
822832
28508623236D9C6000189D94 /* Launch Screen.storyboard in Resources */,
823833
286D38672364398C0091B23F /* QuestionListViewController.xib in Resources */,
824834
28735F83226B19F600B4DB0B /* CustomConfiguration.xcconfig in Resources */,
@@ -1043,7 +1053,9 @@
10431053
271595B521465EBA00BECC9C /* String+Localization.swift in Sources */,
10441054
286D3869236439990091B23F /* QuestionListViewModel.swift in Sources */,
10451055
E74087241DDC90E800D9332F /* AppDelegate.swift in Sources */,
1056+
2879CA3A2381C04F00CE4DC7 /* EmptyDetailsViewController.swift in Sources */,
10461057
28A7DCB6235CC7EB000B00C4 /* ApiModels.swift in Sources */,
1058+
2879CA372381BA5E00CE4DC7 /* AppRouter.swift in Sources */,
10471059
28C4343C2370C5C9001E6268 /* UITableView+HeaderAutoLayout.swift in Sources */,
10481060
67EE98CB22A296F7006E4762 /* Logger.swift in Sources */,
10491061
F553E3BE1DF9D67A000D0902 /* Answer+CoreDataProperties.swift in Sources */,
@@ -1228,10 +1240,11 @@
12281240
CLANG_ENABLE_MODULES = YES;
12291241
CODE_SIGN_ENTITLEMENTS = MonitorizareVot/MonitorizareVot.entitlements;
12301242
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
1231-
CURRENT_PROJECT_VERSION = 9;
1243+
CURRENT_PROJECT_VERSION = 11;
12321244
INFOPLIST_FILE = MonitorizareVot/Info.plist;
12331245
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
12341246
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
1247+
MARKETING_VERSION = 2.1;
12351248
PRODUCT_NAME = "$(TARGET_NAME)";
12361249
SWIFT_OBJC_BRIDGING_HEADER = "";
12371250
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -1247,10 +1260,11 @@
12471260
CLANG_ENABLE_MODULES = YES;
12481261
CODE_SIGN_ENTITLEMENTS = MonitorizareVot/MonitorizareVot.entitlements;
12491262
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
1250-
CURRENT_PROJECT_VERSION = 9;
1263+
CURRENT_PROJECT_VERSION = 11;
12511264
INFOPLIST_FILE = MonitorizareVot/Info.plist;
12521265
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
12531266
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
1267+
MARKETING_VERSION = 2.1;
12541268
PRODUCT_NAME = "$(TARGET_NAME)";
12551269
SWIFT_OBJC_BRIDGING_HEADER = "";
12561270
SWIFT_VERSION = 5.0;

MonitorizareVot/AppDelegate.swift

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -103,27 +103,8 @@ extension AppDelegate {
103103
window?.overrideUserInterfaceStyle = .light
104104
}
105105

106-
if OnboardingViewModel.shouldShowOnboarding {
107-
goToOnboarding()
108-
} else {
109-
goToLogin()
110-
}
106+
AppRouter.shared.showAppEntry()
111107
}
112108

113-
func goToLogin() {
114-
let entryViewController = LoginViewController()
115-
if let currentNavigation = window?.rootViewController as? UINavigationController {
116-
currentNavigation.setViewControllers([entryViewController], animated: true)
117-
} else {
118-
let navigation = UINavigationController(rootViewController: entryViewController)
119-
window?.rootViewController = navigation
120-
}
121-
}
122-
123-
func goToOnboarding() {
124-
let entryViewController = OnboardingLanguageViewController()
125-
let navigation = UINavigationController(rootViewController: entryViewController)
126-
window?.rootViewController = navigation
127-
}
128109

129110
}

MonitorizareVot/AppRouter.swift

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
//
2+
// AppRouter.swift
3+
// MonitorizareVot
4+
//
5+
// Created by Cristi Habliuc on 17/11/2019.
6+
// Copyright © 2019 Code4Ro. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
/// Handles navigation inside the app
12+
class AppRouter: NSObject {
13+
static let shared = AppRouter()
14+
15+
var isPad: Bool { return UIDevice.current.userInterfaceIdiom == .pad }
16+
var isPhone: Bool { return UIDevice.current.userInterfaceIdiom == .phone }
17+
18+
var window: UIWindow? { return AppDelegate.shared.window }
19+
var splitViewController: UISplitViewController? { return AppDelegate.shared.window?.rootViewController as? UISplitViewController }
20+
var navigationController: UINavigationController? {
21+
return splitViewController?.viewControllers.first as? UINavigationController
22+
?? AppDelegate.shared.window?.rootViewController as? UINavigationController
23+
}
24+
25+
func showAppEntry() {
26+
if OnboardingViewModel.shouldShowOnboarding {
27+
goToOnboarding()
28+
} else {
29+
goToLogin()
30+
}
31+
}
32+
33+
func goToLogin() {
34+
let entryViewController = LoginViewController()
35+
window?.rootViewController = entryViewController
36+
}
37+
38+
func goToOnboarding() {
39+
let entryViewController = OnboardingLanguageViewController()
40+
let navigation = UINavigationController(rootViewController: entryViewController)
41+
window?.rootViewController = navigation
42+
}
43+
44+
func createSplitControllerIfNecessary() {
45+
guard splitViewController == nil else { return }
46+
}
47+
48+
func goToChooseStation() {
49+
let sectionModel = SectionPickerViewModel()
50+
let sectionController = SectionPickerViewController(withModel: sectionModel)
51+
if isPad && splitViewController == nil {
52+
AppDelegate.shared.window?.rootViewController = UISplitViewController()
53+
splitViewController?.viewControllers = [UINavigationController()]
54+
if isPad {
55+
splitViewController?.preferredDisplayMode = UISplitViewController.DisplayMode.allVisible
56+
}
57+
} else if isPhone {
58+
AppDelegate.shared.window?.rootViewController = UINavigationController()
59+
}
60+
navigationController?.setViewControllers([sectionController], animated: true)
61+
resetDetailsPane()
62+
}
63+
64+
func proceedToAuthenticated() {
65+
goToChooseStation()
66+
}
67+
68+
func goToForms(from vc: UIViewController) {
69+
let formsModel = FormListViewModel()
70+
let formsVC = FormListViewController(withModel: formsModel)
71+
navigationController?.setViewControllers([formsVC], animated: true)
72+
resetDetailsPane()
73+
}
74+
75+
func open(questionModel: QuestionAnswerViewModel) {
76+
let controller = QuestionAnswerViewController(withModel: questionModel)
77+
if isPad,
78+
let split = splitViewController {
79+
let navigation = UINavigationController(rootViewController: controller)
80+
split.showDetailViewController(navigation, sender: nil)
81+
} else {
82+
navigationController?.pushViewController(controller, animated: true)
83+
}
84+
}
85+
86+
func openAddNote() {
87+
let noteModel = NoteViewModel()
88+
let controller = NoteViewController(withModel: noteModel)
89+
if isPad,
90+
let split = splitViewController {
91+
let navigation = UINavigationController(rootViewController: controller)
92+
split.showDetailViewController(navigation, sender: nil)
93+
} else {
94+
navigationController?.pushViewController(controller, animated: true)
95+
}
96+
}
97+
98+
/// Will make the details pane go back to blank
99+
func resetDetailsPane() {
100+
guard isPad else { return }
101+
guard let split = AppDelegate.shared.window?.rootViewController as? UISplitViewController else { return}
102+
let controller = EmptyDetailsViewController()
103+
let navigation = UINavigationController(rootViewController: controller)
104+
split.showDetailViewController(navigation, sender: nil)
105+
}
106+
}

MonitorizareVot/Base.lproj/Localizable.strings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Created by Code4Romania
22

3+
"Button_Login" = "Login";
34
"Button_Continue" = "Continue";
45
"Button_ChangeDepartemnt" = "Change";
56
"Button_Urban" = "Urban";
@@ -35,6 +36,7 @@
3536
"Label_AddNote" = "Add a note";
3637
"Label_TypeNote" = "Type your note here";
3738
"Label_EnterStation" = "Enter station number (i.e. 34)";
39+
"Label_Empty" = "Choose a question or add a note";
3840

3941
"Option.Gallery" = "Load from gallery";
4042
"Option.TakePhoto" = "Take a photo";

0 commit comments

Comments
 (0)