2021-02-23 08:38:05 +01:00
|
|
|
//
|
|
|
|
// MastodonConfirmEmailViewModel.swift
|
|
|
|
// Mastodon
|
|
|
|
//
|
|
|
|
// Created by sxiaojian on 2021/2/23.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Combine
|
2021-02-24 13:06:28 +01:00
|
|
|
import Foundation
|
|
|
|
import MastodonSDK
|
2021-02-23 08:38:05 +01:00
|
|
|
|
|
|
|
final class MastodonConfirmEmailViewModel {
|
|
|
|
var disposeBag = Set<AnyCancellable>()
|
2021-02-24 13:06:28 +01:00
|
|
|
|
2021-03-08 12:05:15 +01:00
|
|
|
// input
|
2021-02-23 08:38:05 +01:00
|
|
|
let context: AppContext
|
|
|
|
var email: String
|
2021-02-24 13:06:28 +01:00
|
|
|
let authenticateInfo: AuthenticationViewModel.AuthenticateInfo
|
|
|
|
let userToken: Mastodon.Entity.Token
|
2021-03-08 12:05:15 +01:00
|
|
|
let updateCredentialQuery: Mastodon.API.Account.UpdateCredentialQuery
|
2021-02-24 13:06:28 +01:00
|
|
|
|
|
|
|
let timestampUpdatePublisher = Timer.publish(every: 4.0, on: .main, in: .common)
|
|
|
|
.autoconnect()
|
|
|
|
.share()
|
|
|
|
.eraseToAnyPublisher()
|
|
|
|
|
2021-03-08 12:05:15 +01:00
|
|
|
init(
|
|
|
|
context: AppContext,
|
|
|
|
email: String,
|
|
|
|
authenticateInfo: AuthenticationViewModel.AuthenticateInfo,
|
|
|
|
userToken: Mastodon.Entity.Token,
|
|
|
|
updateCredentialQuery: Mastodon.API.Account.UpdateCredentialQuery
|
|
|
|
) {
|
2021-02-23 08:38:05 +01:00
|
|
|
self.context = context
|
|
|
|
self.email = email
|
2021-02-24 13:06:28 +01:00
|
|
|
self.authenticateInfo = authenticateInfo
|
|
|
|
self.userToken = userToken
|
2021-03-08 12:05:15 +01:00
|
|
|
self.updateCredentialQuery = updateCredentialQuery
|
2021-02-23 08:38:05 +01:00
|
|
|
}
|
|
|
|
}
|