Compare commits
No commits in common. "804636dcbbf6b182e87366c15e5b2cf008a08d42" and "65d57df949d1684f86bbecad599070ff9a696a21" have entirely different histories.
804636dcbb
...
65d57df949
|
@ -68,6 +68,11 @@ public class Client {
|
||||||
completion(.failure(Error.invalidModel))
|
completion(.failure(Error.invalidModel))
|
||||||
return
|
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)
|
let pagination = response.allHeaderFields["Link"].flatMap { $0 as? String }.flatMap(Pagination.init)
|
||||||
|
|
||||||
completion(.success(result, pagination))
|
completion(.success(result, pagination))
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,24 +27,18 @@ public class NotificationGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func createGroups(notifications: [Notification], only allowedTypes: [Notification.Kind]) -> [NotificationGroup] {
|
public static func createGroups(notifications: [Notification], only allowedTypes: [Notification.Kind]) -> [NotificationGroup] {
|
||||||
var groups = [[Notification]]()
|
return notifications.reduce(into: [[Notification]]()) { (groups, notification) in
|
||||||
for notification in notifications {
|
if allowedTypes.contains(notification.kind),
|
||||||
if allowedTypes.contains(notification.kind) {
|
let lastGroup = groups.last,
|
||||||
if let lastGroup = groups.last, let firstNotification = lastGroup.first, firstNotification.kind == notification.kind, firstNotification.status?.id == notification.status?.id {
|
let firstStatus = lastGroup.first,
|
||||||
groups[groups.count - 1].append(notification)
|
firstStatus.kind == notification.kind,
|
||||||
continue
|
firstStatus.status?.id == notification.status?.id {
|
||||||
} else if groups.count >= 2 {
|
|
||||||
let secondToLastGroup = groups[groups.count - 2]
|
|
||||||
if allowedTypes.contains(groups[groups.count - 1][0].kind), let firstNotification = secondToLastGroup.first, firstNotification.kind == notification.kind, firstNotification.status?.id == notification.status?.id {
|
|
||||||
groups[groups.count - 2].append(notification)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
groups[groups.count - 1].append(notification)
|
||||||
|
} else {
|
||||||
groups.append([notification])
|
groups.append([notification])
|
||||||
}
|
}
|
||||||
return groups.map {
|
}.map {
|
||||||
NotificationGroup(notifications: $0)!
|
NotificationGroup(notifications: $0)!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
D6109A05214572BF00432DC2 /* Scope.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A04214572BF00432DC2 /* Scope.swift */; };
|
D6109A05214572BF00432DC2 /* Scope.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A04214572BF00432DC2 /* Scope.swift */; };
|
||||||
D6109A072145756700432DC2 /* LoginSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A062145756700432DC2 /* LoginSettings.swift */; };
|
D6109A072145756700432DC2 /* LoginSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A062145756700432DC2 /* LoginSettings.swift */; };
|
||||||
D6109A0921458C4A00432DC2 /* Empty.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A0821458C4A00432DC2 /* Empty.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 */; };
|
D6109A0D214599E100432DC2 /* RequestRange.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A0C214599E100432DC2 /* RequestRange.swift */; };
|
||||||
D6109A0F21459B6900432DC2 /* Pagination.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A0E21459B6900432DC2 /* Pagination.swift */; };
|
D6109A0F21459B6900432DC2 /* Pagination.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A0E21459B6900432DC2 /* Pagination.swift */; };
|
||||||
D6109A11214607D500432DC2 /* Timeline.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A10214607D500432DC2 /* Timeline.swift */; };
|
D6109A11214607D500432DC2 /* Timeline.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A10214607D500432DC2 /* Timeline.swift */; };
|
||||||
|
@ -155,8 +156,6 @@
|
||||||
D67C57AF21E28EAD00C3118B /* Array+Uniques.swift in Sources */ = {isa = PBXBuildFile; fileRef = D67C57AE21E28EAD00C3118B /* Array+Uniques.swift */; };
|
D67C57AF21E28EAD00C3118B /* Array+Uniques.swift in Sources */ = {isa = PBXBuildFile; fileRef = D67C57AE21E28EAD00C3118B /* Array+Uniques.swift */; };
|
||||||
D67C57B221E28FAD00C3118B /* ComposeStatusReplyView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D67C57B121E28FAD00C3118B /* ComposeStatusReplyView.xib */; };
|
D67C57B221E28FAD00C3118B /* ComposeStatusReplyView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D67C57B121E28FAD00C3118B /* ComposeStatusReplyView.xib */; };
|
||||||
D67C57B421E2910700C3118B /* ComposeStatusReplyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D67C57B321E2910700C3118B /* ComposeStatusReplyView.swift */; };
|
D67C57B421E2910700C3118B /* ComposeStatusReplyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D67C57B321E2910700C3118B /* ComposeStatusReplyView.swift */; };
|
||||||
D68015402401A6BA00D6103B /* ComposingPrefsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D680153F2401A6BA00D6103B /* ComposingPrefsView.swift */; };
|
|
||||||
D68015422401A74600D6103B /* MediaPrefsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68015412401A74600D6103B /* MediaPrefsView.swift */; };
|
|
||||||
D68FEC4F232C5BC300C84F23 /* SegmentedPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68FEC4E232C5BC300C84F23 /* SegmentedPageViewController.swift */; };
|
D68FEC4F232C5BC300C84F23 /* SegmentedPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68FEC4E232C5BC300C84F23 /* SegmentedPageViewController.swift */; };
|
||||||
D693DE5723FE1A6A0061E07D /* EnhancedNavigationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D693DE5623FE1A6A0061E07D /* EnhancedNavigationViewController.swift */; };
|
D693DE5723FE1A6A0061E07D /* EnhancedNavigationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D693DE5623FE1A6A0061E07D /* EnhancedNavigationViewController.swift */; };
|
||||||
D693DE5923FE24310061E07D /* InteractivePushTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = D693DE5823FE24300061E07D /* InteractivePushTransition.swift */; };
|
D693DE5923FE24310061E07D /* InteractivePushTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = D693DE5823FE24300061E07D /* InteractivePushTransition.swift */; };
|
||||||
|
@ -339,6 +338,7 @@
|
||||||
D6109A04214572BF00432DC2 /* Scope.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Scope.swift; sourceTree = "<group>"; };
|
D6109A04214572BF00432DC2 /* Scope.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Scope.swift; sourceTree = "<group>"; };
|
||||||
D6109A062145756700432DC2 /* LoginSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginSettings.swift; sourceTree = "<group>"; };
|
D6109A062145756700432DC2 /* LoginSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginSettings.swift; sourceTree = "<group>"; };
|
||||||
D6109A0821458C4A00432DC2 /* Empty.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Empty.swift; sourceTree = "<group>"; };
|
D6109A0821458C4A00432DC2 /* Empty.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Empty.swift; sourceTree = "<group>"; };
|
||||||
|
D6109A0A2145953C00432DC2 /* ClientModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientModel.swift; sourceTree = "<group>"; };
|
||||||
D6109A0C214599E100432DC2 /* RequestRange.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestRange.swift; sourceTree = "<group>"; };
|
D6109A0C214599E100432DC2 /* RequestRange.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestRange.swift; sourceTree = "<group>"; };
|
||||||
D6109A0E21459B6900432DC2 /* Pagination.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Pagination.swift; sourceTree = "<group>"; };
|
D6109A0E21459B6900432DC2 /* Pagination.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Pagination.swift; sourceTree = "<group>"; };
|
||||||
D6109A10214607D500432DC2 /* Timeline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Timeline.swift; sourceTree = "<group>"; };
|
D6109A10214607D500432DC2 /* Timeline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Timeline.swift; sourceTree = "<group>"; };
|
||||||
|
@ -433,8 +433,6 @@
|
||||||
D67C57AE21E28EAD00C3118B /* Array+Uniques.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Array+Uniques.swift"; sourceTree = "<group>"; };
|
D67C57AE21E28EAD00C3118B /* Array+Uniques.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Array+Uniques.swift"; sourceTree = "<group>"; };
|
||||||
D67C57B121E28FAD00C3118B /* ComposeStatusReplyView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ComposeStatusReplyView.xib; sourceTree = "<group>"; };
|
D67C57B121E28FAD00C3118B /* ComposeStatusReplyView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ComposeStatusReplyView.xib; sourceTree = "<group>"; };
|
||||||
D67C57B321E2910700C3118B /* ComposeStatusReplyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeStatusReplyView.swift; sourceTree = "<group>"; };
|
D67C57B321E2910700C3118B /* ComposeStatusReplyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeStatusReplyView.swift; sourceTree = "<group>"; };
|
||||||
D680153F2401A6BA00D6103B /* ComposingPrefsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposingPrefsView.swift; sourceTree = "<group>"; };
|
|
||||||
D68015412401A74600D6103B /* MediaPrefsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaPrefsView.swift; sourceTree = "<group>"; };
|
|
||||||
D68FEC4E232C5BC300C84F23 /* SegmentedPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SegmentedPageViewController.swift; sourceTree = "<group>"; };
|
D68FEC4E232C5BC300C84F23 /* SegmentedPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SegmentedPageViewController.swift; sourceTree = "<group>"; };
|
||||||
D693DE5623FE1A6A0061E07D /* EnhancedNavigationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnhancedNavigationViewController.swift; sourceTree = "<group>"; };
|
D693DE5623FE1A6A0061E07D /* EnhancedNavigationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnhancedNavigationViewController.swift; sourceTree = "<group>"; };
|
||||||
D693DE5823FE24300061E07D /* InteractivePushTransition.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InteractivePushTransition.swift; sourceTree = "<group>"; };
|
D693DE5823FE24300061E07D /* InteractivePushTransition.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InteractivePushTransition.swift; sourceTree = "<group>"; };
|
||||||
|
@ -600,6 +598,7 @@
|
||||||
D61099AD2144B0CC00432DC2 /* Pachyderm.h */,
|
D61099AD2144B0CC00432DC2 /* Pachyderm.h */,
|
||||||
D61099AE2144B0CC00432DC2 /* Info.plist */,
|
D61099AE2144B0CC00432DC2 /* Info.plist */,
|
||||||
D61099C82144B13C00432DC2 /* Client.swift */,
|
D61099C82144B13C00432DC2 /* Client.swift */,
|
||||||
|
D6109A0A2145953C00432DC2 /* ClientModel.swift */,
|
||||||
D6A3BC7223218C6E00FD64D5 /* Utilities */,
|
D6A3BC7223218C6E00FD64D5 /* Utilities */,
|
||||||
D61099D72144B74500432DC2 /* Extensions */,
|
D61099D72144B74500432DC2 /* Extensions */,
|
||||||
D61099CC2144B2C300432DC2 /* Request */,
|
D61099CC2144B2C300432DC2 /* Request */,
|
||||||
|
@ -883,8 +882,6 @@
|
||||||
04586B4022B2FFB10021BD04 /* PreferencesView.swift */,
|
04586B4022B2FFB10021BD04 /* PreferencesView.swift */,
|
||||||
04586B4222B301470021BD04 /* AppearancePrefsView.swift */,
|
04586B4222B301470021BD04 /* AppearancePrefsView.swift */,
|
||||||
0427033722B30F5F000D31B6 /* BehaviorPrefsView.swift */,
|
0427033722B30F5F000D31B6 /* BehaviorPrefsView.swift */,
|
||||||
D680153F2401A6BA00D6103B /* ComposingPrefsView.swift */,
|
|
||||||
D68015412401A74600D6103B /* MediaPrefsView.swift */,
|
|
||||||
D6BC9DB2232D4C07002CA326 /* WellnessPrefsView.swift */,
|
D6BC9DB2232D4C07002CA326 /* WellnessPrefsView.swift */,
|
||||||
0427033922B31269000D31B6 /* AdvancedPrefsView.swift */,
|
0427033922B31269000D31B6 /* AdvancedPrefsView.swift */,
|
||||||
0427037B22B316B9000D31B6 /* SilentActionPrefs.swift */,
|
0427037B22B316B9000D31B6 /* SilentActionPrefs.swift */,
|
||||||
|
@ -1542,6 +1539,7 @@
|
||||||
D61099FB214569F600432DC2 /* Report.swift in Sources */,
|
D61099FB214569F600432DC2 /* Report.swift in Sources */,
|
||||||
D61099F92145698900432DC2 /* Relationship.swift in Sources */,
|
D61099F92145698900432DC2 /* Relationship.swift in Sources */,
|
||||||
D61099E12144C1DC00432DC2 /* Account.swift in Sources */,
|
D61099E12144C1DC00432DC2 /* Account.swift in Sources */,
|
||||||
|
D6109A0B2145953C00432DC2 /* ClientModel.swift in Sources */,
|
||||||
D61099E92145658300432DC2 /* Card.swift in Sources */,
|
D61099E92145658300432DC2 /* Card.swift in Sources */,
|
||||||
D61099F32145688600432DC2 /* Mention.swift in Sources */,
|
D61099F32145688600432DC2 /* Mention.swift in Sources */,
|
||||||
D6109A0F21459B6900432DC2 /* Pagination.swift in Sources */,
|
D6109A0F21459B6900432DC2 /* Pagination.swift in Sources */,
|
||||||
|
@ -1690,7 +1688,6 @@
|
||||||
04586B4122B2FFB10021BD04 /* PreferencesView.swift in Sources */,
|
04586B4122B2FFB10021BD04 /* PreferencesView.swift in Sources */,
|
||||||
D620483223D2A6A3008A63EF /* CompositionState.swift in Sources */,
|
D620483223D2A6A3008A63EF /* CompositionState.swift in Sources */,
|
||||||
D6BC9DB5232D4CE3002CA326 /* NotificationsMode.swift in Sources */,
|
D6BC9DB5232D4CE3002CA326 /* NotificationsMode.swift in Sources */,
|
||||||
D68015402401A6BA00D6103B /* ComposingPrefsView.swift in Sources */,
|
|
||||||
D667E5EB21349EF80057A976 /* ProfileHeaderTableViewCell.swift in Sources */,
|
D667E5EB21349EF80057A976 /* ProfileHeaderTableViewCell.swift in Sources */,
|
||||||
04D14BB022B34A2800642648 /* GalleryViewController.swift in Sources */,
|
04D14BB022B34A2800642648 /* GalleryViewController.swift in Sources */,
|
||||||
D641C773213CAA25004B4513 /* NotificationsTableViewController.swift in Sources */,
|
D641C773213CAA25004B4513 /* NotificationsTableViewController.swift in Sources */,
|
||||||
|
@ -1701,7 +1698,6 @@
|
||||||
D6AEBB3E2321638100E5038B /* UIActivity+Types.swift in Sources */,
|
D6AEBB3E2321638100E5038B /* UIActivity+Types.swift in Sources */,
|
||||||
D61AC1D5232E9FA600C54D2D /* InstanceSelectorTableViewController.swift in Sources */,
|
D61AC1D5232E9FA600C54D2D /* InstanceSelectorTableViewController.swift in Sources */,
|
||||||
D626493F23C101C500612E6E /* AlbumAssetCollectionViewController.swift in Sources */,
|
D626493F23C101C500612E6E /* AlbumAssetCollectionViewController.swift in Sources */,
|
||||||
D68015422401A74600D6103B /* MediaPrefsView.swift in Sources */,
|
|
||||||
D6757A7E2157E02600721E32 /* XCBRequestSpec.swift in Sources */,
|
D6757A7E2157E02600721E32 /* XCBRequestSpec.swift in Sources */,
|
||||||
D667E5F12134D5050057A976 /* UIViewController+Delegates.swift in Sources */,
|
D667E5F12134D5050057A976 /* UIViewController+Delegates.swift in Sources */,
|
||||||
D6BC8748219738E1006163F1 /* EnhancedTableViewController.swift in Sources */,
|
D6BC8748219738E1006163F1 /* EnhancedTableViewController.swift in Sources */,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"repositoryURL": "https://git.shadowfacts.net/shadowfacts/SheetController.git",
|
"repositoryURL": "https://git.shadowfacts.net/shadowfacts/SheetController.git",
|
||||||
"state": {
|
"state": {
|
||||||
"branch": "master",
|
"branch": "master",
|
||||||
"revision": "6926446c4e15eb7f4513c4c00df9279553b330be",
|
"revision": "6ee1ad24ec8620f5c17416d6141643f0787708ba",
|
||||||
"version": null
|
"version": null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,31 @@ import Foundation
|
||||||
|
|
||||||
extension Date {
|
extension Date {
|
||||||
|
|
||||||
|
// var timeAgo: String {
|
||||||
|
// let calendar = NSCalendar.current
|
||||||
|
// let unitFlags = Set<Calendar.Component>([.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) {
|
func timeAgo() -> (Int, Calendar.Component) {
|
||||||
let calendar = NSCalendar.current
|
let calendar = NSCalendar.current
|
||||||
let unitFlags = Set<Calendar.Component>([.second, .minute, .hour, .day, .weekOfYear, .month, .year])
|
let unitFlags = Set<Calendar.Component>([.second, .minute, .hour, .day, .weekOfYear, .month, .year])
|
||||||
|
|
|
@ -48,7 +48,6 @@ class Preferences: Codable, ObservableObject {
|
||||||
self.contentWarningCopyMode = try container.decode(ContentWarningCopyMode.self, forKey: .contentWarningCopyMode)
|
self.contentWarningCopyMode = try container.decode(ContentWarningCopyMode.self, forKey: .contentWarningCopyMode)
|
||||||
self.mentionReblogger = try container.decode(Bool.self, forKey: .mentionReblogger)
|
self.mentionReblogger = try container.decode(Bool.self, forKey: .mentionReblogger)
|
||||||
self.blurAllMedia = try container.decode(Bool.self, forKey: .blurAllMedia)
|
self.blurAllMedia = try container.decode(Bool.self, forKey: .blurAllMedia)
|
||||||
self.automaticallyPlayGifs = try container.decode(Bool.self, forKey: .automaticallyPlayGifs)
|
|
||||||
self.openLinksInApps = try container.decode(Bool.self, forKey: .openLinksInApps)
|
self.openLinksInApps = try container.decode(Bool.self, forKey: .openLinksInApps)
|
||||||
self.useInAppSafari = try container.decode(Bool.self, forKey: .useInAppSafari)
|
self.useInAppSafari = try container.decode(Bool.self, forKey: .useInAppSafari)
|
||||||
self.inAppSafariAutomaticReaderMode = try container.decode(Bool.self, forKey: .inAppSafariAutomaticReaderMode)
|
self.inAppSafariAutomaticReaderMode = try container.decode(Bool.self, forKey: .inAppSafariAutomaticReaderMode)
|
||||||
|
@ -74,7 +73,6 @@ class Preferences: Codable, ObservableObject {
|
||||||
try container.encode(contentWarningCopyMode, forKey: .contentWarningCopyMode)
|
try container.encode(contentWarningCopyMode, forKey: .contentWarningCopyMode)
|
||||||
try container.encode(mentionReblogger, forKey: .mentionReblogger)
|
try container.encode(mentionReblogger, forKey: .mentionReblogger)
|
||||||
try container.encode(blurAllMedia, forKey: .blurAllMedia)
|
try container.encode(blurAllMedia, forKey: .blurAllMedia)
|
||||||
try container.encode(automaticallyPlayGifs, forKey: .automaticallyPlayGifs)
|
|
||||||
try container.encode(openLinksInApps, forKey: .openLinksInApps)
|
try container.encode(openLinksInApps, forKey: .openLinksInApps)
|
||||||
try container.encode(useInAppSafari, forKey: .useInAppSafari)
|
try container.encode(useInAppSafari, forKey: .useInAppSafari)
|
||||||
try container.encode(inAppSafariAutomaticReaderMode, forKey: .inAppSafariAutomaticReaderMode)
|
try container.encode(inAppSafariAutomaticReaderMode, forKey: .inAppSafariAutomaticReaderMode)
|
||||||
|
@ -99,7 +97,6 @@ class Preferences: Codable, ObservableObject {
|
||||||
@Published var contentWarningCopyMode = ContentWarningCopyMode.asIs
|
@Published var contentWarningCopyMode = ContentWarningCopyMode.asIs
|
||||||
@Published var mentionReblogger = false
|
@Published var mentionReblogger = false
|
||||||
@Published var blurAllMedia = false
|
@Published var blurAllMedia = false
|
||||||
@Published var automaticallyPlayGifs = true
|
|
||||||
@Published var openLinksInApps = true
|
@Published var openLinksInApps = true
|
||||||
@Published var useInAppSafari = true
|
@Published var useInAppSafari = true
|
||||||
@Published var inAppSafariAutomaticReaderMode = false
|
@Published var inAppSafariAutomaticReaderMode = false
|
||||||
|
@ -124,7 +121,6 @@ class Preferences: Codable, ObservableObject {
|
||||||
case contentWarningCopyMode
|
case contentWarningCopyMode
|
||||||
case mentionReblogger
|
case mentionReblogger
|
||||||
case blurAllMedia
|
case blurAllMedia
|
||||||
case automaticallyPlayGifs
|
|
||||||
case openLinksInApps
|
case openLinksInApps
|
||||||
case useInAppSafari
|
case useInAppSafari
|
||||||
case inAppSafariAutomaticReaderMode
|
case inAppSafariAutomaticReaderMode
|
||||||
|
|
|
@ -40,6 +40,13 @@ class AssetPickerSheetContainerViewController: SheetContainerViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
extension AssetPickerSheetContainerViewController: SheetContainerViewControllerDelegate {
|
extension AssetPickerSheetContainerViewController: SheetContainerViewControllerDelegate {
|
||||||
|
func sheetContainer(_ sheetContainer: SheetContainerViewController, willSnapToDetent detent: Detent) -> Bool {
|
||||||
|
if detent == .bottom {
|
||||||
|
dismiss(animated: true)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
func sheetContainerContentScrollView(_ sheetContainer: SheetContainerViewController) -> UIScrollView? {
|
func sheetContainerContentScrollView(_ sheetContainer: SheetContainerViewController) -> UIScrollView? {
|
||||||
if let vc = assetPicker.visibleViewController as? UITableViewController {
|
if let vc = assetPicker.visibleViewController as? UITableViewController {
|
||||||
return vc.tableView
|
return vc.tableView
|
||||||
|
|
|
@ -367,21 +367,12 @@ class ComposeViewController: UIViewController {
|
||||||
let description = mediaView.descriptionTextView.text ?? ""
|
let description = mediaView.descriptionTextView.text ?? ""
|
||||||
attachments.append(.init(attachment: attachment, description: description))
|
attachments.append(.init(attachment: attachment, description: description))
|
||||||
}
|
}
|
||||||
let statusText = statusTextView.text.trimmingCharacters(in: .whitespacesAndNewlines)
|
let cw = contentWarningEnabled ? contentWarningTextField.text : nil
|
||||||
let cw = contentWarningEnabled ? contentWarningTextField.text?.trimmingCharacters(in: .whitespacesAndNewlines) : nil
|
|
||||||
let account = mastodonController.accountInfo!
|
let account = mastodonController.accountInfo!
|
||||||
if attachments.count == 0, statusText.isEmpty, cw?.isEmpty ?? true {
|
|
||||||
if let currentDraft = self.currentDraft {
|
if let currentDraft = self.currentDraft {
|
||||||
DraftsManager.shared.remove(currentDraft)
|
currentDraft.update(accountID: account.id, text: self.statusTextView.text, contentWarning: cw, attachments: attachments)
|
||||||
} else {
|
} else {
|
||||||
return
|
self.currentDraft = DraftsManager.shared.create(accountID: account.id, text: self.statusTextView.text, contentWarning: cw, inReplyToID: inReplyToID, attachments: attachments)
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if let currentDraft = self.currentDraft {
|
|
||||||
currentDraft.update(accountID: account.id, text: statusText, contentWarning: cw, attachments: attachments)
|
|
||||||
} else {
|
|
||||||
self.currentDraft = DraftsManager.shared.create(accountID: account.id, text: statusText, contentWarning: cw, inReplyToID: inReplyToID, attachments: attachments)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
DraftsManager.save()
|
DraftsManager.save()
|
||||||
}
|
}
|
||||||
|
@ -632,7 +623,7 @@ extension ComposeViewController: DraftsTableViewControllerDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
func shouldSelectDraft(_ draft: DraftsManager.Draft, completion: @escaping (Bool) -> Void) {
|
func shouldSelectDraft(_ draft: DraftsManager.Draft, completion: @escaping (Bool) -> Void) {
|
||||||
if draft.inReplyToID != self.inReplyToID, hasChanges {
|
if draft.inReplyToID != self.inReplyToID {
|
||||||
let alertController = UIAlertController(title: "Different Reply", message: "The selected draft is a reply to a different status, do you wish to use it?", preferredStyle: .alert)
|
let alertController = UIAlertController(title: "Different Reply", message: "The selected draft is a reply to a different status, do you wish to use it?", preferredStyle: .alert)
|
||||||
alertController.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { (_) in
|
alertController.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { (_) in
|
||||||
completion(false)
|
completion(false)
|
||||||
|
@ -649,10 +640,6 @@ extension ComposeViewController: DraftsTableViewControllerDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
func draftSelected(_ draft: DraftsManager.Draft) {
|
func draftSelected(_ draft: DraftsManager.Draft) {
|
||||||
if hasChanges {
|
|
||||||
saveDraft()
|
|
||||||
}
|
|
||||||
|
|
||||||
self.currentDraft = draft
|
self.currentDraft = draft
|
||||||
|
|
||||||
inReplyToID = draft.inReplyToID
|
inReplyToID = draft.inReplyToID
|
||||||
|
|
|
@ -13,8 +13,54 @@ struct BehaviorPrefsView: View {
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
List {
|
List {
|
||||||
|
composingSection
|
||||||
|
replyingSection
|
||||||
|
readingSection
|
||||||
linksSection
|
linksSection
|
||||||
}.listStyle(GroupedListStyle()).navigationBarTitle(Text("Behavior"))
|
}.listStyle(GroupedListStyle())
|
||||||
|
.navigationBarTitle(Text("Behavior"))
|
||||||
|
}
|
||||||
|
|
||||||
|
var composingSection: some View {
|
||||||
|
Section(header: Text("COMPOSING")) {
|
||||||
|
Picker(selection: $preferences.defaultPostVisibility, label: Text("Default Post Visibility")) {
|
||||||
|
ForEach(Status.Visibility.allCases, id: \.self) { visibility in
|
||||||
|
HStack {
|
||||||
|
Image(systemName: visibility.imageName)
|
||||||
|
Text(visibility.displayName)
|
||||||
|
}
|
||||||
|
.tag(visibility)
|
||||||
|
}//.navigationBarTitle("Default Post Visibility")
|
||||||
|
// navbar title on the ForEach is currently incorrectly applied when the picker is not expanded, see FB6838291
|
||||||
|
}
|
||||||
|
Toggle(isOn: $preferences.automaticallySaveDrafts) {
|
||||||
|
Text("Automatically Save Drafts")
|
||||||
|
}
|
||||||
|
Toggle(isOn: $preferences.requireAttachmentDescriptions) {
|
||||||
|
Text("Require Attachment Descriptions")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var replyingSection: some View {
|
||||||
|
Section(header: Text("REPLYING")) {
|
||||||
|
Picker(selection: $preferences.contentWarningCopyMode, label: Text("Content Warning Copy Style")) {
|
||||||
|
Text("As-is").tag(ContentWarningCopyMode.asIs)
|
||||||
|
Text("Prepend 're: '").tag(ContentWarningCopyMode.prependRe)
|
||||||
|
Text("Don't copy").tag(ContentWarningCopyMode.doNotCopy)
|
||||||
|
}
|
||||||
|
Toggle(isOn: $preferences.mentionReblogger) {
|
||||||
|
Text("Mention Reblogger")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var readingSection: some View {
|
||||||
|
Section(header: Text("READING")) {
|
||||||
|
Toggle(isOn: $preferences.blurAllMedia) {
|
||||||
|
Text("Blur All Media")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var linksSection: some View {
|
var linksSection: some View {
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
//
|
|
||||||
// ComposingPrefsView.swift
|
|
||||||
// Tusker
|
|
||||||
//
|
|
||||||
// Created by Shadowfacts on 2/22/20.
|
|
||||||
// Copyright © 2020 Shadowfacts. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
import Pachyderm
|
|
||||||
|
|
||||||
struct ComposingPrefsView: View {
|
|
||||||
@ObservedObject var preferences = Preferences.shared
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
List {
|
|
||||||
composingSection
|
|
||||||
replyingSection
|
|
||||||
}.listStyle(GroupedListStyle()).navigationBarTitle("Composing")
|
|
||||||
}
|
|
||||||
|
|
||||||
var composingSection: some View {
|
|
||||||
Section(header: Text("COMPOSING")) {
|
|
||||||
Picker(selection: $preferences.defaultPostVisibility, label: Text("Default Post Visibility")) {
|
|
||||||
ForEach(Status.Visibility.allCases, id: \.self) { visibility in
|
|
||||||
HStack {
|
|
||||||
Image(systemName: visibility.imageName)
|
|
||||||
Text(visibility.displayName)
|
|
||||||
}
|
|
||||||
.tag(visibility)
|
|
||||||
}//.navigationBarTitle("Default Post Visibility")
|
|
||||||
// navbar title on the ForEach is currently incorrectly applied when the picker is not expanded, see FB6838291
|
|
||||||
}
|
|
||||||
Toggle(isOn: $preferences.automaticallySaveDrafts) {
|
|
||||||
Text("Automatically Save Drafts")
|
|
||||||
}
|
|
||||||
Toggle(isOn: $preferences.requireAttachmentDescriptions) {
|
|
||||||
Text("Require Attachment Descriptions")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var replyingSection: some View {
|
|
||||||
Section(header: Text("REPLYING")) {
|
|
||||||
Picker(selection: $preferences.contentWarningCopyMode, label: Text("Copy Content Warnings")) {
|
|
||||||
Text("As-is").tag(ContentWarningCopyMode.asIs)
|
|
||||||
Text("Prepend 're: '").tag(ContentWarningCopyMode.prependRe)
|
|
||||||
Text("Don't copy").tag(ContentWarningCopyMode.doNotCopy)
|
|
||||||
}
|
|
||||||
Toggle(isOn: $preferences.mentionReblogger) {
|
|
||||||
Text("Mention Reblogger")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ComposingPrefsView_Previews: PreviewProvider {
|
|
||||||
static var previews: some View {
|
|
||||||
ComposingPrefsView()
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
//
|
|
||||||
// MediaPrefsView.swift
|
|
||||||
// Tusker
|
|
||||||
//
|
|
||||||
// Created by Shadowfacts on 2/22/20.
|
|
||||||
// Copyright © 2020 Shadowfacts. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct MediaPrefsView: View {
|
|
||||||
@ObservedObject var preferences = Preferences.shared
|
|
||||||
|
|
||||||
var body: some View {
|
|
||||||
List {
|
|
||||||
viewingSection
|
|
||||||
}.listStyle(GroupedListStyle()).navigationBarTitle("Media")
|
|
||||||
}
|
|
||||||
|
|
||||||
var viewingSection: some View {
|
|
||||||
Section(header: Text("VIEWING")) {
|
|
||||||
Toggle(isOn: $preferences.blurAllMedia) {
|
|
||||||
Text("Blur All Media")
|
|
||||||
}
|
|
||||||
Toggle(isOn: $preferences.automaticallyPlayGifs) {
|
|
||||||
Text("Automatically Play GIFs")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct MediaPrefsView_Previews: PreviewProvider {
|
|
||||||
static var previews: some View {
|
|
||||||
MediaPrefsView()
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -52,12 +52,6 @@ struct PreferencesView: View {
|
||||||
NavigationLink(destination: AppearancePrefsView()) {
|
NavigationLink(destination: AppearancePrefsView()) {
|
||||||
Text("Appearance")
|
Text("Appearance")
|
||||||
}
|
}
|
||||||
NavigationLink(destination: ComposingPrefsView()) {
|
|
||||||
Text("Composing")
|
|
||||||
}
|
|
||||||
NavigationLink(destination: MediaPrefsView()) {
|
|
||||||
Text("Media")
|
|
||||||
}
|
|
||||||
NavigationLink(destination: BehaviorPrefsView()) {
|
NavigationLink(destination: BehaviorPrefsView()) {
|
||||||
Text("Behavior")
|
Text("Behavior")
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,17 +54,6 @@ class AttachmentView: UIImageView, GIFAnimatable {
|
||||||
isUserInteractionEnabled = true
|
isUserInteractionEnabled = true
|
||||||
addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(imagePressed)))
|
addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(imagePressed)))
|
||||||
|
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(preferencesChanged), name: .preferencesChanged, object: nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
@objc func preferencesChanged() {
|
|
||||||
if let gifData = gifData {
|
|
||||||
if Preferences.shared.automaticallyPlayGifs && !isAnimatingGIF {
|
|
||||||
animate(withGIFData: gifData)
|
|
||||||
} else if !Preferences.shared.automaticallyPlayGifs && isAnimatingGIF {
|
|
||||||
stopAnimatingGIF()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadAttachment() {
|
func loadAttachment() {
|
||||||
|
@ -89,12 +78,8 @@ class AttachmentView: UIImageView, GIFAnimatable {
|
||||||
self.attachmentRequest = nil
|
self.attachmentRequest = nil
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
if self.attachment.url.pathExtension == "gif" {
|
if self.attachment.url.pathExtension == "gif" {
|
||||||
self.gifData = data
|
|
||||||
if Preferences.shared.automaticallyPlayGifs {
|
|
||||||
self.animate(withGIFData: data)
|
self.animate(withGIFData: data)
|
||||||
} else {
|
self.gifData = data
|
||||||
self.image = UIImage(data: data)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
self.image = UIImage(data: data)
|
self.image = UIImage(data: data)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Pachyderm
|
import Pachyderm
|
||||||
import Combine
|
|
||||||
|
|
||||||
protocol ProfileHeaderTableViewCellDelegate: TuskerNavigationDelegate {
|
protocol ProfileHeaderTableViewCellDelegate: TuskerNavigationDelegate {
|
||||||
func showMoreOptions(cell: ProfileHeaderTableViewCell)
|
func showMoreOptions(cell: ProfileHeaderTableViewCell)
|
||||||
|
@ -36,8 +35,6 @@ class ProfileHeaderTableViewCell: UITableViewCell {
|
||||||
var avatarRequest: ImageCache.Request?
|
var avatarRequest: ImageCache.Request?
|
||||||
var headerRequest: ImageCache.Request?
|
var headerRequest: ImageCache.Request?
|
||||||
|
|
||||||
private var accountUpdater: Cancellable?
|
|
||||||
|
|
||||||
override func awakeFromNib() {
|
override func awakeFromNib() {
|
||||||
avatarContainerView.layer.masksToBounds = true
|
avatarContainerView.layer.masksToBounds = true
|
||||||
avatarImageView.layer.masksToBounds = true
|
avatarImageView.layer.masksToBounds = true
|
||||||
|
@ -65,6 +62,7 @@ class ProfileHeaderTableViewCell: UITableViewCell {
|
||||||
|
|
||||||
usernameLabel.text = "@\(account.acct)"
|
usernameLabel.text = "@\(account.acct)"
|
||||||
|
|
||||||
|
avatarImageView.image = nil
|
||||||
avatarRequest = ImageCache.avatars.get(account.avatar) { [weak self] (data) in
|
avatarRequest = ImageCache.avatars.get(account.avatar) { [weak self] (data) in
|
||||||
guard let self = self, let data = data, self.accountID == accountID else { return }
|
guard let self = self, let data = data, self.accountID == accountID else { return }
|
||||||
self.avatarRequest = nil
|
self.avatarRequest = nil
|
||||||
|
@ -72,6 +70,7 @@ class ProfileHeaderTableViewCell: UITableViewCell {
|
||||||
self.avatarImageView.image = UIImage(data: data)
|
self.avatarImageView.image = UIImage(data: data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
headerImageView.image = nil
|
||||||
headerRequest = ImageCache.headers.get(account.header) { [weak self] (data) in
|
headerRequest = ImageCache.headers.get(account.header) { [weak self] (data) in
|
||||||
guard let self = self, let data = data, self.accountID == accountID else { return }
|
guard let self = self, let data = data, self.accountID == accountID else { return }
|
||||||
self.headerRequest = nil
|
self.headerRequest = nil
|
||||||
|
@ -100,7 +99,6 @@ class ProfileHeaderTableViewCell: UITableViewCell {
|
||||||
if let fields = account.fields, !fields.isEmpty {
|
if let fields = account.fields, !fields.isEmpty {
|
||||||
fieldsStackView.isHidden = false
|
fieldsStackView.isHidden = false
|
||||||
|
|
||||||
fieldsStackView.arrangedSubviews.forEach { $0.removeFromSuperview() }
|
|
||||||
for field in fields {
|
for field in fields {
|
||||||
let nameLabel = UILabel()
|
let nameLabel = UILabel()
|
||||||
nameLabel.text = field.name
|
nameLabel.text = field.name
|
||||||
|
@ -122,13 +120,6 @@ class ProfileHeaderTableViewCell: UITableViewCell {
|
||||||
} else {
|
} else {
|
||||||
fieldsStackView.isHidden = true
|
fieldsStackView.isHidden = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if accountUpdater == nil {
|
|
||||||
accountUpdater = mastodonController.cache.accountSubject
|
|
||||||
.filter { [unowned self] in $0.id == self.accountID }
|
|
||||||
.receive(on: DispatchQueue.main)
|
|
||||||
.sink { [unowned self] in self.updateUI(for: $0.id) }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func updateUIForPreferences() {
|
@objc func updateUIForPreferences() {
|
||||||
|
|
|
@ -328,16 +328,10 @@ extension BaseStatusTableViewCell: MenuPreviewProvider {
|
||||||
)
|
)
|
||||||
} else if attachmentsView.frame.contains(location) {
|
} else if attachmentsView.frame.contains(location) {
|
||||||
let attachmentsViewLocation = attachmentsView.convert(location, from: self)
|
let attachmentsViewLocation = attachmentsView.convert(location, from: self)
|
||||||
if let attachmentView = attachmentsView.attachmentViews.allObjects.first(where: { $0.frame.contains(attachmentsViewLocation) }) {
|
if let attachmentView = attachmentsView.attachmentViews.allObjects.first(where: { $0.frame.contains(attachmentsViewLocation) }),
|
||||||
return (
|
let image = attachmentView.image {
|
||||||
content: {
|
let description = attachmentView.attachment.description
|
||||||
let attachments = self.attachmentsView.attachments!
|
return (content: { self.delegate?.largeImage(image, description: description, sourceView: attachmentView) }, actions: { [] })
|
||||||
let sourceViews = attachments.map(self.attachmentsView.getAttachmentView(for:))
|
|
||||||
let startIndex = sourceViews.firstIndex(of: attachmentView)!
|
|
||||||
return self.delegate?.gallery(attachments: attachments, sourceViews: sourceViews, startIndex: startIndex)
|
|
||||||
},
|
|
||||||
actions: { [] }
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}/* else if contentLabel.frame.contains(location),
|
}/* else if contentLabel.frame.contains(location),
|
||||||
let link = contentLabel.getLink(atPoint: contentLabel.convert(location, from: self)) {
|
let link = contentLabel.getLink(atPoint: contentLabel.convert(location, from: self)) {
|
||||||
|
|
Loading…
Reference in New Issue