Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 3 #37

Merged
merged 69 commits into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
35e9f97
update .gitignore
marc-medley Sep 18, 2019
a6494ae
cleanup: removed .DS_Store
marc-medley Sep 18, 2019
7d65aae
Core DailyDozen updated for Swift 5. Dropped UICheckbox (~3yr out-of-…
marc-medley Sep 21, 2019
8ea29ee
Delete .DS_Store
marc-medley Sep 25, 2019
a1b7e90
Delete .DS_Store
marc-medley Sep 25, 2019
1ce4d7f
Delete .DS_Store
marc-medley Sep 26, 2019
7486583
Delete .DS_Store
marc-medley Sep 26, 2019
79cb0fe
Delete .DS_Store
marc-medley Sep 26, 2019
4ecd632
Delete .DS_Store
marc-medley Sep 26, 2019
98d6990
Delete .DS_Store
marc-medley Sep 26, 2019
d643ab9
Delete .DS_Store
marc-medley Sep 26, 2019
6739afd
basic native checkbox button in place. now compiles & runs with Xcode…
marc-medley Sep 26, 2019
47d1847
Merge branch 'version_3' of github.com:nutritionfactsorg/daily-dozen-…
marc-medley Sep 26, 2019
a720e4f
Delete .DS_Store
marc-medley Sep 26, 2019
f805704
v2.1 update.
marc-medley Oct 18, 2019
58e7286
toggled imperial/metric is now saved. solves GH issue #25
marc-medley Oct 22, 2019
4ea1c38
DB schema refactor snapshot. replaces random key with derived non-ran…
marc-medley Nov 20, 2019
8a8916c
DailyTracker passes basic write/read unit test.
marc-medley Nov 21, 2019
48bfa5b
Passes unit test: legacy DB CSV export > CSV import > CSV export > CS…
marc-medley Nov 24, 2019
d8852c0
added code coverage target. set legacy func names for clarity.
marc-medley Nov 26, 2019
1873277
updated Servings image assets.
marc-medley Nov 27, 2019
0594aae
initial integration of new database with UI.
marc-medley Nov 28, 2019
206c077
layout checkpoint
marc-medley Dec 6, 2019
2ff0964
small image assets.
marc-medley Dec 6, 2019
1040114
Test Daily Dozen + 21 Tweets
marc-medley Dec 6, 2019
88ae783
Test version.
marc-medley Dec 7, 2019
53edc33
opt out of dark mode via info.plist
marc-medley Dec 8, 2019
30393f6
weight
marc-medley Dec 8, 2019
0ff0ed2
Weight History Chart baseline.
marc-medley Dec 9, 2019
38497d4
health manager
marc-medley Dec 9, 2019
4669627
test snapshot 3.0.0 (2)
marc-medley Dec 9, 2019
8fa344f
fix app icon filenames
marc-medley Dec 9, 2019
8b8ff92
added assets for 21 Tweaks
marc-medley Dec 10, 2019
a60f99e
weight: database read write
marc-medley Dec 10, 2019
61db7c1
clear weight fields
marc-medley Dec 10, 2019
fee3e0a
realm delete weight entry
marc-medley Dec 10, 2019
f46c8bd
DataWeightRecord timeAmPm datetime
marc-medley Dec 10, 2019
09236df
fix initial picker registration
marc-medley Dec 10, 2019
d26f99c
first launch. weight plot update.
marc-medley Dec 10, 2019
61e8d30
weight plot scale
marc-medley Dec 10, 2019
35d3f3f
weight chart x-axis range
marc-medley Dec 10, 2019
7c84162
weight plot reporting completed for date navigation
marc-medley Dec 11, 2019
8740ef6
healthkit read connection for data from scales.
marc-medley Dec 11, 2019
88c3378
minor comment cleanup
marc-medley Dec 11, 2019
c52d92b
build 4
marc-medley Dec 11, 2019
252205e
21 Tweaks show/hide prelim snapshot.
marc-medley Dec 15, 2019
0ebc633
21 Tweaks show/hide prelim snapshot (checkpoint)
marc-medley Dec 15, 2019
3dce526
21 Tweaks show/hide merge snapshot (checkpoint)
marc-medley Dec 15, 2019
d91522d
21 Tweaks show/hide merge snapshot (checkpoint #2)
marc-medley Dec 15, 2019
486b4df
3.1.0-test-01
marc-medley Dec 15, 2019
f6f5321
set build version v3.1.0 (1)
marc-medley Dec 15, 2019
72ae388
fixes About presentation. Fixes Settings background highlights.
marc-medley Dec 15, 2019
a2723b0
verision 3.1.0 (4)
marc-medley Dec 16, 2019
dff82f8
fix "Sizes" section header "Units:" alignment
marc-medley Dec 16, 2019
66f611b
corrected nav title color. added brand color.
marc-medley Dec 16, 2019
dd4abca
settings color
marc-medley Dec 17, 2019
449c888
tweaks history chart now shows tweaks instead of history.
marc-medley Dec 17, 2019
160f1ca
updated data export.
marc-medley Dec 17, 2019
d04c290
build 3.1.0 (5)
marc-medley Dec 17, 2019
d658d40
(1) fixed lookup of data for weight chart now properly sorted (2) fix…
marc-medley Dec 20, 2019
0c91afc
v3.1.1(1)
marc-medley Dec 20, 2019
af30904
restructured to support international language localization. layout s…
marc-medley Feb 14, 2020
d05e317
README update
marc-medley Feb 14, 2020
4cc4c09
separted UI and associated cose for Tweaks Details and Doze Details
marc-medley Feb 28, 2020
f3881aa
imperial vs. metric toggle header updated layout & application logic.
marc-medley Mar 8, 2020
df7d3d1
language transition checkpoint. normalized Doze & Tweak naming.
marc-medley Mar 17, 2020
9c4f5fa
3.2.0 (1) Spanish beta version
marc-medley Mar 26, 2020
2af566f
build 3.2.0 (3)
marc-medley Apr 8, 2020
c9fa035
v3.2.1 (5) Reworked data sync with HealthKit. Fixed some UI updates. …
marc-medley Jun 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
separted UI and associated cose for Tweaks Details and Doze Details
  • Loading branch information
marc-medley committed Feb 28, 2020
commit 4cc4c0911ff18f6533f36005f95eeac326b5f267
210 changes: 111 additions & 99 deletions DailyDozen/DailyDozen.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

20 changes: 12 additions & 8 deletions DailyDozen/DailyDozen/App/Controllers/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,10 @@ class MainViewController: UIViewController {
.instantiateInitialViewController() as? ServingsPagerViewController
else { fatalError("Did not instantiate `ServingsPagerViewController`") }

tabDailyDozenViewController.title = "Daily Dozen"
let titleDoze = NSLocalizedString("navtab.doze", comment: "Daily Dozen (proper noun) navigation tab")
tabDailyDozenViewController.title = titleDoze
tabDailyDozenViewController.tabBarItem = UITabBarItem.init(
title: "Daily Dozen", // shows below tab bar item icon
title: titleDoze, // shows below tab bar item icon
image: UIImage(named: "ic_tabapp_dailydozen"),
tag: 0
)
Expand All @@ -151,9 +152,10 @@ class MainViewController: UIViewController {
.instantiateInitialViewController() as? TweaksPagerViewController
else { fatalError("Did not instantiate `TweaksPagerViewController`") }

tabTweaksViewController.title = "21 Tweaks"
let titleTweak = NSLocalizedString("navtab.tweaks", comment: "Twenty-One Tweaks (proper noun) navigation tab")
tabTweaksViewController.title = titleTweak
tabTweaksViewController.tabBarItem = UITabBarItem.init(
title: "21 Tweaks",
title: titleTweak,
image: UIImage(named: "ic_tabapp_21tweaks"),
tag: 1
)
Expand All @@ -167,9 +169,10 @@ class MainViewController: UIViewController {
.instantiateInitialViewController() as? MenuTableViewController
else { fatalError("Did not instantiate More `MenuTableViewController`") }

tabInfoViewController.title = "More"
let titleInfo = NSLocalizedString("navtab.info", comment: "More Information navigation tab")
tabInfoViewController.title = titleInfo
tabInfoViewController.tabBarItem = UITabBarItem.init(
title: "More",
title: titleInfo,
image: UIImage(named: "ic_tabapp_more"),
tag: 0
)
Expand All @@ -182,9 +185,10 @@ class MainViewController: UIViewController {
.instantiateInitialViewController() as? SettingsViewController
else { fatalError("Did not instantiate `SettingsViewController`") }

tabSettingsViewController.title = "Settings"
let titleSettings = NSLocalizedString("navtab.preferences", comment: "Preferences (aka Settings, Configuration) navigation tab. Choose word different from 'Tweaks' translation")
tabSettingsViewController.title = titleSettings
tabSettingsViewController.tabBarItem = UITabBarItem.init(
title: "Settings",
title: titleSettings,
image: UIImage(named: "ic_tabapp_settings"),
tag: 0
)
Expand Down
10 changes: 5 additions & 5 deletions DailyDozen/DailyDozen/App/Texts/DozeTextsProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ class DozeTextsProvider {
static let shared: DozeTextsProvider = {
let decoder = JSONDecoder()
guard
let path = Bundle.main.path(forResource: "DozeDetails", ofType: "json"),
let path = Bundle.main.path(forResource: "DozeDetailData", ofType: "json"),
let jsonString = try? String(contentsOfFile: path),
let jsonData = jsonString.data(using: .utf8),
let info = try? decoder.decode(DozeDetailsInfo.self, from: jsonData)
let info = try? decoder.decode(DozeDetailInfo.self, from: jsonData)
else {
fatalError("DozeTextsProvider failed to load 'DozeDetails.json'")
fatalError("DozeTextsProvider failed to load 'DozeDetailData.json'")
}
return DozeTextsProvider(info: info)
}()

private let info: DozeDetailsInfo
private let info: DozeDetailInfo

init(info: DozeDetailsInfo) {
init(info: DozeDetailInfo) {
self.info = info
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,4 @@
"topic" : ""
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
Copyright © 2019 Nutritionfacts.org. All rights reserved.
*/

/* Daily Dozen (proper noun) navigation tab */
"navtab.doze"="Daily Dozen";
/* Twenty-One Tweaks (proper noun) navigation tab */
"navtab.tweaks"="Twenty-One Tweaks";
/* More Information navigation tab */
"navtab.info"="Info";
/* Preferences (aka Settings, Configuration) navigation tab. Choose word different from 'Tweaks' translation */
"navtab.preferences"="Settings";

/* ***** Daily Dozen ***** */
"dozeBeans.heading"="Beans";
"dozeBerries.heading"="Berries";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@

/* Daily Dozen (proper noun) navigation tab */
"navtab.doze"="Docena Diaria";
/* Twenty-One Tweaks (proper noun) navigation tab */
"navtab.tweaks"="Veintiún Ajustes";
/* More Information navigation tab */
"navtab.info"="Información";
/* Preferences (aka Settings, Configuration) navigation tab. Choose word different from 'Tweaks' translation */
"navtab.preferences"="Configuración";

/* display heading. */
"dozeBeans.heading" = "Frijoles";

Expand Down
10 changes: 5 additions & 5 deletions DailyDozen/DailyDozen/App/Texts/TweakTextsProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ class TweakTextsProvider {
static let shared: TweakTextsProvider = {
let decoder = JSONDecoder()
guard
let path = Bundle.main.path(forResource: "TweakDetails", ofType: "json"),
let path = Bundle.main.path(forResource: "TweakDetailData", ofType: "json"),
let jsonString = try? String(contentsOfFile: path),
let jsonData = jsonString.data(using: .utf8),
let info = try? decoder.decode(TweakDetailsInfo.self, from: jsonData)
let info = try? decoder.decode(TweakDetailInfo.self, from: jsonData)
else {
fatalError("TweakTextsProvider failed to load 'TweakDetails.json'")
fatalError("TweakTextsProvider failed to load 'TweakDetailData.json'")
}
return TweakTextsProvider(info: info)
}()

private let info: TweakDetailsInfo
private let info: TweakDetailInfo

init(info: TweakDetailsInfo) {
init(info: TweakDetailInfo) {
self.info = info
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DataCountRecord: Object {

var pidParts: (datestamp: Date, countType: DataCountType)? {
guard let date = Date.init(datestampKey: pidKeys.datestampKey),
let countType = DataCountType(typeKey: pidKeys.typeKey) else {
let countType = DataCountType(itemTypeKey: pidKeys.typeKey) else {
print(":ERROR: DataCountRecord has invalid datestamp or typeKey")
return nil
}
Expand All @@ -52,7 +52,7 @@ class DataCountRecord: Object {

/// CSV Initialer.
convenience init?(datestampKey: String, typeKey: String, count: Int = 0, streak: Int = 0) {
guard let dataCountType = DataCountType(typeKey: typeKey),
guard let dataCountType = DataCountType(itemTypeKey: typeKey),
Date(datestampKey: datestampKey) != nil else {
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ enum DataCountType: String, CaseIterable {
case tweakNightlySleep
case tweakNightlyTrendelenbrug

init?(typeKey: String) {
self = DataCountType(rawValue: String(typeKey))!
init?(itemTypeKey: String) {
self = DataCountType(rawValue: String(itemTypeKey))!
}

var typeKey: String {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// DozeDetailSizeCell.swift
// DailyDozen
//
// Copyright © 2020 Nutritionfacts.org. All rights reserved.
//

import UIKit

class DozeDetailSizeCell: UITableViewCell {

// MARK: - Outlets
@IBOutlet private weak var titleLabel: UILabel!

// MARK: - Methods.
/// Sets the new title text.
///
/// - Parameter title: The new title text.
func configure(title: String) {
titleLabel.text = title
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
//
// TypesCell.swift
// DozeDetailTypeCell.swift
// DailyDozen
//
// Created by Konstantin Khokhlov on 10.11.17.
// Copyright © 2017 Nutritionfacts.org. All rights reserved.
// Copyright © 2019 Nutritionfacts.org. All rights reserved.
//

import UIKit

class TypesCell: UITableViewCell {
class DozeDetailTypeCell: UITableViewCell {

// MARK: - Outlets
@IBOutlet private weak var titleLabel: UILabel!
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
//
// DozeDetailsViewController.swift
// DozeDetailViewController.swift
// DailyDozen
//
// Created by Konstantin Khokhlov on 31.10.17.
// Copyright © 2017 Nutritionfacts.org. All rights reserved.
// Copyright © 2019 Nutritionfacts.org. All rights reserved.
//

import UIKit

// MARK: - Builder
class DozeDetailsBuilder {
class DozeDetailBuilder {

// MARK: - Nested
struct Strings {
static let storyboardDetailsDoze = "DetailsDoze"
static let storyboardDetailsDoze = "DozeDetailLayout"
}

// MARK: - Methods
/// Instantiates and returns the initial view controller for a storyboard.
///
/// - Parameter itemTypeKey: An item type key string.
/// - Returns: The initial view controller in the storyboard.
static func instantiateController(itemTypeKey: String) -> DozeDetailsViewController {
static func instantiateController(itemTypeKey: String) -> DozeDetailViewController {

let storyboard = UIStoryboard(name: Strings.storyboardDetailsDoze, bundle: nil)
guard
let viewController = storyboard
.instantiateInitialViewController() as? DozeDetailsViewController
else { fatalError("Did not instantiate `DozeDetails` controller") }
.instantiateInitialViewController() as? DozeDetailViewController
else { fatalError("Did not instantiate `DozeDetailData` controller") }

viewController.setViewModel(itemTypeKey: itemTypeKey)

Expand All @@ -36,7 +35,7 @@ class DozeDetailsBuilder {
}

// MARK: - Controller
class DozeDetailsViewController: UIViewController {
class DozeDetailViewController: UIViewController {

// MARK: - Nested
private struct Keys {
Expand All @@ -45,7 +44,7 @@ class DozeDetailsViewController: UIViewController {

// MARK: - Outlets
@IBOutlet private weak var tableView: UITableView!
@IBOutlet private weak var dataProvider: DozeDetailsDataProvider!
@IBOutlet private weak var dataProvider: DozeDetailDataProvider!
@IBOutlet private weak var titleLabel: UILabel!
@IBOutlet private weak var detailsImageView: UIImageView!

Expand All @@ -61,7 +60,7 @@ class DozeDetailsViewController: UIViewController {

if let dataCountType = dataProvider.dataCountType {
if dataCountType.typeKey.prefix(4) == "doze" {
// DozeDetailsViewController VIDEOS
// DozeDetailViewController VIDEOS
navigationItem.rightBarButtonItem = UIBarButtonItem(
title: Keys.videos,
style: .done,
Expand All @@ -88,7 +87,7 @@ class DozeDetailsViewController: UIViewController {
///
/// - Parameter item: The current item name.
func setViewModel(itemTypeKey: String) {
dataProvider.dataCountType = DataCountType(typeKey: itemTypeKey)
dataProvider.dataCountType = DataCountType(itemTypeKey: itemTypeKey)
dataProvider.viewModel = DozeTextsProvider.shared.getDetails(itemTypeKey: itemTypeKey)
}

Expand All @@ -105,7 +104,7 @@ class DozeDetailsViewController: UIViewController {
///
/// - Parameter sender: The button.
@IBAction private func unitsChanged(_ sender: UIButton) {
let sectionIndex = DetailsSection.sizes.rawValue
let sectionIndex = DozeDetailSection.amount.rawValue
guard
let unitsTypePrefStr = UserDefaults.standard.string(forKey: SettingsKeys.unitsTypePref),
let currentUnitsType = UnitsType(rawValue: unitsTypePrefStr),
Expand All @@ -130,14 +129,14 @@ class DozeDetailsViewController: UIViewController {
}

// MARK: - UITableViewDelegate
extension DozeDetailsViewController: UITableViewDelegate {
extension DozeDetailViewController: UITableViewDelegate {

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
guard let sectionType = DetailsSection(rawValue: indexPath.section) else {
guard let sectionType = DozeDetailSection(rawValue: indexPath.section) else {
fatalError("There should be a section type")
}

if sectionType == .types &&
if sectionType == .example &&
dataProvider.dataCountType.isTweak {
let x = CGFloat(0.0)
let y = CGFloat(0.0)
Expand Down Expand Up @@ -166,19 +165,19 @@ extension DozeDetailsViewController: UITableViewDelegate {
}

func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
guard let sectionType = DetailsSection(rawValue: section) else {
guard let sectionType = DozeDetailSection(rawValue: section) else {
fatalError("There should be a section type")
}
return sectionType.headerHeight
}

func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
guard let sectionType = DetailsSection(rawValue: section) else {
fatalError("There should be a section type")
guard let sectionType = DozeDetailSection(rawValue: section) else {
fatalError("There should be a doze section type")
}
if let dataCountType = dataProvider.dataCountType {
if dataCountType.typeKey.prefix(5) == "tweak" {
return sectionType.headerTweaksView
return sectionType.headerView
}
}
return sectionType.headerView
Expand Down
Loading