Compare commits
47 Commits
1f37a5e7eb
...
3ea1ad5622
Author | SHA1 | Date |
---|---|---|
Shadowfacts | 3ea1ad5622 | |
Shadowfacts | 5898da3234 | |
Shadowfacts | 9dd966f639 | |
Shadowfacts | 48662ef1f3 | |
Shadowfacts | 854d48e54e | |
Shadowfacts | d4c560d7fc | |
Shadowfacts | 91b7ce3008 | |
Shadowfacts | 4dca231a06 | |
Shadowfacts | b81c83a250 | |
Shadowfacts | f9e619d9e7 | |
Shadowfacts | ae7962ae50 | |
Shadowfacts | 5027660b52 | |
Shadowfacts | 358d81b5cf | |
Shadowfacts | 79b9108a8f | |
Shadowfacts | 5ab22e742b | |
Shadowfacts | 4f655bb80a | |
Shadowfacts | e4f1309e2d | |
Shadowfacts | bb40894778 | |
Shadowfacts | 24b3fa1e3f | |
Shadowfacts | 16cd045588 | |
Shadowfacts | 15a7cd5f65 | |
Shadowfacts | e676075d5b | |
Shadowfacts | 967bff063b | |
Shadowfacts | 3cba0bce34 | |
Shadowfacts | 60b182ac18 | |
Shadowfacts | 619878ac85 | |
Shadowfacts | 169f1a0191 | |
Shadowfacts | fa31c28e92 | |
Shadowfacts | f815d4e2e4 | |
Shadowfacts | a3e5b29cfc | |
Shadowfacts | 46cecde014 | |
Shadowfacts | 86143c5887 | |
Shadowfacts | 0a1dc423d4 | |
Shadowfacts | 1cb0f1ae56 | |
Shadowfacts | 9f86158bb7 | |
Shadowfacts | 231b0ea830 | |
Shadowfacts | 4dc108f782 | |
Shadowfacts | 795146cde4 | |
Shadowfacts | 975be17d13 | |
Shadowfacts | 32be76ebee | |
Shadowfacts | d13b517128 | |
Shadowfacts | e0d97cd2a8 | |
Shadowfacts | 8b718ce50b | |
Shadowfacts | ce708e2d16 | |
Shadowfacts | 01467574d0 | |
Shadowfacts | 97a2278634 | |
Shadowfacts | 4b2a263889 |
27
CHANGELOG.md
27
CHANGELOG.md
|
@ -1,5 +1,32 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2022.1 (59)
|
||||||
|
This build is a hotfix for a crash when migrating saved instances to iCloud.
|
||||||
|
|
||||||
|
## 2022.1 (58)
|
||||||
|
Features/Improvements:
|
||||||
|
- Sync timeline positions via iCloud
|
||||||
|
- Add pinned timelines customization (synced via iCloud)
|
||||||
|
- Sync saved hashtags & instances via iCloud
|
||||||
|
- Add filters for hiding reblogs and replies from home timeline
|
||||||
|
- Show uncropped attachments in the timeline for posts that have only one attachment
|
||||||
|
- Add more prominent Follow button to profile pages
|
||||||
|
- Add About and Acknowledgements pages to Preferences
|
||||||
|
- Automatically report certain kinds of errors
|
||||||
|
- iPadOS/macOS: Add window titles to indicate which account is in use
|
||||||
|
- iPadOS: Limit content to readable width
|
||||||
|
- VoiceOver: Improve label for toggle collapse button in conversation view
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
- Fix attachments in timeline somtimes being untappable
|
||||||
|
- Fix previewing links in the main status in a conversation activating the link
|
||||||
|
- Don't show reblog swipe action when reblogging is forbidden
|
||||||
|
- Fix unknown notifications appearing in the Mentions view
|
||||||
|
- Fix crash when fetching present items in certain circumstances
|
||||||
|
- Fix relationship (following/blocked/etc.) change breaking profile header layout
|
||||||
|
- Fix crash when restored timeline state includes unloaded statuses
|
||||||
|
- macOS: Fix add attachment buttons not matching system accent color
|
||||||
|
|
||||||
## 2022.1 (53)
|
## 2022.1 (53)
|
||||||
Features/Improvements:
|
Features/Improvements:
|
||||||
- Apply filters to Trending Posts
|
- Apply filters to Trending Posts
|
||||||
|
|
|
@ -298,9 +298,17 @@ public class Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Notifications
|
// MARK: - Notifications
|
||||||
public static func getNotifications(excludeTypes: [Notification.Kind], range: RequestRange = .default) -> Request<[Notification]> {
|
public static func getNotifications(allowedTypes: [Notification.Kind], range: RequestRange = .default) -> Request<[Notification]> {
|
||||||
var request = Request<[Notification]>(method: .get, path: "/api/v1/notifications", queryParameters:
|
var request = Request<[Notification]>(method: .get, path: "/api/v1/notifications", queryParameters:
|
||||||
"exclude_types" => excludeTypes.map { $0.rawValue }
|
"types" => allowedTypes.map { $0.rawValue }
|
||||||
|
)
|
||||||
|
request.range = range
|
||||||
|
return request
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func getNotifications(excludedTypes: [Notification.Kind], range: RequestRange = .default) -> Request<[Notification]> {
|
||||||
|
var request = Request<[Notification]>(method: .get, path: "/api/v1/notifications", queryParameters:
|
||||||
|
"exclude_types" => excludedTypes.map { $0.rawValue }
|
||||||
)
|
)
|
||||||
request.range = range
|
request.range = range
|
||||||
return request
|
return request
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public enum Timeline: Equatable {
|
public enum Timeline: Equatable, Hashable {
|
||||||
case home
|
case home
|
||||||
case `public`(local: Bool)
|
case `public`(local: Bool)
|
||||||
case tag(hashtag: String)
|
case tag(hashtag: String)
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
.DS_Store
|
||||||
|
/.build
|
||||||
|
/Packages
|
||||||
|
/*.xcodeproj
|
||||||
|
xcuserdata/
|
||||||
|
DerivedData/
|
||||||
|
.swiftpm/config/registries.json
|
||||||
|
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
|
||||||
|
.netrc
|
|
@ -0,0 +1,31 @@
|
||||||
|
// swift-tools-version: 5.7
|
||||||
|
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||||
|
|
||||||
|
import PackageDescription
|
||||||
|
|
||||||
|
let package = Package(
|
||||||
|
name: "TTTKit",
|
||||||
|
platforms: [
|
||||||
|
.iOS(.v15),
|
||||||
|
],
|
||||||
|
products: [
|
||||||
|
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
||||||
|
.library(
|
||||||
|
name: "TTTKit",
|
||||||
|
targets: ["TTTKit"]),
|
||||||
|
],
|
||||||
|
dependencies: [
|
||||||
|
// Dependencies declare other packages that this package depends on.
|
||||||
|
// .package(url: /* package url */, from: "1.0.0"),
|
||||||
|
],
|
||||||
|
targets: [
|
||||||
|
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||||
|
// Targets can depend on other targets in this package, and on products in packages this package depends on.
|
||||||
|
.target(
|
||||||
|
name: "TTTKit",
|
||||||
|
dependencies: []),
|
||||||
|
.testTarget(
|
||||||
|
name: "TTTKitTests",
|
||||||
|
dependencies: ["TTTKit"]),
|
||||||
|
]
|
||||||
|
)
|
|
@ -0,0 +1,3 @@
|
||||||
|
# TTTKit
|
||||||
|
|
||||||
|
A description of this package.
|
|
@ -0,0 +1,152 @@
|
||||||
|
//
|
||||||
|
// GameModel.swift
|
||||||
|
// TTTKit
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/21/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import GameKit
|
||||||
|
|
||||||
|
public class GameModel: NSObject, NSCopying, GKGameModel {
|
||||||
|
private var controller: GameController
|
||||||
|
|
||||||
|
public init(controller: GameController) {
|
||||||
|
self.controller = controller
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: GKGameModel
|
||||||
|
|
||||||
|
public var players: [GKGameModelPlayer]? {
|
||||||
|
[Player.x, Player.o]
|
||||||
|
}
|
||||||
|
|
||||||
|
public var activePlayer: GKGameModelPlayer? {
|
||||||
|
switch controller.state {
|
||||||
|
case .playAnywhere(let mark), .playSpecific(let mark, column: _, row: _):
|
||||||
|
switch mark {
|
||||||
|
case .x:
|
||||||
|
return Player.x
|
||||||
|
case .o:
|
||||||
|
return Player.o
|
||||||
|
}
|
||||||
|
case .end(_):
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func setGameModel(_ gameModel: GKGameModel) {
|
||||||
|
let other = (gameModel as! GameModel).controller
|
||||||
|
self.controller = GameController(state: other.state, board: other.board)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func gameModelUpdates(for player: GKGameModelPlayer) -> [GKGameModelUpdate]? {
|
||||||
|
guard let player = player as? Player else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
let mark = player.mark
|
||||||
|
|
||||||
|
switch controller.state {
|
||||||
|
case .playAnywhere:
|
||||||
|
return updatesForPlayAnywhere(mark: mark)
|
||||||
|
case .playSpecific(_, column: let col, row: let row):
|
||||||
|
return updatesForPlaySpecific(mark: mark, board: (col, row))
|
||||||
|
case .end:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func apply(_ gameModelUpdate: GKGameModelUpdate) {
|
||||||
|
let update = gameModelUpdate as! Update
|
||||||
|
switch controller.state {
|
||||||
|
case .playAnywhere(update.mark), .playSpecific(update.mark, column: update.subBoard.column, row: update.subBoard.row):
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
fatalError()
|
||||||
|
}
|
||||||
|
controller.play(on: update.subBoard, column: update.column, row: update.row)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func score(for player: GKGameModelPlayer) -> Int {
|
||||||
|
guard let player = player as? Player else {
|
||||||
|
return .min
|
||||||
|
}
|
||||||
|
|
||||||
|
var score = 0
|
||||||
|
for column in 0..<3 {
|
||||||
|
for row in 0..<3 {
|
||||||
|
let subBoard = controller.board.getSubBoard(column: column, row: row)
|
||||||
|
if let win = subBoard.win {
|
||||||
|
if win.mark == player.mark {
|
||||||
|
score += 10
|
||||||
|
} else {
|
||||||
|
score -= 5
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
score += 4 * subBoard.potentialWinCount(for: player.mark)
|
||||||
|
score -= 2 * subBoard.potentialWinCount(for: player.mark.next)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if case .playAnywhere(let mark) = controller.state {
|
||||||
|
if mark == player.mark {
|
||||||
|
score += 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
score += 8 * controller.board.potentialWinCount(for: player.mark)
|
||||||
|
score -= 4 * controller.board.potentialWinCount(for: player.mark.next)
|
||||||
|
return score
|
||||||
|
}
|
||||||
|
|
||||||
|
public func isWin(for player: GKGameModelPlayer) -> Bool {
|
||||||
|
let mark = (player as! Player).mark
|
||||||
|
return controller.board.win?.mark == mark
|
||||||
|
}
|
||||||
|
|
||||||
|
private func updatesForPlayAnywhere(mark: Mark) -> [Update] {
|
||||||
|
var updates = [Update]()
|
||||||
|
for boardColumn in 0..<3 {
|
||||||
|
for boardRow in 0..<3 {
|
||||||
|
let subBoard = controller.board.getSubBoard(column: boardColumn, row: boardRow)
|
||||||
|
guard !subBoard.ended else { continue }
|
||||||
|
|
||||||
|
for column in 0..<3 {
|
||||||
|
for row in 0..<3 {
|
||||||
|
guard subBoard[column, row] == nil else { continue }
|
||||||
|
updates.append(Update(mark: mark, subBoard: (boardColumn, boardRow), column: column, row: row))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return updates
|
||||||
|
}
|
||||||
|
|
||||||
|
private func updatesForPlaySpecific(mark: Mark, board: (column: Int, row: Int)) -> [Update] {
|
||||||
|
let subBoard = controller.board.getSubBoard(column: board.column, row: board.row)
|
||||||
|
var updates = [Update]()
|
||||||
|
for column in 0..<3 {
|
||||||
|
for row in 0..<3 {
|
||||||
|
guard subBoard[column, row] == nil else { continue }
|
||||||
|
updates.append(Update(mark: mark, subBoard: board, column: column, row: row))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return updates
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: NSCopying
|
||||||
|
|
||||||
|
public func copy(with zone: NSZone? = nil) -> Any {
|
||||||
|
return GameModel(controller: GameController(state: controller.state, board: controller.board))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Board {
|
||||||
|
func potentialWinCount(for mark: Mark) -> Int {
|
||||||
|
return Win.allPoints.filter { points in
|
||||||
|
let empty = points.filter { self[$0] == nil }.count
|
||||||
|
let matching = points.filter { self[$0] == mark }.count
|
||||||
|
return matching == 2 && empty == 1
|
||||||
|
}.count
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
//
|
||||||
|
// Player.swift
|
||||||
|
// TTTKit
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/21/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import GameKit
|
||||||
|
|
||||||
|
class Player: NSObject, GKGameModelPlayer {
|
||||||
|
static let x = Player(playerId: 0)
|
||||||
|
static let o = Player(playerId: 1)
|
||||||
|
|
||||||
|
let playerId: Int
|
||||||
|
|
||||||
|
var mark: Mark {
|
||||||
|
playerId == 0 ? .x : .o
|
||||||
|
}
|
||||||
|
|
||||||
|
private init(playerId: Int) {
|
||||||
|
self.playerId = playerId
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
//
|
||||||
|
// Update.swift
|
||||||
|
// TTTKit
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/21/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import GameKit
|
||||||
|
|
||||||
|
class Update: NSObject, GKGameModelUpdate {
|
||||||
|
let mark: Mark
|
||||||
|
let subBoard: (column: Int, row: Int)
|
||||||
|
let column: Int
|
||||||
|
let row: Int
|
||||||
|
|
||||||
|
init(mark: Mark, subBoard: (Int, Int), column: Int, row: Int) {
|
||||||
|
self.mark = mark
|
||||||
|
self.subBoard = subBoard
|
||||||
|
self.column = column
|
||||||
|
self.row = row
|
||||||
|
}
|
||||||
|
|
||||||
|
var value: Int = 0
|
||||||
|
}
|
|
@ -0,0 +1,120 @@
|
||||||
|
//
|
||||||
|
// GameController.swift
|
||||||
|
// TTTKit
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/21/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public class GameController: ObservableObject {
|
||||||
|
|
||||||
|
@Published public private(set) var state: State
|
||||||
|
@Published public private(set) var board: SuperTicTacToeBoard
|
||||||
|
|
||||||
|
public init() {
|
||||||
|
self.state = .playAnywhere(.x)
|
||||||
|
self.board = SuperTicTacToeBoard()
|
||||||
|
}
|
||||||
|
|
||||||
|
init(state: State, board: SuperTicTacToeBoard) {
|
||||||
|
self.state = state
|
||||||
|
self.board = board
|
||||||
|
}
|
||||||
|
|
||||||
|
public func play(on subBoard: (column: Int, row: Int), column: Int, row: Int) {
|
||||||
|
guard board.getSubBoard(column: subBoard.column, row: subBoard.row)[column, row] == nil else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let activePlayer: Mark
|
||||||
|
switch state {
|
||||||
|
case .playAnywhere(let mark):
|
||||||
|
activePlayer = mark
|
||||||
|
case .playSpecific(let mark, column: subBoard.column, row: subBoard.row):
|
||||||
|
activePlayer = mark
|
||||||
|
default:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
board.play(mark: activePlayer, subBoard: subBoard, column: column, row: row)
|
||||||
|
|
||||||
|
if let win = board.win {
|
||||||
|
state = .end(.won(win))
|
||||||
|
} else if board.tied {
|
||||||
|
state = .end(.tie)
|
||||||
|
} else {
|
||||||
|
let nextSubBoard = board.getSubBoard(column: column, row: row)
|
||||||
|
if nextSubBoard.ended {
|
||||||
|
state = .playAnywhere(activePlayer.next)
|
||||||
|
} else {
|
||||||
|
state = .playSpecific(activePlayer.next, column: column, row: row)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func canPlay(on subBoard: (column: Int, row: Int)) -> Bool {
|
||||||
|
switch state {
|
||||||
|
case .playAnywhere(_):
|
||||||
|
return true
|
||||||
|
case .playSpecific(_, column: subBoard.column, row: subBoard.row):
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public extension GameController {
|
||||||
|
enum State {
|
||||||
|
case playAnywhere(Mark)
|
||||||
|
case playSpecific(Mark, column: Int, row: Int)
|
||||||
|
case end(Result)
|
||||||
|
|
||||||
|
public var displayName: String {
|
||||||
|
switch self {
|
||||||
|
case .playAnywhere(_):
|
||||||
|
return "Play anywhere"
|
||||||
|
case .playSpecific(_, column: let col, row: let row):
|
||||||
|
switch (col, row) {
|
||||||
|
case (0, 0):
|
||||||
|
return "Play in the top left"
|
||||||
|
case (1, 0):
|
||||||
|
return "Play in the top middle"
|
||||||
|
case (2, 0):
|
||||||
|
return "Play in the top right"
|
||||||
|
case (0, 1):
|
||||||
|
return "Play in the middle left"
|
||||||
|
case (1, 1):
|
||||||
|
return "Play in the center"
|
||||||
|
case (2, 1):
|
||||||
|
return "Play in the middle right"
|
||||||
|
case (0, 2):
|
||||||
|
return "Play in the bottom left"
|
||||||
|
case (1, 2):
|
||||||
|
return "Play in the bottom middle"
|
||||||
|
case (2, 2):
|
||||||
|
return "Play in the bottom right"
|
||||||
|
default:
|
||||||
|
fatalError()
|
||||||
|
}
|
||||||
|
case .end(.tie):
|
||||||
|
return "It's a tie!"
|
||||||
|
case .end(.won(let win)):
|
||||||
|
switch win.mark {
|
||||||
|
case .x:
|
||||||
|
return "X wins!"
|
||||||
|
case .o:
|
||||||
|
return "O wins!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public extension GameController {
|
||||||
|
enum Result {
|
||||||
|
case won(Win)
|
||||||
|
case tie
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
//
|
||||||
|
// Board.swift
|
||||||
|
// TTTKit
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/21/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public protocol Board {
|
||||||
|
subscript(_ column: Int, _ row: Int) -> Mark? { get }
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Board {
|
||||||
|
subscript(_ point: (column: Int, row: Int)) -> Mark? {
|
||||||
|
get {
|
||||||
|
self[point.column, point.row]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public var full: Bool {
|
||||||
|
for column in 0..<3 {
|
||||||
|
for row in 0..<3 {
|
||||||
|
if self[column, row] == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
public var win: Win? {
|
||||||
|
for points in Win.allPoints {
|
||||||
|
if let mark = self[points[0]],
|
||||||
|
self[points[1]] == mark && self[points[2]] == mark {
|
||||||
|
return Win(mark: mark, points: points)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
public var won: Bool {
|
||||||
|
win != nil
|
||||||
|
}
|
||||||
|
|
||||||
|
public var tied: Bool {
|
||||||
|
full && !won
|
||||||
|
}
|
||||||
|
|
||||||
|
public var ended: Bool {
|
||||||
|
won || tied
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
//
|
||||||
|
// Mark.swift
|
||||||
|
// TTTKit
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/21/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public enum Mark {
|
||||||
|
case x, o
|
||||||
|
|
||||||
|
public var next: Mark {
|
||||||
|
switch self {
|
||||||
|
case .x:
|
||||||
|
return .o
|
||||||
|
case .o:
|
||||||
|
return .x
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
//
|
||||||
|
// SuperTicTacToeBoard.swift
|
||||||
|
// TTTKit
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/21/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public struct SuperTicTacToeBoard: Board {
|
||||||
|
|
||||||
|
private var boards: [[TicTacToeBoard]] = [
|
||||||
|
[TicTacToeBoard(), TicTacToeBoard(), TicTacToeBoard()],
|
||||||
|
[TicTacToeBoard(), TicTacToeBoard(), TicTacToeBoard()],
|
||||||
|
[TicTacToeBoard(), TicTacToeBoard(), TicTacToeBoard()],
|
||||||
|
]
|
||||||
|
|
||||||
|
public subscript(_ column: Int, _ row: Int) -> Mark? {
|
||||||
|
get {
|
||||||
|
getSubBoard(column: column, row: row).win?.mark
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func getSubBoard(column: Int, row: Int) -> TicTacToeBoard {
|
||||||
|
return boards[row][column]
|
||||||
|
}
|
||||||
|
|
||||||
|
public mutating func play(mark: Mark, subBoard: (column: Int, row: Int), column: Int, row: Int) {
|
||||||
|
boards[subBoard.row][subBoard.column].play(mark: mark, column: column, row: row)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
//
|
||||||
|
// TicTacToeBoard.swift
|
||||||
|
// TTTKit
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/21/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public struct TicTacToeBoard: Board {
|
||||||
|
private var marks: [[Mark?]] = [
|
||||||
|
[nil, nil, nil],
|
||||||
|
[nil, nil, nil],
|
||||||
|
[nil, nil, nil],
|
||||||
|
]
|
||||||
|
|
||||||
|
init() {
|
||||||
|
}
|
||||||
|
|
||||||
|
init(marks: [[Mark?]]) {
|
||||||
|
precondition(marks.count == 3)
|
||||||
|
precondition(marks.allSatisfy { $0.count == 3 })
|
||||||
|
self.marks = marks
|
||||||
|
}
|
||||||
|
|
||||||
|
public subscript(_ column: Int, _ row: Int) -> Mark? {
|
||||||
|
get {
|
||||||
|
marks[row][column]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func canPlay(column: Int, row: Int) -> Bool {
|
||||||
|
return self[column, row] == nil
|
||||||
|
}
|
||||||
|
|
||||||
|
public mutating func play(mark: Mark, column: Int, row: Int) {
|
||||||
|
marks[row][column] = mark
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
//
|
||||||
|
// Win.swift
|
||||||
|
// TTTKit
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/21/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public struct Win {
|
||||||
|
public let mark: Mark
|
||||||
|
public let points: [(column: Int, row: Int)]
|
||||||
|
|
||||||
|
static let allPoints: [[(Int, Int)]] = [
|
||||||
|
[(0, 0), (1, 1), (2, 2)], // top left diag
|
||||||
|
[(2, 0), (1, 1), (0, 2)], // top right diag
|
||||||
|
[(0, 0), (1, 0), (2, 0)], // top row
|
||||||
|
[(0, 1), (1, 1), (2, 1)], // middle row
|
||||||
|
[(0, 2), (1, 2), (2, 2)], // bottom row
|
||||||
|
[(0, 0), (0, 1), (0, 2)], // left col
|
||||||
|
[(1, 0), (1, 1), (1, 2)], // middle col
|
||||||
|
[(2, 0), (2, 1), (2, 2)], // right col
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
//
|
||||||
|
// BoardView.swift
|
||||||
|
// TTTKit
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/21/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct BoardView<Cell: View>: View {
|
||||||
|
let board: any Board
|
||||||
|
@Binding var cellSize: CGFloat
|
||||||
|
let spacing: CGFloat
|
||||||
|
let cellProvider: (_ column: Int, _ row: Int) -> Cell
|
||||||
|
|
||||||
|
init(board: any Board, cellSize: Binding<CGFloat>, spacing: CGFloat, @ViewBuilder cellProvider: @escaping (Int, Int) -> Cell) {
|
||||||
|
self.board = board
|
||||||
|
self._cellSize = cellSize
|
||||||
|
self.spacing = spacing
|
||||||
|
self.cellProvider = cellProvider
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
ZStack {
|
||||||
|
if let win = board.win {
|
||||||
|
winOverlay(win)
|
||||||
|
}
|
||||||
|
|
||||||
|
Grid(horizontalSpacing: 10, verticalSpacing: 10) {
|
||||||
|
GridRow {
|
||||||
|
cellProvider(0, 0)
|
||||||
|
.background(GeometryReader { proxy in
|
||||||
|
Color.clear
|
||||||
|
.preference(key: MarkSizePrefKey.self, value: proxy.size.width)
|
||||||
|
.onPreferenceChange(MarkSizePrefKey.self) { newValue in
|
||||||
|
cellSize = newValue
|
||||||
|
}
|
||||||
|
})
|
||||||
|
cellProvider(1, 0)
|
||||||
|
cellProvider(2, 0)
|
||||||
|
}
|
||||||
|
GridRow {
|
||||||
|
cellProvider(0, 1)
|
||||||
|
cellProvider(1, 1)
|
||||||
|
cellProvider(2, 1)
|
||||||
|
}
|
||||||
|
GridRow {
|
||||||
|
cellProvider(0, 2)
|
||||||
|
cellProvider(1, 2)
|
||||||
|
cellProvider(2, 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let sepOffset = (cellSize + spacing) / 2
|
||||||
|
Separator(axis: .vertical)
|
||||||
|
.offset(x: -sepOffset)
|
||||||
|
Separator(axis: .vertical)
|
||||||
|
.offset(x: sepOffset)
|
||||||
|
Separator(axis: .horizontal)
|
||||||
|
.offset(y: -sepOffset)
|
||||||
|
Separator(axis: .horizontal)
|
||||||
|
.offset(y: sepOffset)
|
||||||
|
}
|
||||||
|
.padding(.all, spacing / 2)
|
||||||
|
.aspectRatio(1, contentMode: .fit)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func winOverlay(_ win: Win) -> some View {
|
||||||
|
let pointsWithIndices = win.points.map { ($0, $0.row * 3 + $0.column) }
|
||||||
|
let cellSize = cellSize + spacing
|
||||||
|
return ForEach(pointsWithIndices, id: \.1) { (point, _) in
|
||||||
|
Rectangle()
|
||||||
|
.foregroundColor(Color(UIColor.green))
|
||||||
|
.opacity(0.5)
|
||||||
|
.frame(width: cellSize, height: cellSize)
|
||||||
|
.offset(x: CGFloat(point.column - 1) * cellSize, y: CGFloat(point.row - 1) * cellSize)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private struct MarkSizePrefKey: PreferenceKey {
|
||||||
|
static var defaultValue: CGFloat = 0
|
||||||
|
|
||||||
|
static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) {
|
||||||
|
value = nextValue()
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
//
|
||||||
|
// GameView.swift
|
||||||
|
// TTTKit
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/21/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
public struct GameView: View {
|
||||||
|
@ObservedObject private var controller: GameController
|
||||||
|
@State private var cellSize: CGFloat = 0
|
||||||
|
@State private var scaleAnchor: UnitPoint = .center
|
||||||
|
@State private var focusedSubBoard: (column: Int, row: Int)? = nil
|
||||||
|
|
||||||
|
public init(controller: GameController) {
|
||||||
|
self.controller = controller
|
||||||
|
}
|
||||||
|
|
||||||
|
public var body: some View {
|
||||||
|
let scale: CGFloat = focusedSubBoard == nil ? 1 : 2.5
|
||||||
|
return boardView
|
||||||
|
.scaleEffect(x: scale, y: scale, anchor: scaleAnchor)
|
||||||
|
.clipped()
|
||||||
|
}
|
||||||
|
|
||||||
|
private var boardView: some View {
|
||||||
|
BoardView(board: controller.board, cellSize: $cellSize, spacing: 10) { column, row in
|
||||||
|
ZStack {
|
||||||
|
if case .playSpecific(_, column: column, row: row) = controller.state {
|
||||||
|
Color.teal
|
||||||
|
.padding(.all, -5)
|
||||||
|
.opacity(0.4)
|
||||||
|
}
|
||||||
|
|
||||||
|
let board = controller.board.getSubBoard(column: column, row: row)
|
||||||
|
SubBoardView(board: board, cellTapped: cellTapHandler(column, row))
|
||||||
|
.environment(\.separatorColor, Color.gray.opacity(0.6))
|
||||||
|
.contentShape(Rectangle())
|
||||||
|
.onTapGesture {
|
||||||
|
switch controller.state {
|
||||||
|
case .playAnywhere(_), .playSpecific(_, column: column, row: row):
|
||||||
|
scaleAnchor = UnitPoint(x: CGFloat(column) * 0.5, y: CGFloat(row) * 0.5)
|
||||||
|
withAnimation(.easeInOut(duration: 0.3)) {
|
||||||
|
focusedSubBoard = (column, row)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.opacity(board.won ? 0.8 : 1)
|
||||||
|
|
||||||
|
if let mark = board.win?.mark {
|
||||||
|
MarkView(mark: mark)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func cellTapHandler(_ column: Int, _ row: Int) -> ((Int, Int) -> Void)? {
|
||||||
|
guard focusedSubBoard?.column == column && focusedSubBoard?.row == row else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
let subBoard = (column, row)
|
||||||
|
return { column, row in
|
||||||
|
controller.play(on: subBoard, column: column, row: row)
|
||||||
|
withAnimation(.easeInOut(duration: 0.3)) {
|
||||||
|
focusedSubBoard = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct GameView_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
GameView(controller: GameController())
|
||||||
|
.padding()
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
//
|
||||||
|
// MarkView.swift
|
||||||
|
// TTTKit
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/21/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct MarkView: View {
|
||||||
|
let mark: Mark?
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
maybeImage.aspectRatio(1, contentMode: .fit)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private var maybeImage: some View {
|
||||||
|
if let mark {
|
||||||
|
Image(systemName: mark == .x ? "xmark" : "circle")
|
||||||
|
.resizable()
|
||||||
|
.fontWeight(mark == .x ? .regular : .semibold)
|
||||||
|
} else {
|
||||||
|
Color.clear
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct MarkView_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
HStack {
|
||||||
|
MarkView(mark: .x)
|
||||||
|
MarkView(mark: .o)
|
||||||
|
MarkView(mark: nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
//
|
||||||
|
// SwiftUIView.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/21/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct Separator: View {
|
||||||
|
let axis: Axis
|
||||||
|
@Environment(\.separatorColor) private var separatorColor
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
rect
|
||||||
|
.foregroundColor(separatorColor)
|
||||||
|
.gridCellUnsizedAxes(axis == .vertical ? .vertical : .horizontal)
|
||||||
|
}
|
||||||
|
|
||||||
|
private var rect: some View {
|
||||||
|
if axis == .vertical {
|
||||||
|
return Rectangle().frame(width: 1)
|
||||||
|
} else {
|
||||||
|
return Rectangle().frame(height: 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private struct SeparatorColorKey: EnvironmentKey {
|
||||||
|
static var defaultValue = Color.black
|
||||||
|
}
|
||||||
|
|
||||||
|
extension EnvironmentValues {
|
||||||
|
var separatorColor: Color {
|
||||||
|
get { self[SeparatorColorKey.self] }
|
||||||
|
set { self[SeparatorColorKey.self] = newValue }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
//
|
||||||
|
// SubBoardView.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/21/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct SubBoardView: View {
|
||||||
|
let board: TicTacToeBoard
|
||||||
|
let cellTapped: ((_ column: Int, _ row: Int) -> Void)?
|
||||||
|
@State private var cellSize: CGFloat = 0
|
||||||
|
|
||||||
|
init(board: TicTacToeBoard, cellTapped: ((Int, Int) -> Void)? = nil) {
|
||||||
|
self.board = board
|
||||||
|
self.cellTapped = cellTapped
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
BoardView(board: board, cellSize: $cellSize, spacing: 10) { column, row in
|
||||||
|
applyTapHandler(column, row, MarkView(mark: board[column, row])
|
||||||
|
.contentShape(Rectangle()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func applyTapHandler(_ column: Int, _ row: Int, _ view: some View) -> some View {
|
||||||
|
if let cellTapped {
|
||||||
|
view.onTapGesture {
|
||||||
|
cellTapped(column, row)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
view
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct SubBoardView_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
SubBoardView(board: TicTacToeBoard(marks: [
|
||||||
|
[ .x, .o, .x],
|
||||||
|
[nil, .x, .o],
|
||||||
|
[ .x, nil, nil],
|
||||||
|
]))
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import XCTest
|
||||||
|
@testable import TTTKit
|
||||||
|
|
||||||
|
final class TTTKitTests: XCTestCase {
|
||||||
|
func testExample() throws {
|
||||||
|
}
|
||||||
|
}
|
|
@ -52,7 +52,7 @@
|
||||||
D61F759229365C6C00C0B37F /* CollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D61F759129365C6C00C0B37F /* CollectionViewController.swift */; };
|
D61F759229365C6C00C0B37F /* CollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D61F759129365C6C00C0B37F /* CollectionViewController.swift */; };
|
||||||
D61F75942936F0DA00C0B37F /* FollowedHashtag.swift in Sources */ = {isa = PBXBuildFile; fileRef = D61F75932936F0DA00C0B37F /* FollowedHashtag.swift */; };
|
D61F75942936F0DA00C0B37F /* FollowedHashtag.swift in Sources */ = {isa = PBXBuildFile; fileRef = D61F75932936F0DA00C0B37F /* FollowedHashtag.swift */; };
|
||||||
D61F75962937037800C0B37F /* ToggleFollowHashtagService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D61F75952937037800C0B37F /* ToggleFollowHashtagService.swift */; };
|
D61F75962937037800C0B37F /* ToggleFollowHashtagService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D61F75952937037800C0B37F /* ToggleFollowHashtagService.swift */; };
|
||||||
D61F759929384D4D00C0B37F /* FiltersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D61F759829384D4D00C0B37F /* FiltersView.swift */; };
|
D61F759929384D4D00C0B37F /* CustomizeTimelinesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D61F759829384D4D00C0B37F /* CustomizeTimelinesView.swift */; };
|
||||||
D61F759B29384F9C00C0B37F /* FilterMO.swift in Sources */ = {isa = PBXBuildFile; fileRef = D61F759A29384F9C00C0B37F /* FilterMO.swift */; };
|
D61F759B29384F9C00C0B37F /* FilterMO.swift in Sources */ = {isa = PBXBuildFile; fileRef = D61F759A29384F9C00C0B37F /* FilterMO.swift */; };
|
||||||
D61F759D2938574B00C0B37F /* FilterRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = D61F759C2938574B00C0B37F /* FilterRow.swift */; };
|
D61F759D2938574B00C0B37F /* FilterRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = D61F759C2938574B00C0B37F /* FilterRow.swift */; };
|
||||||
D61F759F29385AD800C0B37F /* SemiCaseSensitiveComparator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D61F759E29385AD800C0B37F /* SemiCaseSensitiveComparator.swift */; };
|
D61F759F29385AD800C0B37F /* SemiCaseSensitiveComparator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D61F759E29385AD800C0B37F /* SemiCaseSensitiveComparator.swift */; };
|
||||||
|
@ -117,7 +117,6 @@
|
||||||
D63CC7122911F57C000E19DE /* StatusBarTappableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D63CC7112911F57C000E19DE /* StatusBarTappableViewController.swift */; };
|
D63CC7122911F57C000E19DE /* StatusBarTappableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D63CC7112911F57C000E19DE /* StatusBarTappableViewController.swift */; };
|
||||||
D63D8DF42850FE7A008D95E1 /* ViewTags.swift in Sources */ = {isa = PBXBuildFile; fileRef = D63D8DF32850FE7A008D95E1 /* ViewTags.swift */; };
|
D63D8DF42850FE7A008D95E1 /* ViewTags.swift in Sources */ = {isa = PBXBuildFile; fileRef = D63D8DF32850FE7A008D95E1 /* ViewTags.swift */; };
|
||||||
D63F9C6E241D2D85004C03CF /* CompositionAttachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D63F9C6D241D2D85004C03CF /* CompositionAttachment.swift */; };
|
D63F9C6E241D2D85004C03CF /* CompositionAttachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D63F9C6D241D2D85004C03CF /* CompositionAttachment.swift */; };
|
||||||
D6403CC224A6B72D00E81C55 /* VisualEffectImageButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6403CC124A6B72D00E81C55 /* VisualEffectImageButton.swift */; };
|
|
||||||
D640D76922BAF5E6004FBE69 /* DomainBlocks.plist in Resources */ = {isa = PBXBuildFile; fileRef = D640D76822BAF5E6004FBE69 /* DomainBlocks.plist */; };
|
D640D76922BAF5E6004FBE69 /* DomainBlocks.plist in Resources */ = {isa = PBXBuildFile; fileRef = D640D76822BAF5E6004FBE69 /* DomainBlocks.plist */; };
|
||||||
D6412B0324AFF6A600F5412E /* TabBarScrollableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6412B0224AFF6A600F5412E /* TabBarScrollableViewController.swift */; };
|
D6412B0324AFF6A600F5412E /* TabBarScrollableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6412B0224AFF6A600F5412E /* TabBarScrollableViewController.swift */; };
|
||||||
D6412B0924B0291E00F5412E /* MyProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6412B0824B0291E00F5412E /* MyProfileViewController.swift */; };
|
D6412B0924B0291E00F5412E /* MyProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6412B0824B0291E00F5412E /* MyProfileViewController.swift */; };
|
||||||
|
@ -144,6 +143,8 @@
|
||||||
D6538945214D6D7500E3CEFC /* TableViewSwipeActionProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6538944214D6D7500E3CEFC /* TableViewSwipeActionProvider.swift */; };
|
D6538945214D6D7500E3CEFC /* TableViewSwipeActionProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6538944214D6D7500E3CEFC /* TableViewSwipeActionProvider.swift */; };
|
||||||
D653F411267D1E32004E32B1 /* DiffableTimelineLikeTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D653F410267D1E32004E32B1 /* DiffableTimelineLikeTableViewController.swift */; };
|
D653F411267D1E32004E32B1 /* DiffableTimelineLikeTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D653F410267D1E32004E32B1 /* DiffableTimelineLikeTableViewController.swift */; };
|
||||||
D6552367289870790048A653 /* ScreenCorners in Frameworks */ = {isa = PBXBuildFile; productRef = D6552366289870790048A653 /* ScreenCorners */; };
|
D6552367289870790048A653 /* ScreenCorners in Frameworks */ = {isa = PBXBuildFile; productRef = D6552366289870790048A653 /* ScreenCorners */; };
|
||||||
|
D659F35E2953A212002D944A /* TTTKit in Frameworks */ = {isa = PBXBuildFile; productRef = D659F35D2953A212002D944A /* TTTKit */; };
|
||||||
|
D659F36229541065002D944A /* TTTView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D659F36129541065002D944A /* TTTView.swift */; };
|
||||||
D65C6BF525478A9C00A6E89C /* BackgroundableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D65C6BF425478A9C00A6E89C /* BackgroundableViewController.swift */; };
|
D65C6BF525478A9C00A6E89C /* BackgroundableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D65C6BF425478A9C00A6E89C /* BackgroundableViewController.swift */; };
|
||||||
D65F613423AEAB6600F3CFD3 /* OnboardingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D65F613323AEAB6600F3CFD3 /* OnboardingTests.swift */; };
|
D65F613423AEAB6600F3CFD3 /* OnboardingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D65F613323AEAB6600F3CFD3 /* OnboardingTests.swift */; };
|
||||||
D6620ACE2511A0ED00312CA0 /* StatusStateResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6620ACD2511A0ED00312CA0 /* StatusStateResolver.swift */; };
|
D6620ACE2511A0ED00312CA0 /* StatusStateResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6620ACD2511A0ED00312CA0 /* StatusStateResolver.swift */; };
|
||||||
|
@ -186,6 +187,13 @@
|
||||||
D6895DC228D65274006341DA /* CustomAlertController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6895DC128D65274006341DA /* CustomAlertController.swift */; };
|
D6895DC228D65274006341DA /* CustomAlertController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6895DC128D65274006341DA /* CustomAlertController.swift */; };
|
||||||
D6895DC428D65342006341DA /* ConfirmReblogStatusPreviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6895DC328D65342006341DA /* ConfirmReblogStatusPreviewView.swift */; };
|
D6895DC428D65342006341DA /* ConfirmReblogStatusPreviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6895DC328D65342006341DA /* ConfirmReblogStatusPreviewView.swift */; };
|
||||||
D6895DE928D962C2006341DA /* TimelineLikeController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6895DE828D962C2006341DA /* TimelineLikeController.swift */; };
|
D6895DE928D962C2006341DA /* TimelineLikeController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6895DE828D962C2006341DA /* TimelineLikeController.swift */; };
|
||||||
|
D68A76DA29511CA6001DA1B3 /* AccountPreferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68A76D929511CA6001DA1B3 /* AccountPreferences.swift */; };
|
||||||
|
D68A76E329524D2A001DA1B3 /* ListMO.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68A76E229524D2A001DA1B3 /* ListMO.swift */; };
|
||||||
|
D68A76E829527884001DA1B3 /* PinnedTimelinesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68A76E729527884001DA1B3 /* PinnedTimelinesView.swift */; };
|
||||||
|
D68A76EA295285D0001DA1B3 /* AddHashtagPinnedTimelineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68A76E9295285D0001DA1B3 /* AddHashtagPinnedTimelineView.swift */; };
|
||||||
|
D68A76EC295369A8001DA1B3 /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68A76EB295369A8001DA1B3 /* AboutView.swift */; };
|
||||||
|
D68A76EE295369C7001DA1B3 /* AcknowledgementsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68A76ED295369C7001DA1B3 /* AcknowledgementsView.swift */; };
|
||||||
|
D68A76F129539116001DA1B3 /* FlipView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68A76F029539116001DA1B3 /* FlipView.swift */; };
|
||||||
D68ACE5D279B1ABA001CE8EB /* AssetPickerControlCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68ACE5C279B1ABA001CE8EB /* AssetPickerControlCollectionViewCell.swift */; };
|
D68ACE5D279B1ABA001CE8EB /* AssetPickerControlCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68ACE5C279B1ABA001CE8EB /* AssetPickerControlCollectionViewCell.swift */; };
|
||||||
D68C2AE325869BAB00548EFF /* AuxiliarySceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68C2AE225869BAB00548EFF /* AuxiliarySceneDelegate.swift */; };
|
D68C2AE325869BAB00548EFF /* AuxiliarySceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68C2AE225869BAB00548EFF /* AuxiliarySceneDelegate.swift */; };
|
||||||
D68E525B24A3D77E0054355A /* TuskerRootViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68E525A24A3D77E0054355A /* TuskerRootViewController.swift */; };
|
D68E525B24A3D77E0054355A /* TuskerRootViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68E525A24A3D77E0054355A /* TuskerRootViewController.swift */; };
|
||||||
|
@ -210,6 +218,8 @@
|
||||||
D6969E9E240C81B9002843CE /* NSTextAttachment+Emoji.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6969E9D240C81B9002843CE /* NSTextAttachment+Emoji.swift */; };
|
D6969E9E240C81B9002843CE /* NSTextAttachment+Emoji.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6969E9D240C81B9002843CE /* NSTextAttachment+Emoji.swift */; };
|
||||||
D6969EA0240C8384002843CE /* EmojiLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6969E9F240C8384002843CE /* EmojiLabel.swift */; };
|
D6969EA0240C8384002843CE /* EmojiLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6969E9F240C8384002843CE /* EmojiLabel.swift */; };
|
||||||
D6A00B1D26379FC900316AD4 /* PollOptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6A00B1C26379FC900316AD4 /* PollOptionsView.swift */; };
|
D6A00B1D26379FC900316AD4 /* PollOptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6A00B1C26379FC900316AD4 /* PollOptionsView.swift */; };
|
||||||
|
D6A3A380295515550036B6EF /* ProfileHeaderButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6A3A37F295515550036B6EF /* ProfileHeaderButton.swift */; };
|
||||||
|
D6A3A3822956123A0036B6EF /* TimelinePosition.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6A3A3812956123A0036B6EF /* TimelinePosition.swift */; };
|
||||||
D6A3BC7C232195C600FD64D5 /* ActionNotificationGroupTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6A3BC7A232195C600FD64D5 /* ActionNotificationGroupTableViewCell.swift */; };
|
D6A3BC7C232195C600FD64D5 /* ActionNotificationGroupTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6A3BC7A232195C600FD64D5 /* ActionNotificationGroupTableViewCell.swift */; };
|
||||||
D6A3BC7D232195C600FD64D5 /* ActionNotificationGroupTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D6A3BC7B232195C600FD64D5 /* ActionNotificationGroupTableViewCell.xib */; };
|
D6A3BC7D232195C600FD64D5 /* ActionNotificationGroupTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D6A3BC7B232195C600FD64D5 /* ActionNotificationGroupTableViewCell.xib */; };
|
||||||
D6A3BC802321B7E600FD64D5 /* FollowNotificationGroupTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6A3BC7E2321B7E600FD64D5 /* FollowNotificationGroupTableViewCell.swift */; };
|
D6A3BC802321B7E600FD64D5 /* FollowNotificationGroupTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6A3BC7E2321B7E600FD64D5 /* FollowNotificationGroupTableViewCell.swift */; };
|
||||||
|
@ -278,6 +288,7 @@
|
||||||
D6C99FCB24FADC91005C74D3 /* MainComposeTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C99FCA24FADC91005C74D3 /* MainComposeTextView.swift */; };
|
D6C99FCB24FADC91005C74D3 /* MainComposeTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C99FCA24FADC91005C74D3 /* MainComposeTextView.swift */; };
|
||||||
D6CA6A92249FAD8900AD45C1 /* AudioSessionHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6CA6A91249FAD8900AD45C1 /* AudioSessionHelper.swift */; };
|
D6CA6A92249FAD8900AD45C1 /* AudioSessionHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6CA6A91249FAD8900AD45C1 /* AudioSessionHelper.swift */; };
|
||||||
D6CA6A94249FADE700AD45C1 /* GalleryPlayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6CA6A93249FADE700AD45C1 /* GalleryPlayerViewController.swift */; };
|
D6CA6A94249FADE700AD45C1 /* GalleryPlayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6CA6A93249FADE700AD45C1 /* GalleryPlayerViewController.swift */; };
|
||||||
|
D6CA8CDA2962231F0050C433 /* ArrayUniqueTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6CA8CD92962231F0050C433 /* ArrayUniqueTests.swift */; };
|
||||||
D6D12B2F2925D66500D528E1 /* TimelineGapCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6D12B2E2925D66500D528E1 /* TimelineGapCollectionViewCell.swift */; };
|
D6D12B2F2925D66500D528E1 /* TimelineGapCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6D12B2E2925D66500D528E1 /* TimelineGapCollectionViewCell.swift */; };
|
||||||
D6D12B56292D57E800D528E1 /* AccountCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6D12B55292D57E800D528E1 /* AccountCollectionViewCell.swift */; };
|
D6D12B56292D57E800D528E1 /* AccountCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6D12B55292D57E800D528E1 /* AccountCollectionViewCell.swift */; };
|
||||||
D6D12B58292D5B2C00D528E1 /* StatusActionAccountListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6D12B57292D5B2C00D528E1 /* StatusActionAccountListViewController.swift */; };
|
D6D12B58292D5B2C00D528E1 /* StatusActionAccountListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6D12B57292D5B2C00D528E1 /* StatusActionAccountListViewController.swift */; };
|
||||||
|
@ -424,7 +435,7 @@
|
||||||
D61F759129365C6C00C0B37F /* CollectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionViewController.swift; sourceTree = "<group>"; };
|
D61F759129365C6C00C0B37F /* CollectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionViewController.swift; sourceTree = "<group>"; };
|
||||||
D61F75932936F0DA00C0B37F /* FollowedHashtag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowedHashtag.swift; sourceTree = "<group>"; };
|
D61F75932936F0DA00C0B37F /* FollowedHashtag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowedHashtag.swift; sourceTree = "<group>"; };
|
||||||
D61F75952937037800C0B37F /* ToggleFollowHashtagService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToggleFollowHashtagService.swift; sourceTree = "<group>"; };
|
D61F75952937037800C0B37F /* ToggleFollowHashtagService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToggleFollowHashtagService.swift; sourceTree = "<group>"; };
|
||||||
D61F759829384D4D00C0B37F /* FiltersView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FiltersView.swift; sourceTree = "<group>"; };
|
D61F759829384D4D00C0B37F /* CustomizeTimelinesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomizeTimelinesView.swift; sourceTree = "<group>"; };
|
||||||
D61F759A29384F9C00C0B37F /* FilterMO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterMO.swift; sourceTree = "<group>"; };
|
D61F759A29384F9C00C0B37F /* FilterMO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterMO.swift; sourceTree = "<group>"; };
|
||||||
D61F759C2938574B00C0B37F /* FilterRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterRow.swift; sourceTree = "<group>"; };
|
D61F759C2938574B00C0B37F /* FilterRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterRow.swift; sourceTree = "<group>"; };
|
||||||
D61F759E29385AD800C0B37F /* SemiCaseSensitiveComparator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SemiCaseSensitiveComparator.swift; sourceTree = "<group>"; };
|
D61F759E29385AD800C0B37F /* SemiCaseSensitiveComparator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SemiCaseSensitiveComparator.swift; sourceTree = "<group>"; };
|
||||||
|
@ -489,7 +500,6 @@
|
||||||
D63CC7112911F57C000E19DE /* StatusBarTappableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusBarTappableViewController.swift; sourceTree = "<group>"; };
|
D63CC7112911F57C000E19DE /* StatusBarTappableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusBarTappableViewController.swift; sourceTree = "<group>"; };
|
||||||
D63D8DF32850FE7A008D95E1 /* ViewTags.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewTags.swift; sourceTree = "<group>"; };
|
D63D8DF32850FE7A008D95E1 /* ViewTags.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewTags.swift; sourceTree = "<group>"; };
|
||||||
D63F9C6D241D2D85004C03CF /* CompositionAttachment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompositionAttachment.swift; sourceTree = "<group>"; };
|
D63F9C6D241D2D85004C03CF /* CompositionAttachment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompositionAttachment.swift; sourceTree = "<group>"; };
|
||||||
D6403CC124A6B72D00E81C55 /* VisualEffectImageButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VisualEffectImageButton.swift; sourceTree = "<group>"; };
|
|
||||||
D640D76822BAF5E6004FBE69 /* DomainBlocks.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = DomainBlocks.plist; sourceTree = "<group>"; };
|
D640D76822BAF5E6004FBE69 /* DomainBlocks.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = DomainBlocks.plist; sourceTree = "<group>"; };
|
||||||
D6412B0224AFF6A600F5412E /* TabBarScrollableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarScrollableViewController.swift; sourceTree = "<group>"; };
|
D6412B0224AFF6A600F5412E /* TabBarScrollableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarScrollableViewController.swift; sourceTree = "<group>"; };
|
||||||
D6412B0824B0291E00F5412E /* MyProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyProfileViewController.swift; sourceTree = "<group>"; };
|
D6412B0824B0291E00F5412E /* MyProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyProfileViewController.swift; sourceTree = "<group>"; };
|
||||||
|
@ -515,6 +525,7 @@
|
||||||
D6531DEF246B867E000F9538 /* GifvAttachmentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GifvAttachmentViewController.swift; sourceTree = "<group>"; };
|
D6531DEF246B867E000F9538 /* GifvAttachmentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GifvAttachmentViewController.swift; sourceTree = "<group>"; };
|
||||||
D6538944214D6D7500E3CEFC /* TableViewSwipeActionProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewSwipeActionProvider.swift; sourceTree = "<group>"; };
|
D6538944214D6D7500E3CEFC /* TableViewSwipeActionProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewSwipeActionProvider.swift; sourceTree = "<group>"; };
|
||||||
D653F410267D1E32004E32B1 /* DiffableTimelineLikeTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiffableTimelineLikeTableViewController.swift; sourceTree = "<group>"; };
|
D653F410267D1E32004E32B1 /* DiffableTimelineLikeTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiffableTimelineLikeTableViewController.swift; sourceTree = "<group>"; };
|
||||||
|
D659F36129541065002D944A /* TTTView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TTTView.swift; sourceTree = "<group>"; };
|
||||||
D65C6BF425478A9C00A6E89C /* BackgroundableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundableViewController.swift; sourceTree = "<group>"; };
|
D65C6BF425478A9C00A6E89C /* BackgroundableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundableViewController.swift; sourceTree = "<group>"; };
|
||||||
D65F612D23AE990C00F3CFD3 /* Embassy.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Embassy.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
D65F612D23AE990C00F3CFD3 /* Embassy.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Embassy.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
D65F613023AE99E000F3CFD3 /* Ambassador.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Ambassador.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
D65F613023AE99E000F3CFD3 /* Ambassador.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Ambassador.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
@ -560,6 +571,14 @@
|
||||||
D6895DC128D65274006341DA /* CustomAlertController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomAlertController.swift; sourceTree = "<group>"; };
|
D6895DC128D65274006341DA /* CustomAlertController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomAlertController.swift; sourceTree = "<group>"; };
|
||||||
D6895DC328D65342006341DA /* ConfirmReblogStatusPreviewView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfirmReblogStatusPreviewView.swift; sourceTree = "<group>"; };
|
D6895DC328D65342006341DA /* ConfirmReblogStatusPreviewView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfirmReblogStatusPreviewView.swift; sourceTree = "<group>"; };
|
||||||
D6895DE828D962C2006341DA /* TimelineLikeController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineLikeController.swift; sourceTree = "<group>"; };
|
D6895DE828D962C2006341DA /* TimelineLikeController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineLikeController.swift; sourceTree = "<group>"; };
|
||||||
|
D68A76D929511CA6001DA1B3 /* AccountPreferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountPreferences.swift; sourceTree = "<group>"; };
|
||||||
|
D68A76E229524D2A001DA1B3 /* ListMO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListMO.swift; sourceTree = "<group>"; };
|
||||||
|
D68A76E729527884001DA1B3 /* PinnedTimelinesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinnedTimelinesView.swift; sourceTree = "<group>"; };
|
||||||
|
D68A76E9295285D0001DA1B3 /* AddHashtagPinnedTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddHashtagPinnedTimelineView.swift; sourceTree = "<group>"; };
|
||||||
|
D68A76EB295369A8001DA1B3 /* AboutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutView.swift; sourceTree = "<group>"; };
|
||||||
|
D68A76ED295369C7001DA1B3 /* AcknowledgementsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AcknowledgementsView.swift; sourceTree = "<group>"; };
|
||||||
|
D68A76F029539116001DA1B3 /* FlipView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlipView.swift; sourceTree = "<group>"; };
|
||||||
|
D68A76F22953915C001DA1B3 /* TTTKit */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = TTTKit; path = Packages/TTTKit; sourceTree = "<group>"; };
|
||||||
D68ACE5C279B1ABA001CE8EB /* AssetPickerControlCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssetPickerControlCollectionViewCell.swift; sourceTree = "<group>"; };
|
D68ACE5C279B1ABA001CE8EB /* AssetPickerControlCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssetPickerControlCollectionViewCell.swift; sourceTree = "<group>"; };
|
||||||
D68C2AE225869BAB00548EFF /* AuxiliarySceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuxiliarySceneDelegate.swift; sourceTree = "<group>"; };
|
D68C2AE225869BAB00548EFF /* AuxiliarySceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuxiliarySceneDelegate.swift; sourceTree = "<group>"; };
|
||||||
D68E525A24A3D77E0054355A /* TuskerRootViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TuskerRootViewController.swift; sourceTree = "<group>"; };
|
D68E525A24A3D77E0054355A /* TuskerRootViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TuskerRootViewController.swift; sourceTree = "<group>"; };
|
||||||
|
@ -584,6 +603,8 @@
|
||||||
D6969E9D240C81B9002843CE /* NSTextAttachment+Emoji.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSTextAttachment+Emoji.swift"; sourceTree = "<group>"; };
|
D6969E9D240C81B9002843CE /* NSTextAttachment+Emoji.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSTextAttachment+Emoji.swift"; sourceTree = "<group>"; };
|
||||||
D6969E9F240C8384002843CE /* EmojiLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiLabel.swift; sourceTree = "<group>"; };
|
D6969E9F240C8384002843CE /* EmojiLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiLabel.swift; sourceTree = "<group>"; };
|
||||||
D6A00B1C26379FC900316AD4 /* PollOptionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PollOptionsView.swift; sourceTree = "<group>"; };
|
D6A00B1C26379FC900316AD4 /* PollOptionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PollOptionsView.swift; sourceTree = "<group>"; };
|
||||||
|
D6A3A37F295515550036B6EF /* ProfileHeaderButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileHeaderButton.swift; sourceTree = "<group>"; };
|
||||||
|
D6A3A3812956123A0036B6EF /* TimelinePosition.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelinePosition.swift; sourceTree = "<group>"; };
|
||||||
D6A3BC7A232195C600FD64D5 /* ActionNotificationGroupTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionNotificationGroupTableViewCell.swift; sourceTree = "<group>"; };
|
D6A3BC7A232195C600FD64D5 /* ActionNotificationGroupTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionNotificationGroupTableViewCell.swift; sourceTree = "<group>"; };
|
||||||
D6A3BC7B232195C600FD64D5 /* ActionNotificationGroupTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ActionNotificationGroupTableViewCell.xib; sourceTree = "<group>"; };
|
D6A3BC7B232195C600FD64D5 /* ActionNotificationGroupTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ActionNotificationGroupTableViewCell.xib; sourceTree = "<group>"; };
|
||||||
D6A3BC7E2321B7E600FD64D5 /* FollowNotificationGroupTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowNotificationGroupTableViewCell.swift; sourceTree = "<group>"; };
|
D6A3BC7E2321B7E600FD64D5 /* FollowNotificationGroupTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowNotificationGroupTableViewCell.swift; sourceTree = "<group>"; };
|
||||||
|
@ -652,6 +673,7 @@
|
||||||
D6C99FCA24FADC91005C74D3 /* MainComposeTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainComposeTextView.swift; sourceTree = "<group>"; };
|
D6C99FCA24FADC91005C74D3 /* MainComposeTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainComposeTextView.swift; sourceTree = "<group>"; };
|
||||||
D6CA6A91249FAD8900AD45C1 /* AudioSessionHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioSessionHelper.swift; sourceTree = "<group>"; };
|
D6CA6A91249FAD8900AD45C1 /* AudioSessionHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioSessionHelper.swift; sourceTree = "<group>"; };
|
||||||
D6CA6A93249FADE700AD45C1 /* GalleryPlayerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GalleryPlayerViewController.swift; sourceTree = "<group>"; };
|
D6CA6A93249FADE700AD45C1 /* GalleryPlayerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GalleryPlayerViewController.swift; sourceTree = "<group>"; };
|
||||||
|
D6CA8CD92962231F0050C433 /* ArrayUniqueTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayUniqueTests.swift; sourceTree = "<group>"; };
|
||||||
D6D12B2E2925D66500D528E1 /* TimelineGapCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineGapCollectionViewCell.swift; sourceTree = "<group>"; };
|
D6D12B2E2925D66500D528E1 /* TimelineGapCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineGapCollectionViewCell.swift; sourceTree = "<group>"; };
|
||||||
D6D12B55292D57E800D528E1 /* AccountCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountCollectionViewCell.swift; sourceTree = "<group>"; };
|
D6D12B55292D57E800D528E1 /* AccountCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountCollectionViewCell.swift; sourceTree = "<group>"; };
|
||||||
D6D12B57292D5B2C00D528E1 /* StatusActionAccountListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusActionAccountListViewController.swift; sourceTree = "<group>"; };
|
D6D12B57292D5B2C00D528E1 /* StatusActionAccountListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusActionAccountListViewController.swift; sourceTree = "<group>"; };
|
||||||
|
@ -722,6 +744,7 @@
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
D674A50927F9128D00BA03AC /* Pachyderm in Frameworks */,
|
D674A50927F9128D00BA03AC /* Pachyderm in Frameworks */,
|
||||||
|
D659F35E2953A212002D944A /* TTTKit in Frameworks */,
|
||||||
D60CFFDB24A290BA00D00083 /* SwiftSoup in Frameworks */,
|
D60CFFDB24A290BA00D00083 /* SwiftSoup in Frameworks */,
|
||||||
D6552367289870790048A653 /* ScreenCorners in Frameworks */,
|
D6552367289870790048A653 /* ScreenCorners in Frameworks */,
|
||||||
D6676CA527A8D0020052936B /* WebURLFoundationExtras in Frameworks */,
|
D6676CA527A8D0020052936B /* WebURLFoundationExtras in Frameworks */,
|
||||||
|
@ -798,14 +821,16 @@
|
||||||
path = "Instance Cell";
|
path = "Instance Cell";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
D61F759729384D4200C0B37F /* Filters */ = {
|
D61F759729384D4200C0B37F /* Customize Timelines */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
D61F759829384D4D00C0B37F /* FiltersView.swift */,
|
D61F759829384D4D00C0B37F /* CustomizeTimelinesView.swift */,
|
||||||
D61F759C2938574B00C0B37F /* FilterRow.swift */,
|
D61F759C2938574B00C0B37F /* FilterRow.swift */,
|
||||||
D61F75A4293ABD6F00C0B37F /* EditFilterView.swift */,
|
D61F75A4293ABD6F00C0B37F /* EditFilterView.swift */,
|
||||||
|
D68A76E729527884001DA1B3 /* PinnedTimelinesView.swift */,
|
||||||
|
D68A76E9295285D0001DA1B3 /* AddHashtagPinnedTimelineView.swift */,
|
||||||
);
|
);
|
||||||
path = Filters;
|
path = "Customize Timelines";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
D623A53B2635F4E20095BD04 /* Poll */ = {
|
D623A53B2635F4E20095BD04 /* Poll */ = {
|
||||||
|
@ -895,6 +920,9 @@
|
||||||
D61F759A29384F9C00C0B37F /* FilterMO.swift */,
|
D61F759A29384F9C00C0B37F /* FilterMO.swift */,
|
||||||
D61F75AA293AF11400C0B37F /* FilterKeywordMO.swift */,
|
D61F75AA293AF11400C0B37F /* FilterKeywordMO.swift */,
|
||||||
D6D706A62948D4D0000827ED /* TimlineState.swift */,
|
D6D706A62948D4D0000827ED /* TimlineState.swift */,
|
||||||
|
D6A3A3812956123A0036B6EF /* TimelinePosition.swift */,
|
||||||
|
D68A76E229524D2A001DA1B3 /* ListMO.swift */,
|
||||||
|
D68A76D929511CA6001DA1B3 /* AccountPreferences.swift */,
|
||||||
D60E2F2D244248BF005F8713 /* MastodonCachePersistentStore.swift */,
|
D60E2F2D244248BF005F8713 /* MastodonCachePersistentStore.swift */,
|
||||||
D6B936702829F72900237D0E /* NSManagedObjectContext+Helpers.swift */,
|
D6B936702829F72900237D0E /* NSManagedObjectContext+Helpers.swift */,
|
||||||
);
|
);
|
||||||
|
@ -924,7 +952,7 @@
|
||||||
D6F2E960249E772F005846BB /* Crash Reporter */,
|
D6F2E960249E772F005846BB /* Crash Reporter */,
|
||||||
D627943C23A5635D00D38C68 /* Explore */,
|
D627943C23A5635D00D38C68 /* Explore */,
|
||||||
D6A4DCC92553666600D9DE31 /* Fast Account Switcher */,
|
D6A4DCC92553666600D9DE31 /* Fast Account Switcher */,
|
||||||
D61F759729384D4200C0B37F /* Filters */,
|
D61F759729384D4200C0B37F /* Customize Timelines */,
|
||||||
D641C788213DD86D004B4513 /* Large Image */,
|
D641C788213DD86D004B4513 /* Large Image */,
|
||||||
D627944B23A9A02400D38C68 /* Lists */,
|
D627944B23A9A02400D38C68 /* Lists */,
|
||||||
D641C782213DD7F0004B4513 /* Main */,
|
D641C782213DD7F0004B4513 /* Main */,
|
||||||
|
@ -1060,6 +1088,8 @@
|
||||||
D6BC9DB2232D4C07002CA326 /* WellnessPrefsView.swift */,
|
D6BC9DB2232D4C07002CA326 /* WellnessPrefsView.swift */,
|
||||||
0427033922B31269000D31B6 /* AdvancedPrefsView.swift */,
|
0427033922B31269000D31B6 /* AdvancedPrefsView.swift */,
|
||||||
D67895BF246870DE00D4CD9E /* LocalAccountAvatarView.swift */,
|
D67895BF246870DE00D4CD9E /* LocalAccountAvatarView.swift */,
|
||||||
|
D68A76ED295369C7001DA1B3 /* AcknowledgementsView.swift */,
|
||||||
|
D68A76EF2953910A001DA1B3 /* About */,
|
||||||
);
|
);
|
||||||
path = Preferences;
|
path = Preferences;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -1088,6 +1118,7 @@
|
||||||
D6412B0A24B0D4C600F5412E /* ProfileHeaderView.xib */,
|
D6412B0A24B0D4C600F5412E /* ProfileHeaderView.xib */,
|
||||||
D6412B0C24B0D4CF00F5412E /* ProfileHeaderView.swift */,
|
D6412B0C24B0D4CF00F5412E /* ProfileHeaderView.swift */,
|
||||||
D651C5B32915B00400236EF6 /* ProfileFieldsView.swift */,
|
D651C5B32915B00400236EF6 /* ProfileFieldsView.swift */,
|
||||||
|
D6A3A37F295515550036B6EF /* ProfileHeaderButton.swift */,
|
||||||
);
|
);
|
||||||
path = "Profile Header";
|
path = "Profile Header";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -1198,6 +1229,16 @@
|
||||||
path = "Account Detail";
|
path = "Account Detail";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
D68A76EF2953910A001DA1B3 /* About */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
D68A76EB295369A8001DA1B3 /* AboutView.swift */,
|
||||||
|
D68A76F029539116001DA1B3 /* FlipView.swift */,
|
||||||
|
D659F36129541065002D944A /* TTTView.swift */,
|
||||||
|
);
|
||||||
|
path = About;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
D6A3BC822321F69400FD64D5 /* Account List */ = {
|
D6A3BC822321F69400FD64D5 /* Account List */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
@ -1310,7 +1351,6 @@
|
||||||
D620483723D38190008A63EF /* StatusContentTextView.swift */,
|
D620483723D38190008A63EF /* StatusContentTextView.swift */,
|
||||||
04ED00B021481ED800567C53 /* SteppedProgressView.swift */,
|
04ED00B021481ED800567C53 /* SteppedProgressView.swift */,
|
||||||
D6093FB625BE0CF3004811E6 /* TrendHistoryView.swift */,
|
D6093FB625BE0CF3004811E6 /* TrendHistoryView.swift */,
|
||||||
D6403CC124A6B72D00E81C55 /* VisualEffectImageButton.swift */,
|
|
||||||
D686BBE224FBF8110068E6AA /* WrappedProgressView.swift */,
|
D686BBE224FBF8110068E6AA /* WrappedProgressView.swift */,
|
||||||
D627944623A6AC9300D38C68 /* BasicTableViewCell.xib */,
|
D627944623A6AC9300D38C68 /* BasicTableViewCell.xib */,
|
||||||
D6A3BC872321F78000FD64D5 /* Account Cell */,
|
D6A3BC872321F78000FD64D5 /* Account Cell */,
|
||||||
|
@ -1374,6 +1414,7 @@
|
||||||
D6D706A829498C82000827ED /* Tusker.xcconfig */,
|
D6D706A829498C82000827ED /* Tusker.xcconfig */,
|
||||||
D674A50727F910F300BA03AC /* Pachyderm */,
|
D674A50727F910F300BA03AC /* Pachyderm */,
|
||||||
D6BEA243291A0C83002F4D01 /* Duckable */,
|
D6BEA243291A0C83002F4D01 /* Duckable */,
|
||||||
|
D68A76F22953915C001DA1B3 /* TTTKit */,
|
||||||
D6D4DDCE212518A000E1C4BB /* Tusker */,
|
D6D4DDCE212518A000E1C4BB /* Tusker */,
|
||||||
D6D4DDE3212518A200E1C4BB /* TuskerTests */,
|
D6D4DDE3212518A200E1C4BB /* TuskerTests */,
|
||||||
D6D4DDEE212518A200E1C4BB /* TuskerUITests */,
|
D6D4DDEE212518A200E1C4BB /* TuskerUITests */,
|
||||||
|
@ -1446,6 +1487,7 @@
|
||||||
D6E426AC25334DA500C02E1C /* FuzzyMatcherTests.swift */,
|
D6E426AC25334DA500C02E1C /* FuzzyMatcherTests.swift */,
|
||||||
D6114E1627F8BB210080E273 /* VersionTests.swift */,
|
D6114E1627F8BB210080E273 /* VersionTests.swift */,
|
||||||
D61F75A029396DE200C0B37F /* SemiCaseSensitiveComparatorTests.swift */,
|
D61F75A029396DE200C0B37F /* SemiCaseSensitiveComparatorTests.swift */,
|
||||||
|
D6CA8CD92962231F0050C433 /* ArrayUniqueTests.swift */,
|
||||||
D6D4DDE6212518A200E1C4BB /* Info.plist */,
|
D6D4DDE6212518A200E1C4BB /* Info.plist */,
|
||||||
);
|
);
|
||||||
path = TuskerTests;
|
path = TuskerTests;
|
||||||
|
@ -1570,6 +1612,7 @@
|
||||||
D6552366289870790048A653 /* ScreenCorners */,
|
D6552366289870790048A653 /* ScreenCorners */,
|
||||||
D63CC701290EC0B8000E19DE /* Sentry */,
|
D63CC701290EC0B8000E19DE /* Sentry */,
|
||||||
D6BEA244291A0EDE002F4D01 /* Duckable */,
|
D6BEA244291A0EDE002F4D01 /* Duckable */,
|
||||||
|
D659F35D2953A212002D944A /* TTTKit */,
|
||||||
);
|
);
|
||||||
productName = Tusker;
|
productName = Tusker;
|
||||||
productReference = D6D4DDCC212518A000E1C4BB /* Tusker.app */;
|
productReference = D6D4DDCC212518A000E1C4BB /* Tusker.app */;
|
||||||
|
@ -1871,6 +1914,7 @@
|
||||||
D62D2422217AA7E1005076CC /* UserActivityManager.swift in Sources */,
|
D62D2422217AA7E1005076CC /* UserActivityManager.swift in Sources */,
|
||||||
D6CA6A92249FAD8900AD45C1 /* AudioSessionHelper.swift in Sources */,
|
D6CA6A92249FAD8900AD45C1 /* AudioSessionHelper.swift in Sources */,
|
||||||
D60D2B8223844C71001B87A3 /* BaseStatusTableViewCell.swift in Sources */,
|
D60D2B8223844C71001B87A3 /* BaseStatusTableViewCell.swift in Sources */,
|
||||||
|
D68A76E329524D2A001DA1B3 /* ListMO.swift in Sources */,
|
||||||
D63CC70C2910AADB000E19DE /* TuskerSceneDelegate.swift in Sources */,
|
D63CC70C2910AADB000E19DE /* TuskerSceneDelegate.swift in Sources */,
|
||||||
D61F759D2938574B00C0B37F /* FilterRow.swift in Sources */,
|
D61F759D2938574B00C0B37F /* FilterRow.swift in Sources */,
|
||||||
D6B9366F2828452F00237D0E /* SavedHashtag.swift in Sources */,
|
D6B9366F2828452F00237D0E /* SavedHashtag.swift in Sources */,
|
||||||
|
@ -1895,11 +1939,11 @@
|
||||||
D6B053A623BD2D0C00A066FA /* AssetCollectionViewController.swift in Sources */,
|
D6B053A623BD2D0C00A066FA /* AssetCollectionViewController.swift in Sources */,
|
||||||
D61A45E828DF477D002BE511 /* LoadingCollectionViewCell.swift in Sources */,
|
D61A45E828DF477D002BE511 /* LoadingCollectionViewCell.swift in Sources */,
|
||||||
D67B506D250B291200FAECFB /* BlurHashDecode.swift in Sources */,
|
D67B506D250B291200FAECFB /* BlurHashDecode.swift in Sources */,
|
||||||
|
D68A76EC295369A8001DA1B3 /* AboutView.swift in Sources */,
|
||||||
D62275A024F1677200B82A16 /* ComposeHostingController.swift in Sources */,
|
D62275A024F1677200B82A16 /* ComposeHostingController.swift in Sources */,
|
||||||
04DACE8E212CC7CC009840C4 /* ImageCache.swift in Sources */,
|
04DACE8E212CC7CC009840C4 /* ImageCache.swift in Sources */,
|
||||||
D6BEA249291C6118002F4D01 /* DraftsView.swift in Sources */,
|
D6BEA249291C6118002F4D01 /* DraftsView.swift in Sources */,
|
||||||
D61F75AD293AF39000C0B37F /* Filter+Helpers.swift in Sources */,
|
D61F75AD293AF39000C0B37F /* Filter+Helpers.swift in Sources */,
|
||||||
D6403CC224A6B72D00E81C55 /* VisualEffectImageButton.swift in Sources */,
|
|
||||||
D6531DEE246B81C9000F9538 /* GifvAttachmentView.swift in Sources */,
|
D6531DEE246B81C9000F9538 /* GifvAttachmentView.swift in Sources */,
|
||||||
D673ACCE2919E74200D6F8B0 /* MenuPicker.swift in Sources */,
|
D673ACCE2919E74200D6F8B0 /* MenuPicker.swift in Sources */,
|
||||||
D6370B9C24421FF30092A7FF /* Tusker.xcdatamodeld in Sources */,
|
D6370B9C24421FF30092A7FF /* Tusker.xcdatamodeld in Sources */,
|
||||||
|
@ -1931,6 +1975,7 @@
|
||||||
D6B053A223BD2C0600A066FA /* AssetPickerViewController.swift in Sources */,
|
D6B053A223BD2C0600A066FA /* AssetPickerViewController.swift in Sources */,
|
||||||
D6EE63FB2551F7F60065485C /* StatusCollapseButton.swift in Sources */,
|
D6EE63FB2551F7F60065485C /* StatusCollapseButton.swift in Sources */,
|
||||||
D6B936712829F72900237D0E /* NSManagedObjectContext+Helpers.swift in Sources */,
|
D6B936712829F72900237D0E /* NSManagedObjectContext+Helpers.swift in Sources */,
|
||||||
|
D68A76EE295369C7001DA1B3 /* AcknowledgementsView.swift in Sources */,
|
||||||
D627944A23A6AD6100D38C68 /* BookmarksTableViewController.swift in Sources */,
|
D627944A23A6AD6100D38C68 /* BookmarksTableViewController.swift in Sources */,
|
||||||
D63CC7102911F1E4000E19DE /* UIScrollView+Top.swift in Sources */,
|
D63CC7102911F1E4000E19DE /* UIScrollView+Top.swift in Sources */,
|
||||||
D6F6A557291F4F1600F496A8 /* MuteAccountView.swift in Sources */,
|
D6F6A557291F4F1600F496A8 /* MuteAccountView.swift in Sources */,
|
||||||
|
@ -1945,11 +1990,13 @@
|
||||||
D61F75B7293C119700C0B37F /* Filterer.swift in Sources */,
|
D61F75B7293C119700C0B37F /* Filterer.swift in Sources */,
|
||||||
D64AAE9526C88C5000FC57FB /* ToastableViewController.swift in Sources */,
|
D64AAE9526C88C5000FC57FB /* ToastableViewController.swift in Sources */,
|
||||||
D6895DE928D962C2006341DA /* TimelineLikeController.swift in Sources */,
|
D6895DE928D962C2006341DA /* TimelineLikeController.swift in Sources */,
|
||||||
|
D6A3A3822956123A0036B6EF /* TimelinePosition.swift in Sources */,
|
||||||
D6E0DC8E216EDF1E00369478 /* Previewing.swift in Sources */,
|
D6E0DC8E216EDF1E00369478 /* Previewing.swift in Sources */,
|
||||||
D6B93667281D937300237D0E /* MainSidebarMyProfileCollectionViewCell.swift in Sources */,
|
D6B93667281D937300237D0E /* MainSidebarMyProfileCollectionViewCell.swift in Sources */,
|
||||||
D61F75BD293D099600C0B37F /* Lazy.swift in Sources */,
|
D61F75BD293D099600C0B37F /* Lazy.swift in Sources */,
|
||||||
D6BED174212667E900F02DA0 /* TimelineStatusTableViewCell.swift in Sources */,
|
D6BED174212667E900F02DA0 /* TimelineStatusTableViewCell.swift in Sources */,
|
||||||
D69693F42585941A00F4E116 /* UIWindowSceneDelegate+Close.swift in Sources */,
|
D69693F42585941A00F4E116 /* UIWindowSceneDelegate+Close.swift in Sources */,
|
||||||
|
D659F36229541065002D944A /* TTTView.swift in Sources */,
|
||||||
D6C143DA253510F4007DC240 /* ComposeEmojiTextField.swift in Sources */,
|
D6C143DA253510F4007DC240 /* ComposeEmojiTextField.swift in Sources */,
|
||||||
D6DD2A3F273C1F4900386A6C /* ComposeAttachmentImage.swift in Sources */,
|
D6DD2A3F273C1F4900386A6C /* ComposeAttachmentImage.swift in Sources */,
|
||||||
D6DD2A45273D6C5700386A6C /* GIFImageView.swift in Sources */,
|
D6DD2A45273D6C5700386A6C /* GIFImageView.swift in Sources */,
|
||||||
|
@ -1979,6 +2026,7 @@
|
||||||
D686BBE324FBF8110068E6AA /* WrappedProgressView.swift in Sources */,
|
D686BBE324FBF8110068E6AA /* WrappedProgressView.swift in Sources */,
|
||||||
D620483423D3801D008A63EF /* LinkTextView.swift in Sources */,
|
D620483423D3801D008A63EF /* LinkTextView.swift in Sources */,
|
||||||
D61F75882932DB6000C0B37F /* StatusSwipeAction.swift in Sources */,
|
D61F75882932DB6000C0B37F /* StatusSwipeAction.swift in Sources */,
|
||||||
|
D68A76EA295285D0001DA1B3 /* AddHashtagPinnedTimelineView.swift in Sources */,
|
||||||
D6D12B58292D5B2C00D528E1 /* StatusActionAccountListViewController.swift in Sources */,
|
D6D12B58292D5B2C00D528E1 /* StatusActionAccountListViewController.swift in Sources */,
|
||||||
D6412B0D24B0D4CF00F5412E /* ProfileHeaderView.swift in Sources */,
|
D6412B0D24B0D4CF00F5412E /* ProfileHeaderView.swift in Sources */,
|
||||||
D641C77F213DC78A004B4513 /* InlineTextAttachment.swift in Sources */,
|
D641C77F213DC78A004B4513 /* InlineTextAttachment.swift in Sources */,
|
||||||
|
@ -2006,7 +2054,7 @@
|
||||||
D64D0AB12128D9AE005A6F37 /* OnboardingViewController.swift in Sources */,
|
D64D0AB12128D9AE005A6F37 /* OnboardingViewController.swift in Sources */,
|
||||||
D67C1795266D57D10070F250 /* FastAccountSwitcherIndicatorView.swift in Sources */,
|
D67C1795266D57D10070F250 /* FastAccountSwitcherIndicatorView.swift in Sources */,
|
||||||
D61F75962937037800C0B37F /* ToggleFollowHashtagService.swift in Sources */,
|
D61F75962937037800C0B37F /* ToggleFollowHashtagService.swift in Sources */,
|
||||||
D61F759929384D4D00C0B37F /* FiltersView.swift in Sources */,
|
D61F759929384D4D00C0B37F /* CustomizeTimelinesView.swift in Sources */,
|
||||||
D61F759F29385AD800C0B37F /* SemiCaseSensitiveComparator.swift in Sources */,
|
D61F759F29385AD800C0B37F /* SemiCaseSensitiveComparator.swift in Sources */,
|
||||||
D627FF76217E923E00CC0648 /* DraftsManager.swift in Sources */,
|
D627FF76217E923E00CC0648 /* DraftsManager.swift in Sources */,
|
||||||
04586B4322B301470021BD04 /* AppearancePrefsView.swift in Sources */,
|
04586B4322B301470021BD04 /* AppearancePrefsView.swift in Sources */,
|
||||||
|
@ -2017,6 +2065,7 @@
|
||||||
D65234E12561AA68001AF9CF /* NotificationsTableViewController.swift in Sources */,
|
D65234E12561AA68001AF9CF /* NotificationsTableViewController.swift in Sources */,
|
||||||
D6A6C11525B62E9700298D0F /* CacheExpiry.swift in Sources */,
|
D6A6C11525B62E9700298D0F /* CacheExpiry.swift in Sources */,
|
||||||
D67C57AF21E28EAD00C3118B /* Array+Uniques.swift in Sources */,
|
D67C57AF21E28EAD00C3118B /* Array+Uniques.swift in Sources */,
|
||||||
|
D68A76F129539116001DA1B3 /* FlipView.swift in Sources */,
|
||||||
D6945C3223AC4D36005C403C /* HashtagTimelineViewController.swift in Sources */,
|
D6945C3223AC4D36005C403C /* HashtagTimelineViewController.swift in Sources */,
|
||||||
D647D92824257BEB0005044F /* AttachmentPreviewViewController.swift in Sources */,
|
D647D92824257BEB0005044F /* AttachmentPreviewViewController.swift in Sources */,
|
||||||
D61F75B5293BD97400C0B37F /* DeleteFilterService.swift in Sources */,
|
D61F75B5293BD97400C0B37F /* DeleteFilterService.swift in Sources */,
|
||||||
|
@ -2040,6 +2089,7 @@
|
||||||
D6620ACE2511A0ED00312CA0 /* StatusStateResolver.swift in Sources */,
|
D6620ACE2511A0ED00312CA0 /* StatusStateResolver.swift in Sources */,
|
||||||
D6B9366B281EE77E00237D0E /* PollVoteButton.swift in Sources */,
|
D6B9366B281EE77E00237D0E /* PollVoteButton.swift in Sources */,
|
||||||
D6BC9DB5232D4CE3002CA326 /* NotificationsMode.swift in Sources */,
|
D6BC9DB5232D4CE3002CA326 /* NotificationsMode.swift in Sources */,
|
||||||
|
D68A76DA29511CA6001DA1B3 /* AccountPreferences.swift in Sources */,
|
||||||
D68015402401A6BA00D6103B /* ComposingPrefsView.swift in Sources */,
|
D68015402401A6BA00D6103B /* ComposingPrefsView.swift in Sources */,
|
||||||
D6895DC428D65342006341DA /* ConfirmReblogStatusPreviewView.swift in Sources */,
|
D6895DC428D65342006341DA /* ConfirmReblogStatusPreviewView.swift in Sources */,
|
||||||
D67895BC24671E6D00D4CD9E /* PKDrawing+Render.swift in Sources */,
|
D67895BC24671E6D00D4CD9E /* PKDrawing+Render.swift in Sources */,
|
||||||
|
@ -2072,7 +2122,9 @@
|
||||||
D6A6C10525B6138A00298D0F /* StatusTablePrefetching.swift in Sources */,
|
D6A6C10525B6138A00298D0F /* StatusTablePrefetching.swift in Sources */,
|
||||||
D6C82B4125C5BB7E0017F1E6 /* ExploreViewController.swift in Sources */,
|
D6C82B4125C5BB7E0017F1E6 /* ExploreViewController.swift in Sources */,
|
||||||
D6B053A423BD2C8100A066FA /* AssetCollectionsListViewController.swift in Sources */,
|
D6B053A423BD2C8100A066FA /* AssetCollectionsListViewController.swift in Sources */,
|
||||||
|
D6A3A380295515550036B6EF /* ProfileHeaderButton.swift in Sources */,
|
||||||
D623A543263634100095BD04 /* PollOptionCheckboxView.swift in Sources */,
|
D623A543263634100095BD04 /* PollOptionCheckboxView.swift in Sources */,
|
||||||
|
D68A76E829527884001DA1B3 /* PinnedTimelinesView.swift in Sources */,
|
||||||
D690797324A4EF9700023A34 /* UIBezierPath+Helpers.swift in Sources */,
|
D690797324A4EF9700023A34 /* UIBezierPath+Helpers.swift in Sources */,
|
||||||
D6D12B5A292D684600D528E1 /* AccountListViewController.swift in Sources */,
|
D6D12B5A292D684600D528E1 /* AccountListViewController.swift in Sources */,
|
||||||
D693DE5723FE1A6A0061E07D /* EnhancedNavigationViewController.swift in Sources */,
|
D693DE5723FE1A6A0061E07D /* EnhancedNavigationViewController.swift in Sources */,
|
||||||
|
@ -2087,6 +2139,7 @@
|
||||||
D62FF04823D7CDD700909D6E /* AttributedStringHelperTests.swift in Sources */,
|
D62FF04823D7CDD700909D6E /* AttributedStringHelperTests.swift in Sources */,
|
||||||
D6E426AD25334DA500C02E1C /* FuzzyMatcherTests.swift in Sources */,
|
D6E426AD25334DA500C02E1C /* FuzzyMatcherTests.swift in Sources */,
|
||||||
D6114E1727F8BB210080E273 /* VersionTests.swift in Sources */,
|
D6114E1727F8BB210080E273 /* VersionTests.swift in Sources */,
|
||||||
|
D6CA8CDA2962231F0050C433 /* ArrayUniqueTests.swift in Sources */,
|
||||||
D6D4DDE5212518A200E1C4BB /* TuskerTests.swift in Sources */,
|
D6D4DDE5212518A200E1C4BB /* TuskerTests.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
@ -2229,7 +2282,7 @@
|
||||||
CODE_SIGN_ENTITLEMENTS = Tusker/Tusker.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Tusker/Tusker.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 53;
|
CURRENT_PROJECT_VERSION = 59;
|
||||||
INFOPLIST_FILE = Tusker/Info.plist;
|
INFOPLIST_FILE = Tusker/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
@ -2296,7 +2349,7 @@
|
||||||
CODE_SIGN_ENTITLEMENTS = OpenInTusker/OpenInTusker.entitlements;
|
CODE_SIGN_ENTITLEMENTS = OpenInTusker/OpenInTusker.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 53;
|
CURRENT_PROJECT_VERSION = 59;
|
||||||
INFOPLIST_FILE = OpenInTusker/Info.plist;
|
INFOPLIST_FILE = OpenInTusker/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
|
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
|
||||||
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.3;
|
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.3;
|
||||||
|
@ -2447,7 +2500,7 @@
|
||||||
CODE_SIGN_ENTITLEMENTS = Tusker/Tusker.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Tusker/Tusker.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 53;
|
CURRENT_PROJECT_VERSION = 59;
|
||||||
INFOPLIST_FILE = Tusker/Info.plist;
|
INFOPLIST_FILE = Tusker/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
@ -2475,7 +2528,7 @@
|
||||||
CODE_SIGN_ENTITLEMENTS = Tusker/Tusker.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Tusker/Tusker.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 53;
|
CURRENT_PROJECT_VERSION = 59;
|
||||||
INFOPLIST_FILE = Tusker/Info.plist;
|
INFOPLIST_FILE = Tusker/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
@ -2584,7 +2637,7 @@
|
||||||
CODE_SIGN_ENTITLEMENTS = OpenInTusker/OpenInTusker.entitlements;
|
CODE_SIGN_ENTITLEMENTS = OpenInTusker/OpenInTusker.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 53;
|
CURRENT_PROJECT_VERSION = 59;
|
||||||
INFOPLIST_FILE = OpenInTusker/Info.plist;
|
INFOPLIST_FILE = OpenInTusker/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
|
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
|
||||||
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.3;
|
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.3;
|
||||||
|
@ -2610,7 +2663,7 @@
|
||||||
CODE_SIGN_ENTITLEMENTS = OpenInTusker/OpenInTusker.entitlements;
|
CODE_SIGN_ENTITLEMENTS = OpenInTusker/OpenInTusker.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 53;
|
CURRENT_PROJECT_VERSION = 59;
|
||||||
INFOPLIST_FILE = OpenInTusker/Info.plist;
|
INFOPLIST_FILE = OpenInTusker/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
|
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
|
||||||
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.3;
|
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.3;
|
||||||
|
@ -2739,6 +2792,10 @@
|
||||||
package = D6552365289870790048A653 /* XCRemoteSwiftPackageReference "ScreenCorners" */;
|
package = D6552365289870790048A653 /* XCRemoteSwiftPackageReference "ScreenCorners" */;
|
||||||
productName = ScreenCorners;
|
productName = ScreenCorners;
|
||||||
};
|
};
|
||||||
|
D659F35D2953A212002D944A /* TTTKit */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
productName = TTTKit;
|
||||||
|
};
|
||||||
D6676CA427A8D0020052936B /* WebURLFoundationExtras */ = {
|
D6676CA427A8D0020052936B /* WebURLFoundationExtras */ = {
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
package = D6676CA127A8D0020052936B /* XCRemoteSwiftPackageReference "swift-url" */;
|
package = D6676CA127A8D0020052936B /* XCRemoteSwiftPackageReference "swift-url" */;
|
||||||
|
|
|
@ -93,6 +93,10 @@ struct InstanceFeatures {
|
||||||
hasMastodonVersion(4, 0, 0)
|
hasMastodonVersion(4, 0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var notificationsAllowedTypes: Bool {
|
||||||
|
hasMastodonVersion(3, 5, 0)
|
||||||
|
}
|
||||||
|
|
||||||
mutating func update(instance: Instance, nodeInfo: NodeInfo?) {
|
mutating func update(instance: Instance, nodeInfo: NodeInfo?) {
|
||||||
let ver = instance.version.lowercased()
|
let ver = instance.version.lowercased()
|
||||||
if ver.contains("glitch") {
|
if ver.contains("glitch") {
|
||||||
|
|
|
@ -40,6 +40,7 @@ class MastodonController: ObservableObject {
|
||||||
|
|
||||||
let instanceURL: URL
|
let instanceURL: URL
|
||||||
var accountInfo: LocalData.UserAccountInfo?
|
var accountInfo: LocalData.UserAccountInfo?
|
||||||
|
var accountPreferences: AccountPreferences!
|
||||||
|
|
||||||
let client: Client!
|
let client: Client!
|
||||||
|
|
||||||
|
@ -154,6 +155,15 @@ class MastodonController: ObservableObject {
|
||||||
// are available when Filterers are constructed
|
// are available when Filterers are constructed
|
||||||
loadCachedFilters()
|
loadCachedFilters()
|
||||||
|
|
||||||
|
loadAccountPreferences()
|
||||||
|
|
||||||
|
NotificationCenter.default.publisher(for: .NSPersistentStoreRemoteChange, object: persistentContainer.persistentStoreCoordinator)
|
||||||
|
.receive(on: DispatchQueue.main)
|
||||||
|
.sink { [unowned self] _ in
|
||||||
|
self.loadAccountPreferences()
|
||||||
|
}
|
||||||
|
.store(in: &cancellables)
|
||||||
|
|
||||||
Task {
|
Task {
|
||||||
do {
|
do {
|
||||||
async let ownAccount = try getOwnAccount()
|
async let ownAccount = try getOwnAccount()
|
||||||
|
@ -169,6 +179,16 @@ class MastodonController: ObservableObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
private func loadAccountPreferences() {
|
||||||
|
if let existing = try? persistentContainer.viewContext.fetch(AccountPreferences.fetchRequest(account: accountInfo!)).first {
|
||||||
|
accountPreferences = existing
|
||||||
|
} else {
|
||||||
|
accountPreferences = AccountPreferences.default(account: accountInfo!, context: persistentContainer.viewContext)
|
||||||
|
persistentContainer.save(context: persistentContainer.viewContext)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func getOwnAccount(completion: ((Result<Account, Client.Error>) -> Void)? = nil) {
|
func getOwnAccount(completion: ((Result<Account, Client.Error>) -> Void)? = nil) {
|
||||||
if account != nil {
|
if account != nil {
|
||||||
completion?(.success(account))
|
completion?(.success(account))
|
||||||
|
@ -317,6 +337,17 @@ class MastodonController: ObservableObject {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.lists = lists.sorted(using: SemiCaseSensitiveComparator.keyPath(\.title))
|
self.lists = lists.sorted(using: SemiCaseSensitiveComparator.keyPath(\.title))
|
||||||
}
|
}
|
||||||
|
let context = self.persistentContainer.backgroundContext
|
||||||
|
context.perform {
|
||||||
|
for list in lists {
|
||||||
|
if let existing = try? context.fetch(ListMO.fetchRequest(id: list.id)).first {
|
||||||
|
existing.updateFrom(apiList: list)
|
||||||
|
} else {
|
||||||
|
_ = ListMO(apiList: list, context: context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.persistentContainer.save(context: context)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "256x256@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "256x256@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 123 KiB |
|
@ -0,0 +1,38 @@
|
||||||
|
//
|
||||||
|
// AccountPreferences.swift
|
||||||
|
// Tusker
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/19/22.
|
||||||
|
// Copyright © 2022 Shadowfacts. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import CoreData
|
||||||
|
import Pachyderm
|
||||||
|
|
||||||
|
@objc(AccountPreferences)
|
||||||
|
public final class AccountPreferences: NSManagedObject {
|
||||||
|
|
||||||
|
@nonobjc class func fetchRequest(account: LocalData.UserAccountInfo) -> NSFetchRequest<AccountPreferences> {
|
||||||
|
let req = NSFetchRequest<AccountPreferences>(entityName: "AccountPreferences")
|
||||||
|
req.predicate = NSPredicate(format: "accountID = %@", account.id)
|
||||||
|
req.sortDescriptors = [NSSortDescriptor(key: "createdAt", ascending: true)]
|
||||||
|
return req
|
||||||
|
}
|
||||||
|
|
||||||
|
@NSManaged public var accountID: String
|
||||||
|
@NSManaged var createdAt: Date
|
||||||
|
@NSManaged var pinnedTimelinesData: Data?
|
||||||
|
|
||||||
|
@LazilyDecoding(from: \AccountPreferences.pinnedTimelinesData, fallback: [])
|
||||||
|
var pinnedTimelines: [Timeline]
|
||||||
|
|
||||||
|
static func `default`(account: LocalData.UserAccountInfo, context: NSManagedObjectContext) -> AccountPreferences {
|
||||||
|
let prefs = AccountPreferences(context: context)
|
||||||
|
prefs.accountID = account.id
|
||||||
|
prefs.createdAt = Date()
|
||||||
|
prefs.pinnedTimelines = [.home, .public(local: true), .public(local: false)]
|
||||||
|
return prefs
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
//
|
||||||
|
// ListMO.swift
|
||||||
|
// Tusker
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/20/22.
|
||||||
|
// Copyright © 2022 Shadowfacts. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import CoreData
|
||||||
|
import Pachyderm
|
||||||
|
|
||||||
|
@objc(ListMO)
|
||||||
|
public final class ListMO: NSManagedObject {
|
||||||
|
|
||||||
|
@nonobjc public class func fetchRequest() -> NSFetchRequest<ListMO> {
|
||||||
|
return NSFetchRequest(entityName: "List")
|
||||||
|
}
|
||||||
|
|
||||||
|
@nonobjc public class func fetchRequest(id: String) -> NSFetchRequest<ListMO> {
|
||||||
|
let req = NSFetchRequest<ListMO>(entityName: "List")
|
||||||
|
req.predicate = NSPredicate(format: "id = %@", id)
|
||||||
|
return req
|
||||||
|
}
|
||||||
|
|
||||||
|
@NSManaged public var id: String
|
||||||
|
@NSManaged public var title: String
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ListMO {
|
||||||
|
convenience init(apiList list: List, context: NSManagedObjectContext) {
|
||||||
|
self.init(context: context)
|
||||||
|
self.updateFrom(apiList: list)
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateFrom(apiList list: List) {
|
||||||
|
self.id = list.id
|
||||||
|
self.title = list.title
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,10 +12,13 @@ import Pachyderm
|
||||||
import Combine
|
import Combine
|
||||||
import OSLog
|
import OSLog
|
||||||
import Sentry
|
import Sentry
|
||||||
|
import CloudKit
|
||||||
|
|
||||||
fileprivate let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "PersistentStore")
|
fileprivate let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "PersistentStore")
|
||||||
|
|
||||||
class MastodonCachePersistentStore: NSPersistentContainer {
|
class MastodonCachePersistentStore: NSPersistentCloudKitContainer {
|
||||||
|
|
||||||
|
private let accountInfo: LocalData.UserAccountInfo?
|
||||||
|
|
||||||
private static let managedObjectModel: NSManagedObjectModel = {
|
private static let managedObjectModel: NSManagedObjectModel = {
|
||||||
let url = Bundle.main.url(forResource: "Tusker", withExtension: "momd")!
|
let url = Bundle.main.url(forResource: "Tusker", withExtension: "momd")!
|
||||||
|
@ -38,6 +41,9 @@ class MastodonCachePersistentStore: NSPersistentContainer {
|
||||||
return context
|
return context
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
private var remoteChangeHandlerQueue = DispatchQueue(label: "PersistentStore remote changes")
|
||||||
|
private var lastRemoteChangeToken: NSPersistentHistoryToken?
|
||||||
|
|
||||||
// TODO: consider sending managed objects through this to avoid re-fetching things unnecessarily
|
// TODO: consider sending managed objects through this to avoid re-fetching things unnecessarily
|
||||||
// would need to audit existing uses to make sure everything happens on the main thread
|
// would need to audit existing uses to make sure everything happens on the main thread
|
||||||
// and when updating things on the background context would need to switch to main, refetch, and then publish
|
// and when updating things on the background context would need to switch to main, refetch, and then publish
|
||||||
|
@ -46,6 +52,11 @@ class MastodonCachePersistentStore: NSPersistentContainer {
|
||||||
let relationshipSubject = PassthroughSubject<String, Never>()
|
let relationshipSubject = PassthroughSubject<String, Never>()
|
||||||
|
|
||||||
init(for accountInfo: LocalData.UserAccountInfo?, transient: Bool = false) {
|
init(for accountInfo: LocalData.UserAccountInfo?, transient: Bool = false) {
|
||||||
|
self.accountInfo = accountInfo
|
||||||
|
|
||||||
|
let group = DispatchGroup()
|
||||||
|
var instancesToMigrate: [URL]? = nil
|
||||||
|
var hashtagsToMigrate: [Hashtag]? = nil
|
||||||
if transient {
|
if transient {
|
||||||
super.init(name: "transient_cache", managedObjectModel: MastodonCachePersistentStore.managedObjectModel)
|
super.init(name: "transient_cache", managedObjectModel: MastodonCachePersistentStore.managedObjectModel)
|
||||||
|
|
||||||
|
@ -55,6 +66,28 @@ class MastodonCachePersistentStore: NSPersistentContainer {
|
||||||
} else {
|
} else {
|
||||||
super.init(name: "\(accountInfo!.persistenceKey)_cache", managedObjectModel: MastodonCachePersistentStore.managedObjectModel)
|
super.init(name: "\(accountInfo!.persistenceKey)_cache", managedObjectModel: MastodonCachePersistentStore.managedObjectModel)
|
||||||
|
|
||||||
|
var localStoreLocation = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first!
|
||||||
|
localStoreLocation.appendPathComponent("\(accountInfo!.persistenceKey)_cache.sqlite", isDirectory: false)
|
||||||
|
let localStoreDescription = NSPersistentStoreDescription(url: localStoreLocation)
|
||||||
|
localStoreDescription.configuration = "Local"
|
||||||
|
localStoreDescription.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey)
|
||||||
|
localStoreDescription.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey)
|
||||||
|
|
||||||
|
var cloudStoreLocation = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first!
|
||||||
|
cloudStoreLocation.appendPathComponent("cloud.sqlite", isDirectory: false)
|
||||||
|
let cloudStoreDescription = NSPersistentStoreDescription(url: cloudStoreLocation)
|
||||||
|
cloudStoreDescription.configuration = "Cloud"
|
||||||
|
let options = NSPersistentCloudKitContainerOptions(containerIdentifier: "iCloud.space.vaccor.Tusker")
|
||||||
|
options.databaseScope = .private
|
||||||
|
cloudStoreDescription.cloudKitContainerOptions = options
|
||||||
|
cloudStoreDescription.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey)
|
||||||
|
cloudStoreDescription.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey)
|
||||||
|
|
||||||
|
persistentStoreDescriptions = [
|
||||||
|
cloudStoreDescription,
|
||||||
|
localStoreDescription,
|
||||||
|
]
|
||||||
|
|
||||||
// workaround for migrating from using id in name to persistenceKey
|
// workaround for migrating from using id in name to persistenceKey
|
||||||
// can be removed after a sufficient time has passed
|
// can be removed after a sufficient time has passed
|
||||||
if accountInfo!.id.contains("/") {
|
if accountInfo!.id.contains("/") {
|
||||||
|
@ -82,19 +115,75 @@ class MastodonCachePersistentStore: NSPersistentContainer {
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// migrate saved data from local store to cloud store
|
||||||
|
// this can be removed pre-app store release
|
||||||
|
var defaultPath = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first!
|
||||||
|
defaultPath.appendPathComponent("\(accountInfo!.persistenceKey)_cache.sqlite", isDirectory: false)
|
||||||
|
if FileManager.default.fileExists(atPath: defaultPath.path) {
|
||||||
|
group.enter()
|
||||||
|
let defaultDesc = NSPersistentStoreDescription(url: defaultPath)
|
||||||
|
defaultDesc.configuration = "Default"
|
||||||
|
let defaultPSC = NSPersistentContainer(name: "\(accountInfo!.persistenceKey)_cache", managedObjectModel: MastodonCachePersistentStore.managedObjectModel)
|
||||||
|
defaultPSC.persistentStoreDescriptions = [defaultDesc]
|
||||||
|
defaultPSC.loadPersistentStores { _, error in
|
||||||
|
guard error == nil else {
|
||||||
|
group.leave()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defaultPSC.performBackgroundTask { context in
|
||||||
|
if let instances = try? context.fetch(SavedInstance.fetchRequestWithoutAccountForMigrating()) {
|
||||||
|
instancesToMigrate = instances.map(\.url)
|
||||||
|
instances.forEach(context.delete(_:))
|
||||||
|
}
|
||||||
|
if let hashtags = try? context.fetch(SavedHashtag.fetchRequestWithoutAccountForMigrating()) {
|
||||||
|
hashtagsToMigrate = hashtags.map { Hashtag(name: $0.name, url: $0.url) }
|
||||||
|
hashtags.forEach(context.delete(_:))
|
||||||
|
}
|
||||||
|
if context.hasChanges {
|
||||||
|
try? context.save()
|
||||||
|
}
|
||||||
|
group.leave()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
group.wait()
|
||||||
loadPersistentStores { (description, error) in
|
loadPersistentStores { (description, error) in
|
||||||
if let error = error {
|
if let error = error {
|
||||||
logger.error("Unable to load persistent store: \(String(describing: error), privacy: .public)")
|
logger.error("Unable to load persistent store: \(String(describing: error), privacy: .public)")
|
||||||
fatalError("Unable to load persistent store")
|
fatalError("Unable to load persistent store: \(String(describing: error))")
|
||||||
|
}
|
||||||
|
|
||||||
|
if description.configuration == "Cloud" {
|
||||||
|
let context = self.backgroundContext
|
||||||
|
context.perform {
|
||||||
|
instancesToMigrate?.forEach({ url in
|
||||||
|
if !context.objectExists(for: SavedInstance.fetchRequest(url: url, account: accountInfo!)) {
|
||||||
|
_ = SavedInstance(url: url, account: accountInfo!, context: self.backgroundContext)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
hashtagsToMigrate?.forEach({ hashtag in
|
||||||
|
if !context.objectExists(for: SavedHashtag.fetchRequest(name: hashtag.name, account: accountInfo!)) {
|
||||||
|
_ = SavedHashtag(hashtag: hashtag, account: accountInfo!, context: self.backgroundContext)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
self.save(context: self.backgroundContext)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// changes to the Cloud CD model in development need this to be uncommented to update the CK schema
|
||||||
|
// #if DEBUG
|
||||||
|
// try! initializeCloudKitSchema(options: [])
|
||||||
|
// #endif
|
||||||
|
|
||||||
viewContext.automaticallyMergesChangesFromParent = true
|
viewContext.automaticallyMergesChangesFromParent = true
|
||||||
viewContext.mergePolicy = NSMergePolicy.mergeByPropertyObjectTrump
|
viewContext.mergePolicy = NSMergePolicy.mergeByPropertyObjectTrump
|
||||||
|
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(managedObjectsDidChange), name: .NSManagedObjectContextObjectsDidChange, object: viewContext)
|
NotificationCenter.default.addObserver(self, selector: #selector(managedObjectsDidChange), name: .NSManagedObjectContextObjectsDidChange, object: viewContext)
|
||||||
|
NotificationCenter.default.addObserver(self, selector: #selector(remoteChanges), name: .NSPersistentStoreRemoteChange, object: persistentStoreCoordinator)
|
||||||
}
|
}
|
||||||
|
|
||||||
func save(context: NSManagedObjectContext) {
|
func save(context: NSManagedObjectContext) {
|
||||||
|
@ -167,18 +256,19 @@ class MastodonCachePersistentStore: NSPersistentContainer {
|
||||||
return statusMO
|
return statusMO
|
||||||
}
|
}
|
||||||
|
|
||||||
func addAll(statuses: [Status], completion: (() -> Void)? = nil) {
|
func addAll(statuses: [Status], in context: NSManagedObjectContext? = nil, completion: (() -> Void)? = nil) {
|
||||||
backgroundContext.perform {
|
let context = context ?? backgroundContext
|
||||||
statuses.forEach { self.upsert(status: $0, context: self.backgroundContext) }
|
context.perform {
|
||||||
self.save(context: self.backgroundContext)
|
statuses.forEach { self.upsert(status: $0, context: context) }
|
||||||
|
self.save(context: context)
|
||||||
statuses.forEach { self.statusSubject.send($0.id) }
|
statuses.forEach { self.statusSubject.send($0.id) }
|
||||||
completion?()
|
completion?()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func addAll(statuses: [Status]) async {
|
func addAll(statuses: [Status], in context: NSManagedObjectContext? = nil) async {
|
||||||
return await withCheckedContinuation { continuation in
|
return await withCheckedContinuation { continuation in
|
||||||
addAll(statuses: statuses) {
|
addAll(statuses: statuses, in: context) {
|
||||||
continuation.resume()
|
continuation.resume()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -355,9 +445,12 @@ class MastodonCachePersistentStore: NSPersistentContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getTimelineState(timeline: Timeline) -> TimelineState? {
|
func getTimelinePosition(timeline: Timeline) -> TimelinePosition? {
|
||||||
|
guard let accountInfo else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
do {
|
do {
|
||||||
let req = TimelineState.fetchRequest(timeline: timeline)
|
let req = TimelinePosition.fetchRequest(timeline: timeline, account: accountInfo)
|
||||||
return try viewContext.fetch(req).first
|
return try viewContext.fetch(req).first
|
||||||
} catch {
|
} catch {
|
||||||
return nil
|
return nil
|
||||||
|
@ -403,4 +496,61 @@ class MastodonCachePersistentStore: NSPersistentContainer {
|
||||||
return changes
|
return changes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc private func remoteChanges(_ notification: Foundation.Notification) {
|
||||||
|
guard let token = notification.userInfo?[NSPersistentHistoryTokenKey] as? NSPersistentHistoryToken else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
remoteChangeHandlerQueue.async {
|
||||||
|
defer {
|
||||||
|
self.lastRemoteChangeToken = token
|
||||||
|
}
|
||||||
|
let req = NSPersistentHistoryChangeRequest.fetchHistory(after: self.lastRemoteChangeToken)
|
||||||
|
self.backgroundContext.performAndWait {
|
||||||
|
if let result = try? self.backgroundContext.execute(req) as? NSPersistentHistoryResult,
|
||||||
|
let transactions = result.result as? [NSPersistentHistoryTransaction],
|
||||||
|
!transactions.isEmpty {
|
||||||
|
var changedHashtags = false
|
||||||
|
var changedInstances = false
|
||||||
|
var changedTimelinePositions = Set<NSManagedObjectID>()
|
||||||
|
var changedAccountPrefs = false
|
||||||
|
outer: for transaction in transactions {
|
||||||
|
for change in transaction.changes ?? [] {
|
||||||
|
if change.changedObjectID.entity.name == "SavedHashtag" {
|
||||||
|
changedHashtags = true
|
||||||
|
} else if change.changedObjectID.entity.name == "SavedInstance" {
|
||||||
|
changedInstances = true
|
||||||
|
} else if change.changedObjectID.entity.name == "TimelinePosition" {
|
||||||
|
changedTimelinePositions.insert(change.changedObjectID)
|
||||||
|
} else if change.changedObjectID.entity.name == "AccountPreferences" {
|
||||||
|
changedAccountPrefs = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
if changedHashtags {
|
||||||
|
NotificationCenter.default.post(name: .savedHashtagsChanged, object: nil)
|
||||||
|
}
|
||||||
|
if changedInstances {
|
||||||
|
NotificationCenter.default.post(name: .savedInstancesChanged, object: nil)
|
||||||
|
}
|
||||||
|
for id in changedTimelinePositions {
|
||||||
|
guard let timelinePosition = try? self.viewContext.existingObject(with: id) as? TimelinePosition else {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
NotificationCenter.default.post(name: .timelinePositionChanged, object: timelinePosition)
|
||||||
|
}
|
||||||
|
if changedAccountPrefs {
|
||||||
|
NotificationCenter.default.post(name: .accountPreferencesChangedRemotely, object: nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Foundation.Notification.Name {
|
||||||
|
static let timelinePositionChanged = Notification.Name("timelinePositionChanged")
|
||||||
|
static let accountPreferencesChangedRemotely = Notification.Name("accountPreferencesChangedRemotely")
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,24 +14,32 @@ import WebURLFoundationExtras
|
||||||
@objc(SavedHashtag)
|
@objc(SavedHashtag)
|
||||||
public final class SavedHashtag: NSManagedObject {
|
public final class SavedHashtag: NSManagedObject {
|
||||||
|
|
||||||
@nonobjc public class func fetchRequest() -> NSFetchRequest<SavedHashtag> {
|
@nonobjc class func fetchRequestWithoutAccountForMigrating() -> NSFetchRequest<SavedHashtag> {
|
||||||
return NSFetchRequest<SavedHashtag>(entityName: "SavedHashtag")
|
return NSFetchRequest<SavedHashtag>(entityName: "SavedHashtag")
|
||||||
}
|
}
|
||||||
|
|
||||||
@nonobjc public class func fetchRequest(name: String) -> NSFetchRequest<SavedHashtag> {
|
@nonobjc class func fetchRequest(account: LocalData.UserAccountInfo) -> NSFetchRequest<SavedHashtag> {
|
||||||
let req = NSFetchRequest<SavedHashtag>(entityName: "SavedHashtag")
|
let req = NSFetchRequest<SavedHashtag>(entityName: "SavedHashtag")
|
||||||
req.predicate = NSPredicate(format: "name LIKE[cd] %@", name)
|
req.predicate = NSPredicate(format: "accountID = %@", account.id)
|
||||||
return req
|
return req
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@nonobjc class func fetchRequest(name: String, account: LocalData.UserAccountInfo) -> NSFetchRequest<SavedHashtag> {
|
||||||
|
let req = NSFetchRequest<SavedHashtag>(entityName: "SavedHashtag")
|
||||||
|
req.predicate = NSPredicate(format: "name LIKE[cd] %@ AND accountID = %@", name, account.id)
|
||||||
|
return req
|
||||||
|
}
|
||||||
|
|
||||||
|
@NSManaged public var accountID: String
|
||||||
@NSManaged public var name: String
|
@NSManaged public var name: String
|
||||||
@NSManaged public var url: URL
|
@NSManaged public var url: URL
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension SavedHashtag {
|
extension SavedHashtag {
|
||||||
convenience init(hashtag: Hashtag, context: NSManagedObjectContext) {
|
convenience init(hashtag: Hashtag, account: LocalData.UserAccountInfo, context: NSManagedObjectContext) {
|
||||||
self.init(context: context)
|
self.init(context: context)
|
||||||
|
self.accountID = account.id
|
||||||
self.name = hashtag.name
|
self.name = hashtag.name
|
||||||
self.url = URL(hashtag.url)!
|
self.url = URL(hashtag.url)!
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,23 +12,31 @@ import CoreData
|
||||||
@objc(SavedInstance)
|
@objc(SavedInstance)
|
||||||
public final class SavedInstance: NSManagedObject {
|
public final class SavedInstance: NSManagedObject {
|
||||||
|
|
||||||
@nonobjc public class func fetchRequest() -> NSFetchRequest<SavedInstance> {
|
@nonobjc class func fetchRequestWithoutAccountForMigrating() -> NSFetchRequest<SavedInstance> {
|
||||||
return NSFetchRequest<SavedInstance>(entityName: "SavedInstance")
|
return NSFetchRequest<SavedInstance>(entityName: "SavedInstance")
|
||||||
}
|
}
|
||||||
|
|
||||||
@nonobjc public class func fetchRequest(url: URL) -> NSFetchRequest<SavedInstance> {
|
@nonobjc class func fetchRequest(account: LocalData.UserAccountInfo) -> NSFetchRequest<SavedInstance> {
|
||||||
let req = fetchRequest()
|
let req = NSFetchRequest<SavedInstance>(entityName: "SavedInstance")
|
||||||
req.predicate = NSPredicate(format: "url = %@", url as NSURL)
|
req.predicate = NSPredicate(format: "accountID = %@", account.id)
|
||||||
return req
|
return req
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@nonobjc class func fetchRequest(url: URL, account: LocalData.UserAccountInfo) -> NSFetchRequest<SavedInstance> {
|
||||||
|
let req = NSFetchRequest<SavedInstance>(entityName: "SavedInstance")
|
||||||
|
req.predicate = NSPredicate(format: "url = %@ AND accountID = %@", url as NSURL, account.id)
|
||||||
|
return req
|
||||||
|
}
|
||||||
|
|
||||||
|
@NSManaged public var accountID: String
|
||||||
@NSManaged public var url: URL
|
@NSManaged public var url: URL
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension SavedInstance {
|
extension SavedInstance {
|
||||||
convenience init(url: URL, context: NSManagedObjectContext) {
|
convenience init(url: URL, account: LocalData.UserAccountInfo, context: NSManagedObjectContext) {
|
||||||
self.init(context: context)
|
self.init(context: context)
|
||||||
|
self.accountID = account.id
|
||||||
self.url = url
|
self.url = url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
//
|
||||||
|
// TimelinePosition.swift
|
||||||
|
// Tusker
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/23/22.
|
||||||
|
// Copyright © 2022 Shadowfacts. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import CoreData
|
||||||
|
import Pachyderm
|
||||||
|
|
||||||
|
@objc(TimelinePosition)
|
||||||
|
public final class TimelinePosition: NSManagedObject {
|
||||||
|
|
||||||
|
@nonobjc class func fetchRequest(timeline: Timeline, account: LocalData.UserAccountInfo) -> NSFetchRequest<TimelinePosition> {
|
||||||
|
let req = NSFetchRequest<TimelinePosition>(entityName: "TimelinePosition")
|
||||||
|
req.predicate = NSPredicate(format: "accountID = %@ AND timelineKind = %@", account.id, toTimelineKind(timeline))
|
||||||
|
req.sortDescriptors = [NSSortDescriptor(key: "createdAt", ascending: true)]
|
||||||
|
return req
|
||||||
|
}
|
||||||
|
|
||||||
|
@NSManaged public var accountID: String
|
||||||
|
@NSManaged public var createdAt: Date
|
||||||
|
@NSManaged private var timelineKind: String
|
||||||
|
@NSManaged public var centerStatusID: String?
|
||||||
|
@NSManaged private var statusIDsData: Data?
|
||||||
|
|
||||||
|
@LazilyDecoding(arrayFrom: \TimelinePosition.statusIDsData)
|
||||||
|
var statusIDs: [String]
|
||||||
|
|
||||||
|
var timeline: Timeline {
|
||||||
|
get { fromTimelineKind(timelineKind) }
|
||||||
|
set { timelineKind = toTimelineKind(newValue) }
|
||||||
|
}
|
||||||
|
|
||||||
|
convenience init(timeline: Timeline, account: LocalData.UserAccountInfo, context: NSManagedObjectContext) {
|
||||||
|
self.init(context: context)
|
||||||
|
self.timeline = timeline
|
||||||
|
self.accountID = account.id
|
||||||
|
self.createdAt = Date()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// blergh, this is the simplest way of getting the Timeline into a format that A) CoreData can handle and B) is usable in the predicate
|
||||||
|
func toTimelineKind(_ timeline: Timeline) -> String {
|
||||||
|
switch timeline {
|
||||||
|
case .home:
|
||||||
|
return "home"
|
||||||
|
case .public(local: true):
|
||||||
|
return "local"
|
||||||
|
case .public(local: false):
|
||||||
|
return "federated"
|
||||||
|
case .direct:
|
||||||
|
return "direct"
|
||||||
|
case .tag(hashtag: let name):
|
||||||
|
return "hashtag:\(name)"
|
||||||
|
case .list(id: let id):
|
||||||
|
return "list:\(id)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func fromTimelineKind(_ kind: String) -> Timeline {
|
||||||
|
if kind == "home" {
|
||||||
|
return .home
|
||||||
|
} else if kind == "local" {
|
||||||
|
return .public(local: true)
|
||||||
|
} else if kind == "federated" {
|
||||||
|
return .public(local: false)
|
||||||
|
} else if kind == "direct" {
|
||||||
|
return .direct
|
||||||
|
} else if kind.starts(with: "hashtag:") {
|
||||||
|
return .tag(hashtag: String(trimmingPrefix("hashtag:", of: kind)))
|
||||||
|
} else if kind.starts(with: "list:") {
|
||||||
|
return .list(id: String(trimmingPrefix("list:", of: kind)))
|
||||||
|
} else {
|
||||||
|
fatalError("invalid timeline kind \(kind)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// replace with Collection.trimmingPrefix
|
||||||
|
@available(iOS, obsoleted: 16.0)
|
||||||
|
private func trimmingPrefix(_ prefix: String, of str: String) -> Substring {
|
||||||
|
return str[str.index(str.startIndex, offsetBy: prefix.count)...]
|
||||||
|
}
|
|
@ -13,10 +13,8 @@ import Pachyderm
|
||||||
@objc(TimelineState)
|
@objc(TimelineState)
|
||||||
public final class TimelineState: NSManagedObject {
|
public final class TimelineState: NSManagedObject {
|
||||||
|
|
||||||
@nonobjc public class func fetchRequest(timeline: Timeline) -> NSFetchRequest<TimelineState> {
|
@nonobjc public class func fetchRequest() -> NSFetchRequest<TimelineState> {
|
||||||
let req = NSFetchRequest<TimelineState>(entityName: "TimelineState")
|
return NSFetchRequest<TimelineState>(entityName: "TimelineState")
|
||||||
req.predicate = NSPredicate(format: "timelineKind = %@", toTimelineKind(timeline))
|
|
||||||
return req
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NSManaged private var timelineKind: String
|
@NSManaged private var timelineKind: String
|
||||||
|
@ -25,65 +23,10 @@ public final class TimelineState: NSManagedObject {
|
||||||
|
|
||||||
var timeline: Timeline {
|
var timeline: Timeline {
|
||||||
get { fromTimelineKind(timelineKind) }
|
get { fromTimelineKind(timelineKind) }
|
||||||
set { timelineKind = toTimelineKind(newValue) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var statusMOs: [StatusMO] {
|
var statusMOs: [StatusMO] {
|
||||||
statuses.array as! [StatusMO]
|
statuses.array as! [StatusMO]
|
||||||
}
|
}
|
||||||
|
|
||||||
convenience init(timeline: Timeline, context: NSManagedObjectContext) {
|
|
||||||
self.init(context: context)
|
|
||||||
self.timeline = timeline
|
|
||||||
}
|
|
||||||
|
|
||||||
func setStatuses(_ statusIDs: [String]) {
|
|
||||||
let context = managedObjectContext!
|
|
||||||
// todo: this feels really inefficient, but I'm not sure if it's better or worse than doing a single "id IN %@" fetch and sorting after
|
|
||||||
let mos = statusIDs.compactMap { try? context.fetch(StatusMO.fetchRequest(id: $0)).first }
|
|
||||||
self.statuses = NSOrderedSet(array: mos)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// blergh, this is the simplest way of getting the Timeline into a format that A) CoreData can handle and B) is usable in the predicate
|
|
||||||
private func toTimelineKind(_ timeline: Timeline) -> String {
|
|
||||||
switch timeline {
|
|
||||||
case .home:
|
|
||||||
return "home"
|
|
||||||
case .public(local: true):
|
|
||||||
return "local"
|
|
||||||
case .public(local: false):
|
|
||||||
return "federated"
|
|
||||||
case .direct:
|
|
||||||
return "direct"
|
|
||||||
case .tag(hashtag: let name):
|
|
||||||
return "hashtag:\(name)"
|
|
||||||
case .list(id: let id):
|
|
||||||
return "list:\(id)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private func fromTimelineKind(_ kind: String) -> Timeline {
|
|
||||||
if kind == "home" {
|
|
||||||
return .home
|
|
||||||
} else if kind == "local" {
|
|
||||||
return .public(local: true)
|
|
||||||
} else if kind == "federated" {
|
|
||||||
return .public(local: false)
|
|
||||||
} else if kind == "direct" {
|
|
||||||
return .direct
|
|
||||||
} else if kind.starts(with: "hashtag:") {
|
|
||||||
return .tag(hashtag: String(trimmingPrefix("hashtag:", of: kind)))
|
|
||||||
} else if kind.starts(with: "list:") {
|
|
||||||
return .list(id: String(trimmingPrefix("list:", of: kind)))
|
|
||||||
} else {
|
|
||||||
fatalError("invalid timeline kind \(kind)")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// replace with Collection.trimmingPrefix
|
|
||||||
@available(iOS, obsoleted: 16.0)
|
|
||||||
private func trimmingPrefix(_ prefix: String, of str: String) -> Substring {
|
|
||||||
return str[str.index(str.startIndex, offsetBy: prefix.count)...]
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="21512" systemVersion="22A380" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
|
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="21513" systemVersion="22C65" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
|
||||||
<entity name="Account" representedClassName="AccountMO" syncable="YES">
|
<entity name="Account" representedClassName="AccountMO" syncable="YES">
|
||||||
<attribute name="acct" attributeType="String"/>
|
<attribute name="acct" attributeType="String"/>
|
||||||
<attribute name="avatar" optional="YES" attributeType="URI"/>
|
<attribute name="avatar" optional="YES" attributeType="URI"/>
|
||||||
|
@ -28,6 +28,11 @@
|
||||||
</uniquenessConstraint>
|
</uniquenessConstraint>
|
||||||
</uniquenessConstraints>
|
</uniquenessConstraints>
|
||||||
</entity>
|
</entity>
|
||||||
|
<entity name="AccountPreferences" representedClassName="AccountPreferences" syncable="YES">
|
||||||
|
<attribute name="accountID" optional="YES" attributeType="String"/>
|
||||||
|
<attribute name="createdAt" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
|
||||||
|
<attribute name="pinnedTimelinesData" optional="YES" attributeType="Binary"/>
|
||||||
|
</entity>
|
||||||
<entity name="Filter" representedClassName="FilterMO" syncable="YES">
|
<entity name="Filter" representedClassName="FilterMO" syncable="YES">
|
||||||
<attribute name="action" attributeType="String" defaultValueString="warn"/>
|
<attribute name="action" attributeType="String" defaultValueString="warn"/>
|
||||||
<attribute name="context" attributeType="String"/>
|
<attribute name="context" attributeType="String"/>
|
||||||
|
@ -46,6 +51,15 @@
|
||||||
<attribute name="name" attributeType="String"/>
|
<attribute name="name" attributeType="String"/>
|
||||||
<attribute name="url" attributeType="URI"/>
|
<attribute name="url" attributeType="URI"/>
|
||||||
</entity>
|
</entity>
|
||||||
|
<entity name="List" representedClassName="ListMO" syncable="YES">
|
||||||
|
<attribute name="id" optional="YES" attributeType="String"/>
|
||||||
|
<attribute name="title" optional="YES" attributeType="String"/>
|
||||||
|
<uniquenessConstraints>
|
||||||
|
<uniquenessConstraint>
|
||||||
|
<constraint value="id"/>
|
||||||
|
</uniquenessConstraint>
|
||||||
|
</uniquenessConstraints>
|
||||||
|
</entity>
|
||||||
<entity name="Relationship" representedClassName="RelationshipMO" syncable="YES">
|
<entity name="Relationship" representedClassName="RelationshipMO" syncable="YES">
|
||||||
<attribute name="accountID" optional="YES" attributeType="String"/>
|
<attribute name="accountID" optional="YES" attributeType="String"/>
|
||||||
<attribute name="blocking" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
|
<attribute name="blocking" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
|
||||||
|
@ -60,21 +74,13 @@
|
||||||
<relationship name="account" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Account" inverseName="relationship" inverseEntity="Account"/>
|
<relationship name="account" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Account" inverseName="relationship" inverseEntity="Account"/>
|
||||||
</entity>
|
</entity>
|
||||||
<entity name="SavedHashtag" representedClassName="SavedHashtag" syncable="YES">
|
<entity name="SavedHashtag" representedClassName="SavedHashtag" syncable="YES">
|
||||||
<attribute name="name" attributeType="String"/>
|
<attribute name="accountID" optional="YES" attributeType="String"/>
|
||||||
<attribute name="url" attributeType="URI"/>
|
<attribute name="name" optional="YES" attributeType="String"/>
|
||||||
<uniquenessConstraints>
|
<attribute name="url" optional="YES" attributeType="URI"/>
|
||||||
<uniquenessConstraint>
|
|
||||||
<constraint value="name"/>
|
|
||||||
</uniquenessConstraint>
|
|
||||||
</uniquenessConstraints>
|
|
||||||
</entity>
|
</entity>
|
||||||
<entity name="SavedInstance" representedClassName="SavedInstance" syncable="YES">
|
<entity name="SavedInstance" representedClassName="SavedInstance" syncable="YES">
|
||||||
<attribute name="url" attributeType="URI"/>
|
<attribute name="accountID" optional="YES" attributeType="String"/>
|
||||||
<uniquenessConstraints>
|
<attribute name="url" optional="YES" attributeType="URI"/>
|
||||||
<uniquenessConstraint>
|
|
||||||
<constraint value="url"/>
|
|
||||||
</uniquenessConstraint>
|
|
||||||
</uniquenessConstraints>
|
|
||||||
</entity>
|
</entity>
|
||||||
<entity name="Status" representedClassName="StatusMO" syncable="YES">
|
<entity name="Status" representedClassName="StatusMO" syncable="YES">
|
||||||
<attribute name="applicationName" optional="YES" attributeType="String"/>
|
<attribute name="applicationName" optional="YES" attributeType="String"/>
|
||||||
|
@ -112,9 +118,32 @@
|
||||||
</uniquenessConstraint>
|
</uniquenessConstraint>
|
||||||
</uniquenessConstraints>
|
</uniquenessConstraints>
|
||||||
</entity>
|
</entity>
|
||||||
|
<entity name="TimelinePosition" representedClassName="TimelinePosition" syncable="YES">
|
||||||
|
<attribute name="accountID" optional="YES" attributeType="String"/>
|
||||||
|
<attribute name="centerStatusID" optional="YES" attributeType="String"/>
|
||||||
|
<attribute name="createdAt" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
|
||||||
|
<attribute name="statusIDsData" optional="YES" attributeType="Binary" valueTransformerName="TimelinePositionStatusIDsTransformer"/>
|
||||||
|
<attribute name="timelineKind" optional="YES" attributeType="String"/>
|
||||||
|
</entity>
|
||||||
<entity name="TimelineState" representedClassName="TimelineState" syncable="YES">
|
<entity name="TimelineState" representedClassName="TimelineState" syncable="YES">
|
||||||
<attribute name="centerStatusID" optional="YES" attributeType="String"/>
|
<attribute name="centerStatusID" optional="YES" attributeType="String"/>
|
||||||
<attribute name="timelineKind" attributeType="String" valueTransformerName="pachydermTimeline" customClassName="Tusker.TimelineContainer"/>
|
<attribute name="timelineKind" attributeType="String" valueTransformerName="pachydermTimeline" customClassName="Tusker.TimelineContainer"/>
|
||||||
<relationship name="statuses" toMany="YES" deletionRule="Nullify" ordered="YES" destinationEntity="Status" inverseName="timelines" inverseEntity="Status"/>
|
<relationship name="statuses" toMany="YES" deletionRule="Nullify" ordered="YES" destinationEntity="Status" inverseName="timelines" inverseEntity="Status"/>
|
||||||
</entity>
|
</entity>
|
||||||
|
<configuration name="Cloud" usedWithCloudKit="YES">
|
||||||
|
<memberEntity name="SavedHashtag"/>
|
||||||
|
<memberEntity name="SavedInstance"/>
|
||||||
|
<memberEntity name="AccountPreferences"/>
|
||||||
|
<memberEntity name="TimelinePosition"/>
|
||||||
|
</configuration>
|
||||||
|
<configuration name="Local">
|
||||||
|
<memberEntity name="Account"/>
|
||||||
|
<memberEntity name="Filter"/>
|
||||||
|
<memberEntity name="FilterKeyword"/>
|
||||||
|
<memberEntity name="FollowedHashtag"/>
|
||||||
|
<memberEntity name="Relationship"/>
|
||||||
|
<memberEntity name="Status"/>
|
||||||
|
<memberEntity name="TimelineState"/>
|
||||||
|
<memberEntity name="List"/>
|
||||||
|
</configuration>
|
||||||
</model>
|
</model>
|
|
@ -8,16 +8,31 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
extension Array where Element: Hashable {
|
extension Array {
|
||||||
func uniques() -> [Element] {
|
func uniques<ID: Hashable>(by identify: (Element) -> ID) -> [Element] {
|
||||||
var buffer = [Element]()
|
var uniques = Set<Hashed<Element, ID>>()
|
||||||
var added = Set<Element>()
|
|
||||||
for elem in self {
|
for elem in self {
|
||||||
if !added.contains(elem) {
|
uniques.insert(Hashed(element: elem, id: identify(elem)))
|
||||||
buffer.append(elem)
|
|
||||||
added.insert(elem)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return buffer
|
return uniques.map(\.element)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Array where Element: Hashable {
|
||||||
|
func uniques() -> [Element] {
|
||||||
|
return uniques(by: { $0 })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fileprivate struct Hashed<Element, ID: Hashable>: Hashable {
|
||||||
|
let element: Element
|
||||||
|
let id: ID
|
||||||
|
|
||||||
|
static func ==(lhs: Self, rhs: Self) -> Bool {
|
||||||
|
return lhs.id == rhs.id
|
||||||
|
}
|
||||||
|
|
||||||
|
func hash(into hasher: inout Hasher) {
|
||||||
|
hasher.combine(id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ extension CollapseState {
|
||||||
func resolveFor(status: StatusMO, height: CGFloat, textLength: Int? = nil) {
|
func resolveFor(status: StatusMO, height: CGFloat, textLength: Int? = nil) {
|
||||||
let longEnoughToCollapse: Bool
|
let longEnoughToCollapse: Bool
|
||||||
if Preferences.shared.collapseLongPosts,
|
if Preferences.shared.collapseLongPosts,
|
||||||
height > 500 || (textLength != nil && textLength! > 500) {
|
height > 600 || (textLength != nil && textLength! > 500) {
|
||||||
longEnoughToCollapse = true
|
longEnoughToCollapse = true
|
||||||
} else {
|
} else {
|
||||||
longEnoughToCollapse = false
|
longEnoughToCollapse = false
|
||||||
|
|
|
@ -25,18 +25,22 @@ extension Timeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var tabBarImage: UIImage? {
|
var image: UIImage {
|
||||||
switch self {
|
switch self {
|
||||||
case .home:
|
case .home:
|
||||||
return UIImage(systemName: "house.fill")
|
return UIImage(systemName: "house.fill")!
|
||||||
case let .public(local):
|
case let .public(local):
|
||||||
if local {
|
if local {
|
||||||
return UIImage(systemName: "person.and.person.fill")
|
return UIImage(systemName: "person.and.person.fill")!
|
||||||
} else {
|
} else {
|
||||||
return UIImage(systemName: "globe")
|
return UIImage(systemName: "globe")!
|
||||||
}
|
}
|
||||||
default:
|
case .list(id: _):
|
||||||
return nil
|
return UIImage(systemName: "list.bullet")!
|
||||||
|
case .tag(hashtag: _):
|
||||||
|
return UIImage(systemName: "number")!
|
||||||
|
case .direct:
|
||||||
|
return UIImage(systemName: "enveloep.fill")!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,9 +45,12 @@ class Filterer {
|
||||||
var htmlConverter = HTMLConverter()
|
var htmlConverter = HTMLConverter()
|
||||||
private var hasSetup = false
|
private var hasSetup = false
|
||||||
private var matchers = [(NSRegularExpression, Result)]()
|
private var matchers = [(NSRegularExpression, Result)]()
|
||||||
private var allFiltersObserver: AnyCancellable?
|
private var cancellables = Set<AnyCancellable>()
|
||||||
private var filterObservers = Set<AnyCancellable>()
|
private var filterObservers = Set<AnyCancellable>()
|
||||||
|
|
||||||
|
private var hideReblogsInTimelines: Bool
|
||||||
|
private var hideRepliesInTimelines: Bool
|
||||||
|
|
||||||
// the generation is incremented when the matchers change, to indicate that older cached FilterStates
|
// the generation is incremented when the matchers change, to indicate that older cached FilterStates
|
||||||
// are no longer valid, without needing to go through and update each of them
|
// are no longer valid, without needing to go through and update each of them
|
||||||
private var generation = 0
|
private var generation = 0
|
||||||
|
@ -55,13 +58,37 @@ class Filterer {
|
||||||
init(mastodonController: MastodonController, context: FilterV1.Context) {
|
init(mastodonController: MastodonController, context: FilterV1.Context) {
|
||||||
self.mastodonController = mastodonController
|
self.mastodonController = mastodonController
|
||||||
self.context = context
|
self.context = context
|
||||||
|
self.hideReblogsInTimelines = Preferences.shared.hideReblogsInTimelines
|
||||||
|
self.hideRepliesInTimelines = Preferences.shared.hideRepliesInTimelines
|
||||||
|
|
||||||
allFiltersObserver = mastodonController.$filters
|
mastodonController.$filters
|
||||||
.sink { [unowned self] in
|
.sink { [unowned self] in
|
||||||
if self.hasSetup {
|
if self.hasSetup {
|
||||||
self.setupFilters(filters: $0)
|
self.setupFilters(filters: $0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.store(in: &cancellables)
|
||||||
|
|
||||||
|
if context == .home {
|
||||||
|
Preferences.shared.$hideReblogsInTimelines
|
||||||
|
.sink { [unowned self] newValue in
|
||||||
|
if newValue != hideReblogsInTimelines {
|
||||||
|
self.hideReblogsInTimelines = newValue
|
||||||
|
self.generation += 1
|
||||||
|
self.filtersChanged?(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.store(in: &cancellables)
|
||||||
|
Preferences.shared.$hideRepliesInTimelines
|
||||||
|
.sink { [unowned self] newValue in
|
||||||
|
if newValue != hideRepliesInTimelines {
|
||||||
|
self.hideRepliesInTimelines = newValue
|
||||||
|
self.generation += 1
|
||||||
|
self.filtersChanged?(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.store(in: &cancellables)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func setupFilters(filters: [FilterMO]) {
|
private func setupFilters(filters: [FilterMO]) {
|
||||||
|
@ -86,7 +113,7 @@ class Filterer {
|
||||||
}
|
}
|
||||||
|
|
||||||
if hasSetup {
|
if hasSetup {
|
||||||
var allMatch: Bool = false
|
var allMatch: Bool = true
|
||||||
var actionsChanged: Bool = false
|
var actionsChanged: Bool = false
|
||||||
if matchers.count != oldMatchers.count {
|
if matchers.count != oldMatchers.count {
|
||||||
allMatch = false
|
allMatch = false
|
||||||
|
@ -114,12 +141,13 @@ class Filterer {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use a closure for the status in case the result is cached and we don't need to look it up
|
// Use a closure for the status in case the result is cached and we don't need to look it up
|
||||||
func resolve(state: FilterState, status: () -> StatusMO) -> (Filterer.Result, NSAttributedString?) {
|
func resolve(state: FilterState, status: () -> (StatusMO, Bool)) -> (Filterer.Result, NSAttributedString?) {
|
||||||
switch state.state {
|
switch state.state {
|
||||||
case .known(_, generation: let knownGen) where knownGen < generation:
|
case .known(_, generation: let knownGen) where knownGen < generation:
|
||||||
fallthrough
|
fallthrough
|
||||||
case .unknown:
|
case .unknown:
|
||||||
let (result, attributedString) = doResolve(status: status())
|
let (status, isReblog) = status()
|
||||||
|
let (result, attributedString) = doResolve(status: status, isReblog: isReblog)
|
||||||
state.state = .known(result, generation: generation)
|
state.state = .known(result, generation: generation)
|
||||||
return (result, attributedString)
|
return (result, attributedString)
|
||||||
case .known(let result, _):
|
case .known(let result, _):
|
||||||
|
@ -140,10 +168,19 @@ class Filterer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func doResolve(status: StatusMO) -> (Result, NSAttributedString?) {
|
private func doResolve(status: StatusMO, isReblog: Bool) -> (Result, NSAttributedString?) {
|
||||||
if !hasSetup {
|
if !hasSetup {
|
||||||
setupFilters(filters: mastodonController.filters)
|
setupFilters(filters: mastodonController.filters)
|
||||||
}
|
}
|
||||||
|
if context == .home {
|
||||||
|
if hideReblogsInTimelines,
|
||||||
|
isReblog {
|
||||||
|
return (.hide, nil)
|
||||||
|
} else if hideRepliesInTimelines,
|
||||||
|
status.inReplyToID != nil {
|
||||||
|
return (.hide, nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
if matchers.isEmpty {
|
if matchers.isEmpty {
|
||||||
return (.allow, nil)
|
return (.allow, nil)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,37 +2,8 @@
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>SentryDSN</key>
|
<key>ITSAppUsesNonExemptEncryption</key>
|
||||||
<string>$(SENTRY_DSN)</string>
|
<false/>
|
||||||
<key>OSLogPreferences</key>
|
|
||||||
<dict>
|
|
||||||
<key>space.vaccor.Tusker</key>
|
|
||||||
<dict>
|
|
||||||
<key>DEFAULT-OPTIONS</key>
|
|
||||||
<dict>
|
|
||||||
<key>TTL</key>
|
|
||||||
<dict>
|
|
||||||
<key>Fault</key>
|
|
||||||
<integer>30</integer>
|
|
||||||
<key>Error</key>
|
|
||||||
<integer>30</integer>
|
|
||||||
<key>Debug</key>
|
|
||||||
<integer>15</integer>
|
|
||||||
<key>Info</key>
|
|
||||||
<integer>30</integer>
|
|
||||||
<key>Default</key>
|
|
||||||
<integer>30</integer>
|
|
||||||
</dict>
|
|
||||||
<key>Level</key>
|
|
||||||
<dict>
|
|
||||||
<key>Persist</key>
|
|
||||||
<string>Debug</string>
|
|
||||||
<key>Enable</key>
|
|
||||||
<string>Debug</string>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
|
@ -102,6 +73,37 @@
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER).activity.show-profile</string>
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER).activity.show-profile</string>
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER).activity.main-scene</string>
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER).activity.main-scene</string>
|
||||||
</array>
|
</array>
|
||||||
|
<key>OSLogPreferences</key>
|
||||||
|
<dict>
|
||||||
|
<key>space.vaccor.Tusker</key>
|
||||||
|
<dict>
|
||||||
|
<key>DEFAULT-OPTIONS</key>
|
||||||
|
<dict>
|
||||||
|
<key>Level</key>
|
||||||
|
<dict>
|
||||||
|
<key>Enable</key>
|
||||||
|
<string>Debug</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<string>Debug</string>
|
||||||
|
</dict>
|
||||||
|
<key>TTL</key>
|
||||||
|
<dict>
|
||||||
|
<key>Debug</key>
|
||||||
|
<integer>15</integer>
|
||||||
|
<key>Default</key>
|
||||||
|
<integer>30</integer>
|
||||||
|
<key>Error</key>
|
||||||
|
<integer>30</integer>
|
||||||
|
<key>Fault</key>
|
||||||
|
<integer>30</integer>
|
||||||
|
<key>Info</key>
|
||||||
|
<integer>30</integer>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<key>SentryDSN</key>
|
||||||
|
<string>$(SENTRY_DSN)</string>
|
||||||
<key>UIApplicationSceneManifest</key>
|
<key>UIApplicationSceneManifest</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>UIApplicationSupportsMultipleScenes</key>
|
<key>UIApplicationSupportsMultipleScenes</key>
|
||||||
|
@ -140,6 +142,7 @@
|
||||||
<key>UIBackgroundModes</key>
|
<key>UIBackgroundModes</key>
|
||||||
<array>
|
<array>
|
||||||
<string>audio</string>
|
<string>audio</string>
|
||||||
|
<string>remote-notification</string>
|
||||||
</array>
|
</array>
|
||||||
<key>UILaunchStoryboardName</key>
|
<key>UILaunchStoryboardName</key>
|
||||||
<string>LaunchScreen</string>
|
<string>LaunchScreen</string>
|
||||||
|
|
|
@ -61,6 +61,7 @@ class Preferences: Codable, ObservableObject {
|
||||||
}
|
}
|
||||||
self.blurMediaBehindContentWarning = try container.decodeIfPresent(Bool.self, forKey: .blurMediaBehindContentWarning) ?? true
|
self.blurMediaBehindContentWarning = try container.decodeIfPresent(Bool.self, forKey: .blurMediaBehindContentWarning) ?? true
|
||||||
self.automaticallyPlayGifs = try container.decode(Bool.self, forKey: .automaticallyPlayGifs)
|
self.automaticallyPlayGifs = try container.decode(Bool.self, forKey: .automaticallyPlayGifs)
|
||||||
|
self.showUncroppedMediaInline = try container.decodeIfPresent(Bool.self, forKey: .showUncroppedMediaInline) ?? true
|
||||||
|
|
||||||
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)
|
||||||
|
@ -70,6 +71,8 @@ class Preferences: Codable, ObservableObject {
|
||||||
self.oppositeCollapseKeywords = try container.decodeIfPresent([String].self, forKey: .oppositeCollapseKeywords) ?? []
|
self.oppositeCollapseKeywords = try container.decodeIfPresent([String].self, forKey: .oppositeCollapseKeywords) ?? []
|
||||||
self.confirmBeforeReblog = try container.decodeIfPresent(Bool.self, forKey: .confirmBeforeReblog) ?? false
|
self.confirmBeforeReblog = try container.decodeIfPresent(Bool.self, forKey: .confirmBeforeReblog) ?? false
|
||||||
self.timelineStateRestoration = try container.decodeIfPresent(Bool.self, forKey: .timelineStateRestoration) ?? true
|
self.timelineStateRestoration = try container.decodeIfPresent(Bool.self, forKey: .timelineStateRestoration) ?? true
|
||||||
|
self.hideReblogsInTimelines = try container.decodeIfPresent(Bool.self, forKey: .hideReblogsInTimelines) ?? false
|
||||||
|
self.hideRepliesInTimelines = try container.decodeIfPresent(Bool.self, forKey: .hideRepliesInTimelines) ?? false
|
||||||
|
|
||||||
self.showFavoriteAndReblogCounts = try container.decode(Bool.self, forKey: .showFavoriteAndReblogCounts)
|
self.showFavoriteAndReblogCounts = try container.decode(Bool.self, forKey: .showFavoriteAndReblogCounts)
|
||||||
self.defaultNotificationsMode = try container.decode(NotificationsMode.self, forKey: .defaultNotificationsType)
|
self.defaultNotificationsMode = try container.decode(NotificationsMode.self, forKey: .defaultNotificationsType)
|
||||||
|
@ -106,6 +109,7 @@ class Preferences: Codable, ObservableObject {
|
||||||
try container.encode(attachmentBlurMode, forKey: .attachmentBlurMode)
|
try container.encode(attachmentBlurMode, forKey: .attachmentBlurMode)
|
||||||
try container.encode(blurMediaBehindContentWarning, forKey: .blurMediaBehindContentWarning)
|
try container.encode(blurMediaBehindContentWarning, forKey: .blurMediaBehindContentWarning)
|
||||||
try container.encode(automaticallyPlayGifs, forKey: .automaticallyPlayGifs)
|
try container.encode(automaticallyPlayGifs, forKey: .automaticallyPlayGifs)
|
||||||
|
try container.encode(showUncroppedMediaInline, forKey: .showUncroppedMediaInline)
|
||||||
|
|
||||||
try container.encode(openLinksInApps, forKey: .openLinksInApps)
|
try container.encode(openLinksInApps, forKey: .openLinksInApps)
|
||||||
try container.encode(useInAppSafari, forKey: .useInAppSafari)
|
try container.encode(useInAppSafari, forKey: .useInAppSafari)
|
||||||
|
@ -115,6 +119,8 @@ class Preferences: Codable, ObservableObject {
|
||||||
try container.encode(oppositeCollapseKeywords, forKey: .oppositeCollapseKeywords)
|
try container.encode(oppositeCollapseKeywords, forKey: .oppositeCollapseKeywords)
|
||||||
try container.encode(confirmBeforeReblog, forKey: .confirmBeforeReblog)
|
try container.encode(confirmBeforeReblog, forKey: .confirmBeforeReblog)
|
||||||
try container.encode(timelineStateRestoration, forKey: .timelineStateRestoration)
|
try container.encode(timelineStateRestoration, forKey: .timelineStateRestoration)
|
||||||
|
try container.encode(hideReblogsInTimelines, forKey: .hideReblogsInTimelines)
|
||||||
|
try container.encode(hideRepliesInTimelines, forKey: .hideRepliesInTimelines)
|
||||||
|
|
||||||
try container.encode(showFavoriteAndReblogCounts, forKey: .showFavoriteAndReblogCounts)
|
try container.encode(showFavoriteAndReblogCounts, forKey: .showFavoriteAndReblogCounts)
|
||||||
try container.encode(defaultNotificationsMode, forKey: .defaultNotificationsType)
|
try container.encode(defaultNotificationsMode, forKey: .defaultNotificationsType)
|
||||||
|
@ -159,6 +165,7 @@ class Preferences: Codable, ObservableObject {
|
||||||
}
|
}
|
||||||
@Published var blurMediaBehindContentWarning = true
|
@Published var blurMediaBehindContentWarning = true
|
||||||
@Published var automaticallyPlayGifs = true
|
@Published var automaticallyPlayGifs = true
|
||||||
|
@Published var showUncroppedMediaInline = true
|
||||||
|
|
||||||
// MARK: Behavior
|
// MARK: Behavior
|
||||||
@Published var openLinksInApps = true
|
@Published var openLinksInApps = true
|
||||||
|
@ -169,6 +176,8 @@ class Preferences: Codable, ObservableObject {
|
||||||
@Published var oppositeCollapseKeywords: [String] = []
|
@Published var oppositeCollapseKeywords: [String] = []
|
||||||
@Published var confirmBeforeReblog = false
|
@Published var confirmBeforeReblog = false
|
||||||
@Published var timelineStateRestoration = true
|
@Published var timelineStateRestoration = true
|
||||||
|
@Published var hideReblogsInTimelines = false
|
||||||
|
@Published var hideRepliesInTimelines = false
|
||||||
|
|
||||||
// MARK: Digital Wellness
|
// MARK: Digital Wellness
|
||||||
@Published var showFavoriteAndReblogCounts = true
|
@Published var showFavoriteAndReblogCounts = true
|
||||||
|
@ -207,6 +216,7 @@ class Preferences: Codable, ObservableObject {
|
||||||
case attachmentBlurMode
|
case attachmentBlurMode
|
||||||
case blurMediaBehindContentWarning
|
case blurMediaBehindContentWarning
|
||||||
case automaticallyPlayGifs
|
case automaticallyPlayGifs
|
||||||
|
case showUncroppedMediaInline
|
||||||
|
|
||||||
case openLinksInApps
|
case openLinksInApps
|
||||||
case useInAppSafari
|
case useInAppSafari
|
||||||
|
@ -216,6 +226,8 @@ class Preferences: Codable, ObservableObject {
|
||||||
case oppositeCollapseKeywords
|
case oppositeCollapseKeywords
|
||||||
case confirmBeforeReblog
|
case confirmBeforeReblog
|
||||||
case timelineStateRestoration
|
case timelineStateRestoration
|
||||||
|
case hideReblogsInTimelines
|
||||||
|
case hideRepliesInTimelines
|
||||||
|
|
||||||
case showFavoriteAndReblogCounts
|
case showFavoriteAndReblogCounts
|
||||||
case defaultNotificationsType
|
case defaultNotificationsType
|
||||||
|
|
|
@ -74,6 +74,8 @@ protocol StatusSwipeActionContainer: UIView {
|
||||||
var navigationDelegate: any TuskerNavigationDelegate { get }
|
var navigationDelegate: any TuskerNavigationDelegate { get }
|
||||||
var toastableViewController: ToastableViewController? { get }
|
var toastableViewController: ToastableViewController? { get }
|
||||||
|
|
||||||
|
var canReblog: Bool { get }
|
||||||
|
|
||||||
// necessary b/c the reblog-handling logic only exists in the cells
|
// necessary b/c the reblog-handling logic only exists in the cells
|
||||||
func performReplyAction()
|
func performReplyAction()
|
||||||
}
|
}
|
||||||
|
@ -108,7 +110,8 @@ private func createFavoriteAction(status: StatusMO, container: StatusSwipeAction
|
||||||
}
|
}
|
||||||
|
|
||||||
private func createReblogAction(status: StatusMO, container: StatusSwipeActionContainer) -> UIContextualAction? {
|
private func createReblogAction(status: StatusMO, container: StatusSwipeActionContainer) -> UIContextualAction? {
|
||||||
guard container.mastodonController.loggedIn else {
|
guard container.mastodonController.loggedIn,
|
||||||
|
container.canReblog else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
let title = status.reblogged ? "Unreblog" : "Reblog"
|
let title = status.reblogged ? "Unreblog" : "Reblog"
|
||||||
|
|
|
@ -7,11 +7,14 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import Combine
|
||||||
|
|
||||||
class ComposeSceneDelegate: UIResponder, UIWindowSceneDelegate {
|
class ComposeSceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
|
|
||||||
var window: UIWindow?
|
var window: UIWindow?
|
||||||
|
|
||||||
|
private var cancellables = Set<AnyCancellable>()
|
||||||
|
|
||||||
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
|
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
|
||||||
guard let windowScene = scene as? UIWindowScene else {
|
guard let windowScene = scene as? UIWindowScene else {
|
||||||
return
|
return
|
||||||
|
@ -56,6 +59,11 @@ class ComposeSceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
composeVC.delegate = self
|
composeVC.delegate = self
|
||||||
let nav = EnhancedNavigationViewController(rootViewController: composeVC)
|
let nav = EnhancedNavigationViewController(rootViewController: composeVC)
|
||||||
|
|
||||||
|
updateTitle(draft: composeVC.draft)
|
||||||
|
composeVC.uiState.$draft
|
||||||
|
.sink { [unowned self] in self.updateTitle(draft: $0) }
|
||||||
|
.store(in: &cancellables)
|
||||||
|
|
||||||
window = UIWindow(windowScene: windowScene)
|
window = UIWindow(windowScene: windowScene)
|
||||||
window!.rootViewController = nav
|
window!.rootViewController = nav
|
||||||
window!.makeKeyAndVisible()
|
window!.makeKeyAndVisible()
|
||||||
|
@ -78,6 +86,19 @@ class ComposeSceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
return scene.userActivity
|
return scene.userActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func updateTitle(draft: Draft) {
|
||||||
|
guard let scene = window?.windowScene,
|
||||||
|
let mastodonController = scene.session.mastodonController else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if let inReplyToID = draft.inReplyToID,
|
||||||
|
let inReplyTo = mastodonController.persistentContainer.status(for: inReplyToID) {
|
||||||
|
scene.title = "Reply to @\(inReplyTo.account.acct)"
|
||||||
|
} else {
|
||||||
|
scene.title = "New Post"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@objc private func themePrefChanged() {
|
@objc private func themePrefChanged() {
|
||||||
window?.overrideUserInterfaceStyle = Preferences.shared.theme
|
window?.overrideUserInterfaceStyle = Preferences.shared.theme
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ class MainSceneDelegate: UIResponder, UIWindowSceneDelegate, TuskerSceneDelegate
|
||||||
minDate.addTimeInterval(-7 * 24 * 60 * 60)
|
minDate.addTimeInterval(-7 * 24 * 60 * 60)
|
||||||
|
|
||||||
let statusReq: NSFetchRequest<NSFetchRequestResult> = StatusMO.fetchRequest()
|
let statusReq: NSFetchRequest<NSFetchRequestResult> = StatusMO.fetchRequest()
|
||||||
statusReq.predicate = NSPredicate(format: "((lastFetchedAt = nil) OR (lastFetchedAt < %@)) AND (timelines.@count = 0)", minDate as NSDate)
|
statusReq.predicate = NSPredicate(format: "(lastFetchedAt = nil) OR (lastFetchedAt < %@)", minDate as NSDate)
|
||||||
let deleteStatusReq = NSBatchDeleteRequest(fetchRequest: statusReq)
|
let deleteStatusReq = NSBatchDeleteRequest(fetchRequest: statusReq)
|
||||||
deleteStatusReq.resultType = .resultTypeCount
|
deleteStatusReq.resultType = .resultTypeCount
|
||||||
if let res = try? context.execute(deleteStatusReq) as? NSBatchDeleteResult {
|
if let res = try? context.execute(deleteStatusReq) as? NSBatchDeleteResult {
|
||||||
|
@ -185,6 +185,15 @@ class MainSceneDelegate: UIResponder, UIWindowSceneDelegate, TuskerSceneDelegate
|
||||||
LocalData.shared.setMostRecentAccount(account)
|
LocalData.shared.setMostRecentAccount(account)
|
||||||
window!.windowScene!.session.mastodonController = MastodonController.getForAccount(account)
|
window!.windowScene!.session.mastodonController = MastodonController.getForAccount(account)
|
||||||
|
|
||||||
|
// iPadOS shows the title below the App Name
|
||||||
|
// macOS uses the title as the window title, but uses the subtitle in addition to the default window title (the app name)
|
||||||
|
// so this way we get basically the same behavior on both
|
||||||
|
if ProcessInfo.processInfo.isiOSAppOnMac || ProcessInfo.processInfo.isMacCatalystApp {
|
||||||
|
window!.windowScene!.subtitle = account.instanceURL.host!
|
||||||
|
} else {
|
||||||
|
window!.windowScene!.title = account.instanceURL.host!
|
||||||
|
}
|
||||||
|
|
||||||
let newRoot = createAppUI()
|
let newRoot = createAppUI()
|
||||||
if let container = window?.rootViewController as? AccountSwitchingContainerViewController {
|
if let container = window?.rootViewController as? AccountSwitchingContainerViewController {
|
||||||
let direction: AccountSwitchingContainerViewController.AnimationDirection
|
let direction: AccountSwitchingContainerViewController.AnimationDirection
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
class AccountListViewController: UIViewController {
|
class AccountListViewController: UIViewController, CollectionViewController {
|
||||||
typealias Item = String
|
typealias Item = String
|
||||||
|
|
||||||
private let mastodonController: MastodonController
|
private let mastodonController: MastodonController
|
||||||
private let accountIDs: [String]
|
private let accountIDs: [String]
|
||||||
|
|
||||||
private var collectionView: UICollectionView {
|
var collectionView: UICollectionView! {
|
||||||
view as! UICollectionView
|
view as! UICollectionView
|
||||||
}
|
}
|
||||||
private var dataSource: UICollectionViewDiffableDataSource<Section, Item>!
|
private var dataSource: UICollectionViewDiffableDataSource<Section, Item>!
|
||||||
|
@ -61,9 +61,7 @@ class AccountListViewController: UIViewController {
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
super.viewWillAppear(animated)
|
super.viewWillAppear(animated)
|
||||||
|
|
||||||
collectionView.indexPathsForSelectedItems?.forEach {
|
clearSelectionOnAppear(animated: animated)
|
||||||
collectionView.deselectItem(at: $0, animated: true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ struct ComposeAttachmentsList: View {
|
||||||
Label("Add photo or video", systemImage: addButtonImageName)
|
Label("Add photo or video", systemImage: addButtonImageName)
|
||||||
}
|
}
|
||||||
.disabled(!canAddAttachment)
|
.disabled(!canAddAttachment)
|
||||||
.foregroundColor(.blue)
|
.foregroundColor(.accentColor)
|
||||||
.frame(height: cellHeight / 2)
|
.frame(height: cellHeight / 2)
|
||||||
.sheetOrPopover(isPresented: $isShowingAssetPickerPopover, content: self.assetPickerPopover)
|
.sheetOrPopover(isPresented: $isShowingAssetPickerPopover, content: self.assetPickerPopover)
|
||||||
.listRowInsets(EdgeInsets(top: cellPadding / 2, leading: cellPadding / 2, bottom: cellPadding / 2, trailing: cellPadding / 2))
|
.listRowInsets(EdgeInsets(top: cellPadding / 2, leading: cellPadding / 2, bottom: cellPadding / 2, trailing: cellPadding / 2))
|
||||||
|
@ -51,7 +51,7 @@ struct ComposeAttachmentsList: View {
|
||||||
Label("Draw something", systemImage: "hand.draw")
|
Label("Draw something", systemImage: "hand.draw")
|
||||||
}
|
}
|
||||||
.disabled(!canAddAttachment)
|
.disabled(!canAddAttachment)
|
||||||
.foregroundColor(.blue)
|
.foregroundColor(.accentColor)
|
||||||
.frame(height: cellHeight / 2)
|
.frame(height: cellHeight / 2)
|
||||||
.listRowInsets(EdgeInsets(top: cellPadding / 2, leading: cellPadding / 2, bottom: cellPadding / 2, trailing: cellPadding / 2))
|
.listRowInsets(EdgeInsets(top: cellPadding / 2, leading: cellPadding / 2, bottom: cellPadding / 2, trailing: cellPadding / 2))
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ struct ComposeAttachmentsList: View {
|
||||||
Label(draft.poll == nil ? "Add a poll" : "Remove poll", systemImage: "chart.bar.doc.horizontal")
|
Label(draft.poll == nil ? "Add a poll" : "Remove poll", systemImage: "chart.bar.doc.horizontal")
|
||||||
}
|
}
|
||||||
.disabled(!canAddPoll)
|
.disabled(!canAddPoll)
|
||||||
.foregroundColor(.blue)
|
.foregroundColor(.accentColor)
|
||||||
.frame(height: cellHeight / 2)
|
.frame(height: cellHeight / 2)
|
||||||
.listRowInsets(EdgeInsets(top: cellPadding / 2, leading: cellPadding / 2, bottom: cellPadding / 2, trailing: cellPadding / 2))
|
.listRowInsets(EdgeInsets(top: cellPadding / 2, leading: cellPadding / 2, bottom: cellPadding / 2, trailing: cellPadding / 2))
|
||||||
}
|
}
|
||||||
|
|
|
@ -400,7 +400,8 @@ struct ComposeAutocompleteHashtagsView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updateHashtags(searchResults: [Hashtag], trendingTags: [Hashtag], query: String) {
|
private func updateHashtags(searchResults: [Hashtag], trendingTags: [Hashtag], query: String) {
|
||||||
let savedTags = ((try? mastodonController.persistentContainer.viewContext.fetch(SavedHashtag.fetchRequest())) ?? [])
|
let req = SavedHashtag.fetchRequest(account: mastodonController.accountInfo!)
|
||||||
|
let savedTags = ((try? mastodonController.persistentContainer.viewContext.fetch(req)) ?? [])
|
||||||
.map { Hashtag(name: $0.name, url: $0.url) }
|
.map { Hashtag(name: $0.name, url: $0.url) }
|
||||||
|
|
||||||
hashtags = (searchResults + savedTags + trendingTags)
|
hashtags = (searchResults + savedTags + trendingTags)
|
||||||
|
|
|
@ -36,14 +36,14 @@ struct ComposeToolbar: View {
|
||||||
|
|
||||||
MenuPicker(selection: $draft.visibility, options: Self.visibilityOptions, buttonStyle: .iconOnly)
|
MenuPicker(selection: $draft.visibility, options: Self.visibilityOptions, buttonStyle: .iconOnly)
|
||||||
// // the button has a bunch of extra space by default, but combined with what we add it's too much
|
// // the button has a bunch of extra space by default, but combined with what we add it's too much
|
||||||
// .padding(.horizontal, -8)
|
.padding(.horizontal, -8)
|
||||||
|
|
||||||
if mastodonController.instanceFeatures.localOnlyPosts {
|
if mastodonController.instanceFeatures.localOnlyPosts {
|
||||||
MenuPicker(selection: $draft.localOnly, options: [
|
MenuPicker(selection: $draft.localOnly, options: [
|
||||||
.init(value: true, title: "Local-only", subtitle: "Only \(mastodonController.accountInfo!.instanceURL.host!)", image: UIImage(named: "link.broken")),
|
.init(value: true, title: "Local-only", subtitle: "Only \(mastodonController.accountInfo!.instanceURL.host!)", image: UIImage(named: "link.broken")),
|
||||||
.init(value: false, title: "Federated", image: UIImage(systemName: "link"))
|
.init(value: false, title: "Federated", image: UIImage(systemName: "link"))
|
||||||
], buttonStyle: .iconOnly)
|
], buttonStyle: .iconOnly)
|
||||||
// .padding(.horizontal, -8)
|
.padding(.horizontal, -8)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let currentInput = uiState.currentInput, currentInput.toolbarElements.contains(.emojiPicker) {
|
if let currentInput = uiState.currentInput, currentInput.toolbarElements.contains(.emojiPicker) {
|
||||||
|
|
|
@ -72,6 +72,7 @@ class ConversationTableViewController: EnhancedTableViewController {
|
||||||
// separators are disabled on the table view so we can re-add them ourselves
|
// separators are disabled on the table view so we can re-add them ourselves
|
||||||
// so they're not inserted in between statuses in the ame sub-thread
|
// so they're not inserted in between statuses in the ame sub-thread
|
||||||
tableView.separatorStyle = .none
|
tableView.separatorStyle = .none
|
||||||
|
tableView.cellLayoutMarginsFollowReadableWidth = true
|
||||||
|
|
||||||
dataSource = UITableViewDiffableDataSource<Section, Item>(tableView: tableView, cellProvider: { (tableView, indexPath, item) -> UITableViewCell? in
|
dataSource = UITableViewDiffableDataSource<Section, Item>(tableView: tableView, cellProvider: { (tableView, indexPath, item) -> UITableViewCell? in
|
||||||
switch item {
|
switch item {
|
||||||
|
@ -125,7 +126,7 @@ class ConversationTableViewController: EnhancedTableViewController {
|
||||||
})
|
})
|
||||||
|
|
||||||
visibilityBarButtonItem = UIBarButtonItem(image: ConversationTableViewController.showPostsImage, style: .plain, target: self, action: #selector(toggleVisibilityButtonPressed))
|
visibilityBarButtonItem = UIBarButtonItem(image: ConversationTableViewController.showPostsImage, style: .plain, target: self, action: #selector(toggleVisibilityButtonPressed))
|
||||||
visibilityBarButtonItem.isSelected = showStatusesAutomatically
|
updateVisibilityBarButtonItem()
|
||||||
navigationItem.rightBarButtonItem = visibilityBarButtonItem
|
navigationItem.rightBarButtonItem = visibilityBarButtonItem
|
||||||
// disable transparent background when scroll to top because it looks weird when items earlier in the thread load in
|
// disable transparent background when scroll to top because it looks weird when items earlier in the thread load in
|
||||||
// (it remains transparent slightly too long, resulting in a flash of the content under the transparent bar)
|
// (it remains transparent slightly too long, resulting in a flash of the content under the transparent bar)
|
||||||
|
@ -138,6 +139,11 @@ class ConversationTableViewController: EnhancedTableViewController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func updateVisibilityBarButtonItem() {
|
||||||
|
visibilityBarButtonItem.isSelected = showStatusesAutomatically
|
||||||
|
visibilityBarButtonItem.accessibilityLabel = showStatusesAutomatically ? "Collapse All" : "Expand All"
|
||||||
|
}
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
private func loadMainStatus() async {
|
private func loadMainStatus() async {
|
||||||
guard loadingState == .unloaded else { return }
|
guard loadingState == .unloaded else { return }
|
||||||
|
@ -391,7 +397,7 @@ class ConversationTableViewController: EnhancedTableViewController {
|
||||||
tableView.beginUpdates()
|
tableView.beginUpdates()
|
||||||
tableView.endUpdates()
|
tableView.endUpdates()
|
||||||
|
|
||||||
visibilityBarButtonItem.isSelected = showStatusesAutomatically
|
updateVisibilityBarButtonItem()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,13 +28,13 @@ class ExpandThreadTableViewCell: UITableViewCell {
|
||||||
threadLinkView.translatesAutoresizingMaskIntoConstraints = false
|
threadLinkView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
threadLinkView.backgroundColor = tintColor.withAlphaComponent(0.5)
|
threadLinkView.backgroundColor = tintColor.withAlphaComponent(0.5)
|
||||||
threadLinkView.layer.cornerRadius = 2.5
|
threadLinkView.layer.cornerRadius = 2.5
|
||||||
addSubview(threadLinkView)
|
contentView.addSubview(threadLinkView)
|
||||||
threadLinkViewFullHeightConstraint = threadLinkView.bottomAnchor.constraint(equalTo: bottomAnchor)
|
threadLinkViewFullHeightConstraint = threadLinkView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor)
|
||||||
threadLinkViewShortHeightConstraint = threadLinkView.bottomAnchor.constraint(equalTo: avatarContainerView.topAnchor, constant: -2)
|
threadLinkViewShortHeightConstraint = threadLinkView.bottomAnchor.constraint(equalTo: avatarContainerView.topAnchor, constant: -2)
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
threadLinkView.widthAnchor.constraint(equalToConstant: 5),
|
threadLinkView.widthAnchor.constraint(equalToConstant: 5),
|
||||||
threadLinkView.centerXAnchor.constraint(equalTo: leadingAnchor, constant: 25 + 16 /* system spacing */),
|
threadLinkView.centerXAnchor.constraint(equalTo: contentView.layoutMarginsGuide.leadingAnchor, constant: 25),
|
||||||
threadLinkView.topAnchor.constraint(equalTo: topAnchor),
|
threadLinkView.topAnchor.constraint(equalTo: contentView.topAnchor),
|
||||||
threadLinkViewFullHeightConstraint,
|
threadLinkViewFullHeightConstraint,
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="iOS"/>
|
<deployment identifier="iOS"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
|
||||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="ExpandThreadTableViewCell" customModule="Tusker" customModuleProvider="target">
|
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="ExpandThreadTableViewCell" customModule="Tusker" customModuleProvider="target">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" layoutMarginsFollowReadableWidth="YES" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
</constraints>
|
</constraints>
|
||||||
</stackView>
|
</stackView>
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Kkt-hM-ScW">
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Kkt-hM-ScW">
|
||||||
<rect key="frame" x="16" y="43.5" width="304" height="0.5"/>
|
<rect key="frame" x="16" y="43.5" width="288" height="0.5"/>
|
||||||
<color key="backgroundColor" systemColor="separatorColor"/>
|
<color key="backgroundColor" systemColor="separatorColor"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="height" constant="0.5" id="Fkq-bT-IYv"/>
|
<constraint firstAttribute="height" constant="0.5" id="Fkq-bT-IYv"/>
|
||||||
|
@ -49,9 +49,9 @@
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="bottom" secondItem="Kkt-hM-ScW" secondAttribute="bottom" id="AvY-H1-0YN"/>
|
<constraint firstAttribute="bottom" secondItem="Kkt-hM-ScW" secondAttribute="bottom" id="AvY-H1-0YN"/>
|
||||||
<constraint firstItem="Kkt-hM-ScW" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="E5g-hz-SLI"/>
|
<constraint firstItem="Kkt-hM-ScW" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" id="E5g-hz-SLI"/>
|
||||||
<constraint firstItem="IXi-sc-YIw" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="SRF-Zx-Y0R"/>
|
<constraint firstItem="IXi-sc-YIw" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="SRF-Zx-Y0R"/>
|
||||||
<constraint firstAttribute="trailing" secondItem="Kkt-hM-ScW" secondAttribute="trailing" id="YML-R1-ezq"/>
|
<constraint firstAttribute="trailingMargin" secondItem="Kkt-hM-ScW" secondAttribute="trailing" id="YML-R1-ezq"/>
|
||||||
<constraint firstItem="IXi-sc-YIw" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" id="iD5-Av-ORS"/>
|
<constraint firstItem="IXi-sc-YIw" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" id="iD5-Av-ORS"/>
|
||||||
<constraint firstAttribute="bottom" secondItem="IXi-sc-YIw" secondAttribute="bottom" id="kpD-6Q-qKi"/>
|
<constraint firstAttribute="bottom" secondItem="IXi-sc-YIw" secondAttribute="bottom" id="kpD-6Q-qKi"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
|
@ -0,0 +1,113 @@
|
||||||
|
//
|
||||||
|
// AddHashtagPinnedTimelineView.swift
|
||||||
|
// Tusker
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/20/22.
|
||||||
|
// Copyright © 2022 Shadowfacts. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
import Pachyderm
|
||||||
|
|
||||||
|
struct AddHashtagPinnedTimelineView: View {
|
||||||
|
@EnvironmentObject private var mastodonController: MastodonController
|
||||||
|
@Environment(\.dismiss) private var dismiss
|
||||||
|
|
||||||
|
@Binding var pinnedTimelines: [Timeline]
|
||||||
|
@StateObject private var viewModel = SearchViewModel()
|
||||||
|
@State private var searchTask: Task<Void, Never>?
|
||||||
|
@State private var isSearching = false
|
||||||
|
@State private var searchResults: [String] = []
|
||||||
|
|
||||||
|
private var savedAndFollowedHashtags: [String] {
|
||||||
|
var tags = Set<String>()
|
||||||
|
let req = SavedHashtag.fetchRequest(account: mastodonController.accountInfo!)
|
||||||
|
for saved in (try? mastodonController.persistentContainer.viewContext.fetch(req)) ?? [] {
|
||||||
|
tags.insert(saved.name)
|
||||||
|
}
|
||||||
|
for followed in mastodonController.followedHashtags {
|
||||||
|
tags.insert(followed.name)
|
||||||
|
}
|
||||||
|
return Array(tags).sorted(using: SemiCaseSensitiveComparator())
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
NavigationView {
|
||||||
|
list
|
||||||
|
.navigationTitle("Search")
|
||||||
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
|
.searchable(text: $viewModel.searchQuery, placement: .navigationBarDrawer(displayMode: .always), prompt: Text("Search for hashtags"))
|
||||||
|
.toolbar {
|
||||||
|
ToolbarItem(placement: .cancellationAction) {
|
||||||
|
Button("Cancel") {
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.navigationViewStyle(.stack)
|
||||||
|
.onReceive(viewModel.$searchQuery, perform: { newValue in
|
||||||
|
isSearching = !newValue.isEmpty
|
||||||
|
})
|
||||||
|
.onReceive(viewModel.$searchQuery.debounce(for: .milliseconds(500), scheduler: DispatchQueue.main), perform: { _ in
|
||||||
|
searchTask?.cancel()
|
||||||
|
searchTask = Task {
|
||||||
|
try? await updateSearchResults()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
private var list: some View {
|
||||||
|
List {
|
||||||
|
Section {
|
||||||
|
if viewModel.searchQuery.isEmpty {
|
||||||
|
forEachTag(savedAndFollowedHashtags)
|
||||||
|
} else {
|
||||||
|
forEachTag(searchResults)
|
||||||
|
}
|
||||||
|
} header: {
|
||||||
|
ProgressView()
|
||||||
|
.progressViewStyle(.circular)
|
||||||
|
.opacity(isSearching ? 1 : 0)
|
||||||
|
.frame(maxWidth: .infinity, alignment: .center)
|
||||||
|
.listRowBackground(EmptyView())
|
||||||
|
.listRowSeparator(.hidden)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.listStyle(.grouped)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func forEachTag(_ tags: [String]) -> some View {
|
||||||
|
ForEach(tags, id: \.self) { tag in
|
||||||
|
Button {
|
||||||
|
pinnedTimelines.append(.tag(hashtag: tag))
|
||||||
|
dismiss()
|
||||||
|
} label: {
|
||||||
|
Text("#\(tag)")
|
||||||
|
}
|
||||||
|
.tint(.primary)
|
||||||
|
.disabled(pinnedTimelines.contains(.tag(hashtag: tag)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func updateSearchResults() async throws {
|
||||||
|
guard !viewModel.searchQuery.isEmpty else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
isSearching = true
|
||||||
|
let req = Client.search(query: viewModel.searchQuery, types: [.hashtags])
|
||||||
|
let (results, _) = try await mastodonController.run(req)
|
||||||
|
searchResults = results.hashtags.map(\.name)
|
||||||
|
isSearching = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SearchViewModel: ObservableObject {
|
||||||
|
@Published var searchQuery = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
//struct AddHashtagPinnedTimelineView_Previews: PreviewProvider {
|
||||||
|
// static var previews: some View {
|
||||||
|
// AddHashtagPinnedTimelineView()
|
||||||
|
// }
|
||||||
|
//}
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// FiltersView.swift
|
// CustomizeTimelinesView.swift
|
||||||
// Tusker
|
// Tusker
|
||||||
//
|
//
|
||||||
// Created by Shadowfacts on 11/30/22.
|
// Created by Shadowfacts on 11/30/22.
|
||||||
|
@ -9,19 +9,20 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Pachyderm
|
import Pachyderm
|
||||||
|
|
||||||
struct FiltersView: View {
|
struct CustomizeTimelinesView: View {
|
||||||
let mastodonController: MastodonController
|
let mastodonController: MastodonController
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
FiltersList()
|
CustomizeTimelinesList()
|
||||||
.environmentObject(mastodonController)
|
.environmentObject(mastodonController)
|
||||||
.environment(\.managedObjectContext, mastodonController.persistentContainer.viewContext)
|
.environment(\.managedObjectContext, mastodonController.persistentContainer.viewContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FiltersList: View {
|
struct CustomizeTimelinesList: View {
|
||||||
@EnvironmentObject private var mastodonController: MastodonController
|
@EnvironmentObject private var mastodonController: MastodonController
|
||||||
|
@ObservedObject private var preferences = Preferences.shared
|
||||||
@FetchRequest(sortDescriptors: []) private var filters: FetchedResults<FilterMO>
|
@FetchRequest(sortDescriptors: []) private var filters: FetchedResults<FilterMO>
|
||||||
@Environment(\.dismiss) private var dismiss
|
@Environment(\.dismiss) private var dismiss
|
||||||
@State private var deletionError: (any Error)?
|
@State private var deletionError: (any Error)?
|
||||||
|
@ -49,19 +50,41 @@ struct FiltersList: View {
|
||||||
|
|
||||||
private var navigationBody: some View {
|
private var navigationBody: some View {
|
||||||
List {
|
List {
|
||||||
|
PinnedTimelinesView(accountPreferences: mastodonController.accountPreferences)
|
||||||
|
|
||||||
Section {
|
Section {
|
||||||
|
Toggle(isOn: $preferences.hideReblogsInTimelines) {
|
||||||
|
Text("Hide Reblogs")
|
||||||
|
}
|
||||||
|
Toggle(isOn: $preferences.hideRepliesInTimelines) {
|
||||||
|
Text("Hide Replies")
|
||||||
|
}
|
||||||
|
} header: {
|
||||||
|
Text("Home Timeline")
|
||||||
|
}
|
||||||
|
|
||||||
|
Section {
|
||||||
|
filtersForEach(unexpiredFilters)
|
||||||
|
|
||||||
NavigationLink {
|
NavigationLink {
|
||||||
EditFilterView(filter: EditedFilter(), create: true, originallyExpired: false)
|
EditFilterView(filter: EditedFilter(), create: true, originallyExpired: false)
|
||||||
} label: {
|
} label: {
|
||||||
Label("Add Filter", systemImage: "plus")
|
Label("Add Filter", systemImage: "plus")
|
||||||
.foregroundColor(.accentColor)
|
.foregroundColor(.accentColor)
|
||||||
}
|
}
|
||||||
|
} header: {
|
||||||
|
Text("Active Filters")
|
||||||
}
|
}
|
||||||
|
|
||||||
filtersSection(unexpiredFilters, header: Text("Active"))
|
if !expiredFilters.isEmpty {
|
||||||
filtersSection(expiredFilters, header: Text("Expired"))
|
Section {
|
||||||
|
filtersForEach(expiredFilters)
|
||||||
|
} header: {
|
||||||
|
Text("Expired Filters")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.navigationTitle(Text("Filters"))
|
.navigationTitle(Text("Customize Timelines"))
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
.toolbar {
|
.toolbar {
|
||||||
ToolbarItem(placement: .confirmationAction) {
|
ToolbarItem(placement: .confirmationAction) {
|
||||||
|
@ -83,30 +106,26 @@ struct FiltersList: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private func filtersSection(_ filters: [FilterMO], header: some View) -> some View {
|
private func filtersForEach(_ filters: [FilterMO]) -> some View {
|
||||||
if !filters.isEmpty {
|
if !filters.isEmpty {
|
||||||
Section {
|
ForEach(filters, id: \.id) { filter in
|
||||||
ForEach(filters, id: \.id) { filter in
|
NavigationLink {
|
||||||
NavigationLink {
|
EditFilterView(filter: EditedFilter(filter), create: false, originallyExpired: filter.expiresAt != nil && filter.expiresAt! <= Date())
|
||||||
EditFilterView(filter: EditedFilter(filter), create: false, originallyExpired: filter.expiresAt != nil && filter.expiresAt! <= Date())
|
} label: {
|
||||||
} label: {
|
FilterRow(filter: filter)
|
||||||
FilterRow(filter: filter)
|
|
||||||
}
|
|
||||||
.contextMenu {
|
|
||||||
Button(role: .destructive) {
|
|
||||||
deleteFilter(filter)
|
|
||||||
} label: {
|
|
||||||
Label("Delete Filter", systemImage: "trash")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.onDelete { indices in
|
.contextMenu {
|
||||||
for filter in indices.map({ filters[$0] }) {
|
Button(role: .destructive) {
|
||||||
deleteFilter(filter)
|
deleteFilter(filter)
|
||||||
|
} label: {
|
||||||
|
Label("Delete Filter", systemImage: "trash")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} header: {
|
}
|
||||||
header
|
.onDelete { indices in
|
||||||
|
for filter in indices.map({ filters[$0] }) {
|
||||||
|
deleteFilter(filter)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -108,7 +108,6 @@ struct EditFilterView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Toggle("Expires", isOn: expires)
|
Toggle("Expires", isOn: expires)
|
||||||
|
|
||||||
if expires.wrappedValue {
|
if expires.wrappedValue {
|
||||||
|
@ -143,7 +142,7 @@ struct EditFilterView: View {
|
||||||
Text("Contexts")
|
Text("Contexts")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.navigationTitle("Edit Filter")
|
.navigationTitle(create ? "Add Filter" : "Edit Filter")
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
.toolbar {
|
.toolbar {
|
||||||
ToolbarItem(placement: .confirmationAction) {
|
ToolbarItem(placement: .confirmationAction) {
|
||||||
|
@ -151,7 +150,7 @@ struct EditFilterView: View {
|
||||||
ProgressView()
|
ProgressView()
|
||||||
.progressViewStyle(.circular)
|
.progressViewStyle(.circular)
|
||||||
} else {
|
} else {
|
||||||
Button(create ? "Create" : "Save") {
|
Button("Save") {
|
||||||
saveFilter()
|
saveFilter()
|
||||||
}
|
}
|
||||||
.disabled(!filter.isValid(for: mastodonController) || (!edited && originallyExpired))
|
.disabled(!filter.isValid(for: mastodonController) || (!edited && originallyExpired))
|
|
@ -0,0 +1,130 @@
|
||||||
|
//
|
||||||
|
// PinnedTimelinesView.swift
|
||||||
|
// Tusker
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/20/22.
|
||||||
|
// Copyright © 2022 Shadowfacts. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
import Pachyderm
|
||||||
|
|
||||||
|
struct PinnedTimelinesView: View {
|
||||||
|
@EnvironmentObject private var mastodonController: MastodonController
|
||||||
|
@ObservedObject private var accountPreferences: AccountPreferences
|
||||||
|
|
||||||
|
@State private var isShowingAddHashtagSheet = false
|
||||||
|
// store this separately from AccountPreferences in the view, b/c the @LazilyDecoding wrapper breaks animations
|
||||||
|
@State private var pinnedTimelines: [Timeline]
|
||||||
|
|
||||||
|
init(accountPreferences: AccountPreferences) {
|
||||||
|
self.accountPreferences = accountPreferences
|
||||||
|
self.pinnedTimelines = accountPreferences.pinnedTimelines
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
Section {
|
||||||
|
ForEach(pinnedTimelines, id: \.id) { timeline in
|
||||||
|
HStack {
|
||||||
|
Label {
|
||||||
|
if case .list(id: let id) = timeline,
|
||||||
|
let list = mastodonController.lists.first(where: { $0.id == id }) {
|
||||||
|
Text(list.title)
|
||||||
|
} else if case .tag(hashtag: let tag) = timeline {
|
||||||
|
Text(tag)
|
||||||
|
} else {
|
||||||
|
Text(timeline.title)
|
||||||
|
}
|
||||||
|
} icon: {
|
||||||
|
Image(uiImage: timeline.image.withRenderingMode(.alwaysTemplate))
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
Image(systemName: "line.3.horizontal")
|
||||||
|
.foregroundColor(Color(.lightGray))
|
||||||
|
.accessibilityHidden(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.onMove { indices, newOffset in
|
||||||
|
pinnedTimelines.move(fromOffsets: indices, toOffset: newOffset)
|
||||||
|
}
|
||||||
|
.onDelete { indices in
|
||||||
|
pinnedTimelines.remove(atOffsets: indices)
|
||||||
|
}
|
||||||
|
|
||||||
|
Menu {
|
||||||
|
ForEach([Timeline.home, .public(local: true), .public(local: false)], id: \.id) { timeline in
|
||||||
|
Button {
|
||||||
|
withAnimation {
|
||||||
|
pinnedTimelines.append(timeline)
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
Label {
|
||||||
|
Text(timeline.title)
|
||||||
|
} icon: {
|
||||||
|
Image(uiImage: timeline.image)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.disabled(pinnedTimelines.contains(timeline))
|
||||||
|
}
|
||||||
|
|
||||||
|
Menu("List…") {
|
||||||
|
ForEach(mastodonController.lists, id: \.id) { list in
|
||||||
|
Button {
|
||||||
|
withAnimation {
|
||||||
|
pinnedTimelines.append(list.timeline)
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
Text(list.title)
|
||||||
|
}
|
||||||
|
.disabled(pinnedTimelines.contains(list.timeline))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
isShowingAddHashtagSheet = true
|
||||||
|
} label: {
|
||||||
|
Label("Hashtag…", systemImage: "number")
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
Label("Add…", systemImage: "plus")
|
||||||
|
.padding(.horizontal, 20)
|
||||||
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading)
|
||||||
|
}
|
||||||
|
.listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0))
|
||||||
|
} header: {
|
||||||
|
Text("Pinned Timelines")
|
||||||
|
}
|
||||||
|
.sheet(isPresented: $isShowingAddHashtagSheet, content: {
|
||||||
|
AddHashtagPinnedTimelineView(pinnedTimelines: $pinnedTimelines)
|
||||||
|
})
|
||||||
|
.onReceive(accountPreferences.publisher(for: \.pinnedTimelinesData)) { _ in
|
||||||
|
if pinnedTimelines != accountPreferences.pinnedTimelines {
|
||||||
|
pinnedTimelines = accountPreferences.pinnedTimelines
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.onChange(of: pinnedTimelines) { newValue in
|
||||||
|
if accountPreferences.pinnedTimelines != newValue {
|
||||||
|
accountPreferences.pinnedTimelines = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fileprivate extension Timeline {
|
||||||
|
var id: String {
|
||||||
|
switch self {
|
||||||
|
case .home:
|
||||||
|
return "home"
|
||||||
|
case .public(local: let local):
|
||||||
|
return "public:\(local)"
|
||||||
|
case .list(id: let id):
|
||||||
|
return "list:\(id)"
|
||||||
|
case .tag(hashtag: let tag):
|
||||||
|
return "tag:\(tag)"
|
||||||
|
case .direct:
|
||||||
|
return "direct"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,11 +12,11 @@ import Pachyderm
|
||||||
import CoreData
|
import CoreData
|
||||||
import WebURLFoundationExtras
|
import WebURLFoundationExtras
|
||||||
|
|
||||||
class ExploreViewController: UIViewController, UICollectionViewDelegate {
|
class ExploreViewController: UIViewController, UICollectionViewDelegate, CollectionViewController {
|
||||||
|
|
||||||
weak var mastodonController: MastodonController!
|
weak var mastodonController: MastodonController!
|
||||||
|
|
||||||
private var collectionView: UICollectionView!
|
var collectionView: UICollectionView!
|
||||||
private var dataSource: UICollectionViewDiffableDataSource<Section, Item>!
|
private var dataSource: UICollectionViewDiffableDataSource<Section, Item>!
|
||||||
|
|
||||||
private(set) var resultsController: SearchResultsViewController!
|
private(set) var resultsController: SearchResultsViewController!
|
||||||
|
@ -95,15 +95,7 @@ class ExploreViewController: UIViewController, UICollectionViewDelegate {
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
super.viewWillAppear(animated)
|
super.viewWillAppear(animated)
|
||||||
|
|
||||||
// Can't use UICollectionViewController's builtin version of this because it requires
|
clearSelectionOnAppear(animated: animated)
|
||||||
// the collection view layout be passed into the constructor. Swipe actions for list collection views
|
|
||||||
// are created by passing a closure to the layout's configuration. This closure needs to capture
|
|
||||||
// `self`, so it can't be passed into the super constructor.
|
|
||||||
if let indexPaths = collectionView.indexPathsForSelectedItems {
|
|
||||||
for indexPath in indexPaths {
|
|
||||||
collectionView.deselectItem(at: indexPath, animated: true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewDidAppear(_ animated: Bool) {
|
override func viewDidAppear(_ animated: Bool) {
|
||||||
|
@ -206,23 +198,25 @@ class ExploreViewController: UIViewController, UICollectionViewDelegate {
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
private func fetchHashtagItems(followed: [FollowedHashtag]) -> [Item] {
|
private func fetchHashtagItems(followed: [FollowedHashtag]) -> [Item] {
|
||||||
let saved = (try? mastodonController.persistentContainer.viewContext.fetch(SavedHashtag.fetchRequest())) ?? []
|
let req = SavedHashtag.fetchRequest(account: mastodonController.accountInfo!)
|
||||||
|
let saved = (try? mastodonController.persistentContainer.viewContext.fetch(req)) ?? []
|
||||||
var items = saved.map {
|
var items = saved.map {
|
||||||
Item.savedHashtag(Hashtag(name: $0.name, url: $0.url))
|
Item.savedHashtag(Hashtag(name: $0.name, url: $0.url))
|
||||||
}
|
}
|
||||||
for followed in followed where !saved.contains(where: { $0.name == followed.name }) {
|
for followed in followed where !saved.contains(where: { $0.name == followed.name }) {
|
||||||
items.append(.savedHashtag(Hashtag(name: followed.name, url: followed.url)))
|
items.append(.savedHashtag(Hashtag(name: followed.name, url: followed.url)))
|
||||||
}
|
}
|
||||||
|
items = items.uniques()
|
||||||
items.sort(using: SemiCaseSensitiveComparator.keyPath(\.label))
|
items.sort(using: SemiCaseSensitiveComparator.keyPath(\.label))
|
||||||
return items
|
return items
|
||||||
}
|
}
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
private func fetchSavedInstances() -> [SavedInstance] {
|
private func fetchSavedInstances() -> [SavedInstance] {
|
||||||
let req = SavedInstance.fetchRequest()
|
let req = SavedInstance.fetchRequest(account: mastodonController.accountInfo!)
|
||||||
req.sortDescriptors = [NSSortDescriptor(key: "url.host", ascending: true)]
|
req.sortDescriptors = [NSSortDescriptor(key: "url.host", ascending: true)]
|
||||||
do {
|
do {
|
||||||
return try mastodonController.persistentContainer.viewContext.fetch(req)
|
return try mastodonController.persistentContainer.viewContext.fetch(req).uniques(by: \.url)
|
||||||
} catch {
|
} catch {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
@ -278,7 +272,8 @@ class ExploreViewController: UIViewController, UICollectionViewDelegate {
|
||||||
|
|
||||||
func removeSavedHashtag(_ hashtag: Hashtag) {
|
func removeSavedHashtag(_ hashtag: Hashtag) {
|
||||||
let context = mastodonController.persistentContainer.viewContext
|
let context = mastodonController.persistentContainer.viewContext
|
||||||
if let hashtag = try? context.fetch(SavedHashtag.fetchRequest(name: hashtag.name)).first {
|
let req = SavedHashtag.fetchRequest(name: hashtag.name, account: mastodonController.accountInfo!)
|
||||||
|
if let hashtag = try? context.fetch(req).first {
|
||||||
context.delete(hashtag)
|
context.delete(hashtag)
|
||||||
try! context.save()
|
try! context.save()
|
||||||
}
|
}
|
||||||
|
@ -286,7 +281,8 @@ class ExploreViewController: UIViewController, UICollectionViewDelegate {
|
||||||
|
|
||||||
func removeSavedInstance(_ instanceURL: URL) {
|
func removeSavedInstance(_ instanceURL: URL) {
|
||||||
let context = mastodonController.persistentContainer.viewContext
|
let context = mastodonController.persistentContainer.viewContext
|
||||||
if let instance = try? context.fetch(SavedInstance.fetchRequest(url: instanceURL)).first {
|
let req = SavedInstance.fetchRequest(url: instanceURL, account: mastodonController.accountInfo!)
|
||||||
|
if let instance = try? context.fetch(req).first {
|
||||||
context.delete(instance)
|
context.delete(instance)
|
||||||
try! context.save()
|
try! context.save()
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ class TrendingStatusesViewController: UIViewController {
|
||||||
return UICollectionViewDiffableDataSource(collectionView: collectionView) { [unowned self] collectionView, indexPath, itemIdentifier in
|
return UICollectionViewDiffableDataSource(collectionView: collectionView) { [unowned self] collectionView, indexPath, itemIdentifier in
|
||||||
switch itemIdentifier {
|
switch itemIdentifier {
|
||||||
case .status(id: let id, let collapseState, let filterState):
|
case .status(id: let id, let collapseState, let filterState):
|
||||||
let (result, attributedString) = self.filterer.resolve(state: filterState, status: { mastodonController.persistentContainer.status(for: id)! })
|
let (result, attributedString) = self.filterer.resolve(state: filterState, status: { (mastodonController.persistentContainer.status(for: id)!, false) })
|
||||||
switch result {
|
switch result {
|
||||||
case .allow, .warn(_):
|
case .allow, .warn(_):
|
||||||
return collectionView.dequeueConfiguredReusableCell(using: statusCell, for: indexPath, item: (id, collapseState, result, attributedString))
|
return collectionView.dequeueConfiguredReusableCell(using: statusCell, for: indexPath, item: (id, collapseState, result, attributedString))
|
||||||
|
|
|
@ -20,7 +20,7 @@ class LargeImageInteractionController: UIPercentDrivenInteractiveTransition {
|
||||||
super.init()
|
super.init()
|
||||||
self.viewController = viewController
|
self.viewController = viewController
|
||||||
let panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(handleGesture(_:)))
|
let panRecognizer = UIPanGestureRecognizer(target: self, action: #selector(handleGesture(_:)))
|
||||||
panRecognizer.allowedScrollTypesMask = .all
|
panRecognizer.allowedScrollTypesMask = .continuous
|
||||||
viewController.view.addGestureRecognizer(panRecognizer)
|
viewController.view.addGestureRecognizer(panRecognizer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -232,23 +232,25 @@ class MainSidebarViewController: UIViewController {
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
private func fetchHashtagItems(followed: [FollowedHashtag]) -> [Item] {
|
private func fetchHashtagItems(followed: [FollowedHashtag]) -> [Item] {
|
||||||
let saved = (try? mastodonController.persistentContainer.viewContext.fetch(SavedHashtag.fetchRequest())) ?? []
|
let req = SavedHashtag.fetchRequest(account: mastodonController.accountInfo!)
|
||||||
|
let saved = (try? mastodonController.persistentContainer.viewContext.fetch(req)) ?? []
|
||||||
var items = saved.map {
|
var items = saved.map {
|
||||||
Item.savedHashtag(Hashtag(name: $0.name, url: $0.url))
|
Item.savedHashtag(Hashtag(name: $0.name, url: $0.url))
|
||||||
}
|
}
|
||||||
for followed in followed where !saved.contains(where: { $0.name == followed.name }) {
|
for followed in followed where !saved.contains(where: { $0.name == followed.name }) {
|
||||||
items.append(.savedHashtag(Hashtag(name: followed.name, url: followed.url)))
|
items.append(.savedHashtag(Hashtag(name: followed.name, url: followed.url)))
|
||||||
}
|
}
|
||||||
|
items = items.uniques()
|
||||||
items.sort(using: SemiCaseSensitiveComparator.keyPath(\.title))
|
items.sort(using: SemiCaseSensitiveComparator.keyPath(\.title))
|
||||||
return items
|
return items
|
||||||
}
|
}
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
private func fetchSavedInstances() -> [SavedInstance] {
|
private func fetchSavedInstances() -> [SavedInstance] {
|
||||||
let req = SavedInstance.fetchRequest()
|
let req = SavedInstance.fetchRequest(account: mastodonController.accountInfo!)
|
||||||
req.sortDescriptors = [NSSortDescriptor(key: "url.host", ascending: true)]
|
req.sortDescriptors = [NSSortDescriptor(key: "url.host", ascending: true)]
|
||||||
do {
|
do {
|
||||||
return try mastodonController.persistentContainer.viewContext.fetch(req)
|
return try mastodonController.persistentContainer.viewContext.fetch(req).uniques(by: \.url)
|
||||||
} catch {
|
} catch {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,6 @@ import Pachyderm
|
||||||
|
|
||||||
class NotificationsPageViewController: SegmentedPageViewController<NotificationsPageViewController.Page> {
|
class NotificationsPageViewController: SegmentedPageViewController<NotificationsPageViewController.Page> {
|
||||||
|
|
||||||
private let notificationsTitle = NSLocalizedString("Notifications", comment: "notifications tab title")
|
|
||||||
private let mentionsTitle = NSLocalizedString("Mentions", comment: "mentions tab title")
|
|
||||||
|
|
||||||
weak var mastodonController: MastodonController!
|
weak var mastodonController: MastodonController!
|
||||||
|
|
||||||
var initialMode: NotificationsMode?
|
var initialMode: NotificationsMode?
|
||||||
|
@ -22,20 +19,14 @@ class NotificationsPageViewController: SegmentedPageViewController<Notifications
|
||||||
self.initialMode = initialMode
|
self.initialMode = initialMode
|
||||||
self.mastodonController = mastodonController
|
self.mastodonController = mastodonController
|
||||||
|
|
||||||
let notifications = NotificationsTableViewController(allowedTypes: Pachyderm.Notification.Kind.allCases, mastodonController: mastodonController)
|
super.init(pages: [.all, .mentions]) { page in
|
||||||
notifications.title = notificationsTitle
|
let vc = NotificationsTableViewController(allowedTypes: page.allowedTypes, mastodonController: mastodonController)
|
||||||
notifications.userActivity = UserActivityManager.checkNotificationsActivity(mode: .allNotifications)
|
vc.title = page.title
|
||||||
|
vc.userActivity = page.userActivity
|
||||||
|
return vc
|
||||||
|
}
|
||||||
|
|
||||||
let mentions = NotificationsTableViewController(allowedTypes: [.mention], mastodonController: mastodonController)
|
title = Page.all.title
|
||||||
mentions.title = mentionsTitle
|
|
||||||
mentions.userActivity = UserActivityManager.checkNotificationsActivity(mode: .mentionsOnly)
|
|
||||||
|
|
||||||
super.init(pages: [
|
|
||||||
(.all, notificationsTitle, notifications),
|
|
||||||
(.mentions, mentionsTitle, mentions),
|
|
||||||
])
|
|
||||||
|
|
||||||
title = notificationsTitle
|
|
||||||
tabBarItem.image = UIImage(systemName: "bell.fill")
|
tabBarItem.image = UIImage(systemName: "bell.fill")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,9 +52,40 @@ class NotificationsPageViewController: SegmentedPageViewController<Notifications
|
||||||
selectPage(page, animated: false)
|
selectPage(page, animated: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Page {
|
enum Page: SegmentedPageViewControllerPage {
|
||||||
case all
|
case all
|
||||||
case mentions
|
case mentions
|
||||||
|
|
||||||
|
var title: String {
|
||||||
|
switch self {
|
||||||
|
case .all:
|
||||||
|
return NSLocalizedString("Notifications", comment: "notifications tab title")
|
||||||
|
case .mentions:
|
||||||
|
return NSLocalizedString("Mentions", comment: "mentions tab title")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var segmentedControlTitle: String {
|
||||||
|
title
|
||||||
|
}
|
||||||
|
|
||||||
|
var allowedTypes: [Pachyderm.Notification.Kind] {
|
||||||
|
switch self {
|
||||||
|
case .all:
|
||||||
|
return Pachyderm.Notification.Kind.allCases
|
||||||
|
case .mentions:
|
||||||
|
return [.mention]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var userActivity: NSUserActivity {
|
||||||
|
switch self {
|
||||||
|
case .all:
|
||||||
|
return UserActivityManager.checkNotificationsActivity(mode: .allNotifications)
|
||||||
|
case .mentions:
|
||||||
|
return UserActivityManager.checkNotificationsActivity(mode: .mentionsOnly)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,14 +22,14 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController<
|
||||||
|
|
||||||
weak var mastodonController: MastodonController!
|
weak var mastodonController: MastodonController!
|
||||||
|
|
||||||
private let excludedTypes: [Pachyderm.Notification.Kind]
|
private let allowedTypes: [Pachyderm.Notification.Kind]
|
||||||
private let groupTypes = [Pachyderm.Notification.Kind.favourite, .reblog, .follow]
|
private let groupTypes = [Pachyderm.Notification.Kind.favourite, .reblog, .follow]
|
||||||
|
|
||||||
private var newer: RequestRange?
|
private var newer: RequestRange?
|
||||||
private var older: RequestRange?
|
private var older: RequestRange?
|
||||||
|
|
||||||
init(allowedTypes: [Pachyderm.Notification.Kind], mastodonController: MastodonController) {
|
init(allowedTypes: [Pachyderm.Notification.Kind], mastodonController: MastodonController) {
|
||||||
self.excludedTypes = Array(Set(Pachyderm.Notification.Kind.allCases).subtracting(allowedTypes))
|
self.allowedTypes = allowedTypes
|
||||||
self.mastodonController = mastodonController
|
self.mastodonController = mastodonController
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
@ -55,6 +55,17 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController<
|
||||||
tableView.register(UINib(nibName: "PollFinishedTableViewCell", bundle: .main), forCellReuseIdentifier: pollCell)
|
tableView.register(UINib(nibName: "PollFinishedTableViewCell", bundle: .main), forCellReuseIdentifier: pollCell)
|
||||||
tableView.register(UINib(nibName: "StatusUpdatedNotificationTableViewCell", bundle: .main), forCellReuseIdentifier: updatedCell)
|
tableView.register(UINib(nibName: "StatusUpdatedNotificationTableViewCell", bundle: .main), forCellReuseIdentifier: updatedCell)
|
||||||
tableView.register(UINib(nibName: "BasicTableViewCell", bundle: .main), forCellReuseIdentifier: unknownCell)
|
tableView.register(UINib(nibName: "BasicTableViewCell", bundle: .main), forCellReuseIdentifier: unknownCell)
|
||||||
|
tableView.cellLayoutMarginsFollowReadableWidth = true
|
||||||
|
}
|
||||||
|
|
||||||
|
private func request(range: RequestRange) -> Request<[Pachyderm.Notification]> {
|
||||||
|
if mastodonController.instanceFeatures.notificationsAllowedTypes {
|
||||||
|
return Client.getNotifications(allowedTypes: allowedTypes, range: range)
|
||||||
|
} else {
|
||||||
|
var types = Set(Notification.Kind.allCases)
|
||||||
|
allowedTypes.forEach { types.remove($0) }
|
||||||
|
return Client.getNotifications(excludedTypes: Array(types), range: range)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - DiffableTimelineLikeTableViewController
|
// MARK: - DiffableTimelineLikeTableViewController
|
||||||
|
@ -140,8 +151,7 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController<
|
||||||
}
|
}
|
||||||
|
|
||||||
override func loadInitialItems(completion: @escaping (LoadResult) -> Void) {
|
override func loadInitialItems(completion: @escaping (LoadResult) -> Void) {
|
||||||
let request = Client.getNotifications(excludeTypes: excludedTypes)
|
mastodonController.run(request(range: .default)) { (response) in
|
||||||
mastodonController.run(request) { (response) in
|
|
||||||
switch response {
|
switch response {
|
||||||
case let .failure(error):
|
case let .failure(error):
|
||||||
completion(.failure(.client(error)))
|
completion(.failure(.client(error)))
|
||||||
|
@ -171,8 +181,7 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController<
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let request = Client.getNotifications(excludeTypes: excludedTypes, range: older)
|
mastodonController.run(request(range: older)) { (response) in
|
||||||
mastodonController.run(request) { (response) in
|
|
||||||
switch response {
|
switch response {
|
||||||
case let .failure(error):
|
case let .failure(error):
|
||||||
completion(.failure(.client(error)))
|
completion(.failure(.client(error)))
|
||||||
|
@ -203,8 +212,7 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController<
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let request = Client.getNotifications(excludeTypes: excludedTypes, range: newer)
|
mastodonController.run(request(range: newer)) { (response) in
|
||||||
mastodonController.run(request) { (response) in
|
|
||||||
switch response {
|
switch response {
|
||||||
case let .failure(error):
|
case let .failure(error):
|
||||||
completion(.failure(.client(error)))
|
completion(.failure(.client(error)))
|
||||||
|
|
|
@ -39,7 +39,7 @@ class OnboardingViewController: UINavigationController {
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
private func tryLoginTo(instanceURL: URL) async throws {
|
private func tryLoginTo(instanceURL: URL) async throws {
|
||||||
let mastodonController = MastodonController(instanceURL: instanceURL)
|
let mastodonController = MastodonController(instanceURL: instanceURL, transient: true)
|
||||||
let clientID: String
|
let clientID: String
|
||||||
let clientSecret: String
|
let clientSecret: String
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -0,0 +1,92 @@
|
||||||
|
//
|
||||||
|
// AboutView.swift
|
||||||
|
// Tusker
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/21/22.
|
||||||
|
// Copyright © 2022 Shadowfacts. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct AboutView: View {
|
||||||
|
private var version: String {
|
||||||
|
let marketing = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
|
||||||
|
let build = Bundle.main.infoDictionary?["CFBundleVersion"] as? String
|
||||||
|
return "\(marketing ?? "<unknown>") (\(build ?? "<unknown>"))"
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
List {
|
||||||
|
iconOrGame
|
||||||
|
.frame(maxWidth: .infinity, alignment: .center)
|
||||||
|
.listRowInsets(EdgeInsets(top: 9, leading: 0, bottom: 0, trailing: 0))
|
||||||
|
.listRowBackground(EmptyView())
|
||||||
|
|
||||||
|
Section {
|
||||||
|
HStack {
|
||||||
|
Text("Version")
|
||||||
|
Spacer()
|
||||||
|
Text(version)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
.contextMenu {
|
||||||
|
Button {
|
||||||
|
UIPasteboard.general.string = version
|
||||||
|
} label: {
|
||||||
|
Label("Copy", systemImage: "doc.on.doc")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Section {
|
||||||
|
Link("Website", destination: URL(string: "https://vaccor.space/tusker")!)
|
||||||
|
Link("Source Code", destination: URL(string: "https://git.shadowfacts.net/shadowfacts/Tusker")!)
|
||||||
|
Link("Issue Tracker", destination: URL(string: "https://git.shadowfacts.net/shadowfacts/Tusker/issues")!)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private var iconOrGame: some View {
|
||||||
|
if #available(iOS 16.0, *) {
|
||||||
|
FlipView {
|
||||||
|
appIcon
|
||||||
|
} back: {
|
||||||
|
TTTView()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
appIcon
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var appIcon: some View {
|
||||||
|
VStack {
|
||||||
|
AppIconView()
|
||||||
|
.shadow(radius: 6, y: 3)
|
||||||
|
.frame(width: 256, height: 256)
|
||||||
|
|
||||||
|
Text("Tusker")
|
||||||
|
.font(.title2.bold())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct AppIconView: UIViewRepresentable {
|
||||||
|
func makeUIView(context: Context) -> UIImageView {
|
||||||
|
let view = UIImageView(image: UIImage(named: "AboutIcon"))
|
||||||
|
view.contentMode = .scaleAspectFit
|
||||||
|
view.layer.cornerRadius = 256 / 6.4
|
||||||
|
view.layer.cornerCurve = .continuous
|
||||||
|
view.layer.masksToBounds = true
|
||||||
|
return view
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateUIView(_ uiView: UIImageView, context: Context) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct AboutView_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
AboutView()
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,116 @@
|
||||||
|
//
|
||||||
|
// FlipView.swift
|
||||||
|
// Tusker
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/21/22.
|
||||||
|
// Copyright © 2022 Shadowfacts. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
// Based on https://stackoverflow.com/a/60807269
|
||||||
|
struct FlipView<Front: View, Back: View> : View {
|
||||||
|
private let front: Front
|
||||||
|
private let back: Back
|
||||||
|
|
||||||
|
@State private var flipped = false
|
||||||
|
@State private var angle: Angle = .zero
|
||||||
|
@State private var width: CGFloat = 0
|
||||||
|
@State private var initialFlipped: Bool!
|
||||||
|
|
||||||
|
init(@ViewBuilder front: () -> Front, @ViewBuilder back: () -> Back) {
|
||||||
|
self.front = front()
|
||||||
|
self.back = back()
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
ZStack {
|
||||||
|
front
|
||||||
|
.opacity(flipped ? 0.0 : 1.0)
|
||||||
|
back
|
||||||
|
.rotation3DEffect(.degrees(180), axis: (0, 1, 0))
|
||||||
|
.opacity(flipped ? 1.0 : 0.0)
|
||||||
|
}
|
||||||
|
.modifier(FlipEffect(flipped: $flipped, angle: angle.degrees, axis: (x: 0, y: 1)))
|
||||||
|
.background(GeometryReader { proxy in
|
||||||
|
Color.clear
|
||||||
|
.preference(key: WidthPrefKey.self, value: proxy.size.width)
|
||||||
|
.onPreferenceChange(WidthPrefKey.self) { newValue in
|
||||||
|
width = newValue
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.gesture(
|
||||||
|
DragGesture()
|
||||||
|
.onChanged({ value in
|
||||||
|
if initialFlipped == nil {
|
||||||
|
initialFlipped = flipped
|
||||||
|
}
|
||||||
|
let adj = (width / 2) - value.location.x
|
||||||
|
let hyp = abs((width / 2) - value.startLocation.x)
|
||||||
|
let clamped: Double = min(max(adj / hyp, -1), 1)
|
||||||
|
let startedOnRight = value.startLocation.x > width / 2
|
||||||
|
angle = .radians(acos(clamped) + (startedOnRight != initialFlipped ? .pi : 0))
|
||||||
|
})
|
||||||
|
.onEnded({ value in
|
||||||
|
initialFlipped = nil
|
||||||
|
let deg = angle.degrees.truncatingRemainder(dividingBy: 360)
|
||||||
|
if deg == 0 {
|
||||||
|
angle = .zero
|
||||||
|
} else if deg == 180 {
|
||||||
|
angle = .degrees(180)
|
||||||
|
} else {
|
||||||
|
withAnimation(.easeInOut(duration: 0.25)) {
|
||||||
|
angle = deg > 90 && deg < 270 ? .degrees(180) : .zero
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.onTapGesture {
|
||||||
|
withAnimation(.easeInOut(duration: 0.5)) {
|
||||||
|
angle = angle == .zero ? .degrees(180) : .zero
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Based on https://swiftui-lab.com/swiftui-animations-part2/
|
||||||
|
struct FlipEffect: GeometryEffect {
|
||||||
|
var animatableData: Double {
|
||||||
|
get { angle }
|
||||||
|
set { angle = newValue }
|
||||||
|
}
|
||||||
|
|
||||||
|
@Binding var flipped: Bool
|
||||||
|
var angle: Double
|
||||||
|
let axis: (x: CGFloat, y: CGFloat)
|
||||||
|
|
||||||
|
func effectValue(size: CGSize) -> ProjectionTransform {
|
||||||
|
// We schedule the change to be done after the view has finished drawing,
|
||||||
|
// otherwise, we would receive a runtime error, indicating we are changing
|
||||||
|
// the state while the view is being drawn.
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
self.flipped = self.angle >= 90 && self.angle < 270
|
||||||
|
}
|
||||||
|
|
||||||
|
let a = CGFloat(Angle.degrees(angle).radians)
|
||||||
|
|
||||||
|
var transform3d = CATransform3DIdentity
|
||||||
|
transform3d.m34 = -1/max(size.width, size.height)
|
||||||
|
|
||||||
|
transform3d = CATransform3DRotate(transform3d, a, axis.x, axis.y, 0)
|
||||||
|
transform3d = CATransform3DTranslate(transform3d, -size.width/2.0, -size.height/2.0, 0)
|
||||||
|
|
||||||
|
let affineTransform = ProjectionTransform(CGAffineTransform(translationX: size.width/2.0, y: size.height / 2.0))
|
||||||
|
|
||||||
|
return ProjectionTransform(transform3d).concatenating(affineTransform)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private struct WidthPrefKey: PreferenceKey {
|
||||||
|
static var defaultValue: CGFloat = 0
|
||||||
|
|
||||||
|
static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) {
|
||||||
|
value = nextValue()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
//
|
||||||
|
// TTTView.swift
|
||||||
|
// Tusker
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/21/22.
|
||||||
|
// Copyright © 2022 Shadowfacts. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
import TTTKit
|
||||||
|
import GameKit
|
||||||
|
import OSLog
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct TTTView: View {
|
||||||
|
static let aiQueue = DispatchQueue(label: "TTT AI Strategist", qos: .userInitiated)
|
||||||
|
|
||||||
|
@StateObject private var controller = GameController()
|
||||||
|
@State private var isAIThinking = false
|
||||||
|
@State private var strategist = {
|
||||||
|
let strategist = GKMinmaxStrategist()
|
||||||
|
strategist.maxLookAheadDepth = 5
|
||||||
|
return strategist
|
||||||
|
}()
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
VStack(alignment: .center) {
|
||||||
|
GameView(controller: controller)
|
||||||
|
.frame(width: 256, height: 256)
|
||||||
|
|
||||||
|
if isAIThinking {
|
||||||
|
ProgressView()
|
||||||
|
.progressViewStyle(.circular)
|
||||||
|
} else {
|
||||||
|
Text(controller.state.displayName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.onReceive(controller.$state) { newState in
|
||||||
|
switch newState {
|
||||||
|
case .playAnywhere(.o), .playSpecific(.o, column: _, row: _):
|
||||||
|
isAIThinking = true
|
||||||
|
TTTView.aiQueue.async {
|
||||||
|
let gameModel = GameModel(controller: controller)
|
||||||
|
strategist.gameModel = gameModel
|
||||||
|
let move = strategist.bestMoveForActivePlayer()!
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
gameModel.apply(move)
|
||||||
|
isAIThinking = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 16.0, *)
|
||||||
|
struct TTTView_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
TTTView()
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,301 @@
|
||||||
|
//
|
||||||
|
// AcknowledgementsView.swift
|
||||||
|
// Tusker
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/21/22.
|
||||||
|
// Copyright © 2022 Shadowfacts. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct AcknowledgementsView: View {
|
||||||
|
var body: some View {
|
||||||
|
ScrollView(.vertical) {
|
||||||
|
Text(text)
|
||||||
|
.padding(.horizontal, 16)
|
||||||
|
}
|
||||||
|
.navigationTitle("Acknowledgements")
|
||||||
|
}
|
||||||
|
|
||||||
|
private var text: AttributedString {
|
||||||
|
var attrStr = try! AttributedString(markdown: """
|
||||||
|
^[[BlurHash](https://github.com/woltapp/blurhash)](headingLevel: 2)
|
||||||
|
Copyright (c) 2018 Wolt Enterprises
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
^[[SwiftSoup](https://github.com/scinfu/swiftsoup)](headingLevel: 2)
|
||||||
|
Copyright (c) 2016 Nabil Chatbi
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
Symbols
|
||||||
|
Symbol outline not available for this file
|
||||||
|
To inspect a symbol, try clicking on the symbol directly in the code view.
|
||||||
|
Code navigation supports a limited number of languages. See which languages are supported.
|
||||||
|
|
||||||
|
^[[swift-url](https://github.com/karwa/swift-url)](headingLevel: 2)
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
^[[ScreenCorners](https://github.com/kylebshr/screencorners)](headingLevel: 2)
|
||||||
|
|
||||||
|
Copyright (c) 2020 Kyle Bashour
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
^[[Sentry](https://github.com/getsentry/sentry-cocoa)](headingLevel: 2)
|
||||||
|
|
||||||
|
Copyright (c) 2015 Sentry
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
""", including: AttributeScopes.HeadingAttributes.self, options: .init(allowsExtendedAttributes: true, interpretedSyntax: .inlineOnlyPreservingWhitespace))
|
||||||
|
|
||||||
|
for (level, range) in attrStr.runs[\.headingLevel].reversed() {
|
||||||
|
guard let level else { continue }
|
||||||
|
attrStr[range].font = .system(level == 1 ? .title : level == 2 ? .title2 : level == 3 ? .title3 : .body).bold()
|
||||||
|
}
|
||||||
|
|
||||||
|
return attrStr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private extension AttributeScopes {
|
||||||
|
struct HeadingAttributes: AttributeScope {
|
||||||
|
let headingLevel: HeadingLevelAttributes
|
||||||
|
}
|
||||||
|
|
||||||
|
var headingAttributes: HeadingAttributes.Type { HeadingAttributes.self }
|
||||||
|
}
|
||||||
|
|
||||||
|
private enum HeadingLevelAttributes: CodableAttributedStringKey, MarkdownDecodableAttributedStringKey {
|
||||||
|
public typealias Value = Int
|
||||||
|
|
||||||
|
public static var name = "headingLevel"
|
||||||
|
}
|
||||||
|
|
||||||
|
private extension AttributeDynamicLookup {
|
||||||
|
subscript<T: AttributedStringKey>(dynamicMember keyPath: KeyPath<AttributeScopes.HeadingAttributes, T>) -> T {
|
||||||
|
return self[T.self]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct AcknowledgementsView_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
AcknowledgementsView()
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,15 +8,18 @@
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Pachyderm
|
import Pachyderm
|
||||||
import CoreData
|
import CoreData
|
||||||
|
import CloudKit
|
||||||
|
|
||||||
struct AdvancedPrefsView : View {
|
struct AdvancedPrefsView : View {
|
||||||
@ObservedObject var preferences = Preferences.shared
|
@ObservedObject var preferences = Preferences.shared
|
||||||
@State private var imageCacheSize: Int64 = 0
|
@State private var imageCacheSize: Int64 = 0
|
||||||
@State private var mastodonCacheSize: Int64 = 0
|
@State private var mastodonCacheSize: Int64 = 0
|
||||||
|
@State private var cloudKitStatus: CKAccountStatus?
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
List {
|
List {
|
||||||
formattingSection
|
formattingSection
|
||||||
|
cloudKitSection
|
||||||
errorReportingSection
|
errorReportingSection
|
||||||
cachingSection
|
cachingSection
|
||||||
}
|
}
|
||||||
|
@ -49,6 +52,39 @@ struct AdvancedPrefsView : View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var cloudKitSection: some View {
|
||||||
|
Section {
|
||||||
|
HStack {
|
||||||
|
Text("iCloud Status")
|
||||||
|
Spacer()
|
||||||
|
switch cloudKitStatus {
|
||||||
|
case nil:
|
||||||
|
EmptyView()
|
||||||
|
case .available:
|
||||||
|
Text("Available")
|
||||||
|
case .couldNotDetermine:
|
||||||
|
Text("Could not determine")
|
||||||
|
case .noAccount:
|
||||||
|
Text("No account")
|
||||||
|
case .restricted:
|
||||||
|
Text("Restricted")
|
||||||
|
case .temporarilyUnavailable:
|
||||||
|
Text("Temporarily Unavailable")
|
||||||
|
@unknown default:
|
||||||
|
Text(String(describing: cloudKitStatus!))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.task {
|
||||||
|
CKContainer.default().accountStatus { status, error in
|
||||||
|
if let error {
|
||||||
|
Logging.general.error("Unable to get CloudKit status: \(String(describing: error))")
|
||||||
|
} else {
|
||||||
|
self.cloudKitStatus = status
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var errorReportingSection: some View {
|
var errorReportingSection: some View {
|
||||||
Section {
|
Section {
|
||||||
Toggle("Report Errors Automatically", isOn: $preferences.reportErrorsAutomatically)
|
Toggle("Report Errors Automatically", isOn: $preferences.reportErrorsAutomatically)
|
||||||
|
|
|
@ -37,6 +37,10 @@ struct MediaPrefsView: View {
|
||||||
Toggle(isOn: $preferences.automaticallyPlayGifs) {
|
Toggle(isOn: $preferences.automaticallyPlayGifs) {
|
||||||
Text("Automatically Play GIFs")
|
Text("Automatically Play GIFs")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Toggle(isOn: $preferences.showUncroppedMediaInline) {
|
||||||
|
Text("Show Uncropped Media Inline")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
import TTTKit
|
||||||
|
|
||||||
struct PreferencesView: View {
|
struct PreferencesView: View {
|
||||||
let mastodonController: MastodonController
|
let mastodonController: MastodonController
|
||||||
|
@ -96,6 +97,15 @@ struct PreferencesView: View {
|
||||||
Text("Advanced")
|
Text("Advanced")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Section {
|
||||||
|
NavigationLink("About") {
|
||||||
|
AboutView()
|
||||||
|
}
|
||||||
|
NavigationLink("Acknowledgements") {
|
||||||
|
AcknowledgementsView()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.listStyle(InsetGroupedListStyle())
|
.listStyle(InsetGroupedListStyle())
|
||||||
.navigationBarTitle(Text("Preferences"), displayMode: .inline)
|
.navigationBarTitle(Text("Preferences"), displayMode: .inline)
|
||||||
|
|
|
@ -10,7 +10,7 @@ import UIKit
|
||||||
import Pachyderm
|
import Pachyderm
|
||||||
import Combine
|
import Combine
|
||||||
|
|
||||||
class ProfileStatusesViewController: UIViewController, TimelineLikeCollectionViewController {
|
class ProfileStatusesViewController: UIViewController, TimelineLikeCollectionViewController, CollectionViewController {
|
||||||
|
|
||||||
weak var owner: ProfileViewController?
|
weak var owner: ProfileViewController?
|
||||||
let mastodonController: MastodonController
|
let mastodonController: MastodonController
|
||||||
|
@ -103,13 +103,28 @@ class ProfileStatusesViewController: UIViewController, TimelineLikeCollectionVie
|
||||||
.sink { [unowned self] id in
|
.sink { [unowned self] id in
|
||||||
switch state {
|
switch state {
|
||||||
case .unloaded:
|
case .unloaded:
|
||||||
Task {
|
Task { [self] in
|
||||||
await load()
|
await self.load()
|
||||||
}
|
}
|
||||||
case .loaded, .setupInitialSnapshot:
|
case .loaded, .setupInitialSnapshot:
|
||||||
var snapshot = dataSource.snapshot()
|
var snapshot = self.dataSource.snapshot()
|
||||||
snapshot.reconfigureItems([.header(id)])
|
snapshot.reconfigureItems([.header(id)])
|
||||||
dataSource.apply(snapshot, animatingDifferences: true)
|
self.dataSource.apply(snapshot, animatingDifferences: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.store(in: &cancellables)
|
||||||
|
|
||||||
|
mastodonController.persistentContainer.relationshipSubject
|
||||||
|
.receive(on: DispatchQueue.main)
|
||||||
|
.filter { [unowned self] in $0 == self.accountID }
|
||||||
|
.sink { [unowned self] id in
|
||||||
|
switch state {
|
||||||
|
case .unloaded:
|
||||||
|
break
|
||||||
|
case .loaded, .setupInitialSnapshot:
|
||||||
|
var snapshot = self.dataSource.snapshot()
|
||||||
|
snapshot.reconfigureItems([.header(id)])
|
||||||
|
self.dataSource.apply(snapshot, animatingDifferences: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
@ -132,6 +147,7 @@ class ProfileStatusesViewController: UIViewController, TimelineLikeCollectionVie
|
||||||
switch itemIdentifier {
|
switch itemIdentifier {
|
||||||
case .header(let id):
|
case .header(let id):
|
||||||
if let headerCell = self.headerCell {
|
if let headerCell = self.headerCell {
|
||||||
|
headerCell.view?.updateUI(for: id)
|
||||||
return headerCell
|
return headerCell
|
||||||
} else {
|
} else {
|
||||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "headerCell", for: indexPath) as! ProfileHeaderCollectionViewCell
|
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "headerCell", for: indexPath) as! ProfileHeaderCollectionViewCell
|
||||||
|
@ -145,6 +161,7 @@ class ProfileStatusesViewController: UIViewController, TimelineLikeCollectionVie
|
||||||
view.pagesSegmentedControl.setSelectedOption(self.owner!.currentPage, animated: false)
|
view.pagesSegmentedControl.setSelectedOption(self.owner!.currentPage, animated: false)
|
||||||
cell.addHeader(view)
|
cell.addHeader(view)
|
||||||
case .useExistingView(let view):
|
case .useExistingView(let view):
|
||||||
|
view.updateUI(for: id)
|
||||||
cell.addHeader(view)
|
cell.addHeader(view)
|
||||||
case .placeholder(height: let height):
|
case .placeholder(height: let height):
|
||||||
_ = cell.addConstraint(height: height)
|
_ = cell.addConstraint(height: height)
|
||||||
|
@ -171,9 +188,7 @@ class ProfileStatusesViewController: UIViewController, TimelineLikeCollectionVie
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
super.viewWillAppear(animated)
|
super.viewWillAppear(animated)
|
||||||
|
|
||||||
collectionView.indexPathsForSelectedItems?.forEach {
|
clearSelectionOnAppear(animated: animated)
|
||||||
collectionView.deselectItem(at: $0, animated: true)
|
|
||||||
}
|
|
||||||
|
|
||||||
Task {
|
Task {
|
||||||
if case .notLoadedInitial = controller.state {
|
if case .notLoadedInitial = controller.state {
|
||||||
|
@ -205,6 +220,13 @@ class ProfileStatusesViewController: UIViewController, TimelineLikeCollectionVie
|
||||||
|
|
||||||
state = .setupInitialSnapshot
|
state = .setupInitialSnapshot
|
||||||
|
|
||||||
|
Task {
|
||||||
|
if let (all, _) = try? await mastodonController.run(Client.getRelationships(accounts: [accountID])),
|
||||||
|
let relationship = all.first {
|
||||||
|
self.mastodonController.persistentContainer.addOrUpdate(relationship: relationship)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await controller.loadInitial()
|
await controller.loadInitial()
|
||||||
await tryLoadPinned()
|
await tryLoadPinned()
|
||||||
|
|
||||||
|
@ -261,7 +283,11 @@ class ProfileStatusesViewController: UIViewController, TimelineLikeCollectionVie
|
||||||
let status = {
|
let status = {
|
||||||
let status = self.mastodonController.persistentContainer.status(for: statusID)!
|
let status = self.mastodonController.persistentContainer.status(for: statusID)!
|
||||||
// if the status is a reblog of another one, filter based on that one
|
// if the status is a reblog of another one, filter based on that one
|
||||||
return status.reblog ?? status
|
if let reblogged = status.reblog {
|
||||||
|
return (reblogged, true)
|
||||||
|
} else {
|
||||||
|
return (status, false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return filterer.resolve(state: state, status: status)
|
return filterer.resolve(state: state, status: status)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
import Pachyderm
|
import Pachyderm
|
||||||
|
|
||||||
class StatusActionAccountListViewController: UIViewController {
|
class StatusActionAccountListViewController: UIViewController, CollectionViewController {
|
||||||
|
|
||||||
private let mastodonController: MastodonController
|
private let mastodonController: MastodonController
|
||||||
private let actionType: ActionType
|
private let actionType: ActionType
|
||||||
|
@ -20,8 +20,8 @@ class StatusActionAccountListViewController: UIViewController {
|
||||||
/// If `true`, a warning will be shown below the account list describing that the total favs/reblogs may be innacurate.
|
/// If `true`, a warning will be shown below the account list describing that the total favs/reblogs may be innacurate.
|
||||||
var showInacurateCountWarning = false
|
var showInacurateCountWarning = false
|
||||||
|
|
||||||
private var collectionView: UICollectionView {
|
var collectionView: UICollectionView! {
|
||||||
view as! UICollectionView
|
view as? UICollectionView
|
||||||
}
|
}
|
||||||
private var dataSource: UICollectionViewDiffableDataSource<Section, Item>!
|
private var dataSource: UICollectionViewDiffableDataSource<Section, Item>!
|
||||||
|
|
||||||
|
@ -120,9 +120,7 @@ class StatusActionAccountListViewController: UIViewController {
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
super.viewWillAppear(animated)
|
super.viewWillAppear(animated)
|
||||||
|
|
||||||
collectionView.indexPathsForSelectedItems?.forEach {
|
clearSelectionOnAppear(animated: animated)
|
||||||
collectionView.deselectItem(at: $0, animated: true)
|
|
||||||
}
|
|
||||||
|
|
||||||
if accountIDs == nil {
|
if accountIDs == nil {
|
||||||
Task {
|
Task {
|
||||||
|
|
|
@ -16,7 +16,8 @@ class HashtagTimelineViewController: TimelineViewController {
|
||||||
var toggleSaveButton: UIBarButtonItem!
|
var toggleSaveButton: UIBarButtonItem!
|
||||||
|
|
||||||
private var isHashtagSaved: Bool {
|
private var isHashtagSaved: Bool {
|
||||||
mastodonController.persistentContainer.viewContext.objectExists(for: SavedHashtag.fetchRequest(name: hashtag.name))
|
let req = SavedHashtag.fetchRequest(name: hashtag.name, account: mastodonController.accountInfo!)
|
||||||
|
return mastodonController.persistentContainer.viewContext.objectExists(for: req)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var isHashtagFollowed: Bool {
|
private var isHashtagFollowed: Bool {
|
||||||
|
@ -47,10 +48,10 @@ class HashtagTimelineViewController: TimelineViewController {
|
||||||
|
|
||||||
private func toggleSave() {
|
private func toggleSave() {
|
||||||
let context = mastodonController.persistentContainer.viewContext
|
let context = mastodonController.persistentContainer.viewContext
|
||||||
if let existing = try? context.fetch(SavedHashtag.fetchRequest(name: hashtag.name)).first {
|
if let existing = try? context.fetch(SavedHashtag.fetchRequest(name: hashtag.name, account: mastodonController.accountInfo!)).first {
|
||||||
context.delete(existing)
|
context.delete(existing)
|
||||||
} else {
|
} else {
|
||||||
_ = SavedHashtag(hashtag: hashtag, context: context)
|
_ = SavedHashtag(hashtag: hashtag, account: mastodonController.accountInfo!, context: context)
|
||||||
}
|
}
|
||||||
mastodonController.persistentContainer.save(context: context)
|
mastodonController.persistentContainer.save(context: context)
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,8 @@ class InstanceTimelineViewController: TimelineViewController {
|
||||||
private var toggleSaveButton: UIBarButtonItem!
|
private var toggleSaveButton: UIBarButtonItem!
|
||||||
|
|
||||||
private var isInstanceSaved: Bool {
|
private var isInstanceSaved: Bool {
|
||||||
parentMastodonController!.persistentContainer.viewContext.objectExists(for: SavedInstance.fetchRequest(url: instanceURL))
|
let req = SavedInstance.fetchRequest(url: instanceURL, account: parentMastodonController!.accountInfo!)
|
||||||
|
return parentMastodonController!.persistentContainer.viewContext.objectExists(for: req)
|
||||||
}
|
}
|
||||||
private var toggleSaveButtonTitle: String {
|
private var toggleSaveButtonTitle: String {
|
||||||
if isInstanceSaved {
|
if isInstanceSaved {
|
||||||
|
@ -83,12 +84,13 @@ class InstanceTimelineViewController: TimelineViewController {
|
||||||
// MARK: - Interaction
|
// MARK: - Interaction
|
||||||
@objc func toggleSaveButtonPressed() {
|
@objc func toggleSaveButtonPressed() {
|
||||||
let context = parentMastodonController!.persistentContainer.viewContext
|
let context = parentMastodonController!.persistentContainer.viewContext
|
||||||
let existing = try? context.fetch(SavedInstance.fetchRequest(url: instanceURL)).first
|
let req = SavedInstance.fetchRequest(url: instanceURL, account: parentMastodonController!.accountInfo!)
|
||||||
|
let existing = try? context.fetch(req).first
|
||||||
if let existing = existing {
|
if let existing = existing {
|
||||||
context.delete(existing)
|
context.delete(existing)
|
||||||
delegate?.didUnsaveInstance(url: instanceURL)
|
delegate?.didUnsaveInstance(url: instanceURL)
|
||||||
} else {
|
} else {
|
||||||
_ = SavedInstance(url: instanceURL, context: context)
|
_ = SavedInstance(url: instanceURL, account: parentMastodonController!.accountInfo!, context: context)
|
||||||
delegate?.didSaveInstance(url: instanceURL)
|
delegate?.didSaveInstance(url: instanceURL)
|
||||||
}
|
}
|
||||||
mastodonController.persistentContainer.save(context: context)
|
mastodonController.persistentContainer.save(context: context)
|
||||||
|
|
|
@ -25,6 +25,7 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
private(set) var collectionView: UICollectionView!
|
private(set) var collectionView: UICollectionView!
|
||||||
private(set) var dataSource: UICollectionViewDiffableDataSource<Section, Item>!
|
private(set) var dataSource: UICollectionViewDiffableDataSource<Section, Item>!
|
||||||
|
|
||||||
|
private var cancellables = Set<AnyCancellable>()
|
||||||
private var contentOffsetObservation: NSKeyValueObservation?
|
private var contentOffsetObservation: NSKeyValueObservation?
|
||||||
private var activityToRestore: NSUserActivity?
|
private var activityToRestore: NSUserActivity?
|
||||||
// the last time this VC disappeared or the scene was backgrounded while it was active, used to decide if we want to check for present when reappearing
|
// the last time this VC disappeared or the scene was backgrounded while it was active, used to decide if we want to check for present when reappearing
|
||||||
|
@ -121,6 +122,21 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
|
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(sceneWillEnterForeground), name: UIScene.willEnterForegroundNotification, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(sceneWillEnterForeground), name: UIScene.willEnterForegroundNotification, object: nil)
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(sceneDidEnterBackground), name: UIScene.didEnterBackgroundNotification, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(sceneDidEnterBackground), name: UIScene.didEnterBackgroundNotification, object: nil)
|
||||||
|
NotificationCenter.default.publisher(for: .timelinePositionChanged)
|
||||||
|
.filter { [unowned self] in
|
||||||
|
if let timelinePosition = $0.object as? TimelinePosition,
|
||||||
|
timelinePosition.accountID == self.mastodonController.accountInfo?.id,
|
||||||
|
timelinePosition.timeline == self.timeline {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.debounce(for: .milliseconds(500), scheduler: DispatchQueue.main)
|
||||||
|
.sink { [unowned self] _ in
|
||||||
|
_ = syncPositionIfNecessary(alwaysPrompt: true)
|
||||||
|
}
|
||||||
|
.store(in: &cancellables)
|
||||||
}
|
}
|
||||||
|
|
||||||
// separate method because InstanceTimelineViewController needs to be able to customize it
|
// separate method because InstanceTimelineViewController needs to be able to customize it
|
||||||
|
@ -194,22 +210,18 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
super.viewWillAppear(animated)
|
super.viewWillAppear(animated)
|
||||||
|
|
||||||
collectionView.indexPathsForSelectedItems?.forEach {
|
clearSelectionOnAppear(animated: animated)
|
||||||
collectionView.deselectItem(at: $0, animated: true)
|
|
||||||
}
|
|
||||||
|
|
||||||
if case .notLoadedInitial = controller.state {
|
if case .notLoadedInitial = controller.state {
|
||||||
if restoreState() {
|
Task {
|
||||||
Task {
|
if await restoreState() {
|
||||||
await checkPresent(jumpImmediately: false)
|
await checkPresent(jumpImmediately: false)
|
||||||
}
|
} else {
|
||||||
} else {
|
|
||||||
Task {
|
|
||||||
await controller.loadInitial()
|
await controller.loadInitial()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
checkPresentIfEnoughTimeElapsed()
|
syncAndCheckPresentIfEnoughTimeElapsed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,19 +245,29 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
saveState()
|
saveState()
|
||||||
}
|
}
|
||||||
|
|
||||||
private func saveState() {
|
private func currentCenterVisibleIndexPath(snapshot: NSDiffableDataSourceSnapshot<Section, Item>?) -> IndexPath? {
|
||||||
guard isViewLoaded,
|
let snapshot = snapshot ?? dataSource.snapshot()
|
||||||
persistsState else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let visible = collectionView.indexPathsForVisibleItems.sorted()
|
let visible = collectionView.indexPathsForVisibleItems.sorted()
|
||||||
let snapshot = dataSource.snapshot()
|
|
||||||
let visibleRect = CGRect(origin: collectionView.contentOffset, size: collectionView.bounds.size)
|
let visibleRect = CGRect(origin: collectionView.contentOffset, size: collectionView.bounds.size)
|
||||||
let midPoint = CGPoint(x: visibleRect.midX, y: visibleRect.midY)
|
let midPoint = CGPoint(x: visibleRect.midX, y: visibleRect.midY)
|
||||||
guard !visible.isEmpty,
|
guard !visible.isEmpty,
|
||||||
let statusesSection = snapshot.sectionIdentifiers.firstIndex(of: .statuses),
|
let statusesSection = snapshot.sectionIdentifiers.firstIndex(of: .statuses),
|
||||||
let rawCenterVisible = collectionView.indexPathForItem(at: midPoint),
|
let rawCenterVisible = collectionView.indexPathForItem(at: midPoint),
|
||||||
let centerVisible = visible.first(where: { $0.section == statusesSection && $0 >= rawCenterVisible }) else {
|
let centerVisible = visible.first(where: { $0.section == statusesSection && $0 >= rawCenterVisible }) else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return centerVisible
|
||||||
|
}
|
||||||
|
|
||||||
|
private func saveState() {
|
||||||
|
guard isViewLoaded,
|
||||||
|
persistsState,
|
||||||
|
let accountInfo = mastodonController.accountInfo else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let snapshot = dataSource.snapshot()
|
||||||
|
guard let centerVisible = currentCenterVisibleIndexPath(snapshot: snapshot) else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let allItems = snapshot.itemIdentifiers(inSection: .statuses)
|
let allItems = snapshot.itemIdentifiers(inSection: .statuses)
|
||||||
|
@ -288,10 +310,11 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
}
|
}
|
||||||
stateRestorationLogger.debug("TimelineViewController: saving state to persistent store with with centerID \(centerVisibleID)")
|
stateRestorationLogger.debug("TimelineViewController: saving state to persistent store with with centerID \(centerVisibleID)")
|
||||||
|
|
||||||
let state = mastodonController.persistentContainer.getTimelineState(timeline: timeline) ?? TimelineState(timeline: timeline, context: mastodonController.persistentContainer.viewContext)
|
let context = mastodonController.persistentContainer.viewContext
|
||||||
state.setStatuses(ids)
|
let position = mastodonController.persistentContainer.getTimelinePosition(timeline: timeline) ?? TimelinePosition(timeline: timeline, account: accountInfo, context: context)
|
||||||
state.centerStatusID = centerVisibleID
|
position.statusIDs = ids
|
||||||
mastodonController.persistentContainer.save(context: mastodonController.persistentContainer.viewContext)
|
position.centerStatusID = centerVisibleID
|
||||||
|
mastodonController.persistentContainer.save(context: context)
|
||||||
}
|
}
|
||||||
|
|
||||||
func stateRestorationActivity() -> NSUserActivity? {
|
func stateRestorationActivity() -> NSUserActivity? {
|
||||||
|
@ -304,43 +327,74 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
return activity
|
return activity
|
||||||
}
|
}
|
||||||
|
|
||||||
private func restoreState() -> Bool {
|
func restoreState() async -> Bool {
|
||||||
guard persistsState,
|
guard persistsState,
|
||||||
Preferences.shared.timelineStateRestoration,
|
Preferences.shared.timelineStateRestoration,
|
||||||
let state = mastodonController.persistentContainer.getTimelineState(timeline: timeline) else {
|
let position = mastodonController.persistentContainer.getTimelinePosition(timeline: timeline) else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
let statusIDs = state.statusMOs.map(\.id)
|
|
||||||
loadViewIfNeeded()
|
loadViewIfNeeded()
|
||||||
controller.restoreInitial {
|
await controller.restoreInitial {
|
||||||
var snapshot = dataSource.snapshot()
|
await loadStatusesToRestore(position: position)
|
||||||
snapshot.appendSections([.statuses])
|
applyItemsToRestore(position: position)
|
||||||
let items = statusIDs.map { Item.status(id: $0, collapseState: .unknown, filterState: .unknown) }
|
}
|
||||||
snapshot.appendItems(items, toSection: .statuses)
|
return true
|
||||||
dataSource.apply(snapshot, animatingDifferences: false) {
|
}
|
||||||
if let centerID = state.centerStatusID,
|
|
||||||
let index = statusIDs.firstIndex(of: centerID),
|
@MainActor
|
||||||
let indexPath = self.dataSource.indexPath(for: items[index]) {
|
private func loadStatusesToRestore(position: TimelinePosition) async {
|
||||||
// it sometimes takes multiple attempts to convert on the right scroll position
|
let unloaded = position.statusIDs.filter({ mastodonController.persistentContainer.status(for: $0) == nil })
|
||||||
// since we're dealing with a bunch of unmeasured cells, so just try a few times in a loop
|
guard !unloaded.isEmpty else {
|
||||||
var count = 0
|
return
|
||||||
while count < 5 {
|
}
|
||||||
count += 1
|
let statuses = await withTaskGroup(of: Status?.self) { group -> [Status] in
|
||||||
let origOffset = self.collectionView.contentOffset
|
for id in unloaded {
|
||||||
self.collectionView.layoutIfNeeded()
|
group.addTask { @MainActor in
|
||||||
self.collectionView.scrollToItem(at: indexPath, at: .centeredVertically, animated: false)
|
if let (status, _) = try? await self.mastodonController.run(Client.getStatus(id: id)) {
|
||||||
let newOffset = self.collectionView.contentOffset
|
return status
|
||||||
if abs(origOffset.y - newOffset.y) <= 1 {
|
} else {
|
||||||
break
|
return nil
|
||||||
}
|
|
||||||
}
|
}
|
||||||
stateRestorationLogger.fault("TimelineViewController: restored statuses with center ID \(centerID)")
|
}
|
||||||
} else {
|
}
|
||||||
stateRestorationLogger.fault("TimelineViewController: restored statuses, but couldn't find center ID")
|
return await group.reduce(into: []) { partialResult, status in
|
||||||
|
if let status {
|
||||||
|
partialResult.append(status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true
|
await mastodonController.persistentContainer.addAll(statuses: statuses, in: mastodonController.persistentContainer.viewContext)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func applyItemsToRestore(position: TimelinePosition) {
|
||||||
|
var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
|
||||||
|
snapshot.appendSections([.statuses])
|
||||||
|
let statusIDs = position.statusIDs
|
||||||
|
let centerStatusID = position.centerStatusID
|
||||||
|
let items = position.statusIDs.map { Item.status(id: $0, collapseState: .unknown, filterState: .unknown) }
|
||||||
|
snapshot.appendItems(items, toSection: .statuses)
|
||||||
|
dataSource.apply(snapshot, animatingDifferences: false) {
|
||||||
|
if let centerStatusID,
|
||||||
|
let index = statusIDs.firstIndex(of: centerStatusID),
|
||||||
|
let indexPath = self.dataSource.indexPath(for: items[index]) {
|
||||||
|
// it sometimes takes multiple attempts to convert on the right scroll position
|
||||||
|
// since we're dealing with a bunch of unmeasured cells, so just try a few times in a loop
|
||||||
|
var count = 0
|
||||||
|
while count < 5 {
|
||||||
|
count += 1
|
||||||
|
let origOffset = self.collectionView.contentOffset
|
||||||
|
self.collectionView.layoutIfNeeded()
|
||||||
|
self.collectionView.scrollToItem(at: indexPath, at: .centeredVertically, animated: false)
|
||||||
|
let newOffset = self.collectionView.contentOffset
|
||||||
|
if abs(origOffset.y - newOffset.y) <= 1 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stateRestorationLogger.fault("TimelineViewController: restored statuses with center ID \(centerStatusID)")
|
||||||
|
} else {
|
||||||
|
stateRestorationLogger.fault("TimelineViewController: restored statuses, but couldn't find center ID")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func removeTimelineDescriptionCell() {
|
private func removeTimelineDescriptionCell() {
|
||||||
|
@ -354,7 +408,11 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
let status = {
|
let status = {
|
||||||
let status = self.mastodonController.persistentContainer.status(for: statusID)!
|
let status = self.mastodonController.persistentContainer.status(for: statusID)!
|
||||||
// if the status is a reblog of another one, filter based on that one
|
// if the status is a reblog of another one, filter based on that one
|
||||||
return status.reblog ?? status
|
if let reblogged = status.reblog {
|
||||||
|
return (reblogged, true)
|
||||||
|
} else {
|
||||||
|
return (status, false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return filterer.resolve(state: state, status: status)
|
return filterer.resolve(state: state, status: status)
|
||||||
}
|
}
|
||||||
|
@ -390,7 +448,7 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
view.window?.windowScene == scene else {
|
view.window?.windowScene == scene else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
checkPresentIfEnoughTimeElapsed()
|
syncAndCheckPresentIfEnoughTimeElapsed()
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func sceneDidEnterBackground(_ notification: Foundation.Notification) {
|
@objc private func sceneDidEnterBackground(_ notification: Foundation.Notification) {
|
||||||
|
@ -403,6 +461,63 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
saveState()
|
saveState()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func syncPositionIfNecessary(alwaysPrompt: Bool) -> Bool {
|
||||||
|
guard persistsState,
|
||||||
|
let timelinePosition = mastodonController.persistentContainer.getTimelinePosition(timeline: timeline) else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
let snapshot = dataSource.snapshot()
|
||||||
|
guard let centerVisible = currentCenterVisibleIndexPath(snapshot: snapshot),
|
||||||
|
snapshot.sectionIdentifiers.contains(.statuses) else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
let statusesSection = snapshot.itemIdentifiers(inSection: .statuses)
|
||||||
|
let centerVisibleStatusID: String
|
||||||
|
switch statusesSection[centerVisible.row] {
|
||||||
|
case .gap:
|
||||||
|
guard case .status(let id, _, _) = statusesSection[centerVisible.row + 1] else {
|
||||||
|
fatalError()
|
||||||
|
}
|
||||||
|
centerVisibleStatusID = id
|
||||||
|
case .status(let id, _, _):
|
||||||
|
centerVisibleStatusID = id
|
||||||
|
default:
|
||||||
|
fatalError()
|
||||||
|
}
|
||||||
|
guard timelinePosition.centerStatusID != centerVisibleStatusID else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if !alwaysPrompt {
|
||||||
|
Task {
|
||||||
|
_ = await restoreState()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var config = ToastConfiguration(title: "Sync Position")
|
||||||
|
config.edge = .top
|
||||||
|
config.dismissAutomaticallyAfter = 5
|
||||||
|
config.systemImageName = "arrow.triangle.2.circlepath"
|
||||||
|
config.action = { [unowned self] toast in
|
||||||
|
toast.isUserInteractionEnabled = false
|
||||||
|
UIView.animateKeyframes(withDuration: 1, delay: 0, options: .repeat) {
|
||||||
|
UIView.addKeyframe(withRelativeStartTime: 0, relativeDuration: 0.5) {
|
||||||
|
toast.imageView!.transform = CGAffineTransform(rotationAngle: 0.5 * .pi)
|
||||||
|
}
|
||||||
|
UIView.addKeyframe(withRelativeStartTime: 0.5, relativeDuration: 0.5) {
|
||||||
|
// the translation is because the symbol isn't perfectly centered
|
||||||
|
toast.imageView!.transform = CGAffineTransform(translationX: -0.5, y: 0).rotated(by: .pi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Task {
|
||||||
|
_ = await self.restoreState()
|
||||||
|
toast.dismissToast(animated: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
showToast(configuration: config, animated: true)
|
||||||
|
UIAccessibility.post(notification: .announcement, argument: "Synced Position Updated")
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
@objc func refresh() {
|
@objc func refresh() {
|
||||||
Task {
|
Task {
|
||||||
if case .notLoadedInitial = controller.state {
|
if case .notLoadedInitial = controller.state {
|
||||||
|
@ -428,14 +543,18 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func checkPresentIfEnoughTimeElapsed() {
|
private func syncAndCheckPresentIfEnoughTimeElapsed() {
|
||||||
guard let disappearedAt,
|
guard let disappearedAt,
|
||||||
-disappearedAt.timeIntervalSinceNow > 60 * 60 /* 1 hour */ else {
|
-disappearedAt.timeIntervalSinceNow > 60 * 60 /* 1 hour */ else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.disappearedAt = nil
|
self.disappearedAt = nil
|
||||||
Task {
|
if syncPositionIfNecessary(alwaysPrompt: false) {
|
||||||
await checkPresent(jumpImmediately: false)
|
// no-op
|
||||||
|
} else {
|
||||||
|
Task {
|
||||||
|
await checkPresent(jumpImmediately: false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,9 +582,19 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let currentItems = snapshot.itemIdentifiers(inSection: .statuses)
|
let currentItems = snapshot.itemIdentifiers(inSection: .statuses)
|
||||||
if case .status(id: let firstID, _, _) = currentItems.first,
|
func currentItemsContains(id: String) -> Bool {
|
||||||
// if there's no overlap between presentItems and the existing items in the data source, prompt the user
|
return currentItems.contains { item in
|
||||||
!presentItems.contains(firstID) {
|
switch item {
|
||||||
|
case .status(id: id, collapseState: _, filterState: _):
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if there's no overlap between presentItems and the existing items in the data source, prompt the user
|
||||||
|
// we can't be clever here by just checking the first id in currentItems against presentItems, since that may belong to a since-unfollowed user
|
||||||
|
if !presentItems.contains(where: { currentItemsContains(id: $0) }) {
|
||||||
let applySnapshotBeforeScrolling: Bool
|
let applySnapshotBeforeScrolling: Bool
|
||||||
|
|
||||||
// remove any existing gap, if there is one
|
// remove any existing gap, if there is one
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
import Pachyderm
|
||||||
|
import Combine
|
||||||
|
|
||||||
class TimelinesPageViewController: SegmentedPageViewController<TimelinesPageViewController.Page> {
|
class TimelinesPageViewController: SegmentedPageViewController<TimelinesPageViewController.Page> {
|
||||||
|
|
||||||
|
@ -17,33 +19,27 @@ class TimelinesPageViewController: SegmentedPageViewController<TimelinesPageView
|
||||||
|
|
||||||
weak var mastodonController: MastodonController!
|
weak var mastodonController: MastodonController!
|
||||||
|
|
||||||
|
private var cancellables = Set<AnyCancellable>()
|
||||||
|
|
||||||
init(mastodonController: MastodonController) {
|
init(mastodonController: MastodonController) {
|
||||||
self.mastodonController = mastodonController
|
self.mastodonController = mastodonController
|
||||||
|
|
||||||
let home = TimelineViewController(for: .home, mastodonController: mastodonController)
|
let pages = mastodonController.accountPreferences.pinnedTimelines.map {
|
||||||
home.title = homeTitle
|
Page(mastodonController: mastodonController, timeline: $0)
|
||||||
home.persistsState = true
|
}
|
||||||
|
super.init(pages: pages) { page in
|
||||||
let federated = TimelineViewController(for: .public(local: false), mastodonController: mastodonController)
|
let vc = TimelineViewController(for: page.timeline, mastodonController: page.mastodonController)
|
||||||
federated.title = federatedTitle
|
vc.title = page.segmentedControlTitle
|
||||||
federated.persistsState = true
|
vc.persistsState = true
|
||||||
|
return vc
|
||||||
let local = TimelineViewController(for: .public(local: true), mastodonController: mastodonController)
|
}
|
||||||
local.title = localTitle
|
|
||||||
local.persistsState = true
|
|
||||||
|
|
||||||
super.init(pages: [
|
|
||||||
(.home, "Home", home),
|
|
||||||
(.local, "Local", local),
|
|
||||||
(.federated, "Federated", federated),
|
|
||||||
])
|
|
||||||
|
|
||||||
title = homeTitle
|
title = homeTitle
|
||||||
tabBarItem.image = UIImage(systemName: "house.fill")
|
tabBarItem.image = UIImage(systemName: "house.fill")
|
||||||
|
|
||||||
let filtersItem = UIBarButtonItem(image: UIImage(systemName: "line.3.horizontal.decrease.circle"), style: .plain, target: self, action: #selector(filtersPressed))
|
let customizeItem = UIBarButtonItem(image: UIImage(systemName: "slider.horizontal.3"), style: .plain, target: self, action: #selector(customizePressed))
|
||||||
filtersItem.accessibilityLabel = "Filters"
|
customizeItem.accessibilityLabel = "Customize Timelines"
|
||||||
navigationItem.leftBarButtonItem = filtersItem
|
navigationItem.rightBarButtonItem = customizeItem
|
||||||
|
|
||||||
let jumpToPresentName = NSMutableAttributedString("Jump to Present")
|
let jumpToPresentName = NSMutableAttributedString("Jump to Present")
|
||||||
// otherwise it pronounces it as 'pɹizˈənt'
|
// otherwise it pronounces it as 'pɹizˈənt'
|
||||||
|
@ -51,51 +47,83 @@ class TimelinesPageViewController: SegmentedPageViewController<TimelinesPageView
|
||||||
jumpToPresentName.addAttribute(.accessibilitySpeechIPANotation, value: "ˈprɛ.zənt", range: NSRange(location: "Jump to ".count, length: "Present".count))
|
jumpToPresentName.addAttribute(.accessibilitySpeechIPANotation, value: "ˈprɛ.zənt", range: NSRange(location: "Jump to ".count, length: "Present".count))
|
||||||
segmentedControl.accessibilityCustomActions = [
|
segmentedControl.accessibilityCustomActions = [
|
||||||
UIAccessibilityCustomAction(attributedName: jumpToPresentName, actionHandler: { [unowned self] _ in
|
UIAccessibilityCustomAction(attributedName: jumpToPresentName, actionHandler: { [unowned self] _ in
|
||||||
guard let vc = pageControllers[currentIndex] as? TimelineViewController else {
|
guard let vc = currentViewController as? TimelineViewController else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
Task {
|
Task {
|
||||||
await vc.checkPresent(jumpImmediately: true)
|
await vc.checkPresent(jumpImmediately: true)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
})
|
}),
|
||||||
|
UIAccessibilityCustomAction(name: "Jump to Sync Position", actionHandler: { [unowned self] _ in
|
||||||
|
guard let vc = currentViewController as? TimelineViewController else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
Task {
|
||||||
|
_ = await vc.restoreState()
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
mastodonController.accountPreferences.publisher(for: \.pinnedTimelinesData)
|
||||||
|
.map { _ in () }
|
||||||
|
.merge(with: NotificationCenter.default.publisher(for: .accountPreferencesChangedRemotely).map { _ in () })
|
||||||
|
.sink { _ in
|
||||||
|
let pages = self.mastodonController.accountPreferences.pinnedTimelines.map {
|
||||||
|
Page(mastodonController: self.mastodonController, timeline: $0)
|
||||||
|
}
|
||||||
|
self.setPages(pages, animated: false)
|
||||||
|
}
|
||||||
|
.store(in: &cancellables)
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
required init?(coder: NSCoder) {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func selectTimeline(_ timeline: Timeline, animated: Bool) {
|
||||||
|
self.selectPage(Page(mastodonController: mastodonController, timeline: timeline), animated: animated)
|
||||||
|
}
|
||||||
|
|
||||||
func stateRestorationActivity() -> NSUserActivity? {
|
func stateRestorationActivity() -> NSUserActivity? {
|
||||||
return (pageControllers[currentIndex] as! TimelineViewController).stateRestorationActivity()
|
return (currentViewController as? TimelineViewController)?.stateRestorationActivity()
|
||||||
}
|
}
|
||||||
|
|
||||||
func restoreActivity(_ activity: NSUserActivity) {
|
func restoreActivity(_ activity: NSUserActivity) {
|
||||||
guard let timeline = UserActivityManager.getTimeline(from: activity) else {
|
guard let timeline = UserActivityManager.getTimeline(from: activity) else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let page: Page
|
let page = Page(mastodonController: mastodonController, timeline: timeline)
|
||||||
switch timeline {
|
|
||||||
case .home:
|
|
||||||
page = .home
|
|
||||||
case .public(local: false):
|
|
||||||
page = .federated
|
|
||||||
case .public(local: true):
|
|
||||||
page = .local
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
selectPage(page, animated: false)
|
selectPage(page, animated: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func filtersPressed() {
|
@objc private func customizePressed() {
|
||||||
present(UIHostingController(rootView: FiltersView(mastodonController: mastodonController)), animated: true)
|
present(UIHostingController(rootView: CustomizeTimelinesView(mastodonController: mastodonController)), animated: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Page: Hashable {
|
}
|
||||||
case home
|
|
||||||
case local
|
extension TimelinesPageViewController {
|
||||||
case federated
|
struct Page: SegmentedPageViewControllerPage {
|
||||||
}
|
let mastodonController: MastodonController
|
||||||
|
let timeline: Timeline
|
||||||
|
|
||||||
|
static func ==(lhs: Page, rhs: Page) -> Bool {
|
||||||
|
return lhs.timeline == rhs.timeline
|
||||||
|
}
|
||||||
|
|
||||||
|
func hash(into hasher: inout Hasher) {
|
||||||
|
hasher.combine(timeline)
|
||||||
|
}
|
||||||
|
|
||||||
|
var segmentedControlTitle: String {
|
||||||
|
if case let .list(id) = timeline,
|
||||||
|
let list = try? mastodonController.persistentContainer.viewContext.fetch(ListMO.fetchRequest(id: id)).first {
|
||||||
|
return list.title
|
||||||
|
} else {
|
||||||
|
return timeline.title
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,3 +11,23 @@ import UIKit
|
||||||
protocol CollectionViewController: UIViewController {
|
protocol CollectionViewController: UIViewController {
|
||||||
var collectionView: UICollectionView! { get }
|
var collectionView: UICollectionView! { get }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension CollectionViewController {
|
||||||
|
func clearSelectionOnAppear(animated: Bool) {
|
||||||
|
guard let indexPath = collectionView.indexPathsForSelectedItems?.first else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if let transitionCoordinator {
|
||||||
|
transitionCoordinator.animate { context in
|
||||||
|
self.collectionView.deselectItem(at: indexPath, animated: true)
|
||||||
|
} completion: { context in
|
||||||
|
if context.isCancelled {
|
||||||
|
self.collectionView.selectItem(at: indexPath, animated: false, scrollPosition: [] /* UICollectionViewScrollPositionNone */)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
collectionView.deselectItem(at: indexPath, animated: animated)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ extension MenuActionProvider {
|
||||||
|
|
||||||
private var mastodonController: MastodonController? { navigationDelegate?.apiController }
|
private var mastodonController: MastodonController? { navigationDelegate?.apiController }
|
||||||
|
|
||||||
func actionsForProfile(accountID: String, source: PopoverSource) -> [UIMenuElement] {
|
func actionsForProfile(accountID: String, source: PopoverSource, fetchRelationship: Bool = true) -> [UIMenuElement] {
|
||||||
guard let mastodonController = mastodonController,
|
guard let mastodonController = mastodonController,
|
||||||
let account = mastodonController.persistentContainer.account(for: accountID) else { return [] }
|
let account = mastodonController.persistentContainer.account(for: accountID) else { return [] }
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ extension MenuActionProvider {
|
||||||
|
|
||||||
if let ownAccount = mastodonController.account,
|
if let ownAccount = mastodonController.account,
|
||||||
accountID != ownAccount.id {
|
accountID != ownAccount.id {
|
||||||
actionsSection.append(relationshipAction(accountID: accountID, mastodonController: mastodonController, builder: { [unowned self] in self.followAction(for: $0, mastodonController: $1) }))
|
actionsSection.append(relationshipAction(fetchRelationship, accountID: accountID, mastodonController: mastodonController, builder: { [unowned self] in self.followAction(for: $0, mastodonController: $1) }))
|
||||||
actionsSection.append(UIDeferredMenuElement.uncached({ elementHandler in
|
actionsSection.append(UIDeferredMenuElement.uncached({ elementHandler in
|
||||||
let listActions = mastodonController.lists.map { list in
|
let listActions = mastodonController.lists.map { list in
|
||||||
UIAction(title: list.title, image: UIImage(systemName: "plus")) { [unowned self] _ in
|
UIAction(title: list.title, image: UIImage(systemName: "plus")) { [unowned self] _ in
|
||||||
|
@ -82,8 +82,8 @@ extension MenuActionProvider {
|
||||||
}
|
}
|
||||||
elementHandler([UIMenu(title: "Add to List", image: UIImage(systemName: "list.bullet"), children: listActions)])
|
elementHandler([UIMenu(title: "Add to List", image: UIImage(systemName: "list.bullet"), children: listActions)])
|
||||||
}))
|
}))
|
||||||
suppressSection.append(relationshipAction(accountID: accountID, mastodonController: mastodonController, builder: { [unowned self] in self.blockAction(for: $0, mastodonController: $1) }))
|
suppressSection.append(relationshipAction(fetchRelationship, accountID: accountID, mastodonController: mastodonController, builder: { [unowned self] in self.blockAction(for: $0, mastodonController: $1) }))
|
||||||
suppressSection.append(relationshipAction(accountID: accountID, mastodonController: mastodonController, builder: { [unowned self] in self.muteAction(for: $0, mastodonController: $1) }))
|
suppressSection.append(relationshipAction(fetchRelationship, accountID: accountID, mastodonController: mastodonController, builder: { [unowned self] in self.muteAction(for: $0, mastodonController: $1) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
addOpenInNewWindow(actions: &shareSection, activity: UserActivityManager.showProfileActivity(id: accountID, accountID: loggedInAccountID))
|
addOpenInNewWindow(actions: &shareSection, activity: UserActivityManager.showProfileActivity(id: accountID, accountID: loggedInAccountID))
|
||||||
|
@ -111,7 +111,7 @@ extension MenuActionProvider {
|
||||||
mastodonController.loggedIn {
|
mastodonController.loggedIn {
|
||||||
let name = hashtag.name.lowercased()
|
let name = hashtag.name.lowercased()
|
||||||
let context = mastodonController.persistentContainer.viewContext
|
let context = mastodonController.persistentContainer.viewContext
|
||||||
let existing = try? context.fetch(SavedHashtag.fetchRequest(name: name)).first
|
let existing = try? context.fetch(SavedHashtag.fetchRequest(name: name, account: mastodonController.accountInfo!)).first
|
||||||
let saveSubtitle = "Saved hashtags appear in the Explore section of Tusker"
|
let saveSubtitle = "Saved hashtags appear in the Explore section of Tusker"
|
||||||
let saveImage = UIImage(systemName: existing != nil ? "minus" : "plus")
|
let saveImage = UIImage(systemName: existing != nil ? "minus" : "plus")
|
||||||
actionsSection = [
|
actionsSection = [
|
||||||
|
@ -119,7 +119,7 @@ extension MenuActionProvider {
|
||||||
if let existing = existing {
|
if let existing = existing {
|
||||||
context.delete(existing)
|
context.delete(existing)
|
||||||
} else {
|
} else {
|
||||||
_ = SavedHashtag(hashtag: hashtag, context: context)
|
_ = SavedHashtag(hashtag: hashtag, account: mastodonController.accountInfo!, context: context)
|
||||||
}
|
}
|
||||||
mastodonController.persistentContainer.save(context: context)
|
mastodonController.persistentContainer.save(context: context)
|
||||||
})
|
})
|
||||||
|
@ -377,16 +377,16 @@ extension MenuActionProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func relationshipAction(accountID: String, mastodonController: MastodonController, builder: @escaping @MainActor (RelationshipMO, MastodonController) -> UIMenuElement) -> UIDeferredMenuElement {
|
private func relationshipAction(_ fetch: Bool, accountID: String, mastodonController: MastodonController, builder: @escaping @MainActor (RelationshipMO, MastodonController) -> UIMenuElement) -> UIDeferredMenuElement {
|
||||||
return UIDeferredMenuElement.uncached({ @MainActor elementHandler in
|
return UIDeferredMenuElement.uncached({ @MainActor elementHandler in
|
||||||
let relationship = Task {
|
|
||||||
await fetchRelationship(accountID: accountID, mastodonController: mastodonController)
|
|
||||||
}
|
|
||||||
// workaround for #198, may result in showing outdated relationship, so only do so where necessary
|
// workaround for #198, may result in showing outdated relationship, so only do so where necessary
|
||||||
if ProcessInfo.processInfo.isiOSAppOnMac,
|
if !fetch || ProcessInfo.processInfo.isiOSAppOnMac,
|
||||||
let mo = mastodonController.persistentContainer.relationship(forAccount: accountID) {
|
let mo = mastodonController.persistentContainer.relationship(forAccount: accountID) {
|
||||||
elementHandler([builder(mo, mastodonController)])
|
elementHandler([builder(mo, mastodonController)])
|
||||||
} else {
|
} else {
|
||||||
|
let relationship = Task {
|
||||||
|
await fetchRelationship(accountID: accountID, mastodonController: mastodonController)
|
||||||
|
}
|
||||||
Task { @MainActor in
|
Task { @MainActor in
|
||||||
if let relationship = await relationship.value {
|
if let relationship = await relationship.value {
|
||||||
elementHandler([builder(relationship, mastodonController)])
|
elementHandler([builder(relationship, mastodonController)])
|
||||||
|
|
|
@ -8,35 +8,39 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
class SegmentedPageViewController<Page: Hashable>: UIPageViewController, UIPageViewControllerDelegate, TabbedPageViewController {
|
protocol SegmentedPageViewControllerPage: Hashable {
|
||||||
|
var segmentedControlTitle: String { get }
|
||||||
|
}
|
||||||
|
|
||||||
let pages: [Page]
|
class SegmentedPageViewController<Page: SegmentedPageViewControllerPage>: UIPageViewController, UIPageViewControllerDelegate, TabbedPageViewController {
|
||||||
let pageControllers: [UIViewController]
|
|
||||||
|
private(set) var pages: [Page]!
|
||||||
|
private let pageProvider: (Page) -> UIViewController
|
||||||
|
private var pageControllers = [Page: UIViewController]()
|
||||||
|
|
||||||
private var initialPage: Page
|
private var initialPage: Page
|
||||||
private var currentPage: Page
|
private var currentPage: Page
|
||||||
var currentIndex: Int {
|
var currentIndex: Int! {
|
||||||
pages.firstIndex(of: currentPage)!
|
pages.firstIndex(of: currentPage)
|
||||||
|
}
|
||||||
|
var currentViewController: UIViewController! {
|
||||||
|
viewControllers?.first
|
||||||
}
|
}
|
||||||
|
|
||||||
let segmentedControl = ScrollingSegmentedControl<Page>()
|
let segmentedControl = ScrollingSegmentedControl<Page>()
|
||||||
|
|
||||||
init(pages: [(Page, String, UIViewController)]) {
|
init(pages: [Page], pageProvider: @escaping (Page) -> UIViewController) {
|
||||||
precondition(!pages.isEmpty)
|
precondition(!pages.isEmpty)
|
||||||
|
|
||||||
self.pages = pages.map(\.0)
|
self.pageProvider = pageProvider
|
||||||
self.pageControllers = pages.map(\.2)
|
|
||||||
|
|
||||||
initialPage = self.pages.first!
|
initialPage = pages.first!
|
||||||
currentPage = self.pages.first!
|
currentPage = pages.first!
|
||||||
|
|
||||||
super.init(transitionStyle: .scroll, navigationOrientation: .horizontal, options: nil)
|
super.init(transitionStyle: .scroll, navigationOrientation: .horizontal, options: nil)
|
||||||
|
|
||||||
// this needs to happen in init because EnhancedNavigationViewController expects to be able to look at the titleView
|
setPages(pages, animated: false)
|
||||||
// before the view has necessarily loaded
|
|
||||||
segmentedControl.options = pages.map {
|
|
||||||
.init(value: $0.0, name: $0.1)
|
|
||||||
}
|
|
||||||
segmentedControl.didSelectOption = { [unowned self] option in
|
segmentedControl.didSelectOption = { [unowned self] option in
|
||||||
if let option {
|
if let option {
|
||||||
self.selectPage(option, animated: true)
|
self.selectPage(option, animated: true)
|
||||||
|
@ -54,6 +58,26 @@ class SegmentedPageViewController<Page: Hashable>: UIPageViewController, UIPageV
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func setPages(_ pages: [Page], animated: Bool) {
|
||||||
|
precondition(!pages.isEmpty)
|
||||||
|
|
||||||
|
self.pages = pages
|
||||||
|
|
||||||
|
if !pages.contains(currentPage) {
|
||||||
|
selectPage(pages.first!, animated: animated)
|
||||||
|
}
|
||||||
|
|
||||||
|
for key in pageControllers.keys where !pages.contains(key) {
|
||||||
|
pageControllers.removeValue(forKey: key)
|
||||||
|
}
|
||||||
|
|
||||||
|
// this needs to happen in init because EnhancedNavigationViewController expects to be able to look at the titleView
|
||||||
|
// before the view has necessarily loaded
|
||||||
|
segmentedControl.options = pages.map {
|
||||||
|
.init(value: $0, name: $0.segmentedControlTitle)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
|
@ -80,12 +104,23 @@ class SegmentedPageViewController<Page: Hashable>: UIPageViewController, UIPageV
|
||||||
initialPage = page
|
initialPage = page
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let prevIndex = currentIndex
|
let direction: UIPageViewController.NavigationDirection
|
||||||
currentPage = page
|
if let prevIndex = currentIndex {
|
||||||
let index = pages.firstIndex(of: page)!
|
let index = pages.firstIndex(of: page)!
|
||||||
let newController = pageControllers[index]
|
direction = index - prevIndex > 0 ? .forward : .reverse
|
||||||
|
} else {
|
||||||
|
direction = .forward
|
||||||
|
}
|
||||||
|
|
||||||
|
currentPage = page
|
||||||
|
let newController: UIViewController
|
||||||
|
if let existing = pageControllers[page] {
|
||||||
|
newController = existing
|
||||||
|
} else {
|
||||||
|
newController = pageProvider(page)
|
||||||
|
pageControllers[page] = newController
|
||||||
|
}
|
||||||
|
|
||||||
let direction: UIPageViewController.NavigationDirection = index - prevIndex > 0 ? .forward : .reverse
|
|
||||||
setViewControllers([newController], direction: direction, animated: animated)
|
setViewControllers([newController], direction: direction, animated: animated)
|
||||||
navigationItem.title = newController.title
|
navigationItem.title = newController.title
|
||||||
|
|
||||||
|
@ -108,7 +143,7 @@ class SegmentedPageViewController<Page: Hashable>: UIPageViewController, UIPageV
|
||||||
|
|
||||||
extension SegmentedPageViewController: TabBarScrollableViewController {
|
extension SegmentedPageViewController: TabBarScrollableViewController {
|
||||||
func tabBarScrollToTop() {
|
func tabBarScrollToTop() {
|
||||||
if let scrollableVC = pageControllers[currentIndex] as? TabBarScrollableViewController {
|
if let scrollableVC = currentViewController as? TabBarScrollableViewController {
|
||||||
scrollableVC.tabBarScrollToTop()
|
scrollableVC.tabBarScrollToTop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,7 +151,7 @@ extension SegmentedPageViewController: TabBarScrollableViewController {
|
||||||
|
|
||||||
extension SegmentedPageViewController: BackgroundableViewController {
|
extension SegmentedPageViewController: BackgroundableViewController {
|
||||||
func sceneDidEnterBackground() {
|
func sceneDidEnterBackground() {
|
||||||
if let current = pageControllers[currentIndex] as? BackgroundableViewController {
|
if let current = currentViewController as? BackgroundableViewController {
|
||||||
current.sceneDidEnterBackground()
|
current.sceneDidEnterBackground()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +159,7 @@ extension SegmentedPageViewController: BackgroundableViewController {
|
||||||
|
|
||||||
extension SegmentedPageViewController: StatusBarTappableViewController {
|
extension SegmentedPageViewController: StatusBarTappableViewController {
|
||||||
func handleStatusBarTapped(xPosition: CGFloat) -> StatusBarTapActionResult {
|
func handleStatusBarTapped(xPosition: CGFloat) -> StatusBarTapActionResult {
|
||||||
if let current = pageControllers[currentIndex] as? StatusBarTappableViewController {
|
if let current = currentViewController as? StatusBarTappableViewController {
|
||||||
return current.handleStatusBarTapped(xPosition: xPosition)
|
return current.handleStatusBarTapped(xPosition: xPosition)
|
||||||
}
|
}
|
||||||
return .continue
|
return .continue
|
||||||
|
|
|
@ -216,23 +216,11 @@ class UserActivityManager {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
switch timeline {
|
if mastodonController.accountPreferences.pinnedTimelines.contains(timeline) {
|
||||||
case .home, .public(true), .public(false):
|
|
||||||
navigationController.popToRootViewController(animated: false)
|
navigationController.popToRootViewController(animated: false)
|
||||||
let rootController = navigationController.viewControllers.first! as! TimelinesPageViewController
|
let rootController = navigationController.viewControllers.first! as! TimelinesPageViewController
|
||||||
let page: TimelinesPageViewController.Page
|
rootController.selectTimeline(timeline, animated: false)
|
||||||
switch timeline {
|
} else {
|
||||||
case .home:
|
|
||||||
page = .home
|
|
||||||
case .public(local: false):
|
|
||||||
page = .federated
|
|
||||||
case .public(local: true):
|
|
||||||
page = .local
|
|
||||||
default:
|
|
||||||
fatalError()
|
|
||||||
}
|
|
||||||
rootController.selectPage(page, animated: false)
|
|
||||||
default:
|
|
||||||
let timeline = TimelineViewController(for: timeline, mastodonController: mastodonController)
|
let timeline = TimelineViewController(for: timeline, mastodonController: mastodonController)
|
||||||
navigationController.pushViewController(timeline, animated: false)
|
navigationController.pushViewController(timeline, animated: false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,12 +80,12 @@ class TimelineLikeController<Item> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used to indicate to the controller that the initial set of posts have been restored externally.
|
/// Used to indicate to the controller that the initial set of posts have been restored externally.
|
||||||
func restoreInitial(doRestore: () -> Void) {
|
func restoreInitial(doRestore: () async -> Void) async {
|
||||||
guard state == .notLoadedInitial else {
|
guard state == .notLoadedInitial || state == .idle else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
state = .restoringInitial
|
state = .restoringInitial
|
||||||
doRestore()
|
await doRestore()
|
||||||
state = .idle
|
state = .idle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ class TimelineLikeController<Item> {
|
||||||
}
|
}
|
||||||
case .idle:
|
case .idle:
|
||||||
switch to {
|
switch to {
|
||||||
case .loadingInitial(_, _), .loadingNewer(_), .loadingOlder(_, _), .loadingGap(_, _):
|
case .restoringInitial, .loadingInitial(_, _), .loadingNewer(_), .loadingOlder(_, _), .loadingGap(_, _):
|
||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -2,6 +2,20 @@
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>com.apple.developer.icloud-container-environment</key>
|
||||||
|
<string>Production</string>
|
||||||
|
<key>aps-environment</key>
|
||||||
|
<string>development</string>
|
||||||
|
<key>com.apple.developer.aps-environment</key>
|
||||||
|
<string>development</string>
|
||||||
|
<key>com.apple.developer.icloud-container-identifiers</key>
|
||||||
|
<array>
|
||||||
|
<string>iCloud.space.vaccor.Tusker</string>
|
||||||
|
</array>
|
||||||
|
<key>com.apple.developer.icloud-services</key>
|
||||||
|
<array>
|
||||||
|
<string>CloudKit</string>
|
||||||
|
</array>
|
||||||
<key>com.apple.security.app-sandbox</key>
|
<key>com.apple.security.app-sandbox</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>com.apple.security.application-groups</key>
|
<key>com.apple.security.application-groups</key>
|
||||||
|
|
|
@ -141,17 +141,20 @@ class AttachmentView: GIFImageView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func blurHashSize() -> CGSize {
|
var attachmentAspectRatio: CGFloat? {
|
||||||
if let meta = self.attachment.meta {
|
if let meta = self.attachment.meta {
|
||||||
let aspectRatio: CGFloat
|
|
||||||
if let width = meta.width, let height = meta.height {
|
if let width = meta.width, let height = meta.height {
|
||||||
aspectRatio = CGFloat(width) / CGFloat(height)
|
return CGFloat(width) / CGFloat(height)
|
||||||
} else if let orig = meta.original,
|
} else if let orig = meta.original,
|
||||||
let width = orig.width, let height = orig.height {
|
let width = orig.width, let height = orig.height {
|
||||||
aspectRatio = CGFloat(width) / CGFloat(height)
|
return CGFloat(width) / CGFloat(height)
|
||||||
} else {
|
|
||||||
return CGSize(width: 32, height: 32)
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
private func blurHashSize() -> CGSize {
|
||||||
|
if let aspectRatio = attachmentAspectRatio {
|
||||||
if aspectRatio > 1 {
|
if aspectRatio > 1 {
|
||||||
return CGSize(width: 32, height: 32 / aspectRatio)
|
return CGSize(width: 32, height: 32 / aspectRatio)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -19,7 +19,9 @@ class AttachmentsContainerView: UIView {
|
||||||
var attachments: [Attachment]!
|
var attachments: [Attachment]!
|
||||||
|
|
||||||
let attachmentViews: NSHashTable<AttachmentView> = .weakObjects()
|
let attachmentViews: NSHashTable<AttachmentView> = .weakObjects()
|
||||||
|
let attachmentStacks: NSHashTable<UIStackView> = .weakObjects()
|
||||||
var moreView: UIView?
|
var moreView: UIView?
|
||||||
|
private var aspectRatioConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
var blurView: UIVisualEffectView?
|
var blurView: UIVisualEffectView?
|
||||||
var hideButtonView: UIVisualEffectView?
|
var hideButtonView: UIVisualEffectView?
|
||||||
|
@ -68,6 +70,8 @@ class AttachmentsContainerView: UIView {
|
||||||
|
|
||||||
attachmentViews.allObjects.forEach { $0.removeFromSuperview() }
|
attachmentViews.allObjects.forEach { $0.removeFromSuperview() }
|
||||||
attachmentViews.removeAllObjects()
|
attachmentViews.removeAllObjects()
|
||||||
|
attachmentStacks.allObjects.forEach { $0.removeFromSuperview() }
|
||||||
|
attachmentStacks.removeAllObjects()
|
||||||
moreView?.removeFromSuperview()
|
moreView?.removeFromSuperview()
|
||||||
|
|
||||||
var accessibilityElements = [Any]()
|
var accessibilityElements = [Any]()
|
||||||
|
@ -75,6 +79,8 @@ class AttachmentsContainerView: UIView {
|
||||||
if attachments.count > 0 {
|
if attachments.count > 0 {
|
||||||
self.isHidden = false
|
self.isHidden = false
|
||||||
|
|
||||||
|
var aspectRatio: CGFloat = 16/9
|
||||||
|
|
||||||
switch attachments.count {
|
switch attachments.count {
|
||||||
case 1:
|
case 1:
|
||||||
let attachmentView = createAttachmentView(index: 0, hSize: .full, vSize: .full)
|
let attachmentView = createAttachmentView(index: 0, hSize: .full, vSize: .full)
|
||||||
|
@ -83,6 +89,9 @@ class AttachmentsContainerView: UIView {
|
||||||
fillView(attachmentView)
|
fillView(attachmentView)
|
||||||
sendSubviewToBack(attachmentView)
|
sendSubviewToBack(attachmentView)
|
||||||
accessibilityElements.append(attachmentView)
|
accessibilityElements.append(attachmentView)
|
||||||
|
if let attachmentAspectRatio = attachmentView.attachmentAspectRatio {
|
||||||
|
aspectRatio = attachmentAspectRatio
|
||||||
|
}
|
||||||
case 2:
|
case 2:
|
||||||
let left = createAttachmentView(index: 0, hSize: .half, vSize: .full)
|
let left = createAttachmentView(index: 0, hSize: .half, vSize: .full)
|
||||||
left.layer.cornerRadius = 5
|
left.layer.cornerRadius = 5
|
||||||
|
@ -96,6 +105,7 @@ class AttachmentsContainerView: UIView {
|
||||||
left,
|
left,
|
||||||
right
|
right
|
||||||
])
|
])
|
||||||
|
attachmentStacks.add(stack)
|
||||||
fillView(stack)
|
fillView(stack)
|
||||||
sendSubviewToBack(stack)
|
sendSubviewToBack(stack)
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
|
@ -116,13 +126,16 @@ class AttachmentsContainerView: UIView {
|
||||||
bottomRight.layer.cornerRadius = 5
|
bottomRight.layer.cornerRadius = 5
|
||||||
bottomRight.layer.maskedCorners = .layerMaxXMaxYCorner
|
bottomRight.layer.maskedCorners = .layerMaxXMaxYCorner
|
||||||
bottomRight.layer.masksToBounds = true
|
bottomRight.layer.masksToBounds = true
|
||||||
|
let innerStack = createAttachmentsStack(axis: .vertical, arrangedSubviews: [
|
||||||
|
topRight,
|
||||||
|
bottomRight
|
||||||
|
])
|
||||||
|
attachmentStacks.add(innerStack)
|
||||||
let outerStack = createAttachmentsStack(axis: .horizontal, arrangedSubviews: [
|
let outerStack = createAttachmentsStack(axis: .horizontal, arrangedSubviews: [
|
||||||
left,
|
left,
|
||||||
createAttachmentsStack(axis: .vertical, arrangedSubviews: [
|
innerStack,
|
||||||
topRight,
|
|
||||||
bottomRight
|
|
||||||
])
|
|
||||||
])
|
])
|
||||||
|
attachmentStacks.add(outerStack)
|
||||||
fillView(outerStack)
|
fillView(outerStack)
|
||||||
sendSubviewToBack(outerStack)
|
sendSubviewToBack(outerStack)
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
|
@ -145,6 +158,7 @@ class AttachmentsContainerView: UIView {
|
||||||
topLeft,
|
topLeft,
|
||||||
bottomLeft
|
bottomLeft
|
||||||
])
|
])
|
||||||
|
attachmentStacks.add(left)
|
||||||
let topRight = createAttachmentView(index: 1, hSize: .half, vSize: .half)
|
let topRight = createAttachmentView(index: 1, hSize: .half, vSize: .half)
|
||||||
topRight.layer.cornerRadius = 5
|
topRight.layer.cornerRadius = 5
|
||||||
topRight.layer.maskedCorners = .layerMaxXMinYCorner
|
topRight.layer.maskedCorners = .layerMaxXMinYCorner
|
||||||
|
@ -153,13 +167,16 @@ class AttachmentsContainerView: UIView {
|
||||||
bottomRight.layer.cornerRadius = 5
|
bottomRight.layer.cornerRadius = 5
|
||||||
bottomRight.layer.maskedCorners = .layerMaxXMaxYCorner
|
bottomRight.layer.maskedCorners = .layerMaxXMaxYCorner
|
||||||
bottomRight.layer.masksToBounds = true
|
bottomRight.layer.masksToBounds = true
|
||||||
|
let right = createAttachmentsStack(axis: .vertical, arrangedSubviews: [
|
||||||
|
topRight,
|
||||||
|
bottomRight
|
||||||
|
])
|
||||||
|
attachmentStacks.add(right)
|
||||||
let outerStack = createAttachmentsStack(axis: .horizontal, arrangedSubviews: [
|
let outerStack = createAttachmentsStack(axis: .horizontal, arrangedSubviews: [
|
||||||
left,
|
left,
|
||||||
createAttachmentsStack(axis: .vertical, arrangedSubviews: [
|
right,
|
||||||
topRight,
|
|
||||||
bottomRight
|
|
||||||
])
|
|
||||||
])
|
])
|
||||||
|
attachmentStacks.add(outerStack)
|
||||||
fillView(outerStack)
|
fillView(outerStack)
|
||||||
sendSubviewToBack(outerStack)
|
sendSubviewToBack(outerStack)
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
|
@ -201,17 +218,21 @@ class AttachmentsContainerView: UIView {
|
||||||
topLeft,
|
topLeft,
|
||||||
bottomLeft
|
bottomLeft
|
||||||
])
|
])
|
||||||
|
attachmentStacks.add(left)
|
||||||
let topRight = createAttachmentView(index: 1, hSize: .half, vSize: .half)
|
let topRight = createAttachmentView(index: 1, hSize: .half, vSize: .half)
|
||||||
topRight.layer.cornerRadius = 5
|
topRight.layer.cornerRadius = 5
|
||||||
topRight.layer.maskedCorners = .layerMaxXMinYCorner
|
topRight.layer.maskedCorners = .layerMaxXMinYCorner
|
||||||
topRight.layer.masksToBounds = true
|
topRight.layer.masksToBounds = true
|
||||||
|
let right = createAttachmentsStack(axis: .vertical, arrangedSubviews: [
|
||||||
|
topRight,
|
||||||
|
moreView
|
||||||
|
])
|
||||||
|
attachmentStacks.add(right)
|
||||||
let outerStack = createAttachmentsStack(axis: .horizontal, arrangedSubviews: [
|
let outerStack = createAttachmentsStack(axis: .horizontal, arrangedSubviews: [
|
||||||
left,
|
left,
|
||||||
createAttachmentsStack(axis: .vertical, arrangedSubviews: [
|
right,
|
||||||
topRight,
|
|
||||||
moreView
|
|
||||||
])
|
|
||||||
])
|
])
|
||||||
|
attachmentStacks.add(outerStack)
|
||||||
fillView(outerStack)
|
fillView(outerStack)
|
||||||
sendSubviewToBack(outerStack)
|
sendSubviewToBack(outerStack)
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
|
@ -227,7 +248,19 @@ class AttachmentsContainerView: UIView {
|
||||||
accessibilityElements.append(topRight)
|
accessibilityElements.append(topRight)
|
||||||
accessibilityElements.append(bottomLeft)
|
accessibilityElements.append(bottomLeft)
|
||||||
accessibilityElements.append(moreView)
|
accessibilityElements.append(moreView)
|
||||||
|
}
|
||||||
|
|
||||||
|
if Preferences.shared.showUncroppedMediaInline {
|
||||||
|
if aspectRatioConstraint?.multiplier != aspectRatio {
|
||||||
|
aspectRatioConstraint?.isActive = false
|
||||||
|
aspectRatioConstraint = widthAnchor.constraint(equalTo: heightAnchor, multiplier: aspectRatio)
|
||||||
|
aspectRatioConstraint!.isActive = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if aspectRatioConstraint == nil {
|
||||||
|
aspectRatioConstraint = widthAnchor.constraint(equalTo: heightAnchor, multiplier: 16/9)
|
||||||
|
aspectRatioConstraint!.isActive = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.isHidden = true
|
self.isHidden = true
|
||||||
|
|
|
@ -214,7 +214,9 @@ extension ContentTextView: UITextViewDelegate {
|
||||||
} else {
|
} else {
|
||||||
// otherwise, regular taps are handled by the gesture recognizer, but the accessibility interaction to select links with the rotor goes through here
|
// otherwise, regular taps are handled by the gesture recognizer, but the accessibility interaction to select links with the rotor goes through here
|
||||||
// and this seems to be the only way of overriding what it does
|
// and this seems to be the only way of overriding what it does
|
||||||
handleLinkTapped(url: URL, text: (text as NSString).substring(with: characterRange))
|
if interaction == .invokeDefaultAction {
|
||||||
|
handleLinkTapped(url: URL, text: (text as NSString).substring(with: characterRange))
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="107" id="Pcu-ap-Xqf" customClass="FollowRequestNotificationTableViewCell" customModule="Tusker" customModuleProvider="target">
|
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="107" id="Pcu-ap-Xqf" customClass="FollowRequestNotificationTableViewCell" customModule="Tusker" customModuleProvider="target">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="320" height="107"/>
|
<rect key="frame" x="0.0" y="0.0" width="320" height="107"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Pcu-ap-Xqf" id="Ulr-P8-MK9">
|
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" layoutMarginsFollowReadableWidth="YES" tableViewCell="Pcu-ap-Xqf" id="Ulr-P8-MK9">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="320" height="107"/>
|
<rect key="frame" x="0.0" y="0.0" width="320" height="107"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="102" id="KGk-i7-Jjw" customClass="PollFinishedTableViewCell" customModule="Tusker" customModuleProvider="target">
|
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="102" id="KGk-i7-Jjw" customClass="PollFinishedTableViewCell" customModule="Tusker" customModuleProvider="target">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="320" height="102"/>
|
<rect key="frame" x="0.0" y="0.0" width="320" height="102"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" layoutMarginsFollowReadableWidth="YES" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="320" height="102"/>
|
<rect key="frame" x="0.0" y="0.0" width="320" height="102"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
</imageView>
|
</imageView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstItem="cqi-cV-ejs" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="34" id="8hN-WG-IsT"/>
|
<constraint firstItem="cqi-cV-ejs" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" constant="18" id="8hN-WG-IsT"/>
|
||||||
<constraint firstAttribute="bottomMargin" secondItem="eSw-Oo-Scy" secondAttribute="bottom" id="9Hx-wD-Rfx"/>
|
<constraint firstAttribute="bottomMargin" secondItem="eSw-Oo-Scy" secondAttribute="bottom" id="9Hx-wD-Rfx"/>
|
||||||
<constraint firstItem="eSw-Oo-Scy" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" id="CxC-Ch-JAx"/>
|
<constraint firstItem="eSw-Oo-Scy" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" id="CxC-Ch-JAx"/>
|
||||||
<constraint firstAttribute="trailingMargin" secondItem="eSw-Oo-Scy" secondAttribute="trailing" id="OPc-Wi-cHD"/>
|
<constraint firstAttribute="trailingMargin" secondItem="eSw-Oo-Scy" secondAttribute="trailing" id="OPc-Wi-cHD"/>
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
//
|
||||||
|
// ProfileHeaderButton.swift
|
||||||
|
// Tusker
|
||||||
|
//
|
||||||
|
// Created by Shadowfacts on 12/22/22.
|
||||||
|
// Copyright © 2022 Shadowfacts. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
class ProfileHeaderButton: UIButton {
|
||||||
|
|
||||||
|
override func updateConfiguration() {
|
||||||
|
guard var config = self.configuration else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
config.baseForegroundColor = .label
|
||||||
|
config.cornerStyle = .capsule
|
||||||
|
var backgroundConfig = UIBackgroundConfiguration.clear()
|
||||||
|
backgroundConfig.visualEffect = UIBlurEffect(style: .systemThickMaterial)
|
||||||
|
config.background = backgroundConfig
|
||||||
|
self.configuration = config
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Pachyderm
|
import Pachyderm
|
||||||
import Combine
|
|
||||||
|
|
||||||
protocol ProfileHeaderViewDelegate: TuskerNavigationDelegate, MenuActionProvider {
|
protocol ProfileHeaderViewDelegate: TuskerNavigationDelegate, MenuActionProvider {
|
||||||
func profileHeader(_ headerView: ProfileHeaderView, selectedPageChangedTo newPage: ProfileViewController.Page)
|
func profileHeader(_ headerView: ProfileHeaderView, selectedPageChangedTo newPage: ProfileViewController.Page)
|
||||||
|
@ -21,17 +20,14 @@ class ProfileHeaderView: UIView {
|
||||||
return nib.instantiate(withOwner: nil, options: nil).first as! ProfileHeaderView
|
return nib.instantiate(withOwner: nil, options: nil).first as! ProfileHeaderView
|
||||||
}
|
}
|
||||||
|
|
||||||
weak var delegate: ProfileHeaderViewDelegate? {
|
weak var delegate: ProfileHeaderViewDelegate?
|
||||||
didSet {
|
|
||||||
createObservers()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var mastodonController: MastodonController! { delegate?.apiController }
|
var mastodonController: MastodonController! { delegate?.apiController }
|
||||||
|
|
||||||
@IBOutlet weak var headerImageView: UIImageView!
|
@IBOutlet weak var headerImageView: UIImageView!
|
||||||
@IBOutlet weak var avatarContainerView: UIView!
|
@IBOutlet weak var avatarContainerView: UIView!
|
||||||
@IBOutlet weak var avatarImageView: UIImageView!
|
@IBOutlet weak var avatarImageView: UIImageView!
|
||||||
@IBOutlet weak var moreButton: VisualEffectImageButton!
|
@IBOutlet weak var moreButton: ProfileHeaderButton!
|
||||||
|
@IBOutlet weak var followButton: ProfileHeaderButton!
|
||||||
@IBOutlet weak var displayNameLabel: EmojiLabel!
|
@IBOutlet weak var displayNameLabel: EmojiLabel!
|
||||||
@IBOutlet weak var usernameLabel: UILabel!
|
@IBOutlet weak var usernameLabel: UILabel!
|
||||||
@IBOutlet weak var lockImageView: UIImageView!
|
@IBOutlet weak var lockImageView: UIImageView!
|
||||||
|
@ -47,8 +43,14 @@ class ProfileHeaderView: UIView {
|
||||||
private var headerRequest: ImageCache.Request?
|
private var headerRequest: ImageCache.Request?
|
||||||
|
|
||||||
private var isGrayscale = false
|
private var isGrayscale = false
|
||||||
|
private var followButtonMode = FollowButtonMode.follow {
|
||||||
private var cancellables = [AnyCancellable]()
|
didSet {
|
||||||
|
var config = followButton.configuration!
|
||||||
|
followButtonMode.updateConfig(&config)
|
||||||
|
config.showsActivityIndicator = false
|
||||||
|
followButton.configuration = config
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
avatarRequest?.cancel()
|
avatarRequest?.cancel()
|
||||||
|
@ -66,12 +68,17 @@ class ProfileHeaderView: UIView {
|
||||||
headerImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(headerPressed)))
|
headerImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(headerPressed)))
|
||||||
headerImageView.isUserInteractionEnabled = true
|
headerImageView.isUserInteractionEnabled = true
|
||||||
|
|
||||||
moreButton.layer.cornerRadius = 16
|
var config = UIButton.Configuration.plain()
|
||||||
moreButton.layer.masksToBounds = true
|
config.image = UIImage(systemName: "ellipsis")
|
||||||
|
moreButton.configuration = config
|
||||||
|
moreButton.setNeedsUpdateConfiguration()
|
||||||
moreButton.addInteraction(UIPointerInteraction(delegate: self))
|
moreButton.addInteraction(UIPointerInteraction(delegate: self))
|
||||||
moreButton.showsMenuAsPrimaryAction = true
|
moreButton.showsMenuAsPrimaryAction = true
|
||||||
moreButton.isContextMenuInteractionEnabled = true
|
moreButton.isContextMenuInteractionEnabled = true
|
||||||
|
|
||||||
|
followButton.setNeedsUpdateConfiguration()
|
||||||
|
followButton.addInteraction(UIPointerInteraction(delegate: self))
|
||||||
|
|
||||||
displayNameLabel.font = UIFontMetrics(forTextStyle: .title1).scaledFont(for: .systemFont(ofSize: 24, weight: .semibold))
|
displayNameLabel.font = UIFontMetrics(forTextStyle: .title1).scaledFont(for: .systemFont(ofSize: 24, weight: .semibold))
|
||||||
displayNameLabel.adjustsFontForContentSizeCategory = true
|
displayNameLabel.adjustsFontForContentSizeCategory = true
|
||||||
|
|
||||||
|
@ -108,27 +115,6 @@ class ProfileHeaderView: UIView {
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(updateUIForPreferences), name: .preferencesChanged, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(updateUIForPreferences), name: .preferencesChanged, object: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func createObservers() {
|
|
||||||
// mastodonController may be nil if the ProfileViewController is deinit'd before the header is even created
|
|
||||||
guard let mastodonController else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
cancellables = []
|
|
||||||
|
|
||||||
mastodonController.persistentContainer.accountSubject
|
|
||||||
.receive(on: DispatchQueue.main)
|
|
||||||
.filter { [weak self] in $0 == self?.accountID }
|
|
||||||
.sink { [weak self] in self?.updateUI(for: $0) }
|
|
||||||
.store(in: &cancellables)
|
|
||||||
|
|
||||||
mastodonController.persistentContainer.relationshipSubject
|
|
||||||
.receive(on: DispatchQueue.main)
|
|
||||||
.filter { [weak self] in $0 == self?.accountID }
|
|
||||||
.sink { [weak self] (_) in self?.updateRelationship() }
|
|
||||||
.store(in: &cancellables)
|
|
||||||
}
|
|
||||||
|
|
||||||
func updateUI(for accountID: String) {
|
func updateUI(for accountID: String) {
|
||||||
self.accountID = accountID
|
self.accountID = accountID
|
||||||
|
|
||||||
|
@ -144,26 +130,19 @@ class ProfileHeaderView: UIView {
|
||||||
|
|
||||||
updateImages(account: account)
|
updateImages(account: account)
|
||||||
|
|
||||||
moreButton.menu = UIMenu(title: "", image: nil, identifier: nil, options: [], children: delegate?.actionsForProfile(accountID: accountID, source: .view(moreButton)) ?? [])
|
moreButton.menu = UIMenu(title: "", image: nil, identifier: nil, options: [], children: delegate?.actionsForProfile(accountID: accountID, source: .view(moreButton), fetchRelationship: false) ?? [])
|
||||||
|
|
||||||
noteTextView.navigationDelegate = delegate
|
noteTextView.navigationDelegate = delegate
|
||||||
noteTextView.setTextFromHtml(account.note)
|
noteTextView.setTextFromHtml(account.note)
|
||||||
noteTextView.setEmojis(account.emojis, identifier: account.id)
|
noteTextView.setEmojis(account.emojis, identifier: account.id)
|
||||||
|
|
||||||
// don't show relationship label for the user's own account
|
if accountID == mastodonController.account?.id {
|
||||||
if accountID != mastodonController.account?.id {
|
followButton.isHidden = true
|
||||||
|
} else {
|
||||||
|
followButton.isHidden = false
|
||||||
|
|
||||||
// while fetching the most up-to-date, show the current data (if any)
|
// while fetching the most up-to-date, show the current data (if any)
|
||||||
updateRelationship()
|
updateRelationship()
|
||||||
|
|
||||||
let request = Client.getRelationships(accounts: [accountID])
|
|
||||||
mastodonController.run(request) { [weak self] (response) in
|
|
||||||
guard let mastodonController = self?.mastodonController,
|
|
||||||
case let .success(results, _) = response,
|
|
||||||
let relationship = results.first else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
mastodonController.persistentContainer.addOrUpdate(relationship: relationship)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldsView.delegate = delegate
|
fieldsView.delegate = delegate
|
||||||
|
@ -183,8 +162,11 @@ class ProfileHeaderView: UIView {
|
||||||
private func updateRelationship() {
|
private func updateRelationship() {
|
||||||
guard let mastodonController = mastodonController,
|
guard let mastodonController = mastodonController,
|
||||||
let relationship = mastodonController.persistentContainer.relationship(forAccount: accountID) else {
|
let relationship = mastodonController.persistentContainer.relationship(forAccount: accountID) else {
|
||||||
return
|
relationshipLabel.isHidden = true
|
||||||
}
|
followButton.isEnabled = false
|
||||||
|
followButtonMode = .follow
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var relationshipStr: String?
|
var relationshipStr: String?
|
||||||
if relationship.following && relationship.followedBy {
|
if relationship.following && relationship.followedBy {
|
||||||
|
@ -202,6 +184,20 @@ class ProfileHeaderView: UIView {
|
||||||
} else {
|
} else {
|
||||||
relationshipLabel.isHidden = true
|
relationshipLabel.isHidden = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if relationship.blocking || relationship.domainBlocking {
|
||||||
|
followButton.isEnabled = false
|
||||||
|
followButtonMode = .blocked
|
||||||
|
} else {
|
||||||
|
followButton.isEnabled = true
|
||||||
|
if relationship.following {
|
||||||
|
followButtonMode = .unfollow
|
||||||
|
} else if relationship.requested {
|
||||||
|
followButtonMode = .cancelRequest
|
||||||
|
} else {
|
||||||
|
followButtonMode = .follow
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func updateUIForPreferences() {
|
@objc private func updateUIForPreferences() {
|
||||||
|
@ -282,11 +278,69 @@ class ProfileHeaderView: UIView {
|
||||||
delegate?.showLoadingLargeImage(url: header, cache: .headers, description: nil, animatingFrom: headerImageView)
|
delegate?.showLoadingLargeImage(url: header, cache: .headers, description: nil, animatingFrom: headerImageView)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@IBAction func followPressed() {
|
||||||
|
let req: Request<Relationship>
|
||||||
|
let action: String
|
||||||
|
switch followButtonMode {
|
||||||
|
case .follow:
|
||||||
|
req = Account.follow(accountID)
|
||||||
|
action = "Following"
|
||||||
|
case .unfollow, .cancelRequest:
|
||||||
|
req = Account.unfollow(accountID)
|
||||||
|
action = followButtonMode == .unfollow ? "Unfollowing" : "Cancelling Request"
|
||||||
|
case .blocked:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
followButton.configuration!.showsActivityIndicator = true
|
||||||
|
followButton.isEnabled = false
|
||||||
|
UIImpactFeedbackGenerator(style: .light).impactOccurred()
|
||||||
|
Task {
|
||||||
|
do {
|
||||||
|
let (relationship, _) = try await mastodonController.run(req)
|
||||||
|
mastodonController.persistentContainer.addOrUpdate(relationship: relationship)
|
||||||
|
// don't need to update the button, since the relationship observer will do so anyways
|
||||||
|
} catch {
|
||||||
|
followButton.isEnabled = true
|
||||||
|
followButton.configuration!.showsActivityIndicator = false
|
||||||
|
if let toastable = delegate?.toastableViewController {
|
||||||
|
let config = ToastConfiguration(from: error, with: "Error \(action)", in: toastable) { toast in
|
||||||
|
toast.dismissToast(animated: true)
|
||||||
|
self.followPressed()
|
||||||
|
}
|
||||||
|
toastable.showToast(configuration: config, animated: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ProfileHeaderView {
|
||||||
|
enum FollowButtonMode {
|
||||||
|
case follow, unfollow, cancelRequest, blocked
|
||||||
|
|
||||||
|
func updateConfig(_ config: inout UIButton.Configuration) {
|
||||||
|
switch self {
|
||||||
|
case .follow:
|
||||||
|
config.title = "Follow"
|
||||||
|
config.image = UIImage(systemName: "person.badge.plus")
|
||||||
|
case .unfollow:
|
||||||
|
config.title = "Unfollow"
|
||||||
|
config.image = UIImage(systemName: "person.badge.minus")
|
||||||
|
case .cancelRequest:
|
||||||
|
config.title = "Cancel Request"
|
||||||
|
config.image = UIImage(systemName: "person.badge.clock")
|
||||||
|
case .blocked:
|
||||||
|
config.title = "Blocked"
|
||||||
|
config.image = UIImage(systemName: "circle.slash")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ProfileHeaderView: UIPointerInteractionDelegate {
|
extension ProfileHeaderView: UIPointerInteractionDelegate {
|
||||||
func pointerInteraction(_ interaction: UIPointerInteraction, styleFor region: UIPointerRegion) -> UIPointerStyle? {
|
func pointerInteraction(_ interaction: UIPointerInteraction, styleFor region: UIPointerRegion) -> UIPointerStyle? {
|
||||||
let preview = UITargetedPreview(view: moreButton)
|
let preview = UITargetedPreview(view: interaction.view!)
|
||||||
return UIPointerStyle(effect: .lift(preview), shape: .none)
|
return UIPointerStyle(effect: .lift(preview), shape: .none)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,20 +45,26 @@
|
||||||
<nil key="textColor"/>
|
<nil key="textColor"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bRJ-Xf-kc9" customClass="VisualEffectImageButton" customModule="Tusker" customModuleProvider="target">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vFa-g3-xIP" customClass="ProfileHeaderButton" customModule="Tusker" customModuleProvider="target">
|
||||||
<rect key="frame" x="374" y="158" width="32" height="32"/>
|
<rect key="frame" x="374" y="158" width="32" height="32"/>
|
||||||
<viewLayoutGuide key="safeArea" id="kQa-ou-pQz"/>
|
|
||||||
<accessibility key="accessibilityConfiguration" label="More Actions">
|
|
||||||
<accessibilityTraits key="traits" button="YES"/>
|
|
||||||
</accessibility>
|
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="32" id="1lX-9R-x90"/>
|
<constraint firstAttribute="width" constant="32" id="969-oZ-nVJ"/>
|
||||||
<constraint firstAttribute="height" constant="32" id="Vp8-v8-Lr1"/>
|
<constraint firstAttribute="height" constant="32" id="Rm3-CK-8eb"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<userDefinedRuntimeAttributes>
|
<state key="normal" title="Button"/>
|
||||||
<userDefinedRuntimeAttribute type="image" keyPath="image" value="ellipsis" catalog="system"/>
|
<buttonConfiguration key="configuration" style="plain" image="ellipsis" catalog="system"/>
|
||||||
</userDefinedRuntimeAttributes>
|
</button>
|
||||||
</view>
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cr8-p9-xkc" customClass="ProfileHeaderButton" customModule="Tusker" customModuleProvider="target">
|
||||||
|
<rect key="frame" x="265" y="158" width="101" height="32"/>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstAttribute="height" constant="32" id="8Ww-Yo-g7G"/>
|
||||||
|
</constraints>
|
||||||
|
<state key="normal" title="Button"/>
|
||||||
|
<buttonConfiguration key="configuration" style="plain" image="person.badge.plus" catalog="system" title="Follow" imagePadding="4"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="followPressed" destination="iN0-l3-epB" eventType="touchUpInside" id="OM3-lq-Z14"/>
|
||||||
|
</connections>
|
||||||
|
</button>
|
||||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="top" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="u4P-3i-gEq">
|
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="top" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="u4P-3i-gEq">
|
||||||
<rect key="frame" x="16" y="266" width="398" height="596"/>
|
<rect key="frame" x="16" y="266" width="398" height="596"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
|
@ -123,13 +129,14 @@
|
||||||
<constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="5ja-fK-Fqz" secondAttribute="bottom" id="9ZS-Ey-eKd"/>
|
<constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="5ja-fK-Fqz" secondAttribute="bottom" id="9ZS-Ey-eKd"/>
|
||||||
<constraint firstItem="jwU-EH-hmC" firstAttribute="top" secondItem="vcl-Gl-kXl" secondAttribute="bottom" id="9lx-Fn-M0U"/>
|
<constraint firstItem="jwU-EH-hmC" firstAttribute="top" secondItem="vcl-Gl-kXl" secondAttribute="bottom" id="9lx-Fn-M0U"/>
|
||||||
<constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="u4P-3i-gEq" secondAttribute="bottom" id="9zc-N2-mfI"/>
|
<constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="u4P-3i-gEq" secondAttribute="bottom" id="9zc-N2-mfI"/>
|
||||||
<constraint firstItem="bRJ-Xf-kc9" firstAttribute="bottom" secondItem="dgG-dR-lSv" secondAttribute="bottom" constant="-8" id="AXS-bG-20Q"/>
|
<constraint firstItem="vFa-g3-xIP" firstAttribute="bottom" secondItem="dgG-dR-lSv" secondAttribute="bottom" constant="-8" id="AXS-bG-20Q"/>
|
||||||
<constraint firstAttribute="trailing" secondItem="5ja-fK-Fqz" secondAttribute="trailing" id="EMk-dp-yJV"/>
|
<constraint firstAttribute="trailing" secondItem="5ja-fK-Fqz" secondAttribute="trailing" id="EMk-dp-yJV"/>
|
||||||
<constraint firstItem="jwU-EH-hmC" firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="TkY-oK-if4" secondAttribute="bottom" id="HBR-rg-RxO"/>
|
<constraint firstItem="jwU-EH-hmC" firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="TkY-oK-if4" secondAttribute="bottom" id="HBR-rg-RxO"/>
|
||||||
<constraint firstItem="dgG-dR-lSv" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="VD1-yc-KSa"/>
|
<constraint firstItem="dgG-dR-lSv" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="VD1-yc-KSa"/>
|
||||||
<constraint firstItem="wT9-2J-uSY" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="16" id="WNS-AR-ff2"/>
|
<constraint firstItem="wT9-2J-uSY" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="16" id="WNS-AR-ff2"/>
|
||||||
<constraint firstItem="bRJ-Xf-kc9" firstAttribute="trailing" secondItem="vUN-kp-3ea" secondAttribute="trailing" constant="-8" id="ZB4-ys-9zP"/>
|
<constraint firstItem="vFa-g3-xIP" firstAttribute="trailing" secondItem="vUN-kp-3ea" secondAttribute="trailing" constant="-8" id="ZB4-ys-9zP"/>
|
||||||
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="vcl-Gl-kXl" secondAttribute="trailing" constant="16" id="e38-Od-kPg"/>
|
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="vcl-Gl-kXl" secondAttribute="trailing" constant="16" id="e38-Od-kPg"/>
|
||||||
|
<constraint firstItem="cr8-p9-xkc" firstAttribute="trailing" secondItem="vFa-g3-xIP" secondAttribute="leading" constant="-8" id="f1L-S8-l6H"/>
|
||||||
<constraint firstItem="u4P-3i-gEq" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="16" id="hgl-UR-o3W"/>
|
<constraint firstItem="u4P-3i-gEq" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="16" id="hgl-UR-o3W"/>
|
||||||
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="dgG-dR-lSv" secondAttribute="trailing" id="j0d-hY-815"/>
|
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="dgG-dR-lSv" secondAttribute="trailing" id="j0d-hY-815"/>
|
||||||
<constraint firstItem="5ja-fK-Fqz" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="16" id="jPG-WM-9km"/>
|
<constraint firstItem="5ja-fK-Fqz" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="16" id="jPG-WM-9km"/>
|
||||||
|
@ -137,26 +144,29 @@
|
||||||
<constraint firstAttribute="trailing" secondItem="u4P-3i-gEq" secondAttribute="trailing" id="ph6-NT-A02"/>
|
<constraint firstAttribute="trailing" secondItem="u4P-3i-gEq" secondAttribute="trailing" id="ph6-NT-A02"/>
|
||||||
<constraint firstItem="u4P-3i-gEq" firstAttribute="top" secondItem="wT9-2J-uSY" secondAttribute="bottom" priority="999" constant="8" id="tKQ-6d-Z55"/>
|
<constraint firstItem="u4P-3i-gEq" firstAttribute="top" secondItem="wT9-2J-uSY" secondAttribute="bottom" priority="999" constant="8" id="tKQ-6d-Z55"/>
|
||||||
<constraint firstItem="u4P-3i-gEq" firstAttribute="top" secondItem="jwU-EH-hmC" secondAttribute="bottom" priority="999" constant="8" id="xDD-rx-gC0"/>
|
<constraint firstItem="u4P-3i-gEq" firstAttribute="top" secondItem="jwU-EH-hmC" secondAttribute="bottom" priority="999" constant="8" id="xDD-rx-gC0"/>
|
||||||
|
<constraint firstItem="cr8-p9-xkc" firstAttribute="centerY" secondItem="vFa-g3-xIP" secondAttribute="centerY" id="xjr-Hn-Tuk"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="avatarContainerView" destination="wT9-2J-uSY" id="yEm-h7-tfq"/>
|
<outlet property="avatarContainerView" destination="wT9-2J-uSY" id="yEm-h7-tfq"/>
|
||||||
<outlet property="avatarImageView" destination="TkY-oK-if4" id="bSJ-7z-j4w"/>
|
<outlet property="avatarImageView" destination="TkY-oK-if4" id="bSJ-7z-j4w"/>
|
||||||
<outlet property="displayNameLabel" destination="vcl-Gl-kXl" id="64n-a9-my0"/>
|
<outlet property="displayNameLabel" destination="vcl-Gl-kXl" id="64n-a9-my0"/>
|
||||||
<outlet property="fieldsView" destination="vKC-m1-Sbs" id="FeE-jh-lYH"/>
|
<outlet property="fieldsView" destination="vKC-m1-Sbs" id="FeE-jh-lYH"/>
|
||||||
|
<outlet property="followButton" destination="cr8-p9-xkc" id="E1n-gh-mCl"/>
|
||||||
<outlet property="headerImageView" destination="dgG-dR-lSv" id="HXT-v4-2iX"/>
|
<outlet property="headerImageView" destination="dgG-dR-lSv" id="HXT-v4-2iX"/>
|
||||||
<outlet property="lockImageView" destination="KNY-GD-beC" id="9EJ-iM-Eos"/>
|
<outlet property="lockImageView" destination="KNY-GD-beC" id="9EJ-iM-Eos"/>
|
||||||
<outlet property="moreButton" destination="bRJ-Xf-kc9" id="zIN-pz-L7y"/>
|
<outlet property="moreButton" destination="vFa-g3-xIP" id="dEX-1a-PHF"/>
|
||||||
<outlet property="noteTextView" destination="1O8-2P-Gbf" id="yss-zZ-uQ5"/>
|
<outlet property="noteTextView" destination="1O8-2P-Gbf" id="yss-zZ-uQ5"/>
|
||||||
<outlet property="relationshipLabel" destination="UF8-nI-KVj" id="dTe-DQ-eJV"/>
|
<outlet property="relationshipLabel" destination="UF8-nI-KVj" id="dTe-DQ-eJV"/>
|
||||||
<outlet property="usernameLabel" destination="1C3-Pd-QiL" id="57b-LQ-3pM"/>
|
<outlet property="usernameLabel" destination="1C3-Pd-QiL" id="57b-LQ-3pM"/>
|
||||||
<outlet property="vStack" destination="u4P-3i-gEq" id="EUC-d2-cQC"/>
|
<outlet property="vStack" destination="u4P-3i-gEq" id="EUC-d2-cQC"/>
|
||||||
</connections>
|
</connections>
|
||||||
<point key="canvasLocation" x="-590" y="117"/>
|
<point key="canvasLocation" x="-591.304347826087" y="116.51785714285714"/>
|
||||||
</view>
|
</view>
|
||||||
</objects>
|
</objects>
|
||||||
<resources>
|
<resources>
|
||||||
<image name="ellipsis" catalog="system" width="128" height="37"/>
|
<image name="ellipsis" catalog="system" width="128" height="37"/>
|
||||||
<image name="lock.fill" catalog="system" width="125" height="128"/>
|
<image name="lock.fill" catalog="system" width="125" height="128"/>
|
||||||
|
<image name="person.badge.plus" catalog="system" width="128" height="125"/>
|
||||||
<systemColor name="labelColor">
|
<systemColor name="labelColor">
|
||||||
<color red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
</systemColor>
|
</systemColor>
|
||||||
|
|
|
@ -89,6 +89,9 @@ class ScrollingSegmentedControl<Value: Hashable>: UIScrollView, UIGestureRecogni
|
||||||
label.accessibilityLabel = "\(option.name), \(index + 1) of \(options.count)"
|
label.accessibilityLabel = "\(option.name), \(index + 1) of \(options.count)"
|
||||||
optionsStack.addArrangedSubview(label)
|
optionsStack.addArrangedSubview(label)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateSelectedIndicatorView()
|
||||||
|
invalidateIntrinsicContentSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
func setSelectedOption(_ value: Value, animated: Bool) {
|
func setSelectedOption(_ value: Value, animated: Bool) {
|
||||||
|
|
|
@ -5,260 +5,257 @@
|
||||||
<deployment identifier="iOS"/>
|
<deployment identifier="iOS"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
|
||||||
<capability name="Image references" minToolsVersion="12.0"/>
|
<capability name="Image references" minToolsVersion="12.0"/>
|
||||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
|
||||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||||
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="ConversationMainStatusTableViewCell" customModule="Tusker" customModuleProvider="target">
|
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" rowHeight="304" id="IDI-ur-8pa" customClass="ConversationMainStatusTableViewCell" customModule="Tusker" customModuleProvider="target">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="375" height="291"/>
|
<rect key="frame" x="0.0" y="0.0" width="393" height="304"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="IDI-ur-8pa" id="MkV-Jo-zuv">
|
||||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="top" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="GuG-Qd-B8I">
|
<rect key="frame" x="0.0" y="0.0" width="393" height="304"/>
|
||||||
<rect key="frame" x="16" y="8" width="343" height="275"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<view contentMode="scaleToFill" verticalHuggingPriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="Cnd-Fj-B7l">
|
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="top" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="GuG-Qd-B8I">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="343" height="50"/>
|
<rect key="frame" x="16" y="8" width="361" height="288"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="mB9-HO-1vf">
|
<view contentMode="scaleToFill" verticalHuggingPriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="Cnd-Fj-B7l">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
|
<rect key="frame" x="0.0" y="0.0" width="361" height="50"/>
|
||||||
<constraints>
|
<subviews>
|
||||||
<constraint firstAttribute="height" constant="50" id="XPF-UL-68q"/>
|
<imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="mB9-HO-1vf">
|
||||||
<constraint firstAttribute="width" constant="50" id="Yxp-Vr-dfl"/>
|
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
|
||||||
</constraints>
|
<constraints>
|
||||||
</imageView>
|
<constraint firstAttribute="height" constant="50" id="XPF-UL-68q"/>
|
||||||
<label opaque="NO" contentMode="left" horizontalHuggingPriority="249" verticalHuggingPriority="251" text="Display name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="12" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lZY-2e-17d" customClass="EmojiLabel" customModule="Tusker" customModuleProvider="target">
|
<constraint firstAttribute="width" constant="50" id="Yxp-Vr-dfl"/>
|
||||||
<rect key="frame" x="58" y="0.0" width="146.5" height="29"/>
|
</constraints>
|
||||||
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="24"/>
|
</imageView>
|
||||||
<nil key="textColor"/>
|
<label opaque="NO" contentMode="left" horizontalHuggingPriority="249" verticalHuggingPriority="251" text="Display name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="12" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lZY-2e-17d" customClass="EmojiLabel" customModule="Tusker" customModuleProvider="target">
|
||||||
<nil key="highlightedColor"/>
|
<rect key="frame" x="58" y="0.0" width="146.5" height="29"/>
|
||||||
</label>
|
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="24"/>
|
||||||
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="@username" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SWg-Ka-QyP">
|
<nil key="textColor"/>
|
||||||
<rect key="frame" x="58" y="29" width="285" height="20.5"/>
|
<nil key="highlightedColor"/>
|
||||||
<fontDescription key="fontDescription" type="system" weight="light" pointSize="17"/>
|
</label>
|
||||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="@username" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SWg-Ka-QyP">
|
||||||
<nil key="highlightedColor"/>
|
<rect key="frame" x="58" y="29" width="303" height="20.5"/>
|
||||||
</label>
|
<fontDescription key="fontDescription" type="system" weight="light" pointSize="17"/>
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xD6-dy-0XV" customClass="StatusMetaIndicatorsView" customModule="Tusker" customModuleProvider="target">
|
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||||
<rect key="frame" x="212.5" y="0.0" width="130.5" height="22"/>
|
<nil key="highlightedColor"/>
|
||||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
</label>
|
||||||
<constraints>
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xD6-dy-0XV" customClass="StatusMetaIndicatorsView" customModule="Tusker" customModuleProvider="target">
|
||||||
<constraint firstAttribute="height" constant="22" placeholder="YES" id="wF5-Ii-LO5"/>
|
<rect key="frame" x="212.5" y="0.0" width="148.5" height="22"/>
|
||||||
</constraints>
|
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
</view>
|
<constraints>
|
||||||
</subviews>
|
<constraint firstAttribute="height" constant="22" placeholder="YES" id="wF5-Ii-LO5"/>
|
||||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
</constraints>
|
||||||
<constraints>
|
</view>
|
||||||
<constraint firstAttribute="trailing" secondItem="SWg-Ka-QyP" secondAttribute="trailing" id="4g6-BT-eW4"/>
|
</subviews>
|
||||||
<constraint firstItem="xD6-dy-0XV" firstAttribute="top" secondItem="Cnd-Fj-B7l" secondAttribute="top" id="7Io-sX-c9k"/>
|
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
<constraint firstItem="lZY-2e-17d" firstAttribute="top" secondItem="Cnd-Fj-B7l" secondAttribute="top" id="8fU-y9-K5Z"/>
|
<constraints>
|
||||||
<constraint firstItem="lZY-2e-17d" firstAttribute="leading" secondItem="mB9-HO-1vf" secondAttribute="trailing" constant="8" id="Aqj-co-Szp"/>
|
<constraint firstAttribute="trailing" secondItem="SWg-Ka-QyP" secondAttribute="trailing" id="4g6-BT-eW4"/>
|
||||||
<constraint firstItem="xD6-dy-0XV" firstAttribute="leading" secondItem="lZY-2e-17d" secondAttribute="trailing" constant="8" id="PfV-YZ-k9j"/>
|
<constraint firstItem="xD6-dy-0XV" firstAttribute="top" secondItem="Cnd-Fj-B7l" secondAttribute="top" id="7Io-sX-c9k"/>
|
||||||
<constraint firstItem="mB9-HO-1vf" firstAttribute="top" secondItem="Cnd-Fj-B7l" secondAttribute="top" id="R7P-rD-Gbm"/>
|
<constraint firstItem="lZY-2e-17d" firstAttribute="top" secondItem="Cnd-Fj-B7l" secondAttribute="top" id="8fU-y9-K5Z"/>
|
||||||
<constraint firstAttribute="bottom" secondItem="mB9-HO-1vf" secondAttribute="bottom" id="Wd0-Qh-idS"/>
|
<constraint firstItem="lZY-2e-17d" firstAttribute="leading" secondItem="mB9-HO-1vf" secondAttribute="trailing" constant="8" id="Aqj-co-Szp"/>
|
||||||
<constraint firstItem="mB9-HO-1vf" firstAttribute="leading" secondItem="Cnd-Fj-B7l" secondAttribute="leading" id="bxq-Fs-1aH"/>
|
<constraint firstItem="xD6-dy-0XV" firstAttribute="leading" secondItem="lZY-2e-17d" secondAttribute="trailing" constant="8" id="PfV-YZ-k9j"/>
|
||||||
<constraint firstItem="SWg-Ka-QyP" firstAttribute="leading" secondItem="mB9-HO-1vf" secondAttribute="trailing" constant="8" id="e45-gE-myI"/>
|
<constraint firstItem="mB9-HO-1vf" firstAttribute="top" secondItem="Cnd-Fj-B7l" secondAttribute="top" id="R7P-rD-Gbm"/>
|
||||||
<constraint firstItem="SWg-Ka-QyP" firstAttribute="top" secondItem="lZY-2e-17d" secondAttribute="bottom" id="lvX-1b-8cN"/>
|
<constraint firstAttribute="bottom" secondItem="mB9-HO-1vf" secondAttribute="bottom" id="Wd0-Qh-idS"/>
|
||||||
<constraint firstAttribute="trailing" secondItem="xD6-dy-0XV" secondAttribute="trailing" id="tfq-dR-UT7"/>
|
<constraint firstItem="mB9-HO-1vf" firstAttribute="leading" secondItem="Cnd-Fj-B7l" secondAttribute="leading" id="bxq-Fs-1aH"/>
|
||||||
</constraints>
|
<constraint firstItem="SWg-Ka-QyP" firstAttribute="leading" secondItem="mB9-HO-1vf" secondAttribute="trailing" constant="8" id="e45-gE-myI"/>
|
||||||
</view>
|
<constraint firstItem="SWg-Ka-QyP" firstAttribute="top" secondItem="lZY-2e-17d" secondAttribute="bottom" id="lvX-1b-8cN"/>
|
||||||
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="751" text="Content Warning" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cwQ-mR-L1b" customClass="EmojiLabel" customModule="Tusker" customModuleProvider="target">
|
<constraint firstAttribute="trailing" secondItem="xD6-dy-0XV" secondAttribute="trailing" id="tfq-dR-UT7"/>
|
||||||
<rect key="frame" x="0.0" y="58" width="343" height="20.5"/>
|
</constraints>
|
||||||
<accessibility key="accessibilityConfiguration">
|
</view>
|
||||||
<accessibilityTraits key="traits" staticText="YES" notEnabled="YES"/>
|
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="751" text="Content Warning" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cwQ-mR-L1b" customClass="EmojiLabel" customModule="Tusker" customModuleProvider="target">
|
||||||
</accessibility>
|
<rect key="frame" x="0.0" y="58" width="361" height="20.5"/>
|
||||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
|
<accessibility key="accessibilityConfiguration">
|
||||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
<accessibilityTraits key="traits" staticText="YES" notEnabled="YES"/>
|
||||||
<nil key="highlightedColor"/>
|
</accessibility>
|
||||||
</label>
|
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8r8-O8-Agh" customClass="StatusCollapseButton" customModule="Tusker" customModuleProvider="target">
|
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||||
<rect key="frame" x="0.0" y="86.5" width="343" height="30"/>
|
<nil key="highlightedColor"/>
|
||||||
<color key="backgroundColor" systemColor="systemBlueColor"/>
|
</label>
|
||||||
<constraints>
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8r8-O8-Agh" customClass="StatusCollapseButton" customModule="Tusker" customModuleProvider="target">
|
||||||
<constraint firstAttribute="height" constant="30" id="icD-3q-uJ6"/>
|
<rect key="frame" x="0.0" y="86.5" width="361" height="30"/>
|
||||||
</constraints>
|
<color key="backgroundColor" systemColor="systemBlueColor"/>
|
||||||
<color key="tintColor" systemColor="systemBackgroundColor"/>
|
<constraints>
|
||||||
<state key="normal" image="chevron.down" catalog="system">
|
<constraint firstAttribute="height" constant="30" id="icD-3q-uJ6"/>
|
||||||
<preferredSymbolConfiguration key="preferredSymbolConfiguration" scale="large"/>
|
</constraints>
|
||||||
</state>
|
<color key="tintColor" systemColor="systemBackgroundColor"/>
|
||||||
<connections>
|
<state key="normal" image="chevron.down" catalog="system">
|
||||||
<action selector="collapseButtonPressed" destination="iN0-l3-epB" eventType="touchUpInside" id="2Jy-L1-lN6"/>
|
<preferredSymbolConfiguration key="preferredSymbolConfiguration" scale="large"/>
|
||||||
</connections>
|
</state>
|
||||||
</button>
|
<connections>
|
||||||
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" verticalCompressionResistancePriority="749" scrollEnabled="NO" delaysContentTouches="NO" editable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="z0g-HN-gS0" customClass="StatusContentTextView" customModule="Tusker" customModuleProvider="target">
|
<action selector="collapseButtonPressed" destination="IDI-ur-8pa" eventType="touchUpInside" id="00b-nM-U5g"/>
|
||||||
<rect key="frame" x="0.0" y="124.5" width="343" height="0.0"/>
|
</connections>
|
||||||
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
|
</button>
|
||||||
<color key="textColor" systemColor="labelColor"/>
|
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" verticalCompressionResistancePriority="749" scrollEnabled="NO" delaysContentTouches="NO" editable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="z0g-HN-gS0" customClass="StatusContentTextView" customModule="Tusker" customModuleProvider="target">
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="20"/>
|
<rect key="frame" x="0.0" y="124.5" width="361" height="2.5"/>
|
||||||
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
|
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
|
||||||
</textView>
|
<color key="textColor" systemColor="labelColor"/>
|
||||||
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QqC-GR-TLC" customClass="StatusCardView" customModule="Tusker" customModuleProvider="target">
|
<fontDescription key="fontDescription" type="system" pointSize="20"/>
|
||||||
<rect key="frame" x="0.0" y="128.5" width="343" height="0.0"/>
|
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
|
||||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
</textView>
|
||||||
<constraints>
|
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QqC-GR-TLC" customClass="StatusCardView" customModule="Tusker" customModuleProvider="target">
|
||||||
<constraint firstAttribute="height" priority="999" constant="65" id="Tdo-Hv-ITE"/>
|
<rect key="frame" x="0.0" y="131" width="361" height="0.0"/>
|
||||||
</constraints>
|
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||||
</view>
|
<constraints>
|
||||||
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="IF9-9U-Gk0" customClass="AttachmentsContainerView" customModule="Tusker" customModuleProvider="target">
|
<constraint firstAttribute="height" priority="999" constant="65" id="Tdo-Hv-ITE"/>
|
||||||
<rect key="frame" x="0.0" y="128.5" width="343" height="0.0"/>
|
</constraints>
|
||||||
<color key="backgroundColor" systemColor="secondarySystemBackgroundColor"/>
|
</view>
|
||||||
<constraints>
|
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="IF9-9U-Gk0" customClass="AttachmentsContainerView" customModule="Tusker" customModuleProvider="target">
|
||||||
<constraint firstAttribute="height" secondItem="IF9-9U-Gk0" secondAttribute="width" multiplier="9:16" priority="999" id="5oh-eK-J5d"/>
|
<rect key="frame" x="0.0" y="131" width="361" height="0.0"/>
|
||||||
</constraints>
|
<color key="backgroundColor" systemColor="secondarySystemBackgroundColor"/>
|
||||||
</view>
|
</view>
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TLv-Xu-tT1" customClass="StatusPollView" customModule="Tusker" customModuleProvider="target">
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TLv-Xu-tT1" customClass="StatusPollView" customModule="Tusker" customModuleProvider="target">
|
||||||
<rect key="frame" x="0.0" y="132.5" width="343" height="39.5"/>
|
<rect key="frame" x="0.0" y="135" width="361" height="50"/>
|
||||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||||
</view>
|
</view>
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ejU-sO-Og5">
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ejU-sO-Og5">
|
||||||
<rect key="frame" x="0.0" y="180" width="343" height="0.5"/>
|
<rect key="frame" x="0.0" y="193" width="361" height="0.5"/>
|
||||||
<color key="backgroundColor" systemColor="opaqueSeparatorColor"/>
|
<color key="backgroundColor" systemColor="opaqueSeparatorColor"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="height" constant="0.5" id="DRI-lB-TyG"/>
|
<constraint firstAttribute="height" constant="0.5" id="DRI-lB-TyG"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</view>
|
</view>
|
||||||
<stackView opaque="NO" contentMode="scaleToFill" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="HZv-qj-gi6">
|
<stackView opaque="NO" contentMode="scaleToFill" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="HZv-qj-gi6">
|
||||||
<rect key="frame" x="0.0" y="188.5" width="142" height="18"/>
|
<rect key="frame" x="0.0" y="201.5" width="142" height="18"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<button opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="252" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yyj-Bs-Vjq">
|
<button opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="252" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yyj-Bs-Vjq">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="75" height="18"/>
|
<rect key="frame" x="0.0" y="0.0" width="75" height="18"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="height" constant="18" id="F9W-LW-swd"/>
|
<constraint firstAttribute="height" constant="18" id="F9W-LW-swd"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<state key="normal" title="2 Favorites">
|
<state key="normal" title="2 Favorites">
|
||||||
<color key="titleColor" systemColor="secondaryLabelColor"/>
|
<color key="titleColor" systemColor="secondaryLabelColor"/>
|
||||||
</state>
|
</state>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="totalFavoritesPressed" destination="iN0-l3-epB" eventType="touchUpInside" id="D3Y-YB-bqP"/>
|
<action selector="totalFavoritesPressed" destination="IDI-ur-8pa" eventType="touchUpInside" id="QEe-yA-n91"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dem-vG-cPB">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dem-vG-cPB">
|
||||||
<rect key="frame" x="83" y="0.0" width="59" height="18"/>
|
<rect key="frame" x="83" y="0.0" width="59" height="18"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="height" constant="18" id="k0P-W7-wMF"/>
|
<constraint firstAttribute="height" constant="18" id="k0P-W7-wMF"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<state key="normal" title="1 Reblog">
|
<state key="normal" title="1 Reblog">
|
||||||
<color key="titleColor" systemColor="secondaryLabelColor"/>
|
<color key="titleColor" systemColor="secondaryLabelColor"/>
|
||||||
</state>
|
</state>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="totalReblogsPressed" destination="iN0-l3-epB" eventType="touchUpInside" id="WG3-nQ-jgr"/>
|
<action selector="totalReblogsPressed" destination="IDI-ur-8pa" eventType="touchUpInside" id="Rmo-Mm-z1A"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
</subviews>
|
</subviews>
|
||||||
</stackView>
|
</stackView>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Sep 7, 2019 12:12:53 PM • Web" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YHN-wG-YWi">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Sep 7, 2019 12:12:53 PM • Web" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YHN-wG-YWi">
|
||||||
<rect key="frame" x="0.0" y="214.5" width="213.5" height="18"/>
|
<rect key="frame" x="0.0" y="227.5" width="213.5" height="18"/>
|
||||||
<accessibility key="accessibilityConfiguration">
|
<accessibility key="accessibilityConfiguration">
|
||||||
<accessibilityTraits key="traits" staticText="YES" notEnabled="YES"/>
|
<accessibilityTraits key="traits" staticText="YES" notEnabled="YES"/>
|
||||||
</accessibility>
|
</accessibility>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3Fp-Nj-sVj">
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3Fp-Nj-sVj">
|
||||||
<rect key="frame" x="0.0" y="240.5" width="343" height="0.5"/>
|
<rect key="frame" x="0.0" y="253.5" width="361" height="0.5"/>
|
||||||
<color key="backgroundColor" systemColor="opaqueSeparatorColor"/>
|
<color key="backgroundColor" systemColor="opaqueSeparatorColor"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="height" constant="0.5" id="akf-Kl-8mK"/>
|
<constraint firstAttribute="height" constant="0.5" id="akf-Kl-8mK"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</view>
|
</view>
|
||||||
<stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" distribution="fillEqually" translatesAutoresizingMaskIntoConstraints="NO" id="3Bg-XP-d13">
|
<stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" distribution="fillEqually" translatesAutoresizingMaskIntoConstraints="NO" id="3Bg-XP-d13">
|
||||||
<rect key="frame" x="0.0" y="249" width="343" height="26"/>
|
<rect key="frame" x="0.0" y="262" width="361" height="26"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2cc-lE-AdG">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2cc-lE-AdG">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="86" height="26"/>
|
<rect key="frame" x="0.0" y="0.0" width="90.5" height="26"/>
|
||||||
<accessibility key="accessibilityConfiguration" label="Reply"/>
|
<accessibility key="accessibilityConfiguration" label="Reply"/>
|
||||||
<state key="normal">
|
<state key="normal">
|
||||||
<imageReference key="image" image="arrowshape.turn.up.left.fill" catalog="system" symbolScale="large"/>
|
<imageReference key="image" image="arrowshape.turn.up.left.fill" catalog="system" symbolScale="large"/>
|
||||||
</state>
|
</state>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="replyPressed" destination="iN0-l3-epB" eventType="touchUpInside" id="RxZ-zv-lkN"/>
|
<action selector="replyPressed" destination="IDI-ur-8pa" eventType="touchUpInside" id="Wic-n9-0Tt"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="DhN-rJ-jdA">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="DhN-rJ-jdA">
|
||||||
<rect key="frame" x="86" y="0.0" width="85.5" height="26"/>
|
<rect key="frame" x="90.5" y="0.0" width="90" height="26"/>
|
||||||
<accessibility key="accessibilityConfiguration" label="Favorite"/>
|
<accessibility key="accessibilityConfiguration" label="Favorite"/>
|
||||||
<state key="normal">
|
<state key="normal">
|
||||||
<imageReference key="image" image="star.fill" catalog="system" symbolScale="large"/>
|
<imageReference key="image" image="star.fill" catalog="system" symbolScale="large"/>
|
||||||
</state>
|
</state>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="favoritePressed" destination="iN0-l3-epB" eventType="touchUpInside" id="NCA-iR-VMt"/>
|
<action selector="favoritePressed" destination="IDI-ur-8pa" eventType="touchUpInside" id="GjO-Fw-3tF"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="GUG-f7-Hdy">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="GUG-f7-Hdy">
|
||||||
<rect key="frame" x="171.5" y="0.0" width="86" height="26"/>
|
<rect key="frame" x="180.5" y="0.0" width="90.5" height="26"/>
|
||||||
<accessibility key="accessibilityConfiguration" label="Reblog"/>
|
<accessibility key="accessibilityConfiguration" label="Reblog"/>
|
||||||
<state key="normal">
|
<state key="normal">
|
||||||
<imageReference key="image" image="repeat" catalog="system" symbolScale="large"/>
|
<imageReference key="image" image="repeat" catalog="system" symbolScale="large"/>
|
||||||
</state>
|
</state>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="reblogPressed" destination="iN0-l3-epB" eventType="touchUpInside" id="iIu-Vv-U0I"/>
|
<action selector="reblogPressed" destination="IDI-ur-8pa" eventType="touchUpInside" id="iLg-O3-i33"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ujo-Ap-dmK">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ujo-Ap-dmK">
|
||||||
<rect key="frame" x="257.5" y="0.0" width="85.5" height="26"/>
|
<rect key="frame" x="271" y="0.0" width="90" height="26"/>
|
||||||
<accessibility key="accessibilityConfiguration" label="More Actions"/>
|
<accessibility key="accessibilityConfiguration" label="More Actions"/>
|
||||||
<state key="normal">
|
<state key="normal">
|
||||||
<imageReference key="image" image="ellipsis" catalog="system" symbolScale="large"/>
|
<imageReference key="image" image="ellipsis" catalog="system" symbolScale="large"/>
|
||||||
</state>
|
</state>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="morePressed" destination="iN0-l3-epB" eventType="touchUpInside" id="1vn-0k-gYi"/>
|
<action selector="morePressed" destination="IDI-ur-8pa" eventType="touchUpInside" id="JNt-fh-WYW"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="height" constant="26" id="bqe-m8-5Lo"/>
|
<constraint firstAttribute="height" constant="26" id="bqe-m8-5Lo"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</stackView>
|
</stackView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstItem="QqC-GR-TLC" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="2WL-jD-I09"/>
|
<constraint firstItem="QqC-GR-TLC" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="2WL-jD-I09"/>
|
||||||
<constraint firstItem="Cnd-Fj-B7l" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="2hS-RG-81T"/>
|
<constraint firstItem="Cnd-Fj-B7l" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="2hS-RG-81T"/>
|
||||||
<constraint firstItem="z0g-HN-gS0" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="4TF-2Z-mdf"/>
|
<constraint firstItem="z0g-HN-gS0" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="4TF-2Z-mdf"/>
|
||||||
<constraint firstItem="IF9-9U-Gk0" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="8A8-wi-7sg"/>
|
<constraint firstItem="IF9-9U-Gk0" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="8A8-wi-7sg"/>
|
||||||
<constraint firstItem="cwQ-mR-L1b" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="O32-3Q-mUs"/>
|
<constraint firstItem="cwQ-mR-L1b" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="O32-3Q-mUs"/>
|
||||||
<constraint firstItem="8r8-O8-Agh" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="bZv-bR-jJ3"/>
|
<constraint firstItem="8r8-O8-Agh" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="bZv-bR-jJ3"/>
|
||||||
<constraint firstItem="ejU-sO-Og5" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="biK-oQ-SLy"/>
|
<constraint firstItem="ejU-sO-Og5" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="biK-oQ-SLy"/>
|
||||||
<constraint firstItem="3Bg-XP-d13" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="iIq-gh-90O"/>
|
<constraint firstItem="3Bg-XP-d13" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="iIq-gh-90O"/>
|
||||||
<constraint firstItem="3Fp-Nj-sVj" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="kfI-WN-ouW"/>
|
<constraint firstItem="3Fp-Nj-sVj" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="kfI-WN-ouW"/>
|
||||||
<constraint firstItem="TLv-Xu-tT1" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="v87-hd-fd4"/>
|
<constraint firstItem="TLv-Xu-tT1" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="v87-hd-fd4"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</stackView>
|
</stackView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
|
<constraints>
|
||||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
<constraint firstAttribute="trailingMargin" secondItem="GuG-Qd-B8I" secondAttribute="trailing" id="GP2-Xt-d67"/>
|
||||||
<constraints>
|
<constraint firstAttribute="bottom" secondItem="GuG-Qd-B8I" secondAttribute="bottom" constant="8" id="Il3-lH-xux"/>
|
||||||
<constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="GuG-Qd-B8I" secondAttribute="bottom" constant="8" id="2F3-0f-0tC"/>
|
<constraint firstItem="GuG-Qd-B8I" firstAttribute="leading" secondItem="MkV-Jo-zuv" secondAttribute="leadingMargin" id="irk-Qi-Wqw"/>
|
||||||
<constraint firstItem="GuG-Qd-B8I" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="16" id="PFH-TI-ZQ9"/>
|
<constraint firstItem="GuG-Qd-B8I" firstAttribute="top" secondItem="MkV-Jo-zuv" secondAttribute="top" constant="8" id="w4H-TR-7gK"/>
|
||||||
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="GuG-Qd-B8I" secondAttribute="trailing" constant="16" id="WpU-W0-YkL"/>
|
</constraints>
|
||||||
<constraint firstItem="GuG-Qd-B8I" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" constant="8" id="oMG-LP-HUD"/>
|
</tableViewCellContentView>
|
||||||
</constraints>
|
|
||||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="attachmentsView" destination="IF9-9U-Gk0" id="Oxw-sJ-MJE"/>
|
<outlet property="attachmentsView" destination="IF9-9U-Gk0" id="UeF-4a-G6k"/>
|
||||||
<outlet property="avatarImageView" destination="mB9-HO-1vf" id="0R0-rt-Osh"/>
|
<outlet property="avatarImageView" destination="mB9-HO-1vf" id="GAt-8i-MIE"/>
|
||||||
<outlet property="cardView" destination="QqC-GR-TLC" id="CWR-fH-IfE"/>
|
<outlet property="cardView" destination="QqC-GR-TLC" id="gkB-5d-ute"/>
|
||||||
<outlet property="collapseButton" destination="8r8-O8-Agh" id="0es-Hi-bpt"/>
|
<outlet property="collapseButton" destination="8r8-O8-Agh" id="kLb-x0-Qx9"/>
|
||||||
<outlet property="contentTextView" destination="z0g-HN-gS0" id="atk-1f-83e"/>
|
<outlet property="contentTextView" destination="z0g-HN-gS0" id="ILZ-WW-zbU"/>
|
||||||
<outlet property="contentWarningLabel" destination="cwQ-mR-L1b" id="5sm-PC-FIN"/>
|
<outlet property="contentWarningLabel" destination="cwQ-mR-L1b" id="JN1-VC-Fql"/>
|
||||||
<outlet property="displayNameLabel" destination="lZY-2e-17d" id="7og-23-eHy"/>
|
<outlet property="displayNameLabel" destination="lZY-2e-17d" id="FFF-kc-1q2"/>
|
||||||
<outlet property="favoriteAndReblogCountStackView" destination="HZv-qj-gi6" id="jC9-cA-dXg"/>
|
<outlet property="favoriteAndReblogCountStackView" destination="HZv-qj-gi6" id="KGA-as-022"/>
|
||||||
<outlet property="favoriteButton" destination="DhN-rJ-jdA" id="b2Q-ch-kSP"/>
|
<outlet property="favoriteButton" destination="DhN-rJ-jdA" id="f6b-VR-dsA"/>
|
||||||
<outlet property="metaIndicatorsView" destination="xD6-dy-0XV" id="Smp-ox-cvj"/>
|
<outlet property="metaIndicatorsView" destination="xD6-dy-0XV" id="sx9-Pf-Qox"/>
|
||||||
<outlet property="moreButton" destination="Ujo-Ap-dmK" id="2ba-5w-HDx"/>
|
<outlet property="moreButton" destination="Ujo-Ap-dmK" id="tBm-jm-2FR"/>
|
||||||
<outlet property="pollView" destination="TLv-Xu-tT1" id="hJX-YD-lNr"/>
|
<outlet property="pollView" destination="TLv-Xu-tT1" id="l9J-Tv-ndf"/>
|
||||||
<outlet property="profileDetailContainerView" destination="Cnd-Fj-B7l" id="wco-VB-VQx"/>
|
<outlet property="profileDetailContainerView" destination="Cnd-Fj-B7l" id="32j-B2-ueG"/>
|
||||||
<outlet property="reblogButton" destination="GUG-f7-Hdy" id="WtT-Ph-DQm"/>
|
<outlet property="reblogButton" destination="GUG-f7-Hdy" id="ZRh-Qy-HXG"/>
|
||||||
<outlet property="replyButton" destination="2cc-lE-AdG" id="My8-JV-Nho"/>
|
<outlet property="replyButton" destination="2cc-lE-AdG" id="EBZ-RJ-Qbp"/>
|
||||||
<outlet property="timestampAndClientLabel" destination="YHN-wG-YWi" id="Onb-fe-qwG"/>
|
<outlet property="timestampAndClientLabel" destination="YHN-wG-YWi" id="ewe-Ad-dYR"/>
|
||||||
<outlet property="totalFavoritesButton" destination="yyj-Bs-Vjq" id="4pV-Qi-Z2X"/>
|
<outlet property="totalFavoritesButton" destination="yyj-Bs-Vjq" id="m4k-RB-lM0"/>
|
||||||
<outlet property="totalReblogsButton" destination="dem-vG-cPB" id="i9E-Qn-d76"/>
|
<outlet property="totalReblogsButton" destination="dem-vG-cPB" id="AHj-6A-5qm"/>
|
||||||
<outlet property="usernameLabel" destination="SWg-Ka-QyP" id="h2I-g4-AD9"/>
|
<outlet property="usernameLabel" destination="SWg-Ka-QyP" id="OFL-Sc-OQX"/>
|
||||||
</connections>
|
</connections>
|
||||||
<point key="canvasLocation" x="40.799999999999997" y="-122.78860569715144"/>
|
<point key="canvasLocation" x="-631.20000000000005" y="-109.74512743628186"/>
|
||||||
</view>
|
</tableViewCell>
|
||||||
</objects>
|
</objects>
|
||||||
<resources>
|
<resources>
|
||||||
<image name="arrowshape.turn.up.left.fill" catalog="system" width="128" height="104"/>
|
<image name="arrowshape.turn.up.left.fill" catalog="system" width="128" height="104"/>
|
||||||
|
|
|
@ -152,6 +152,7 @@ class StatusCardView: UIView {
|
||||||
|
|
||||||
imageRequest = ImageCache.attachments.get(URL(imageURL)!, completion: { (_, image) in
|
imageRequest = ImageCache.attachments.get(URL(imageURL)!, completion: { (_, image) in
|
||||||
guard let image = image,
|
guard let image = image,
|
||||||
|
self.card?.image == imageURL,
|
||||||
let transformedImage = ImageGrayscalifier.convertIfNecessary(url: URL(imageURL)!, image: image) else {
|
let transformedImage = ImageGrayscalifier.convertIfNecessary(url: URL(imageURL)!, image: image) else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ extension StatusCollectionViewCell {
|
||||||
if statusState.unknown {
|
if statusState.unknown {
|
||||||
// layout so that we can take the content height into consideration when deciding whether to collapse
|
// layout so that we can take the content height into consideration when deciding whether to collapse
|
||||||
layoutIfNeeded()
|
layoutIfNeeded()
|
||||||
statusState.resolveFor(status: status, height: contentContainer.contentTextView.bounds.height)
|
statusState.resolveFor(status: status, height: contentContainer.visibleSubviewHeight)
|
||||||
if statusState.collapsible! && showStatusAutomatically {
|
if statusState.collapsible! && showStatusAutomatically {
|
||||||
statusState.collapsed = false
|
statusState.collapsed = false
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +24,7 @@ class StatusContentContainer: UIView {
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
let attachmentsView = AttachmentsContainerView().configure {
|
let attachmentsView = AttachmentsContainerView()
|
||||||
NSLayoutConstraint.activate([
|
|
||||||
$0.heightAnchor.constraint(equalTo: $0.widthAnchor, multiplier: 9/16),
|
|
||||||
])
|
|
||||||
}
|
|
||||||
|
|
||||||
let pollView = StatusPollView()
|
let pollView = StatusPollView()
|
||||||
|
|
||||||
|
@ -43,6 +39,10 @@ class StatusContentContainer: UIView {
|
||||||
private var zeroHeightConstraint: NSLayoutConstraint!
|
private var zeroHeightConstraint: NSLayoutConstraint!
|
||||||
|
|
||||||
private var isCollapsed = false
|
private var isCollapsed = false
|
||||||
|
|
||||||
|
var visibleSubviewHeight: CGFloat {
|
||||||
|
subviews.filter { !$0.isHidden }.map(\.bounds.height).reduce(0, +)
|
||||||
|
}
|
||||||
|
|
||||||
override init(frame: CGRect) {
|
override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
|
|
|
@ -495,8 +495,8 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
||||||
filteredLabel.removeFromSuperview()
|
filteredLabel.removeFromSuperview()
|
||||||
contentView.addSubview(statusContainer)
|
contentView.addSubview(statusContainer)
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
statusContainer.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
statusContainer.leadingAnchor.constraint(equalTo: UIDevice.current.userInterfaceIdiom == .pad ? contentView.readableContentGuide.leadingAnchor : contentView.leadingAnchor),
|
||||||
statusContainer.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
statusContainer.trailingAnchor.constraint(equalTo: UIDevice.current.userInterfaceIdiom == .pad ? contentView.readableContentGuide.trailingAnchor : contentView.trailingAnchor),
|
||||||
statusContainer.topAnchor.constraint(equalTo: contentView.topAnchor),
|
statusContainer.topAnchor.constraint(equalTo: contentView.topAnchor),
|
||||||
statusContainer.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
statusContainer.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
||||||
])
|
])
|
||||||
|
@ -506,8 +506,8 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
||||||
statusContainer.removeFromSuperview()
|
statusContainer.removeFromSuperview()
|
||||||
contentView.addSubview(filteredLabel)
|
contentView.addSubview(filteredLabel)
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
filteredLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
filteredLabel.leadingAnchor.constraint(equalTo: UIDevice.current.userInterfaceIdiom == .pad ? contentView.readableContentGuide.leadingAnchor : contentView.leadingAnchor),
|
||||||
filteredLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
filteredLabel.trailingAnchor.constraint(equalTo: UIDevice.current.userInterfaceIdiom == .pad ? contentView.readableContentGuide.trailingAnchor : contentView.trailingAnchor),
|
||||||
filteredLabel.topAnchor.constraint(equalToSystemSpacingBelow: contentView.topAnchor, multiplier: 1),
|
filteredLabel.topAnchor.constraint(equalToSystemSpacingBelow: contentView.topAnchor, multiplier: 1),
|
||||||
contentView.bottomAnchor.constraint(equalToSystemSpacingBelow: filteredLabel.bottomAnchor, multiplier: 1),
|
contentView.bottomAnchor.constraint(equalToSystemSpacingBelow: filteredLabel.bottomAnchor, multiplier: 1),
|
||||||
])
|
])
|
||||||
|
@ -529,6 +529,7 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
||||||
attrStr.append(showStr)
|
attrStr.append(showStr)
|
||||||
filteredLabel.attributedText = attrStr
|
filteredLabel.attributedText = attrStr
|
||||||
setContentViewMode(.filtered)
|
setContentViewMode(.filtered)
|
||||||
|
return
|
||||||
case .hide:
|
case .hide:
|
||||||
fatalError("unreachable")
|
fatalError("unreachable")
|
||||||
}
|
}
|
||||||
|
@ -822,6 +823,10 @@ extension TimelineStatusCollectionViewCell: StatusSwipeActionContainer {
|
||||||
var navigationDelegate: TuskerNavigationDelegate { delegate! }
|
var navigationDelegate: TuskerNavigationDelegate { delegate! }
|
||||||
var toastableViewController: ToastableViewController? { delegate }
|
var toastableViewController: ToastableViewController? { delegate }
|
||||||
|
|
||||||
|
var canReblog: Bool {
|
||||||
|
reblogButton.isEnabled
|
||||||
|
}
|
||||||
|
|
||||||
func performReplyAction() {
|
func performReplyAction() {
|
||||||
self.replyPressed()
|
self.replyPressed()
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,6 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell {
|
||||||
@IBOutlet weak var pinImageView: UIImageView!
|
@IBOutlet weak var pinImageView: UIImageView!
|
||||||
@IBOutlet weak var actionsContainerView: UIView!
|
@IBOutlet weak var actionsContainerView: UIView!
|
||||||
@IBOutlet weak var actionsContainerHeightConstraint: NSLayoutConstraint!
|
@IBOutlet weak var actionsContainerHeightConstraint: NSLayoutConstraint!
|
||||||
@IBOutlet weak var verticalStackToActionsContainerConstraint: NSLayoutConstraint!
|
|
||||||
@IBOutlet weak var verticalStackToSuperviewConstraint: NSLayoutConstraint!
|
|
||||||
|
|
||||||
var reblogStatusID: String?
|
var reblogStatusID: String?
|
||||||
var rebloggerID: String?
|
var rebloggerID: String?
|
||||||
|
@ -445,6 +443,10 @@ extension TimelineStatusTableViewCell: StatusSwipeActionContainer {
|
||||||
var navigationDelegate: TuskerNavigationDelegate { delegate! }
|
var navigationDelegate: TuskerNavigationDelegate { delegate! }
|
||||||
var toastableViewController: ToastableViewController? { delegate }
|
var toastableViewController: ToastableViewController? { delegate }
|
||||||
|
|
||||||
|
var canReblog: Bool {
|
||||||
|
reblogButton.isEnabled
|
||||||
|
}
|
||||||
|
|
||||||
func performReplyAction() {
|
func performReplyAction() {
|
||||||
self.replyPressed()
|
self.replyPressed()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,273 +1,274 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="iOS"/>
|
<deployment identifier="iOS"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
|
||||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
|
||||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||||
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="TimelineStatusTableViewCell" customModule="Tusker" customModuleProvider="target">
|
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" rowHeight="269" id="BR5-ZS-LIo" customClass="TimelineStatusTableViewCell" customModule="Tusker" customModuleProvider="target">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="375" height="240"/>
|
<rect key="frame" x="0.0" y="0.0" width="393" height="269"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="BR5-ZS-LIo" id="27d-P9-02g">
|
||||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="yNh-ac-v6c">
|
<rect key="frame" x="0.0" y="0.0" width="393" height="269"/>
|
||||||
<rect key="frame" x="16" y="8" width="343" height="224"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="751" text="Reblogged by Person" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lDH-50-AJZ" customClass="EmojiLabel" customModule="Tusker" customModuleProvider="target">
|
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="yNh-ac-v6c">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="343" height="20.5"/>
|
<rect key="frame" x="16" y="8" width="361" height="253"/>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
<subviews>
|
||||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="751" text="Reblogged by Person" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lDH-50-AJZ" customClass="EmojiLabel" customModule="Tusker" customModuleProvider="target">
|
||||||
<nil key="highlightedColor"/>
|
<rect key="frame" x="0.0" y="0.0" width="361" height="20.5"/>
|
||||||
</label>
|
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="H6C-5s-ICE">
|
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||||
<rect key="frame" x="0.0" y="20.5" width="343" height="4"/>
|
<nil key="highlightedColor"/>
|
||||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
</label>
|
||||||
<constraints>
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="H6C-5s-ICE">
|
||||||
<constraint firstAttribute="height" constant="4" id="KdU-GV-9et"/>
|
<rect key="frame" x="0.0" y="20.5" width="361" height="4"/>
|
||||||
</constraints>
|
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
</view>
|
<constraints>
|
||||||
<view contentMode="scaleToFill" verticalHuggingPriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="ve3-Y1-NQH">
|
<constraint firstAttribute="height" constant="4" id="KdU-GV-9et"/>
|
||||||
<rect key="frame" x="0.0" y="24.5" width="343" height="173.5"/>
|
</constraints>
|
||||||
<subviews>
|
</view>
|
||||||
<imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="QMP-j2-HLn">
|
<view contentMode="scaleToFill" verticalHuggingPriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="ve3-Y1-NQH">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
|
<rect key="frame" x="0.0" y="24.5" width="361" height="202.5"/>
|
||||||
<accessibility key="accessibilityConfiguration" label="User Avatar">
|
<subviews>
|
||||||
<bool key="isElement" value="YES"/>
|
<imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="QMP-j2-HLn">
|
||||||
</accessibility>
|
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
|
||||||
<gestureRecognizers/>
|
<accessibility key="accessibilityConfiguration" label="User Avatar">
|
||||||
<constraints>
|
<bool key="isElement" value="YES"/>
|
||||||
<constraint firstAttribute="width" constant="50" id="KZ8-d7-8UK"/>
|
</accessibility>
|
||||||
<constraint firstAttribute="height" constant="50" id="nMi-Gq-JyV"/>
|
<gestureRecognizers/>
|
||||||
</constraints>
|
<constraints>
|
||||||
</imageView>
|
<constraint firstAttribute="width" constant="50" id="KZ8-d7-8UK"/>
|
||||||
<stackView opaque="NO" contentMode="scaleToFill" verticalCompressionResistancePriority="751" axis="vertical" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="gIY-Wp-RSk">
|
<constraint firstAttribute="height" constant="50" id="nMi-Gq-JyV"/>
|
||||||
<rect key="frame" x="58" y="0.0" width="277" height="173.5"/>
|
</constraints>
|
||||||
<subviews>
|
</imageView>
|
||||||
<stackView opaque="NO" contentMode="scaleToFill" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="3Sm-P0-ySf">
|
<stackView opaque="NO" contentMode="scaleToFill" verticalCompressionResistancePriority="751" axis="vertical" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="gIY-Wp-RSk">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="277" height="20.5"/>
|
<rect key="frame" x="58" y="0.0" width="295" height="202.5"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" horizontalCompressionResistancePriority="749" verticalCompressionResistancePriority="752" text="Display name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gll-xe-FSr" customClass="EmojiLabel" customModule="Tusker" customModuleProvider="target">
|
<stackView opaque="NO" contentMode="scaleToFill" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="3Sm-P0-ySf">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="106.5" height="20.5"/>
|
<rect key="frame" x="0.0" y="0.0" width="295" height="20.5"/>
|
||||||
<accessibility key="accessibilityConfiguration">
|
<subviews>
|
||||||
<accessibilityTraits key="traits" staticText="YES" notEnabled="YES"/>
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" horizontalCompressionResistancePriority="749" verticalCompressionResistancePriority="752" text="Display name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gll-xe-FSr" customClass="EmojiLabel" customModule="Tusker" customModuleProvider="target">
|
||||||
</accessibility>
|
<rect key="frame" x="0.0" y="0.0" width="106.5" height="20.5"/>
|
||||||
<gestureRecognizers/>
|
<accessibility key="accessibilityConfiguration">
|
||||||
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
|
<accessibilityTraits key="traits" staticText="YES" notEnabled="YES"/>
|
||||||
<nil key="textColor"/>
|
</accessibility>
|
||||||
<nil key="highlightedColor"/>
|
<gestureRecognizers/>
|
||||||
</label>
|
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="249" verticalHuggingPriority="252" horizontalCompressionResistancePriority="748" verticalCompressionResistancePriority="752" text="@username" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="j89-zc-SFa">
|
<nil key="textColor"/>
|
||||||
<rect key="frame" x="110.5" y="0.0" width="138.5" height="20.5"/>
|
<nil key="highlightedColor"/>
|
||||||
<accessibility key="accessibilityConfiguration">
|
</label>
|
||||||
<accessibilityTraits key="traits" staticText="YES" notEnabled="YES"/>
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="249" verticalHuggingPriority="252" horizontalCompressionResistancePriority="748" verticalCompressionResistancePriority="752" text="@username" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="j89-zc-SFa">
|
||||||
</accessibility>
|
<rect key="frame" x="110.5" y="0.0" width="156.5" height="20.5"/>
|
||||||
<gestureRecognizers/>
|
<accessibility key="accessibilityConfiguration">
|
||||||
<fontDescription key="fontDescription" type="system" weight="light" pointSize="17"/>
|
<accessibilityTraits key="traits" staticText="YES" notEnabled="YES"/>
|
||||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
</accessibility>
|
||||||
<nil key="highlightedColor"/>
|
<gestureRecognizers/>
|
||||||
</label>
|
<fontDescription key="fontDescription" type="system" weight="light" pointSize="17"/>
|
||||||
<imageView hidden="YES" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="pin.fill" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="wtt-8G-Ua1">
|
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||||
<rect key="frame" x="251" y="-0.5" width="0.0" height="22"/>
|
<nil key="highlightedColor"/>
|
||||||
<color key="tintColor" systemColor="secondaryLabelColor"/>
|
</label>
|
||||||
<accessibility key="accessibilityConfiguration" label="Pinned Status"/>
|
<imageView hidden="YES" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="pin.fill" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="wtt-8G-Ua1">
|
||||||
</imageView>
|
<rect key="frame" x="269" y="-0.5" width="0.0" height="22"/>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="752" text="2m" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="35d-EA-ReR">
|
<color key="tintColor" systemColor="secondaryLabelColor"/>
|
||||||
<rect key="frame" x="253" y="0.0" width="24" height="20.5"/>
|
<accessibility key="accessibilityConfiguration" label="Pinned Status"/>
|
||||||
<accessibility key="accessibilityConfiguration">
|
</imageView>
|
||||||
<accessibilityTraits key="traits" staticText="YES" notEnabled="YES"/>
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="752" text="2m" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="35d-EA-ReR">
|
||||||
<bool key="isElement" value="YES"/>
|
<rect key="frame" x="271" y="0.0" width="24" height="20.5"/>
|
||||||
</accessibility>
|
<accessibility key="accessibilityConfiguration">
|
||||||
<fontDescription key="fontDescription" type="system" weight="light" pointSize="17"/>
|
<accessibilityTraits key="traits" staticText="YES" notEnabled="YES"/>
|
||||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
<bool key="isElement" value="YES"/>
|
||||||
<nil key="highlightedColor"/>
|
</accessibility>
|
||||||
</label>
|
<fontDescription key="fontDescription" type="system" weight="light" pointSize="17"/>
|
||||||
</subviews>
|
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||||
<constraints>
|
<nil key="highlightedColor"/>
|
||||||
<constraint firstAttribute="height" secondItem="gll-xe-FSr" secondAttribute="height" id="B7p-Pc-fZD"/>
|
</label>
|
||||||
</constraints>
|
</subviews>
|
||||||
</stackView>
|
<constraints>
|
||||||
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="755" text="Content Warning" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="inI-Og-YiU" customClass="EmojiLabel" customModule="Tusker" customModuleProvider="target">
|
<constraint firstAttribute="height" secondItem="gll-xe-FSr" secondAttribute="height" id="B7p-Pc-fZD"/>
|
||||||
<rect key="frame" x="0.0" y="24.5" width="277" height="20.5"/>
|
</constraints>
|
||||||
<accessibility key="accessibilityConfiguration">
|
</stackView>
|
||||||
<accessibilityTraits key="traits" staticText="YES" notEnabled="YES"/>
|
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="755" text="Content Warning" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="inI-Og-YiU" customClass="EmojiLabel" customModule="Tusker" customModuleProvider="target">
|
||||||
</accessibility>
|
<rect key="frame" x="0.0" y="24.5" width="295" height="20.5"/>
|
||||||
<gestureRecognizers/>
|
<accessibility key="accessibilityConfiguration">
|
||||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
|
<accessibilityTraits key="traits" staticText="YES" notEnabled="YES"/>
|
||||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
</accessibility>
|
||||||
<nil key="highlightedColor"/>
|
<gestureRecognizers/>
|
||||||
</label>
|
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
|
||||||
<button opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="252" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="O0E-Vf-XYR" customClass="StatusCollapseButton" customModule="Tusker" customModuleProvider="target">
|
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||||
<rect key="frame" x="0.0" y="49" width="277" height="30"/>
|
<nil key="highlightedColor"/>
|
||||||
<color key="backgroundColor" systemColor="systemBlueColor"/>
|
</label>
|
||||||
<constraints>
|
<button opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="252" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="O0E-Vf-XYR" customClass="StatusCollapseButton" customModule="Tusker" customModuleProvider="target">
|
||||||
<constraint firstAttribute="height" constant="30" id="z84-XW-gP3"/>
|
<rect key="frame" x="0.0" y="49" width="295" height="30"/>
|
||||||
</constraints>
|
<color key="backgroundColor" systemColor="systemBlueColor"/>
|
||||||
<color key="tintColor" systemColor="systemBackgroundColor"/>
|
<constraints>
|
||||||
<state key="normal" image="chevron.down" catalog="system">
|
<constraint firstAttribute="height" constant="30" id="z84-XW-gP3"/>
|
||||||
<preferredSymbolConfiguration key="preferredSymbolConfiguration" scale="large"/>
|
</constraints>
|
||||||
</state>
|
<color key="tintColor" systemColor="systemBackgroundColor"/>
|
||||||
<connections>
|
<state key="normal" image="chevron.down" catalog="system">
|
||||||
<action selector="collapseButtonPressed" destination="iN0-l3-epB" eventType="touchUpInside" id="JaH-xX-UOD"/>
|
<preferredSymbolConfiguration key="preferredSymbolConfiguration" scale="large"/>
|
||||||
</connections>
|
</state>
|
||||||
</button>
|
<connections>
|
||||||
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" delaysContentTouches="NO" editable="NO" textAlignment="natural" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="waJ-f5-LKv" customClass="StatusContentTextView" customModule="Tusker" customModuleProvider="target">
|
<action selector="collapseButtonPressed" destination="BR5-ZS-LIo" eventType="touchUpInside" id="twO-rE-1pQ"/>
|
||||||
<rect key="frame" x="0.0" y="83" width="277" height="86.5"/>
|
</connections>
|
||||||
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
|
</button>
|
||||||
<color key="textColor" systemColor="labelColor"/>
|
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" delaysContentTouches="NO" editable="NO" textAlignment="natural" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="waJ-f5-LKv" customClass="StatusContentTextView" customModule="Tusker" customModuleProvider="target">
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
<rect key="frame" x="0.0" y="83" width="295" height="115.5"/>
|
||||||
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
|
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
|
||||||
</textView>
|
<color key="textColor" systemColor="labelColor"/>
|
||||||
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LKo-VB-XWl" customClass="StatusCardView" customModule="Tusker" customModuleProvider="target">
|
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||||
<rect key="frame" x="0.0" y="171.5" width="277" height="0.0"/>
|
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
|
||||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
</textView>
|
||||||
<constraints>
|
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LKo-VB-XWl" customClass="StatusCardView" customModule="Tusker" customModuleProvider="target">
|
||||||
<constraint firstAttribute="height" priority="999" constant="65" id="khY-jm-CPn"/>
|
<rect key="frame" x="0.0" y="200.5" width="295" height="0.0"/>
|
||||||
</constraints>
|
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||||
</view>
|
<constraints>
|
||||||
<view hidden="YES" contentMode="scaleToFill" verticalCompressionResistancePriority="1" translatesAutoresizingMaskIntoConstraints="NO" id="nbq-yr-2mA" customClass="AttachmentsContainerView" customModule="Tusker" customModuleProvider="target">
|
<constraint firstAttribute="height" priority="999" constant="65" id="khY-jm-CPn"/>
|
||||||
<rect key="frame" x="0.0" y="171.5" width="277" height="0.0"/>
|
</constraints>
|
||||||
<color key="backgroundColor" systemColor="secondarySystemBackgroundColor"/>
|
</view>
|
||||||
<constraints>
|
<view hidden="YES" contentMode="scaleToFill" verticalCompressionResistancePriority="1" translatesAutoresizingMaskIntoConstraints="NO" id="nbq-yr-2mA" customClass="AttachmentsContainerView" customModule="Tusker" customModuleProvider="target">
|
||||||
<constraint firstAttribute="height" secondItem="nbq-yr-2mA" secondAttribute="width" multiplier="9:16" priority="999" id="Rvt-zs-fkd"/>
|
<rect key="frame" x="0.0" y="200.5" width="295" height="0.0"/>
|
||||||
</constraints>
|
<color key="backgroundColor" systemColor="secondarySystemBackgroundColor"/>
|
||||||
</view>
|
</view>
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="x3b-Zl-9F0" customClass="StatusPollView" customModule="Tusker" customModuleProvider="target">
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="x3b-Zl-9F0" customClass="StatusPollView" customModule="Tusker" customModuleProvider="target">
|
||||||
<rect key="frame" x="0.0" y="173.5" width="277" height="0.0"/>
|
<rect key="frame" x="0.0" y="202.5" width="295" height="0.0"/>
|
||||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||||
</view>
|
</view>
|
||||||
</subviews>
|
</subviews>
|
||||||
</stackView>
|
</stackView>
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qBn-Gk-DCa" customClass="StatusMetaIndicatorsView" customModule="Tusker" customModuleProvider="target">
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qBn-Gk-DCa" customClass="StatusMetaIndicatorsView" customModule="Tusker" customModuleProvider="target">
|
||||||
<rect key="frame" x="0.0" y="54" width="50" height="22"/>
|
<rect key="frame" x="0.0" y="54" width="50" height="22"/>
|
||||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="height" constant="22" placeholder="YES" id="ipd-WE-P20"/>
|
<constraint firstAttribute="height" constant="22" placeholder="YES" id="ipd-WE-P20"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</view>
|
</view>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstItem="gIY-Wp-RSk" firstAttribute="leading" secondItem="QMP-j2-HLn" secondAttribute="trailing" constant="8" id="0Tm-v7-Ts4"/>
|
<constraint firstItem="gIY-Wp-RSk" firstAttribute="leading" secondItem="QMP-j2-HLn" secondAttribute="trailing" constant="8" id="0Tm-v7-Ts4"/>
|
||||||
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="QMP-j2-HLn" secondAttribute="bottom" constant="8" id="2Ao-Gj-fY3"/>
|
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="QMP-j2-HLn" secondAttribute="bottom" constant="8" id="2Ao-Gj-fY3"/>
|
||||||
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="gIY-Wp-RSk" secondAttribute="bottom" id="6OU-Ub-VH8"/>
|
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="gIY-Wp-RSk" secondAttribute="bottom" id="6OU-Ub-VH8"/>
|
||||||
<constraint firstItem="gIY-Wp-RSk" firstAttribute="leading" secondItem="qBn-Gk-DCa" secondAttribute="trailing" constant="8" id="AQs-QN-j49"/>
|
<constraint firstItem="gIY-Wp-RSk" firstAttribute="leading" secondItem="qBn-Gk-DCa" secondAttribute="trailing" constant="8" id="AQs-QN-j49"/>
|
||||||
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="qBn-Gk-DCa" secondAttribute="bottom" id="P1i-ZM-TRt"/>
|
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="qBn-Gk-DCa" secondAttribute="bottom" id="P1i-ZM-TRt"/>
|
||||||
<constraint firstItem="QMP-j2-HLn" firstAttribute="top" secondItem="ve3-Y1-NQH" secondAttribute="top" id="PC4-Bi-QXm"/>
|
<constraint firstItem="QMP-j2-HLn" firstAttribute="top" secondItem="ve3-Y1-NQH" secondAttribute="top" id="PC4-Bi-QXm"/>
|
||||||
<constraint firstItem="gIY-Wp-RSk" firstAttribute="top" secondItem="QMP-j2-HLn" secondAttribute="top" id="fEd-wN-kuQ"/>
|
<constraint firstItem="gIY-Wp-RSk" firstAttribute="top" secondItem="QMP-j2-HLn" secondAttribute="top" id="fEd-wN-kuQ"/>
|
||||||
<constraint firstAttribute="trailingMargin" secondItem="gIY-Wp-RSk" secondAttribute="trailing" id="hKk-kO-wFT"/>
|
<constraint firstAttribute="trailingMargin" secondItem="gIY-Wp-RSk" secondAttribute="trailing" id="hKk-kO-wFT"/>
|
||||||
<constraint firstItem="qBn-Gk-DCa" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="ve3-Y1-NQH" secondAttribute="leading" id="iLD-VU-ixJ"/>
|
<constraint firstItem="qBn-Gk-DCa" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="ve3-Y1-NQH" secondAttribute="leading" id="iLD-VU-ixJ"/>
|
||||||
<constraint firstAttribute="bottom" secondItem="gIY-Wp-RSk" secondAttribute="bottom" id="kq7-bk-S8j"/>
|
<constraint firstAttribute="bottom" secondItem="gIY-Wp-RSk" secondAttribute="bottom" id="kq7-bk-S8j"/>
|
||||||
<constraint firstItem="qBn-Gk-DCa" firstAttribute="top" secondItem="QMP-j2-HLn" secondAttribute="bottom" constant="4" id="tKU-VP-n8P"/>
|
<constraint firstItem="qBn-Gk-DCa" firstAttribute="top" secondItem="QMP-j2-HLn" secondAttribute="bottom" constant="4" id="tKU-VP-n8P"/>
|
||||||
<constraint firstItem="qBn-Gk-DCa" firstAttribute="width" secondItem="QMP-j2-HLn" secondAttribute="width" id="v1v-Pp-ubE"/>
|
<constraint firstItem="qBn-Gk-DCa" firstAttribute="width" secondItem="QMP-j2-HLn" secondAttribute="width" id="v1v-Pp-ubE"/>
|
||||||
<constraint firstItem="QMP-j2-HLn" firstAttribute="leading" secondItem="ve3-Y1-NQH" secondAttribute="leading" id="zeW-tQ-uJl"/>
|
<constraint firstItem="QMP-j2-HLn" firstAttribute="leading" secondItem="ve3-Y1-NQH" secondAttribute="leading" id="zeW-tQ-uJl"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<variation key="default">
|
<variation key="default">
|
||||||
<mask key="constraints">
|
<mask key="constraints">
|
||||||
<exclude reference="kq7-bk-S8j"/>
|
<exclude reference="kq7-bk-S8j"/>
|
||||||
</mask>
|
</mask>
|
||||||
</variation>
|
</variation>
|
||||||
</view>
|
</view>
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TUP-Nz-5Yh">
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TUP-Nz-5Yh">
|
||||||
<rect key="frame" x="0.0" y="198" width="343" height="26"/>
|
<rect key="frame" x="0.0" y="227" width="361" height="26"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rKF-yF-KIa">
|
<button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rKF-yF-KIa">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="86" height="26"/>
|
<rect key="frame" x="0.0" y="0.0" width="90.5" height="26"/>
|
||||||
<accessibility key="accessibilityConfiguration" label="Reply"/>
|
<accessibility key="accessibilityConfiguration" label="Reply"/>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="18"/>
|
<fontDescription key="fontDescription" type="system" pointSize="18"/>
|
||||||
<state key="normal" image="arrowshape.turn.up.left.fill" catalog="system"/>
|
<state key="normal" image="arrowshape.turn.up.left.fill" catalog="system"/>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="replyPressed" destination="iN0-l3-epB" eventType="touchUpInside" id="ybz-3W-jAa"/>
|
<action selector="replyPressed" destination="BR5-ZS-LIo" eventType="touchUpInside" id="ljN-Uq-rSV"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6tW-z8-Qh9">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6tW-z8-Qh9">
|
||||||
<rect key="frame" x="171.5" y="0.0" width="86" height="26"/>
|
<rect key="frame" x="180.5" y="0.0" width="90.5" height="26"/>
|
||||||
<accessibility key="accessibilityConfiguration" label="Reblog"/>
|
<accessibility key="accessibilityConfiguration" label="Reblog"/>
|
||||||
<state key="normal" image="repeat" catalog="system"/>
|
<state key="normal" image="repeat" catalog="system"/>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="reblogPressed" destination="iN0-l3-epB" eventType="touchUpInside" id="Wa2-ZA-TBo"/>
|
<action selector="reblogPressed" destination="BR5-ZS-LIo" eventType="touchUpInside" id="0y7-cF-Nsu"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="982-J4-NGl">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="982-J4-NGl">
|
||||||
<rect key="frame" x="257.5" y="0.0" width="85.5" height="26"/>
|
<rect key="frame" x="271" y="0.0" width="90" height="26"/>
|
||||||
<accessibility key="accessibilityConfiguration" label="More Actions"/>
|
<accessibility key="accessibilityConfiguration" label="More Actions"/>
|
||||||
<state key="normal" image="ellipsis" catalog="system"/>
|
<state key="normal" image="ellipsis" catalog="system"/>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="morePressed" destination="iN0-l3-epB" eventType="touchUpInside" id="WT4-fi-usq"/>
|
<action selector="morePressed" destination="BR5-ZS-LIo" eventType="touchUpInside" id="Nvo-Lw-cQd"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="x0t-TR-jJ4">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" pointerInteraction="YES" translatesAutoresizingMaskIntoConstraints="NO" id="x0t-TR-jJ4">
|
||||||
<rect key="frame" x="86" y="0.0" width="85.5" height="26"/>
|
<rect key="frame" x="90.5" y="0.0" width="90" height="26"/>
|
||||||
<accessibility key="accessibilityConfiguration" label="Favorite"/>
|
<accessibility key="accessibilityConfiguration" label="Favorite"/>
|
||||||
<state key="normal" image="star.fill" catalog="system"/>
|
<state key="normal" image="star.fill" catalog="system"/>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="favoritePressed" destination="iN0-l3-epB" eventType="touchUpInside" id="8Q8-Rz-k02"/>
|
<action selector="favoritePressed" destination="BR5-ZS-LIo" eventType="touchUpInside" id="KUW-UC-40j"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="height" constant="26" id="1FK-Er-G11"/>
|
<constraint firstAttribute="height" constant="26" id="1FK-Er-G11"/>
|
||||||
<constraint firstAttribute="bottom" secondItem="rKF-yF-KIa" secondAttribute="bottom" id="KyG-2C-MgN"/>
|
<constraint firstAttribute="bottom" secondItem="rKF-yF-KIa" secondAttribute="bottom" id="KyG-2C-MgN"/>
|
||||||
<constraint firstItem="x0t-TR-jJ4" firstAttribute="top" secondItem="TUP-Nz-5Yh" secondAttribute="top" id="L3w-JH-eeG"/>
|
<constraint firstItem="x0t-TR-jJ4" firstAttribute="top" secondItem="TUP-Nz-5Yh" secondAttribute="top" id="L3w-JH-eeG"/>
|
||||||
<constraint firstItem="6tW-z8-Qh9" firstAttribute="top" secondItem="TUP-Nz-5Yh" secondAttribute="top" id="N7j-f4-gvP"/>
|
<constraint firstItem="6tW-z8-Qh9" firstAttribute="top" secondItem="TUP-Nz-5Yh" secondAttribute="top" id="N7j-f4-gvP"/>
|
||||||
<constraint firstItem="982-J4-NGl" firstAttribute="leading" secondItem="6tW-z8-Qh9" secondAttribute="trailing" id="VQo-DJ-C7L"/>
|
<constraint firstItem="982-J4-NGl" firstAttribute="leading" secondItem="6tW-z8-Qh9" secondAttribute="trailing" id="VQo-DJ-C7L"/>
|
||||||
<constraint firstItem="982-J4-NGl" firstAttribute="top" secondItem="TUP-Nz-5Yh" secondAttribute="top" id="W53-1a-fKu"/>
|
<constraint firstItem="982-J4-NGl" firstAttribute="top" secondItem="TUP-Nz-5Yh" secondAttribute="top" id="W53-1a-fKu"/>
|
||||||
<constraint firstItem="x0t-TR-jJ4" firstAttribute="leading" secondItem="rKF-yF-KIa" secondAttribute="trailing" id="WPd-A2-6Ju"/>
|
<constraint firstItem="x0t-TR-jJ4" firstAttribute="leading" secondItem="rKF-yF-KIa" secondAttribute="trailing" id="WPd-A2-6Ju"/>
|
||||||
<constraint firstItem="rKF-yF-KIa" firstAttribute="width" secondItem="x0t-TR-jJ4" secondAttribute="width" id="X7m-pJ-oje"/>
|
<constraint firstItem="rKF-yF-KIa" firstAttribute="width" secondItem="x0t-TR-jJ4" secondAttribute="width" id="X7m-pJ-oje"/>
|
||||||
<constraint firstItem="rKF-yF-KIa" firstAttribute="leading" secondItem="TUP-Nz-5Yh" secondAttribute="leading" placeholder="YES" id="aFR-Ew-99S"/>
|
<constraint firstItem="rKF-yF-KIa" firstAttribute="leading" secondItem="TUP-Nz-5Yh" secondAttribute="leading" placeholder="YES" id="aFR-Ew-99S"/>
|
||||||
<constraint firstAttribute="bottom" secondItem="982-J4-NGl" secondAttribute="bottom" id="eXy-3h-51w"/>
|
<constraint firstAttribute="bottom" secondItem="982-J4-NGl" secondAttribute="bottom" id="eXy-3h-51w"/>
|
||||||
<constraint firstAttribute="bottom" secondItem="x0t-TR-jJ4" secondAttribute="bottom" id="euN-Nf-rwh"/>
|
<constraint firstAttribute="bottom" secondItem="x0t-TR-jJ4" secondAttribute="bottom" id="euN-Nf-rwh"/>
|
||||||
<constraint firstItem="6tW-z8-Qh9" firstAttribute="leading" secondItem="x0t-TR-jJ4" secondAttribute="trailing" id="oAK-VG-bbp"/>
|
<constraint firstItem="6tW-z8-Qh9" firstAttribute="leading" secondItem="x0t-TR-jJ4" secondAttribute="trailing" id="oAK-VG-bbp"/>
|
||||||
<constraint firstAttribute="bottom" secondItem="6tW-z8-Qh9" secondAttribute="bottom" id="tpf-Q3-V3l"/>
|
<constraint firstAttribute="bottom" secondItem="6tW-z8-Qh9" secondAttribute="bottom" id="tpf-Q3-V3l"/>
|
||||||
<constraint firstAttribute="trailing" secondItem="982-J4-NGl" secondAttribute="trailing" id="uQG-FZ-F7u"/>
|
<constraint firstAttribute="trailing" secondItem="982-J4-NGl" secondAttribute="trailing" id="uQG-FZ-F7u"/>
|
||||||
<constraint firstItem="rKF-yF-KIa" firstAttribute="width" secondItem="982-J4-NGl" secondAttribute="width" id="vir-iq-biv"/>
|
<constraint firstItem="rKF-yF-KIa" firstAttribute="width" secondItem="982-J4-NGl" secondAttribute="width" id="vir-iq-biv"/>
|
||||||
<constraint firstItem="rKF-yF-KIa" firstAttribute="width" secondItem="6tW-z8-Qh9" secondAttribute="width" id="vqw-d7-VtZ"/>
|
<constraint firstItem="rKF-yF-KIa" firstAttribute="width" secondItem="6tW-z8-Qh9" secondAttribute="width" id="vqw-d7-VtZ"/>
|
||||||
<constraint firstItem="rKF-yF-KIa" firstAttribute="top" secondItem="TUP-Nz-5Yh" secondAttribute="top" id="wWH-J7-egM"/>
|
<constraint firstItem="rKF-yF-KIa" firstAttribute="top" secondItem="TUP-Nz-5Yh" secondAttribute="top" id="wWH-J7-egM"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</view>
|
</view>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstItem="ve3-Y1-NQH" firstAttribute="width" secondItem="yNh-ac-v6c" secondAttribute="width" id="xN6-cs-Tnn"/>
|
<constraint firstItem="ve3-Y1-NQH" firstAttribute="width" secondItem="yNh-ac-v6c" secondAttribute="width" id="xN6-cs-Tnn"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</stackView>
|
<variation key="default">
|
||||||
</subviews>
|
<mask key="constraints">
|
||||||
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
|
<exclude reference="xN6-cs-Tnn"/>
|
||||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
</mask>
|
||||||
<constraints>
|
</variation>
|
||||||
<constraint firstAttribute="trailingMargin" secondItem="yNh-ac-v6c" secondAttribute="trailing" id="2qQ-80-4Ui"/>
|
</stackView>
|
||||||
<constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="yNh-ac-v6c" secondAttribute="bottom" constant="8" id="RKQ-BR-mlH"/>
|
</subviews>
|
||||||
<constraint firstItem="yNh-ac-v6c" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="16" id="YVV-xZ-N4f"/>
|
<constraints>
|
||||||
<constraint firstItem="yNh-ac-v6c" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" constant="8" id="aAG-d7-dmV"/>
|
<constraint firstItem="yNh-ac-v6c" firstAttribute="top" secondItem="27d-P9-02g" secondAttribute="top" constant="8" id="BV4-cX-hOq"/>
|
||||||
</constraints>
|
<constraint firstAttribute="bottom" secondItem="yNh-ac-v6c" secondAttribute="bottom" constant="8" id="Bjn-HM-IXF"/>
|
||||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
<constraint firstItem="yNh-ac-v6c" firstAttribute="leading" secondItem="27d-P9-02g" secondAttribute="leadingMargin" id="Y9H-aJ-Nab"/>
|
||||||
|
<constraint firstAttribute="trailingMargin" secondItem="yNh-ac-v6c" secondAttribute="trailing" id="etD-1m-QVM"/>
|
||||||
|
</constraints>
|
||||||
|
</tableViewCellContentView>
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="actionsContainerHeightConstraint" destination="1FK-Er-G11" id="9yN-NJ-GjN"/>
|
<outlet property="actionsContainerHeightConstraint" destination="1FK-Er-G11" id="rkH-TL-9rr"/>
|
||||||
<outlet property="actionsContainerView" destination="TUP-Nz-5Yh" id="NHM-5L-Odz"/>
|
<outlet property="actionsContainerView" destination="TUP-Nz-5Yh" id="B5c-tl-Sbw"/>
|
||||||
<outlet property="attachmentsView" destination="nbq-yr-2mA" id="SVm-zl-mPb"/>
|
<outlet property="attachmentsView" destination="nbq-yr-2mA" id="MAs-nv-cNN"/>
|
||||||
<outlet property="avatarImageView" destination="QMP-j2-HLn" id="xfS-v8-Gzu"/>
|
<outlet property="avatarImageView" destination="QMP-j2-HLn" id="73F-6g-drx"/>
|
||||||
<outlet property="cardView" destination="LKo-VB-XWl" id="6X5-8P-Ata"/>
|
<outlet property="cardView" destination="LKo-VB-XWl" id="Ypd-Cr-fie"/>
|
||||||
<outlet property="collapseButton" destination="O0E-Vf-XYR" id="nWd-gg-st8"/>
|
<outlet property="collapseButton" destination="O0E-Vf-XYR" id="oTb-VA-JHD"/>
|
||||||
<outlet property="contentTextView" destination="waJ-f5-LKv" id="hrR-Zg-gLY"/>
|
<outlet property="contentTextView" destination="waJ-f5-LKv" id="Tyd-9N-WxW"/>
|
||||||
<outlet property="contentWarningLabel" destination="inI-Og-YiU" id="C7a-eK-qcx"/>
|
<outlet property="contentWarningLabel" destination="inI-Og-YiU" id="TmT-Fq-HVG"/>
|
||||||
<outlet property="displayNameLabel" destination="gll-xe-FSr" id="vVS-WM-Wqx"/>
|
<outlet property="displayNameLabel" destination="gll-xe-FSr" id="dAN-AD-XMb"/>
|
||||||
<outlet property="favoriteButton" destination="x0t-TR-jJ4" id="guV-yz-Lm6"/>
|
<outlet property="favoriteButton" destination="x0t-TR-jJ4" id="jE8-4t-FVW"/>
|
||||||
<outlet property="metaIndicatorsView" destination="qBn-Gk-DCa" id="HTg-JD-7zH"/>
|
<outlet property="metaIndicatorsView" destination="qBn-Gk-DCa" id="Hd4-6j-lvT"/>
|
||||||
<outlet property="moreButton" destination="982-J4-NGl" id="Pux-tL-aWe"/>
|
<outlet property="moreButton" destination="982-J4-NGl" id="GwC-R2-qSn"/>
|
||||||
<outlet property="pinImageView" destination="wtt-8G-Ua1" id="mE8-oe-m1l"/>
|
<outlet property="pinImageView" destination="wtt-8G-Ua1" id="igV-Q0-3h9"/>
|
||||||
<outlet property="pollView" destination="x3b-Zl-9F0" id="WIF-Oz-cnm"/>
|
<outlet property="pollView" destination="x3b-Zl-9F0" id="aZF-5R-yOi"/>
|
||||||
<outlet property="reblogButton" destination="6tW-z8-Qh9" id="u2t-8D-kOn"/>
|
<outlet property="reblogButton" destination="6tW-z8-Qh9" id="k4G-ZY-yNO"/>
|
||||||
<outlet property="reblogLabel" destination="lDH-50-AJZ" id="uJf-Pt-cEP"/>
|
<outlet property="reblogLabel" destination="lDH-50-AJZ" id="asF-Ea-qOg"/>
|
||||||
<outlet property="reblogSpacer" destination="H6C-5s-ICE" id="yFb-Yx-flv"/>
|
<outlet property="reblogSpacer" destination="H6C-5s-ICE" id="LEq-6z-z1E"/>
|
||||||
<outlet property="replyButton" destination="rKF-yF-KIa" id="rka-q1-o4a"/>
|
<outlet property="replyButton" destination="rKF-yF-KIa" id="bx6-Co-4KB"/>
|
||||||
<outlet property="timestampLabel" destination="35d-EA-ReR" id="Ny2-nV-nqP"/>
|
<outlet property="timestampLabel" destination="35d-EA-ReR" id="NEL-KM-hOJ"/>
|
||||||
<outlet property="usernameLabel" destination="j89-zc-SFa" id="bXX-FZ-fCp"/>
|
<outlet property="usernameLabel" destination="j89-zc-SFa" id="fgg-kb-b9s"/>
|
||||||
<outlet property="verticalStackToSuperviewConstraint" destination="kq7-bk-S8j" id="Rfv-Bn-8B4"/>
|
|
||||||
</connections>
|
</connections>
|
||||||
<point key="canvasLocation" x="29.600000000000001" y="79.160419790104953"/>
|
<point key="canvasLocation" x="-848.79999999999995" y="79.610194902548727"/>
|
||||||
</view>
|
</tableViewCell>
|
||||||
</objects>
|
</objects>
|
||||||
<resources>
|
<resources>
|
||||||
<image name="arrowshape.turn.up.left.fill" catalog="system" width="128" height="104"/>
|
<image name="arrowshape.turn.up.left.fill" catalog="system" width="128" height="104"/>
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Pachyderm
|
import Pachyderm
|
||||||
|
import Sentry
|
||||||
|
|
||||||
struct ToastConfiguration {
|
struct ToastConfiguration {
|
||||||
var systemImageName: String?
|
var systemImageName: String?
|
||||||
|
@ -38,7 +39,7 @@ extension ToastConfiguration {
|
||||||
init(from error: Error, with title: String, in viewController: UIViewController, retryAction: ((ToastView) -> Void)?) {
|
init(from error: Error, with title: String, in viewController: UIViewController, retryAction: ((ToastView) -> Void)?) {
|
||||||
self.init(title: title)
|
self.init(title: title)
|
||||||
// localizedDescription is statically dispatched, so we need to call it after the downcast
|
// localizedDescription is statically dispatched, so we need to call it after the downcast
|
||||||
if let error = error as? Client.Error {
|
if let error = error as? Pachyderm.Client.Error {
|
||||||
self.subtitle = error.localizedDescription
|
self.subtitle = error.localizedDescription
|
||||||
self.systemImageName = error.systemImageName
|
self.systemImageName = error.systemImageName
|
||||||
self.longPressAction = { [unowned viewController] toast in
|
self.longPressAction = { [unowned viewController] toast in
|
||||||
|
@ -54,6 +55,36 @@ extension ToastConfiguration {
|
||||||
})
|
})
|
||||||
viewController.present(reporter, animated: true)
|
viewController.present(reporter, animated: true)
|
||||||
}
|
}
|
||||||
|
// TODO: this is a bizarre place to do this, but code path covers basically all errors
|
||||||
|
switch error.type {
|
||||||
|
case .invalidRequest, .invalidResponse, .invalidModel(_), .mastodonError(_):
|
||||||
|
SentrySDK.capture(error: error) { scope in
|
||||||
|
scope.setFingerprint([String(describing: error)])
|
||||||
|
let crumb = Breadcrumb(level: .error, category: "error")
|
||||||
|
crumb.message = title
|
||||||
|
crumb.data = [
|
||||||
|
"request_method": error.requestMethod.name,
|
||||||
|
"request_endpoint": error.requestEndpoint.description,
|
||||||
|
]
|
||||||
|
switch error.type {
|
||||||
|
case .invalidRequest:
|
||||||
|
crumb.data!["error_type"] = "invalid_request"
|
||||||
|
case .invalidResponse:
|
||||||
|
crumb.data!["error_type"] = "invalid_response"
|
||||||
|
case .invalidModel(let error):
|
||||||
|
crumb.data!["error_type"] = "invalid_model"
|
||||||
|
crumb.data!["underlying_error"] = String(describing: error)
|
||||||
|
case .mastodonError(let error):
|
||||||
|
crumb.data!["error_type"] = "mastodon_error"
|
||||||
|
crumb.data!["underlying_error"] = error
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
scope.add(crumb)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
self.subtitle = error.localizedDescription
|
self.subtitle = error.localizedDescription
|
||||||
self.systemImageName = "exclamationmark.triangle"
|
self.systemImageName = "exclamationmark.triangle"
|
||||||
|
@ -73,7 +104,7 @@ extension ToastConfiguration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate extension Client.Error {
|
fileprivate extension Pachyderm.Client.Error {
|
||||||
var systemImageName: String {
|
var systemImageName: String {
|
||||||
switch type {
|
switch type {
|
||||||
case .networkError(_):
|
case .networkError(_):
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue