Skip to content

[WIP] Add profile controller #16

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

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
44 changes: 44 additions & 0 deletions FunnyPuny.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@
CE10453028F759B8006B31D6 /* AddHabitViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE10452F28F759B8006B31D6 /* AddHabitViewController.swift */; };
CE10453228F7696E006B31D6 /* AddHabitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE10453128F7696E006B31D6 /* AddHabitView.swift */; };
CE11DCF7295C4CE700CBE37A /* UIViewController+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE11DCF6295C4CE700CBE37A /* UIViewController+Extension.swift */; };
CE11DCFC296C657400CBE37A /* ProfileCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE11DCFB296C657400CBE37A /* ProfileCell.swift */; };
CE11DCFE296C658200CBE37A /* ProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE11DCFD296C658100CBE37A /* ProfileView.swift */; };
CE11DD00296C658900CBE37A /* ProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE11DCFF296C658900CBE37A /* ProfileViewController.swift */; };
CE11DD02296C68CB00CBE37A /* ProfileCellType.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE11DD01296C68CB00CBE37A /* ProfileCellType.swift */; };
CE11DD04296C6D7700CBE37A /* profile.gif in Resources */ = {isa = PBXBuildFile; fileRef = CE11DD03296C6D7700CBE37A /* profile.gif */; };
CE3429692925482B0037EE0E /* CalendarAnalyticHeaderMonthView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE3429682925482B0037EE0E /* CalendarAnalyticHeaderMonthView.swift */; };
CE351C312911927F00ACCF0C /* AnalyticsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE351C302911927F00ACCF0C /* AnalyticsView.swift */; };
CE351C332911929900ACCF0C /* AnalyticsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE351C322911929900ACCF0C /* AnalyticsViewController.swift */; };
CE351C352911BC7400ACCF0C /* AchivmentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE351C342911BC7400ACCF0C /* AchivmentView.swift */; };
CE351C372911BD8000ACCF0C /* ScoreView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE351C362911BD8000ACCF0C /* ScoreView.swift */; };
CE5D91C0297B0F9600640E85 /* NotificationsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE5D91BF297B0F9600640E85 /* NotificationsViewController.swift */; };
CE6B77BC29184F2F00996142 /* HabitManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE6B77BB29184F2F00996142 /* HabitManager.swift */; };
CE6B77BE2918586200996142 /* Results+Extension .swift in Sources */ = {isa = PBXBuildFile; fileRef = CE6B77BD2918586200996142 /* Results+Extension .swift */; };
CE6B77C0291AD5DE00996142 /* CalendarAnalyticDateCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE6B77BF291AD5DE00996142 /* CalendarAnalyticDateCell.swift */; };
Expand All @@ -42,6 +48,7 @@
CE6D4BB72930D25700647D7D /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = CE6D4BB62930D25700647D7D /* FirebaseCrashlytics */; };
CE6D4BB92930D25700647D7D /* FirebasePerformance in Frameworks */ = {isa = PBXBuildFile; productRef = CE6D4BB82930D25700647D7D /* FirebasePerformance */; };
CE6D4BC32930ED0F00647D7D /* Texts.strings in Resources */ = {isa = PBXBuildFile; fileRef = CE6D4BC52930ED0F00647D7D /* Texts.strings */; };
CE71E1D929707082003AD465 /* ProfileCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE71E1D829707082003AD465 /* ProfileCellViewModel.swift */; };
CE7381CE29265EDE00FCAAAC /* AnalyticsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE7381CD29265EDE00FCAAAC /* AnalyticsViewModel.swift */; };
CE7381D029266D7800FCAAAC /* MenuButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE7381CF29266D7800FCAAAC /* MenuButtonView.swift */; };
CE7808E528FEF8140016AD41 /* HomeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE7808E428FEF8140016AD41 /* HomeCell.swift */; };
Expand Down Expand Up @@ -93,11 +100,17 @@
CE10452F28F759B8006B31D6 /* AddHabitViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddHabitViewController.swift; sourceTree = "<group>"; };
CE10453128F7696E006B31D6 /* AddHabitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddHabitView.swift; sourceTree = "<group>"; };
CE11DCF6295C4CE700CBE37A /* UIViewController+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Extension.swift"; sourceTree = "<group>"; };
CE11DCFB296C657400CBE37A /* ProfileCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProfileCell.swift; sourceTree = "<group>"; };
CE11DCFD296C658100CBE37A /* ProfileView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProfileView.swift; sourceTree = "<group>"; };
CE11DCFF296C658900CBE37A /* ProfileViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = "<group>"; };
CE11DD01296C68CB00CBE37A /* ProfileCellType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileCellType.swift; sourceTree = "<group>"; };
CE11DD03296C6D7700CBE37A /* profile.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = profile.gif; sourceTree = "<group>"; };
CE3429682925482B0037EE0E /* CalendarAnalyticHeaderMonthView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarAnalyticHeaderMonthView.swift; sourceTree = "<group>"; };
CE351C302911927F00ACCF0C /* AnalyticsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsView.swift; sourceTree = "<group>"; };
CE351C322911929900ACCF0C /* AnalyticsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsViewController.swift; sourceTree = "<group>"; };
CE351C342911BC7400ACCF0C /* AchivmentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AchivmentView.swift; sourceTree = "<group>"; };
CE351C362911BD8000ACCF0C /* ScoreView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScoreView.swift; sourceTree = "<group>"; };
CE5D91BF297B0F9600640E85 /* NotificationsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationsViewController.swift; sourceTree = "<group>"; };
CE6B77BB29184F2F00996142 /* HabitManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HabitManager.swift; sourceTree = "<group>"; };
CE6B77BD2918586200996142 /* Results+Extension .swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Results+Extension .swift"; sourceTree = "<group>"; };
CE6B77BF291AD5DE00996142 /* CalendarAnalyticDateCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarAnalyticDateCell.swift; sourceTree = "<group>"; };
Expand All @@ -113,6 +126,7 @@
CE6B77DC29240D1100996142 /* CalendarCellViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarCellViewModel.swift; sourceTree = "<group>"; };
CE6D4BB12930D06800647D7D /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
CE6D4BC42930ED0F00647D7D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Texts.strings; sourceTree = "<group>"; };
CE71E1D829707082003AD465 /* ProfileCellViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileCellViewModel.swift; sourceTree = "<group>"; };
CE7381CD29265EDE00FCAAAC /* AnalyticsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsViewModel.swift; sourceTree = "<group>"; };
CE7381CF29266D7800FCAAAC /* MenuButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuButtonView.swift; sourceTree = "<group>"; };
CE7808E428FEF8140016AD41 /* HomeCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeCell.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -209,6 +223,7 @@
children = (
CEBE1AD029392DA800F52C3F /* chillState.gif */,
CEBE1ACC2938E80C00F52C3F /* emptyState.gif */,
CE11DD03296C6D7700CBE37A /* profile.gif */,
);
path = GIF;
sourceTree = "<group>";
Expand All @@ -232,6 +247,18 @@
path = AddHabit;
sourceTree = "<group>";
};
CE11DCFA296C653500CBE37A /* Profile */ = {
isa = PBXGroup;
children = (
CE11DCFB296C657400CBE37A /* ProfileCell.swift */,
CE11DCFD296C658100CBE37A /* ProfileView.swift */,
CE11DCFF296C658900CBE37A /* ProfileViewController.swift */,
CE11DD01296C68CB00CBE37A /* ProfileCellType.swift */,
CE71E1D829707082003AD465 /* ProfileCellViewModel.swift */,
);
path = Profile;
sourceTree = "<group>";
};
CE34296729241D580037EE0E /* Models */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -262,13 +289,23 @@
path = Fonts;
sourceTree = "<group>";
};
CE5D91C1297B0F9D00640E85 /* Notifications */ = {
isa = PBXGroup;
children = (
CE5D91BF297B0F9600640E85 /* NotificationsViewController.swift */,
);
path = Notifications;
sourceTree = "<group>";
};
CE6AFF2228F6123E0079FD83 /* Presentation */ = {
isa = PBXGroup;
children = (
CE10452A28F70518006B31D6 /* Common */,
CE351C2F2911924200ACCF0C /* Analytics */,
CE10452E28F756CD006B31D6 /* AddHabit */,
CE6AFF2528F6192A0079FD83 /* Home */,
CE5D91C1297B0F9D00640E85 /* Notifications */,
CE11DCFA296C653500CBE37A /* Profile */,
);
path = Presentation;
sourceTree = "<group>";
Expand Down Expand Up @@ -505,6 +542,7 @@
CE6B77D52923C3A300996142 /* SF-Pro-Text-Medium.otf in Resources */,
CEDAFF3C28E7199E006136B3 /* Assets.xcassets in Resources */,
CEB1EA8A2909CB840087ED24 /* SF-Pro-Text-Regular.otf in Resources */,
CE11DD04296C6D7700CBE37A /* profile.gif in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -585,21 +623,27 @@
CE11DCF7295C4CE700CBE37A /* UIViewController+Extension.swift in Sources */,
CE6B77C8291C303C00996142 /* JTACMonthView+Extension.swift in Sources */,
CEB1EA8E290C170A0087ED24 /* Fonts.swift in Sources */,
CE5D91C0297B0F9600640E85 /* NotificationsViewController.swift in Sources */,
CEBE1ACB2938E37C00F52C3F /* HomeStateView.swift in Sources */,
CE944F732901BB940000697A /* CalendarHomeView.swift in Sources */,
CEA71A2428F8A18600D2CE36 /* NavigationController.swift in Sources */,
CE7808E528FEF8140016AD41 /* HomeCell.swift in Sources */,
CE11DCFC296C657400CBE37A /* ProfileCell.swift in Sources */,
CE0C56D02915AC710080ED5C /* UIView+Extension.swift in Sources */,
CE6B77CC29201DD600996142 /* String+Extension.swift in Sources */,
CE6B77D9292406ED00996142 /* Configurable.swift in Sources */,
CEB1EA90290D931A0087ED24 /* TextField.swift in Sources */,
CEADCCCF29354EB600BFD545 /* Constants.swift in Sources */,
CE11DD02296C68CB00CBE37A /* ProfileCellType.swift in Sources */,
CEC51B10292D5B3200DCC848 /* CalendarManager.swift in Sources */,
CE351C312911927F00ACCF0C /* AnalyticsView.swift in Sources */,
CE6B77C0291AD5DE00996142 /* CalendarAnalyticDateCell.swift in Sources */,
CE11DCFE296C658200CBE37A /* ProfileView.swift in Sources */,
CEA0CAF72900753B00EDCDFD /* CalendarHomeHeaderView.swift in Sources */,
CEDAFF3728E7199C006136B3 /* HomeViewController.swift in Sources */,
CE6B77D1292261FA00996142 /* ProgressView.swift in Sources */,
CE71E1D929707082003AD465 /* ProfileCellViewModel.swift in Sources */,
CE11DD00296C658900CBE37A /* ProfileViewController.swift in Sources */,
CEA0BF5528FEBA7A009B6BFD /* DateFormats.swift in Sources */,
CE351C372911BD8000ACCF0C /* ScoreView.swift in Sources */,
CE7808E728FF10CE0016AD41 /* UITableView+Extension.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "Profile.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Binary file not shown.
Binary file added FunnyPuny/Application/GIF/profile.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions FunnyPuny/Application/en.lproj/Texts.strings
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,12 @@
"sat" = "Sat";
"sun" = "Sun";
"everyday" = "Everyday";

//MARK: Profile

"profile" = "Profile";
"notifications" = "Notifications";
"appearance" = "Appearance";
"achievments" = "Achievments";
"donation" = "Donation";
"soon" = "soon";
9 changes: 9 additions & 0 deletions FunnyPuny/Application/ru.lproj/Texts.strings
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,12 @@
"sat" = "Сб";
"sun" = "Вс";
"everyday" = "Каждый день";

//MARK: Profile

"profile" = "Профайл";
"notifications" = "Уведомления";
"appearance" = "Тема";
"achievments" = "Достижения";
"donation" = "Поддержать разработчика";
"soon" = "soon";
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ class TabBarController: UITabBarController {
tag: 1
)

viewControllers = [firstViewController, secondViewController]
let thirdViewController = ProfileViewController()
thirdViewController.tabBarItem = UITabBarItem(
title: Texts.profile,
image: Images.profile.image,
tag: 2
)

viewControllers = [firstViewController, secondViewController, thirdViewController]
selectedIndex = 0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// NotificationsViewController.swift
// FunnyPuny. Created by Zlata Guseva.

import UIKit

class NotificationsViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
}
92 changes: 92 additions & 0 deletions FunnyPuny/Presentation/Profile/ProfileCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// ProfileCell.swift
// FunnyPuny. Created by Zlata Guseva.

import SwiftDate
import UIKit

// MARK: - ProfileCell

class ProfileCell: UITableViewCell {
private var iconImageView: UIImageView = {
let imageView = UIImageView()
imageView.layer.cornerRadius = 16
imageView.image = Images.right.image
imageView.tintColor = Colors.iconsOther.color
imageView.backgroundColor = Colors.backgroundGlobe.color
return imageView
}()

private var label: UILabel = {
let label = UILabel()
label.font = .bodyRegular
label.textColor = Colors.textPrimary.color
return label
}()

private var availabilityLabel: UILabel = {
let label = UILabel()
label.text = Texts.soon
label.font = .bodyRegular
label.textColor = Colors.iconsOther.color
label.backgroundColor = Colors.backgroundGlobe.color
return label
}()

override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
commonInit()
}

@available(*, unavailable)
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

private func commonInit() {
addSubviews()
makeConstraints()
setupStyle()
}

private func setupStyle() {
backgroundColor = Colors.backgroundGlobe.color
selectionStyle = .none
}

private func addSubviews() {
contentView.addSubview(iconImageView)
contentView.addSubview(label)
contentView.addSubview(availabilityLabel)
}

private func makeConstraints() {
contentView.snp.makeConstraints { make in
make.top.bottom.equalToSuperview().inset(8)
make.trailing.leading.equalToSuperview().inset(16)
}

label.snp.makeConstraints { make in
make.leading.equalToSuperview().inset(16)
make.top.bottom.equalToSuperview()
make.trailing.equalToSuperview().inset(48)
}

iconImageView.snp.makeConstraints { make in
make.trailing.equalToSuperview().inset(8)
make.centerY.equalToSuperview()
make.width.height.equalTo(24)
}

availabilityLabel.snp.makeConstraints { make in
make.trailing.equalToSuperview().inset(8)
make.centerY.equalToSuperview()
}
}
}

extension ProfileCell: Configurable {
func configure(with viewModel: ProfileCellViewModel) {
label.text = viewModel.itemName
availabilityLabel.isHidden = viewModel.isAvailable
}
}
25 changes: 25 additions & 0 deletions FunnyPuny/Presentation/Profile/ProfileCellType.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ProfileCellType.swift
// FunnyPuny. Created by Zlata Guseva.

enum ProfileCellType: CaseIterable {
case notifications
case appearance
case achievments
case donation

var name: String {
switch self {
case .notifications: return Texts.notifications
case .appearance: return Texts.appearance
case .achievments: return Texts.achievments
case .donation: return Texts.donation
}
}

var isAvailable: Bool {
switch self {
case .notifications: return true
default: return false
}
}
}
9 changes: 9 additions & 0 deletions FunnyPuny/Presentation/Profile/ProfileCellViewModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// ProfileCellViewModel.swift
// FunnyPuny. Created by Zlata Guseva.

import Foundation

struct ProfileCellViewModel {
var itemName: String
var isAvailable: Bool
}
60 changes: 60 additions & 0 deletions FunnyPuny/Presentation/Profile/ProfileView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// ProfileView.swift
// FunnyPuny. Created by Zlata Guseva.

import SwiftyGif
import UIKit

class ProfileView: UIView {
private var gifImageView: UIImageView = .profileGIF

var tableView: UITableView = {
let tableView = UITableView()
tableView.backgroundColor = Colors.backgroundGlobe.color
tableView.register(cellWithClass: ProfileCell.self)
tableView.rowHeight = 64
tableView.separatorStyle = .singleLine
tableView.layer.cornerRadius = 16
tableView.layer.borderColor = Colors.backgroundIsland.color.cgColor
tableView.layer.borderWidth = 2
return tableView
}()

override init(frame: CGRect) {
super.init(frame: frame)
commonInit()
}

@available(*, unavailable)
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

private func commonInit() {
setupStyle()
addSubviews()
makeConstraints()
}

private func setupStyle() {
backgroundColor = Colors.backgroundGlobe.color
}

private func addSubviews() {
addSubview(gifImageView)
addSubview(tableView)
}

private func makeConstraints() {
gifImageView.snp.makeConstraints { make in
make.width.height.equalTo(100)
make.centerX.equalToSuperview()
make.top.equalTo(safeAreaLayoutGuide.snp.top)
}

tableView.snp.makeConstraints { make in
make.top.equalTo(gifImageView.snp.bottom).offset(44)
make.leading.trailing.equalToSuperview().inset(16)
make.height.equalTo(256)
}
}
}
Loading