Merge pull request #2230 from rizwankce/fix/settings-account-header-imageview
Settings account header imageview
This commit is contained in:
commit
5efc02f969
|
@ -0,0 +1,37 @@
|
|||
//
|
||||
// AccountHeaderImageView.swift
|
||||
// Multiplatform iOS
|
||||
//
|
||||
// Created by Rizwan on 08/07/20.
|
||||
// Copyright © 2020 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import RSCore
|
||||
|
||||
struct AccountHeaderImageView: View {
|
||||
var image: RSImage
|
||||
|
||||
var body: some View {
|
||||
HStack(alignment: .center) {
|
||||
Spacer()
|
||||
Image(rsImage: image)
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(height: 48, alignment: .center)
|
||||
.foregroundColor(Color.primary)
|
||||
Spacer()
|
||||
}
|
||||
.padding(16)
|
||||
}
|
||||
}
|
||||
|
||||
struct AccountHeaderImageView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
Group {
|
||||
AccountHeaderImageView(image: AppAssets.image(for: .onMyMac)!)
|
||||
AccountHeaderImageView(image: AppAssets.image(for: .feedbin)!)
|
||||
AccountHeaderImageView(image: AppAssets.accountLocalPadImage)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,8 +17,8 @@ struct SettingsAccountLabelView: View {
|
|||
HStack {
|
||||
Image(rsImage: accountImage!)
|
||||
.resizable()
|
||||
.aspectRatio(1, contentMode: .fit)
|
||||
.frame(height: 32)
|
||||
.scaledToFit()
|
||||
.frame(width: 32, height: 32)
|
||||
Text(verbatim: accountLabel).font(.title)
|
||||
}
|
||||
.foregroundColor(.primary).padding(4.0)
|
||||
|
@ -27,10 +27,23 @@ struct SettingsAccountLabelView: View {
|
|||
|
||||
struct SettingsAccountLabelView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
SettingsAccountLabelView(
|
||||
accountImage: AppAssets.image(for: .onMyMac),
|
||||
accountLabel: "On My Device"
|
||||
)
|
||||
.previewLayout(.fixed(width: 300, height: 44))
|
||||
List {
|
||||
SettingsAccountLabelView(
|
||||
accountImage: AppAssets.image(for: .onMyMac),
|
||||
accountLabel: "On My Device"
|
||||
)
|
||||
SettingsAccountLabelView(
|
||||
accountImage: AppAssets.image(for: .feedbin),
|
||||
accountLabel: "Feedbin"
|
||||
)
|
||||
SettingsAccountLabelView(
|
||||
accountImage: AppAssets.accountLocalPadImage,
|
||||
accountLabel: "On My iPad"
|
||||
)
|
||||
SettingsAccountLabelView(
|
||||
accountImage: AppAssets.accountLocalPhoneImage,
|
||||
accountLabel: "On My iPhone"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,7 @@ struct SettingsFeedbinAccountView: View {
|
|||
var body: some View {
|
||||
NavigationView {
|
||||
List {
|
||||
Section {
|
||||
imageView
|
||||
Section(header: AccountHeaderImageView(image: AppAssets.image(for: .feedbin)!)) {
|
||||
TextField("Email", text: $settingsModel.email).textContentType(.emailAddress)
|
||||
SecureField("Password", text: $settingsModel.password)
|
||||
}
|
||||
|
@ -42,13 +41,13 @@ struct SettingsFeedbinAccountView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.listStyle(InsetGroupedListStyle())
|
||||
.disabled(settingsModel.busy)
|
||||
.onReceive(settingsModel.$shouldDismiss, perform: { dismiss in
|
||||
if dismiss == true {
|
||||
presentationMode.wrappedValue.dismiss()
|
||||
}
|
||||
})
|
||||
.listStyle(InsetGroupedListStyle())
|
||||
.disabled(settingsModel.busy)
|
||||
.navigationBarTitle(Text(verbatim: "Feedbin"), displayMode: .inline)
|
||||
.navigationBarItems(leading:
|
||||
Button(action: { self.dismiss() }) { Text("Cancel") }
|
||||
|
@ -56,19 +55,6 @@ struct SettingsFeedbinAccountView: View {
|
|||
}
|
||||
}
|
||||
|
||||
var imageView: some View {
|
||||
HStack {
|
||||
Spacer()
|
||||
Image(rsImage: AppAssets.image(for: .feedbin)!)
|
||||
.resizable()
|
||||
.aspectRatio(1, contentMode: .fit)
|
||||
.frame(height: 48, alignment: .center)
|
||||
.padding()
|
||||
Spacer()
|
||||
}
|
||||
.listRowBackground(Color.clear)
|
||||
}
|
||||
|
||||
var errorFooter: some View {
|
||||
HStack {
|
||||
Spacer()
|
||||
|
|
|
@ -16,8 +16,7 @@ struct SettingsLocalAccountView: View {
|
|||
var body: some View {
|
||||
NavigationView {
|
||||
List {
|
||||
Section {
|
||||
imageView
|
||||
Section(header: AccountHeaderImageView(image: AppAssets.image(for: .onMyMac)!)) {
|
||||
HStack {
|
||||
TextField("Name", text: $name)
|
||||
}
|
||||
|
@ -38,19 +37,6 @@ struct SettingsLocalAccountView: View {
|
|||
}
|
||||
}
|
||||
|
||||
var imageView: some View {
|
||||
HStack {
|
||||
Spacer()
|
||||
Image(rsImage: AppAssets.image(for: .onMyMac)!)
|
||||
.resizable()
|
||||
.aspectRatio(1, contentMode: .fit)
|
||||
.frame(height: 48, alignment: .center)
|
||||
.padding()
|
||||
Spacer()
|
||||
}
|
||||
.listRowBackground(Color.clear)
|
||||
}
|
||||
|
||||
private func addAccount() {
|
||||
let account = AccountManager.shared.createAccount(type: .onMyMac)
|
||||
account.name = name
|
||||
|
|
|
@ -677,6 +677,7 @@
|
|||
6581C74020CED60100F4AD34 /* netnewswire-subscribe-to-feed.js in Resources */ = {isa = PBXBuildFile; fileRef = 6581C73F20CED60100F4AD34 /* netnewswire-subscribe-to-feed.js */; };
|
||||
6581C74220CED60100F4AD34 /* ToolbarItemIcon.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 6581C74120CED60100F4AD34 /* ToolbarItemIcon.pdf */; };
|
||||
6591720E24B59C5100B638E8 /* SettingsFeedbinAccountModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6591720D24B59C5100B638E8 /* SettingsFeedbinAccountModel.swift */; };
|
||||
6591723124B5C35400B638E8 /* AccountHeaderImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6591723024B5C35400B638E8 /* AccountHeaderImageView.swift */; };
|
||||
6594CA3B24AF6F2A005C7D7C /* OPMLExporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8444C8F11FED81840051386C /* OPMLExporter.swift */; };
|
||||
65ACE48424B4779B003AE06A /* SettingsAddAccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65ACE48324B4779B003AE06A /* SettingsAddAccountView.swift */; };
|
||||
65ACE48624B477C9003AE06A /* SettingsAccountLabelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65ACE48524B477C9003AE06A /* SettingsAccountLabelView.swift */; };
|
||||
|
@ -2094,6 +2095,7 @@
|
|||
6581C74120CED60100F4AD34 /* ToolbarItemIcon.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = ToolbarItemIcon.pdf; sourceTree = "<group>"; };
|
||||
6581C74320CED60100F4AD34 /* Subscribe_to_Feed.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Subscribe_to_Feed.entitlements; sourceTree = "<group>"; };
|
||||
6591720D24B59C5100B638E8 /* SettingsFeedbinAccountModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsFeedbinAccountModel.swift; sourceTree = "<group>"; };
|
||||
6591723024B5C35400B638E8 /* AccountHeaderImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountHeaderImageView.swift; sourceTree = "<group>"; };
|
||||
65ACE48324B4779B003AE06A /* SettingsAddAccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsAddAccountView.swift; sourceTree = "<group>"; };
|
||||
65ACE48524B477C9003AE06A /* SettingsAccountLabelView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsAccountLabelView.swift; sourceTree = "<group>"; };
|
||||
65ACE48724B48020003AE06A /* SettingsLocalAccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsLocalAccountView.swift; sourceTree = "<group>"; };
|
||||
|
@ -3156,6 +3158,7 @@
|
|||
65ACE48724B48020003AE06A /* SettingsLocalAccountView.swift */,
|
||||
65ACE48924B4C2D8003AE06A /* SettingsFeedbinAccountView.swift */,
|
||||
6591720D24B59C5100B638E8 /* SettingsFeedbinAccountModel.swift */,
|
||||
6591723024B5C35400B638E8 /* AccountHeaderImageView.swift */,
|
||||
);
|
||||
path = Accounts;
|
||||
sourceTree = "<group>";
|
||||
|
@ -4975,6 +4978,7 @@
|
|||
51E4992F24A8676400B667CB /* ArticleArray.swift in Sources */,
|
||||
5177471C24B387AC00EB0F74 /* ImageScrollView.swift in Sources */,
|
||||
51E498F824A8085D00B667CB /* UnreadFeed.swift in Sources */,
|
||||
6591723124B5C35400B638E8 /* AccountHeaderImageView.swift in Sources */,
|
||||
FF64D0E724AF53EE0084080A /* RefreshProgressModel.swift in Sources */,
|
||||
51E4996A24A8762D00B667CB /* ExtractedArticle.swift in Sources */,
|
||||
51919FF124AB864A00541E64 /* TimelineModel.swift in Sources */,
|
||||
|
|
Loading…
Reference in New Issue