Skip to content

Commit

Permalink
fix: Typos & bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsuz0u committed Jul 10, 2021
1 parent 2529dcf commit 8e84256
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 17 deletions.
9 changes: 4 additions & 5 deletions EhPanda/App/EhPandaApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,18 @@ struct EhPandaApp: App {
}

private extension EhPandaApp {
var setting: Setting? {
var setting: Setting {
store.appState.settings.setting
}
var accentColor: Color? {
setting?.accentColor
var accentColor: Color {
setting.accentColor
}
var preferredColorScheme: ColorScheme? {
setting?.colorScheme ?? .none
setting.colorScheme
}

func onStartTasks() {
DispatchQueue.main.async {
store.dispatch(.initializeStates)
store.dispatch(.fetchFavoriteNames)
store.dispatch(.fetchUserInfo)
}
Expand Down
2 changes: 1 addition & 1 deletion EhPanda/App/Tools/AppEnvStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import SwiftyBeaver

@propertyWrapper
struct AppEnvStorage<T: Codable> {
struct AppEnvStorage<T: Encodable> {
private var key: String

private var appEnv: AppEnv {
Expand Down
3 changes: 1 addition & 2 deletions EhPanda/DataFlow/AppAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import Kanna
import Foundation

enum AppAction {
case replaceUser(user: User?)
case initializeStates
case replaceUser(user: User)
case initializeFilter
case clearDetailViewCommentContent
case clearCommentViewCommentContent
Expand Down
8 changes: 1 addition & 7 deletions EhPanda/DataFlow/Store.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,7 @@ final class Store: ObservableObject {
switch action {
// MARK: App Ops
case .replaceUser(let user):
if let user = user {
appState.settings.user = user
}
case .initializeStates:
// swiftlint:disable unneeded_break_in_switch
break
// swiftlint:enable unneeded_break_in_switch
appState.settings.user = user
case .initializeFilter:
appState.settings.filter = Filter()
case .saveAspectBox(let gid, let box):
Expand Down
1 change: 0 additions & 1 deletion EhPanda/Database/PersistenceAccessor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ extension PersistenceController {
)
)
newMO.gid = gid
saveContext()
return newMO
}

Expand Down
2 changes: 1 addition & 1 deletion EhPanda/View/Setting/SettingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private extension SettingView {
func logout() {
clearCookies()
clearImageCaches()
store.dispatch(.replaceUser(user: nil))
store.dispatch(.replaceUser(user: User()))
}

func calculateDiskCachesSize() {
Expand Down

0 comments on commit 8e84256

Please sign in to comment.