-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3124eec
commit 9113450
Showing
7 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,3 +42,4 @@ | |
"Typing" = "Typing"; | ||
"Complete" = "Complete"; | ||
"Uncomplete" = "Uncomplete"; | ||
"Recent" = "Recent"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// RecentDocuments.swift | ||
// | ||
// | ||
// Created by Maurice Parker on 2/2/21. | ||
// | ||
|
||
import UIKit | ||
import RSCore | ||
|
||
public final class RecentDocuments: Identifiable, DocumentContainer { | ||
|
||
public var id: EntityID | ||
public var name: String? = L10n.recent | ||
public var image: RSImage? = UIImage(systemName: "clock")! | ||
|
||
public weak var account: Account? | ||
|
||
public init(account: Account) { | ||
self.id = .recentDocuments(account.id.accountID) | ||
self.account = account | ||
} | ||
|
||
public func sortedDocuments(completion: @escaping (Result<[Document], Error>) -> Void) { | ||
let sortedDocuments = Self.sortByUpdate(account?.documents ?? [Document]()) | ||
let suffix = Array(sortedDocuments.suffix(10)) | ||
completion(.success(suffix)) | ||
} | ||
|
||
} |