Skip to content

Commit

Permalink
Merge pull request #334 from EhPanda-Team/develop
Browse files Browse the repository at this point in the history
Bugfixes
  • Loading branch information
chihchy authored Jun 3, 2023
2 parents a229d8b + 90c1bc7 commit ac4a6ed
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
types: [closed]
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.app
APP_VERSION: '2.7.0'
APP_VERSION: '2.7.1'
SCHEME_NAME: 'EhPanda'
ALTSTORE_JSON_PATH: './AltStore.json'
BUILDS_PATH: '/tmp/action-builds'
Expand Down
2 changes: 1 addition & 1 deletion EhPanda/DataFlow/AppLockReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct AppLockReducer: ReducerProtocol {
switch action {
case .onBecomeActive(let threshold, let blurRadius):
if let date = state.becameInactiveDate, threshold >= 0,
Date().timeIntervalSince(date) > Double(threshold)
Date.now.timeIntervalSince(date) >= Double(threshold)
{
return .merge(
.init(value: .authorize),
Expand Down
7 changes: 5 additions & 2 deletions EhPanda/DataFlow/AppReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,21 @@ struct AppReducer: ReducerProtocol {
return .none

case .onScenePhaseChange(let scenePhase):
guard state.settingState.hasLoadedInitialSetting else { return .none }

switch scenePhase {
case .active:
let threshold = state.settingState.setting.autoLockPolicy.rawValue
let blurRadius = state.settingState.setting.backgroundBlurRadius
return .init(value: .appLock(.onBecomeActive(threshold, blurRadius)))

case .inactive:
let blurRadius = state.settingState.setting.backgroundBlurRadius
return .init(value: .appLock(.onBecomeInactive(blurRadius)))

default:
break
return .none
}
return .none

case .appDelegate(.migration(.onDatabasePreparationSuccess)):
return .merge(
Expand Down
104 changes: 52 additions & 52 deletions EhPanda/View/Detail/DetailReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -363,58 +363,58 @@ struct DetailReducer: ReducerProtocol {
return .none
}
}
.ifLet(
\.commentsState,
action: /Action.comments,
then: CommentsReducer.init
)
.ifLet(
\.detailSearchState,
action: /Action.detailSearch,
then: DetailSearchReducer.init
)
.haptics(
unwrapping: \.route,
case: /Route.detailSearch,
hapticsClient: hapticsClient,
style: .soft
)
.haptics(
unwrapping: \.route,
case: /Route.postComment,
hapticsClient: hapticsClient
)
.haptics(
unwrapping: \.route,
case: /Route.tagDetail,
hapticsClient: hapticsClient
)
.haptics(
unwrapping: \.route,
case: /Route.torrents,
hapticsClient: hapticsClient
)
.haptics(
unwrapping: \.route,
case: /Route.archives,
hapticsClient: hapticsClient
)
.haptics(
unwrapping: \.route,
case: /Route.reading,
hapticsClient: hapticsClient
)
.haptics(
unwrapping: \.route,
case: /Route.share,
hapticsClient: hapticsClient
)

Scope(state: \.readingState, action: /Action.reading, child: ReadingReducer.init)
Scope(state: \.archivesState, action: /Action.archives, child: ArchivesReducer.init)
Scope(state: \.torrentsState, action: /Action.torrents, child: TorrentsReducer.init)
Scope(state: \.previewsState, action: /Action.previews, child: PreviewsReducer.init)
Scope(state: \.galleryInfosState, action: /Action.galleryInfos, child: GalleryInfosReducer.init)
}
.ifLet(
\.commentsState,
action: /Action.comments,
then: CommentsReducer.init
)
.ifLet(
\.detailSearchState,
action: /Action.detailSearch,
then: DetailSearchReducer.init
)
.haptics(
unwrapping: \.route,
case: /Route.detailSearch,
hapticsClient: hapticsClient,
style: .soft
)
.haptics(
unwrapping: \.route,
case: /Route.postComment,
hapticsClient: hapticsClient
)
.haptics(
unwrapping: \.route,
case: /Route.tagDetail,
hapticsClient: hapticsClient
)
.haptics(
unwrapping: \.route,
case: /Route.torrents,
hapticsClient: hapticsClient
)
.haptics(
unwrapping: \.route,
case: /Route.archives,
hapticsClient: hapticsClient
)
.haptics(
unwrapping: \.route,
case: /Route.reading,
hapticsClient: hapticsClient
)
.haptics(
unwrapping: \.route,
case: /Route.share,
hapticsClient: hapticsClient
)

Scope(state: \.readingState, action: /Action.reading, child: ReadingReducer.init)
Scope(state: \.archivesState, action: /Action.archives, child: ArchivesReducer.init)
Scope(state: \.torrentsState, action: /Action.torrents, child: TorrentsReducer.init)
Scope(state: \.previewsState, action: /Action.previews, child: PreviewsReducer.init)
Scope(state: \.galleryInfosState, action: /Action.galleryInfos, child: GalleryInfosReducer.init)
}
}
3 changes: 3 additions & 0 deletions EhPanda/View/Setting/SettingReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ struct SettingReducer: ReducerProtocol {
var tagTranslator = TagTranslator()
var user = User()

var hasLoadedInitialSetting = false

@BindingState var route: Route?
var tagTranslatorLoadingState: LoadingState = .idle

Expand Down Expand Up @@ -263,6 +265,7 @@ struct SettingReducer: ReducerProtocol {
return .merge(effects)

case .loadUserSettingsDone:
state.hasLoadedInitialSetting = true
return .none

case .createDefaultEhProfile:
Expand Down

0 comments on commit ac4a6ed

Please sign in to comment.