Skip to content

[YiR] Show survey for users that reached second slide #5101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ public struct WMFYearInReviewView: View {
.onChange(of: viewModel.currentSlide) { newSlide in
// Logs slide impressions and next taps
viewModel.logYearInReviewSlideDidAppear()
if newSlide == 1 {
viewModel.hasSeenTwoSlides = true
}
}
.toolbar {
if !viewModel.isFirstSlide {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public class WMFYearInReviewViewModel: ObservableObject {
weak var coordinatorDelegate: YearInReviewCoordinatorDelegate?
weak var badgeDelegate: YearInReviewBadgeDelegate?
private(set) weak var loggingDelegate: WMFYearInReviewLoggingDelegate?

var hasSeenTwoSlides: Bool = false

@Published public var isLoading: Bool = false

public init(isFirstSlide: Bool = true, localizedStrings: LocalizedStrings, slides: [YearInReviewSlideContent], shareLink: String, hashtag: String, hasPersonalizedDonateSlide: Bool, coordinatorDelegate: YearInReviewCoordinatorDelegate?, loggingDelegate: WMFYearInReviewLoggingDelegate, badgeDelegate: YearInReviewBadgeDelegate?) {
Expand All @@ -45,7 +46,7 @@ public class WMFYearInReviewViewModel: ObservableObject {

public func nextSlide() {
if isLastSlide {
coordinatorDelegate?.handleYearInReviewAction(.dismiss(isLastSlide: true))
coordinatorDelegate?.handleYearInReviewAction(.dismiss(hasSeenTwoSlides: true))
} else {
currentSlide = (currentSlide + 1) % slides.count
}
Expand Down Expand Up @@ -85,7 +86,7 @@ public class WMFYearInReviewViewModel: ObservableObject {
}

func handleDone() {
coordinatorDelegate?.handleYearInReviewAction(.dismiss(isLastSlide: isLastSlide))
coordinatorDelegate?.handleYearInReviewAction(.dismiss(hasSeenTwoSlides: hasSeenTwoSlides))
}

func handleDonate(sourceRect: CGRect) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public protocol YearInReviewCoordinatorDelegate: AnyObject {
public enum YearInReviewCoordinatorAction {
case donate(sourceRect: CGRect)
case share(image: UIImage)
case dismiss(isLastSlide: Bool)
case dismiss(hasSeenTwoSlides: Bool)
case introLearnMore
case learnMore(url: URL, shouldShowDonateButton: Bool)
case info(url: URL)
Expand Down
4 changes: 2 additions & 2 deletions Wikipedia/Code/YearInReviewCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -706,12 +706,12 @@ extension YearInReviewCoordinator: YearInReviewCoordinatorDelegate {

visibleVC.present(activityController, animated: true, completion: nil)
}
case .dismiss(let isLastSlide):
case .dismiss(let hasSeenTwoSlides):
(self.navigationController as? RootNavigationController)?.turnOffForcePortrait()
navigationController.dismiss(animated: true, completion: { [weak self] in
guard let self else { return }

guard isLastSlide else { return }
guard hasSeenTwoSlides else { return }

self.presentSurveyIfNeeded()
})
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy