Skip to content

Commit

Permalink
Merge pull request #5179 from wikimedia/7.7.0
Browse files Browse the repository at this point in the history
Merge 7.7.0 back into main
  • Loading branch information
mazevedofs authored Jan 30, 2025
2 parents 0e14331 + 43412f3 commit f1b12ba
Show file tree
Hide file tree
Showing 170 changed files with 940 additions and 759 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,25 @@ class WikipediaLanguageCommandLineUtilityAPI {
return Wikipedia(languageCode: code, languageName: name, localName: localname, altISOCode: "nb")
}

// If there's a site array populated with a subdomain that does NOT equal languageCode, skip. It might show up as a dupe in the languages list.
// TODO: This is a temporary workaround to remove duplicated languages, but eventually a proper data migration for the user might need to occur to switch from the old language code to the new.
if let sites = result["site"] as? [[String : Any]] {
let site = sites.first

if let siteURLString = site?["url"] as? String,
let components = URLComponents(string: siteURLString),
let host = components.host,
let hostLangCode = host.components(separatedBy: ".").first {

if siteURLString.hasSuffix("wikipedia.org") {
if code != hostLangCode && code != "yue" { // Cantonese has already slipped in here twice, so leaving it in as a dupe until we can clean up user databases.
return nil
}
}

}
}

return Wikipedia(languageCode: code, languageName: name, localName: localname, altISOCode: nil)
}
// Add testwiki and test2wiki, they are not returned by the site matrix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fileprivate final class WMFDeveloperSettingsHostingController: WMFComponentHosti

private func configureNavigationBar() {
let titleConfig = WMFNavigationBarTitleConfig(title: viewModel.localizedStrings.developerSettings, customView: nil, alignment: .centerCompact)
let closeConfig = WMFNavigationBarCloseButtonConfig(text: viewModel.localizedStrings.close, target: self, action: #selector(tappedClose), alignment: .trailing)
let closeConfig = WMFNavigationBarCloseButtonConfig(text: viewModel.localizedStrings.done, target: self, action: #selector(tappedClose), alignment: .leading)
configureNavigationBar(titleConfig: titleConfig, closeButtonConfig: closeConfig, profileButtonConfig: nil, searchBarConfig: nil, hideNavigationBarOnScroll: false)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import WMFData
let sendAnalyticsToWMFLabs: String
let enableYearinReview: String
let bypassDonation: String
let close: String
let done: String

@objc public init(developerSettings: String, doNotPostImageRecommendations: String, enableAltTextExperimentForEN: String, alwaysShowAltTextEntryPoint: String, sendAnalyticsToWMFLabs: String, enableYearinReview: String, bypassDonation: String, close: String) {
self.developerSettings = developerSettings
Expand All @@ -20,7 +20,7 @@ import WMFData
self.sendAnalyticsToWMFLabs = sendAnalyticsToWMFLabs
self.enableYearinReview = enableYearinReview
self.bypassDonation = bypassDonation
self.close = close
self.done = close
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public final class WMFDonateViewController: WMFCanvasViewController, WMFNavigati
var closeConfig: WMFNavigationBarCloseButtonConfig? = nil

if navigationController?.viewControllers.first === self {
closeConfig = WMFNavigationBarCloseButtonConfig(text: viewModel.localizedStrings.doneTitle, target: self, action: #selector(closeButtonTapped(_:)), alignment: .trailing)
closeConfig = WMFNavigationBarCloseButtonConfig(text: viewModel.localizedStrings.cancelTitle, target: self, action: #selector(closeButtonTapped(_:)), alignment: .leading)
}

configureNavigationBar(titleConfig: titleConfig, closeButtonConfig: closeConfig, profileButtonConfig: nil, searchBarConfig: nil, hideNavigationBarOnScroll: false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public final class WMFDonateViewModel: NSObject, ObservableObject {

public struct LocalizedStrings {
public let title: String
public let doneTitle: String
public let cancelTitle: String
public let transactionFeeOptInTextFormat: String
public let monthlyRecurringText: String
public let emailOptInText: String
Expand All @@ -39,9 +39,9 @@ public final class WMFDonateViewModel: NSObject, ObservableObject {
public let accessibilityKeyboardDoneButtonHint: String
public let accessibilityDonateButtonHintFormat: String

public init(title: String, doneTitle: String, transactionFeeOptInTextFormat: String, monthlyRecurringText: String, emailOptInText: String, maximumErrorText: String?, minimumErrorText: String, genericErrorTextFormat: String, helpLinkProblemsDonating: String, helpLinkOtherWaysToGive: String, helpLinkFrequentlyAskedQuestions: String, helpLinkTaxDeductibilityInformation: String, appleFinePrint: String, wikimediaFinePrint1: String, wikimediaFinePrint2: String, accessibilityAmountButtonHint: String, accessibilityTextfieldHint: String, accessibilityTransactionFeeHint: String, accessibilityMonthlyRecurringHint: String, accessibilityEmailOptInHint: String, accessibilityKeyboardDoneButtonHint: String, accessibilityDonateButtonHintFormat: String) {
public init(title: String, cancelTitle: String, transactionFeeOptInTextFormat: String, monthlyRecurringText: String, emailOptInText: String, maximumErrorText: String?, minimumErrorText: String, genericErrorTextFormat: String, helpLinkProblemsDonating: String, helpLinkOtherWaysToGive: String, helpLinkFrequentlyAskedQuestions: String, helpLinkTaxDeductibilityInformation: String, appleFinePrint: String, wikimediaFinePrint1: String, wikimediaFinePrint2: String, accessibilityAmountButtonHint: String, accessibilityTextfieldHint: String, accessibilityTransactionFeeHint: String, accessibilityMonthlyRecurringHint: String, accessibilityEmailOptInHint: String, accessibilityKeyboardDoneButtonHint: String, accessibilityDonateButtonHintFormat: String) {
self.title = title
self.doneTitle = doneTitle
self.cancelTitle = cancelTitle
self.transactionFeeOptInTextFormat = transactionFeeOptInTextFormat
self.monthlyRecurringText = monthlyRecurringText
self.emailOptInText = emailOptInText
Expand Down Expand Up @@ -229,7 +229,7 @@ public final class WMFDonateViewModel: NSObject, ObservableObject {
}

self.buttonViewModels = buttonViewModels
self.textfieldViewModel = AmountTextFieldViewModel(localizedStrings: AmountTextFieldViewModel.LocalizedStrings(doneTitle: localizedStrings.doneTitle, textfieldAccessibilityHint: localizedStrings.accessibilityTextfieldHint, doneAccessibilityHint: localizedStrings.accessibilityKeyboardDoneButtonHint), currencyCode: currencyCode, amount: 0, hasFocus: true)
self.textfieldViewModel = AmountTextFieldViewModel(localizedStrings: AmountTextFieldViewModel.LocalizedStrings(doneTitle: localizedStrings.cancelTitle, textfieldAccessibilityHint: localizedStrings.accessibilityTextfieldHint, doneAccessibilityHint: localizedStrings.accessibilityKeyboardDoneButtonHint), currencyCode: currencyCode, amount: 0, hasFocus: true)

self.finalAmount = 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public class WMFProfileHostingController<HostedView: View>: WMFComponentHostingC
private func configureNavigationBar() {
let titleConfig = WMFNavigationBarTitleConfig(title: viewModel.localizedStrings.pageTitle, customView: nil, alignment: .leadingLarge)

let closeConfig = WMFNavigationBarCloseButtonConfig(text: viewModel.localizedStrings.doneButtonTitle, target: self, action: #selector(tappedDone), alignment: .trailing)
let closeConfig = WMFNavigationBarCloseButtonConfig(text: viewModel.localizedStrings.doneButtonTitle, target: self, action: #selector(tappedDone), alignment: .leading)

configureNavigationBar(titleConfig: titleConfig, closeButtonConfig: closeConfig, profileButtonConfig: nil, searchBarConfig: nil, hideNavigationBarOnScroll: false)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ private extension WMFDonateViewModel.LocalizedStrings {
static func demoStringsForCurrencyCode(_ currencyCode: String) -> WMFDonateViewModel.LocalizedStrings {

let title = "Select an amount"
let doneTitle = "Done"
let cancelTitle = "Cancel"

let transactionFeeFormat = "I’ll generously add %1$@ to cover the transaction fees so you can keep 100 percent of my donation."

var minimumString: String = ""
Expand Down Expand Up @@ -342,7 +342,7 @@ private extension WMFDonateViewModel.LocalizedStrings {
let monthlyRecurring = "Make this a monthly recurring donation."
let accessibilityMonthlyRecurringHint = "Double tap to enable automatic monthly donations of this amount."

return WMFDonateViewModel.LocalizedStrings(title: title, doneTitle: doneTitle, transactionFeeOptInTextFormat: transactionFeeFormat, monthlyRecurringText: monthlyRecurring, emailOptInText: emailOptIn, maximumErrorText: maximumString, minimumErrorText: minimumString, genericErrorTextFormat: genericError, helpLinkProblemsDonating: helpProblemsDonating, helpLinkOtherWaysToGive: helpOtherWaysToGive, helpLinkFrequentlyAskedQuestions: helpFrequentlyAskedQuestions, helpLinkTaxDeductibilityInformation: helpTaxDeductibilityInformation, appleFinePrint: appleFinePrint, wikimediaFinePrint1: wikimediaFinePrint1, wikimediaFinePrint2: wikimediaFinePrint2, accessibilityAmountButtonHint: accessibilityAmountButtonHint, accessibilityTextfieldHint: accessibilityTextfieldHint, accessibilityTransactionFeeHint: accessibilityTransactionFeeHint, accessibilityMonthlyRecurringHint: accessibilityMonthlyRecurringHint, accessibilityEmailOptInHint: accessibilityEmailOptInHint, accessibilityKeyboardDoneButtonHint: accessibilityKeyboardDoneButtonHint, accessibilityDonateButtonHintFormat: accessibilityDonateHintButtonFormat)
return WMFDonateViewModel.LocalizedStrings(title: title, cancelTitle: cancelTitle, transactionFeeOptInTextFormat: transactionFeeFormat, monthlyRecurringText: monthlyRecurring, emailOptInText: emailOptIn, maximumErrorText: maximumString, minimumErrorText: minimumString, genericErrorTextFormat: genericError, helpLinkProblemsDonating: helpProblemsDonating, helpLinkOtherWaysToGive: helpOtherWaysToGive, helpLinkFrequentlyAskedQuestions: helpFrequentlyAskedQuestions, helpLinkTaxDeductibilityInformation: helpTaxDeductibilityInformation, appleFinePrint: appleFinePrint, wikimediaFinePrint1: wikimediaFinePrint1, wikimediaFinePrint2: wikimediaFinePrint2, accessibilityAmountButtonHint: accessibilityAmountButtonHint, accessibilityTextfieldHint: accessibilityTextfieldHint, accessibilityTransactionFeeHint: accessibilityTransactionFeeHint, accessibilityMonthlyRecurringHint: accessibilityMonthlyRecurringHint, accessibilityEmailOptInHint: accessibilityEmailOptInHint, accessibilityKeyboardDoneButtonHint: accessibilityKeyboardDoneButtonHint, accessibilityDonateButtonHintFormat: accessibilityDonateHintButtonFormat)
}

static var usdMinimumString: String {
Expand Down
2 changes: 1 addition & 1 deletion Wikipedia/Code/AboutViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ - (void)presentDeveloperSettings {

NSString *bypassDonation = WMFLocalizedStringWithDefaultValue(@"developer-settings-bypass-donation", nil, nil, @"Bypass Donation", @"Title for option to bypass a donation in developer settings menu.");

WMFDeveloperSettingsLocalizedStrings *localizedStrings = [[WMFDeveloperSettingsLocalizedStrings alloc] initWithDeveloperSettings:developerSettings doNotPostImageRecommendations:doNotPostImageRecommendations enableAltTextExperimentForEN:enableAltTextExperimentForEN alwaysShowAltTextEntryPoint:alwaysShowAltTextEntryPoint sendAnalyticsToWMFLabs:sendAnalyticsToWMFLabs enableYearinReview:enableYearInReview bypassDonation:bypassDonation close:WMFCommonStrings.closeButtonAccessibilityLabel];
WMFDeveloperSettingsLocalizedStrings *localizedStrings = [[WMFDeveloperSettingsLocalizedStrings alloc] initWithDeveloperSettings:developerSettings doNotPostImageRecommendations:doNotPostImageRecommendations enableAltTextExperimentForEN:enableAltTextExperimentForEN alwaysShowAltTextEntryPoint:alwaysShowAltTextEntryPoint sendAnalyticsToWMFLabs:sendAnalyticsToWMFLabs enableYearinReview:enableYearInReview bypassDonation:bypassDonation close:WMFCommonStrings.doneTitle];
WMFDeveloperSettingsViewModel *viewModel = [[WMFDeveloperSettingsViewModel alloc] initWithLocalizedStrings:localizedStrings];

WMFDeveloperSettingsViewController *viewController = [[WMFDeveloperSettingsViewController alloc] initWithViewModel:viewModel];
Expand Down
4 changes: 2 additions & 2 deletions Wikipedia/Code/AddArticlesToReadingListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ class AddArticlesToReadingListViewController: ThemeableViewController, WMFNaviga

let titleConfig = WMFNavigationBarTitleConfig(title: String.localizedStringWithFormat(title, articles.count), customView: nil, alignment: .centerCompact)

let closeButtonConfig = WMFNavigationBarCloseButtonConfig(text: CommonStrings.doneTitle, target: self, action: #selector(closeButtonPressed), alignment: .trailing)
let closeButtonConfig = WMFNavigationBarCloseButtonConfig(text: CommonStrings.cancelActionTitle, target: self, action: #selector(closeButtonPressed), alignment: .leading)

configureNavigationBar(titleConfig: titleConfig, closeButtonConfig: closeButtonConfig, profileButtonConfig: nil, searchBarConfig: nil, hideNavigationBarOnScroll: false)
}

Expand Down
5 changes: 2 additions & 3 deletions Wikipedia/Code/CreateReadingListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,12 @@ class CreateReadingListViewController: WMFScrollViewController, UITextFieldDeleg
private func configureNavigationBar() {

let title = isInImportingMode ? WMFLocalizedString("import-shared-reading-list-title", value: "Import shared reading list", comment: "Title of screen that imports a shared reading list.") : CommonStrings.createNewListTitle
let closeAlignment: WMFNavigationBarCloseButtonConfig.Alignment = isInImportingMode ? .leading : .trailing

view.wmf_addSubviewWithConstraintsToEdges(importLoadingView)

let titleConfig = WMFNavigationBarTitleConfig(title: title, customView: nil, alignment: .centerCompact)
let closeButtonConfig = WMFNavigationBarCloseButtonConfig(text: CommonStrings.doneTitle, target: self, action: #selector(closeButtonTapped(_:)), alignment: closeAlignment)
let closeButtonConfig = WMFNavigationBarCloseButtonConfig(text: CommonStrings.cancelActionTitle, target: self, action: #selector(closeButtonTapped(_:)), alignment: .leading)

configureNavigationBar(titleConfig: titleConfig, closeButtonConfig: closeButtonConfig, profileButtonConfig: nil, searchBarConfig: nil, hideNavigationBarOnScroll: false)
}

Expand Down
4 changes: 2 additions & 2 deletions Wikipedia/Code/DescriptionEditViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ protocol DescriptionEditViewControllerDelegate: AnyObject {

let titleConfig = WMFNavigationBarTitleConfig(title: title, customView: nil, alignment: .centerCompact)

let closeConfig = WMFNavigationBarCloseButtonConfig(text: CommonStrings.doneTitle, target: self, action: #selector(closeButtonPushed(_:)), alignment: .trailing)
let closeConfig = WMFNavigationBarCloseButtonConfig(text: CommonStrings.cancelActionTitle, target: self, action: #selector(closeButtonPushed(_:)), alignment: .leading)

configureNavigationBar(titleConfig: titleConfig, closeButtonConfig: closeConfig, profileButtonConfig: nil, searchBarConfig: nil, hideNavigationBarOnScroll: false)
}

Expand Down
6 changes: 3 additions & 3 deletions Wikipedia/Code/DonateCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ class DonateCoordinator: Coordinator {
let maximumString = formatter.string(from: maximumValue as NSNumber)

let donate = WMFLocalizedString("donate-title", value: "Select an amount", comment: "Title for donate form.")
let done = CommonStrings.doneTitle
let cancel = CommonStrings.cancelActionTitle

let transactionFeeFormat = WMFLocalizedString("donate-transaction-fee-opt-in-text", value: "I’ll generously add %1$@ to cover the transaction fees so you can keep 100%% of my donation.", comment: "Transaction fee checkbox on donate form. Checking it adds transaction fee to donation amount. Parameters: * %1$@ - transaction fee amount. Please leave %% unchanged for proper formatting.")

let minimumFormat = WMFLocalizedString("donate-minimum-error-text", value: "Please select an amount (minimum %1$@ %2$@).", comment: "Error text displayed when user enters donation amount below the allowed minimum. Parameters: * %1$@ - the minimum amount allowed, %2$@ - the currency code. (For example, '$1 USD')")
Expand Down Expand Up @@ -360,7 +360,7 @@ class DonateCoordinator: Coordinator {

let accessibilityDonateHintButtonFormat = WMFLocalizedString("donate-accessibility-donate-hint-format", value: "Double tap to donate %1$@ to the Wikimedia Foundation.", comment: "Accessibility hint on donate form Apple Pay button for screen readers. Parameters: * %1$@ - the donation amount entered by the user.")

let localizedStrings = WMFDonateViewModel.LocalizedStrings(title: donate, doneTitle: done, transactionFeeOptInTextFormat: transactionFeeFormat, monthlyRecurringText: monthlyRecurring, emailOptInText: emailOptIn, maximumErrorText: maximum, minimumErrorText: minimum, genericErrorTextFormat: genericErrorFormat, helpLinkProblemsDonating: helpProblemsDonating, helpLinkOtherWaysToGive: helpOtherWaysToGive, helpLinkFrequentlyAskedQuestions: helpFrequentlyAskedQuestions, helpLinkTaxDeductibilityInformation: helpTaxDeductibilityInformation, appleFinePrint: appleFinePrint, wikimediaFinePrint1: wikimediaFinePrint1, wikimediaFinePrint2: wikimediaFinePrint2, accessibilityAmountButtonHint: accessibilityAmountButtonHint, accessibilityTextfieldHint: accessibilityTextfieldHint, accessibilityTransactionFeeHint: accessibilityTransactionFeeHint, accessibilityMonthlyRecurringHint: accessibilityMonthlyRecurringHint, accessibilityEmailOptInHint: accessibilityEmailOptInHint, accessibilityKeyboardDoneButtonHint: accessibilityKeyboardDoneButtonHint, accessibilityDonateButtonHintFormat: accessibilityDonateHintButtonFormat)
let localizedStrings = WMFDonateViewModel.LocalizedStrings(title: donate, cancelTitle: cancel, transactionFeeOptInTextFormat: transactionFeeFormat, monthlyRecurringText: monthlyRecurring, emailOptInText: emailOptIn, maximumErrorText: maximum, minimumErrorText: minimum, genericErrorTextFormat: genericErrorFormat, helpLinkProblemsDonating: helpProblemsDonating, helpLinkOtherWaysToGive: helpOtherWaysToGive, helpLinkFrequentlyAskedQuestions: helpFrequentlyAskedQuestions, helpLinkTaxDeductibilityInformation: helpTaxDeductibilityInformation, appleFinePrint: appleFinePrint, wikimediaFinePrint1: wikimediaFinePrint1, wikimediaFinePrint2: wikimediaFinePrint2, accessibilityAmountButtonHint: accessibilityAmountButtonHint, accessibilityTextfieldHint: accessibilityTextfieldHint, accessibilityTransactionFeeHint: accessibilityTransactionFeeHint, accessibilityMonthlyRecurringHint: accessibilityMonthlyRecurringHint, accessibilityEmailOptInHint: accessibilityEmailOptInHint, accessibilityKeyboardDoneButtonHint: accessibilityKeyboardDoneButtonHint, accessibilityDonateButtonHintFormat: accessibilityDonateHintButtonFormat)

guard let viewModel = WMFDonateViewModel(localizedStrings: localizedStrings, donateConfig: donateConfig, paymentMethods: paymentMethods, countryCode: countryCode, currencyCode: currencyCode, languageCode: languageCode, merchantID: merchantID, metricsID: metricsID, appVersion: appVersion, coordinatorDelegate: self, loggingDelegate: self) else {
return nil
Expand Down
Loading

0 comments on commit f1b12ba

Please sign in to comment.