From 387623a309efa3b09d40cc93d2a9623103e4e756 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Fri, 28 Feb 2020 19:24:14 -0500 Subject: [PATCH] Remove old code --- Pachyderm/Client.swift | 5 ---- Pachyderm/ClientModel.swift | 39 ---------------------------- Tusker.xcodeproj/project.pbxproj | 4 --- Tusker/Extensions/Date+TimeAgo.swift | 27 +------------------ 4 files changed, 1 insertion(+), 74 deletions(-) delete mode 100644 Pachyderm/ClientModel.swift diff --git a/Pachyderm/Client.swift b/Pachyderm/Client.swift index c593b7b3..370cf4c5 100644 --- a/Pachyderm/Client.swift +++ b/Pachyderm/Client.swift @@ -68,11 +68,6 @@ public class Client { completion(.failure(Error.invalidModel)) return } - if var result = result as? ClientModel { - result.client = self - } else if var result = result as? [ClientModel] { - result.client = self - } let pagination = response.allHeaderFields["Link"].flatMap { $0 as? String }.flatMap(Pagination.init) completion(.success(result, pagination)) diff --git a/Pachyderm/ClientModel.swift b/Pachyderm/ClientModel.swift deleted file mode 100644 index f1328260..00000000 --- a/Pachyderm/ClientModel.swift +++ /dev/null @@ -1,39 +0,0 @@ -// -// ClientModel.swift -// Pachyderm -// -// Created by Shadowfacts on 9/9/18. -// Copyright © 2018 Shadowfacts. All rights reserved. -// - -import Foundation - -protocol ClientModel { - var client: Client! { get set } -} - -extension Array where Element == ClientModel { - var client: Client! { - get { - return first?.client - } - set { - for var el in self { - el.client = newValue - } - } - } -} - -extension Array where Element: ClientModel { - var client: Client! { - get { - return first?.client - } - set { - for var el in self { - el.client = newValue - } - } - } -} diff --git a/Tusker.xcodeproj/project.pbxproj b/Tusker.xcodeproj/project.pbxproj index c965bbcb..088ddfd9 100644 --- a/Tusker.xcodeproj/project.pbxproj +++ b/Tusker.xcodeproj/project.pbxproj @@ -61,7 +61,6 @@ D6109A05214572BF00432DC2 /* Scope.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A04214572BF00432DC2 /* Scope.swift */; }; D6109A072145756700432DC2 /* LoginSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A062145756700432DC2 /* LoginSettings.swift */; }; D6109A0921458C4A00432DC2 /* Empty.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A0821458C4A00432DC2 /* Empty.swift */; }; - D6109A0B2145953C00432DC2 /* ClientModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A0A2145953C00432DC2 /* ClientModel.swift */; }; D6109A0D214599E100432DC2 /* RequestRange.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A0C214599E100432DC2 /* RequestRange.swift */; }; D6109A0F21459B6900432DC2 /* Pagination.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A0E21459B6900432DC2 /* Pagination.swift */; }; D6109A11214607D500432DC2 /* Timeline.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A10214607D500432DC2 /* Timeline.swift */; }; @@ -340,7 +339,6 @@ D6109A04214572BF00432DC2 /* Scope.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Scope.swift; sourceTree = ""; }; D6109A062145756700432DC2 /* LoginSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginSettings.swift; sourceTree = ""; }; D6109A0821458C4A00432DC2 /* Empty.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Empty.swift; sourceTree = ""; }; - D6109A0A2145953C00432DC2 /* ClientModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientModel.swift; sourceTree = ""; }; D6109A0C214599E100432DC2 /* RequestRange.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestRange.swift; sourceTree = ""; }; D6109A0E21459B6900432DC2 /* Pagination.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Pagination.swift; sourceTree = ""; }; D6109A10214607D500432DC2 /* Timeline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Timeline.swift; sourceTree = ""; }; @@ -602,7 +600,6 @@ D61099AD2144B0CC00432DC2 /* Pachyderm.h */, D61099AE2144B0CC00432DC2 /* Info.plist */, D61099C82144B13C00432DC2 /* Client.swift */, - D6109A0A2145953C00432DC2 /* ClientModel.swift */, D6A3BC7223218C6E00FD64D5 /* Utilities */, D61099D72144B74500432DC2 /* Extensions */, D61099CC2144B2C300432DC2 /* Request */, @@ -1545,7 +1542,6 @@ D61099FB214569F600432DC2 /* Report.swift in Sources */, D61099F92145698900432DC2 /* Relationship.swift in Sources */, D61099E12144C1DC00432DC2 /* Account.swift in Sources */, - D6109A0B2145953C00432DC2 /* ClientModel.swift in Sources */, D61099E92145658300432DC2 /* Card.swift in Sources */, D61099F32145688600432DC2 /* Mention.swift in Sources */, D6109A0F21459B6900432DC2 /* Pagination.swift in Sources */, diff --git a/Tusker/Extensions/Date+TimeAgo.swift b/Tusker/Extensions/Date+TimeAgo.swift index bbb5f389..bca179dd 100644 --- a/Tusker/Extensions/Date+TimeAgo.swift +++ b/Tusker/Extensions/Date+TimeAgo.swift @@ -9,32 +9,7 @@ import Foundation extension Date { - -// var timeAgo: String { -// let calendar = NSCalendar.current -// let unitFlags = Set([.second, .minute, .hour, .day, .weekOfYear, .month, .year]) -// -// let components = calendar.dateComponents(unitFlags, from: self, to: Date()) -// -// if components.year! >= 1 { -// return "\(components.year!)y" -// } else if components.month! >= 1 { -// return "\(components.month!)mo" -// } else if components.weekOfYear! >= 1 { -// return "\(components.weekOfYear!)w" -// } else if components.day! >= 1 { -// return "\(components.day!)d" -// } else if components.hour! >= 1 { -// return "\(components.hour!)h" -// } else if components.minute! >= 1 { -// return "\(components.minute!)m" -// } else if components.second! >= 3 { -// return "\(components.second!)s" -// } else { -// return "Now" -// } -// } - + func timeAgo() -> (Int, Calendar.Component) { let calendar = NSCalendar.current let unitFlags = Set([.second, .minute, .hour, .day, .weekOfYear, .month, .year])