git.iko.soy/dashared/GDproject
on master help sign in
minor chanes
commit011b79ce7095df9d0c6857bc7d5c4766eb7d611e authorDarya Rednikina <rednikina.com@yandex.ru> dateSun 24 Feb 2019, 14:35 (8 years ago) parent5707aca
9 files changed+164−16
Cartfile+2−1 GDproject.xcodeproj/project.pbxproj+10 GDproject.xcodeproj/xcshareddata/xcschemes/GDproject.xcscheme+106 GDproject/Controller/ News and channels/NewsVC.swift+1−1 GDproject/Controller/Log In/LogInCoordinator.swift+1 GDproject/Controller/Profile/ProfileViewController.swift+6−4 GDproject/DataStorage.swift+5 GDproject/Simple model/Model.swift+25 GDproject/Supporting files/AppDelegate.swift+8−10
Cartfile+2−1
@@ -2,4 +2,5 @@ github "robb/Cartography"
22github "ivanbruel/MarkdownKit"
33github "roberthein/TinyConstraints"
44github "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 @@
99/* Begin PBXBuildFile section */
1010 123E37A5221F1B3200F6E42A /* LogInViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 123E37A4221F1B3200F6E42A /* LogInViewController.swift */; };
1111 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, ); }; };
1215 125BD57D22171D2A008A3575 /* ProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD57C22171D2A008A3575 /* ProfileViewController.swift */; };
1316 125BD57F22171D73008A3575 /* Extentions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD57E22171D73008A3575 /* Extentions.swift */; };
1417 125BD5812217314A008A3575 /* NewsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 125BD5802217314A008A3575 /* NewsVC.swift */; };
@@ -56,6 +59,7 @@
5659 dstSubfolderSpec = 10;
5760 files = (
5861 12E36DC0221441DB006FCDD7 /* Marklight.framework in Embed Frameworks */,
62+ 124CC7072221C2C3009DF531 /* Alamofire.framework in Embed Frameworks */,
5963 12E36DC4221441EA006FCDD7 /* Cartography.framework in Embed Frameworks */,
6064 12E36DD9221594A9006FCDD7 /* TagListView.framework in Embed Frameworks */,
6165 12E36DBD221441D5006FCDD7 /* TinyConstraints.framework in Embed Frameworks */,
@@ -69,6 +73,8 @@
6973/* Begin PBXFileReference section */
7074 123E37A4221F1B3200F6E42A /* LogInViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogInViewController.swift; sourceTree = "<group>"; };
7175 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>"; };
7278 125BD57C22171D2A008A3575 /* ProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = "<group>"; };
7379 125BD57E22171D73008A3575 /* Extentions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extentions.swift; sourceTree = "<group>"; };
7480 125BD5802217314A008A3575 /* NewsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsVC.swift; sourceTree = "<group>"; };
@@ -111,6 +117,7 @@
111117 buildActionMask = 2147483647;
112118 files = (
113119 12E36DB522143D54006FCDD7 /* TinyConstraints.framework in Frameworks */,
120+ 124CC7052221C2BB009DF531 /* Alamofire.framework in Frameworks */,
114121 12E36DDB221594B1006FCDD7 /* MarkdownKit.framework in Frameworks */,
115122 12E36DD8221594A9006FCDD7 /* TagListView.framework in Frameworks */,
116123 12E36DAF22143D40006FCDD7 /* Cartography.framework in Frameworks */,
@@ -154,6 +161,7 @@
154161 12E36D8F221424EA006FCDD7 = {
155162 isa = PBXGroup;
156163 children = (
164+ 124CC7042221C2BA009DF531 /* Alamofire.framework */,
157165 12E36DD622159493006FCDD7 /* TagListView.framework */,
158166 12E36DB422143D54006FCDD7 /* TinyConstraints.framework */,
159167 12E36DB222143D4E006FCDD7 /* Marklight.framework */,
@@ -193,6 +201,7 @@
193201 12E36DBA2214401B006FCDD7 /* Simple model */ = {
194202 isa = PBXGroup;
195203 children = (
204+ 124CC7022221C00C009DF531 /* Model.swift */,
196205 12E36DB62214400A006FCDD7 /* Post.swift */,
197206 12D7D136221D78E800B35452 /* Channel.swift */,
198207 12E36DB822144016006FCDD7 /* User.swift */,
@@ -315,6 +324,7 @@
315324 isa = PBXSourcesBuildPhase;
316325 buildActionMask = 2147483647;
317326 files = (
327+ 124CC7032221C00C009DF531 /* Model.swift in Sources */,
318328 12E36DD522156559006FCDD7 /* MyStackView.swift in Sources */,
319329 12D7D137221D78E800B35452 /* Channel.swift in Sources */,
320330 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{
1414
1515 var type: HeaderType = .NONE
1616
17− var viewController: UIViewController?
17+ weak var viewController: UIViewController?
1818
1919 func numberOfSections(in tableView: UITableView) -> Int {
2020 return 1
GDproject/Controller/Log In/LogInCoordinator.swift+1
@@ -34,6 +34,7 @@ class LogInCoordinator{
3434 controller.onLogIn = { [weak self] in
3535 self?.showStatusPage()
3636 DataStorage.standard.setIsLoggedIn(value: true)
37+ Model.authenticate()
3738 }
3839 //navigationController?.setViewControllers([controller], animated: false)
3940 navigationController?.pushViewController(controller, animated: false)
GDproject/Controller/Profile/ProfileViewController.swift+6−4
@@ -41,8 +41,8 @@ class ProfileViewController: UIViewController
4141
4242 var user: User = User(surname: "Богомазова", name: "Вероника", optional: "Львовна", emailName: "vbogomazova", id: 2, place: "📍Москва, Кочновский пр. 3", faculty: "Методист: Факультет Компьютерных наук")
4343
44− let basicInfo = BasicInfoController()
45− let posts = NewsVC()
44+ var basicInfo = BasicInfoController()
45+ var posts = NewsVC()
4646
4747 override func viewDidLoad()
4848 {
@@ -107,8 +107,7 @@ class ProfileViewController: UIViewController
107107 let logoutAction = UIAlertAction(title: "Log out", style: .destructive)
108108 {
109109 (_) in
110−
111− AppDelegate.logInAgain()
110+ DataStorage.standard.setIsLoggedIn(value: false)
112111 }
113112
114113 optionMenu.addAction(editAction)
@@ -120,6 +119,9 @@ class ProfileViewController: UIViewController
120119 self.present(optionMenu, animated: true, completion: nil)
121120 }
122121
122+ deinit {
123+ print("profile clear")
124+ }
123125
124126 @IBAction func valueChanged(_ sender: UISegmentedControl) {
125127 let index = sender.selectedSegmentIndex
GDproject/DataStorage.swift+5
@@ -7,6 +7,7 @@
77//
88
99import Foundation
10+import UIKit
1011
1112/**
1213 _DataStorage_ class is aimed to store user private settings
@@ -16,6 +17,7 @@ class DataStorage{
1617
1718 private init(){}
1819
20+ var coordinator: LogInCoordinator?
1921 static let standard = DataStorage()
2022
2123 // add channel
@@ -27,6 +29,9 @@ class DataStorage{
2729 */
2830 func setIsLoggedIn(value: Bool){
2931 UserDefaults.standard.set(value, forKey: UserDefaultsKeys.loggedIn.rawValue)
32+ if !value {
33+ (UIApplication.shared.delegate as? AppDelegate)?.logInAgain()
34+ }
3035 }
3136
3237 /**
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
1111@UIApplicationMain
1212class AppDelegate: UIResponder, UIApplicationDelegate {
1313
14− static var coordinator: LogInCoordinator!
14+
15+ var coordinator: LogInCoordinator!
1516 var tabCoordinator: TabbarCoordinator!
1617
1718 var window: UIWindow?
@@ -19,17 +20,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1920 return self.window!.rootViewController as? UINavigationController
2021 }
2122
22− static func logInAgain(){
23+ func logInAgain(){
2324 let root = UIStoryboard.navRoot()
24− UIApplication.shared.keyWindow?.rootViewController = root
25− DataStorage.standard.setIsLoggedIn(value: false)
25+ window?.rootViewController = root
26+ window?.makeKeyAndVisible()
2627 coordinator = LogInCoordinator(navigationController: root, window: UIApplication.shared.keyWindow!)
27− coordinator.start()
28+ coordinator!.start()
2829 }
2930
30− private func makeCoordinator(with: UINavigationController) -> ChannelsCoordinator {
31− return ChannelsCoordinator(currentChannel: Channel(title: "example", subtitle: "ex", hashtags: ["none"], people: ["none"], posts: []), navigationController: with)
32− }
3331
3432 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
3533 {
@@ -39,8 +37,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3937 tabCoordinator = TabbarCoordinator(window: window!)
4038 tabCoordinator.start()
4139 } else {
42− AppDelegate.coordinator = LogInCoordinator(navigationController: rootController!, window: window!)
43− AppDelegate.coordinator.start()
40+ coordinator = LogInCoordinator(navigationController: rootController!, window: window!)
41+ coordinator.start()
4442 }
4543
4644 return true