git.iko.soy/dashared/GDproject
on master help sign in
Trying to embed coordinators in project. Broke log in a little bit. Can be a lot of issues now.
commit9e6ff4894be62e27d20b07d07d47a3dc4c5b76dd authorDarya Rednikina <rednikina.com@yandex.ru> dateTue 19 Mar 2019, 21:50 (8 years ago) parent25c84f2
19 files changed+553−433
Cartfile+1 GDproject.xcodeproj/project.pbxproj+63−20 GDproject/Base.lproj/Main.storyboard+4−72 GDproject/Constants.swift+4 GDproject/Controller/ News and channels/ChannelsCoordinator.swift−55 GDproject/Controller/Coordinators/ApplicationCoordinator.swift+69 GDproject/Controller/Coordinators/BaseCoordinator.swift+47 GDproject/Controller/Coordinators/ChannelsCoordinator.swift+28 GDproject/Controller/Coordinators/LogInCoordinator.swift+41 GDproject/Controller/Coordinators/ProfileCoordinator.swift+52 GDproject/Controller/Coordinators/TabbarController.swift+45 GDproject/Controller/Coordinators/TabbarCoordinator.swift+57 GDproject/Controller/Log In/LogInCoordinator.swift−48 GDproject/Controller/Log In/LogInCoordinator1.swift+48 GDproject/Controller/Log In/LogInViewController.swift+71−94 GDproject/Controller/Profile/ProfileViewController.swift+14−32 GDproject/Controller/RepeatingTimer.swift−59 GDproject/DataStorage.swift+1−9 GDproject/Supporting files/AppDelegate.swift+8−44
Cartfile+1
@@ -5,3 +5,4 @@ github "macteo/Marklight"
55github "ElaWorkshop/TagListView"
66github "Alamofire/Alamofire" "5.0.0-beta.2"
77github "whitesmith/WSTagsField"
8+github "ReactiveCocoa/ReactiveCocoa" ~> 8.0
GDproject.xcodeproj/project.pbxproj+63−20
@@ -15,14 +15,16 @@
1515 124CC7032221C00C009DF531 /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = 124CC7022221C00C009DF531 /* Model.swift */; };
1616 124CC7052221C2BB009DF531 /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 124CC7042221C2BA009DF531 /* Alamofire.framework */; };
1717 124CC7072221C2C3009DF531 /* Alamofire.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 124CC7042221C2BA009DF531 /* Alamofire.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
18− 1253867D2223DC9F00CC5EA7 /* RepeatingTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1253867C2223DC9F00CC5EA7 /* RepeatingTimer.swift */; };
1918 125BD57D22171D2A008A3575 /* ProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD57C22171D2A008A3575 /* ProfileViewController.swift */; };
2019 125BD57F22171D73008A3575 /* Extentions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD57E22171D73008A3575 /* Extentions.swift */; };
2120 125BD5812217314A008A3575 /* NewsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD5802217314A008A3575 /* NewsVC.swift */; };
2221 1288B5CE221F1158002BE6B1 /* DataStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1288B5CD221F1158002BE6B1 /* DataStorage.swift */; };
2322 1291BE2D2221312D009D3F23 /* ChannelsCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1291BE2C2221312C009D3F23 /* ChannelsCoordinator.swift */; };
2423 1291BE342221569B009D3F23 /* TabbarCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1291BE332221569B009D3F23 /* TabbarCoordinator.swift */; };
25− 1291BE3622218DBF009D3F23 /* LogInCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1291BE3522218DBF009D3F23 /* LogInCoordinator.swift */; };
24+ 1291BE3622218DBF009D3F23 /* LogInCoordinator1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1291BE3522218DBF009D3F23 /* LogInCoordinator1.swift */; };
25+ 12BA4B9B224101A400DF93D7 /* ApplicationCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12BA4B9A224101A400DF93D7 /* ApplicationCoordinator.swift */; };
26+ 12BA4B9D224101E700DF93D7 /* BaseCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12BA4B9C224101E700DF93D7 /* BaseCoordinator.swift */; };
27+ 12BA4B9F224102B700DF93D7 /* LogInCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12BA4B9E224102B700DF93D7 /* LogInCoordinator.swift */; };
2628 12D7D133221C321600B35452 /* ChannelListController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D7D132221C321600B35452 /* ChannelListController.swift */; };
2729 12D7D135221C42B700B35452 /* ChannelController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D7D134221C42B700B35452 /* ChannelController.swift */; };
2830 12D7D137221D78E800B35452 /* Channel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D7D136221D78E800B35452 /* Channel.swift */; };
@@ -50,9 +52,17 @@
5052 12E36DCE22144756006FCDD7 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E36DCD22144756006FCDD7 /* Constants.swift */; };
5153 12E36DD122148122006FCDD7 /* FullPostController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E36DD022148122006FCDD7 /* FullPostController.swift */; };
5254 12E36DD522156559006FCDD7 /* MyStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E36DD422156559006FCDD7 /* MyStackView.swift */; };
53− 12E36DD8221594A9006FCDD7 /* TagListView.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 12E36DD622159493006FCDD7 /* TagListView.framework */; };
54− 12E36DD9221594A9006FCDD7 /* TagListView.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 12E36DD622159493006FCDD7 /* TagListView.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
5555 12E36DDB221594B1006FCDD7 /* MarkdownKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 12E36DB022143D47006FCDD7 /* MarkdownKit.framework */; };
56+ 12F3D6B0224106F700A69214 /* TabbarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12F3D6AF224106F700A69214 /* TabbarController.swift */; };
57+ 12F3D6B22241097B00A69214 /* ProfileCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12F3D6B12241097B00A69214 /* ProfileCoordinator.swift */; };
58+ 12F3D6B4224112D600A69214 /* ReactiveMapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6B3224112D600A69214 /* ReactiveMapKit.framework */; };
59+ 12F3D6B6224112E100A69214 /* ReactiveSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6B5224112E000A69214 /* ReactiveSwift.framework */; };
60+ 12F3D6B8224112E900A69214 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6B7224112E800A69214 /* Result.framework */; };
61+ 12F3D6BB224112FD00A69214 /* ReactiveCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6B9224112F500A69214 /* ReactiveCocoa.framework */; };
62+ 12F3D6BC224112FD00A69214 /* ReactiveCocoa.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6B9224112F500A69214 /* ReactiveCocoa.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
63+ 12F3D6BE2241130000A69214 /* Result.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6B7224112E800A69214 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
64+ 12F3D6C02241130200A69214 /* ReactiveSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6B5224112E000A69214 /* ReactiveSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
65+ 12F3D6C22241130400A69214 /* ReactiveMapKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6B3224112D600A69214 /* ReactiveMapKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
5666/* End PBXBuildFile section */
5767
5868/* Begin PBXCopyFilesBuildPhase section */
@@ -63,10 +73,13 @@
6373 dstSubfolderSpec = 10;
6474 files = (
6575 12E36DC0221441DB006FCDD7 /* Marklight.framework in Embed Frameworks */,
76+ 12F3D6C22241130400A69214 /* ReactiveMapKit.framework in Embed Frameworks */,
6677 124CC7072221C2C3009DF531 /* Alamofire.framework in Embed Frameworks */,
6778 12E36DC4221441EA006FCDD7 /* Cartography.framework in Embed Frameworks */,
68− 12E36DD9221594A9006FCDD7 /* TagListView.framework in Embed Frameworks */,
79+ 12F3D6BE2241130000A69214 /* Result.framework in Embed Frameworks */,
6980 12E36DBD221441D5006FCDD7 /* TinyConstraints.framework in Embed Frameworks */,
81+ 12F3D6C02241130200A69214 /* ReactiveSwift.framework in Embed Frameworks */,
82+ 12F3D6BC224112FD00A69214 /* ReactiveCocoa.framework in Embed Frameworks */,
7083 123AD0E5223C1C4300326173 /* WSTagsField.framework in Embed Frameworks */,
7184 12E36DC2221441E1006FCDD7 /* MarkdownKit.framework in Embed Frameworks */,
7285 );
@@ -82,14 +95,16 @@
8295 123E37A6221F1DD700F6E42A /* MainController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainController.swift; sourceTree = "<group>"; };
8396 124CC7022221C00C009DF531 /* Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Model.swift; sourceTree = "<group>"; };
8497 124CC7042221C2BA009DF531 /* Alamofire.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Alamofire.framework; path = Carthage/Build/iOS/Alamofire.framework; sourceTree = "<group>"; };
85− 1253867C2223DC9F00CC5EA7 /* RepeatingTimer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RepeatingTimer.swift; sourceTree = "<group>"; };
8698 125BD57C22171D2A008A3575 /* ProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = "<group>"; };
8799 125BD57E22171D73008A3575 /* Extentions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extentions.swift; sourceTree = "<group>"; };
88100 125BD5802217314A008A3575 /* NewsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsVC.swift; sourceTree = "<group>"; };
89101 1288B5CD221F1158002BE6B1 /* DataStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataStorage.swift; sourceTree = "<group>"; };
90102 1291BE2C2221312C009D3F23 /* ChannelsCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelsCoordinator.swift; sourceTree = "<group>"; };
91103 1291BE332221569B009D3F23 /* TabbarCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabbarCoordinator.swift; sourceTree = "<group>"; };
92− 1291BE3522218DBF009D3F23 /* LogInCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogInCoordinator.swift; sourceTree = "<group>"; };
104+ 1291BE3522218DBF009D3F23 /* LogInCoordinator1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogInCoordinator1.swift; sourceTree = "<group>"; };
105+ 12BA4B9A224101A400DF93D7 /* ApplicationCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplicationCoordinator.swift; sourceTree = "<group>"; };
106+ 12BA4B9C224101E700DF93D7 /* BaseCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseCoordinator.swift; sourceTree = "<group>"; };
107+ 12BA4B9E224102B700DF93D7 /* LogInCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogInCoordinator.swift; sourceTree = "<group>"; };
93108 12D7D132221C321600B35452 /* ChannelListController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelListController.swift; sourceTree = "<group>"; };
94109 12D7D134221C42B700B35452 /* ChannelController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelController.swift; sourceTree = "<group>"; };
95110 12D7D136221D78E800B35452 /* Channel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Channel.swift; sourceTree = "<group>"; };
@@ -116,7 +131,12 @@
116131 12E36DCD22144756006FCDD7 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
117132 12E36DD022148122006FCDD7 /* FullPostController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FullPostController.swift; sourceTree = "<group>"; };
118133 12E36DD422156559006FCDD7 /* MyStackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyStackView.swift; sourceTree = "<group>"; };
119− 12E36DD622159493006FCDD7 /* TagListView.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TagListView.framework; path = Carthage/Build/iOS/TagListView.framework; sourceTree = "<group>"; };
134+ 12F3D6AF224106F700A69214 /* TabbarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabbarController.swift; sourceTree = "<group>"; };
135+ 12F3D6B12241097B00A69214 /* ProfileCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileCoordinator.swift; sourceTree = "<group>"; };
136+ 12F3D6B3224112D600A69214 /* ReactiveMapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReactiveMapKit.framework; path = Carthage/Build/iOS/ReactiveMapKit.framework; sourceTree = "<group>"; };
137+ 12F3D6B5224112E000A69214 /* ReactiveSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReactiveSwift.framework; path = Carthage/Build/iOS/ReactiveSwift.framework; sourceTree = "<group>"; };
138+ 12F3D6B7224112E800A69214 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = Carthage/Build/iOS/Result.framework; sourceTree = "<group>"; };
139+ 12F3D6B9224112F500A69214 /* ReactiveCocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReactiveCocoa.framework; path = Carthage/Build/iOS/ReactiveCocoa.framework; sourceTree = "<group>"; };
120140/* End PBXFileReference section */
121141
122142/* Begin PBXFrameworksBuildPhase section */
@@ -125,9 +145,12 @@
125145 buildActionMask = 2147483647;
126146 files = (
127147 12E36DB522143D54006FCDD7 /* TinyConstraints.framework in Frameworks */,
148+ 12F3D6B4224112D600A69214 /* ReactiveMapKit.framework in Frameworks */,
128149 124CC7052221C2BB009DF531 /* Alamofire.framework in Frameworks */,
150+ 12F3D6BB224112FD00A69214 /* ReactiveCocoa.framework in Frameworks */,
151+ 12F3D6B8224112E900A69214 /* Result.framework in Frameworks */,
152+ 12F3D6B6224112E100A69214 /* ReactiveSwift.framework in Frameworks */,
129153 12E36DDB221594B1006FCDD7 /* MarkdownKit.framework in Frameworks */,
130− 12E36DD8221594A9006FCDD7 /* TagListView.framework in Frameworks */,
131154 12E36DAF22143D40006FCDD7 /* Cartography.framework in Frameworks */,
132155 123AD0E3223C1C3900326173 /* WSTagsField.framework in Frameworks */,
133156 12E36DB322143D4E006FCDD7 /* Marklight.framework in Frameworks */,
@@ -150,19 +173,25 @@
150173 path = Profile;
151174 sourceTree = "<group>";
152175 };
153− 1291BE32222154C3009D3F23 /* Coordinator tab bar? */ = {
176+ 1291BE32222154C3009D3F23 /* Coordinators */ = {
154177 isa = PBXGroup;
155178 children = (
179+ 12BA4B9A224101A400DF93D7 /* ApplicationCoordinator.swift */,
180+ 12F3D6AF224106F700A69214 /* TabbarController.swift */,
181+ 12F3D6B12241097B00A69214 /* ProfileCoordinator.swift */,
182+ 12BA4B9E224102B700DF93D7 /* LogInCoordinator.swift */,
183+ 12BA4B9C224101E700DF93D7 /* BaseCoordinator.swift */,
184+ 1291BE2C2221312C009D3F23 /* ChannelsCoordinator.swift */,
156185 1291BE332221569B009D3F23 /* TabbarCoordinator.swift */,
157186 );
158− path = "Coordinator tab bar?";
187+ path = Coordinators;
159188 sourceTree = "<group>";
160189 };
161190 1291BE3722218DC4009D3F23 /* Log In */ = {
162191 isa = PBXGroup;
163192 children = (
164193 123E37A4221F1B3200F6E42A /* LogInViewController.swift */,
165− 1291BE3522218DBF009D3F23 /* LogInCoordinator.swift */,
194+ 1291BE3522218DBF009D3F23 /* LogInCoordinator1.swift */,
166195 );
167196 path = "Log In";
168197 sourceTree = "<group>";
@@ -170,9 +199,12 @@
170199 12E36D8F221424EA006FCDD7 = {
171200 isa = PBXGroup;
172201 children = (
202+ 12F3D6B9224112F500A69214 /* ReactiveCocoa.framework */,
203+ 12F3D6B7224112E800A69214 /* Result.framework */,
204+ 12F3D6B5224112E000A69214 /* ReactiveSwift.framework */,
205+ 12F3D6B3224112D600A69214 /* ReactiveMapKit.framework */,
173206 123AD0E2223C1C3900326173 /* WSTagsField.framework */,
174207 124CC7042221C2BA009DF531 /* Alamofire.framework */,
175− 12E36DD622159493006FCDD7 /* TagListView.framework */,
176208 12E36DB422143D54006FCDD7 /* TinyConstraints.framework */,
177209 12E36DB222143D4E006FCDD7 /* Marklight.framework */,
178210 12E36DB022143D47006FCDD7 /* MarkdownKit.framework */,
@@ -232,8 +264,7 @@
232264 12E36DCF22145923006FCDD7 /* Controller */ = {
233265 isa = PBXGroup;
234266 children = (
235− 1253867C2223DC9F00CC5EA7 /* RepeatingTimer.swift */,
236− 1291BE32222154C3009D3F23 /* Coordinator tab bar? */,
267+ 1291BE32222154C3009D3F23 /* Coordinators */,
237268 1291BE3722218DC4009D3F23 /* Log In */,
238269 1288B5CC221F0EFE002BE6B1 /* Profile */,
239270 12E36DD322156519006FCDD7 /* News and channels */,
@@ -250,7 +281,6 @@
250281 12E36DC922144635006FCDD7 /* NewPostViewController.swift */,
251282 12E36DD022148122006FCDD7 /* FullPostController.swift */,
252283 12E36D9D221424EA006FCDD7 /* NewsController.swift */,
253− 1291BE2C2221312C009D3F23 /* ChannelsCoordinator.swift */,
254284 125BD5802217314A008A3575 /* NewsVC.swift */,
255285 12E36DCB22144725006FCDD7 /* PostViewCell.swift */,
256286 );
@@ -297,6 +327,11 @@
297327 TargetAttributes = {
298328 12E36D97221424EA006FCDD7 = {
299329 CreatedOnToolsVersion = 10.1;
330+ SystemCapabilities = {
331+ com.apple.Keychain = {
332+ enabled = 0;
333+ };
334+ };
300335 };
301336 };
302337 };
@@ -337,9 +372,10 @@
337372 buildActionMask = 2147483647;
338373 files = (
339374 124CC7032221C00C009DF531 /* Model.swift in Sources */,
375+ 12F3D6B0224106F700A69214 /* TabbarController.swift in Sources */,
340376 12E36DD522156559006FCDD7 /* MyStackView.swift in Sources */,
341377 12D7D137221D78E800B35452 /* Channel.swift in Sources */,
342− 1291BE3622218DBF009D3F23 /* LogInCoordinator.swift in Sources */,
378+ 1291BE3622218DBF009D3F23 /* LogInCoordinator1.swift in Sources */,
343379 12E36DB922144016006FCDD7 /* User.swift in Sources */,
344380 1210A0BB223940310080686D /* SimplifiedChannelsList.swift in Sources */,
345381 125BD5812217314A008A3575 /* NewsVC.swift in Sources */,
@@ -352,15 +388,18 @@
352388 125BD57F22171D73008A3575 /* Extentions.swift in Sources */,
353389 12D7D133221C321600B35452 /* ChannelListController.swift in Sources */,
354390 1291BE342221569B009D3F23 /* TabbarCoordinator.swift in Sources */,
391+ 12BA4B9B224101A400DF93D7 /* ApplicationCoordinator.swift in Sources */,
355392 1291BE2D2221312D009D3F23 /* ChannelsCoordinator.swift in Sources */,
356393 12E36DD122148122006FCDD7 /* FullPostController.swift in Sources */,
357394 1288B5CE221F1158002BE6B1 /* DataStorage.swift in Sources */,
395+ 12BA4B9F224102B700DF93D7 /* LogInCoordinator.swift in Sources */,
396+ 12F3D6B22241097B00A69214 /* ProfileCoordinator.swift in Sources */,
358397 125BD57D22171D2A008A3575 /* ProfileViewController.swift in Sources */,
359− 1253867D2223DC9F00CC5EA7 /* RepeatingTimer.swift in Sources */,
360398 12DB7FDB2218590C0096878E /* InfoCell.swift in Sources */,
361399 12DB7FD922181E660096878E /* BasicInfoCell.swift in Sources */,
362400 12D7D135221C42B700B35452 /* ChannelController.swift in Sources */,
363401 12E36D9C221424EA006FCDD7 /* AppDelegate.swift in Sources */,
402+ 12BA4B9D224101E700DF93D7 /* BaseCoordinator.swift in Sources */,
364403 12DB7FD722181CD20096878E /* BasicInfoController.swift in Sources */,
365404 12E36DCE22144756006FCDD7 /* Constants.swift in Sources */,
366405 12DB7FDD221872F80096878E /* SettingsViewController.swift in Sources */,
@@ -510,6 +549,7 @@
510549 isa = XCBuildConfiguration;
511550 buildSettings = {
512551 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
552+ CODE_SIGN_IDENTITY = "iPhone Developer";
513553 CODE_SIGN_STYLE = Automatic;
514554 DEVELOPMENT_TEAM = 9Z6LFGKA9G;
515555 FRAMEWORK_SEARCH_PATHS = (
@@ -521,8 +561,9 @@
521561 "$(inherited)",
522562 "@executable_path/Frameworks",
523563 );
524− PRODUCT_BUNDLE_IDENTIFIER = rednikina.com.drHSE.GDproject;
564+ PRODUCT_BUNDLE_IDENTIFIER = rednikina.com.drHSE.GDproject.sos;
525565 PRODUCT_NAME = "$(TARGET_NAME)";
566+ PROVISIONING_PROFILE_SPECIFIER = "";
526567 SWIFT_VERSION = 4.2;
527568 TARGETED_DEVICE_FAMILY = "1,2";
528569 };
@@ -532,6 +573,7 @@
532573 isa = XCBuildConfiguration;
533574 buildSettings = {
534575 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
576+ CODE_SIGN_IDENTITY = "iPhone Developer";
535577 CODE_SIGN_STYLE = Automatic;
536578 DEVELOPMENT_TEAM = 9Z6LFGKA9G;
537579 FRAMEWORK_SEARCH_PATHS = (
@@ -543,8 +585,9 @@
543585 "$(inherited)",
544586 "@executable_path/Frameworks",
545587 );
546− PRODUCT_BUNDLE_IDENTIFIER = rednikina.com.drHSE.GDproject;
588+ PRODUCT_BUNDLE_IDENTIFIER = rednikina.com.drHSE.GDproject.sos;
547589 PRODUCT_NAME = "$(TARGET_NAME)";
590+ PROVISIONING_PROFILE_SPECIFIER = "";
548591 SWIFT_VERSION = 4.2;
549592 TARGETED_DEVICE_FAMILY = "1,2";
550593 };
GDproject/Base.lproj/Main.storyboard+4−72
@@ -1,5 +1,5 @@
11<?xml version="1.0" encoding="UTF-8"?>
2−<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="609-2j-gc9">
2+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
33 <device id="retina4_7" orientation="portrait">
44 <adaptation id="fullscreen"/>
55 </device>
@@ -20,7 +20,7 @@
2020 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2121 <subviews>
2222 <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="cay-ea-rTl">
23− <rect key="frame" x="0.0" y="116" width="375" height="502"/>
23+ <rect key="frame" x="0.0" y="20" width="375" height="647"/>
2424 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
2525 <view key="tableHeaderView" contentMode="scaleToFill" id="kFZ-3c-OFY">
2626 <rect key="frame" x="0.0" y="0.0" width="375" height="199"/>
@@ -416,55 +416,6 @@
416416 </objects>
417417 <point key="canvasLocation" x="3444" y="129.98500749625188"/>
418418 </scene>
419− <!--Log In View Controller-->
420− <scene sceneID="Pkd-pB-bQs">
421− <objects>
422− <viewController storyboardIdentifier="LogInController" id="ZCz-70-hDh" customClass="LogInViewController" customModule="GDproject" customModuleProvider="target" sceneMemberID="viewController">
423− <view key="view" contentMode="scaleToFill" id="1q2-4g-KZs">
424− <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
425− <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
426− <subviews>
427− <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="UwC-m5-jA5">
428− <rect key="frame" x="16" y="100" width="343" height="83"/>
429− <subviews>
430− <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Log In" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="efn-ze-jca">
431− <rect key="frame" x="0.0" y="0.0" width="343" height="41"/>
432− <fontDescription key="fontDescription" type="boldSystem" pointSize="34"/>
433− <nil key="textColor"/>
434− <nil key="highlightedColor"/>
435− </label>
436− <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Mail" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="mFP-WG-jY5">
437− <rect key="frame" x="0.0" y="53" width="343" height="30"/>
438− <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
439− <nil key="textColor"/>
440− <fontDescription key="fontDescription" type="system" pointSize="14"/>
441− <textInputTraits key="textInputTraits"/>
442− </textField>
443− </subviews>
444− </stackView>
445− <activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="K3b-gv-JPp">
446− <rect key="frame" x="177.5" y="333.5" width="20" height="20"/>
447− </activityIndicatorView>
448− </subviews>
449− <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
450− <constraints>
451− <constraint firstItem="UwC-m5-jA5" firstAttribute="leading" secondItem="LOR-Yw-0FU" secondAttribute="leading" constant="16" id="M6z-nU-H40"/>
452− <constraint firstItem="K3b-gv-JPp" firstAttribute="centerY" secondItem="LOR-Yw-0FU" secondAttribute="centerY" id="eOp-yQ-n28"/>
453− <constraint firstItem="K3b-gv-JPp" firstAttribute="centerX" secondItem="LOR-Yw-0FU" secondAttribute="centerX" id="gdW-VU-pE8"/>
454− <constraint firstItem="LOR-Yw-0FU" firstAttribute="trailing" secondItem="UwC-m5-jA5" secondAttribute="trailing" constant="16" id="jST-rr-MMX"/>
455− <constraint firstItem="UwC-m5-jA5" firstAttribute="top" secondItem="LOR-Yw-0FU" secondAttribute="top" constant="80" id="rvy-Ii-bwS"/>
456− </constraints>
457− <viewLayoutGuide key="safeArea" id="LOR-Yw-0FU"/>
458− </view>
459− <connections>
460− <outlet property="indicatorView" destination="K3b-gv-JPp" id="mSR-QU-VZQ"/>
461− <outlet property="mailTextField" destination="mFP-WG-jY5" id="7SN-qe-DDm"/>
462− </connections>
463− </viewController>
464− <placeholder placeholderIdentifier="IBFirstResponder" id="6e8-oo-bbc" userLabel="First Responder" sceneMemberID="firstResponder"/>
465− </objects>
466− <point key="canvasLocation" x="-466" y="-821"/>
467− </scene>
468419 <!--Posts-->
469420 <scene sceneID="RSd-UJ-34B">
470421 <objects>
@@ -476,9 +427,6 @@
476427 <autoresizingMask key="autoresizingMask"/>
477428 </navigationBar>
478429 <nil name="viewControllers"/>
479− <connections>
480− <segue destination="Nqc-TI-ueQ" kind="relationship" relationship="rootViewController" id="2BZ-i4-uIE"/>
481− </connections>
482430 </navigationController>
483431 <placeholder placeholderIdentifier="IBFirstResponder" id="POV-5T-jeQ" userLabel="First Responder" sceneMemberID="firstResponder"/>
484432 </objects>
@@ -515,31 +463,15 @@
515463 <autoresizingMask key="autoresizingMask"/>
516464 </navigationBar>
517465 <nil name="viewControllers"/>
518− <connections>
519− <segue destination="R4D-Ao-uvG" kind="relationship" relationship="rootViewController" id="aF6-zK-hCB"/>
520− </connections>
521466 </navigationController>
522467 <placeholder placeholderIdentifier="IBFirstResponder" id="Fvm-qf-2Ve" userLabel="First Responder" sceneMemberID="firstResponder"/>
523468 </objects>
524469 <point key="canvasLocation" x="1089" y="958"/>
525470 </scene>
526− <!--Navigation Controller-->
527− <scene sceneID="r0M-xH-UwU">
528− <objects>
529− <navigationController storyboardIdentifier="root" id="609-2j-gc9" sceneMemberID="viewController">
530− <navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="Ah8-NU-AsD">
531− <rect key="frame" x="0.0" y="20" width="375" height="44"/>
532− <autoresizingMask key="autoresizingMask"/>
533− </navigationBar>
534− </navigationController>
535− <placeholder placeholderIdentifier="IBFirstResponder" id="Raj-78-jlT" userLabel="First Responder" sceneMemberID="firstResponder"/>
536− </objects>
537− <point key="canvasLocation" x="-2242" y="68"/>
538− </scene>
539− <!--Tab Bar Controller-->
471+ <!--Tabbar Controller-->
540472 <scene sceneID="HCR-WO-p7g">
541473 <objects>
542− <tabBarController storyboardIdentifier="TabBar" automaticallyAdjustsScrollViewInsets="NO" id="IeP-4W-8LT" sceneMemberID="viewController">
474+ <tabBarController storyboardIdentifier="TabbarController" automaticallyAdjustsScrollViewInsets="NO" id="IeP-4W-8LT" customClass="TabbarController" customModule="GDproject" customModuleProvider="target" sceneMemberID="viewController">
543475 <toolbarItems/>
544476 <tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="3pl-mU-U30">
545477 <rect key="frame" x="0.0" y="0.0" width="1000" height="1000"/>
GDproject/Constants.swift+4
@@ -6,6 +6,7 @@
66// Copyright © 2019 drHSE. All rights reserved.
77//
88
9+import UIKit
910/// constant for cell in posts NewsController.swift
1011let postCellId = "PostCell"
1112
@@ -46,3 +47,6 @@ let logInController = "LogInController"
4647let profileViewController = "ProfileViewController"
4748
4849let simplifiedChannelsList = "SimplifiedChannelsList"
50+
51+let blueSystemColor = UIColor(red: 0, green: 137/255, blue: 249/255, alpha: 0.5)
52+
GDproject/Controller/ News and channels/ChannelsCoordinator.swiftdeleted−55
@@ -1,55 +0,0 @@
1−//
2−// ChannelsCoordinator.swift
3−// GDproject
4−//
5−// Created by cstore on 23/02/2019.
6−// Copyright © 2019 drHSE. All rights reserved.
7−//
8−
9−import Foundation
10−import UIKit
11−
12−final class ChannelsCoordinator{
13−
14− // MARK: - Properties
15− private var channel: Model.Channels { didSet { updateInterfaces() } }
16− private weak var navigationController: UINavigationController?
17−
18− // MARK:- Init
19− init(currentChannel: Model.Channels, navigationController: UINavigationController) {
20− self.channel = currentChannel
21− self.navigationController = navigationController
22− }
23−
24− func start(){
25− showCurrentChannel()
26− }
27−
28− // MARK: - Private implementation
29− private func showListOfChannels(){
30− let controller = UIStoryboard.makeChannelsListController()
31− controller.onChannelSelected = { [weak self] channel
32− in
33− self?.channel = channel
34− _ = self?.navigationController?.popViewController(animated: true)
35− }
36− navigationController?.pushViewController(controller, animated: true)
37− }
38−
39− private func showCurrentChannel(){
40− let controller = UIStoryboard.makeNewsController()
41− controller.channel = channel
42− controller.onSelectChannel = { [weak self] in
43− self?.showListOfChannels()
44− }
45− navigationController?.setViewControllers([controller], animated: false)
46− //navigationController?.pushViewController(controller, animated: false)
47− }
48−
49− // MARK:- update only viewControllers which are depandable on chosen channel
50− private func updateInterfaces() {
51− navigationController?.viewControllers.forEach {
52− ($0 as? UpdateableWithChannel)?.channel = channel
53− }
54− }
55−}
GDproject/Controller/Coordinators/ApplicationCoordinator.swiftnew file+69
@@ -0,0 +1,69 @@
1+//
2+// ApplicationCoordinator.swift
3+// RxSwift
4+//
5+// Created by cstore on 04/03/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import Foundation
10+import UIKit
11+
12+
13+
14+fileprivate enum LaunchInstructor {
15+ case main, auth
16+
17+ static func configure(
18+ isAutorized: Bool = DataStorage.standard.isLoggedIn) -> LaunchInstructor {
19+
20+ if isAutorized{
21+ return .main
22+ } else {
23+ return .auth
24+ }
25+ }
26+}
27+
28+final class ApplicationCoordinator: BaseCoordinator{
29+ private var window: UIWindow!
30+
31+ init(window: UIWindow) {
32+ self.window = window
33+ }
34+
35+ private var instructor: LaunchInstructor {
36+ return LaunchInstructor.configure()
37+ }
38+
39+ override func start() {
40+ switch instructor {
41+ case .auth: runAuthFlow()
42+ case .main: runMainFlow()
43+ }
44+ }
45+
46+ private func runAuthFlow() {
47+ let coordinator = LogInCoordinator(window: window)
48+ coordinator.didEndFlow = { [weak self, weak coordinator] in
49+ self?.start()
50+ self?.removeDependency(coordinator)
51+ }
52+ addDependency(coordinator)
53+ coordinator.start()
54+ }
55+
56+ private func runMainFlow() {
57+ let storyboard = UIStoryboard(name: "Main", bundle: nil)
58+ let tabBar = storyboard.instantiateViewController(withIdentifier: "TabbarController") as! TabbarController
59+ let coordinator = TabBarCoordinator(tabbarView: tabBar, window: window!)
60+
61+ coordinator.didEndFlow = { [weak self, weak coordinator] in
62+ self?.start()
63+ self?.removeDependency(coordinator)
64+ }
65+
66+ addDependency(coordinator)
67+ coordinator.start()
68+ }
69+}
GDproject/Controller/Coordinators/BaseCoordinator.swiftnew file+47
@@ -0,0 +1,47 @@
1+//
2+// BaseCoordinator.swift
3+// RxSwift
4+//
5+// Created by cstore on 02/03/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import Foundation
10+import UIKit
11+
12+protocol Coordinator: class {
13+ func start()
14+}
15+
16+class BaseCoordinator: Coordinator {
17+
18+ var childCoordinators: [Coordinator] = []
19+
20+ func start() {
21+
22+ }
23+
24+ // add only unique object
25+ func addDependency(_ coordinator: Coordinator) {
26+ guard !childCoordinators.contains(where: { $0 === coordinator }) else { return }
27+ childCoordinators.append(coordinator)
28+ }
29+
30+ func removeDependency(_ coordinator: Coordinator?) {
31+ guard
32+ childCoordinators.isEmpty == false,
33+ let coordinator = coordinator
34+ else { return }
35+
36+ // Clear child-coordinators recursively
37+ if let coordinator = coordinator as? BaseCoordinator, !coordinator.childCoordinators.isEmpty {
38+ coordinator.childCoordinators
39+ .filter({ $0 !== coordinator })
40+ .forEach({ coordinator.removeDependency($0) })
41+ }
42+ for (index, element) in childCoordinators.enumerated() where element === coordinator {
43+ childCoordinators.remove(at: index)
44+ break
45+ }
46+ }
47+}
GDproject/Controller/Coordinators/ChannelsCoordinator.swiftnew file+28
@@ -0,0 +1,28 @@
1+//
2+// ChannelsCoordinator.swift
3+// RxSwift
4+//
5+// Created by cstore on 03/03/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import Foundation
10+import UIKit
11+
12+class ChannelsCoordinator: BaseCoordinator{
13+ private weak var navigationController: UINavigationController?
14+
15+ init(nc: UINavigationController) {
16+ self.navigationController = nc
17+ }
18+
19+ override func start() {
20+ show()
21+ }
22+
23+ private func show() {
24+ let storyboard = UIStoryboard(name: "Main", bundle: nil)
25+ let channels = storyboard.instantiateViewController(withIdentifier: channelListControllerId) as! ChannelListController
26+ navigationController?.setViewControllers([channels], animated: false)
27+ }
28+}
GDproject/Controller/Coordinators/LogInCoordinator.swiftnew file+41
@@ -0,0 +1,41 @@
1+//
2+// LogInCoordinator.swift
3+// RxSwift
4+//
5+// Created by cstore on 01/03/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import UIKit
10+
11+class LogInCoordinator: BaseCoordinator {
12+
13+ var didEndFlow: (()->())?
14+ var window: UIWindow!
15+ var navigationController: UINavigationController?
16+
17+ init(window: UIWindow) {
18+ self.window = window
19+ self.window?.rootViewController = UINavigationController()
20+ self.navigationController = window.rootViewController as? UINavigationController
21+ }
22+
23+ override func start(){
24+ let logInVC = LogInViewController()
25+ logInVC.authenticate = { [weak self] (id) in
26+
27+ Model.authenticate(with: id) {
28+ (res) in
29+
30+ if (res) {
31+ DataStorage.standard.setUserKey(with: id)
32+ self?.didEndFlow?()
33+ }
34+ else {
35+ DataStorage.standard.setUserKey(with: 0)
36+ }
37+ }
38+ }
39+ navigationController?.pushViewController(logInVC, animated: false)
40+ }
41+}
GDproject/Controller/Coordinators/ProfileCoordinator.swiftnew file+52
@@ -0,0 +1,52 @@
1+//
2+// ProfileCoordinator.swift
3+// RxSwift
4+//
5+// Created by cstore on 02/03/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import Foundation
10+import UIKit
11+
12+class ProfileCoordinator: BaseCoordinator {
13+
14+ var didEndSession: (()->())?
15+
16+ private weak var navigationController: UINavigationController?
17+
18+ init(nc: UINavigationController) {
19+ self.navigationController = nc
20+ }
21+
22+ override func start() {
23+ show()
24+ }
25+
26+ private func show() {
27+ let storyboard = UIStoryboard(name: "Main", bundle: nil)
28+ let profile = storyboard.instantiateViewController(withIdentifier: "ProfileViewController") as! ProfileViewController
29+ profile.logOut = { [weak self] in
30+ DataStorage.standard.setIsLoggedIn(value: false, with: 0)
31+ self?.didEndSession?()
32+ }
33+ profile.onSettings = { [weak self, weak storyboard] in
34+ let vc = storyboard?.instantiateViewController(withIdentifier: "SettingsViewController") as! SettingsViewController
35+ self?.navigationController?.pushViewController(vc, animated: true)
36+ }
37+
38+ profile.onChannelsListToAddAPerson = { [weak self, weak storyboard] (user) in
39+ let vc = storyboard?.instantiateViewController(withIdentifier: simplifiedChannelsList) as! SimplifiedChannelsList
40+ vc.user = user
41+
42+ let transition = CATransition()
43+ transition.duration = 0.5
44+ transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
45+ transition.type = CATransitionType.moveIn
46+ transition.subtype = CATransitionSubtype.fromTop
47+ self?.navigationController?.view.layer.add(transition, forKey: nil)
48+ self?.navigationController?.pushViewController(vc, animated: false)
49+ }
50+ navigationController?.setViewControllers([profile], animated: false)
51+ }
52+}
GDproject/Controller/Coordinators/TabbarController.swiftnew file+45
@@ -0,0 +1,45 @@
1+//
2+// TabbarController.swift
3+// RxSwift
4+//
5+// Created by cstore on 03/03/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import Foundation
10+import UIKit
11+
12+protocol TabbarView: class {
13+ var onChannelsFlowSelect: ((UINavigationController) -> ())? { get set }
14+ var onProfileFlowSelect: ((UINavigationController) -> ())? { get set }
15+ var onViewDidLoad: ((UINavigationController) -> ())? { get set }
16+}
17+
18+final class TabbarController: UITabBarController, UITabBarControllerDelegate, TabbarView {
19+
20+
21+ var onChannelsFlowSelect: ((UINavigationController) -> ())?
22+ var onProfileFlowSelect: ((UINavigationController) -> ())?
23+ var onViewDidLoad: ((UINavigationController) -> ())?
24+
25+ override func viewDidLoad() {
26+ super.viewDidLoad()
27+
28+ delegate = self
29+ if let controller = customizableViewControllers?.first as? UINavigationController {
30+ onViewDidLoad?(controller)
31+ }
32+ }
33+
34+ func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController)
35+ {
36+
37+ guard let controller = viewControllers?[selectedIndex] as? UINavigationController else { return }
38+
39+ if selectedIndex == 0 {
40+ onChannelsFlowSelect?(controller)
41+ } else {
42+ onProfileFlowSelect?(controller)
43+ }
44+ }
45+}
GDproject/Controller/Coordinators/TabbarCoordinator.swiftnew file+57
@@ -0,0 +1,57 @@
1+//
2+// TabBarCoordinator.swift
3+// RxSwift
4+//
5+// Created by cstore on 02/03/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import Foundation
10+import UIKit
11+
12+
13+class TabBarCoordinator: BaseCoordinator {
14+
15+ var didEndFlow: (()->())?
16+
17+ private let tabbarView: TabbarView
18+ private let window: UIWindow?
19+
20+ init(tabbarView: TabbarView, window: UIWindow) {
21+ self.tabbarView = tabbarView
22+ self.window = window
23+ }
24+
25+ override func start() {
26+ tabbarView.onViewDidLoad = runChannelsFlow()
27+ tabbarView.onChannelsFlowSelect = runChannelsFlow()
28+ tabbarView.onProfileFlowSelect = runProfileFlow()
29+ window?.rootViewController = tabbarView as! TabbarController
30+ }
31+
32+ private func runChannelsFlow() -> ((UINavigationController) -> ())
33+ {
34+ return { [unowned self] navController in
35+ if navController.viewControllers.isEmpty == true {
36+ let channelCoordinator = ChannelsCoordinator(nc: navController)
37+ self.addDependency(channelCoordinator)
38+ channelCoordinator.start()
39+ }
40+ }
41+ }
42+
43+ private func runProfileFlow() -> ((UINavigationController) -> ())
44+ {
45+ return { [unowned self] navController in
46+ if navController.viewControllers.isEmpty == true {
47+ let profileCoordinator = ProfileCoordinator(nc: navController)
48+ profileCoordinator.didEndSession = { [weak self, weak profileCoordinator] in
49+ self?.removeDependency(profileCoordinator)
50+ self?.didEndFlow?()
51+ }
52+ self.addDependency(profileCoordinator)
53+ profileCoordinator.start()
54+ }
55+ }
56+ }
57+}
GDproject/Controller/Log In/LogInCoordinator.swiftdeleted−48
@@ -1,48 +0,0 @@
1−//
2−// LogInCoordinator.swift
3−// GDproject
4−//
5−// Created by cstore on 23/02/2019.
6−// Copyright © 2019 drHSE. All rights reserved.
7−//
8−
9−import UIKit
10−
11−class LogInCoordinator{
12−
13− private weak var navigationController: UINavigationController?
14− private var window: UIWindow!
15− // MARK:- Init
16− init(navigationController: UINavigationController, window: UIWindow) {
17− self.navigationController = navigationController
18− self.window = window
19− }
20−
21− func start(){
22− showLogInPage()
23− }
24−
25− // MARK: - Private implementation
26−// private func showStatusPage(){
27−// let controller = TabbarCoordinator(window: window)
28−// controller.start()
29−// }
30−
31− private func showLogInPage(){
32− let controller = UIStoryboard.makeLogIn()
33−
34− controller.onLogIn = {
35− (id) in Model.authenticate(with: id) {
36− (res) in
37−
38− if (res) { DataStorage.standard.setUserKey(with: id) }
39− else { DataStorage.standard.setUserKey(with: 0) }
40−
41− controller.authenticateSucceeded = res
42− }
43− }
44−
45− navigationController?.pushViewController(controller, animated: false)
46− }
47−
48−}
GDproject/Controller/Log In/LogInCoordinator1.swiftnew file+48
@@ -0,0 +1,48 @@
1+////
2+//// LogInCoordinator.swift
3+//// GDproject
4+////
5+//// Created by cstore on 23/02/2019.
6+//// Copyright © 2019 drHSE. All rights reserved.
7+////
8+//
9+//import UIKit
10+//
11+//class LogInCoordinator{
12+//
13+// private weak var navigationController: UINavigationController?
14+// private var window: UIWindow!
15+// // MARK:- Init
16+// init(navigationController: UINavigationController, window: UIWindow) {
17+// self.navigationController = navigationController
18+// self.window = window
19+// }
20+//
21+// func start(){
22+// showLogInPage()
23+// }
24+//
25+// // MARK: - Private implementation
26+//// private func showStatusPage(){
27+//// let controller = TabbarCoordinator(window: window)
28+//// controller.start()
29+//// }
30+//
31+// private func showLogInPage(){
32+// let controller = UIStoryboard.makeLogIn()
33+//
34+// controller.onLogIn = {
35+// (id) in Model.authenticate(with: id) {
36+// (res) in
37+//
38+// if (res) { DataStorage.standard.setUserKey(with: id) }
39+// else { DataStorage.standard.setUserKey(with: 0) }
40+//
41+// controller.authenticateSucceeded = res
42+// }
43+// }
44+//
45+// navigationController?.pushViewController(controller, animated: false)
46+// }
47+//
48+//}
GDproject/Controller/Log In/LogInViewController.swift+71−94
@@ -1,128 +1,110 @@
11//
22// LogInViewController.swift
3−// NewsFeed
3+// RxSwift
44//
5−// Created by cstore on 20/01/2019.
5+// Created by cstore on 01/03/2019.
66// Copyright © 2019 drHSE. All rights reserved.
77//
88
99import UIKit
10+import TinyConstraints
11+import ReactiveSwift
12+import ReactiveCocoa
13+import Result
1014
1115class LogInViewController: UIViewController {
1216
13− @IBOutlet weak var mailTextField: UITextField!
17+ var authenticate: ((Int)->())?
1418
15− @IBOutlet weak var indicatorView: UIActivityIndicatorView!
16−
17− var onLogIn: ((Int)->())?
18−
19− var authenticateSucceeded: Bool? {
20− didSet {
21− if !authenticateSucceeded! {
22− indicatorView.stopAnimating()
23− indicatorView.isHidden = true
24− }
25− }
26− }
27−
28− static let titleColor = UIColor(red: 0, green: 137/255, blue: 249/255, alpha: 0.5)
19+ let logInLabel: UILabel = {
20+ let label = UILabel()
21+ label.text = "Log In"
22+ label.textColor = .black
23+ label.font = UIFont.boldSystemFont(ofSize: 34)
24+ return label
25+ }()
2926
30− var bottomConstraint: NSLayoutConstraint?
27+ let mailTextField: UITextField = {
28+ let textField = UITextField()
29+ textField.backgroundColor = #colorLiteral(red: 0.937254902, green: 0.937254902, blue: 0.9568627451, alpha: 1)
30+ textField.placeholder = "Mail"
31+ textField.borderStyle = .roundedRect
32+ textField.textColor = .black
33+ textField.clearButtonMode = .always
34+ return textField
35+ }()
3136
3237 let logInButton: UIButton = {
3338 let button = UIButton(type: .system)
3439 button.setTitle("Log In", for: .normal)
35− button.setTitleColor(titleColor, for: .normal)
40+ button.setTitleColor(blueSystemColor, for: .normal)
3641 button.titleLabel?.font = UIFont.boldSystemFont(ofSize: 16)
42+ button.addTarget(self, action: #selector(handleTap), for: .touchUpInside)
3743 button.isEnabled = false
38− button.addTarget(self, action: #selector(activateLogInProcess), for: .touchUpInside)
3944 return button
4045 }()
4146
42− let keyboardBar: UIView = {
43− let view = UIView()
44− view.backgroundColor = .white
45− return view
46− }()
47−
48− override func viewDidLoad() {
49− super.viewDidLoad()
50− setUpView()
51− configureTapgesture()
52− }
53−
54− override func viewWillAppear(_ animated: Bool) {
55− super.viewWillAppear(animated)
47+ @objc func handleTap(){
48+ authenticate?(Int(mailTextField.text!)!)
5649 }
5750
58− override func viewWillDisappear(_ animated: Bool) {
59− super.viewWillDisappear(animated)
60− }
51+ private lazy var keyboardBar = UIView()
52+ private lazy var contentView = UIView()
53+ private var bottomConstraint: NSLayoutConstraint?
6154
62− private func configureTapgesture(){
63− let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap))
64− view.addGestureRecognizer(tapGesture)
55+ func setUpView(){
56+ // logIn stack with textField and label
57+ view.addSubview(contentView)
58+ contentView.edgesToSuperview(excluding: .bottom, insets: .left(16) + .right(16) + .top(80), usingSafeArea: true)
59+ let views = [logInLabel, mailTextField]
60+ contentView.stack(views, axis: .vertical, spacing: 10)
6561 }
6662
67− @objc func handleTap(){
68− view.endEditing(true)
63+ func configureKeyboard(){
64+
65+ // configure keyboardBar setUp
66+ view.addSubview(keyboardBar)
67+ keyboardBar.height(50)
68+ keyboardBar.edgesToSuperview(excluding: [.top,.bottom])
69+ bottomConstraint = NSLayoutConstraint(item: keyboardBar, attribute: .bottom, relatedBy: .equal, toItem: view.safeAreaLayoutGuide, attribute: .bottom, multiplier: 1, constant: 0)
70+ view.addConstraint(bottomConstraint!)
71+
72+ // configure keyboardBar components
73+ keyboardBar.addSubview(logInButton)
74+ logInButton.height(50)
75+ logInButton.leftToSuperview(view.leftAnchor, offset: 16, relation: .equal, isActive: true)
76+
6977 }
7078
71− @objc func activateLogInProcess(){
72− if logInButton.isEnabled {
73− // MARK:- when log in is succeeded do I need to go there?
74− if let id = Int(mailTextField.text!){
75− indicatorView.isHidden = false
76− indicatorView.startAnimating()
77− onLogIn?(id)
78− view.endEditing(true)
79+ func logicOfLogInInputValidation() -> ((String?)->()) {
80+
81+ let logic: ((String?)->()) = { [weak self] (someText) in
82+ if let text = someText, !text.isEmpty, let id = Int(text) {
83+ self?.logInButton.isEnabled = true
7984 } else {
80− logInButton.isEnabled = false
81− logInButton.setTitleColor(LogInViewController.titleColor.withAlphaComponent(0.5), for: .normal)
85+ self?.logInButton.isEnabled = false
8286 }
8387 }
88+
89+ return logic
8490 }
8591
86− func setUpView(){
87− indicatorView.isHidden = true
88− mailTextField.delegate = self
89− view.addSubview(keyboardBar)
90−
91− view.addConstraintsWithFormat(format: "H:|[v0]|", views: keyboardBar)
92− view.addConstraintsWithFormat(format: "V:[v0(50)]", views: keyboardBar)
92+ override func viewDidLoad() {
93+ super.viewDidLoad()
94+ self.view.backgroundColor = .white
95+ setUpView()
96+ configureKeyboard()
9397
94− setUpBarComponents()
98+ let mailFieldValuesSignal: Signal<String?, NoError> = mailTextField.reactive.continuousTextValues
9599
96− configureKeyboardBehavior()
97− }
98−
99− func configureKeyboardBehavior(){
100− bottomConstraint = NSLayoutConstraint(item: keyboardBar, attribute: .bottom, relatedBy: .equal, toItem: view.safeAreaLayoutGuide, attribute: .bottom, multiplier: 1, constant: 0)
101− view.addConstraint(bottomConstraint!)
100+ mailFieldValuesSignal.observeValues(logicOfLogInInputValidation())
102101
103102 // for keyboard notifications
104103 NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotifications), name: UIResponder.keyboardWillShowNotification, object: nil)
105104
106105 NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotifications), name: UIResponder.keyboardWillHideNotification, object: nil)
107−
108− // for log in button notifications
109− NotificationCenter.default.addObserver(self, selector: #selector(inputDidChanged), name: UITextField.textDidChangeNotification, object: mailTextField)
110−
111− NotificationCenter.default.addObserver(self, selector: #selector(inputDidChanged), name: UITextField.textDidBeginEditingNotification, object: mailTextField)
112106 }
113107
114− @objc func inputDidChanged(notification: NSNotification){
115− if mailTextField.text?.isEmpty ?? true
116− {
117− logInButton.isEnabled = false
118− logInButton.setTitleColor(LogInViewController.titleColor.withAlphaComponent(0.5), for: .normal)
119− }
120− else
121− {
122− logInButton.isEnabled = true
123− logInButton.setTitleColor(LogInViewController.titleColor.withAlphaComponent(1), for: .normal)
124− }
125− }
126108
127109 @objc func handleKeyboardNotifications(notification: NSNotification){
128110 if let userInfo = notification.userInfo{
@@ -136,18 +118,13 @@ class LogInViewController: UIViewController {
136118 }
137119 }
138120
139− func setUpBarComponents(){
140− keyboardBar.addSubview(logInButton)
141− keyboardBar.addConstraintsWithFormat(format: "H:[v0(60)]-16-|", views: logInButton)
142− keyboardBar.addConstraintsWithFormat(format: "V:|[v0]|", views: logInButton)
143− }
144121}
145122
146−
147−extension LogInViewController: UITextFieldDelegate{
148− func textFieldShouldReturn(_ textField: UITextField) -> Bool
149− {
150− textField.resignFirstResponder()
151− return true
123+extension UIButton {
124+ override open var isEnabled: Bool {
125+ didSet {
126+ let color = isEnabled ? self.titleLabel?.textColor.withAlphaComponent(1) : self.titleLabel?.textColor.withAlphaComponent(0.5)
127+ self.setTitleColor(color, for: .normal)
128+ }
152129 }
153130}
GDproject/Controller/Profile/ProfileViewController.swift+14−32
@@ -30,6 +30,12 @@ class ProfileViewController: UIViewController
3030
3131 @IBOutlet weak var newMessageButton: UIButton!
3232
33+ var logOut: (()->())?
34+
35+ var onSettings: (()->())?
36+
37+ var onChannelsListToAddAPerson: ((Model.Users)->())?
38+
3339 var protoDictionary: [Int: UIImage] = [9: #imageLiteral(resourceName: "9"), 5051: #imageLiteral(resourceName: "5051"), 69: #imageLiteral(resourceName: "69"), 42: #imageLiteral(resourceName: "42")]
3440
3541 func fill(with user: Model.Users){
@@ -76,8 +82,6 @@ class ProfileViewController: UIViewController
7682 {
7783 super.viewDidLoad()
7884
79−
80−
8185 posts.viewController = self
8286 posts.type = .NONE
8387
@@ -99,6 +103,7 @@ class ProfileViewController: UIViewController
99103 var idProfile: Int?
100104
101105 override func viewWillAppear(_ animated: Bool) {
106+
102107 if idProfile == nil {
103108 idProfile = DataStorage.standard.getUserId()
104109 }
@@ -111,8 +116,6 @@ class ProfileViewController: UIViewController
111116 self?.user = dic[id]
112117 }
113118 }
114−
115− // requst for postsforuser was here. moved because of concrr
116119 }
117120
118121 setUpNavigarionBar()
@@ -120,56 +123,35 @@ class ProfileViewController: UIViewController
120123
121124 func setUpNavigarionBar(){
122125 navigationController?.navigationBar.prefersLargeTitles = true
123− //navigationItem.title = "\(user?.id ?? 0)"
124126 let uibarbutton = UIBarButtonItem(title: "More", style: .plain, target: self, action: #selector(showInformation))
125127 navigationItem.rightBarButtonItems = [uibarbutton]
126128 navigationItem.largeTitleDisplayMode = .always
127129 }
128130
129−
130− let copyLink: UIAlertAction = {
131− let b = UIAlertAction(title: "Copy link", style: .default)
132− return b
133− }()
134−
135131 @objc func showInformation(){
136132
137− // drafts
138− // saved
139−
140133 let optionMenu = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
134+
141135 let channelAction = UIAlertAction(title: "Add to a channel", style: .default){
142136 [weak self] (_) in
143−
144− let vc = self?.storyboard?.instantiateViewController(withIdentifier: simplifiedChannelsList) as! SimplifiedChannelsList
145−
146− vc.user = self?.user!
147−
148− let transition = CATransition()
149− transition.duration = 0.5
150− transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
151− transition.type = CATransitionType.moveIn
152− transition.subtype = CATransitionSubtype.fromTop
153− self?.navigationController?.view.layer.add(transition, forKey: nil)
154− self?.navigationController?.pushViewController(vc, animated: false)
137+ self?.onChannelsListToAddAPerson?(self!.user!)
155138 }
139+
156140 let settingsAction = UIAlertAction(title: "Setting", style: .default)
157141 { [weak self] (_) in
158−
159− let vc = self?.storyboard?.instantiateViewController(withIdentifier: "SettingsViewController") as! SettingsViewController
160− self?.navigationController?.pushViewController(vc, animated: true)
142+ self?.onSettings?()
161143 }
162144
163145 let cancelAction = UIAlertAction(title: "Cancel", style: .cancel)
146+
164147 let logoutAction = UIAlertAction(title: "Log out", style: .destructive)
165− {
148+ { [weak self]
166149 (_) in
167− DataStorage.standard.setIsLoggedIn(value: false, with: 0)
150+ self?.logOut?()
168151 }
169152
170153 optionMenu.addAction(channelAction)
171154 optionMenu.addAction(settingsAction)
172− optionMenu.addAction(copyLink)
173155 optionMenu.addAction(logoutAction)
174156 optionMenu.addAction(cancelAction)
175157
GDproject/Controller/RepeatingTimer.swiftdeleted−59
@@ -1,59 +0,0 @@
1−/// RepeatingTimer mimics the API of DispatchSourceTimer but in a way that prevents
2−/// crashes that occur from calling resume multiple times on a timer that is
3−/// already resumed (noted by https://github.com/SiftScience/sift-ios/issues/52
4−
5−import Foundation
6−
7−class RepeatingTimer {
8−
9− let timeInterval: TimeInterval
10−
11− init(timeInterval: TimeInterval) {
12− self.timeInterval = timeInterval
13− }
14−
15− private lazy var timer: DispatchSourceTimer = {
16− let t = DispatchSource.makeTimerSource()
17− t.schedule(deadline: .now() + self.timeInterval, repeating: self.timeInterval)
18− t.setEventHandler(handler: { [weak self] in
19− self?.eventHandler?()
20− })
21− return t
22− }()
23−
24− var eventHandler: (() -> Void)?
25−
26− private enum State {
27− case suspended
28− case resumed
29− }
30−
31− private var state: State = .suspended
32−
33− deinit {
34− timer.setEventHandler {}
35− timer.cancel()
36− /*
37− If the timer is suspended, calling cancel without resuming
38− triggers a crash. This is documented here https://forums.developer.apple.com/thread/15902
39− */
40− resume()
41− eventHandler = nil
42− }
43−
44− func resume() {
45− if state == .resumed {
46− return
47− }
48− state = .resumed
49− timer.resume()
50− }
51−
52− func suspend() {
53− if state == .suspended {
54− return
55− }
56− state = .suspended
57− timer.suspend()
58− }
59−}
GDproject/DataStorage.swift+1−9
@@ -40,15 +40,7 @@ class DataStorage{
4040 /**
4141 Function to determine is user logged in already or not
4242 */
43− var isLoggedIn: Bool = UserDefaults.standard.bool(forKey: UserDefaultsKeys.loggedIn.rawValue) {
44− didSet{
45− if isLoggedIn && getUserId() != 0 {
46− (UIApplication.shared.delegate as? AppDelegate)?.tabCoordinator.start()
47− } else {
48− (UIApplication.shared.delegate as? AppDelegate)?.logInAgain()
49− }
50− }
51− }
43+ var isLoggedIn: Bool = UserDefaults.standard.bool(forKey: UserDefaultsKeys.loggedIn.rawValue)
5244}
5345
5446/**
GDproject/Supporting files/AppDelegate.swift+8−44
@@ -12,57 +12,21 @@ import UIKit
1212class AppDelegate: UIResponder, UIApplicationDelegate {
1313
1414
15− var coordinator: LogInCoordinator!
16− var tabCoordinator: TabbarCoordinator!
17−
1815 var window: UIWindow?
19− var rootController: UINavigationController? {
20− return self.window!.rootViewController as? UINavigationController
21− }
22−
23− func logInAgain(){
24− let root = UIStoryboard.navRoot()
25− window?.rootViewController = root
26− window?.makeKeyAndVisible()
27− coordinator = LogInCoordinator(navigationController: root, window: UIApplication.shared.keyWindow!)
28− coordinator!.start()
29− }
16+ var appCoordinator: ApplicationCoordinator!
3017
3118
3219 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
3320 {
34− coordinator = LogInCoordinator(navigationController: rootController!, window: window!)
35− tabCoordinator = TabbarCoordinator(window: window!)
36− // TODO:- determine what to do here: log in or tabbar
37− if DataStorage.standard.isLoggedIn {
38− tabCoordinator.start()
39− } else {
40− coordinator.start()
41− }
21+ window = UIWindow(frame: UIScreen.main.bounds)
22+ window?.makeKeyAndVisible()
23+
24+ // window?.rootViewController = UINavigationController()
25+
26+ appCoordinator = ApplicationCoordinator(window: window!)
27+ appCoordinator.start()
4228
4329 return true
4430 }
45−
46− func applicationWillResignActive(_ application: UIApplication) {
47− // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
48− // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
49− }
50−
51− func applicationDidEnterBackground(_ application: UIApplication) {
52− // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
53− // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
54− }
55−
56− func applicationWillEnterForeground(_ application: UIApplication) {
57− // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
58− }
59−
60− func applicationDidBecomeActive(_ application: UIApplication) {
61− // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
62− }
63−
64− func applicationWillTerminate(_ application: UIApplication) {
65− // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
66− }
6731}
6832