Skip to content

Commit 607570e

Browse files
Merge pull request #15 from htmlprogrammist/develop
Added tests and minor updates
2 parents 9eb7dab + 21b5f59 commit 607570e

86 files changed

Lines changed: 3857 additions & 513 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Agenda.xcodeproj/project.pbxproj

Lines changed: 463 additions & 17 deletions
Large diffs are not rendered by default.
Binary file not shown.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1340"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "F0BB551627EF4D5400FA7E99"
18+
BuildableName = "Agenda.app"
19+
BlueprintName = "Agenda"
20+
ReferencedContainer = "container:Agenda.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
<TestableReference
32+
skipped = "NO">
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "F0055BE82854748F00430622"
36+
BuildableName = "AgendaTests.xctest"
37+
BlueprintName = "AgendaTests"
38+
ReferencedContainer = "container:Agenda.xcodeproj">
39+
</BuildableReference>
40+
</TestableReference>
41+
<TestableReference
42+
skipped = "NO">
43+
<BuildableReference
44+
BuildableIdentifier = "primary"
45+
BlueprintIdentifier = "F0FFD19028549DC6001EE4A6"
46+
BuildableName = "AgendaUITests.xctest"
47+
BlueprintName = "AgendaUITests"
48+
ReferencedContainer = "container:Agenda.xcodeproj">
49+
</BuildableReference>
50+
</TestableReference>
51+
</Testables>
52+
</TestAction>
53+
<LaunchAction
54+
buildConfiguration = "Debug"
55+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
56+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57+
launchStyle = "0"
58+
useCustomWorkingDirectory = "NO"
59+
ignoresPersistentStateOnLaunch = "NO"
60+
debugDocumentVersioning = "YES"
61+
debugServiceExtension = "internal"
62+
allowLocationSimulation = "YES">
63+
<BuildableProductRunnable
64+
runnableDebuggingMode = "0">
65+
<BuildableReference
66+
BuildableIdentifier = "primary"
67+
BlueprintIdentifier = "F0BB551627EF4D5400FA7E99"
68+
BuildableName = "Agenda.app"
69+
BlueprintName = "Agenda"
70+
ReferencedContainer = "container:Agenda.xcodeproj">
71+
</BuildableReference>
72+
</BuildableProductRunnable>
73+
</LaunchAction>
74+
<ProfileAction
75+
buildConfiguration = "Release"
76+
shouldUseLaunchSchemeArgsEnv = "YES"
77+
savedToolIdentifier = ""
78+
useCustomWorkingDirectory = "NO"
79+
debugDocumentVersioning = "YES">
80+
<BuildableProductRunnable
81+
runnableDebuggingMode = "0">
82+
<BuildableReference
83+
BuildableIdentifier = "primary"
84+
BlueprintIdentifier = "F0BB551627EF4D5400FA7E99"
85+
BuildableName = "Agenda.app"
86+
BlueprintName = "Agenda"
87+
ReferencedContainer = "container:Agenda.xcodeproj">
88+
</BuildableReference>
89+
</BuildableProductRunnable>
90+
</ProfileAction>
91+
<AnalyzeAction
92+
buildConfiguration = "Debug">
93+
</AnalyzeAction>
94+
<ArchiveAction
95+
buildConfiguration = "Release"
96+
revealArchiveInOrganizer = "YES">
97+
</ArchiveAction>
98+
</Scheme>

Agenda.xcodeproj/xcuserdata/egbad.xcuserdatad/xcschemes/xcschememanagement.plist

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,23 @@
1010
<integer>0</integer>
1111
</dict>
1212
</dict>
13+
<key>SuppressBuildableAutocreation</key>
14+
<dict>
15+
<key>F0055BE82854748F00430622</key>
16+
<dict>
17+
<key>primary</key>
18+
<true/>
19+
</dict>
20+
<key>F0BB551627EF4D5400FA7E99</key>
21+
<dict>
22+
<key>primary</key>
23+
<true/>
24+
</dict>
25+
<key>F0FFD19028549DC6001EE4A6</key>
26+
<dict>
27+
<key>primary</key>
28+
<true/>
29+
</dict>
30+
</dict>
1331
</dict>
1432
</plist>

Agenda/Application/AppCoordinator.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ private extension AppCoordinator {
3535
let context = AgendaContext(moduleOutput: nil, moduleDependency: coreDataManager)
3636
let container = AgendaContainer.assemble(with: context)
3737

38-
let agendaViewController = createNavController(viewController: container.viewController, itemName: Labels.goals, itemImage: "calendar")
38+
let agendaViewController = createNavController(viewController: container.viewController, itemName: Labels.goals, itemImage: Icons.calendar)
3939
viewControllers.append(agendaViewController)
4040
subscribeToCoreDataManager(vc: container.viewController)
4141
}
@@ -44,23 +44,23 @@ private extension AppCoordinator {
4444
let context = HistoryContext(moduleOutput: nil, moduleDependency: coreDataManager)
4545
let container = HistoryContainer.assemble(with: context)
4646

47-
let historyViewController = createNavController(viewController: container.viewController, itemName: Labels.History.title, itemImage: "clock.fill")
47+
let historyViewController = createNavController(viewController: container.viewController, itemName: Labels.History.title, itemImage: Icons.history)
4848
viewControllers.append(historyViewController)
4949
subscribeToCoreDataManager(vc: container.viewController)
5050
}
5151

5252
func setupSummary() {
5353
let context = SummaryContext(moduleOutput: nil, moduleDependency: coreDataManager)
5454
let container = SummaryContainer.assemble(with: context)
55-
let summaryViewController = createNavController(viewController: container.viewController, itemName: Labels.Summary.title, itemImage: "square.text.square.fill")
55+
let summaryViewController = createNavController(viewController: container.viewController, itemName: Labels.Summary.title, itemImage: Icons.summary)
5656
viewControllers.append(summaryViewController)
5757
subscribeToCoreDataManager(vc: container.viewController)
5858
}
5959

60-
func createNavController(viewController: UIViewController, itemName: String, itemImage: String) -> UINavigationController {
60+
func createNavController(viewController: UIViewController, itemName: String, itemImage: UIImage) -> UINavigationController {
6161

6262
let navController = UINavigationController(rootViewController: viewController)
63-
navController.tabBarItem = UITabBarItem(title: itemName, image: UIImage(named: itemImage), tag: 0)
63+
navController.tabBarItem = UITabBarItem(title: itemName, image: itemImage, tag: 0)
6464
navController.navigationBar.prefersLargeTitles = true
6565
return navController
6666
}

Agenda/Extensions/UIKit/UIAlertController.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
import UIKit
99

10-
// MARK: this code is needed so that the console no longer displays an error about the allegedly negative width
11-
10+
/// this code is needed so that the console no longer displays an error about the allegedly negative width on iOS 13 (14?)
1211
extension UIAlertController {
1312
func negativeWidthConstraint() {
1413
for subView in self.view.subviews {

Agenda/Extensions/UIKit/UIButton.swift

Lines changed: 0 additions & 22 deletions
This file was deleted.

Agenda/Extensions/UIKit/UIViewController.swift

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,30 @@
88
import UIKit
99

1010
extension UIViewController {
11+
12+
func alertForError(title: String, message: String) {
13+
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
14+
let ok = UIAlertAction(title: "OK", style: .default, handler: nil)
15+
alert.addAction(ok)
16+
17+
present(alert, animated: true, completion: nil)
18+
}
19+
20+
func alertForDeletion(title: String, message: String, completion: @escaping () -> ()) {
21+
let alert = UIAlertController(title: title, message: message, preferredStyle: .actionSheet)
22+
let yes = UIAlertAction(title: Labels.yes, style: .destructive, handler: { _ in
23+
completion()
24+
})
25+
let no = UIAlertAction(title: Labels.cancel, style: .default)
26+
27+
alert.addAction(yes)
28+
alert.addAction(no)
29+
30+
/// for definition try to open declaration of this functions in Extensions/UIKit/UIAlertController.swift
31+
alert.negativeWidthConstraint()
32+
present(alert, animated: true)
33+
}
34+
1135
func hideKeyboardWhenTappedAround() {
1236
let tap = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
1337
tap.cancelsTouchesInView = false
@@ -18,20 +42,4 @@ extension UIViewController {
1842
@objc private func dismissKeyboard() {
1943
view.endEditing(true)
2044
}
21-
22-
func resize(_ cell: GoalTableViewCell, in tableView: UITableView, with textView: UITextView) {
23-
let size = textView.bounds.size
24-
let newSize = tableView.sizeThatFits(CGSize(width: size.width, height: CGFloat.greatestFiniteMagnitude))
25-
26-
if size.height != newSize.height {
27-
UIView.setAnimationsEnabled(false)
28-
tableView.beginUpdates()
29-
tableView.endUpdates()
30-
UIView.setAnimationsEnabled(true)
31-
// Scoll up your textview if required
32-
if let thisIndexPath = tableView.indexPath(for: cell) {
33-
tableView.scrollToRow(at: thisIndexPath, at: .bottom, animated: false)
34-
}
35-
}
36-
}
3745
}

Agenda/Extensions/UserDefaults.swift

Lines changed: 0 additions & 24 deletions
This file was deleted.

Agenda/Models/UserSettings.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//
2+
// UserSettings.swift
3+
// Agenda
4+
//
5+
// Created by Егор Бадмаев on 10.06.2022.
6+
//
7+
8+
fileprivate enum SettingsKey: CodingKey {
9+
case hasOnboarded
10+
case summaries
11+
}
12+
13+
struct UserSettings {
14+
private let storage = UserDefaultsContainer(keyedBy: SettingsKey.self)
15+
16+
var hasOnboarded: Bool? {
17+
get { storage[.hasOnboarded] }
18+
set { storage[.hasOnboarded] = newValue }
19+
}
20+
21+
var summaries: [Int]? {
22+
get { storage[.summaries] }
23+
set { storage[.summaries] = newValue}
24+
}
25+
}

0 commit comments

Comments
 (0)