Added refreshProgressState to SceneModel. Removed RefreshProgressModel from environment
This commit is contained in:
parent
299f3d421e
commit
9131056f2b
@ -19,7 +19,6 @@ struct MainApp: App {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
@StateObject private var sceneModel = SceneModel()
|
@StateObject private var sceneModel = SceneModel()
|
||||||
@StateObject private var refreshProgresModel = RefreshProgressModel()
|
|
||||||
@StateObject private var defaults = AppDefaults.shared
|
@StateObject private var defaults = AppDefaults.shared
|
||||||
@State private var showSheet = false
|
@State private var showSheet = false
|
||||||
|
|
||||||
@ -29,7 +28,6 @@ struct MainApp: App {
|
|||||||
SceneNavigationView()
|
SceneNavigationView()
|
||||||
.frame(minWidth: 600, idealWidth: 1000, maxWidth: .infinity, minHeight: 600, idealHeight: 700, maxHeight: .infinity)
|
.frame(minWidth: 600, idealWidth: 1000, maxWidth: .infinity, minHeight: 600, idealHeight: 700, maxHeight: .infinity)
|
||||||
.environmentObject(sceneModel)
|
.environmentObject(sceneModel)
|
||||||
.environmentObject(refreshProgresModel)
|
|
||||||
.environmentObject(defaults)
|
.environmentObject(defaults)
|
||||||
.sheet(isPresented: $showSheet, onDismiss: { showSheet = false }) {
|
.sheet(isPresented: $showSheet, onDismiss: { showSheet = false }) {
|
||||||
AddWebFeedView()
|
AddWebFeedView()
|
||||||
@ -155,7 +153,6 @@ struct MainApp: App {
|
|||||||
WindowGroup {
|
WindowGroup {
|
||||||
SceneNavigationView()
|
SceneNavigationView()
|
||||||
.environmentObject(sceneModel)
|
.environmentObject(sceneModel)
|
||||||
.environmentObject(refreshProgresModel)
|
|
||||||
.environmentObject(defaults)
|
.environmentObject(defaults)
|
||||||
.modifier(PreferredColorSchemeModifier(preferredColorScheme: defaults.userInterfaceColorPalette))
|
.modifier(PreferredColorSchemeModifier(preferredColorScheme: defaults.userInterfaceColorPalette))
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,19 @@ import Account
|
|||||||
|
|
||||||
final class SceneModel: ObservableObject {
|
final class SceneModel: ObservableObject {
|
||||||
|
|
||||||
|
@Published var refreshProgressState = RefreshProgressModel.State.none
|
||||||
|
|
||||||
var sidebarModel: SidebarModel?
|
var sidebarModel: SidebarModel?
|
||||||
var timelineModel: TimelineModel?
|
var timelineModel: TimelineModel?
|
||||||
var articleModel: ArticleModel?
|
var articleModel: ArticleModel?
|
||||||
|
|
||||||
|
private let refreshProgressModel: RefreshProgressModel
|
||||||
|
|
||||||
|
init(refreshProgressModel: RefreshProgressModel = RefreshProgressModel()) {
|
||||||
|
self.refreshProgressModel = refreshProgressModel
|
||||||
|
self.refreshProgressModel.$state.assign(to: self.$refreshProgressState)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: SidebarModelDelegate
|
// MARK: SidebarModelDelegate
|
||||||
|
@ -10,10 +10,10 @@ import SwiftUI
|
|||||||
|
|
||||||
struct RefreshProgressView: View {
|
struct RefreshProgressView: View {
|
||||||
|
|
||||||
@EnvironmentObject var refreshProgressModel: RefreshProgressModel
|
@EnvironmentObject var sceneModel: SceneModel
|
||||||
|
|
||||||
@ViewBuilder var body: some View {
|
@ViewBuilder var body: some View {
|
||||||
switch refreshProgressModel.state {
|
switch sceneModel.refreshProgressState {
|
||||||
case .refreshProgress(let progress):
|
case .refreshProgress(let progress):
|
||||||
ProgressView(value: progress)
|
ProgressView(value: progress)
|
||||||
.frame(width: progressViewWidth())
|
.frame(width: progressViewWidth())
|
||||||
|
@ -2791,6 +2791,7 @@
|
|||||||
1776E88D24AC5F8A00E78166 /* AppDefaults.swift */,
|
1776E88D24AC5F8A00E78166 /* AppDefaults.swift */,
|
||||||
51E4995824A873F900B667CB /* ErrorHandler.swift */,
|
51E4995824A873F900B667CB /* ErrorHandler.swift */,
|
||||||
51C0513624A77DF700194D5E /* MainApp.swift */,
|
51C0513624A77DF700194D5E /* MainApp.swift */,
|
||||||
|
FF64D0C424AF53EE0084080A /* RefreshProgressModel.swift */,
|
||||||
51E499D724A912C200B667CB /* SceneModel.swift */,
|
51E499D724A912C200B667CB /* SceneModel.swift */,
|
||||||
51E49A0224A91FF600B667CB /* SceneNavigationView.swift */,
|
51E49A0224A91FF600B667CB /* SceneNavigationView.swift */,
|
||||||
51C0513824A77DF800194D5E /* Assets.xcassets */,
|
51C0513824A77DF800194D5E /* Assets.xcassets */,
|
||||||
@ -2978,7 +2979,6 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
172952AF24AA287100D65E66 /* CompactSidebarContainerView.swift */,
|
172952AF24AA287100D65E66 /* CompactSidebarContainerView.swift */,
|
||||||
FF64D0C424AF53EE0084080A /* RefreshProgressModel.swift */,
|
|
||||||
FF64D0E624AF53EE0084080A /* RefreshProgressView.swift */,
|
FF64D0E624AF53EE0084080A /* RefreshProgressView.swift */,
|
||||||
51E499FF24A91FC100B667CB /* RegularSidebarContainerView.swift */,
|
51E499FF24A91FC100B667CB /* RegularSidebarContainerView.swift */,
|
||||||
51392D1A24AC19A000BE0D35 /* SidebarExpandedContainers.swift */,
|
51392D1A24AC19A000BE0D35 /* SidebarExpandedContainers.swift */,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user