From 3c11bd733659530e76ea9fa53080eefe20215ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E4=B8=9A=E5=8D=87?= Date: Sun, 6 Jun 2021 12:50:15 +0800 Subject: [PATCH] Several fixes --- Source/Hollow.xcodeproj/project.pbxproj | 57 ++++++++----------- .../xcshareddata/swiftpm/Package.resolved | 9 --- Source/Hollow/App/HollowApp.swift | 4 +- .../Hierarchy/Account/SettingsSubViews.swift | 2 +- .../Hollow/Content/HollowTextView.swift | 1 - .../Hollow/Detail/HollowDetailView.swift | 2 - .../Hollow/View/Hierarchy/Main/MainView.swift | 2 - .../Integration/IntegrationUtilities.swift | 6 +- .../HollowErrorHandler.swift} | 6 +- Source/Hollow/en.lproj/Localizable.strings | 4 +- ...ronment.swift => HollowErrorHandler.swift} | 7 +-- .../View/Hierarchy/Login/LoginView.swift | 2 - .../ViewModel/Account/AccountInfoStore.swift | 2 +- .../ViewModel/Account/DeviceListStore.swift | 2 +- .../ViewModel/Account/MessageStore.swift | 2 +- .../ViewModel/Hollow/HollowDetailStore.swift | 2 +- .../ViewModel/Hollow/HollowInputStore.swift | 2 +- .../Hollow/PostListRequestStore.swift | 2 +- .../Shared/ViewModel/Login/LoginStore.swift | 2 +- .../ViewModel/Login/UnregisterStore.swift | 2 +- 20 files changed, 47 insertions(+), 71 deletions(-) rename Source/Hollow/{App/AppModelEnvironment.swift => ViewModel/HollowErrorHandler.swift} (94%) rename Source/HollowMac/App/{AppModelEnvironment.swift => HollowErrorHandler.swift} (88%) diff --git a/Source/Hollow.xcodeproj/project.pbxproj b/Source/Hollow.xcodeproj/project.pbxproj index 6c6fb8ed..ce5b1bd2 100644 --- a/Source/Hollow.xcodeproj/project.pbxproj +++ b/Source/Hollow.xcodeproj/project.pbxproj @@ -183,7 +183,6 @@ 0EC244E226340172001AFC4B /* CrossPlatformImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC244DF26340172001AFC4B /* CrossPlatformImage.swift */; }; 0EC244E326340172001AFC4B /* CrossPlatformImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC244DF26340172001AFC4B /* CrossPlatformImage.swift */; }; 0EC244EB263401E4001AFC4B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC244EA263401E4001AFC4B /* AppDelegate.swift */; }; - 0EC244F826340211001AFC4B /* AppModelEnvironment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC244F326340211001AFC4B /* AppModelEnvironment.swift */; }; 0EC244FA26340211001AFC4B /* AppModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC244F426340211001AFC4B /* AppModel.swift */; }; 0EC244FC26340211001AFC4B /* AppDelegateShared.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC244F526340211001AFC4B /* AppDelegateShared.swift */; }; 0EC244FD26340211001AFC4B /* AppDelegateShared.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC244F526340211001AFC4B /* AppDelegateShared.swift */; }; @@ -353,12 +352,13 @@ 0EC2463F26340770001AFC4B /* AppModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC2463E26340770001AFC4B /* AppModel.swift */; }; 0EC24649263407D3001AFC4B /* WelcomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC24648263407D3001AFC4B /* WelcomeView.swift */; }; 0EC2464D263407E4001AFC4B /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC2464C263407E4001AFC4B /* LoginView.swift */; }; - 0EC24651263408CC001AFC4B /* AppModelEnvironment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC24650263408CC001AFC4B /* AppModelEnvironment.swift */; }; + 0EC24651263408CC001AFC4B /* HollowErrorHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC24650263408CC001AFC4B /* HollowErrorHandler.swift */; }; 0EC2465626340B71001AFC4B /* View+showAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC2465526340B71001AFC4B /* View+showAlert.swift */; }; 0EC2465C2634116A001AFC4B /* AppModelBehaviour.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC2465B2634116A001AFC4B /* AppModelBehaviour.swift */; }; 0EC2AE36260F761A0099B500 /* View+conditionalSizeCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC2AE35260F761A0099B500 /* View+conditionalSizeCategory.swift */; }; 0EC4B67825D644CA0065BB82 /* CustomTextEditor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC4B67725D644CA0065BB82 /* CustomTextEditor.swift */; }; 0EC4B67F25D670070065BB82 /* ImagePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC4B67E25D670070065BB82 /* ImagePicker.swift */; }; + 0ECA796E26652C4200736096 /* HollowErrorHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ECA796D26652C4200736096 /* HollowErrorHandler.swift */; }; 0ED087BF263480C9003C2E11 /* LoginSubViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ED087BE263480C9003C2E11 /* LoginSubViews.swift */; }; 0ED087D126354556003C2E11 /* PostListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ED087D026354556003C2E11 /* PostListView.swift */; }; 0ED1A16026346C37001453A7 /* ReCAPTCHAWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ED1A15F26346C37001453A7 /* ReCAPTCHAWebView.swift */; }; @@ -373,7 +373,6 @@ 0EDA263125D2465100B67292 /* LoadingIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EDA263025D2465100B67292 /* LoadingIndicator.swift */; }; 0EDEC0E52650E5A6003112BA /* View+makeButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EDEC0E42650E5A6003112BA /* View+makeButton.swift */; }; 0EE60EFD25FCCCD700D97E7A /* CheckmarkButtonImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE60EFC25FCCCD700D97E7A /* CheckmarkButtonImage.swift */; }; - 0EEA957B265FE11400689E78 /* Introspect in Frameworks */ = {isa = PBXBuildFile; productRef = 0EEA957A265FE11400689E78 /* Introspect */; }; 0EF10F6626330F29004D6538 /* HollowDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EF10F6526330F29004D6538 /* HollowDetailViewController.swift */; }; 0EFA3DDE25D3A03D0003C76B /* LoadingLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFA3DDD25D3A03D0003C76B /* LoadingLabel.swift */; }; 0EFB4F222639790000530B5F /* ImageTitledStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFB4F212639790000530B5F /* ImageTitledStack.swift */; }; @@ -530,7 +529,6 @@ 0EC244DE26340172001AFC4B /* CrossPlatformTypes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CrossPlatformTypes.swift; sourceTree = ""; }; 0EC244DF26340172001AFC4B /* CrossPlatformImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CrossPlatformImage.swift; sourceTree = ""; }; 0EC244EA263401E4001AFC4B /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 0EC244F326340211001AFC4B /* AppModelEnvironment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppModelEnvironment.swift; sourceTree = ""; }; 0EC244F426340211001AFC4B /* AppModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppModel.swift; sourceTree = ""; }; 0EC244F526340211001AFC4B /* AppDelegateShared.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegateShared.swift; sourceTree = ""; }; 0EC245012634022C001AFC4B /* HollowApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HollowApp.swift; sourceTree = ""; }; @@ -620,12 +618,13 @@ 0EC2463E26340770001AFC4B /* AppModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppModel.swift; sourceTree = ""; }; 0EC24648263407D3001AFC4B /* WelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeView.swift; sourceTree = ""; }; 0EC2464C263407E4001AFC4B /* LoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = ""; }; - 0EC24650263408CC001AFC4B /* AppModelEnvironment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppModelEnvironment.swift; sourceTree = ""; }; + 0EC24650263408CC001AFC4B /* HollowErrorHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HollowErrorHandler.swift; sourceTree = ""; }; 0EC2465526340B71001AFC4B /* View+showAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+showAlert.swift"; sourceTree = ""; }; 0EC2465B2634116A001AFC4B /* AppModelBehaviour.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppModelBehaviour.swift; sourceTree = ""; }; 0EC2AE35260F761A0099B500 /* View+conditionalSizeCategory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+conditionalSizeCategory.swift"; sourceTree = ""; }; 0EC4B67725D644CA0065BB82 /* CustomTextEditor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomTextEditor.swift; sourceTree = ""; }; 0EC4B67E25D670070065BB82 /* ImagePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImagePicker.swift; sourceTree = ""; }; + 0ECA796D26652C4200736096 /* HollowErrorHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HollowErrorHandler.swift; sourceTree = ""; }; 0ED087BE263480C9003C2E11 /* LoginSubViews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginSubViews.swift; sourceTree = ""; }; 0ED087D026354556003C2E11 /* PostListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostListView.swift; sourceTree = ""; }; 0ED1A15F26346C37001453A7 /* ReCAPTCHAWebView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReCAPTCHAWebView.swift; sourceTree = ""; }; @@ -662,7 +661,6 @@ 0E42905C263A742D008DA046 /* WaterfallGrid in Frameworks */, 0E429070263A8557008DA046 /* ImageScrollView in Frameworks */, 0E429067263A84CA008DA046 /* AppCenterAnalytics in Frameworks */, - 0EEA957B265FE11400689E78 /* Introspect in Frameworks */, 0E429065263A84CA008DA046 /* AppCenterCrashes in Frameworks */, 0E42906D263A853E008DA046 /* Connectivity in Frameworks */, ); @@ -739,6 +737,7 @@ 0E415A7225CD769B00351672 /* Hollow */ = { isa = PBXGroup; children = ( + 0ECA796C26652C3400736096 /* ViewModel */, 0EC245002634022C001AFC4B /* App */, 0EC2451A26340301001AFC4B /* Model */, 0E415AE825CD772200351672 /* View */, @@ -1037,7 +1036,7 @@ 0EC244C4263400C6001AFC4B /* HollowMacApp.swift */, 0EC244EA263401E4001AFC4B /* AppDelegate.swift */, 0EC2463E26340770001AFC4B /* AppModel.swift */, - 0EC24650263408CC001AFC4B /* AppModelEnvironment.swift */, + 0EC24650263408CC001AFC4B /* HollowErrorHandler.swift */, 0EC2465B2634116A001AFC4B /* AppModelBehaviour.swift */, ); path = App; @@ -1055,7 +1054,6 @@ isa = PBXGroup; children = ( 0EC245012634022C001AFC4B /* HollowApp.swift */, - 0EC244F326340211001AFC4B /* AppModelEnvironment.swift */, 0EC244F426340211001AFC4B /* AppModel.swift */, 0EC245022634022C001AFC4B /* AppDelegate.swift */, ); @@ -1346,6 +1344,14 @@ path = Integration; sourceTree = ""; }; + 0ECA796C26652C3400736096 /* ViewModel */ = { + isa = PBXGroup; + children = ( + 0ECA796D26652C4200736096 /* HollowErrorHandler.swift */, + ); + path = ViewModel; + sourceTree = ""; + }; 0ED087C2263485E1003C2E11 /* Utilities */ = { isa = PBXGroup; children = ( @@ -1413,7 +1419,6 @@ 0E42906C263A853E008DA046 /* Connectivity */, 0E42906F263A8557008DA046 /* ImageScrollView */, 0E429072263A8572008DA046 /* Cache */, - 0EEA957A265FE11400689E78 /* Introspect */, ); productName = Hollow; productReference = 0E415A7025CD769B00351672 /* Hollow.app */; @@ -1507,7 +1512,6 @@ 0E42906B263A853E008DA046 /* XCRemoteSwiftPackageReference "Connectivity" */, 0E42906E263A8557008DA046 /* XCRemoteSwiftPackageReference "ImageScrollView" */, 0E429071263A8572008DA046 /* XCRemoteSwiftPackageReference "Cache" */, - 0EEA9579265FE11400689E78 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */, ); productRefGroup = 0E415A7125CD769B00351672 /* Products */; projectDirPath = ""; @@ -1581,6 +1585,7 @@ 0EC2458526340311001AFC4B /* Post.swift in Sources */, 0EC245042634022C001AFC4B /* AppDelegate.swift in Sources */, 0EC245E526340312001AFC4B /* Array+removeDuplicates.swift in Sources */, + 0ECA796E26652C4200736096 /* HollowErrorHandler.swift in Sources */, 0E415B6625CD772200351672 /* HollowVoteContentView.swift in Sources */, 0EC245C526340312001AFC4B /* ReportPostRequest.swift in Sources */, 0E40F74825D7C997003A2342 /* HollowInputSubViews.swift in Sources */, @@ -1652,7 +1657,6 @@ 0E6E4E28263EF1CB007BBCFC /* UnregisterStore.swift in Sources */, 0EC245C126340312001AFC4B /* ReportRequestGroup.swift in Sources */, 0EC245FD26340312001AFC4B /* DeviceModelUtilities.swift in Sources */, - 0EC244F826340211001AFC4B /* AppModelEnvironment.swift in Sources */, 0EC245A326340311001AFC4B /* AttentionListSearchRequest.swift in Sources */, 0EC2452526340301001AFC4B /* ImageCompressor.swift in Sources */, 0E415B6425CD772200351672 /* HollowCiteContentView.swift in Sources */, @@ -1858,7 +1862,7 @@ 0EC2462D2634040D001AFC4B /* WelcomeStore.swift in Sources */, 0EC2459226340311001AFC4B /* PostData.swift in Sources */, 0EC245F226340312001AFC4B /* DateExtensions.swift in Sources */, - 0EC24651263408CC001AFC4B /* AppModelEnvironment.swift in Sources */, + 0EC24651263408CC001AFC4B /* HollowErrorHandler.swift in Sources */, 0EC245F426340312001AFC4B /* PublisherExtensions.swift in Sources */, 0EC245E426340312001AFC4B /* Int+string.swift in Sources */, 0EC245D026340312001AFC4B /* SendCommentRequest.swift in Sources */, @@ -2080,7 +2084,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = Hollow/Hollow.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 66; + CURRENT_PROJECT_VERSION = 67; DEVELOPMENT_TEAM = C5UH93T368; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = Hollow/Info.plist; @@ -2089,7 +2093,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 3.2; + MARKETING_VERSION = 3.2.1; PRODUCT_BUNDLE_IDENTIFIER = treehollow.Hollow; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; @@ -2106,7 +2110,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = Hollow/Hollow.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 66; + CURRENT_PROJECT_VERSION = 67; DEVELOPMENT_TEAM = C5UH93T368; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = Hollow/Info.plist; @@ -2115,7 +2119,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 3.2; + MARKETING_VERSION = 3.2.1; PRODUCT_BUNDLE_IDENTIFIER = treehollow.Hollow; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; @@ -2131,7 +2135,7 @@ ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_ENTITLEMENTS = HollowWidget/HollowWidgetExtension.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 66; + CURRENT_PROJECT_VERSION = 67; DEVELOPMENT_TEAM = C5UH93T368; INFOPLIST_FILE = HollowWidget/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.1; @@ -2141,7 +2145,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 3.2; + MARKETING_VERSION = 3.2.1; OTHER_SWIFT_FLAGS = "-DWIDGET"; PRODUCT_BUNDLE_IDENTIFIER = treehollow.Hollow.HollowWidget; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2159,7 +2163,7 @@ ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_ENTITLEMENTS = HollowWidget/HollowWidgetExtension.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 66; + CURRENT_PROJECT_VERSION = 67; DEVELOPMENT_TEAM = C5UH93T368; INFOPLIST_FILE = HollowWidget/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.1; @@ -2169,7 +2173,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 3.2; + MARKETING_VERSION = 3.2.1; OTHER_SWIFT_FLAGS = "-DWIDGET"; PRODUCT_BUNDLE_IDENTIFIER = treehollow.Hollow.HollowWidget; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2338,14 +2342,6 @@ minimumVersion = 6.0.1; }; }; - 0EEA9579265FE11400689E78 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/siteline/SwiftUI-Introspect.git"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 0.1.3; - }; - }; /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ @@ -2444,11 +2440,6 @@ package = 0E429060263A7568008DA046 /* XCRemoteSwiftPackageReference "Alamofire" */; productName = Alamofire; }; - 0EEA957A265FE11400689E78 /* Introspect */ = { - isa = XCSwiftPackageProductDependency; - package = 0EEA9579265FE11400689E78 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */; - productName = Introspect; - }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 0E415A6825CD769B00351672 /* Project object */; diff --git a/Source/Hollow.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Source/Hollow.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index e2ed094c..5e5c9713 100644 --- a/Source/Hollow.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Source/Hollow.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -73,15 +73,6 @@ "version": "1.8.1" } }, - { - "package": "Introspect", - "repositoryURL": "https://github.com/siteline/SwiftUI-Introspect.git", - "state": { - "branch": null, - "revision": "2e09be8af614401bc9f87d40093ec19ce56ccaf2", - "version": "0.1.3" - } - }, { "package": "WaterfallGrid", "repositoryURL": "https://github.com/paololeonardi/WaterfallGrid.git", diff --git a/Source/Hollow/App/HollowApp.swift b/Source/Hollow/App/HollowApp.swift index e491336b..b88f39f5 100644 --- a/Source/Hollow/App/HollowApp.swift +++ b/Source/Hollow/App/HollowApp.swift @@ -32,8 +32,6 @@ struct HollowApp: App { } // Set larger size category for macOS .conditionalSizeCategory() -// // Inject the app model into the environment -// .environmentObject(appModel) // Set the color scheme when appear .onAppear { IntegrationUtilities.setCustomColorScheme() @@ -44,7 +42,7 @@ struct HollowApp: App { NotificationCenter.default.publisher(for: UIApplication.didBecomeActiveNotification), perform: { _ in appDelegate.fetchConfig() - if appModel.widgetReloadCount % 3 == 0 { + if appModel.widgetReloadCount % 3 == 1 { WidgetCenter.shared.reloadAllTimelines() appModel.widgetReloadCount += 1 } diff --git a/Source/Hollow/View/Hierarchy/Account/SettingsSubViews.swift b/Source/Hollow/View/Hierarchy/Account/SettingsSubViews.swift index 5baca389..51fa943a 100644 --- a/Source/Hollow/View/Hierarchy/Account/SettingsSubViews.swift +++ b/Source/Hollow/View/Hierarchy/Account/SettingsSubViews.swift @@ -332,7 +332,7 @@ struct PushNotificationSettingsView: View { }) } - class ViewModel: ObservableObject, AppModelEnvironment { + class ViewModel: ObservableObject, HollowErrorHandler { @Published var isLoading = false @Published var notificationType = Defaults[.notificationTypeCache] @Published var tempNotificationType = Defaults[.notificationTypeCache] diff --git a/Source/Hollow/View/Hierarchy/Hollow/Content/HollowTextView.swift b/Source/Hollow/View/Hierarchy/Hollow/Content/HollowTextView.swift index 8a2a125c..1bd5f28d 100644 --- a/Source/Hollow/View/Hierarchy/Hollow/Content/HollowTextView.swift +++ b/Source/Hollow/View/Hierarchy/Hollow/Content/HollowTextView.swift @@ -8,7 +8,6 @@ import SwiftUI import Defaults -import Introspect struct HollowTextView: View { var text: String diff --git a/Source/Hollow/View/Hierarchy/Hollow/Detail/HollowDetailView.swift b/Source/Hollow/View/Hierarchy/Hollow/Detail/HollowDetailView.swift index 4624fc5d..b7b2bafa 100644 --- a/Source/Hollow/View/Hierarchy/Hollow/Detail/HollowDetailView.swift +++ b/Source/Hollow/View/Hierarchy/Hollow/Detail/HollowDetailView.swift @@ -7,7 +7,6 @@ import SwiftUI import Defaults -import Introspect struct HollowDetailView: View { @ObservedObject var store: HollowDetailStore @@ -129,7 +128,6 @@ struct HollowDetailView: View { } } - .introspectTableView(customize: { $0.backgroundColor = nil }) .background(Color.hollowCardBackground) .coordinateSpace(name: "detail.scrollview") .buttonStyle(BorderlessButtonStyle()) diff --git a/Source/Hollow/View/Hierarchy/Main/MainView.swift b/Source/Hollow/View/Hierarchy/Main/MainView.swift index f14c3114..bf077ff7 100644 --- a/Source/Hollow/View/Hierarchy/Main/MainView.swift +++ b/Source/Hollow/View/Hierarchy/Main/MainView.swift @@ -23,8 +23,6 @@ struct MainView: View { let overlayTransition = AnyTransition.asymmetric(insertion: .opacity, removal: .scaleAndOpacity) @Namespace var namespace - - @Environment(\.colorScheme) var colorScheme var body: some View { ZStack { diff --git a/Source/Hollow/View/Integration/IntegrationUtilities.swift b/Source/Hollow/View/Integration/IntegrationUtilities.swift index 2da28765..fa102888 100644 --- a/Source/Hollow/View/Integration/IntegrationUtilities.swift +++ b/Source/Hollow/View/Integration/IntegrationUtilities.swift @@ -79,7 +79,7 @@ struct IntegrationUtilities { store = detailVC.store } } else { - if let detailVC = topViewController() as? HollowDetailViewController { + if let detailVC = getDetailVC() { store = detailVC.store } } @@ -158,4 +158,8 @@ extension IntegrationUtilities { vc.view.backgroundColor = nil navigationVC.pushViewController(vc, animated: true) } + + static private func getDetailVC() -> HollowDetailViewController? { + return (topViewController() as? UINavigationController)?.topViewController as? HollowDetailViewController + } } diff --git a/Source/Hollow/App/AppModelEnvironment.swift b/Source/Hollow/ViewModel/HollowErrorHandler.swift similarity index 94% rename from Source/Hollow/App/AppModelEnvironment.swift rename to Source/Hollow/ViewModel/HollowErrorHandler.swift index dc3c0aa8..ebed7c17 100644 --- a/Source/Hollow/App/AppModelEnvironment.swift +++ b/Source/Hollow/ViewModel/HollowErrorHandler.swift @@ -1,5 +1,5 @@ // -// AppModelEnvironment.swift +// HollowErrorHandler.swift // Hollow // // Created by liang2kl on 2021/2/15. @@ -10,9 +10,9 @@ import SwiftUI import Defaults /// Protocol for a view model which protentially modify the shared `AppModel` instance. -protocol AppModelEnvironment: ObservableObject {} +protocol HollowErrorHandler: ObservableObject {} -extension AppModelEnvironment { +extension HollowErrorHandler { /// Default implementation to handle token expire error. /// /// - parameter error: The request error diff --git a/Source/Hollow/en.lproj/Localizable.strings b/Source/Hollow/en.lproj/Localizable.strings index e963e5e6..ca266702 100644 --- a/Source/Hollow/en.lproj/Localizable.strings +++ b/Source/Hollow/en.lproj/Localizable.strings @@ -659,9 +659,9 @@ "SETTINGSVIEW_APPEARANCE_BLURRED_IMG_BG" = "Blurred Image Background"; -"HOLLOWDETAIL_COMMENTS_ORDER_OLD_TO_NEW" = "Old to New"; +"HOLLOWDETAIL_COMMENTS_ORDER_OLD_TO_NEW" = "OLD TO NEW"; -"HOLLOWDETAIL_COMMENTS_ORDER_NEW_TO_OLD" = "New to Old"; +"HOLLOWDETAIL_COMMENTS_ORDER_NEW_TO_OLD" = "NEW TO OLD"; "COMMENT_VIEW_SHOW_ONLY_LABEL" = "Show this Person Only"; diff --git a/Source/HollowMac/App/AppModelEnvironment.swift b/Source/HollowMac/App/HollowErrorHandler.swift similarity index 88% rename from Source/HollowMac/App/AppModelEnvironment.swift rename to Source/HollowMac/App/HollowErrorHandler.swift index e3fbdba0..5d77f69d 100644 --- a/Source/HollowMac/App/AppModelEnvironment.swift +++ b/Source/HollowMac/App/HollowErrorHandler.swift @@ -1,5 +1,5 @@ // -// AppModelEnvironment.swift +// HollowErrorHandler.swift // HollowMac // // Created by liang2kl on 2021/4/24. @@ -9,11 +9,10 @@ import SwiftUI import Defaults -protocol AppModelEnvironment: ObservableObject { - var appModelState: AppModelState { get set } +protocol HollowErrorHandler: ObservableObject { } -extension AppModelEnvironment { +extension HollowErrorHandler { /// Default implementation to handle token expire error. /// /// - parameter error: The request error diff --git a/Source/HollowMac/View/Hierarchy/Login/LoginView.swift b/Source/HollowMac/View/Hierarchy/Login/LoginView.swift index bb6bd5c4..eb2b033b 100644 --- a/Source/HollowMac/View/Hierarchy/Login/LoginView.swift +++ b/Source/HollowMac/View/Hierarchy/Login/LoginView.swift @@ -116,8 +116,6 @@ struct LoginView: View { .disabled(disableButton) } .errorAlert($store.errorMessage) - - .modifier(AppModelBehaviour(state: store.appModelState)) } } diff --git a/Source/Shared/ViewModel/Account/AccountInfoStore.swift b/Source/Shared/ViewModel/Account/AccountInfoStore.swift index 77b39470..fa5f6d9b 100644 --- a/Source/Shared/ViewModel/Account/AccountInfoStore.swift +++ b/Source/Shared/ViewModel/Account/AccountInfoStore.swift @@ -10,7 +10,7 @@ import SwiftUI import Combine import Defaults -class AccountInfoStore: ObservableObject, AppModelEnvironment { +class AccountInfoStore: ObservableObject, HollowErrorHandler { @Published var errorMessage: (title: String, message: String)? @Published var isLoading = false diff --git a/Source/Shared/ViewModel/Account/DeviceListStore.swift b/Source/Shared/ViewModel/Account/DeviceListStore.swift index f5e0b078..d3c618b3 100644 --- a/Source/Shared/ViewModel/Account/DeviceListStore.swift +++ b/Source/Shared/ViewModel/Account/DeviceListStore.swift @@ -11,7 +11,7 @@ import Combine import SwiftUI import Defaults -class DeviceListStore: ObservableObject, AppModelEnvironment { +class DeviceListStore: ObservableObject, HollowErrorHandler { @Published var deviceData: DeviceListRequestResultData @Published var isLoading: Bool = false @Published var loggingoutUUID: String? diff --git a/Source/Shared/ViewModel/Account/MessageStore.swift b/Source/Shared/ViewModel/Account/MessageStore.swift index 670027d1..9283ea2a 100644 --- a/Source/Shared/ViewModel/Account/MessageStore.swift +++ b/Source/Shared/ViewModel/Account/MessageStore.swift @@ -10,7 +10,7 @@ import Combine import Defaults import SwiftUI -class MessageStore: ObservableObject, AppModelEnvironment { +class MessageStore: ObservableObject, HollowErrorHandler { @Published var messages: [SystemMessage] = [] @Published var errorMessage: (title: String, message: String)? @Published var isLoading = false diff --git a/Source/Shared/ViewModel/Hollow/HollowDetailStore.swift b/Source/Shared/ViewModel/Hollow/HollowDetailStore.swift index fdb821fd..2656ee84 100644 --- a/Source/Shared/ViewModel/Hollow/HollowDetailStore.swift +++ b/Source/Shared/ViewModel/Hollow/HollowDetailStore.swift @@ -14,7 +14,7 @@ import Defaults import Connectivity #endif -class HollowDetailStore: ObservableObject, ImageCompressStore, AppModelEnvironment { +class HollowDetailStore: ObservableObject, ImageCompressStore, HollowErrorHandler { // MARK: Post Variables var bindingPostWrapper: Binding @Published var postDataWrapper: PostDataWrapper diff --git a/Source/Shared/ViewModel/Hollow/HollowInputStore.swift b/Source/Shared/ViewModel/Hollow/HollowInputStore.swift index 3bcc02b6..998230c7 100644 --- a/Source/Shared/ViewModel/Hollow/HollowInputStore.swift +++ b/Source/Shared/ViewModel/Hollow/HollowInputStore.swift @@ -11,7 +11,7 @@ import Combine import SwiftUI import Defaults -class HollowInputStore: ObservableObject, AppModelEnvironment, ImageCompressStore { +class HollowInputStore: ObservableObject, HollowErrorHandler, ImageCompressStore { var presented: Binding var selfDismiss: Bool var refreshHandler: (() -> Void)? diff --git a/Source/Shared/ViewModel/Hollow/PostListRequestStore.swift b/Source/Shared/ViewModel/Hollow/PostListRequestStore.swift index d021d225..50d70340 100644 --- a/Source/Shared/ViewModel/Hollow/PostListRequestStore.swift +++ b/Source/Shared/ViewModel/Hollow/PostListRequestStore.swift @@ -12,7 +12,7 @@ import Combine /// Shared view model for views that request `PostList`, `Search`, `AttentionList` /// and `AttentionListSearch`. -class PostListRequestStore: ObservableObject, AppModelEnvironment { +class PostListRequestStore: ObservableObject, HollowErrorHandler { // MARK: - Shared Variables let type: PostListRequestGroupType diff --git a/Source/Shared/ViewModel/Login/LoginStore.swift b/Source/Shared/ViewModel/Login/LoginStore.swift index 2a58ce1b..e1bd148f 100644 --- a/Source/Shared/ViewModel/Login/LoginStore.swift +++ b/Source/Shared/ViewModel/Login/LoginStore.swift @@ -12,7 +12,7 @@ import SwiftUI import Defaults /// View model for `LoginView` -class LoginStore: ObservableObject, AppModelEnvironment { +class LoginStore: ObservableObject, HollowErrorHandler { @Published var showsRecaptcha = false @Published var reCAPTCHAToken: String = "" diff --git a/Source/Shared/ViewModel/Login/UnregisterStore.swift b/Source/Shared/ViewModel/Login/UnregisterStore.swift index b1d9f732..6c7974b3 100644 --- a/Source/Shared/ViewModel/Login/UnregisterStore.swift +++ b/Source/Shared/ViewModel/Login/UnregisterStore.swift @@ -10,7 +10,7 @@ import Combine import Defaults import SwiftUI -class UnregisterStore: ObservableObject, AppModelEnvironment { +class UnregisterStore: ObservableObject, HollowErrorHandler { var presented: Binding @Published var email = "" { didSet { if email != oldValue { restore() } }