Mac stuff
This commit is contained in:
parent
0755e81ed9
commit
350bf29b49
|
@ -7,6 +7,7 @@ struct AddIdentityView: View {
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Form {
|
Form {
|
||||||
|
Spacer()
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
urlTextField
|
urlTextField
|
||||||
.autocapitalization(.none)
|
.autocapitalization(.none)
|
||||||
|
@ -25,7 +26,9 @@ struct AddIdentityView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, alignment: .center)
|
.frame(maxWidth: .infinity, alignment: .center)
|
||||||
|
Spacer()
|
||||||
}
|
}
|
||||||
|
.padding()
|
||||||
.alertItem($viewModel.alertItem)
|
.alertItem($viewModel.alertItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,25 +10,40 @@ struct SettingsView: View {
|
||||||
@EnvironmentObject var sceneViewModel: SceneViewModel
|
@EnvironmentObject var sceneViewModel: SceneViewModel
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationView {
|
VStack(spacing: 0) {
|
||||||
Form {
|
NavigationView {
|
||||||
HStack {
|
Form {
|
||||||
KFImage(viewModel.identity.account?.avatar,
|
HStack {
|
||||||
options: [
|
KFImage(viewModel.identity.account?.avatar,
|
||||||
.processor(
|
options: [
|
||||||
DownsamplingImageProcessor(size: CGSize(width: 50, height: 50))
|
.processor(
|
||||||
.append(another: RoundCornerImageProcessor(radius: .widthFraction(0.5)))
|
DownsamplingImageProcessor(size: CGSize(width: 50, height: 50))
|
||||||
),
|
.append(another: RoundCornerImageProcessor(radius: .widthFraction(0.5)))
|
||||||
.scaleFactor(Screen.scale),
|
),
|
||||||
.cacheOriginalImage
|
.scaleFactor(Screen.scale),
|
||||||
])
|
.cacheOriginalImage
|
||||||
Text(viewModel.identity.handle)
|
])
|
||||||
.font(.subheadline)
|
Text(viewModel.identity.handle)
|
||||||
|
.font(.subheadline)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
.navigationBarTitleAndItems(sceneViewModel: sceneViewModel)
|
||||||
}
|
}
|
||||||
.navigationBarTitleAndItems(sceneViewModel: sceneViewModel)
|
.navigationViewStyle
|
||||||
|
#if os(macOS)
|
||||||
|
Divider()
|
||||||
|
HStack {
|
||||||
|
Spacer()
|
||||||
|
Button(action: { sceneViewModel.presentingSettings.toggle() }) {
|
||||||
|
Text("Done")
|
||||||
|
}
|
||||||
|
.keyboardShortcut(.defaultAction)
|
||||||
|
}
|
||||||
|
.padding()
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
.navigationViewStyle
|
.frame
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +69,14 @@ private extension View {
|
||||||
return self
|
return self
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var frame: some View {
|
||||||
|
#if os(macOS)
|
||||||
|
return frame(minWidth: 400, maxWidth: 600, minHeight: 350, maxHeight: 500)
|
||||||
|
#else
|
||||||
|
return self
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
// Copyright © 2020 Metabolist. All rights reserved.
|
// Copyright © 2020 Metabolist. All rights reserved.
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
import KingfisherSwiftUI
|
||||||
|
import struct Kingfisher.DownsamplingImageProcessor
|
||||||
|
import struct Kingfisher.RoundCornerImageProcessor
|
||||||
|
|
||||||
struct SidebarNavigation: View {
|
struct SidebarNavigation: View {
|
||||||
let identity: Identity
|
let identity: Identity
|
||||||
|
@ -16,6 +19,7 @@ struct SidebarNavigation: View {
|
||||||
.tag(topLevelNavigation)
|
.tag(topLevelNavigation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.overlay(Pocket(identity: identity), alignment: .bottom)
|
||||||
.listStyle(SidebarListStyle())
|
.listStyle(SidebarListStyle())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +43,43 @@ private extension SidebarNavigation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct Pocket: View {
|
||||||
|
let identity: Identity
|
||||||
|
@EnvironmentObject var sceneViewModel: SceneViewModel
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
VStack(alignment: .leading, spacing: 0) {
|
||||||
|
Divider()
|
||||||
|
Button(action: { sceneViewModel.presentingSettings.toggle() }) {
|
||||||
|
KFImage(identity.account?.avatar
|
||||||
|
?? identity.instance?.thumbnail,
|
||||||
|
options: [
|
||||||
|
.processor(
|
||||||
|
DownsamplingImageProcessor(size: CGSize(width: 50, height: 50))
|
||||||
|
.append(another: RoundCornerImageProcessor(radius: .widthFraction(0.5)))
|
||||||
|
),
|
||||||
|
.scaleFactor(Screen.scale),
|
||||||
|
.cacheOriginalImage
|
||||||
|
])
|
||||||
|
.placeholder { Image(systemName: "gear") }
|
||||||
|
.renderingMode(.original)
|
||||||
|
.resizable()
|
||||||
|
.padding(6)
|
||||||
|
.contentShape(Rectangle())
|
||||||
|
}
|
||||||
|
.frame(width: 50, height: 50)
|
||||||
|
.accessibility(label: Text("Rewards"))
|
||||||
|
.padding(.vertical, 8)
|
||||||
|
.padding(.horizontal, 16)
|
||||||
|
.buttonStyle(PlainButtonStyle())
|
||||||
|
}
|
||||||
|
.sheet(isPresented: $sceneViewModel.presentingSettings) {
|
||||||
|
SettingsView(viewModel: SettingsViewModel(identity: identity))
|
||||||
|
.environmentObject(sceneViewModel)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|
Loading…
Reference in New Issue