fix: vector assert not correct rendered issue

This commit is contained in:
CMK 2021-07-06 11:59:28 +08:00
parent 0ef0819dad
commit cca8432fb6
7 changed files with 44 additions and 5 deletions

View File

@ -12,7 +12,7 @@
<key>CoreDataStack.xcscheme_^#shared#^_</key> <key>CoreDataStack.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>21</integer> <integer>20</integer>
</dict> </dict>
<key>Mastodon - ASDK.xcscheme_^#shared#^_</key> <key>Mastodon - ASDK.xcscheme_^#shared#^_</key>
<dict> <dict>
@ -37,7 +37,7 @@
<key>NotificationService.xcscheme_^#shared#^_</key> <key>NotificationService.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>20</integer> <integer>21</integer>
</dict> </dict>
</dict> </dict>
<key>SuppressBuildableAutocreation</key> <key>SuppressBuildableAutocreation</key>

View File

@ -1,7 +1,7 @@
{ {
"images" : [ "images" : [
{ {
"filename" : "mastodon.with.mail.svg", "filename" : "c1 1.svg",
"idiom" : "universal" "idiom" : "universal"
} }
], ],

View File

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -31,7 +31,11 @@ extension HomeTimelineViewController {
guard let self = self else { return } guard let self = self else { return }
self.showWelcomeAction(action) self.showWelcomeAction(action)
}, },
UIAction(title: "Show Or Remove EmptyView", image: UIImage(systemName: "clear"), attributes: []) { [weak self] action in UIAction(title: "Show Confirm Email", image: UIImage(systemName: "envelope"), attributes: []) { [weak self] action in
guard let self = self else { return }
self.showConfirmEmail(action)
},
UIAction(title: "Toggle EmptyView", image: UIImage(systemName: "clear"), attributes: []) { [weak self] action in
guard let self = self else { return } guard let self = self else { return }
if self.emptyView.superview != nil { if self.emptyView.superview != nil {
self.emptyView.removeFromSuperview() self.emptyView.removeFromSuperview()
@ -310,6 +314,11 @@ extension HomeTimelineViewController {
@objc private func showWelcomeAction(_ sender: UIAction) { @objc private func showWelcomeAction(_ sender: UIAction) {
coordinator.present(scene: .welcome, from: self, transition: .modal(animated: true, completion: nil)) coordinator.present(scene: .welcome, from: self, transition: .modal(animated: true, completion: nil))
} }
@objc private func showConfirmEmail(_ sender: UIAction) {
let mastodonConfirmEmailViewModel = MastodonConfirmEmailViewModel()
coordinator.present(scene: .mastodonConfirmEmail(viewModel: mastodonConfirmEmailViewModel), from: nil, transition: .modal(animated: true, completion: nil))
}
@objc private func showPublicTimelineAction(_ sender: UIAction) { @objc private func showPublicTimelineAction(_ sender: UIAction) {
coordinator.present(scene: .publicTimeline, from: self, transition: .show) coordinator.present(scene: .publicTimeline, from: self, transition: .show)

View File

@ -37,4 +37,17 @@ final class MastodonConfirmEmailViewModel {
self.userToken = userToken self.userToken = userToken
self.updateCredentialQuery = updateCredentialQuery self.updateCredentialQuery = updateCredentialQuery
} }
#if DEBUG
init() {
self.context = AppContext.shared
self.email = "example.com"
self.authenticateInfo = AuthenticationViewModel.AuthenticateInfo(
domain: "",
application: Mastodon.Entity.Application(name: "", website: nil, vapidKey: nil, redirectURI: nil, clientID: "clientID", clientSecret: "clientSecret")
)!
self.userToken = Mastodon.Entity.Token(accessToken: "", tokenType: "", scope: "", createdAt: Date())
self.updateCredentialQuery = Mastodon.API.Account.UpdateCredentialQuery(discoverable: nil, bot: nil, displayName: nil, note: nil, avatar: nil, header: nil, locked: nil, source: nil, fieldsAttributes: nil)
}
#endif
} }

View File

@ -17,7 +17,7 @@ extension Mastodon.Entity {
/// # Reference /// # Reference
/// [Document](https://docs.joinmastodon.org/entities/application/) /// [Document](https://docs.joinmastodon.org/entities/application/)
public struct Application: Codable { public struct Application: Codable {
public let name: String public let name: String
public let website: String? public let website: String?
@ -27,6 +27,15 @@ extension Mastodon.Entity {
public let redirectURI: String? // undocumented public let redirectURI: String? // undocumented
public let clientID: String? public let clientID: String?
public let clientSecret: String? public let clientSecret: String?
public init(name: String, website: String?, vapidKey: String?, redirectURI: String?, clientID: String?, clientSecret: String?) {
self.name = name
self.website = website
self.vapidKey = vapidKey
self.redirectURI = redirectURI
self.clientID = clientID
self.clientSecret = clientSecret
}
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case name case name

View File

@ -17,10 +17,18 @@ extension Mastodon.Entity {
/// # Reference /// # Reference
/// [Document](https://docs.joinmastodon.org/entities/token/) /// [Document](https://docs.joinmastodon.org/entities/token/)
public struct Token: Codable { public struct Token: Codable {
public let accessToken: String public let accessToken: String
public let tokenType: String public let tokenType: String
public let scope: String public let scope: String
public let createdAt: Date public let createdAt: Date
public init(accessToken: String, tokenType: String, scope: String, createdAt: Date) {
self.accessToken = accessToken
self.tokenType = tokenType
self.scope = scope
self.createdAt = createdAt
}
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case accessToken = "access_token" case accessToken = "access_token"