Merge pull request #204 from tootsuite/fix/confirm-email-asset

Fix image assert may not render correctly issue
This commit is contained in:
CMK 2021-07-06 12:00:50 +08:00 committed by GitHub
commit 3029b7416c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 44 additions and 5 deletions

View File

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

View File

@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "mastodon.with.mail.svg",
"filename" : "c1 1.svg",
"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 }
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 }
if self.emptyView.superview != nil {
self.emptyView.removeFromSuperview()
@ -310,6 +314,11 @@ extension HomeTimelineViewController {
@objc private func showWelcomeAction(_ sender: UIAction) {
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) {
coordinator.present(scene: .publicTimeline, from: self, transition: .show)

View File

@ -37,4 +37,17 @@ final class MastodonConfirmEmailViewModel {
self.userToken = userToken
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
/// [Document](https://docs.joinmastodon.org/entities/application/)
public struct Application: Codable {
public let name: String
public let website: String?
@ -27,6 +27,15 @@ extension Mastodon.Entity {
public let redirectURI: String? // undocumented
public let clientID: 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 {
case name

View File

@ -17,10 +17,18 @@ extension Mastodon.Entity {
/// # Reference
/// [Document](https://docs.joinmastodon.org/entities/token/)
public struct Token: Codable {
public let accessToken: String
public let tokenType: String
public let scope: String
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 {
case accessToken = "access_token"