Skip to content

Commit

Permalink
🐛 pan開始時にスライドショーを停止する
Browse files Browse the repository at this point in the history
  • Loading branch information
tasuwo committed Aug 24, 2022
1 parent e8785bc commit f0e024e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ protocol ClipPreviewPageTransitionDispatcherInputs {
protocol ClipPreviewPageTransitionDispatcherOutputs {
var isPreviewScrollEnabled: CurrentValueSubject<Bool, Never> { get }
var presentInformation: PassthroughSubject<Void, Never> { get }
var didBeginPan: PassthroughSubject<Void, Never> { get }
}

class ClipPreviewPageTransitionController: NSObject,
Expand Down Expand Up @@ -61,6 +62,7 @@ class ClipPreviewPageTransitionController: NSObject,

let isPreviewScrollEnabled: CurrentValueSubject<Bool, Never> = .init(true)
let presentInformation: PassthroughSubject<Void, Never> = .init()
let didBeginPan: PassthroughSubject<Void, Never> = .init()

// MARK: Privates

Expand Down Expand Up @@ -122,6 +124,10 @@ class ClipPreviewPageTransitionController: NSObject,

@objc
func didPan(_ sender: UIPanGestureRecognizer) {
if sender.state == .began {
self.outputs.didBeginPan.send(())
}

switch (sender.state, self.destination) {
case (.began, .back):
guard context == nil else { return }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ extension ClipPreviewPageViewController {
transitionDispatcher.outputs.presentInformation
.sink { [weak self] in self?.store.execute(.clipInformationViewPresented) }
.store(in: &subscriptions)

transitionDispatcher.outputs.didBeginPan
.sink { [weak self] in self?.store.execute(.didBeginPan) }
.store(in: &subscriptions)
}

// MARK: Page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enum ClipPreviewPageViewAction: Action {
case settingUpdated(isSomeItemsHidden: Bool)
case playConfigUpdated(config: ClipPreviewPlayConfiguration)
case willBeginTransition
case didBeginPan
case willBeginZoom

// MARK: Transition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct ClipPreviewPageViewReducer: Reducer {
nextState.playConfiguration = config
return (nextState, .none)

case .willBeginTransition, .willBeginZoom:
case .willBeginTransition, .willBeginZoom, .didBeginPan:
nextState.playingAt = nil
return (nextState, .none)

Expand Down

0 comments on commit f0e024e

Please sign in to comment.