Trying to embed coordinators in project. Broke log in a little bit. Can be a lot of issues now.

This commit is contained in:
Darya Rednikina 2019-03-19 21:50:19 +03:00
parent 25c84f2005
commit 9e6ff4894b
19 changed files with 561 additions and 441 deletions

View File

@ -5,3 +5,4 @@ github "macteo/Marklight"
github "ElaWorkshop/TagListView"
github "Alamofire/Alamofire" "5.0.0-beta.2"
github "whitesmith/WSTagsField"
github "ReactiveCocoa/ReactiveCocoa" ~> 8.0

View File

@ -15,14 +15,16 @@
124CC7032221C00C009DF531 /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = 124CC7022221C00C009DF531 /* Model.swift */; };
124CC7052221C2BB009DF531 /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 124CC7042221C2BA009DF531 /* Alamofire.framework */; };
124CC7072221C2C3009DF531 /* Alamofire.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 124CC7042221C2BA009DF531 /* Alamofire.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1253867D2223DC9F00CC5EA7 /* RepeatingTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1253867C2223DC9F00CC5EA7 /* RepeatingTimer.swift */; };
125BD57D22171D2A008A3575 /* ProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD57C22171D2A008A3575 /* ProfileViewController.swift */; };
125BD57F22171D73008A3575 /* Extentions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD57E22171D73008A3575 /* Extentions.swift */; };
125BD5812217314A008A3575 /* NewsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD5802217314A008A3575 /* NewsVC.swift */; };
1288B5CE221F1158002BE6B1 /* DataStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1288B5CD221F1158002BE6B1 /* DataStorage.swift */; };
1291BE2D2221312D009D3F23 /* ChannelsCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1291BE2C2221312C009D3F23 /* ChannelsCoordinator.swift */; };
1291BE342221569B009D3F23 /* TabbarCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1291BE332221569B009D3F23 /* TabbarCoordinator.swift */; };
1291BE3622218DBF009D3F23 /* LogInCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1291BE3522218DBF009D3F23 /* LogInCoordinator.swift */; };
1291BE3622218DBF009D3F23 /* LogInCoordinator1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1291BE3522218DBF009D3F23 /* LogInCoordinator1.swift */; };
12BA4B9B224101A400DF93D7 /* ApplicationCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12BA4B9A224101A400DF93D7 /* ApplicationCoordinator.swift */; };
12BA4B9D224101E700DF93D7 /* BaseCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12BA4B9C224101E700DF93D7 /* BaseCoordinator.swift */; };
12BA4B9F224102B700DF93D7 /* LogInCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12BA4B9E224102B700DF93D7 /* LogInCoordinator.swift */; };
12D7D133221C321600B35452 /* ChannelListController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D7D132221C321600B35452 /* ChannelListController.swift */; };
12D7D135221C42B700B35452 /* ChannelController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D7D134221C42B700B35452 /* ChannelController.swift */; };
12D7D137221D78E800B35452 /* Channel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12D7D136221D78E800B35452 /* Channel.swift */; };
@ -50,9 +52,17 @@
12E36DCE22144756006FCDD7 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E36DCD22144756006FCDD7 /* Constants.swift */; };
12E36DD122148122006FCDD7 /* FullPostController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E36DD022148122006FCDD7 /* FullPostController.swift */; };
12E36DD522156559006FCDD7 /* MyStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E36DD422156559006FCDD7 /* MyStackView.swift */; };
12E36DD8221594A9006FCDD7 /* TagListView.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 12E36DD622159493006FCDD7 /* TagListView.framework */; };
12E36DD9221594A9006FCDD7 /* TagListView.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 12E36DD622159493006FCDD7 /* TagListView.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
12E36DDB221594B1006FCDD7 /* MarkdownKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 12E36DB022143D47006FCDD7 /* MarkdownKit.framework */; };
12F3D6B0224106F700A69214 /* TabbarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12F3D6AF224106F700A69214 /* TabbarController.swift */; };
12F3D6B22241097B00A69214 /* ProfileCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12F3D6B12241097B00A69214 /* ProfileCoordinator.swift */; };
12F3D6B4224112D600A69214 /* ReactiveMapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6B3224112D600A69214 /* ReactiveMapKit.framework */; };
12F3D6B6224112E100A69214 /* ReactiveSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6B5224112E000A69214 /* ReactiveSwift.framework */; };
12F3D6B8224112E900A69214 /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6B7224112E800A69214 /* Result.framework */; };
12F3D6BB224112FD00A69214 /* ReactiveCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6B9224112F500A69214 /* ReactiveCocoa.framework */; };
12F3D6BC224112FD00A69214 /* ReactiveCocoa.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6B9224112F500A69214 /* ReactiveCocoa.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
12F3D6BE2241130000A69214 /* Result.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6B7224112E800A69214 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
12F3D6C02241130200A69214 /* ReactiveSwift.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6B5224112E000A69214 /* ReactiveSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
12F3D6C22241130400A69214 /* ReactiveMapKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 12F3D6B3224112D600A69214 /* ReactiveMapKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@ -63,10 +73,13 @@
dstSubfolderSpec = 10;
files = (
12E36DC0221441DB006FCDD7 /* Marklight.framework in Embed Frameworks */,
12F3D6C22241130400A69214 /* ReactiveMapKit.framework in Embed Frameworks */,
124CC7072221C2C3009DF531 /* Alamofire.framework in Embed Frameworks */,
12E36DC4221441EA006FCDD7 /* Cartography.framework in Embed Frameworks */,
12E36DD9221594A9006FCDD7 /* TagListView.framework in Embed Frameworks */,
12F3D6BE2241130000A69214 /* Result.framework in Embed Frameworks */,
12E36DBD221441D5006FCDD7 /* TinyConstraints.framework in Embed Frameworks */,
12F3D6C02241130200A69214 /* ReactiveSwift.framework in Embed Frameworks */,
12F3D6BC224112FD00A69214 /* ReactiveCocoa.framework in Embed Frameworks */,
123AD0E5223C1C4300326173 /* WSTagsField.framework in Embed Frameworks */,
12E36DC2221441E1006FCDD7 /* MarkdownKit.framework in Embed Frameworks */,
);
@ -82,14 +95,16 @@
123E37A6221F1DD700F6E42A /* MainController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainController.swift; sourceTree = "<group>"; };
124CC7022221C00C009DF531 /* Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Model.swift; sourceTree = "<group>"; };
124CC7042221C2BA009DF531 /* Alamofire.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Alamofire.framework; path = Carthage/Build/iOS/Alamofire.framework; sourceTree = "<group>"; };
1253867C2223DC9F00CC5EA7 /* RepeatingTimer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RepeatingTimer.swift; sourceTree = "<group>"; };
125BD57C22171D2A008A3575 /* ProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = "<group>"; };
125BD57E22171D73008A3575 /* Extentions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extentions.swift; sourceTree = "<group>"; };
125BD5802217314A008A3575 /* NewsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsVC.swift; sourceTree = "<group>"; };
1288B5CD221F1158002BE6B1 /* DataStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataStorage.swift; sourceTree = "<group>"; };
1291BE2C2221312C009D3F23 /* ChannelsCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelsCoordinator.swift; sourceTree = "<group>"; };
1291BE332221569B009D3F23 /* TabbarCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabbarCoordinator.swift; sourceTree = "<group>"; };
1291BE3522218DBF009D3F23 /* LogInCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogInCoordinator.swift; sourceTree = "<group>"; };
1291BE3522218DBF009D3F23 /* LogInCoordinator1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogInCoordinator1.swift; sourceTree = "<group>"; };
12BA4B9A224101A400DF93D7 /* ApplicationCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplicationCoordinator.swift; sourceTree = "<group>"; };
12BA4B9C224101E700DF93D7 /* BaseCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseCoordinator.swift; sourceTree = "<group>"; };
12BA4B9E224102B700DF93D7 /* LogInCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogInCoordinator.swift; sourceTree = "<group>"; };
12D7D132221C321600B35452 /* ChannelListController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelListController.swift; sourceTree = "<group>"; };
12D7D134221C42B700B35452 /* ChannelController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelController.swift; sourceTree = "<group>"; };
12D7D136221D78E800B35452 /* Channel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Channel.swift; sourceTree = "<group>"; };
@ -116,7 +131,12 @@
12E36DCD22144756006FCDD7 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
12E36DD022148122006FCDD7 /* FullPostController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FullPostController.swift; sourceTree = "<group>"; };
12E36DD422156559006FCDD7 /* MyStackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyStackView.swift; sourceTree = "<group>"; };
12E36DD622159493006FCDD7 /* TagListView.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TagListView.framework; path = Carthage/Build/iOS/TagListView.framework; sourceTree = "<group>"; };
12F3D6AF224106F700A69214 /* TabbarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabbarController.swift; sourceTree = "<group>"; };
12F3D6B12241097B00A69214 /* ProfileCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileCoordinator.swift; sourceTree = "<group>"; };
12F3D6B3224112D600A69214 /* ReactiveMapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReactiveMapKit.framework; path = Carthage/Build/iOS/ReactiveMapKit.framework; sourceTree = "<group>"; };
12F3D6B5224112E000A69214 /* ReactiveSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReactiveSwift.framework; path = Carthage/Build/iOS/ReactiveSwift.framework; sourceTree = "<group>"; };
12F3D6B7224112E800A69214 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = Carthage/Build/iOS/Result.framework; sourceTree = "<group>"; };
12F3D6B9224112F500A69214 /* ReactiveCocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReactiveCocoa.framework; path = Carthage/Build/iOS/ReactiveCocoa.framework; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -125,9 +145,12 @@
buildActionMask = 2147483647;
files = (
12E36DB522143D54006FCDD7 /* TinyConstraints.framework in Frameworks */,
12F3D6B4224112D600A69214 /* ReactiveMapKit.framework in Frameworks */,
124CC7052221C2BB009DF531 /* Alamofire.framework in Frameworks */,
12F3D6BB224112FD00A69214 /* ReactiveCocoa.framework in Frameworks */,
12F3D6B8224112E900A69214 /* Result.framework in Frameworks */,
12F3D6B6224112E100A69214 /* ReactiveSwift.framework in Frameworks */,
12E36DDB221594B1006FCDD7 /* MarkdownKit.framework in Frameworks */,
12E36DD8221594A9006FCDD7 /* TagListView.framework in Frameworks */,
12E36DAF22143D40006FCDD7 /* Cartography.framework in Frameworks */,
123AD0E3223C1C3900326173 /* WSTagsField.framework in Frameworks */,
12E36DB322143D4E006FCDD7 /* Marklight.framework in Frameworks */,
@ -150,19 +173,25 @@
path = Profile;
sourceTree = "<group>";
};
1291BE32222154C3009D3F23 /* Coordinator tab bar? */ = {
1291BE32222154C3009D3F23 /* Coordinators */ = {
isa = PBXGroup;
children = (
12BA4B9A224101A400DF93D7 /* ApplicationCoordinator.swift */,
12F3D6AF224106F700A69214 /* TabbarController.swift */,
12F3D6B12241097B00A69214 /* ProfileCoordinator.swift */,
12BA4B9E224102B700DF93D7 /* LogInCoordinator.swift */,
12BA4B9C224101E700DF93D7 /* BaseCoordinator.swift */,
1291BE2C2221312C009D3F23 /* ChannelsCoordinator.swift */,
1291BE332221569B009D3F23 /* TabbarCoordinator.swift */,
);
path = "Coordinator tab bar?";
path = Coordinators;
sourceTree = "<group>";
};
1291BE3722218DC4009D3F23 /* Log In */ = {
isa = PBXGroup;
children = (
123E37A4221F1B3200F6E42A /* LogInViewController.swift */,
1291BE3522218DBF009D3F23 /* LogInCoordinator.swift */,
1291BE3522218DBF009D3F23 /* LogInCoordinator1.swift */,
);
path = "Log In";
sourceTree = "<group>";
@ -170,9 +199,12 @@
12E36D8F221424EA006FCDD7 = {
isa = PBXGroup;
children = (
12F3D6B9224112F500A69214 /* ReactiveCocoa.framework */,
12F3D6B7224112E800A69214 /* Result.framework */,
12F3D6B5224112E000A69214 /* ReactiveSwift.framework */,
12F3D6B3224112D600A69214 /* ReactiveMapKit.framework */,
123AD0E2223C1C3900326173 /* WSTagsField.framework */,
124CC7042221C2BA009DF531 /* Alamofire.framework */,
12E36DD622159493006FCDD7 /* TagListView.framework */,
12E36DB422143D54006FCDD7 /* TinyConstraints.framework */,
12E36DB222143D4E006FCDD7 /* Marklight.framework */,
12E36DB022143D47006FCDD7 /* MarkdownKit.framework */,
@ -232,8 +264,7 @@
12E36DCF22145923006FCDD7 /* Controller */ = {
isa = PBXGroup;
children = (
1253867C2223DC9F00CC5EA7 /* RepeatingTimer.swift */,
1291BE32222154C3009D3F23 /* Coordinator tab bar? */,
1291BE32222154C3009D3F23 /* Coordinators */,
1291BE3722218DC4009D3F23 /* Log In */,
1288B5CC221F0EFE002BE6B1 /* Profile */,
12E36DD322156519006FCDD7 /* News and channels */,
@ -250,7 +281,6 @@
12E36DC922144635006FCDD7 /* NewPostViewController.swift */,
12E36DD022148122006FCDD7 /* FullPostController.swift */,
12E36D9D221424EA006FCDD7 /* NewsController.swift */,
1291BE2C2221312C009D3F23 /* ChannelsCoordinator.swift */,
125BD5802217314A008A3575 /* NewsVC.swift */,
12E36DCB22144725006FCDD7 /* PostViewCell.swift */,
);
@ -297,6 +327,11 @@
TargetAttributes = {
12E36D97221424EA006FCDD7 = {
CreatedOnToolsVersion = 10.1;
SystemCapabilities = {
com.apple.Keychain = {
enabled = 0;
};
};
};
};
};
@ -337,9 +372,10 @@
buildActionMask = 2147483647;
files = (
124CC7032221C00C009DF531 /* Model.swift in Sources */,
12F3D6B0224106F700A69214 /* TabbarController.swift in Sources */,
12E36DD522156559006FCDD7 /* MyStackView.swift in Sources */,
12D7D137221D78E800B35452 /* Channel.swift in Sources */,
1291BE3622218DBF009D3F23 /* LogInCoordinator.swift in Sources */,
1291BE3622218DBF009D3F23 /* LogInCoordinator1.swift in Sources */,
12E36DB922144016006FCDD7 /* User.swift in Sources */,
1210A0BB223940310080686D /* SimplifiedChannelsList.swift in Sources */,
125BD5812217314A008A3575 /* NewsVC.swift in Sources */,
@ -352,15 +388,18 @@
125BD57F22171D73008A3575 /* Extentions.swift in Sources */,
12D7D133221C321600B35452 /* ChannelListController.swift in Sources */,
1291BE342221569B009D3F23 /* TabbarCoordinator.swift in Sources */,
12BA4B9B224101A400DF93D7 /* ApplicationCoordinator.swift in Sources */,
1291BE2D2221312D009D3F23 /* ChannelsCoordinator.swift in Sources */,
12E36DD122148122006FCDD7 /* FullPostController.swift in Sources */,
1288B5CE221F1158002BE6B1 /* DataStorage.swift in Sources */,
12BA4B9F224102B700DF93D7 /* LogInCoordinator.swift in Sources */,
12F3D6B22241097B00A69214 /* ProfileCoordinator.swift in Sources */,
125BD57D22171D2A008A3575 /* ProfileViewController.swift in Sources */,
1253867D2223DC9F00CC5EA7 /* RepeatingTimer.swift in Sources */,
12DB7FDB2218590C0096878E /* InfoCell.swift in Sources */,
12DB7FD922181E660096878E /* BasicInfoCell.swift in Sources */,
12D7D135221C42B700B35452 /* ChannelController.swift in Sources */,
12E36D9C221424EA006FCDD7 /* AppDelegate.swift in Sources */,
12BA4B9D224101E700DF93D7 /* BaseCoordinator.swift in Sources */,
12DB7FD722181CD20096878E /* BasicInfoController.swift in Sources */,
12E36DCE22144756006FCDD7 /* Constants.swift in Sources */,
12DB7FDD221872F80096878E /* SettingsViewController.swift in Sources */,
@ -510,6 +549,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 9Z6LFGKA9G;
FRAMEWORK_SEARCH_PATHS = (
@ -521,8 +561,9 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = rednikina.com.drHSE.GDproject;
PRODUCT_BUNDLE_IDENTIFIER = rednikina.com.drHSE.GDproject.sos;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
@ -532,6 +573,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 9Z6LFGKA9G;
FRAMEWORK_SEARCH_PATHS = (
@ -543,8 +585,9 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = rednikina.com.drHSE.GDproject;
PRODUCT_BUNDLE_IDENTIFIER = rednikina.com.drHSE.GDproject.sos;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<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">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
@ -20,7 +20,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<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">
<rect key="frame" x="0.0" y="116" width="375" height="502"/>
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<view key="tableHeaderView" contentMode="scaleToFill" id="kFZ-3c-OFY">
<rect key="frame" x="0.0" y="0.0" width="375" height="199"/>
@ -416,55 +416,6 @@
</objects>
<point key="canvasLocation" x="3444" y="129.98500749625188"/>
</scene>
<!--Log In View Controller-->
<scene sceneID="Pkd-pB-bQs">
<objects>
<viewController storyboardIdentifier="LogInController" id="ZCz-70-hDh" customClass="LogInViewController" customModule="GDproject" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="1q2-4g-KZs">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="UwC-m5-jA5">
<rect key="frame" x="16" y="100" width="343" height="83"/>
<subviews>
<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">
<rect key="frame" x="0.0" y="0.0" width="343" height="41"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="34"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Mail" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="mFP-WG-jY5">
<rect key="frame" x="0.0" y="53" width="343" height="30"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
</stackView>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="K3b-gv-JPp">
<rect key="frame" x="177.5" y="333.5" width="20" height="20"/>
</activityIndicatorView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="UwC-m5-jA5" firstAttribute="leading" secondItem="LOR-Yw-0FU" secondAttribute="leading" constant="16" id="M6z-nU-H40"/>
<constraint firstItem="K3b-gv-JPp" firstAttribute="centerY" secondItem="LOR-Yw-0FU" secondAttribute="centerY" id="eOp-yQ-n28"/>
<constraint firstItem="K3b-gv-JPp" firstAttribute="centerX" secondItem="LOR-Yw-0FU" secondAttribute="centerX" id="gdW-VU-pE8"/>
<constraint firstItem="LOR-Yw-0FU" firstAttribute="trailing" secondItem="UwC-m5-jA5" secondAttribute="trailing" constant="16" id="jST-rr-MMX"/>
<constraint firstItem="UwC-m5-jA5" firstAttribute="top" secondItem="LOR-Yw-0FU" secondAttribute="top" constant="80" id="rvy-Ii-bwS"/>
</constraints>
<viewLayoutGuide key="safeArea" id="LOR-Yw-0FU"/>
</view>
<connections>
<outlet property="indicatorView" destination="K3b-gv-JPp" id="mSR-QU-VZQ"/>
<outlet property="mailTextField" destination="mFP-WG-jY5" id="7SN-qe-DDm"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="6e8-oo-bbc" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-466" y="-821"/>
</scene>
<!--Posts-->
<scene sceneID="RSd-UJ-34B">
<objects>
@ -476,9 +427,6 @@
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="Nqc-TI-ueQ" kind="relationship" relationship="rootViewController" id="2BZ-i4-uIE"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="POV-5T-jeQ" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
@ -515,31 +463,15 @@
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="R4D-Ao-uvG" kind="relationship" relationship="rootViewController" id="aF6-zK-hCB"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Fvm-qf-2Ve" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1089" y="958"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="r0M-xH-UwU">
<objects>
<navigationController storyboardIdentifier="root" id="609-2j-gc9" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="Ah8-NU-AsD">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Raj-78-jlT" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-2242" y="68"/>
</scene>
<!--Tab Bar Controller-->
<!--Tabbar Controller-->
<scene sceneID="HCR-WO-p7g">
<objects>
<tabBarController storyboardIdentifier="TabBar" automaticallyAdjustsScrollViewInsets="NO" id="IeP-4W-8LT" sceneMemberID="viewController">
<tabBarController storyboardIdentifier="TabbarController" automaticallyAdjustsScrollViewInsets="NO" id="IeP-4W-8LT" customClass="TabbarController" customModule="GDproject" customModuleProvider="target" sceneMemberID="viewController">
<toolbarItems/>
<tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="3pl-mU-U30">
<rect key="frame" x="0.0" y="0.0" width="1000" height="1000"/>

View File

@ -6,6 +6,7 @@
// Copyright © 2019 drHSE. All rights reserved.
//
import UIKit
/// constant for cell in posts NewsController.swift
let postCellId = "PostCell"
@ -46,3 +47,6 @@ let logInController = "LogInController"
let profileViewController = "ProfileViewController"
let simplifiedChannelsList = "SimplifiedChannelsList"
let blueSystemColor = UIColor(red: 0, green: 137/255, blue: 249/255, alpha: 0.5)

View File

@ -1,55 +0,0 @@
//
// ChannelsCoordinator.swift
// GDproject
//
// Created by cstore on 23/02/2019.
// Copyright © 2019 drHSE. All rights reserved.
//
import Foundation
import UIKit
final class ChannelsCoordinator{
// MARK: - Properties
private var channel: Model.Channels { didSet { updateInterfaces() } }
private weak var navigationController: UINavigationController?
// MARK:- Init
init(currentChannel: Model.Channels, navigationController: UINavigationController) {
self.channel = currentChannel
self.navigationController = navigationController
}
func start(){
showCurrentChannel()
}
// MARK: - Private implementation
private func showListOfChannels(){
let controller = UIStoryboard.makeChannelsListController()
controller.onChannelSelected = { [weak self] channel
in
self?.channel = channel
_ = self?.navigationController?.popViewController(animated: true)
}
navigationController?.pushViewController(controller, animated: true)
}
private func showCurrentChannel(){
let controller = UIStoryboard.makeNewsController()
controller.channel = channel
controller.onSelectChannel = { [weak self] in
self?.showListOfChannels()
}
navigationController?.setViewControllers([controller], animated: false)
//navigationController?.pushViewController(controller, animated: false)
}
// MARK:- update only viewControllers which are depandable on chosen channel
private func updateInterfaces() {
navigationController?.viewControllers.forEach {
($0 as? UpdateableWithChannel)?.channel = channel
}
}
}

View File

@ -0,0 +1,69 @@
//
// ApplicationCoordinator.swift
// RxSwift
//
// Created by cstore on 04/03/2019.
// Copyright © 2019 drHSE. All rights reserved.
//
import Foundation
import UIKit
fileprivate enum LaunchInstructor {
case main, auth
static func configure(
isAutorized: Bool = DataStorage.standard.isLoggedIn) -> LaunchInstructor {
if isAutorized{
return .main
} else {
return .auth
}
}
}
final class ApplicationCoordinator: BaseCoordinator{
private var window: UIWindow!
init(window: UIWindow) {
self.window = window
}
private var instructor: LaunchInstructor {
return LaunchInstructor.configure()
}
override func start() {
switch instructor {
case .auth: runAuthFlow()
case .main: runMainFlow()
}
}
private func runAuthFlow() {
let coordinator = LogInCoordinator(window: window)
coordinator.didEndFlow = { [weak self, weak coordinator] in
self?.start()
self?.removeDependency(coordinator)
}
addDependency(coordinator)
coordinator.start()
}
private func runMainFlow() {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let tabBar = storyboard.instantiateViewController(withIdentifier: "TabbarController") as! TabbarController
let coordinator = TabBarCoordinator(tabbarView: tabBar, window: window!)
coordinator.didEndFlow = { [weak self, weak coordinator] in
self?.start()
self?.removeDependency(coordinator)
}
addDependency(coordinator)
coordinator.start()
}
}

View File

@ -0,0 +1,47 @@
//
// BaseCoordinator.swift
// RxSwift
//
// Created by cstore on 02/03/2019.
// Copyright © 2019 drHSE. All rights reserved.
//
import Foundation
import UIKit
protocol Coordinator: class {
func start()
}
class BaseCoordinator: Coordinator {
var childCoordinators: [Coordinator] = []
func start() {
}
// add only unique object
func addDependency(_ coordinator: Coordinator) {
guard !childCoordinators.contains(where: { $0 === coordinator }) else { return }
childCoordinators.append(coordinator)
}
func removeDependency(_ coordinator: Coordinator?) {
guard
childCoordinators.isEmpty == false,
let coordinator = coordinator
else { return }
// Clear child-coordinators recursively
if let coordinator = coordinator as? BaseCoordinator, !coordinator.childCoordinators.isEmpty {
coordinator.childCoordinators
.filter({ $0 !== coordinator })
.forEach({ coordinator.removeDependency($0) })
}
for (index, element) in childCoordinators.enumerated() where element === coordinator {
childCoordinators.remove(at: index)
break
}
}
}

View File

@ -0,0 +1,28 @@
//
// ChannelsCoordinator.swift
// RxSwift
//
// Created by cstore on 03/03/2019.
// Copyright © 2019 drHSE. All rights reserved.
//
import Foundation
import UIKit
class ChannelsCoordinator: BaseCoordinator{
private weak var navigationController: UINavigationController?
init(nc: UINavigationController) {
self.navigationController = nc
}
override func start() {
show()
}
private func show() {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let channels = storyboard.instantiateViewController(withIdentifier: channelListControllerId) as! ChannelListController
navigationController?.setViewControllers([channels], animated: false)
}
}

View File

@ -0,0 +1,41 @@
//
// LogInCoordinator.swift
// RxSwift
//
// Created by cstore on 01/03/2019.
// Copyright © 2019 drHSE. All rights reserved.
//
import UIKit
class LogInCoordinator: BaseCoordinator {
var didEndFlow: (()->())?
var window: UIWindow!
var navigationController: UINavigationController?
init(window: UIWindow) {
self.window = window
self.window?.rootViewController = UINavigationController()
self.navigationController = window.rootViewController as? UINavigationController
}
override func start(){
let logInVC = LogInViewController()
logInVC.authenticate = { [weak self] (id) in
Model.authenticate(with: id) {
(res) in
if (res) {
DataStorage.standard.setUserKey(with: id)
self?.didEndFlow?()
}
else {
DataStorage.standard.setUserKey(with: 0)
}
}
}
navigationController?.pushViewController(logInVC, animated: false)
}
}

View File

@ -0,0 +1,52 @@
//
// ProfileCoordinator.swift
// RxSwift
//
// Created by cstore on 02/03/2019.
// Copyright © 2019 drHSE. All rights reserved.
//
import Foundation
import UIKit
class ProfileCoordinator: BaseCoordinator {
var didEndSession: (()->())?
private weak var navigationController: UINavigationController?
init(nc: UINavigationController) {
self.navigationController = nc
}
override func start() {
show()
}
private func show() {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let profile = storyboard.instantiateViewController(withIdentifier: "ProfileViewController") as! ProfileViewController
profile.logOut = { [weak self] in
DataStorage.standard.setIsLoggedIn(value: false, with: 0)
self?.didEndSession?()
}
profile.onSettings = { [weak self, weak storyboard] in
let vc = storyboard?.instantiateViewController(withIdentifier: "SettingsViewController") as! SettingsViewController
self?.navigationController?.pushViewController(vc, animated: true)
}
profile.onChannelsListToAddAPerson = { [weak self, weak storyboard] (user) in
let vc = storyboard?.instantiateViewController(withIdentifier: simplifiedChannelsList) as! SimplifiedChannelsList
vc.user = user
let transition = CATransition()
transition.duration = 0.5
transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
transition.type = CATransitionType.moveIn
transition.subtype = CATransitionSubtype.fromTop
self?.navigationController?.view.layer.add(transition, forKey: nil)
self?.navigationController?.pushViewController(vc, animated: false)
}
navigationController?.setViewControllers([profile], animated: false)
}
}

View File

@ -0,0 +1,45 @@
//
// TabbarController.swift
// RxSwift
//
// Created by cstore on 03/03/2019.
// Copyright © 2019 drHSE. All rights reserved.
//
import Foundation
import UIKit
protocol TabbarView: class {
var onChannelsFlowSelect: ((UINavigationController) -> ())? { get set }
var onProfileFlowSelect: ((UINavigationController) -> ())? { get set }
var onViewDidLoad: ((UINavigationController) -> ())? { get set }
}
final class TabbarController: UITabBarController, UITabBarControllerDelegate, TabbarView {
var onChannelsFlowSelect: ((UINavigationController) -> ())?
var onProfileFlowSelect: ((UINavigationController) -> ())?
var onViewDidLoad: ((UINavigationController) -> ())?
override func viewDidLoad() {
super.viewDidLoad()
delegate = self
if let controller = customizableViewControllers?.first as? UINavigationController {
onViewDidLoad?(controller)
}
}
func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController)
{
guard let controller = viewControllers?[selectedIndex] as? UINavigationController else { return }
if selectedIndex == 0 {
onChannelsFlowSelect?(controller)
} else {
onProfileFlowSelect?(controller)
}
}
}

View File

@ -0,0 +1,57 @@
//
// TabBarCoordinator.swift
// RxSwift
//
// Created by cstore on 02/03/2019.
// Copyright © 2019 drHSE. All rights reserved.
//
import Foundation
import UIKit
class TabBarCoordinator: BaseCoordinator {
var didEndFlow: (()->())?
private let tabbarView: TabbarView
private let window: UIWindow?
init(tabbarView: TabbarView, window: UIWindow) {
self.tabbarView = tabbarView
self.window = window
}
override func start() {
tabbarView.onViewDidLoad = runChannelsFlow()
tabbarView.onChannelsFlowSelect = runChannelsFlow()
tabbarView.onProfileFlowSelect = runProfileFlow()
window?.rootViewController = tabbarView as! TabbarController
}
private func runChannelsFlow() -> ((UINavigationController) -> ())
{
return { [unowned self] navController in
if navController.viewControllers.isEmpty == true {
let channelCoordinator = ChannelsCoordinator(nc: navController)
self.addDependency(channelCoordinator)
channelCoordinator.start()
}
}
}
private func runProfileFlow() -> ((UINavigationController) -> ())
{
return { [unowned self] navController in
if navController.viewControllers.isEmpty == true {
let profileCoordinator = ProfileCoordinator(nc: navController)
profileCoordinator.didEndSession = { [weak self, weak profileCoordinator] in
self?.removeDependency(profileCoordinator)
self?.didEndFlow?()
}
self.addDependency(profileCoordinator)
profileCoordinator.start()
}
}
}
}

View File

@ -1,48 +0,0 @@
//
// LogInCoordinator.swift
// GDproject
//
// Created by cstore on 23/02/2019.
// Copyright © 2019 drHSE. All rights reserved.
//
import UIKit
class LogInCoordinator{
private weak var navigationController: UINavigationController?
private var window: UIWindow!
// MARK:- Init
init(navigationController: UINavigationController, window: UIWindow) {
self.navigationController = navigationController
self.window = window
}
func start(){
showLogInPage()
}
// MARK: - Private implementation
// private func showStatusPage(){
// let controller = TabbarCoordinator(window: window)
// controller.start()
// }
private func showLogInPage(){
let controller = UIStoryboard.makeLogIn()
controller.onLogIn = {
(id) in Model.authenticate(with: id) {
(res) in
if (res) { DataStorage.standard.setUserKey(with: id) }
else { DataStorage.standard.setUserKey(with: 0) }
controller.authenticateSucceeded = res
}
}
navigationController?.pushViewController(controller, animated: false)
}
}

View File

@ -0,0 +1,48 @@
////
//// LogInCoordinator.swift
//// GDproject
////
//// Created by cstore on 23/02/2019.
//// Copyright © 2019 drHSE. All rights reserved.
////
//
//import UIKit
//
//class LogInCoordinator{
//
// private weak var navigationController: UINavigationController?
// private var window: UIWindow!
// // MARK:- Init
// init(navigationController: UINavigationController, window: UIWindow) {
// self.navigationController = navigationController
// self.window = window
// }
//
// func start(){
// showLogInPage()
// }
//
// // MARK: - Private implementation
//// private func showStatusPage(){
//// let controller = TabbarCoordinator(window: window)
//// controller.start()
//// }
//
// private func showLogInPage(){
// let controller = UIStoryboard.makeLogIn()
//
// controller.onLogIn = {
// (id) in Model.authenticate(with: id) {
// (res) in
//
// if (res) { DataStorage.standard.setUserKey(with: id) }
// else { DataStorage.standard.setUserKey(with: 0) }
//
// controller.authenticateSucceeded = res
// }
// }
//
// navigationController?.pushViewController(controller, animated: false)
// }
//
//}

View File

@ -1,128 +1,110 @@
//
// LogInViewController.swift
// NewsFeed
// RxSwift
//
// Created by cstore on 20/01/2019.
// Created by cstore on 01/03/2019.
// Copyright © 2019 drHSE. All rights reserved.
//
import UIKit
import TinyConstraints
import ReactiveSwift
import ReactiveCocoa
import Result
class LogInViewController: UIViewController {
@IBOutlet weak var mailTextField: UITextField!
var authenticate: ((Int)->())?
@IBOutlet weak var indicatorView: UIActivityIndicatorView!
let logInLabel: UILabel = {
let label = UILabel()
label.text = "Log In"
label.textColor = .black
label.font = UIFont.boldSystemFont(ofSize: 34)
return label
}()
var onLogIn: ((Int)->())?
var authenticateSucceeded: Bool? {
didSet {
if !authenticateSucceeded! {
indicatorView.stopAnimating()
indicatorView.isHidden = true
}
}
}
static let titleColor = UIColor(red: 0, green: 137/255, blue: 249/255, alpha: 0.5)
var bottomConstraint: NSLayoutConstraint?
let mailTextField: UITextField = {
let textField = UITextField()
textField.backgroundColor = #colorLiteral(red: 0.937254902, green: 0.937254902, blue: 0.9568627451, alpha: 1)
textField.placeholder = "Mail"
textField.borderStyle = .roundedRect
textField.textColor = .black
textField.clearButtonMode = .always
return textField
}()
let logInButton: UIButton = {
let button = UIButton(type: .system)
button.setTitle("Log In", for: .normal)
button.setTitleColor(titleColor, for: .normal)
button.setTitleColor(blueSystemColor, for: .normal)
button.titleLabel?.font = UIFont.boldSystemFont(ofSize: 16)
button.addTarget(self, action: #selector(handleTap), for: .touchUpInside)
button.isEnabled = false
button.addTarget(self, action: #selector(activateLogInProcess), for: .touchUpInside)
return button
}()
let keyboardBar: UIView = {
let view = UIView()
view.backgroundColor = .white
return view
}()
@objc func handleTap(){
authenticate?(Int(mailTextField.text!)!)
}
private lazy var keyboardBar = UIView()
private lazy var contentView = UIView()
private var bottomConstraint: NSLayoutConstraint?
func setUpView(){
// logIn stack with textField and label
view.addSubview(contentView)
contentView.edgesToSuperview(excluding: .bottom, insets: .left(16) + .right(16) + .top(80), usingSafeArea: true)
let views = [logInLabel, mailTextField]
contentView.stack(views, axis: .vertical, spacing: 10)
}
func configureKeyboard(){
// configure keyboardBar setUp
view.addSubview(keyboardBar)
keyboardBar.height(50)
keyboardBar.edgesToSuperview(excluding: [.top,.bottom])
bottomConstraint = NSLayoutConstraint(item: keyboardBar, attribute: .bottom, relatedBy: .equal, toItem: view.safeAreaLayoutGuide, attribute: .bottom, multiplier: 1, constant: 0)
view.addConstraint(bottomConstraint!)
// configure keyboardBar components
keyboardBar.addSubview(logInButton)
logInButton.height(50)
logInButton.leftToSuperview(view.leftAnchor, offset: 16, relation: .equal, isActive: true)
}
func logicOfLogInInputValidation() -> ((String?)->()) {
let logic: ((String?)->()) = { [weak self] (someText) in
if let text = someText, !text.isEmpty, let id = Int(text) {
self?.logInButton.isEnabled = true
} else {
self?.logInButton.isEnabled = false
}
}
return logic
}
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .white
setUpView()
configureTapgesture()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
}
private func configureTapgesture(){
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap))
view.addGestureRecognizer(tapGesture)
}
@objc func handleTap(){
view.endEditing(true)
}
@objc func activateLogInProcess(){
if logInButton.isEnabled {
// MARK:- when log in is succeeded do I need to go there?
if let id = Int(mailTextField.text!){
indicatorView.isHidden = false
indicatorView.startAnimating()
onLogIn?(id)
view.endEditing(true)
} else {
logInButton.isEnabled = false
logInButton.setTitleColor(LogInViewController.titleColor.withAlphaComponent(0.5), for: .normal)
}
}
}
func setUpView(){
indicatorView.isHidden = true
mailTextField.delegate = self
view.addSubview(keyboardBar)
configureKeyboard()
view.addConstraintsWithFormat(format: "H:|[v0]|", views: keyboardBar)
view.addConstraintsWithFormat(format: "V:[v0(50)]", views: keyboardBar)
let mailFieldValuesSignal: Signal<String?, NoError> = mailTextField.reactive.continuousTextValues
setUpBarComponents()
configureKeyboardBehavior()
}
func configureKeyboardBehavior(){
bottomConstraint = NSLayoutConstraint(item: keyboardBar, attribute: .bottom, relatedBy: .equal, toItem: view.safeAreaLayoutGuide, attribute: .bottom, multiplier: 1, constant: 0)
view.addConstraint(bottomConstraint!)
mailFieldValuesSignal.observeValues(logicOfLogInInputValidation())
// for keyboard notifications
NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotifications), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotifications), name: UIResponder.keyboardWillHideNotification, object: nil)
// for log in button notifications
NotificationCenter.default.addObserver(self, selector: #selector(inputDidChanged), name: UITextField.textDidChangeNotification, object: mailTextField)
NotificationCenter.default.addObserver(self, selector: #selector(inputDidChanged), name: UITextField.textDidBeginEditingNotification, object: mailTextField)
}
@objc func inputDidChanged(notification: NSNotification){
if mailTextField.text?.isEmpty ?? true
{
logInButton.isEnabled = false
logInButton.setTitleColor(LogInViewController.titleColor.withAlphaComponent(0.5), for: .normal)
}
else
{
logInButton.isEnabled = true
logInButton.setTitleColor(LogInViewController.titleColor.withAlphaComponent(1), for: .normal)
}
}
@objc func handleKeyboardNotifications(notification: NSNotification){
if let userInfo = notification.userInfo{
@ -136,18 +118,13 @@ class LogInViewController: UIViewController {
}
}
func setUpBarComponents(){
keyboardBar.addSubview(logInButton)
keyboardBar.addConstraintsWithFormat(format: "H:[v0(60)]-16-|", views: logInButton)
keyboardBar.addConstraintsWithFormat(format: "V:|[v0]|", views: logInButton)
}
}
extension LogInViewController: UITextFieldDelegate{
func textFieldShouldReturn(_ textField: UITextField) -> Bool
{
textField.resignFirstResponder()
return true
extension UIButton {
override open var isEnabled: Bool {
didSet {
let color = isEnabled ? self.titleLabel?.textColor.withAlphaComponent(1) : self.titleLabel?.textColor.withAlphaComponent(0.5)
self.setTitleColor(color, for: .normal)
}
}
}

View File

@ -30,6 +30,12 @@ class ProfileViewController: UIViewController
@IBOutlet weak var newMessageButton: UIButton!
var logOut: (()->())?
var onSettings: (()->())?
var onChannelsListToAddAPerson: ((Model.Users)->())?
var protoDictionary: [Int: UIImage] = [9: #imageLiteral(resourceName: "9"), 5051: #imageLiteral(resourceName: "5051"), 69: #imageLiteral(resourceName: "69"), 42: #imageLiteral(resourceName: "42")]
func fill(with user: Model.Users){
@ -76,8 +82,6 @@ class ProfileViewController: UIViewController
{
super.viewDidLoad()
posts.viewController = self
posts.type = .NONE
@ -99,6 +103,7 @@ class ProfileViewController: UIViewController
var idProfile: Int?
override func viewWillAppear(_ animated: Bool) {
if idProfile == nil {
idProfile = DataStorage.standard.getUserId()
}
@ -111,8 +116,6 @@ class ProfileViewController: UIViewController
self?.user = dic[id]
}
}
// requst for postsforuser was here. moved because of concrr
}
setUpNavigarionBar()
@ -120,56 +123,35 @@ class ProfileViewController: UIViewController
func setUpNavigarionBar(){
navigationController?.navigationBar.prefersLargeTitles = true
//navigationItem.title = "\(user?.id ?? 0)"
let uibarbutton = UIBarButtonItem(title: "More", style: .plain, target: self, action: #selector(showInformation))
navigationItem.rightBarButtonItems = [uibarbutton]
navigationItem.largeTitleDisplayMode = .always
}
let copyLink: UIAlertAction = {
let b = UIAlertAction(title: "Copy link", style: .default)
return b
}()
@objc func showInformation(){
// drafts
// saved
let optionMenu = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
let channelAction = UIAlertAction(title: "Add to a channel", style: .default){
[weak self] (_) in
let vc = self?.storyboard?.instantiateViewController(withIdentifier: simplifiedChannelsList) as! SimplifiedChannelsList
vc.user = self?.user!
let transition = CATransition()
transition.duration = 0.5
transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
transition.type = CATransitionType.moveIn
transition.subtype = CATransitionSubtype.fromTop
self?.navigationController?.view.layer.add(transition, forKey: nil)
self?.navigationController?.pushViewController(vc, animated: false)
self?.onChannelsListToAddAPerson?(self!.user!)
}
let settingsAction = UIAlertAction(title: "Setting", style: .default)
{ [weak self] (_) in
let vc = self?.storyboard?.instantiateViewController(withIdentifier: "SettingsViewController") as! SettingsViewController
self?.navigationController?.pushViewController(vc, animated: true)
self?.onSettings?()
}
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel)
let logoutAction = UIAlertAction(title: "Log out", style: .destructive)
{
{ [weak self]
(_) in
DataStorage.standard.setIsLoggedIn(value: false, with: 0)
self?.logOut?()
}
optionMenu.addAction(channelAction)
optionMenu.addAction(settingsAction)
optionMenu.addAction(copyLink)
optionMenu.addAction(logoutAction)
optionMenu.addAction(cancelAction)

View File

@ -1,59 +0,0 @@
/// RepeatingTimer mimics the API of DispatchSourceTimer but in a way that prevents
/// crashes that occur from calling resume multiple times on a timer that is
/// already resumed (noted by https://github.com/SiftScience/sift-ios/issues/52
import Foundation
class RepeatingTimer {
let timeInterval: TimeInterval
init(timeInterval: TimeInterval) {
self.timeInterval = timeInterval
}
private lazy var timer: DispatchSourceTimer = {
let t = DispatchSource.makeTimerSource()
t.schedule(deadline: .now() + self.timeInterval, repeating: self.timeInterval)
t.setEventHandler(handler: { [weak self] in
self?.eventHandler?()
})
return t
}()
var eventHandler: (() -> Void)?
private enum State {
case suspended
case resumed
}
private var state: State = .suspended
deinit {
timer.setEventHandler {}
timer.cancel()
/*
If the timer is suspended, calling cancel without resuming
triggers a crash. This is documented here https://forums.developer.apple.com/thread/15902
*/
resume()
eventHandler = nil
}
func resume() {
if state == .resumed {
return
}
state = .resumed
timer.resume()
}
func suspend() {
if state == .suspended {
return
}
state = .suspended
timer.suspend()
}
}

View File

@ -40,15 +40,7 @@ class DataStorage{
/**
Function to determine is user logged in already or not
*/
var isLoggedIn: Bool = UserDefaults.standard.bool(forKey: UserDefaultsKeys.loggedIn.rawValue) {
didSet{
if isLoggedIn && getUserId() != 0 {
(UIApplication.shared.delegate as? AppDelegate)?.tabCoordinator.start()
} else {
(UIApplication.shared.delegate as? AppDelegate)?.logInAgain()
}
}
}
var isLoggedIn: Bool = UserDefaults.standard.bool(forKey: UserDefaultsKeys.loggedIn.rawValue)
}
/**

View File

@ -12,57 +12,21 @@ import UIKit
class AppDelegate: UIResponder, UIApplicationDelegate {
var coordinator: LogInCoordinator!
var tabCoordinator: TabbarCoordinator!
var window: UIWindow?
var rootController: UINavigationController? {
return self.window!.rootViewController as? UINavigationController
}
func logInAgain(){
let root = UIStoryboard.navRoot()
window?.rootViewController = root
window?.makeKeyAndVisible()
coordinator = LogInCoordinator(navigationController: root, window: UIApplication.shared.keyWindow!)
coordinator!.start()
}
var appCoordinator: ApplicationCoordinator!
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
{
coordinator = LogInCoordinator(navigationController: rootController!, window: window!)
tabCoordinator = TabbarCoordinator(window: window!)
// TODO:- determine what to do here: log in or tabbar
if DataStorage.standard.isLoggedIn {
tabCoordinator.start()
} else {
coordinator.start()
}
window = UIWindow(frame: UIScreen.main.bounds)
window?.makeKeyAndVisible()
// window?.rootViewController = UINavigationController()
appCoordinator = ApplicationCoordinator(window: window!)
appCoordinator.start()
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// 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.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// 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.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// 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.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// 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.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}