git.iko.soy/dashared/GDproject
on 5334c41 help sign in
GDproject.xcodeproj/project.pbxproj−4
since splitsnapshots
unifiedsplit
@@ -10,7 +10,6 @@
10 1210A0BB223940310080686D /* SimplifiedChannelsList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1210A0BA223940310080686D /* SimplifiedChannelsList.swift */; };
10 1210A0BB223940310080686D /* SimplifiedChannelsList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1210A0BA223940310080686D /* SimplifiedChannelsList.swift */; };
11 121A8972226B1EAC005EE599 /* TagsSuggestionController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 121A8971226B1EAC005EE599 /* TagsSuggestionController.swift */; };
11 121A8972226B1EAC005EE599 /* TagsSuggestionController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 121A8971226B1EAC005EE599 /* TagsSuggestionController.swift */; };
12 1220FF94227C41270092C6BC /* TaggsSelectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1220FF93227C41270092C6BC /* TaggsSelectionViewController.swift */; };
12 1220FF94227C41270092C6BC /* TaggsSelectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1220FF93227C41270092C6BC /* TaggsSelectionViewController.swift */; };
13− 123589FD22899339002F8028 /* MessageViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 123589FC22899339002F8028 /* MessageViewCell.swift */; };
14 123E37A5221F1B3200F6E42A /* LogInViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 123E37A4221F1B3200F6E42A /* LogInViewController.swift */; };
13 123E37A5221F1B3200F6E42A /* LogInViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 123E37A4221F1B3200F6E42A /* LogInViewController.swift */; };
15 123E37A7221F1DD700F6E42A /* MainController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 123E37A6221F1DD700F6E42A /* MainController.swift */; };
14 123E37A7221F1DD700F6E42A /* MainController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 123E37A6221F1DD700F6E42A /* MainController.swift */; };
16 124CC7032221C00C009DF531 /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = 124CC7022221C00C009DF531 /* Model.swift */; };
15 124CC7032221C00C009DF531 /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = 124CC7022221C00C009DF531 /* Model.swift */; };
@@ -109,7 +108,6 @@
109 1210A0BA223940310080686D /* SimplifiedChannelsList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimplifiedChannelsList.swift; sourceTree = "<group>"; };
108 1210A0BA223940310080686D /* SimplifiedChannelsList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimplifiedChannelsList.swift; sourceTree = "<group>"; };
110 121A8971226B1EAC005EE599 /* TagsSuggestionController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagsSuggestionController.swift; sourceTree = "<group>"; };
109 121A8971226B1EAC005EE599 /* TagsSuggestionController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagsSuggestionController.swift; sourceTree = "<group>"; };
111 1220FF93227C41270092C6BC /* TaggsSelectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TaggsSelectionViewController.swift; sourceTree = "<group>"; };
110 1220FF93227C41270092C6BC /* TaggsSelectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TaggsSelectionViewController.swift; sourceTree = "<group>"; };
112− 123589FC22899339002F8028 /* MessageViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageViewCell.swift; sourceTree = "<group>"; };
113 123E37A4221F1B3200F6E42A /* LogInViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogInViewController.swift; sourceTree = "<group>"; };
111 123E37A4221F1B3200F6E42A /* LogInViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogInViewController.swift; sourceTree = "<group>"; };
114 123E37A6221F1DD700F6E42A /* MainController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainController.swift; sourceTree = "<group>"; };
112 123E37A6221F1DD700F6E42A /* MainController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainController.swift; sourceTree = "<group>"; };
115 124CC7022221C00C009DF531 /* Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Model.swift; sourceTree = "<group>"; };
113 124CC7022221C00C009DF531 /* Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Model.swift; sourceTree = "<group>"; };
@@ -240,7 +238,6 @@
240 129320082279C3B50035C7B3 /* PeopleToWriteViewController.swift */,
238 129320082279C3B50035C7B3 /* PeopleToWriteViewController.swift */,
241 1298810C227F138C0032ACA3 /* Dialog */,
239 1298810C227F138C0032ACA3 /* Dialog */,
242 129320032279B4270035C7B3 /* MessagesViewController.swift */,
240 129320032279B4270035C7B3 /* MessagesViewController.swift */,
243− 123589FC22899339002F8028 /* MessageViewCell.swift */,
244 );
241 );
245 path = Messages;
242 path = Messages;
246 sourceTree = "<group>";
243 sourceTree = "<group>";
@@ -454,7 +451,6 @@
454 1298810B227F13840032ACA3 /* DialogCell.swift in Sources */,
451 1298810B227F13840032ACA3 /* DialogCell.swift in Sources */,
455 125A9A922286100800513E2A /* FacultyTableViewController.swift in Sources */,
452 125A9A922286100800513E2A /* FacultyTableViewController.swift in Sources */,
456 125A9A8E2286068A00513E2A /* RegisterTableViewController.swift in Sources */,
453 125A9A8E2286068A00513E2A /* RegisterTableViewController.swift in Sources */,
457− 123589FD22899339002F8028 /* MessageViewCell.swift in Sources */,
458 12E36DCC22144725006FCDD7 /* PostViewCell.swift in Sources */,
454 12E36DCC22144725006FCDD7 /* PostViewCell.swift in Sources */,
459 123E37A5221F1B3200F6E42A /* LogInViewController.swift in Sources */,
455 123E37A5221F1B3200F6E42A /* LogInViewController.swift in Sources */,
460 125BD57F22171D73008A3575 /* Extentions.swift in Sources */,
456 125BD57F22171D73008A3575 /* Extentions.swift in Sources */,
GDproject/Base.lproj/Main.storyboard+27−44
@@ -248,37 +248,37 @@
248 <stackView opaque="NO" contentMode="scaleToFill" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="2Gj-pC-RZ2">
248 <stackView opaque="NO" contentMode="scaleToFill" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="2Gj-pC-RZ2">
249 <rect key="frame" x="37.5" y="99" width="300" height="58"/>
249 <rect key="frame" x="37.5" y="99" width="300" height="58"/>
250 <subviews>
250 <subviews>
251− <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="_" textAlignment="center" adjustsFontSizeToFit="NO" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="744-t1-YNn">
251+ <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="_" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="744-t1-YNn">
252 <rect key="frame" x="0.0" y="0.0" width="40" height="58"/>
252 <rect key="frame" x="0.0" y="0.0" width="40" height="58"/>
253 <nil key="textColor"/>
253 <nil key="textColor"/>
254 <fontDescription key="fontDescription" type="system" pointSize="45"/>
254 <fontDescription key="fontDescription" type="system" pointSize="45"/>
255 <textInputTraits key="textInputTraits" keyboardType="numberPad"/>
255 <textInputTraits key="textInputTraits" keyboardType="numberPad"/>
256 </textField>
256 </textField>
257− <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="_" textAlignment="center" adjustsFontSizeToFit="NO" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="jcR-jp-s7a">
257+ <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="_" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="jcR-jp-s7a">
258 <rect key="frame" x="52" y="0.0" width="40" height="58"/>
258 <rect key="frame" x="52" y="0.0" width="40" height="58"/>
259 <nil key="textColor"/>
259 <nil key="textColor"/>
260 <fontDescription key="fontDescription" type="system" pointSize="45"/>
260 <fontDescription key="fontDescription" type="system" pointSize="45"/>
261 <textInputTraits key="textInputTraits" keyboardType="numberPad"/>
261 <textInputTraits key="textInputTraits" keyboardType="numberPad"/>
262 </textField>
262 </textField>
263− <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="_" textAlignment="center" adjustsFontSizeToFit="NO" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="YKO-0M-KD8">
263+ <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="_" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="YKO-0M-KD8">
264 <rect key="frame" x="104" y="0.0" width="40" height="58"/>
264 <rect key="frame" x="104" y="0.0" width="40" height="58"/>
265 <nil key="textColor"/>
265 <nil key="textColor"/>
266 <fontDescription key="fontDescription" type="system" pointSize="45"/>
266 <fontDescription key="fontDescription" type="system" pointSize="45"/>
267 <textInputTraits key="textInputTraits" keyboardType="numberPad"/>
267 <textInputTraits key="textInputTraits" keyboardType="numberPad"/>
268 </textField>
268 </textField>
269− <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="_" textAlignment="center" adjustsFontSizeToFit="NO" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="SmG-Ae-oOs">
269+ <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="_" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="SmG-Ae-oOs">
270 <rect key="frame" x="156" y="0.0" width="40" height="58"/>
270 <rect key="frame" x="156" y="0.0" width="40" height="58"/>
271 <nil key="textColor"/>
271 <nil key="textColor"/>
272 <fontDescription key="fontDescription" type="system" pointSize="45"/>
272 <fontDescription key="fontDescription" type="system" pointSize="45"/>
273 <textInputTraits key="textInputTraits" keyboardType="numberPad"/>
273 <textInputTraits key="textInputTraits" keyboardType="numberPad"/>
274 </textField>
274 </textField>
275− <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="_" textAlignment="center" adjustsFontSizeToFit="NO" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="vaP-rO-NZW">
275+ <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="_" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="vaP-rO-NZW">
276 <rect key="frame" x="208" y="0.0" width="40" height="58"/>
276 <rect key="frame" x="208" y="0.0" width="40" height="58"/>
277 <nil key="textColor"/>
277 <nil key="textColor"/>
278 <fontDescription key="fontDescription" type="system" pointSize="45"/>
278 <fontDescription key="fontDescription" type="system" pointSize="45"/>
279 <textInputTraits key="textInputTraits" keyboardType="numberPad"/>
279 <textInputTraits key="textInputTraits" keyboardType="numberPad"/>
280 </textField>
280 </textField>
281− <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="_" textAlignment="center" adjustsFontSizeToFit="NO" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="qDh-32-HSn">
281+ <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="_" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="qDh-32-HSn">
282 <rect key="frame" x="260" y="0.0" width="40" height="58"/>
282 <rect key="frame" x="260" y="0.0" width="40" height="58"/>
283 <nil key="textColor"/>
283 <nil key="textColor"/>
284 <fontDescription key="fontDescription" type="system" pointSize="45"/>
284 <fontDescription key="fontDescription" type="system" pointSize="45"/>
@@ -778,53 +778,29 @@
778 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
778 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
779 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
779 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
780 <prototypes>
780 <prototypes>
781− <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="MessageViewCell" rowHeight="78" id="67C-fT-WEV" customClass="MessageViewCell" customModule="GDproject" customModuleProvider="target">
781+ <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="MessagesCell" textLabel="9br-gb-mg8" detailTextLabel="Jxd-We-VyC" style="IBUITableViewCellStyleSubtitle" id="67C-fT-WEV">
782− <rect key="frame" x="0.0" y="28" width="375" height="78"/>
782+ <rect key="frame" x="0.0" y="28" width="375" height="44"/>
783 <autoresizingMask key="autoresizingMask"/>
783 <autoresizingMask key="autoresizingMask"/>
784 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="67C-fT-WEV" id="O3b-Xv-UNk">
784 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="67C-fT-WEV" id="O3b-Xv-UNk">
785− <rect key="frame" x="0.0" y="0.0" width="375" height="77.5"/>
785+ <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
786 <autoresizingMask key="autoresizingMask"/>
786 <autoresizingMask key="autoresizingMask"/>
787 <subviews>
787 <subviews>
788− <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xAY-IF-RpX">
789− <rect key="frame" x="229" y="11" width="130" height="15"/>
790− <constraints>
791− <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="130" id="f99-ZF-f8h"/>
792− </constraints>
793− <fontDescription key="fontDescription" type="system" pointSize="12"/>
794− <color key="textColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
795− <nil key="highlightedColor"/>
796− </label>
797− <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FG3-gU-0r1">
788+ <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="9br-gb-mg8">
798− <rect key="frame" x="16" y="11" width="46" height="22"/>
789+ <rect key="frame" x="16" y="5" width="33.5" height="20.5"/>
799− <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="18"/>
790+ <autoresizingMask key="autoresizingMask"/>
791+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
800 <nil key="textColor"/>
792 <nil key="textColor"/>
801 <nil key="highlightedColor"/>
793 <nil key="highlightedColor"/>
802 </label>
794 </label>
803− <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nTy-rK-XTr">
795+ <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Detail" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Jxd-We-VyC">
804− <rect key="frame" x="16" y="49" width="343" height="18"/>
796+ <rect key="frame" x="16" y="25.5" width="33" height="14.5"/>
797+ <autoresizingMask key="autoresizingMask"/>
805− <fontDescription key="fontDescription" type="system" pointSize="15"/>
798+ <fontDescription key="fontDescription" type="system" pointSize="12"/>
806 <nil key="textColor"/>
799 <nil key="textColor"/>
807 <nil key="highlightedColor"/>
800 <nil key="highlightedColor"/>
808 </label>
801 </label>
809 </subviews>
802 </subviews>
810− <constraints>
811− <constraint firstItem="nTy-rK-XTr" firstAttribute="top" secondItem="xAY-IF-RpX" secondAttribute="bottom" constant="23" id="09Y-aK-nD9"/>
812− <constraint firstItem="FG3-gU-0r1" firstAttribute="top" secondItem="O3b-Xv-UNk" secondAttribute="topMargin" id="4Hp-d5-9An"/>
813− <constraint firstItem="xAY-IF-RpX" firstAttribute="top" secondItem="O3b-Xv-UNk" secondAttribute="topMargin" id="G4f-oJ-7ud"/>
814− <constraint firstItem="nTy-rK-XTr" firstAttribute="trailing" secondItem="O3b-Xv-UNk" secondAttribute="trailingMargin" id="MaE-VM-KhL"/>
815− <constraint firstItem="nTy-rK-XTr" firstAttribute="leading" secondItem="O3b-Xv-UNk" secondAttribute="leadingMargin" id="OIX-rY-Leo"/>
816− <constraint firstItem="nTy-rK-XTr" firstAttribute="top" secondItem="FG3-gU-0r1" secondAttribute="bottom" constant="16" id="Qdj-s3-t60"/>
817− <constraint firstItem="nTy-rK-XTr" firstAttribute="bottom" secondItem="O3b-Xv-UNk" secondAttribute="bottomMargin" id="Rv3-Mz-Aed"/>
818− <constraint firstItem="FG3-gU-0r1" firstAttribute="leading" secondItem="O3b-Xv-UNk" secondAttribute="leadingMargin" id="iN1-KG-dYn"/>
819− <constraint firstItem="xAY-IF-RpX" firstAttribute="trailing" secondItem="O3b-Xv-UNk" secondAttribute="trailingMargin" id="opV-4x-VCk"/>
820− <constraint firstItem="xAY-IF-RpX" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="FG3-gU-0r1" secondAttribute="trailing" constant="4" id="x9r-sM-t4x"/>
821− </constraints>
822 </tableViewCellContentView>
803 </tableViewCellContentView>
823− <connections>
824− <outlet property="dateLabel" destination="xAY-IF-RpX" id="fcz-re-BXk"/>
825− <outlet property="dialogName" destination="FG3-gU-0r1" id="gd7-ND-wCi"/>
826− <outlet property="lastMessagePreview" destination="nTy-rK-XTr" id="Cmo-IJ-2r0"/>
827− </connections>
828 </tableViewCell>
804 </tableViewCell>
829 </prototypes>
805 </prototypes>
830 <connections>
806 <connections>
@@ -835,7 +811,7 @@
835 </tableViewController>
811 </tableViewController>
836 <placeholder placeholderIdentifier="IBFirstResponder" id="fu3-z4-EY7" userLabel="First Responder" sceneMemberID="firstResponder"/>
812 <placeholder placeholderIdentifier="IBFirstResponder" id="fu3-z4-EY7" userLabel="First Responder" sceneMemberID="firstResponder"/>
837 </objects>
813 </objects>
838− <point key="canvasLocation" x="2681" y="918"/>
814+ <point key="canvasLocation" x="2798" y="932"/>
839 </scene>
815 </scene>
840 <!--People To Write View Controller-->
816 <!--People To Write View Controller-->
841 <scene sceneID="6Td-bq-Ebf">
817 <scene sceneID="6Td-bq-Ebf">
@@ -846,7 +822,7 @@
846 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
822 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
847 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
823 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
848 <prototypes>
824 <prototypes>
849− <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="peopleToWriteCell" textLabel="e4H-yo-W57" style="IBUITableViewCellStyleDefault" id="5ue-Sf-Blf">
825+ <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="peopleToWriteCell" textLabel="e4H-yo-W57" detailTextLabel="QSb-Bd-4gu" style="IBUITableViewCellStyleValue1" id="5ue-Sf-Blf">
850 <rect key="frame" x="0.0" y="28" width="375" height="44"/>
826 <rect key="frame" x="0.0" y="28" width="375" height="44"/>
851 <autoresizingMask key="autoresizingMask"/>
827 <autoresizingMask key="autoresizingMask"/>
852 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="5ue-Sf-Blf" id="8Dr-YE-x7M">
828 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="5ue-Sf-Blf" id="8Dr-YE-x7M">
@@ -854,7 +830,14 @@
854 <autoresizingMask key="autoresizingMask"/>
830 <autoresizingMask key="autoresizingMask"/>
855 <subviews>
831 <subviews>
856 <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="e4H-yo-W57">
832 <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="e4H-yo-W57">
857− <rect key="frame" x="16" y="0.0" width="343" height="43.5"/>
833+ <rect key="frame" x="16" y="12" width="33.5" height="20.5"/>
834+ <autoresizingMask key="autoresizingMask"/>
835+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
836+ <nil key="textColor"/>
837+ <nil key="highlightedColor"/>
838+ </label>
839+ <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="QSb-Bd-4gu">
840+ <rect key="frame" x="315" y="12" width="44" height="20.5"/>
858 <autoresizingMask key="autoresizingMask"/>
841 <autoresizingMask key="autoresizingMask"/>
859 <fontDescription key="fontDescription" type="system" pointSize="17"/>
842 <fontDescription key="fontDescription" type="system" pointSize="17"/>
860 <nil key="textColor"/>
843 <nil key="textColor"/>
GDproject/Controller/ News and channels/ChannelController.swift+1−1
@@ -73,7 +73,7 @@ class ChannelController: UIViewController, UITableViewDelegate, UITableViewDataS
73 if let _ = channel?.id { print("update")
73 if let _ = channel?.id { print("update")
74 Model.updateChannel(with: channel!)
74 Model.updateChannel(with: channel!)
75 } else { print("create")
75 } else { print("create")
76− //Model.createChannel(with: channel!)
76+ Model.createChannel(with: channel!)
77 }
77 }
78 return
78 return
79 }
79 }
GDproject/Controller/ News and channels/ChannelListController.swift+2−2
@@ -30,7 +30,7 @@ class ChannelListController: UITableViewController {
30 var displayingChannel: Model.Channels?
30 var displayingChannel: Model.Channels?
31
31
32 var toReload: Bool = false {
32 var toReload: Bool = false {
33− didSet {
33+ didSet{
34 tableView.reloadData()
34 tableView.reloadData()
35 }
35 }
36 }
36 }
@@ -100,7 +100,7 @@ class ChannelListController: UITableViewController {
100 @objc func addChannel()
100 @objc func addChannel()
101 {
101 {
102 // editing mode is on automatically
102 // editing mode is on automatically
103− onEditingModeBegins?(Model.Channels(people: [], name: "Untitled", id: 0, tags: []),IndexPath(row: 1, section: 0))
103+ onEditingModeBegins?(Model.Channels(people: [], name: "Untitled", tags: []),IndexPath(row: 1, section: 0))
104 }
104 }
105
105
106 static let generalChannel = Model.Channels(people: [], name: "General", id: -1, tags: [])
106 static let generalChannel = Model.Channels(people: [], name: "General", id: -1, tags: [])
GDproject/Controller/ News and channels/ChannelViewController.swift+3−8
@@ -60,17 +60,12 @@ class ChannelViewController: UITableViewController, UpdatableName, UpdatableChan
60 super.viewWillDisappear(animated)
60 super.viewWillDisappear(animated)
61 }
61 }
62
62
63− guard let _ = self.navigationController?.viewControllers.lastIndex(of: self) else
63+ guard let _ = self.navigationController?.viewControllers.lastIndex(of: self) else {
64− {
65− if let id = channel?.id, id != 0
64+ if let _ = channel?.id
66 {
65 {
67 Model.updateChannel(with: channel!)
66 Model.updateChannel(with: channel!)
68 } else {
67 } else {
69− Model.createChannel(with: channel!) {
68+ Model.createChannel(with: channel!)
70− [weak self] in
71− self?.showAlertOn(result: $0)
72− return
73− }
74 }
69 }
75 return
70 return
76 }
71 }
GDproject/Controller/ News and channels/FullPostController.swift+18−1
@@ -26,9 +26,26 @@ class FullPostController: UITableViewController {
26 func setUpNavigationBar(){
26 func setUpNavigationBar(){
27 navigationItem.largeTitleDisplayMode = .never
27 navigationItem.largeTitleDisplayMode = .never
28 navigationItem.title = "Post"
28 navigationItem.title = "Post"
29+ navigationItem.rightBarButtonItems = [UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(self.options))]
29 }
30 }
30
31
31−
32+ @objc func options(){
33+ // drafts
34+ // saved
35+
36+ let optionMenu = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
37+ let editAction = UIAlertAction(title: "Send via message", style: .default)
38+ let shareAction = UIAlertAction(title: "Send via project", style: .default)
39+ let settingsAction = UIAlertAction(title: "Copy link", style: .default)
40+ let cancelAction = UIAlertAction(title: "Cancel", style: .cancel)
41+
42+ optionMenu.addAction(editAction)
43+ optionMenu.addAction(shareAction)
44+ optionMenu.addAction(settingsAction)
45+ optionMenu.addAction(cancelAction)
46+
47+ self.present(optionMenu, animated: true, completion: nil)
48+ }
32 // MARK: - Table view data source
49 // MARK: - Table view data source
33
50
34 override func numberOfSections(in tableView: UITableView) -> Int {
51 override func numberOfSections(in tableView: UITableView) -> Int {
GDproject/Controller/ News and channels/NewPostViewController.swift+8−26
@@ -41,7 +41,7 @@ class NewPostViewController: UIViewController, UITextViewDelegate, TagsReceiver
41 let textStorage = MarklightTextStorage()
41 let textStorage = MarklightTextStorage()
42
42
43 static var draft: String = ""
43 static var draft: String = ""
44− static var hashTagsDraft: [String] = [ ]
44+ static var hashTagsDraft: [String] = ["tt"]
45
45
46 var textView: UITextView!
46 var textView: UITextView!
47
47
@@ -72,7 +72,7 @@ class NewPostViewController: UIViewController, UITextViewDelegate, TagsReceiver
72
72
73 setUpMD()
73 setUpMD()
74 setUpTextView()
74 setUpTextView()
75− // setUpAccessoryView()
75+ setUpAccessoryView()
76 //setUpTagsView()
76 //setUpTagsView()
77 }
77 }
78
78
@@ -109,8 +109,7 @@ class NewPostViewController: UIViewController, UITextViewDelegate, TagsReceiver
109 override func viewWillAppear(_ animated: Bool) {
109 override func viewWillAppear(_ animated: Bool) {
110 super.viewWillAppear(animated)
110 super.viewWillAppear(animated)
111
111
112− //navigationController?.navigationBar.prefersLargeTitles = false
112+ navigationController?.navigationBar.prefersLargeTitles = false
113− navigationItem.largeTitleDisplayMode = .never
114 navigationItem.title = "New post"
113 navigationItem.title = "New post"
115 textView.text = NewPostViewController.draft
114 textView.text = NewPostViewController.draft
116 // tagsField.addTags(NewPostViewController.hashTagsDraft)
115 // tagsField.addTags(NewPostViewController.hashTagsDraft)
@@ -141,7 +140,7 @@ class NewPostViewController: UIViewController, UITextViewDelegate, TagsReceiver
141 func setUpTextView(){
140 func setUpTextView(){
142 view.addConstraint(bottomTextViewConstraint)
141 view.addConstraint(bottomTextViewConstraint)
143 view1.addSubview(textView)
142 view1.addSubview(textView)
144− textView.edgesToSuperview(insets: .top(8) + .left(8) + .bottom(8) + .right(8))
143+ textView.edgesToSuperview(insets: .top(8) + .left(8) + .bottom(40+8) + .right(8))
145
144
146 if #available(iOS 11.0, *) {
145 if #available(iOS 11.0, *) {
147 textView.smartDashesType = .no
146 textView.smartDashesType = .no
@@ -210,7 +209,7 @@ class NewPostViewController: UIViewController, UITextViewDelegate, TagsReceiver
210 }
209 }
211
210
212 func setUpMD(){
211 func setUpMD(){
213− textStorage.marklightTextProcessor.codeColor = UIColor.gray
212+ textStorage.marklightTextProcessor.codeColor = UIColor.orange
214 textStorage.marklightTextProcessor.quoteColor = UIColor.darkGray
213 textStorage.marklightTextProcessor.quoteColor = UIColor.darkGray
215 textStorage.marklightTextProcessor.syntaxColor = UIColor.blue
214 textStorage.marklightTextProcessor.syntaxColor = UIColor.blue
216 textStorage.marklightTextProcessor.codeFontName = "Courier"
215 textStorage.marklightTextProcessor.codeFontName = "Courier"
@@ -232,27 +231,10 @@ class NewPostViewController: UIViewController, UITextViewDelegate, TagsReceiver
232 var indexOfPost = 0
231 var indexOfPost = 0
233 // MARK:- new post
232 // MARK:- new post
234 @objc func newPost(){
233 @objc func newPost(){
235− self.navigationItem.title = "Sending..."
236− Model.createAndPublish(body: [Model.Attachments(markdown: textView!.text)], tags: currentTags) {
234+ Model.createAndPublish(body: [Model.Attachments(markdown: textView!.text)], tags: currentTags)
237− [weak self] in
238−
239− switch $0 {
240− case .success1, .success:
241− NewPostViewController.draft = ""
242− NewPostViewController.hashTagsDraft = []
243− self?.moveBackToParentVC?()
244− default:
245− self?.showAlertOn(result: $0)
246− self?.navigationItem.title = "New post"
247− }
248−
249− }
250−
251− // NewPostViewController.draft = ""
252− // NewPostViewController.hashTagsDraft = []
253 // adding row to uiTableView after adding new post
235 // adding row to uiTableView after adding new post
254 // myProtocol?.addPost(post: p)
236 // myProtocol?.addPost(post: p)
255− // moveBackToParentVC?()
237+ moveBackToParentVC?()
256 // somewhere here i will be sending server notifications about new post arrival
238 // somewhere here i will be sending server notifications about new post arrival
257 }
239 }
258
240
@@ -264,7 +246,7 @@ class NewPostViewController: UIViewController, UITextViewDelegate, TagsReceiver
264 [weak self]
246 [weak self]
265 _ in
247 _ in
266 NewPostViewController.draft = self?.textView.text ?? ""
248 NewPostViewController.draft = self?.textView.text ?? ""
267− NewPostViewController.hashTagsDraft = self?.currentTags ?? []
249+ NewPostViewController.hashTagsDraft = /*self?.tagsField.tags.map { $0.text } ??*/ []
268 self?.moveBackToParentVC?()
250 self?.moveBackToParentVC?()
269 }
251 }
270
252
GDproject/Controller/ News and channels/NewsController.swift+1−3
@@ -52,7 +52,6 @@ class NewsController: UIViewController, UISearchControllerDelegate, UpdateableWi
52 let updater = TagsSuggestionController()
52 let updater = TagsSuggestionController()
53 updater.delegate = self
53 updater.delegate = self
54 searchController = UISearchController(searchResultsController: updater)
54 searchController = UISearchController(searchResultsController: updater)
55− navigationItem.largeTitleDisplayMode = .always
56
55
57 navigationController?.navigationBar.prefersLargeTitles = true
56 navigationController?.navigationBar.prefersLargeTitles = true
58 navigationItem.title = "Loading ..."
57 navigationItem.title = "Loading ..."
@@ -82,7 +81,7 @@ class NewsController: UIViewController, UISearchControllerDelegate, UpdateableWi
82 searchController?.searchBar.placeholder = "Search tags"
81 searchController?.searchBar.placeholder = "Search tags"
83 }
82 }
84
83
85− @objc func refreshPostsData( _ ff: UIRefreshControl) {
84+ @objc func refreshPostsData( _ ff: UIRefreshControl){
86 decideWhatChannelDisplay()
85 decideWhatChannelDisplay()
87 }
86 }
88
87
@@ -122,7 +121,6 @@ class NewsController: UIViewController, UISearchControllerDelegate, UpdateableWi
122 }
121 }
123 }
122 }
124 default:
123 default:
125− refreshContr.endRefreshing()
126 break
124 break
127 }
125 }
128
126
GDproject/Controller/ News and channels/NewsVC.swift+1−3
@@ -19,9 +19,7 @@ struct PostCellData{
19
19
20 let markdownParser = MarkdownParser(font: UIFont.systemFont(ofSize: 16))
20 let markdownParser = MarkdownParser(font: UIFont.systemFont(ofSize: 16))
21 markdownParser.enabledElements = .disabledAutomaticLink
21 markdownParser.enabledElements = .disabledAutomaticLink
22− markdownParser.code.font = UIFont(name: "Menlo", size: 16)
23− markdownParser.code.textBackgroundColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
22+ markdownParser.code.textBackgroundColor = #colorLiteral(red: 0.8039215803, green: 0.8039215803, blue: 0.8039215803, alpha: 1)
24− markdownParser.code.color = #colorLiteral(red: 0.2549019754, green: 0.2745098174, blue: 0.3019607961, alpha: 1)
25
23
26 return markdownParser.parse(markdown)
24 return markdownParser.parse(markdown)
27 }
25 }
GDproject/Controller/ News and channels/PostViewCell.swift+1−2
@@ -42,7 +42,6 @@ class PostViewCell: UITableViewCell
42
42
43 let shareButton: UIButton = {
43 let shareButton: UIButton = {
44 let button = UIButton(type: UIButton.ButtonType.detailDisclosure)
44 let button = UIButton(type: UIButton.ButtonType.detailDisclosure)
45− button.isHidden = true
46 return button
45 return button
47 }()
46 }()
48
47
@@ -87,7 +86,7 @@ class PostViewCell: UITableViewCell
87 nameLabel.setTitle("\(post.user?.firstName ?? "") \(post.user?.lastName ?? "")", for: .normal)
86 nameLabel.setTitle("\(post.user?.firstName ?? "") \(post.user?.lastName ?? "")", for: .normal)
88 nameLabel.addTarget(self, action: #selector(displayProfile), for: .touchUpInside)
87 nameLabel.addTarget(self, action: #selector(displayProfile), for: .touchUpInside)
89 if let user = post.user{
88 if let user = post.user{
90− fullNameLabel.text = "\(user.faculty.name)"
89+ fullNameLabel.text = "\(user.firstName) \(user.middleName) \(user.lastName)"
91 }
90 }
92 else {
91 else {
93 fullNameLabel.text = "\(post.authorId)"
92 fullNameLabel.text = "\(post.authorId)"
GDproject/Controller/Coordinators/LogInCoordinator.swift+1−2
@@ -26,14 +26,13 @@ class LogInCoordinator: BaseCoordinator {
26 let logInVC = LogInViewController()
26 let logInVC = LogInViewController()
27 logInVC.authenticate = { [weak self, weak logInVC] (email) in
27 logInVC.authenticate = { [weak self, weak logInVC] (email) in
28
28
29− DataStorage.standard.setEmail(email: email)
30 Model.authenticate(with: email) { [weak self]
29 Model.authenticate(with: email) { [weak self]
31 (authStatus) in
30 (authStatus) in
32
31
33 print(authStatus.userStatus)
32 print(authStatus.userStatus)
34
33
35 if (authStatus.userStatus == "invalid") {
34 if (authStatus.userStatus == "invalid") {
36− logInVC?.presentAlertInvalidCode()
35+ logInVC?.mailTextField.text = "invalid"
37 }
36 }
38 else if (authStatus.userStatus == "canRegister") { // register form
37 else if (authStatus.userStatus == "canRegister") { // register form
39 self?.presentRegisterVC()
38 self?.presentRegisterVC()
GDproject/Controller/Coordinators/ProfileCoordinator.swift+13−15
@@ -36,25 +36,23 @@ class ProfileCoordinator: BaseCoordinator {
36 }
36 }
37 }
37 }
38
38
39− profile.deleteAllSessions = {
39+ profile.onSettings = { [weak self, weak storyboard] in
40− Model.deactivateAll() {
40+ let vc = storyboard?.instantiateViewController(withIdentifier: "SettingsViewController") as! SettingsViewController
41− [weak self] in
41+ self?.navigationController?.pushViewController(vc, animated: true)
42−
43− DataStorage.standard.setIsLoggedIn(value: false, with: 0)
44− self?.didEndSession?()
45− }
46 }
42 }
47
43
48− profile.onSettings = { [weak self, weak storyboard, weak profile] in
44+ profile.onChannelsListToAddAPerson = { [weak self, weak storyboard] (user) in
49−
50− let vc = storyboard?.instantiateViewController(withIdentifier: "RegisterTableViewController") as! RegisterTableViewController
45+ let vc = storyboard?.instantiateViewController(withIdentifier: simplifiedChannelsList) as! SimplifiedChannelsList
51− vc.delegate = profile
46+ vc.user = user
52− vc.userActive = profile?.user
53
47
48+ let transition = CATransition()
49+ transition.duration = 0.5
50+ transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
51+ transition.type = CATransitionType.moveIn
52+ transition.subtype = CATransitionSubtype.fromTop
53+ self?.navigationController?.view.layer.add(transition, forKey: nil)
54− self?.navigationController?.pushViewController(vc, animated: true)
54+ self?.navigationController?.pushViewController(vc, animated: false)
55 }
55 }
56−
57−
58 navigationController?.setViewControllers([profile], animated: false)
56 navigationController?.setViewControllers([profile], animated: false)
59 }
57 }
60}
58}
GDproject/Controller/Log In/CodeViewController.swift+8−47
@@ -7,7 +7,6 @@
7//
7//
8
8
9import UIKit
9import UIKit
10−import TinyConstraints
11
10
12class CodeViewController: UIViewController {
11class CodeViewController: UIViewController {
13
12
@@ -18,16 +17,12 @@ class CodeViewController: UIViewController {
18 @IBOutlet weak var f5: UITextField!
17 @IBOutlet weak var f5: UITextField!
19 @IBOutlet weak var f6: UITextField!
18 @IBOutlet weak var f6: UITextField!
20
19
21− var loading = UIActivityIndicatorView(style: .gray)
22−
23 var onSuccessLogIn: (()->())?
20 var onSuccessLogIn: (()->())?
24
21
25 override func viewDidLoad() {
22 override func viewDidLoad() {
26 super.viewDidLoad()
23 super.viewDidLoad()
27 setUpConstraint()
24 setUpConstraint()
28
25
29− navigationItem.title = DataStorage.standard.getEmail()
30−
31 f1.addTarget(self, action: #selector(textFiledDidChange(textField:)), for: .editingChanged)
26 f1.addTarget(self, action: #selector(textFiledDidChange(textField:)), for: .editingChanged)
32 f2.addTarget(self, action: #selector(textFiledDidChange(textField:)), for: .editingChanged)
27 f2.addTarget(self, action: #selector(textFiledDidChange(textField:)), for: .editingChanged)
33 f3.addTarget(self, action: #selector(textFiledDidChange(textField:)), for: .editingChanged)
28 f3.addTarget(self, action: #selector(textFiledDidChange(textField:)), for: .editingChanged)
@@ -36,12 +31,6 @@ class CodeViewController: UIViewController {
36 f6.addTarget(self, action: #selector(textFiledDidChange(textField:)), for: .editingChanged)
31 f6.addTarget(self, action: #selector(textFiledDidChange(textField:)), for: .editingChanged)
37 }
32 }
38
33
39− override func viewWillDisappear(_ animated: Bool) {
40− super.viewWillDisappear(animated)
41−
42− loading.stopAnimating()
43− }
44−
45 override func viewWillAppear(_ animated: Bool) {
34 override func viewWillAppear(_ animated: Bool) {
46 super.viewWillAppear(animated)
35 super.viewWillAppear(animated)
47
36
@@ -73,56 +62,28 @@ class CodeViewController: UIViewController {
73 }
62 }
74
63
75
64
76− func presentAlertInvalidData(with text: String)
77− {
78− let alert = UIAlertController(title: "Invalid code", message: text, preferredStyle: .alert)
79− alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
80− self.present(alert, animated: true, completion: nil)
81−
82− loading.stopAnimating()
83− }
84−
85 @IBOutlet weak var bottomConstraint: NSLayoutConstraint!
65 @IBOutlet weak var bottomConstraint: NSLayoutConstraint!
86
66
87 @IBAction func whereToGoNext(_ sender: UIButton)
67 @IBAction func whereToGoNext(_ sender: UIButton)
88 {
68 {
89− guard let f1t = f1.text, let f2t = f2.text, let f3t = f3.text, let f4t = f4.text, let f5t = f5.text, let f6t = f6.text else {
90− presentAlertInvalidData(with: "Some fields are missing");
91− return
92− }
93−
94− if f1t.isEmpty || f2t.isEmpty || f3t.isEmpty || f4t.isEmpty || f5t.isEmpty || f6t.isEmpty {
95− presentAlertInvalidData(with: "Some fields are missing");
96− return
97− }
98−
99 let code = "\(f1.text!)\(f2.text!)\(f3.text!)\(f4.text!)\(f5.text!)\(f6.text!)"
69 let code = "\(f1.text!)\(f2.text!)\(f3.text!)\(f4.text!)\(f5.text!)\(f6.text!)"
100 if let codeToInt = Int(code)
70 if let codeToInt = Int(code)
101 {
71 {
102− loading.startAnimating()
103− Model.verify(with: codeToInt) { [weak self] in
72+ Model.verify(with: codeToInt) { _ in
104 // if everything is okay we can authemticicate
73 // if everything is okay we can authemticicate
105− if !$0 {
106− self?.presentAlertInvalidData(with: "Wrong code. Try again!")
107− self?.loading.stopAnimating()
108− return
109− } else {
110− // Model.authemticiateMe
74+ // Model.authemticiateMe
111− Model.authenticateMe { [weak self] (res) in
75+ Model.authenticateMe { [weak self] (res) in
112− if res {
76+ if res {
113− self?.onSuccessLogIn?()
77+ self?.onSuccessLogIn?()
114− }
78+ } else {
79+ print("sosi")
115 }
80 }
116− return
117 }
81 }
118 }
82 }
119 }
83 }
120 }
84 }
121
85
122− func setUpConstraint()
86+ func setUpConstraint(){
123− {
124− self.view.addSubview(loading)
125− loading.centerInSuperview()
126 // for keyboard notifications
87 // for keyboard notifications
127 NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotifications), name: UIResponder.keyboardWillShowNotification, object: nil)
88 NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboardNotifications), name: UIResponder.keyboardWillShowNotification, object: nil)
128
89
GDproject/Controller/Log In/FacultyTableViewController.swift−1
@@ -81,7 +81,6 @@ class FacultyTableViewController: UITableViewController {
81
81
82 override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
82 override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
83 delegate?.onChooseFaculty(faculty: currentFaculties[indexPath.row])
83 delegate?.onChooseFaculty(faculty: currentFaculties[indexPath.row])
84− searchController.dismiss(animated: true, completion: nil)
85 self.navigationController?.popViewController(animated: true)
84 self.navigationController?.popViewController(animated: true)
86 }
85 }
87
86
GDproject/Controller/Log In/LogInViewController.swift+1−26
@@ -14,25 +14,8 @@ import Result
14
14
15class LogInViewController: UIViewController {
15class LogInViewController: UIViewController {
16
16
17− var loading = UIActivityIndicatorView(style: .gray)
18−
19 var authenticate: ((String)->())?
17 var authenticate: ((String)->())?
20
18
21− func presentAlertInvalidCode()
22− {
23− let alert = UIAlertController(title: "Invalid email", message: "Try again. Use @hse.ru mail.", preferredStyle: .alert)
24− alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
25− self.present(alert, animated: true, completion: nil)
26− mailTextField.text = ""
27− loading.stopAnimating()
28− }
29−
30− override func viewWillDisappear(_ animated: Bool) {
31− super.viewWillDisappear(animated)
32−
33− loading.stopAnimating()
34− }
35−
36 let logInLabel: UILabel = {
19 let logInLabel: UILabel = {
37 let label = UILabel()
20 let label = UILabel()
38 label.text = "Log In"
21 label.text = "Log In"
@@ -47,8 +30,6 @@ class LogInViewController: UIViewController {
47 textField.placeholder = "Mail"
30 textField.placeholder = "Mail"
48 textField.borderStyle = .roundedRect
31 textField.borderStyle = .roundedRect
49 textField.textColor = .black
32 textField.textColor = .black
50− textField.autocorrectionType = UITextAutocorrectionType.no
51− textField.autocapitalizationType = UITextAutocapitalizationType.none
52 textField.clearButtonMode = .always
33 textField.clearButtonMode = .always
53 return textField
34 return textField
54 }()
35 }()
@@ -64,7 +45,6 @@ class LogInViewController: UIViewController {
64 }()
45 }()
65
46
66 @objc func handleTap(){
47 @objc func handleTap(){
67− loading.startAnimating()
68 authenticate?(mailTextField.text!)
48 authenticate?(mailTextField.text!)
69 }
49 }
70
50
@@ -75,10 +55,6 @@ class LogInViewController: UIViewController {
75 func setUpView(){
55 func setUpView(){
76 // logIn stack with textField and label
56 // logIn stack with textField and label
77 view.addSubview(contentView)
57 view.addSubview(contentView)
78− view.addSubview(loading)
79−
80− loading.centerInSuperview()
81−
82 contentView.edgesToSuperview(excluding: .bottom, insets: .left(16) + .right(16) + .top(80), usingSafeArea: true)
58 contentView.edgesToSuperview(excluding: .bottom, insets: .left(16) + .right(16) + .top(80), usingSafeArea: true)
83 let views = [logInLabel, mailTextField]
59 let views = [logInLabel, mailTextField]
84 contentView.stack(views, axis: .vertical, spacing: 10)
60 contentView.stack(views, axis: .vertical, spacing: 10)
@@ -86,7 +62,6 @@ class LogInViewController: UIViewController {
86
62
87 func configureKeyboard(){
63 func configureKeyboard(){
88
64
89− mailTextField.keyboardType = .emailAddress
90 // configure keyboardBar setUp
65 // configure keyboardBar setUp
91 view.addSubview(keyboardBar)
66 view.addSubview(keyboardBar)
92 keyboardBar.height(50)
67 keyboardBar.height(50)
@@ -104,7 +79,7 @@ class LogInViewController: UIViewController {
104 func logicOfLogInInputValidation() -> ((String?)->()) {
79 func logicOfLogInInputValidation() -> ((String?)->()) {
105
80
106 let logic: ((String?)->()) = { [weak self] (someText) in
81 let logic: ((String?)->()) = { [weak self] (someText) in
107− if let text = someText, !text.isEmpty, text.contains("@") {
82+ if let text = someText, !text.isEmpty {
108 self?.logInButton.isEnabled = true
83 self?.logInButton.isEnabled = true
109 } else {
84 } else {
110 self?.logInButton.isEnabled = false
85 self?.logInButton.isEnabled = false
GDproject/Controller/Log In/RegisterTableViewController.swift+7−60
@@ -11,91 +11,38 @@ import UIKit
11class RegisterTableViewController: UITableViewController, ChosenFactulty
11class RegisterTableViewController: UITableViewController, ChosenFactulty
12{
12{
13
13
14− func presentAlertInvalidData(message: String)
15− {
16− let alert = UIAlertController(title: "Invalid data", message: message, preferredStyle: .alert)
17− alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
18− self.present(alert, animated: true, completion: nil)
19− }
20−
21 func onChooseFaculty(faculty: Model.Faculty) {
14 func onChooseFaculty(faculty: Model.Faculty) {
22 self.faculty = faculty
15 self.faculty = faculty
23 tableView.reloadData()
16 tableView.reloadData()
24 }
17 }
25
18
26− weak var delegate: UpdateUser?
19+
27−
28 var onRegistration: (()->())?
20 var onRegistration: (()->())?
29
21
30 var faculty: Model.Faculty?
22 var faculty: Model.Faculty?
31− var user: Model.NewRegistration = Model.NewRegistration(email: DataStorage.standard.getEmail()!, firstName: nil, middleName: nil, lastName: nil, faculty: nil)
23+ var user: Model.NewRegistration = Model.NewRegistration(email: "dyurednikina@edu.hse.ru", firstName: nil, middleName: nil, lastName: nil, faculty: nil)
32−
33− var userActive: Model.Users? {
34− didSet {
35− if let userA = userActive {
36− user.firstName = userA.firstName
37− user.middleName = userA.middleName
38− user.lastName = userA.lastName
39−
40− faculty = userA.faculty
41− self.updateUserIfCan = true
42− tableView.reloadData()
43− }
44− }
45− }
46−
47− var updateUserIfCan: Bool = false
48
24
49 override func viewDidLoad()
25 override func viewDidLoad()
50 {
26 {
51 super.viewDidLoad()
27 super.viewDidLoad()
52
28
53− navigationItem.largeTitleDisplayMode = .never
54 tableView.keyboardDismissMode = .interactive
29 tableView.keyboardDismissMode = .interactive
55 navigationItem.title = user.email
30 navigationItem.title = user.email
56 navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(endRegistration))
31 navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(endRegistration))
57 }
32 }
58
33
59−
60 @objc func endRegistration()
34 @objc func endRegistration()
61 {
35 {
62− let fieldsMissing = "Some fields are missing. Add more information"
63 updateUser()
36 updateUser()
64− guard let faculty = faculty else { presentAlertInvalidData(message: fieldsMissing); return }
37+ guard let faculty = faculty else { return }
65
38
66 user.faculty = faculty.url
39 user.faculty = faculty.url
67
40
68− guard let name = user.firstName else { presentAlertInvalidData(message: fieldsMissing); return }
69− guard let middle = user.middleName else { presentAlertInvalidData(message: fieldsMissing); return }
70− guard let last = user.lastName else { presentAlertInvalidData(message: fieldsMissing); return }
71−
72− if updateUserIfCan {
73− guard let delegate = delegate else { return }
74− guard var userA = userActive else { return }
75−
76− // updating current
77− userA.firstName = name
78− userA.faculty = faculty
79− userA.middleName = middle
80− userA.lastName = last
81−
82− Model.userUpdate(with: user) { [weak self] in
83−
84− if $0 {
85− delegate.updateUserObj(with: userA)
86− self?.navigationController?.popViewController(animated: true)
87− } else {
88− self?.presentAlertInvalidData(message: "Something went wrong! Try again")
89− }
90−
91− }
92− } else {
93−
94− Model.register(object: user)
41+ Model.register(object: user)
95− { [weak self] in
42+ { [weak self] in
96− self?.onRegistration?()
43+ self?.onRegistration?()
97− }
98 }
44 }
45+
99 }
46 }
100 // MARK: - Table view data source
47 // MARK: - Table view data source
101
48
GDproject/Controller/Messages/ChatInfoViewController.swift+4−25
@@ -91,12 +91,10 @@ class ChatInfoViewController: UITableViewController {
91 switch indexPath.section {
91 switch indexPath.section {
92 case 0:
92 case 0:
93 cell.textLabel?.text = groupChat!.name
93 cell.textLabel?.text = groupChat!.name
94− cell.selectionStyle = .none
95 return cell
94 return cell
96 case 1:
95 case 1:
97 cell.textLabel?.text = "Leave chat"
96 cell.textLabel?.text = "Leave chat"
98 cell.textLabel?.textColor = #colorLiteral(red: 1, green: 0.1491314173, blue: 0, alpha: 1)
97 cell.textLabel?.textColor = #colorLiteral(red: 1, green: 0.1491314173, blue: 0, alpha: 1)
99− cell.selectionStyle = .none
100 return cell
98 return cell
101 default:
99 default:
102 switch myPermissions{
100 switch myPermissions{
@@ -106,7 +104,6 @@ class ChatInfoViewController: UITableViewController {
106 case .ordinary:
104 case .ordinary:
107 cell.textLabel?.text = name(for: users[usersArray[indexPath.row]])
105 cell.textLabel?.text = name(for: users[usersArray[indexPath.row]])
108 }
106 }
109− cell.selectionStyle = .none
110 return cell
107 return cell
111 }
108 }
112 }
109 }
@@ -117,7 +114,7 @@ class ChatInfoViewController: UITableViewController {
117 case .ordinary:
114 case .ordinary:
118 cell.textLabel?.text = name(for: users[usersArray[indexPath.row]])
115 cell.textLabel?.text = name(for: users[usersArray[indexPath.row]])
119 }
116 }
120− cell.selectionStyle = .none
117+
121 return cell
118 return cell
122 }
119 }
123
120
@@ -146,9 +143,9 @@ class ChatInfoViewController: UITableViewController {
146
143
147
144
148 func editName(for cell: UITableViewCell){
145 func editName(for cell: UITableViewCell){
149− let alert = UIAlertController(title: "Are you sure?", message: "Title:", preferredStyle: .alert)
146+ let alert = UIAlertController(title: "Вы уверены?", message: "Название:", preferredStyle: .alert)
150
147
151− let action1 = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
148+ let action1 = UIAlertAction(title: "Oтмена", style: .cancel, handler: nil)
152
149
153 alert.addTextField { [weak self] (tf) in
150 alert.addTextField { [weak self] (tf) in
154 tf.textColor = #colorLiteral(red: 0, green: 0, blue: 0, alpha: 1)
151 tf.textColor = #colorLiteral(red: 0, green: 0, blue: 0, alpha: 1)
@@ -197,28 +194,10 @@ class ChatInfoViewController: UITableViewController {
197 case .admin:
194 case .admin:
198 showUserChoiceVC()
195 showUserChoiceVC()
199 default:
196 default:
200− showParticipantPage(with: usersArray[indexPath.row])
197+ break
201 }
198 }
202 }
199 }
203 }
200 }
204−
205−
206− if indexPath.section == 2 && indexPath.row != 0 {
207− switch myPermissions{
208− case .admin:
209− showParticipantPage(with: usersArray[indexPath.row-1])
210− default:
211− showParticipantPage(with: usersArray[indexPath.row])
212− }
213− }
214− }
215−
216− var onUserDiplay: ((Int)->())?
217−
218− func showParticipantPage(with user: Int?) {
219− if let user = user {
220− onUserDiplay?(user)
221− }
222 }
201 }
223
202
224 func showUserChoiceVC()
203 func showUserChoiceVC()
GDproject/Controller/Messages/Dialog/DialogViewController.swift+7−17
@@ -61,9 +61,7 @@ class DialogViewController: UIViewController, UpdatableGroup, UITableViewDelegat
61
61
62 self.tableView.delegate = self
62 self.tableView.delegate = self
63 self.tableView.dataSource = self
63 self.tableView.dataSource = self
64−
64+
65− tableView.setContentOffset(CGPoint(x: 0, y: 50), animated: false)
66−
67 navigationItem.largeTitleDisplayMode = .never
65 navigationItem.largeTitleDisplayMode = .never
68
66
69 tableView.keyboardDismissMode = .onDrag
67 tableView.keyboardDismissMode = .onDrag
@@ -116,7 +114,6 @@ class DialogViewController: UIViewController, UpdatableGroup, UITableViewDelegat
116 let button = UIButton()
114 let button = UIButton()
117 button.setTitle("Send", for: .normal)
115 button.setTitle("Send", for: .normal)
118 button.setTitleColor(.blue, for: .normal)
116 button.setTitleColor(.blue, for: .normal)
119− button.titleLabel?.font = UIFont.systemFont(ofSize: 17, weight: .semibold)
120 button.addTarget(self, action: #selector(sendMessage), for: .touchUpInside)
117 button.addTarget(self, action: #selector(sendMessage), for: .touchUpInside)
121 return button
118 return button
122 }()
119 }()
@@ -135,13 +132,8 @@ class DialogViewController: UIViewController, UpdatableGroup, UITableViewDelegat
135 {
132 {
136 Model.sendMessage(message: Model.SendMessage(body: Model.Attachments(markdown: messageTextView.text), destination: destination)) { [unowned self] in
133 Model.sendMessage(message: Model.SendMessage(body: Model.Attachments(markdown: messageTextView.text), destination: destination)) { [unowned self] in
137
134
138− switch $0 {
139− case .success, .success1:
140− self.getMessagesNew(for: self.dialog!)
135+ self.getMessagesNew(for: self.dialog!)
141− self.messageTextView.text = ""
136+ self.messageTextView.text = ""
142− default:
143− self.showAlertOn(result: $0)
144− }
145 }
137 }
146
138
147 prevLast = -1
139 prevLast = -1
@@ -166,7 +158,7 @@ class DialogViewController: UIViewController, UpdatableGroup, UITableViewDelegat
166
158
167 messageSendView.edgesToSuperview(excluding: [.top,.bottom])
159 messageSendView.edgesToSuperview(excluding: [.top,.bottom])
168
160
169− bottomConstraint = NSLayoutConstraint(item: messageSendView, attribute: .bottom, relatedBy: .equal, toItem: self.view.safeAreaLayoutGuide, attribute: .bottom, multiplier: 1, constant: 0)
161+ bottomConstraint = NSLayoutConstraint(item: messageSendView, attribute: .bottom, relatedBy: .equal, toItem: view, attribute: .bottom, multiplier: 1, constant: 0)
170 view.addConstraint(bottomConstraint)
162 view.addConstraint(bottomConstraint)
171
163
172 messageSendView.height(60)
164 messageSendView.height(60)
@@ -199,7 +191,7 @@ class DialogViewController: UIViewController, UpdatableGroup, UITableViewDelegat
199
191
200 let keyBoardFrame = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
192 let keyBoardFrame = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
201
193
202− bottomConstraint.constant = notification.name == UIResponder.keyboardWillShowNotification ? -(keyBoardFrame.height) + self.view.safeAreaInsets.bottom : 0
194+ bottomConstraint.constant = notification.name == UIResponder.keyboardWillShowNotification ? -(keyBoardFrame.height) : 0
203
195
204 UIView.animate(withDuration: 0, delay: 0, options: .curveEaseOut, animations: {
196 UIView.animate(withDuration: 0, delay: 0, options: .curveEaseOut, animations: {
205 self.view.layoutIfNeeded()
197 self.view.layoutIfNeeded()
@@ -231,7 +223,6 @@ class DialogViewController: UIViewController, UpdatableGroup, UITableViewDelegat
231
223
232 vc.delegate = self
224 vc.delegate = self
233 vc.users = users!
225 vc.users = users!
234− vc.onUserDiplay = onUserDisplay
235
226
236 if let groupChat = groupChat {
227 if let groupChat = groupChat {
237 vc.groupChat = groupChat.group
228 vc.groupChat = groupChat.group
@@ -257,8 +248,7 @@ class DialogViewController: UIViewController, UpdatableGroup, UITableViewDelegat
257 return cellData.count
248 return cellData.count
258 }
249 }
259
250
260− override func viewWillAppear(_ animated: Bool)
251+ override func viewWillAppear(_ animated: Bool) {
261− {
262 super.viewWillAppear(animated)
252 super.viewWillAppear(animated)
263 tabBarController?.tabBar.isHidden = true
253 tabBarController?.tabBar.isHidden = true
264
254
@@ -323,7 +313,7 @@ class DialogViewController: UIViewController, UpdatableGroup, UITableViewDelegat
323 var canBePaginated = false
313 var canBePaginated = false
324 func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath)
314 func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath)
325 {
315 {
326− if indexPath.row == cellData.count - 1 && prevLast != indexPath.row && canBePaginated && cellData.count >= 24
316+ if indexPath.row == cellData.count - 1 && prevLast != indexPath.row && canBePaginated
327 {
317 {
328 print("exclusiveFrom \(currentMessagesInChat.last?.id ?? 0)")
318 print("exclusiveFrom \(currentMessagesInChat.last?.id ?? 0)")
329 if let dialog = dialog
319 if let dialog = dialog
GDproject/Controller/Messages/MessageViewCell.swiftdeleted−38
@@ -1,38 +0,0 @@
1−//
2−// MessageViewCell.swift
3−// GDproject
4−//
5−// Created by cstore on 13/05/2019.
6−// Copyright © 2019 drHSE. All rights reserved.
7−//
8−
9−import UIKit
10−
11−class MessageViewCell: UITableViewCell {
12−
13− @IBOutlet weak var dialogName: UILabel!
14−
15− @IBOutlet weak var lastMessagePreview: UILabel!
16−
17− @IBOutlet weak var dateLabel: UILabel!
18−
19− override func awakeFromNib() {
20− super.awakeFromNib()
21− // Initialization code
22− }
23−
24− func fill(with dialog: Model.Dialog, user: Model.Users? = nil)
25− {
26− switch dialog {
27−
28− case .groupChat(let group):
29− dialogName.text = group.group.name
30− lastMessagePreview.text = group.lastMessage?.body.markdown
31− dateLabel.text = group.lastMessage?.time.getDate()
32− case .userChat(let userChat):
33− dialogName.text = "👤 \(user!.fullName())"
34− lastMessagePreview.text = userChat.lastMessage?.body.markdown
35− dateLabel.text = userChat.lastMessage?.time.getDate()
36− }
37− }
38−}
GDproject/Controller/Messages/MessagesViewController.swift+12−107
@@ -8,44 +8,8 @@
8
8
9import UIKit
9import UIKit
10
10
11−protocol SelectableDialog: class {
11+class MessagesViewController: UITableViewController {
12− func openDialog(with dialog: Model.Dialog)
13−}
14
12
15−class MessagesViewController: UITableViewController, UISearchControllerDelegate, UISearchResultsUpdating, SelectableDialog {
16−
17− func openDialog(with dialog: Model.Dialog) {
18− onDialogDisplay?((dialog, users))
19− }
20−
21− func updateSearchResults(for searchController: UISearchController) {
22−
23− let filteredData = currentActiveDialogs
24− let inputText = searchController.searchBar.text ?? ""
25−
26− let filteredResults = filteredData.filter {
27−
28− switch $0 {
29− case .groupChat(let gropuChat):
30− return gropuChat.group.name.contains(inputText)
31−
32− case .userChat(let userChat):
33− let user = users[userChat.user]
34− guard let u = user else { return false }
35− return u.fullName().contains(inputText)
36−
37− }
38−
39− }
40−
41− // Apply the filtered results to the search results table.
42− if let resultsController = searchController.searchResultsController as? SuggestedDialogsTableViewController {
43− resultsController.users = users
44− resultsController.currentDialogs = filteredResults
45− resultsController.tableView.reloadData()
46− }
47− }
48−
49 // curreent Active which can be displayed
13 // curreent Active which can be displayed
50 var currentActiveDialogs: [Model.Dialog] = [] {
14 var currentActiveDialogs: [Model.Dialog] = [] {
51 didSet {
15 didSet {
@@ -53,17 +17,6 @@ class MessagesViewController: UITableViewController, UISearchControllerDelegate,
53 }
17 }
54 }
18 }
55
19
56− func setUpSearchContr(){
57−
58− searchController?.delegate = self
59− searchController?.obscuresBackgroundDuringPresentation = true
60− navigationItem.searchController = searchController
61− definesPresentationContext = true
62− searchController?.searchResultsUpdater = self
63− searchController?.searchBar.placeholder = "Search dialogs"
64−
65− }
66−
67 // curreent users
20 // curreent users
68 var users: [Int: Model.Users] = [:]
21 var users: [Int: Model.Users] = [:]
69
22
@@ -71,22 +24,17 @@ class MessagesViewController: UITableViewController, UISearchControllerDelegate,
71
24
72 var onDialogDisplay: (((dialog: Model.Dialog, users: [Int:Model.Users]))->())?
25 var onDialogDisplay: (((dialog: Model.Dialog, users: [Int:Model.Users]))->())?
73
26
74− var searchController: UISearchController?
27+ let searchC = UISearchController(searchResultsController: nil)
75
28
76 override func viewDidLoad() {
29 override func viewDidLoad() {
77 super.viewDidLoad()
30 super.viewDidLoad()
78−
31+
79− let updater = SuggestedDialogsTableViewController()
80−
81− updater.delegate = self
82− searchController = UISearchController(searchResultsController: updater)
83−
84 // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
32 // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
85 self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Write", style: .plain, target: self, action: #selector(choosePerson))
33 self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Write", style: .plain, target: self, action: #selector(choosePerson))
86
34
87 self.navigationItem.title = "Messages"
35 self.navigationItem.title = "Messages"
88 // self.navigationItem.largeTitleDisplayMode = .always
36 // self.navigationItem.largeTitleDisplayMode = .always
89− setUpSearchContr()
37+ self.navigationItem.searchController = searchC
90 navigationController?.navigationBar.prefersLargeTitles = true
38 navigationController?.navigationBar.prefersLargeTitles = true
91 self.navigationItem.hidesSearchBarWhenScrolling = false
39 self.navigationItem.hidesSearchBarWhenScrolling = false
92 }
40 }
@@ -116,15 +64,18 @@ class MessagesViewController: UITableViewController, UISearchControllerDelegate,
116
64
117 override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
65 override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
118 {
66 {
119− let cell = tableView.dequeueReusableCell(withIdentifier: "MessageViewCell", for: indexPath) as! MessageViewCell
67+ let cell = tableView.dequeueReusableCell(withIdentifier: "MessagesCell", for: indexPath)
120
68
121 switch currentActiveDialogs[indexPath.row].self {
69 switch currentActiveDialogs[indexPath.row].self {
70+
122− case .groupChat:
71+ case .groupChat(let group):
123− cell.fill(with: currentActiveDialogs[indexPath.row])
72+ cell.textLabel?.text = group.group.name
73+ cell.detailTextLabel?.text = group.lastMessage!.body.markdown
124 case .userChat(let userChat):
74 case .userChat(let userChat):
125− cell.fill(with: currentActiveDialogs[indexPath.row], user: users[userChat.user])
75+ cell.textLabel?.text = "👤 \(users[userChat.user]!.fullName())"
76+ cell.detailTextLabel?.text = userChat.lastMessage!.body.markdown
126 }
77 }
127−
78+
128 return cell
79 return cell
129 }
80 }
130
81
@@ -133,49 +84,3 @@ class MessagesViewController: UITableViewController, UISearchControllerDelegate,
133 onDialogDisplay?(tuple)
84 onDialogDisplay?(tuple)
134 }
85 }
135}
86}
136−
137−
138−class SuggestedDialogsTableViewController: UITableViewController {
139−
140− var idCell = "cell"
141−
142− var users: [Int: Model.Users] = [:]
143−
144− weak var delegate: SelectableDialog?
145−
146− var currentDialogs: [Model.Dialog] = []
147−
148− override func viewDidLoad() {
149− super.viewDidLoad()
150− tableView.register(UITableViewCell.self, forCellReuseIdentifier: idCell)
151− tableView.reloadData()
152− }
153−
154− override func numberOfSections(in tableView: UITableView) -> Int {
155− return 1
156− }
157−
158− override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
159− return currentDialogs.count
160− }
161−
162− override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
163− {
164− let cell = tableView.dequeueReusableCell(withIdentifier: idCell, for: indexPath)
165−
166− switch currentDialogs[indexPath.row] {
167− case .groupChat(let groupChat):
168− cell.textLabel?.text = groupChat.group.name
169− case .userChat(let userChat):
170− cell.textLabel?.text = users[userChat.user]?.fullName()
171− }
172−
173− cell.accessoryType = .disclosureIndicator
174− return cell
175− }
176−
177− override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
178− delegate?.openDialog(with: currentDialogs[indexPath.row])
179− // self.dismiss(animated: true)
180− }
181−}
GDproject/Controller/Messages/PeopleToWriteViewController.swift+1
@@ -53,6 +53,7 @@ class PeopleToWriteViewController: UITableViewController {
53 let cell = tableView.dequeueReusableCell(withIdentifier: "peopleToWriteCell", for: indexPath)
53 let cell = tableView.dequeueReusableCell(withIdentifier: "peopleToWriteCell", for: indexPath)
54
54
55 cell.textLabel?.text = users[indexPath.row].fullName()
55 cell.textLabel?.text = users[indexPath.row].fullName()
56+ cell.detailTextLabel?.text = "\(users[indexPath.row].id)"
56
57
57 return cell
58 return cell
58 }
59 }
GDproject/Controller/Profile/BasicInfoController.swift+11−16
@@ -16,20 +16,17 @@ struct CellData{
16
16
17class BasicInfoController: UIViewController, UITableViewDelegate, UITableViewDataSource {
17class BasicInfoController: UIViewController, UITableViewDelegate, UITableViewDataSource {
18
18
19− var userInfo: Model.Users? {
19+ var dataSourse: [CellData] = [
20− didSet {
20+ CellData(opened: false, title: "Phone", sectionData: ["+7 901 733 01 79"]),
21− if let userInfo = userInfo {
22− dataSourse = [CellData(opened: false, title: "Contacts", sectionData: [userInfo.email, userInfo.faculty.address]),
21+ CellData(opened: false, title: "Mail", sectionData: ["vbogomazova@edu.hse.ru"]),
23− CellData(opened: false, title: "Faculty", sectionData: [userInfo.faculty.campusName, userInfo.faculty.name, userInfo.faculty.address, userInfo.faculty.path]),
22+ CellData(opened: false, title: "Research ID", sectionData: ["4567834336789456737"]),
23+ CellData(opened: false, title: "Published", sectionData: ["Это будет очень длинное название книги 1, чтобы сделать проверку", "Книга 2", "Книга 3"]),
24− CellData(opened: false, title: "Interests", sectionData: userInfo.faculty.tags)]
24+ CellData(opened: false, title: "Courses", sectionData: ["Курс 1", "Курс 2"]),
25− }
25+ CellData(opened: false, title: "Link", sectionData: ["https://wwww.hse.ru"])
26− }
26+ ]
27− }
28−
29− var dataSourse: [CellData] = [ ]
30
27
31 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
28 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
32− if (dataSourse[section].opened) {
29+ if (dataSourse[section].opened){
33 return dataSourse[section].sectionData.count + 1
30 return dataSourse[section].sectionData.count + 1
34 } else {
31 } else {
35 return 1
32 return 1
@@ -48,10 +45,8 @@ class BasicInfoController: UIViewController, UITableViewDelegate, UITableViewDat
48 cell.selectionStyle = .none
45 cell.selectionStyle = .none
49 return cell
46 return cell
50 } else {
47 } else {
51− let cell = tableView.dequeueReusableCell(withIdentifier: infoCellId, for: indexPath) as! InfoCell
48+ let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
52− cell.fill(title: dataSourse[indexPath.section].sectionData[indexPath.row - 1])
49+ cell.textLabel?.text = dataSourse[indexPath.section].sectionData[indexPath.row - 1]
53− cell.accessoryType = .none
54− cell.selectionStyle = .none
55 return cell
50 return cell
56 }
51 }
57 }
52 }
GDproject/Controller/Profile/InfoCell.swift+1−2
@@ -16,9 +16,8 @@ class InfoCell: UITableViewCell{
16 label.font = UIFont.systemFont(ofSize: 16)
16 label.font = UIFont.systemFont(ofSize: 16)
17 label.sizeToFit()
17 label.sizeToFit()
18 label.isScrollEnabled = false
18 label.isScrollEnabled = false
19− // label.isUserInteractionEnabled = false
19+ label.isUserInteractionEnabled = false
20 label.isEditable = false
20 label.isEditable = false
21− label.dataDetectorTypes = .all
22 label.textColor = .black
21 label.textColor = .black
23 return label
22 return label
24 }()
23 }()
GDproject/Controller/Profile/ProfileViewController.swift+23−88
@@ -9,17 +9,8 @@
9import UIKit
9import UIKit
10import TinyConstraints
10import TinyConstraints
11
11
12−protocol UpdateUser: class {
13− func updateUserObj(with user: Model.Users)
14−}
15−
16−class ProfileViewController: UIViewController, UpdateUser
12+class ProfileViewController: UIViewController
17{
13{
18− func updateUserObj(with user: Model.Users)
19− {
20− self.user = user
21− Model.Channels.fullPeopleDict[user.id] = user
22− }
23
14
24 @IBOutlet weak var segmentedControl: UISegmentedControl!
15 @IBOutlet weak var segmentedControl: UISegmentedControl!
25
16
@@ -41,8 +32,6 @@ class ProfileViewController: UIViewController, UpdateUser
41
32
42 var logOut: (()->())?
33 var logOut: (()->())?
43
34
44− var deleteAllSessions: (()->())?
45−
46 var onSettings: (()->())?
35 var onSettings: (()->())?
47
36
48 @IBAction func sendMessage(_ sender: UIButton)
37 @IBAction func sendMessage(_ sender: UIButton)
@@ -57,6 +46,8 @@ class ProfileViewController: UIViewController, UpdateUser
57 }
46 }
58 }
47 }
59
48
49+ var onChannelsListToAddAPerson: ((Model.Users)->())?
50+
60 var protoDictionary: [String: UIImage] = ["135213": #imageLiteral(resourceName: "9"), "135288": #imageLiteral(resourceName: "5051"), "22723" : #imageLiteral(resourceName: "69"), "135083": #imageLiteral(resourceName: "42")]
51 var protoDictionary: [String: UIImage] = ["135213": #imageLiteral(resourceName: "9"), "135288": #imageLiteral(resourceName: "5051"), "22723" : #imageLiteral(resourceName: "69"), "135083": #imageLiteral(resourceName: "42")]
61
52
62 func fill(with user: Model.Users)
53 func fill(with user: Model.Users)
@@ -65,7 +56,7 @@ class ProfileViewController: UIViewController, UpdateUser
65 self.nameLabel.text = "\(user.firstName) \(user.middleName)"
56 self.nameLabel.text = "\(user.firstName) \(user.middleName)"
66 self.surnameLabel.text = "\(user.lastName)"
57 self.surnameLabel.text = "\(user.lastName)"
67 self.profileImageView.image = protoDictionary[user.faculty.campusCode]?.roundedImage
58 self.profileImageView.image = protoDictionary[user.faculty.campusCode]?.roundedImage
68− self.placeLabel.text = "📍\(user.faculty.address)"
59+ self.placeLabel.text = "📍\(user.faculty.campusName)"
69 if user.id == DataStorage.standard.getUserId() {
60 if user.id == DataStorage.standard.getUserId() {
70 newMessageButton.isHidden = true
61 newMessageButton.isHidden = true
71 } else {
62 } else {
@@ -115,15 +106,6 @@ class ProfileViewController: UIViewController, UpdateUser
115 posts.type = .NONE
106 posts.type = .NONE
116 posts.currChannel = channel
107 posts.currChannel = channel
117
108
118− posts.onFullPost = {
119− [weak self] (type,post) in
120−
121− let vc = self?.storyboard?.instantiateViewController(withIdentifier: fullPostControllerId) as! FullPostController
122− vc.type = type
123− vc.post = post
124− self?.navigationController!.pushViewController(vc, animated: true)
125− }
126−
127 tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
109 tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
128
110
129 tableView.register(PostViewCell.self, forCellReuseIdentifier: postCellId)
111 tableView.register(PostViewCell.self, forCellReuseIdentifier: postCellId)
@@ -159,7 +141,7 @@ class ProfileViewController: UIViewController, UpdateUser
159 }
141 }
160
142
161 func setUpNavigarionBar(){
143 func setUpNavigarionBar(){
162− // navigationController?.navigationBar.prefersLargeTitles = true
144+ navigationController?.navigationBar.prefersLargeTitles = true
163 let uibarbutton = UIBarButtonItem(title: "More", style: .plain, target: self, action: #selector(showInformation))
145 let uibarbutton = UIBarButtonItem(title: "More", style: .plain, target: self, action: #selector(showInformation))
164 navigationItem.rightBarButtonItems = [uibarbutton]
146 navigationItem.rightBarButtonItems = [uibarbutton]
165 navigationItem.largeTitleDisplayMode = .always
147 navigationItem.largeTitleDisplayMode = .always
@@ -169,75 +151,29 @@ class ProfileViewController: UIViewController, UpdateUser
169
151
170 let optionMenu = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
152 let optionMenu = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
171
153
172−
173− let cancelAction = UIAlertAction(title: "Cancel", style: .cancel)
154+ let channelAction = UIAlertAction(title: "Add to a channel", style: .default){
155+ [weak self] (_) in
156+ self?.onChannelsListToAddAPerson?(self!.user!)
157+ }
174
158
159+ let settingsAction = UIAlertAction(title: "Setting", style: .default)
160+ { [weak self] (_) in
161+ self?.onSettings?()
162+ }
175
163
176− if idProfile == DataStorage.standard.getUserId() {
164+ let cancelAction = UIAlertAction(title: "Cancel", style: .cancel)
165+
177− let logoutAction = UIAlertAction(title: "Log out", style: .destructive)
166+ let logoutAction = UIAlertAction(title: "Log out", style: .destructive)
178− { [weak self] (_) in
167+ { [weak self]
179−
180− if let logOut = self?.logOut {
181− logOut()
182− } else {
183− Model.logout() {
184− DataStorage.standard.setIsLoggedIn(value: false, with: 0)
185− (UIApplication.shared.delegate as! AppDelegate).relaunch()
186− }
187− }
188− }
189−
190− let deleetAllSessionsAction = UIAlertAction(title: "Delete all sessions", style: .destructive)
191− { [weak self] _ in
192−
193− if let delete = self?.deleteAllSessions {
194− delete()
195− } else {
196− Model.deactivateAll() {
197− DataStorage.standard.setIsLoggedIn(value: false, with: 0)
198− (UIApplication.shared.delegate as! AppDelegate).relaunch()
199− }
200− }
201− }
202−
203− let settingsAction = UIAlertAction(title: "Edit profile", style: .default)
204− { [weak self] (_) in
168+ (_) in
205−
169+ self?.logOut?()
206− if let settings = self?.onSettings{
207− settings()
208− } else {
209− let vc = self?.storyboard?.instantiateViewController(withIdentifier: "RegisterTableViewController") as! RegisterTableViewController
210− vc.delegate = self
211− vc.userActive = self?.user
212−
213− self?.navigationController?.pushViewController(vc, animated: true)
214− }
215− }
216−
217− optionMenu.addAction(settingsAction)
218− optionMenu.addAction(logoutAction)
219− optionMenu.addAction(deleetAllSessionsAction)
220− } else {
221− let channelAction = UIAlertAction(title: "Add to a channel", style: .default)
222− {
223− [weak self] (_) in
224−
225− let vc = self?.storyboard?.instantiateViewController(withIdentifier: simplifiedChannelsList) as! SimplifiedChannelsList
226− vc.user = self?.user
227−
228− let transition = CATransition()
229− transition.duration = 0.5
230− transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
231− transition.type = CATransitionType.moveIn
232− transition.subtype = CATransitionSubtype.fromTop
233− self?.navigationController?.view.layer.add(transition, forKey: nil)
234− self?.navigationController?.pushViewController(vc, animated: false)
235− }
236−
237− optionMenu.addAction(channelAction)
238 }
170 }
239
171
172+ optionMenu.addAction(channelAction)
173+ optionMenu.addAction(settingsAction)
174+ optionMenu.addAction(logoutAction)
240 optionMenu.addAction(cancelAction)
175 optionMenu.addAction(cancelAction)
176+
241 self.present(optionMenu, animated: true, completion: nil)
177 self.present(optionMenu, animated: true, completion: nil)
242 }
178 }
243
179
@@ -267,7 +203,6 @@ class ProfileViewController: UIViewController, UpdateUser
267 func changeToBasicInfo(){
203 func changeToBasicInfo(){
268 tableView.delegate = basicInfo
204 tableView.delegate = basicInfo
269 tableView.dataSource = basicInfo
205 tableView.dataSource = basicInfo
270− basicInfo.userInfo = self.user
271 tableView.reloadData()
206 tableView.reloadData()
272 }
207 }
273}
208}
GDproject/DataStorage.swift−8
@@ -37,13 +37,6 @@ class DataStorage{
37 return UserDefaults.standard.integer(forKey: UserDefaultsKeys.id.rawValue)
37 return UserDefaults.standard.integer(forKey: UserDefaultsKeys.id.rawValue)
38 }
38 }
39
39
40− func setEmail(email: String) {
41− UserDefaults.standard.set(email, forKey: UserDefaultsKeys.email.rawValue)
42− }
43−
44− func getEmail() -> String? {
45− return UserDefaults.standard.string(forKey: UserDefaultsKeys.email.rawValue)
46− }
47 /**
40 /**
48 Function to determine is user logged in already or not
41 Function to determine is user logged in already or not
49 */
42 */
@@ -56,5 +49,4 @@ class DataStorage{
56enum UserDefaultsKeys: String{
49enum UserDefaultsKeys: String{
57 case loggedIn
50 case loggedIn
58 case id
51 case id
59− case email
60}
52}
GDproject/Extentions.swift−30
@@ -77,33 +77,3 @@ extension String {
77 return timeStamp
77 return timeStamp
78 }
78 }
79}
79}
80−
81−extension UIViewController {
82− func showAlertOn(result: ResultR) {
83−
84− let message: String
85−
86− switch result {
87− case .impossibleContent:
88− message = "Impossible content"
89− case .exceededContent:
90− message = "The content exceeded"
91− case .longContent:
92− message = "The content is too long"
93− case .badAccess:
94− message = "Try reloading the page again"
95− case .alreadyRegistered:
96− message = "User is already registered"
97− case .tooMuchToAdd:
98− message = "Limit of channels exceeded"
99− case .success, .success1:
100− return
101− default:
102− message = "Something went wrong"
103− }
104−
105− let alert = UIAlertController(title: "Error", message: message, preferredStyle: .alert)
106− alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
107− self.present(alert, animated: true, completion: nil)
108− }
109−}
GDproject/Simple model/Model.swift+14−166
@@ -10,22 +10,6 @@ import Foundation
10import UIKit
10import UIKit
11import Alamofire
11import Alamofire
12
12
13−enum ResultR: Int {
14− case internalServerError = 500
15− case exceededContent = 470
16− case longContent = 471
17− case incorrectContent = 472
18− case impossibleContent = 473
19− case invalidTocken = 498
20− case alreadyRegistered = 409
21− case invalidCode = 403
22− case badAccess = 400
23− case tooMuchToAdd = 406
24− case notFound = 404
25− case success1 = 204
26− case success = 200
27−}
28−
29class Model{
13class Model{
30
14
31 static let invalidTocken = 498
15 static let invalidTocken = 498
@@ -35,12 +19,10 @@ class Model{
35 private static var isValidTocken: ((Int)->())? = { responce in
19 private static var isValidTocken: ((Int)->())? = { responce in
36 print(responce)
20 print(responce)
37 if responce == invalidTocken {
21 if responce == invalidTocken {
38−
39− DataStorage.standard.setIsLoggedIn(value: false, with: 0)
40− (UIApplication.shared.delegate as! AppDelegate).relaunch()
41−
42 Model.logout {
22 Model.logout {
43 print("Logout Is Successful")
23 print("Logout Is Successful")
24+ DataStorage.standard.setIsLoggedIn(value: false, with: 0)
25+ (UIApplication.shared.delegate as! AppDelegate).relaunch()
44 }
26 }
45 }
27 }
46 }
28 }
@@ -49,7 +31,6 @@ class Model{
49 static let decoder = JSONDecoder()
31 static let decoder = JSONDecoder()
50
32
51 static let authMeURL = URL(string: "\(baseUrl)/authentication/me")!
33 static let authMeURL = URL(string: "\(baseUrl)/authentication/me")!
52− static let deactivateURL = URL(string: "\(baseUrl)/deactivateAll")!
53 static let registerMeURL = URL(string: "\(baseUrl)/authentication/register")!
34 static let registerMeURL = URL(string: "\(baseUrl)/authentication/register")!
54 static let authVerifyURL = URL(string: "\(baseUrl)/authentication/verify")!
35 static let authVerifyURL = URL(string: "\(baseUrl)/authentication/verify")!
55 static let authenticationURL = URL(string:"\(baseUrl)/authentication/login")!
36 static let authenticationURL = URL(string:"\(baseUrl)/authentication/login")!
@@ -59,7 +40,6 @@ class Model{
59 static let postsPublishURL = URL(string:"\(baseUrl)/posts/publish")!
40 static let postsPublishURL = URL(string:"\(baseUrl)/posts/publish")!
60 static let usersURL = URL(string:"\(baseUrl)/users")!
41 static let usersURL = URL(string:"\(baseUrl)/users")!
61 static let usersAllURL = URL(string:"\(baseUrl)/users/all")!
42 static let usersAllURL = URL(string:"\(baseUrl)/users/all")!
62− static let usersUpdateURL = URL(string:"\(baseUrl)/users/update")!
63 static let channelsGetURL = URL(string: "\(baseUrl)/channels/get")!
43 static let channelsGetURL = URL(string: "\(baseUrl)/channels/get")!
64 static let channelsUpdateURL = URL(string: "\(baseUrl)/channels/update")!
44 static let channelsUpdateURL = URL(string: "\(baseUrl)/channels/update")!
65 static let channelsListURL = URL(string: "\(baseUrl)/channels")!
45 static let channelsListURL = URL(string: "\(baseUrl)/channels")!
@@ -228,10 +208,6 @@ class Model{
228 AF.request(request).response { (responce) in
208 AF.request(request).response { (responce) in
229 isValidTocken?(responce.response?.statusCode ?? 498)
209 isValidTocken?(responce.response?.statusCode ?? 498)
230
210
231− if let code = responce.response?.statusCode, code == 498 {
232− return
233− }
234−
235 completion()
211 completion()
236 }
212 }
237 }
213 }
@@ -264,14 +240,11 @@ class Model{
264 guard let code = responce.response?.statusCode else { return }
240 guard let code = responce.response?.statusCode else { return }
265 isValidTocken?(code)
241 isValidTocken?(code)
266
242
267− if let code = responce.response?.statusCode, code == 498 {
268− return
269− }
270−
271 if code == 204 {
243 if code == 204 {
272−
273 let fields = responce.response?.allHeaderFields as? [String :String]
244 let fields = responce.response?.allHeaderFields as? [String :String]
245+
274 let cookies = HTTPCookie.cookies(withResponseHeaderFields: fields!, for: responce.response!.url!)
246 let cookies = HTTPCookie.cookies(withResponseHeaderFields: fields!, for: responce.response!.url!)
247+
275 HTTPCookieStorage.shared.setCookie(cookies[0])
248 HTTPCookieStorage.shared.setCookie(cookies[0])
276
249
277 completion()
250 completion()
@@ -291,16 +264,12 @@ class Model{
291 guard let statusCode = responce.response?.statusCode else { completion(false); return }
264 guard let statusCode = responce.response?.statusCode else { completion(false); return }
292 isValidTocken?(statusCode)
265 isValidTocken?(statusCode)
293
266
294− if let code = responce.response?.statusCode, code == 498 {
295− return
296− }
297−
298 if statusCode == 204 {
267 if statusCode == 204 {
299 // at this point cookies are set
268 // at this point cookies are set
300 completion(true)
269 completion(true)
301− } else {
302− completion(false)
303 }
270 }
271+
272+ completion(false)
304 }
273 }
305 }
274 }
306
275
@@ -314,10 +283,6 @@ class Model{
314 guard let statusCode = responce.response?.statusCode else { completion(false); return }
283 guard let statusCode = responce.response?.statusCode else { completion(false); return }
315 isValidTocken?(statusCode)
284 isValidTocken?(statusCode)
316
285
317− if let code = responce.response?.statusCode, code == 498 {
318− return
319− }
320−
321 guard let json = responce.data else { return }
286 guard let json = responce.data else { return }
322 guard let personId = Int(String(data: json, encoding: String.Encoding.utf8)!) else {
287 guard let personId = Int(String(data: json, encoding: String.Encoding.utf8)!) else {
323 completion(false)
288 completion(false)
@@ -412,10 +377,6 @@ class Model{
412
377
413 isValidTocken?(response.response?.statusCode ?? 498)
378 isValidTocken?(response.response?.statusCode ?? 498)
414
379
415− if let code = response.response?.statusCode, code == 498 {
416− return
417− }
418−
419 guard let json = response.data else { return }
380 guard let json = response.data else { return }
420
381
421 guard let newQueery = try? decoder.decode(QueryPosts<Posts>.self, from: json) else { print("no")
382 guard let newQueery = try? decoder.decode(QueryPosts<Posts>.self, from: json) else { print("no")
@@ -427,7 +388,7 @@ class Model{
427 }
388 }
428
389
429
390
430− static func createAndPublish(body: [Attachments], tags: [String], completion: @escaping ((ResultR)->())){
391+ static func createAndPublish(body: [Attachments], tags: [String]){
431 let jsonUpd = CreatedPost(body: body, tags: tags)
392 let jsonUpd = CreatedPost(body: body, tags: tags)
432 var request = URLRequest(url: postsPublishURL)
393 var request = URLRequest(url: postsPublishURL)
433
394
@@ -441,18 +402,6 @@ class Model{
441 (response) in
402 (response) in
442
403
443 isValidTocken?(response.response?.statusCode ?? 498)
404 isValidTocken?(response.response?.statusCode ?? 498)
444−
445− if let code = response.response?.statusCode, code == 498 {
446− return
447− }
448−
449− if let code = response.response?.statusCode,
450− let result = ResultR(rawValue: code)
451− {
452− completion(result)
453− } else {
454− completion(.internalServerError)
455− }
456 }
405 }
457 }
406 }
458
407
@@ -478,10 +427,6 @@ class Model{
478
427
479 isValidTocken?(response.response?.statusCode ?? 498)
428 isValidTocken?(response.response?.statusCode ?? 498)
480
429
481− if let code = response.response?.statusCode, code == 498 {
482− return
483− }
484−
485 guard let json = response.data else { return }
430 guard let json = response.data else { return }
486
431
487 guard let newPost = try? decoder.decode(QueryPosts<Posts>.self, from: json) else { return }
432 guard let newPost = try? decoder.decode(QueryPosts<Posts>.self, from: json) else { return }
@@ -494,7 +439,7 @@ class Model{
494
439
495 static func getUsers(for ids: [Int], completion: @escaping (([Int:Users])->())){
440 static func getUsers(for ids: [Int], completion: @escaping (([Int:Users])->())){
496 let json = "\(Set(ids))"
441 let json = "\(Set(ids))"
497−
442+ print(json)
498 var request = URLRequest(url: usersURL)
443 var request = URLRequest(url: usersURL)
499
444
500 request.httpMethod = "POST"
445 request.httpMethod = "POST"
@@ -508,10 +453,6 @@ class Model{
508
453
509 isValidTocken?(response.response?.statusCode ?? 498)
454 isValidTocken?(response.response?.statusCode ?? 498)
510
455
511− if let code = response.response?.statusCode, code == 498 {
512− return
513− }
514−
515 guard let json = response.data else { return }
456 guard let json = response.data else { return }
516
457
517 guard let users = try? decoder.decode([Users].self, from: json) else { return }
458 guard let users = try? decoder.decode([Users].self, from: json) else { return }
@@ -544,9 +485,6 @@ class Model{
544
485
545 isValidTocken?(response.response?.statusCode ?? 498)
486 isValidTocken?(response.response?.statusCode ?? 498)
546
487
547− if let code = response.response?.statusCode, code == 498 {
548− return
549− }
550
488
551 guard let json = response.data else { return }
489 guard let json = response.data else { return }
552
490
@@ -558,7 +496,7 @@ class Model{
558 }
496 }
559
497
560
498
561− static func createChannel(with channel: Channels, completion: @escaping ((ResultR)->())) {
499+ static func createChannel(with channel: Channels) {
562
500
563 var request = URLRequest(url: channelsCreateURL)
501 var request = URLRequest(url: channelsCreateURL)
564 request.httpMethod = "POST"
502 request.httpMethod = "POST"
@@ -569,13 +507,6 @@ class Model{
569 (response) in
507 (response) in
570
508
571 isValidTocken?(response.response?.statusCode ?? 498)
509 isValidTocken?(response.response?.statusCode ?? 498)
572−
573− if let code = response.response?.statusCode, let result = ResultR(rawValue: code) {
574− completion(result)
575− return
576− }
577−
578− completion(ResultR.internalServerError)
579 }
510 }
580
511
581 }
512 }
@@ -588,9 +519,6 @@ class Model{
588 AF.request(request).responseJSON { (response) in
519 AF.request(request).responseJSON { (response) in
589
520
590 isValidTocken?(response.response?.statusCode ?? 498)
521 isValidTocken?(response.response?.statusCode ?? 498)
591− if let code = response.response?.statusCode, code == 498 {
592− return
593− }
594
522
595 guard let json = response.data else { return }
523 guard let json = response.data else { return }
596
524
@@ -609,9 +537,6 @@ class Model{
609
537
610 AF.request(request).response { (response) in
538 AF.request(request).response { (response) in
611 isValidTocken?(response.response?.statusCode ?? 498)
539 isValidTocken?(response.response?.statusCode ?? 498)
612− if let code = response.response?.statusCode, code == 498 {
613− return
614− }
615 }
540 }
616 completion()
541 completion()
617 }
542 }
@@ -627,9 +552,6 @@ class Model{
627 (response) in
552 (response) in
628
553
629 isValidTocken?(response.response?.statusCode ?? 498)
554 isValidTocken?(response.response?.statusCode ?? 498)
630− if let code = response.response?.statusCode, code == 498 {
631− return
632− }
633 }
555 }
634 }
556 }
635
557
@@ -652,9 +574,6 @@ class Model{
652 }
574 }
653
575
654 isValidTocken?(response.response?.statusCode ?? 498)
576 isValidTocken?(response.response?.statusCode ?? 498)
655− if let code = response.response?.statusCode, code == 498 {
656− return
657− }
658 }
577 }
659 }
578 }
660
579
@@ -730,13 +649,12 @@ class Model{
730 (response) in
649 (response) in
731
650
732 isValidTocken?(response.response?.statusCode ?? 498)
651 isValidTocken?(response.response?.statusCode ?? 498)
733− if let code = response.response?.statusCode, code == 498 {
734− return
735− }
736
652
737 guard let json = response.data else { return }
653 guard let json = response.data else { return }
738
654
739 guard let newQueery = try? decoder.decode(QueryPosts<Posts>.self, from: json) else { return }
655 guard let newQueery = try? decoder.decode(QueryPosts<Posts>.self, from: json) else { return }
656+
657+ print("\(anonymousChannel) \(newQueery)")
740 completion((newQueery.users, newQueery.response))
658 completion((newQueery.users, newQueery.response))
741 }
659 }
742 }
660 }
@@ -746,9 +664,6 @@ class Model{
746 AF.request(URLRequest(url: hashTagTreeURL)).responseJSON {
664 AF.request(URLRequest(url: hashTagTreeURL)).responseJSON {
747 (response) in
665 (response) in
748 isValidTocken?(response.response?.statusCode ?? 498)
666 isValidTocken?(response.response?.statusCode ?? 498)
749− if let code = response.response?.statusCode, code == 498 {
750− return
751− }
752 guard let json = response.data else { return }
667 guard let json = response.data else { return }
753 guard let tree = try? decoder.decode(CompletionTree.self, from: json) else { return }
668 guard let tree = try? decoder.decode(CompletionTree.self, from: json) else { return }
754 completion(tree)
669 completion(tree)
@@ -766,10 +681,6 @@ class Model{
766 AF.request(request).responseJSON { response in
681 AF.request(request).responseJSON { response in
767 isValidTocken?(response.response?.statusCode ?? 498)
682 isValidTocken?(response.response?.statusCode ?? 498)
768
683
769− if let code = response.response?.statusCode, code == 498 {
770− return
771− }
772−
773 guard let json = response.data else { return }
684 guard let json = response.data else { return }
774 let dialogs = try! decoder.decode(QueryPosts<Dialog>.self, from: json)
685 let dialogs = try! decoder.decode(QueryPosts<Dialog>.self, from: json)
775
686
@@ -941,9 +852,6 @@ class Model{
941 AF.request(request).response { (response) in
852 AF.request(request).response { (response) in
942
853
943 isValidTocken?(response.response?.statusCode ?? 498)
854 isValidTocken?(response.response?.statusCode ?? 498)
944− if let code = response.response?.statusCode, code == 498 {
945− return
946− }
947
855
948 guard let json = response.data else { return }
856 guard let json = response.data else { return }
949 let stringInt = String.init(data: json, encoding: String.Encoding.utf8)
857 let stringInt = String.init(data: json, encoding: String.Encoding.utf8)
@@ -953,7 +861,7 @@ class Model{
953 }
861 }
954 }
862 }
955
863
956− static func getMessagesFor(typeOfChat: Model.Dialog, chat id: Int, exclusiveFrom: Int? = nil, limit l: Int = 25, direction: String = "backward", completion: @escaping (([LastMessage])->()))
864+ static func getMessagesFor(typeOfChat: Model.Dialog, chat id: Int, exclusiveFrom: Int? = nil, limit l: Int = 10, direction: String = "backward", completion: @escaping (([LastMessage])->()))
957 {
865 {
958 let req = GeneralRequest<Int>(direction: direction, limit: l, exclusiveFrom: exclusiveFrom, request: id)
866 let req = GeneralRequest<Int>(direction: direction, limit: l, exclusiveFrom: exclusiveFrom, request: id)
959 var request: URLRequest?
867 var request: URLRequest?
@@ -972,9 +880,6 @@ class Model{
972 AF.request(request!).response { (response) in
880 AF.request(request!).response { (response) in
973
881
974 isValidTocken?(response.response?.statusCode ?? 498)
882 isValidTocken?(response.response?.statusCode ?? 498)
975− if let code = response.response?.statusCode, code == 498 {
976− return
977− }
978
883
979 guard let json = response.data else { return }
884 guard let json = response.data else { return }
980 guard let messages = try? decoder.decode([LastMessage].self, from: json) else { return }
885 guard let messages = try? decoder.decode([LastMessage].self, from: json) else { return }
@@ -992,10 +897,6 @@ class Model{
992
897
993 AF.request(request).response { (response) in
898 AF.request(request).response { (response) in
994 isValidTocken?(response.response?.statusCode ?? 498)
899 isValidTocken?(response.response?.statusCode ?? 498)
995−
996− if let code = response.response?.statusCode, code == 498 {
997− return
998− }
999 }
900 }
1000
901
1001 completion()
902 completion()
@@ -1010,10 +911,6 @@ class Model{
1010
911
1011 AF.request(request).response { (response) in
912 AF.request(request).response { (response) in
1012 isValidTocken?(response.response?.statusCode ?? 498)
913 isValidTocken?(response.response?.statusCode ?? 498)
1013−
1014− if let code = response.response?.statusCode, code == 498 {
1015− return
1016− }
1017 }
914 }
1018
915
1019 // completion()
916 // completion()
@@ -1056,7 +953,7 @@ class Model{
1056 }
953 }
1057 }
954 }
1058
955
1059− static func sendMessage(message: SendMessage, completion: @escaping ((ResultR)->())){
956+ static func sendMessage(message: SendMessage, completion: @escaping (()->())){
1060
957
1061 var request = URLRequest(url: messagesSendURL)
958 var request = URLRequest(url: messagesSendURL)
1062 request.setValue("application/json; charset=utf-8", forHTTPHeaderField: "Content-Type")
959 request.setValue("application/json; charset=utf-8", forHTTPHeaderField: "Content-Type")
@@ -1066,15 +963,7 @@ class Model{
1066 AF.request(request).response { (response) in
963 AF.request(request).response { (response) in
1067 isValidTocken?(response.response?.statusCode ?? 498)
964 isValidTocken?(response.response?.statusCode ?? 498)
1068
965
1069− if let code = response.response?.statusCode, code == 498 {
1070− return
1071− }
1072−
1073− if let result = ResultR(rawValue: response.response!.statusCode){
1074− completion(result)
966+ completion()
1075− } else {
1076− completion(.internalServerError)
1077− }
1078 }
967 }
1079 }
968 }
1080
969
@@ -1087,7 +976,6 @@ class Model{
1087 var campusCode: String
976 var campusCode: String
1088 var name: String
977 var name: String
1089 var tags: [String]
978 var tags: [String]
1090− var address: String
1091
979
1092 }
980 }
1093
981
@@ -1101,50 +989,10 @@ class Model{
1101 AF.request(request).response { (response) in
989 AF.request(request).response { (response) in
1102 isValidTocken?(response.response?.statusCode ?? 498)
990 isValidTocken?(response.response?.statusCode ?? 498)
1103
991
1104− if let code = response.response?.statusCode, code == 498 {
1105− return
1106− }
1107−
1108 guard let json = response.data else { return }
992 guard let json = response.data else { return }
1109 guard let faculties = try? decoder.decode([Faculty].self, from: json) else { return }
993 guard let faculties = try? decoder.decode([Faculty].self, from: json) else { return }
1110
994
1111 completion(faculties)
995 completion(faculties)
1112 }
996 }
1113 }
997 }
1114−
1115− static func userUpdate(with newUser: NewRegistration, completion: @escaping ((Bool)->())) {
1116− var request = URLRequest(url: usersUpdateURL)
1117− request.setValue("application/json; charset=utf-8", forHTTPHeaderField: "Content-Type")
1118− request.httpMethod = "POST"
1119− request.httpBody = try? JSONEncoder().encode(newUser)
1120−
1121− AF.request(request).response { (response) in
1122− isValidTocken?(response.response?.statusCode ?? 498)
1123−
1124− if let code = response.response?.statusCode, code == 498 {
1125− return
1126− }
1127−
1128− if let code = response.response?.statusCode, code != 204{
1129− completion (false)
1130− } else {
1131− completion(true)
1132− }
1133− }
1134− }
1135−
1136− static func deactivateAll(completion: @escaping (()->())){
1137− var request = URLRequest(url: deactivateURL)
1138− request.httpMethod = "DELETE"
1139−
1140− AF.request(request).response { (responce) in
1141− isValidTocken?(responce.response?.statusCode ?? 498)
1142−
1143− if let code = responce.response?.statusCode, code == 498 {
1144− return
1145− }
1146−
1147− completion()
1148− }
1149− }
1150}
998}