Skip to content

Commit

Permalink
Buttons on end slides
Browse files Browse the repository at this point in the history
  • Loading branch information
golson-wmf committed Oct 28, 2024
1 parent cbc45ba commit 583cf62
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,13 @@ public struct WMFYearInReview: View {
WMFYearInReviewScrollView(scrollViewContents: scrollViewContent, contents: { AnyView(buttonsFirstSlide) })
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else if viewModel.isEdgeSlide {
WMFYearInReviewScrollView(scrollViewContents: scrollViewContent)
.frame(maxWidth: .infinity, maxHeight: .infinity)
if viewModel.hasDonated {
WMFYearInReviewScrollView(scrollViewContents: scrollViewContent)
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else {
WMFYearInReviewScrollView(scrollViewContents: scrollViewContent, contents: { AnyView(buttonsLastSlide) })
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
} else {
VStack {
TabView(selection: $viewModel.currentSlide) {
Expand Down Expand Up @@ -131,6 +136,9 @@ public struct WMFYearInReview: View {
// Has donated or not
if viewModel.hasDonated {
VStack(alignment: .leading, spacing: 16) {
Image("globe", bundle: .module)
.frame(maxWidth: .infinity, alignment: .center)
.padding(.top, 48)
Text(viewModel.localizedStrings.firstSlideTitle)
.font(Font(WMFFont.for(.boldTitle1)))
Text(viewModel.localizedStrings.firstSlideSubtitle)
Expand All @@ -139,6 +147,9 @@ public struct WMFYearInReview: View {
.foregroundStyle(Color(uiColor: theme.text))
} else {
VStack(alignment: .leading, spacing: 16) {
Image("globe", bundle: .module)
.frame(maxWidth: .infinity, alignment: .center)
.padding(.top, 48)
Text(viewModel.localizedStrings.firstSlideTitle)
.font(Font(WMFFont.for(.boldTitle1)))
Text(viewModel.localizedStrings.firstSlideSubtitle)
Expand All @@ -164,31 +175,15 @@ public struct WMFYearInReview: View {
}

private var buttonsLastSlide: some View {
Group {
if viewModel.hasDonated {
VStack {
WMFLargeButton(configuration: .primary, title: viewModel.localizedStrings.firstSlideCTA) {
withAnimation(.easeInOut(duration: 0.75)) {
viewModel.getStarted()
}
}
WMFSmallButton(configuration: configuration, title: viewModel.localizedStrings.firstSlideHide) {
// TODO: Implement hide this feature
}
}
} else {
VStack {
WMFLargeButton(configuration: .primary, title: viewModel.localizedStrings.firstSlideCTA) {
withAnimation(.easeInOut(duration: 0.75)) {
viewModel.getStarted()
}
}
WMFSmallButton(configuration: configuration, title: viewModel.localizedStrings.firstSlideHide) {
// TODO: Implement hide this feature
}
VStack {
WMFLargeButton(configuration: .primary, title: viewModel.localizedStrings.lastSlideCTA) {
withAnimation(.easeInOut(duration: 0.75)) {
// TODO: Implement this feature
}
}

WMFSmallButton(configuration: configuration, title: viewModel.localizedStrings.lastSlideDonate) {
// TODO: Implement this feature
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class WMFYearInReviewViewModel: ObservableObject {
self.shareLink = shareLink
self.hashtag = hashtag
self.coordinatorDelegate = coordinatorDelegate
self.hasDonated = true
self.hasDonated = false
}

public func getStarted() {
Expand All @@ -42,10 +42,12 @@ public class WMFYearInReviewViewModel: ObservableObject {
let firstSlideSubtitle: String
let firstSlideCTA: String
let firstSlideHide: String
let lastSlideCTA: String
let lastSlideDonate: String
public let shareText: String
public let usernameTitle: String

public init(donateButtonTitle: String, doneButtonTitle: String, shareButtonTitle: String, nextButtonTitle: String, finishButtonTitle: String, firstSlideTitle: String, firstSlideSubtitle: String, firstSlideCTA: String, firstSlideHide: String, shareText: String, usernameTitle: String) {
public init(donateButtonTitle: String, doneButtonTitle: String, shareButtonTitle: String, nextButtonTitle: String, finishButtonTitle: String, firstSlideTitle: String, firstSlideSubtitle: String, firstSlideCTA: String, firstSlideHide: String, lastSlideCTA: String, lastSlideDonate: String, shareText: String, usernameTitle: String) {
self.donateButtonTitle = donateButtonTitle
self.doneButtonTitle = doneButtonTitle
self.shareButtonTitle = shareButtonTitle
Expand All @@ -55,6 +57,8 @@ public class WMFYearInReviewViewModel: ObservableObject {
self.firstSlideSubtitle = firstSlideSubtitle
self.firstSlideCTA = firstSlideCTA
self.firstSlideHide = firstSlideHide
self.lastSlideCTA = lastSlideCTA
self.lastSlideDonate = lastSlideDonate
self.shareText = shareText
self.usernameTitle = usernameTitle
}
Expand Down
2 changes: 2 additions & 0 deletions Wikipedia/Code/YearInReviewCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ final class YearInReviewCoordinator: NSObject, Coordinator {
firstSlideSubtitle: WMFLocalizedString("year-in-review-subtitle", value: "See insights about which articles you read on the Wikipedia app and the edits you made. Share your journey and discover what stood out for you this year. Your reading history is kept protected. Reading insights are calculated using locally stored data on your device.", comment: "Year in review page information"),
firstSlideCTA: WMFLocalizedString("year-in-review-get-started", value: "Get Started", comment: "Button to continue to year in review"),
firstSlideHide: WMFLocalizedString("year-in-review-hide", value: "Hide this feature", comment: "Button to hide year in review feature"),
lastSlideCTA: WMFLocalizedString("year-in-review-learn-more", value: "Learn more about our work", comment: "Button to navigate to learn more about our work."),
lastSlideDonate: WMFLocalizedString("year-in-review-already-donate", value: "I already contribute", comment: "Button to let the app know that the user has already made a donation"),
shareText: WMFLocalizedString("year-in-review-share-text", value: "Here's my Wikipedia year in review. Created with the Wikipedia iOS app", comment: "Text shared the Year In Review slides"),
usernameTitle: CommonStrings.userTitle
)
Expand Down
2 changes: 2 additions & 0 deletions Wikipedia/Localizations/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,7 @@
"year-in-review-2024-Wikipedia-num-edits-per-minute" = "342 edits per minute";
"year-in-review-2024-Wikipedia-num-languages" = "332 active languages";
"year-in-review-2024-Wikipedia-num-views" = "1.4 billion times";
"year-in-review-already-donate" = "I already contribute";
"year-in-review-base-editors-subtitle" = "Wikipedia's community of volunteer editors made more than $1 on the iOS app so far this year. The heart and soul of Wikipedia is our global community of volunteer contributors, donors, and billions of readers like yourself – all united to share unlimited access to reliable information.";
"year-in-review-base-editors-title" = "Editors on the iOS app made more than $1";
"year-in-review-base-edits-subtitle" = "This year, Wikipedia was edited at an average rate of $1. Articles are collaboratively created and improved using reliable sources. Each edit plays a crucial role in improving and expanding Wikipedia.";
Expand All @@ -1410,6 +1411,7 @@
"year-in-review-finish" = "Finish";
"year-in-review-get-started" = "Get Started";
"year-in-review-hide" = "Hide this feature";
"year-in-review-learn-more" = "Learn more about our work";
"year-in-review-next" = "Next";
"year-in-review-personalized-editing-subtitle-format" = "You edited Wikipedia {{PLURAL:$1|$1 time|$1 times}}. Thank you for being one of the volunteer editors making a difference on Wikimedia projects around the world.";
"year-in-review-personalized-editing-subtitle-format-500plus" = "You edited Wikipedia 500+ times. Thank you for being one of the volunteer editors making a difference on Wikimedia projects around the world.";
Expand Down
2 changes: 2 additions & 0 deletions Wikipedia/Localizations/qqq.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,7 @@
"year-in-review-2024-Wikipedia-num-edits-per-minute" = "Number of edits per minute made on Wikipedia. This text will be inserted into paragraph text displayed in Wikipedia Year in Review slides for 2024.";
"year-in-review-2024-Wikipedia-num-languages" = "Number of active languages available on Wikipedia. This text will be inserted into paragraph text displayed in Wikipedia Year in Review slides for 2024.";
"year-in-review-2024-Wikipedia-num-views" = "Number of article views on Wikipedia. This text will be inserted into paragraph text displayed in Wikipedia Year in Review slides for 2024.";
"year-in-review-already-donate" = "Button to let the app know that the user has already made a donation";
"year-in-review-base-editors-subtitle" = "Year in review, collective edits count slide subtitle, $1 is replaced with the number of edits text, e.g. \"460,300 edits\"";
"year-in-review-base-editors-title" = "Year in review, collective edits count slide title, $1 is replaced with the number of edits text, e.g. \"460,300 edits\".";
"year-in-review-base-edits-subtitle" = "Year in review, collective edits per minute slide subtitle, $1 is replaced with the number of edits per minute text, e.g. \"342 times per minute\"";
Expand All @@ -1410,6 +1411,7 @@
"year-in-review-finish" = "Year in review finish button";
"year-in-review-get-started" = "Button to continue to year in review";
"year-in-review-hide" = "Button to hide year in review feature";
"year-in-review-learn-more" = "Button to navigate to learn more about our work.";
"year-in-review-next" = "Year in review next button";
"year-in-review-personalized-editing-subtitle-format" = "Year in review, personalized editing article count slide subtitle for users that edited articles. $1 is replaced with the number of edits the user made.";
"year-in-review-personalized-editing-subtitle-format-500plus" = "Year in review, personalized editing article count slide subtitle for users that edited articles more than 500 times.";
Expand Down
Binary file modified Wikipedia/iOS Native Localizations/en.lproj/Localizable.strings
Binary file not shown.

0 comments on commit 583cf62

Please sign in to comment.