Skip to content

Commit

Permalink
Merge pull request #150 from tatsuz0u/develop
Browse files Browse the repository at this point in the history
Bugfix
  • Loading branch information
tatsuz0u committed Sep 26, 2021
2 parents aabaa7b + 59b3eb9 commit d6ce5ac
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 17 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_13.0.app
APP_VERSION: '1.3.3'
APP_VERSION: '1.3.4'
SCHEME_NAME: 'EhPanda'
ALTSTORE_JSON_PATH: './AltStore.json'
BUILDS_PATH: '/tmp/action-builds'
Expand Down
1 change: 1 addition & 0 deletions EhPanda/View/Detail/AssociatedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ private extension AssociatedView {
func toggleJumpPage() {
alertManager.show()
isAlertFocused = true
impactFeedback(style: .light)
}
func performJumpPage() {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
Expand Down
1 change: 1 addition & 0 deletions EhPanda/View/Home/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ private extension HomeView {
func toggleJumpPage() {
alertManager.show()
isAlertFocused = true
impactFeedback(style: .light)
}
func performJumpPage() {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
Expand Down
47 changes: 31 additions & 16 deletions EhPanda/View/Reading/ControlPanel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import Kingfisher

// MARK: ControlPanel
struct ControlPanel: View {
@State private var refreshID = UUID().uuidString

@Binding private var showsPanel: Bool
@Binding private var sliderValue: Float
@Binding private var setting: Setting
Expand Down Expand Up @@ -54,6 +56,7 @@ struct ControlPanel: View {
title: "\(currentIndex) / "
+ "\(Int(range.upperBound))",
setting: $setting,
refreshID: $refreshID,
autoPlayPolicy: $autoPlayPolicy,
settingAction: settingAction,
updateSettingAction: updateSettingAction
Expand All @@ -74,27 +77,37 @@ struct ControlPanel: View {
}
.opacity(showsPanel ? 1 : 0)
.disabled(!showsPanel)
.onChange(of: showsPanel) { newValue in
guard newValue else { return } // workaround
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
refreshID = UUID().uuidString
}
}
}
}

// MARK: UpperPanel
private struct UpperPanel: View {
@Environment(\.dismiss) var dismissAction
@Binding var setting: Setting
@Binding private var setting: Setting
@Binding private var refreshID: String
@Binding private var autoPlayPolicy: AutoPlayPolicy

private let title: String
private let settingAction: () -> Void
private let updateSettingAction: (Setting) -> Void

init(
title: String, setting: Binding<Setting>,
title: String,
setting: Binding<Setting>,
refreshID: Binding<String>,
autoPlayPolicy: Binding<AutoPlayPolicy>,
settingAction: @escaping () -> Void,
updateSettingAction: @escaping (Setting) -> Void
) {
self.title = title
_setting = setting
_refreshID = refreshID
_autoPlayPolicy = autoPlayPolicy
self.settingAction = settingAction
self.updateSettingAction = updateSettingAction
Expand Down Expand Up @@ -141,23 +154,25 @@ private struct UpperPanel: View {
.symbolVariant(setting.enablesDualPageMode ? .fill : .none)
}
}
Menu {
Text("AutoPlay").foregroundColor(.secondary)
ForEach(AutoPlayPolicy.allCases) { policy in
Button {
autoPlayPolicy = policy
} label: {
Text(policy.descriptionKey)
if autoPlayPolicy == policy {
Image(systemName: "checkmark")
Image(systemName: "timer").opacity(0.01)
.overlay {
Menu {
Text("AutoPlay").foregroundColor(.secondary)
ForEach(AutoPlayPolicy.allCases) { policy in
Button {
autoPlayPolicy = policy
} label: {
Text(policy.descriptionKey)
if autoPlayPolicy == policy {
Image(systemName: "checkmark")
}
}
}
} label: {
Image(systemName: "timer")
}
}
} label: {
Image(systemName: "timer")
}
.frame(height: 25) // workaround
.clipped()
.id(refreshID)
Button(action: settingAction) {
Image(systemName: "gear")
}
Expand Down

0 comments on commit d6ce5ac

Please sign in to comment.