diff --git a/FunnyPuny.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/FunnyPuny.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 2d2da98..f86e8f4 100644 --- a/FunnyPuny.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/FunnyPuny.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -24,7 +24,7 @@ "location" : "https://github.com/firebase/firebase-ios-sdk", "state" : { "branch" : "master", - "revision" : "8a0bb35f019d062d7aefd118cd0d3cf2482ef293" + "revision" : "d6e18b978aab37c810a6e9ce40a756ae02e58562" } }, { @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleAppMeasurement.git", "state" : { - "revision" : "71eb6700dd53a851473c48d392f00a3ab26699a6", - "version" : "10.1.0" + "revision" : "9a09ece724128e8d1e14c5133b87c0e236844ac0", + "version" : "10.4.0" } }, { @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleDataTransport.git", "state" : { - "revision" : "5056b15c5acbb90cd214fe4d6138bdf5a740e5a8", - "version" : "9.2.0" + "revision" : "f6b558e3f801f2cac336b04f615ce111fa9ddaa0", + "version" : "9.2.1" } }, { @@ -50,8 +50,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleUtilities.git", "state" : { - "revision" : "6db6edb48bdd9943426562c7f042a5492de5ba3d", - "version" : "7.10.0" + "revision" : "0543562f85620b5b7c510c6bcbef75b562a5127b", + "version" : "7.11.0" } }, { @@ -68,8 +68,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/gtm-session-fetcher.git", "state" : { - "revision" : "efda500b6d9858d38a76dbfbfa396bd644692e4a", - "version" : "3.0.0" + "revision" : "96d7cc73a71ce950723aa3c50ce4fb275ae180b8", + "version" : "3.1.0" } }, { @@ -132,7 +132,7 @@ "location" : "https://github.com/realm/realm-swift.git", "state" : { "branch" : "master", - "revision" : "b002cf50fbc21b6f52f3b4e74b15edc4007d5cbc" + "revision" : "5d6abe657bfe628e426442aa8143c1ec392706a2" } }, { @@ -167,8 +167,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/kirualex/SwiftyGif.git", "state" : { - "revision" : "db0c122b671bc9760385e0355be00eede3b7bb44", - "version" : "5.4.3" + "revision" : "d6d26061d6553a493781ad3df4a8e275c43fc373", + "version" : "5.4.4" } } ], diff --git a/FunnyPuny/Application/Assets.xcassets/addReminderButton.imageset/Button.pdf b/FunnyPuny/Application/Assets.xcassets/addReminderButton.imageset/Button.pdf new file mode 100644 index 0000000..94aca6c Binary files /dev/null and b/FunnyPuny/Application/Assets.xcassets/addReminderButton.imageset/Button.pdf differ diff --git a/FunnyPuny/Application/Assets.xcassets/addReminderButton.imageset/Contents.json b/FunnyPuny/Application/Assets.xcassets/addReminderButton.imageset/Contents.json new file mode 100644 index 0000000..737fde5 --- /dev/null +++ b/FunnyPuny/Application/Assets.xcassets/addReminderButton.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "Button.pdf", + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "filename" : "Theme=Dark, Size=Small, Property 2=Outline, Status=Active.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/FunnyPuny/Application/Assets.xcassets/addReminderButton.imageset/Theme=Dark, Size=Small, Property 2=Outline, Status=Active.pdf b/FunnyPuny/Application/Assets.xcassets/addReminderButton.imageset/Theme=Dark, Size=Small, Property 2=Outline, Status=Active.pdf new file mode 100644 index 0000000..04a12d1 Binary files /dev/null and b/FunnyPuny/Application/Assets.xcassets/addReminderButton.imageset/Theme=Dark, Size=Small, Property 2=Outline, Status=Active.pdf differ diff --git a/FunnyPuny/Application/en.lproj/Texts.strings b/FunnyPuny/Application/en.lproj/Texts.strings index 9aab9ba..be9c718 100644 --- a/FunnyPuny/Application/en.lproj/Texts.strings +++ b/FunnyPuny/Application/en.lproj/Texts.strings @@ -18,6 +18,9 @@ "addName" = "Please, create habit's name"; "addFrequency" = "Please, choose frequency"; "addAllItems" = "Please, create habit's name and choose frequency"; +"note" = "Note"; +"reminderNote" = "Reminder Note"; +"reminderTime" = "Reminder Time"; "startDate" = "Start date"; // MARK: TabBar diff --git a/FunnyPuny/Application/ru.lproj/Texts.strings b/FunnyPuny/Application/ru.lproj/Texts.strings index 5723820..581fb25 100644 --- a/FunnyPuny/Application/ru.lproj/Texts.strings +++ b/FunnyPuny/Application/ru.lproj/Texts.strings @@ -18,6 +18,9 @@ "addName" = "Пожалуйста, укажите наименование привычки"; "addFrequency" = "Пожалуйста, выберете частоту выполнения привычки"; "addAllItems" = "Пожалуйста, укажите наименование привычки и частоту ее выполнения"; +"note" = "Заметка"; +"reminderNote" = "Введите описание привычки"; +"reminderTime" = "Напоминание"; "startDate" = "Дата начала"; // MARK: TabBar diff --git a/FunnyPuny/BusinessLogic/HabitManager.swift b/FunnyPuny/BusinessLogic/HabitManager.swift index fdfd554..208f4d6 100644 --- a/FunnyPuny/BusinessLogic/HabitManager.swift +++ b/FunnyPuny/BusinessLogic/HabitManager.swift @@ -18,6 +18,7 @@ class HabitManager { var allHabitsName: [String] { habits.map(\.name).sorted(by: <) } + var countCompletedHabits: Int { var totalCount = 0 for day in days { @@ -84,7 +85,7 @@ class HabitManager { return nil } -// MARK: Private properties + // MARK: Private properties private var countHabits: Int { var totalCount = 0 diff --git a/FunnyPuny/Presentation/AddHabit/AddHabitView.swift b/FunnyPuny/Presentation/AddHabit/AddHabitView.swift index 6ef3375..b17fa1c 100644 --- a/FunnyPuny/Presentation/AddHabit/AddHabitView.swift +++ b/FunnyPuny/Presentation/AddHabit/AddHabitView.swift @@ -6,7 +6,10 @@ import UIKit class AddHabitView: UIView { var nameInputView = TextFieldView(text: Texts.name, placeholder: Texts.nameHabit) var frequencyView = FrequencyView() - var datePickerView = DatePickerView(text: Texts.startDate) + var datePickerView = PickerView(text: Texts.startDate, pickerMode: .date) + var timePickerView = PickerView(text: Texts.reminderTime, pickerMode: .time) + + private var reminderInputView = TextFieldView(text: Texts.reminderNote, placeholder: Texts.note) var addButton: UIButton = { let button = UIButton() @@ -38,6 +41,8 @@ class AddHabitView: UIView { private func addSubviews() { addSubview(nameInputView) addSubview(frequencyView) + addSubview(reminderInputView) + addSubview(timePickerView) addSubview(datePickerView) addSubview(addButton) } @@ -54,8 +59,18 @@ class AddHabitView: UIView { make.trailing.equalToSuperview() } - datePickerView.snp.makeConstraints { make in + reminderInputView.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview().inset(16) make.top.equalTo(frequencyView.snp.bottom).offset(24) + } + + timePickerView.snp.makeConstraints { make in + make.top.equalTo(reminderInputView.snp.bottom).offset(24) + make.leading.equalToSuperview().inset(16) + } + + datePickerView.snp.makeConstraints { make in + make.top.equalTo(timePickerView.snp.bottom).offset(24) make.leading.trailing.equalToSuperview().inset(16) } diff --git a/FunnyPuny/Presentation/Common /UIElements/DatePickerView.swift b/FunnyPuny/Presentation/Common /UIElements/DatePickerView.swift index 8690a56..fd33fee 100644 --- a/FunnyPuny/Presentation/Common /UIElements/DatePickerView.swift +++ b/FunnyPuny/Presentation/Common /UIElements/DatePickerView.swift @@ -3,26 +3,29 @@ import UIKit -class DatePickerView: UIView { +class PickerView: UIView { var text: String - var datePicker: UIDatePicker = { + var pickerMode: UIDatePicker.Mode + + lazy var datePicker: UIDatePicker = { let datePicker = UIDatePicker() datePicker.preferredDatePickerStyle = .compact - datePicker.datePickerMode = .date datePicker.tintColor = Colors.backgroundAccent.color + datePicker.datePickerMode = pickerMode return datePicker }() - private var label: UILabel = { - let label = UILabel() - label.text = text - label.textColor = Colors.textPrimary.color - label.font = .bodyMedium - return label - }() + private lazy var label: UILabel = { + let label = UILabel() + label.text = text + label.textColor = Colors.textPrimary.color + label.font = .bodyMedium + return label + }() - required init(text: String) { + required init(text: String, pickerMode: UIDatePicker.Mode) { self.text = text + self.pickerMode = pickerMode super.init(frame: .zero) commonInit() } diff --git a/FunnyPuny/Presentation/Common /UIElements/ScoreView.swift b/FunnyPuny/Presentation/Common /UIElements/ScoreView.swift index 35039d1..bfce4a7 100644 --- a/FunnyPuny/Presentation/Common /UIElements/ScoreView.swift +++ b/FunnyPuny/Presentation/Common /UIElements/ScoreView.swift @@ -7,7 +7,7 @@ class ScoreView: UIView { private var amount: String private var text: String - private var amountHabitsLabel: UILabel = { + private lazy var amountHabitsLabel: UILabel = { let label = UILabel() label.text = amount label.textAlignment = .center @@ -16,7 +16,7 @@ class ScoreView: UIView { return label }() - private var textLabel: UILabel = { + private lazy var textLabel: UILabel = { let label = UILabel() label.text = text label.textAlignment = .center