git.iko.soy/dashared/GDproject
on master help sign in
minor chanes
011b79cDarya Rednikina
Cartfile+2−1
@@ -2,4 +2,5 @@ github "robb/Cartography"
2github "ivanbruel/MarkdownKit"
2github "ivanbruel/MarkdownKit"
3github "roberthein/TinyConstraints"
3github "roberthein/TinyConstraints"
4github "macteo/Marklight"
4github "macteo/Marklight"
5−github "ElaWorkshop/TagListView"
5+github "ElaWorkshop/TagListView"
6+github "Alamofire/Alamofire" "5.0.0-beta.2"
GDproject.xcodeproj/project.pbxproj+10
@@ -9,6 +9,9 @@
9/* Begin PBXBuildFile section */
9/* Begin PBXBuildFile section */
10 123E37A5221F1B3200F6E42A /* LogInViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 123E37A4221F1B3200F6E42A /* LogInViewController.swift */; };
10 123E37A5221F1B3200F6E42A /* LogInViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 123E37A4221F1B3200F6E42A /* LogInViewController.swift */; };
11 123E37A7221F1DD700F6E42A /* MainController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 123E37A6221F1DD700F6E42A /* MainController.swift */; };
11 123E37A7221F1DD700F6E42A /* MainController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 123E37A6221F1DD700F6E42A /* MainController.swift */; };
12+ 124CC7032221C00C009DF531 /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = 124CC7022221C00C009DF531 /* Model.swift */; };
13+ 124CC7052221C2BB009DF531 /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 124CC7042221C2BA009DF531 /* Alamofire.framework */; };
14+ 124CC7072221C2C3009DF531 /* Alamofire.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 124CC7042221C2BA009DF531 /* Alamofire.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
12 125BD57D22171D2A008A3575 /* ProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD57C22171D2A008A3575 /* ProfileViewController.swift */; };
15 125BD57D22171D2A008A3575 /* ProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD57C22171D2A008A3575 /* ProfileViewController.swift */; };
13 125BD57F22171D73008A3575 /* Extentions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD57E22171D73008A3575 /* Extentions.swift */; };
16 125BD57F22171D73008A3575 /* Extentions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD57E22171D73008A3575 /* Extentions.swift */; };
14 125BD5812217314A008A3575 /* NewsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD5802217314A008A3575 /* NewsVC.swift */; };
17 125BD5812217314A008A3575 /* NewsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD5802217314A008A3575 /* NewsVC.swift */; };
@@ -56,6 +59,7 @@
56 dstSubfolderSpec = 10;
59 dstSubfolderSpec = 10;
57 files = (
60 files = (
58 12E36DC0221441DB006FCDD7 /* Marklight.framework in Embed Frameworks */,
61 12E36DC0221441DB006FCDD7 /* Marklight.framework in Embed Frameworks */,
62+ 124CC7072221C2C3009DF531 /* Alamofire.framework in Embed Frameworks */,
59 12E36DC4221441EA006FCDD7 /* Cartography.framework in Embed Frameworks */,
63 12E36DC4221441EA006FCDD7 /* Cartography.framework in Embed Frameworks */,
60 12E36DD9221594A9006FCDD7 /* TagListView.framework in Embed Frameworks */,
64 12E36DD9221594A9006FCDD7 /* TagListView.framework in Embed Frameworks */,
61 12E36DBD221441D5006FCDD7 /* TinyConstraints.framework in Embed Frameworks */,
65 12E36DBD221441D5006FCDD7 /* TinyConstraints.framework in Embed Frameworks */,
@@ -69,6 +73,8 @@
69/* Begin PBXFileReference section */
73/* Begin PBXFileReference section */
70 123E37A4221F1B3200F6E42A /* LogInViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogInViewController.swift; sourceTree = "<group>"; };
74 123E37A4221F1B3200F6E42A /* LogInViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogInViewController.swift; sourceTree = "<group>"; };
71 123E37A6221F1DD700F6E42A /* MainController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainController.swift; sourceTree = "<group>"; };
75 123E37A6221F1DD700F6E42A /* MainController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainController.swift; sourceTree = "<group>"; };
76+ 124CC7022221C00C009DF531 /* Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Model.swift; sourceTree = "<group>"; };
77+ 124CC7042221C2BA009DF531 /* Alamofire.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Alamofire.framework; path = Carthage/Build/iOS/Alamofire.framework; sourceTree = "<group>"; };
72 125BD57C22171D2A008A3575 /* ProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = "<group>"; };
78 125BD57C22171D2A008A3575 /* ProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = "<group>"; };
73 125BD57E22171D73008A3575 /* Extentions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extentions.swift; sourceTree = "<group>"; };
79 125BD57E22171D73008A3575 /* Extentions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extentions.swift; sourceTree = "<group>"; };
74 125BD5802217314A008A3575 /* NewsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsVC.swift; sourceTree = "<group>"; };
80 125BD5802217314A008A3575 /* NewsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsVC.swift; sourceTree = "<group>"; };
@@ -111,6 +117,7 @@
111 buildActionMask = 2147483647;
117 buildActionMask = 2147483647;
112 files = (
118 files = (
113 12E36DB522143D54006FCDD7 /* TinyConstraints.framework in Frameworks */,
119 12E36DB522143D54006FCDD7 /* TinyConstraints.framework in Frameworks */,
120+ 124CC7052221C2BB009DF531 /* Alamofire.framework in Frameworks */,
114 12E36DDB221594B1006FCDD7 /* MarkdownKit.framework in Frameworks */,
121 12E36DDB221594B1006FCDD7 /* MarkdownKit.framework in Frameworks */,
115 12E36DD8221594A9006FCDD7 /* TagListView.framework in Frameworks */,
122 12E36DD8221594A9006FCDD7 /* TagListView.framework in Frameworks */,
116 12E36DAF22143D40006FCDD7 /* Cartography.framework in Frameworks */,
123 12E36DAF22143D40006FCDD7 /* Cartography.framework in Frameworks */,
@@ -154,6 +161,7 @@
154 12E36D8F221424EA006FCDD7 = {
161 12E36D8F221424EA006FCDD7 = {
155 isa = PBXGroup;
162 isa = PBXGroup;
156 children = (
163 children = (
164+ 124CC7042221C2BA009DF531 /* Alamofire.framework */,
157 12E36DD622159493006FCDD7 /* TagListView.framework */,
165 12E36DD622159493006FCDD7 /* TagListView.framework */,
158 12E36DB422143D54006FCDD7 /* TinyConstraints.framework */,
166 12E36DB422143D54006FCDD7 /* TinyConstraints.framework */,
159 12E36DB222143D4E006FCDD7 /* Marklight.framework */,
167 12E36DB222143D4E006FCDD7 /* Marklight.framework */,
@@ -193,6 +201,7 @@
193 12E36DBA2214401B006FCDD7 /* Simple model */ = {
201 12E36DBA2214401B006FCDD7 /* Simple model */ = {
194 isa = PBXGroup;
202 isa = PBXGroup;
195 children = (
203 children = (
204+ 124CC7022221C00C009DF531 /* Model.swift */,
196 12E36DB62214400A006FCDD7 /* Post.swift */,
205 12E36DB62214400A006FCDD7 /* Post.swift */,
197 12D7D136221D78E800B35452 /* Channel.swift */,
206 12D7D136221D78E800B35452 /* Channel.swift */,
198 12E36DB822144016006FCDD7 /* User.swift */,
207 12E36DB822144016006FCDD7 /* User.swift */,
@@ -315,6 +324,7 @@
315 isa = PBXSourcesBuildPhase;
324 isa = PBXSourcesBuildPhase;
316 buildActionMask = 2147483647;
325 buildActionMask = 2147483647;
317 files = (
326 files = (
327+ 124CC7032221C00C009DF531 /* Model.swift in Sources */,
318 12E36DD522156559006FCDD7 /* MyStackView.swift in Sources */,
328 12E36DD522156559006FCDD7 /* MyStackView.swift in Sources */,
319 12D7D137221D78E800B35452 /* Channel.swift in Sources */,
329 12D7D137221D78E800B35452 /* Channel.swift in Sources */,
320 1291BE3622218DBF009D3F23 /* LogInCoordinator.swift in Sources */,
330 1291BE3622218DBF009D3F23 /* LogInCoordinator.swift in Sources */,
GDproject.xcodeproj/xcshareddata/xcschemes/GDproject.xcschemenew file+106
@@ -0,0 +1,106 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<Scheme
3+ LastUpgradeVersion = "1010"
4+ version = "1.3">
5+ <BuildAction
6+ parallelizeBuildables = "YES"
7+ buildImplicitDependencies = "YES">
8+ <BuildActionEntries>
9+ <BuildActionEntry
10+ buildForTesting = "YES"
11+ buildForRunning = "YES"
12+ buildForProfiling = "YES"
13+ buildForArchiving = "YES"
14+ buildForAnalyzing = "YES">
15+ <BuildableReference
16+ BuildableIdentifier = "primary"
17+ BlueprintIdentifier = "12E36D97221424EA006FCDD7"
18+ BuildableName = "GDproject.app"
19+ BlueprintName = "GDproject"
20+ ReferencedContainer = "container:GDproject.xcodeproj">
21+ </BuildableReference>
22+ </BuildActionEntry>
23+ </BuildActionEntries>
24+ </BuildAction>
25+ <TestAction
26+ buildConfiguration = "Debug"
27+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+ shouldUseLaunchSchemeArgsEnv = "YES">
30+ <Testables>
31+ </Testables>
32+ <MacroExpansion>
33+ <BuildableReference
34+ BuildableIdentifier = "primary"
35+ BlueprintIdentifier = "12E36D97221424EA006FCDD7"
36+ BuildableName = "GDproject.app"
37+ BlueprintName = "GDproject"
38+ ReferencedContainer = "container:GDproject.xcodeproj">
39+ </BuildableReference>
40+ </MacroExpansion>
41+ <AdditionalOptions>
42+ </AdditionalOptions>
43+ </TestAction>
44+ <LaunchAction
45+ buildConfiguration = "Debug"
46+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
47+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
48+ launchStyle = "0"
49+ useCustomWorkingDirectory = "NO"
50+ ignoresPersistentStateOnLaunch = "NO"
51+ debugDocumentVersioning = "YES"
52+ debugServiceExtension = "internal"
53+ allowLocationSimulation = "YES">
54+ <BuildableProductRunnable
55+ runnableDebuggingMode = "0">
56+ <BuildableReference
57+ BuildableIdentifier = "primary"
58+ BlueprintIdentifier = "12E36D97221424EA006FCDD7"
59+ BuildableName = "GDproject.app"
60+ BlueprintName = "GDproject"
61+ ReferencedContainer = "container:GDproject.xcodeproj">
62+ </BuildableReference>
63+ </BuildableProductRunnable>
64+ <AdditionalOptions>
65+ <AdditionalOption
66+ key = "MallocStackLogging"
67+ value = ""
68+ isEnabled = "YES">
69+ </AdditionalOption>
70+ <AdditionalOption
71+ key = "PrefersMallocStackLoggingLite"
72+ value = ""
73+ isEnabled = "YES">
74+ </AdditionalOption>
75+ <AdditionalOption
76+ key = "MallocScribble"
77+ value = ""
78+ isEnabled = "YES">
79+ </AdditionalOption>
80+ </AdditionalOptions>
81+ </LaunchAction>
82+ <ProfileAction
83+ buildConfiguration = "Release"
84+ shouldUseLaunchSchemeArgsEnv = "YES"
85+ savedToolIdentifier = ""
86+ useCustomWorkingDirectory = "NO"
87+ debugDocumentVersioning = "YES">
88+ <BuildableProductRunnable
89+ runnableDebuggingMode = "0">
90+ <BuildableReference
91+ BuildableIdentifier = "primary"
92+ BlueprintIdentifier = "12E36D97221424EA006FCDD7"
93+ BuildableName = "GDproject.app"
94+ BlueprintName = "GDproject"
95+ ReferencedContainer = "container:GDproject.xcodeproj">
96+ </BuildableReference>
97+ </BuildableProductRunnable>
98+ </ProfileAction>
99+ <AnalyzeAction
100+ buildConfiguration = "Debug">
101+ </AnalyzeAction>
102+ <ArchiveAction
103+ buildConfiguration = "Release"
104+ revealArchiveInOrganizer = "YES">
105+ </ArchiveAction>
106+</Scheme>
GDproject/Controller/ News and channels/NewsVC.swift+1−1
@@ -14,7 +14,7 @@ class NewsVC: UIViewController, UITableViewDelegate, UITableViewDataSource{
14
14
15 var type: HeaderType = .NONE
15 var type: HeaderType = .NONE
16
16
17− var viewController: UIViewController?
17+ weak var viewController: UIViewController?
18
18
19 func numberOfSections(in tableView: UITableView) -> Int {
19 func numberOfSections(in tableView: UITableView) -> Int {
20 return 1
20 return 1
GDproject/Controller/Log In/LogInCoordinator.swift+1
@@ -34,6 +34,7 @@ class LogInCoordinator{
34 controller.onLogIn = { [weak self] in
34 controller.onLogIn = { [weak self] in
35 self?.showStatusPage()
35 self?.showStatusPage()
36 DataStorage.standard.setIsLoggedIn(value: true)
36 DataStorage.standard.setIsLoggedIn(value: true)
37+ Model.authenticate()
37 }
38 }
38 //navigationController?.setViewControllers([controller], animated: false)
39 //navigationController?.setViewControllers([controller], animated: false)
39 navigationController?.pushViewController(controller, animated: false)
40 navigationController?.pushViewController(controller, animated: false)
GDproject/Controller/Profile/ProfileViewController.swift+6−4
@@ -41,8 +41,8 @@ class ProfileViewController: UIViewController
41
41
42 var user: User = User(surname: "Богомазова", name: "Вероника", optional: "Львовна", emailName: "vbogomazova", id: 2, place: "📍Москва, Кочновский пр. 3", faculty: "Методист: Факультет Компьютерных наук")
42 var user: User = User(surname: "Богомазова", name: "Вероника", optional: "Львовна", emailName: "vbogomazova", id: 2, place: "📍Москва, Кочновский пр. 3", faculty: "Методист: Факультет Компьютерных наук")
43
43
44− let basicInfo = BasicInfoController()
44+ var basicInfo = BasicInfoController()
45− let posts = NewsVC()
45+ var posts = NewsVC()
46
46
47 override func viewDidLoad()
47 override func viewDidLoad()
48 {
48 {
@@ -107,8 +107,7 @@ class ProfileViewController: UIViewController
107 let logoutAction = UIAlertAction(title: "Log out", style: .destructive)
107 let logoutAction = UIAlertAction(title: "Log out", style: .destructive)
108 {
108 {
109 (_) in
109 (_) in
110−
110+ DataStorage.standard.setIsLoggedIn(value: false)
111− AppDelegate.logInAgain()
112 }
111 }
113
112
114 optionMenu.addAction(editAction)
113 optionMenu.addAction(editAction)
@@ -120,6 +119,9 @@ class ProfileViewController: UIViewController
120 self.present(optionMenu, animated: true, completion: nil)
119 self.present(optionMenu, animated: true, completion: nil)
121 }
120 }
122
121
122+ deinit {
123+ print("profile clear")
124+ }
123
125
124 @IBAction func valueChanged(_ sender: UISegmentedControl) {
126 @IBAction func valueChanged(_ sender: UISegmentedControl) {
125 let index = sender.selectedSegmentIndex
127 let index = sender.selectedSegmentIndex
GDproject/DataStorage.swift+5
@@ -7,6 +7,7 @@
7//
7//
8
8
9import Foundation
9import Foundation
10+import UIKit
10
11
11/**
12/**
12 _DataStorage_ class is aimed to store user private settings
13 _DataStorage_ class is aimed to store user private settings
@@ -16,6 +17,7 @@ class DataStorage{
16
17
17 private init(){}
18 private init(){}
18
19
20+ var coordinator: LogInCoordinator?
19 static let standard = DataStorage()
21 static let standard = DataStorage()
20
22
21 // add channel
23 // add channel
@@ -27,6 +29,9 @@ class DataStorage{
27 */
29 */
28 func setIsLoggedIn(value: Bool){
30 func setIsLoggedIn(value: Bool){
29 UserDefaults.standard.set(value, forKey: UserDefaultsKeys.loggedIn.rawValue)
31 UserDefaults.standard.set(value, forKey: UserDefaultsKeys.loggedIn.rawValue)
32+ if !value {
33+ (UIApplication.shared.delegate as? AppDelegate)?.logInAgain()
34+ }
30 }
35 }
31
36
32 /**
37 /**
GDproject/Simple model/Model.swiftnew file+25
@@ -0,0 +1,25 @@
1+//
2+// Model.swift
3+// GDproject
4+//
5+// Created by cstore on 23/02/2019.
6+// Copyright © 2019 drHSE. All rights reserved.
7+//
8+
9+import Foundation
10+import Alamofire
11+
12+class Model{
13+ static var url = URL(string:"https://valera-denis.herokuapp.com/authenticate")!
14+
15+ static func authenticate(){
16+
17+ let params: Parameters = ["authenticationId" : 9]
18+ AF.request(url, method: .post, parameters: params).response{
19+ (responce) in
20+
21+ print(responce.response?.allHeaderFields)
22+ }
23+
24+ }
25+}
GDproject/Supporting files/AppDelegate.swift+8−10
@@ -11,7 +11,8 @@ import UIKit
11@UIApplicationMain
11@UIApplicationMain
12class AppDelegate: UIResponder, UIApplicationDelegate {
12class AppDelegate: UIResponder, UIApplicationDelegate {
13
13
14+
14− static var coordinator: LogInCoordinator!
15+ var coordinator: LogInCoordinator!
15 var tabCoordinator: TabbarCoordinator!
16 var tabCoordinator: TabbarCoordinator!
16
17
17 var window: UIWindow?
18 var window: UIWindow?
@@ -19,17 +20,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
19 return self.window!.rootViewController as? UINavigationController
20 return self.window!.rootViewController as? UINavigationController
20 }
21 }
21
22
22− static func logInAgain(){
23+ func logInAgain(){
23 let root = UIStoryboard.navRoot()
24 let root = UIStoryboard.navRoot()
24− UIApplication.shared.keyWindow?.rootViewController = root
25+ window?.rootViewController = root
25− DataStorage.standard.setIsLoggedIn(value: false)
26+ window?.makeKeyAndVisible()
26 coordinator = LogInCoordinator(navigationController: root, window: UIApplication.shared.keyWindow!)
27 coordinator = LogInCoordinator(navigationController: root, window: UIApplication.shared.keyWindow!)
27− coordinator.start()
28+ coordinator!.start()
28 }
29 }
29
30
30− private func makeCoordinator(with: UINavigationController) -> ChannelsCoordinator {
31− return ChannelsCoordinator(currentChannel: Channel(title: "example", subtitle: "ex", hashtags: ["none"], people: ["none"], posts: []), navigationController: with)
32− }
33
31
34 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
32 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
35 {
33 {
@@ -39,8 +37,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
39 tabCoordinator = TabbarCoordinator(window: window!)
37 tabCoordinator = TabbarCoordinator(window: window!)
40 tabCoordinator.start()
38 tabCoordinator.start()
41 } else {
39 } else {
42− AppDelegate.coordinator = LogInCoordinator(navigationController: rootController!, window: window!)
40+ coordinator = LogInCoordinator(navigationController: rootController!, window: window!)
43− AppDelegate.coordinator.start()
41+ coordinator.start()
44 }
42 }
45
43
46 return true
44 return true