Update iOS to use FreshRSS branding

This commit is contained in:
Maurice Parker 2019-06-20 07:33:17 -05:00
parent 4b13e508e7
commit 6765206a1b
3 changed files with 24 additions and 6 deletions

View File

@ -0,0 +1,15 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "accountFreshRSS.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}

View File

@ -21,7 +21,7 @@ struct SettingsReaderAPIAccountView : View {
NavigationView { NavigationView {
List { List {
Section(header: Section(header:
SettingsAccountLabelView(accountImage: "accountLocal", accountLabel: "Google Reader Compatible").padding() SettingsAccountLabelView(accountImage: "accountFreshRSS", accountLabel: "FreshRSS").padding()
) { ) {
HStack { HStack {
Text("Email:") Text("Email:")
@ -83,7 +83,7 @@ struct SettingsReaderAPIAccountView : View {
return return
} }
Account.validateCredentials(type: .readerAPI, credentials: credentials, endpoint: apiURL) { result in Account.validateCredentials(type: viewModel.accountType, credentials: credentials, endpoint: apiURL) { result in
self.busy = false self.busy = false
@ -95,7 +95,7 @@ struct SettingsReaderAPIAccountView : View {
var newAccount = false var newAccount = false
let workAccount: Account let workAccount: Account
if self.viewModel.account == nil { if self.viewModel.account == nil {
workAccount = AccountManager.shared.createAccount(type: .readerAPI) workAccount = AccountManager.shared.createAccount(type: self.viewModel.accountType)
newAccount = true newAccount = true
} else { } else {
workAccount = self.viewModel.account! workAccount = self.viewModel.account!
@ -139,13 +139,16 @@ struct SettingsReaderAPIAccountView : View {
class ViewModel: BindableObject { class ViewModel: BindableObject {
let didChange = PassthroughSubject<ViewModel, Never>() let didChange = PassthroughSubject<ViewModel, Never>()
var accountType: AccountType
var account: Account? = nil var account: Account? = nil
init() { init(accountType: AccountType) {
self.accountType = accountType
} }
init(account: Account) { init(accountType: AccountType, account: Account) {
self.account = account self.account = account
self.accountType = accountType
if case .basic(let username, let password) = try? account.retrieveBasicCredentials() { if case .basic(let username, let password) = try? account.retrieveBasicCredentials() {
self.email = username self.email = username
self.password = password self.password = password
@ -181,7 +184,7 @@ struct SettingsReaderAPIAccountView : View {
#if DEBUG #if DEBUG
struct SettingsReaderAPIAccountView_Previews : PreviewProvider { struct SettingsReaderAPIAccountView_Previews : PreviewProvider {
static var previews: some View { static var previews: some View {
SettingsReaderAPIAccountView(viewModel: SettingsReaderAPIAccountView.ViewModel()) SettingsReaderAPIAccountView(viewModel: SettingsReaderAPIAccountView.ViewModel(accountType: .freshRSS))
} }
} }
#endif #endif