Skip to content

Commit 9c6205b

Browse files
authored
Merge branch 'main' into rebasedstorage
2 parents 56da68f + bb933d3 commit 9c6205b

File tree

51 files changed

+746
-113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+746
-113
lines changed

FeaturedArticleWidget/FeaturedArticleWidget.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class FeaturedArticleWidget: ExtensionViewController, NCWidgetProviding {
8787
func widgetPerformUpdate(completionHandler: @escaping (NCUpdateResult) -> Void) {
8888
WidgetController.shared.startWidgetUpdateTask(completionHandler) { (dataStore, completion) in
8989
let moc = dataStore.viewContext
90-
let siteURL = dataStore.languageLinkController.appLanguage?.siteURL()
90+
let siteURL = dataStore.primarySiteURL
9191
moc.perform {
9292
guard let featuredContentGroup = moc.newestGroup(of: .featuredArticle, forSiteURL: siteURL),
9393
let articleURL = featuredContentGroup.contentPreview as? URL else {

TopReadWidget/WMFTodayTopReadWidgetViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class WMFTodayTopReadWidgetViewController: ExtensionViewController, NCWidgetProv
159159
}
160160

161161
var language: String? = nil
162-
let siteURL = dataStore.languageLinkController.appLanguage?.siteURL()
162+
let siteURL = dataStore.primarySiteURL
163163
if let languageCode = siteURL?.wmf_language {
164164
language = Locale.current.localizedString(forLanguageCode: languageCode)
165165
}

WMF Framework/ReadingListsSyncOperation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ internal class ReadingListsSyncOperation: ReadingListsOperation {
390390

391391
if !englishOnly {
392392
if let randomLanguage = dataStore.languageLinkController.allLanguages.randomElement() {
393-
maybeSiteURL = randomLanguage.siteURL()
393+
maybeSiteURL = randomLanguage.siteURL
394394
}
395395
}
396396

WMF Framework/WidgetController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public final class WidgetController: NSObject {
6565
private func fetchCachedWidgetContentGroup(with kind: WMFContentGroupKind, isAnyLanguageAllowed: Bool, in dataStore: MWKDataStore, completion: @escaping (WMFContentGroup?) -> Void) {
6666
assert(Thread.isMainThread, "Cached widget content group must be fetched from the main queue")
6767
let moc = dataStore.viewContext
68-
let siteURL = isAnyLanguageAllowed ? dataStore.languageLinkController.appLanguage?.siteURL() : nil
68+
let siteURL = isAnyLanguageAllowed ? dataStore.primarySiteURL : nil
6969
completion(moc.newestGroup(of: kind, forSiteURL: siteURL))
7070
}
7171

Widgets/Widgets/OnThisDayWidget.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ final class OnThisDayData {
116116
let articleSnippet = WMFLocalizedString("widget-onthisday-placeholder-article-snippet", language: language?.languageCode, value: "Free online encyclopedia that anyone can edit", comment: "Placeholder text for On This Day widget: Article description for an article about Wikipedia")
117117

118118
// It seems that projects whose article is not titled "Wikipedia" (Arabic, for instance) all redirect this URL appropriately.
119-
let articleURL = URL(string: ((language?.siteURL().absoluteString ?? "https://en.wikipedia.org") + "/wiki/Wikipedia"))
119+
let articleURL = URL(string: ((language?.siteURL.absoluteString ?? "https://en.wikipedia.org") + "/wiki/Wikipedia"))
120120

121121
let entry: OnThisDayEntry = OnThisDayEntry(isRTLLanguage: isRTL,
122122
error: nil,

Wikipedia.xcodeproj/project.pbxproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4854,7 +4854,10 @@
48544854
D8FFF6942031CB4000A028E0 /* tcy */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = tcy; path = tcy.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
48554855
FF2090EE2500247100849774 /* ThreeLineHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeLineHeaderView.swift; sourceTree = "<group>"; };
48564856
FF2B210F254B7D6A0009E61A /* ActivityIndicatorCollectionViewFooter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityIndicatorCollectionViewFooter.swift; sourceTree = "<group>"; };
4857+
FF338A0A258D572900292602 /* nqo */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nqo; path = nqo.lproj/Localizable.strings; sourceTree = "<group>"; };
4858+
FF338A0B258D572900292602 /* nqo */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = nqo; path = nqo.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
48574859
FF59DF4C2555E0CB0048E66C /* InternalLinkPreviewing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InternalLinkPreviewing.swift; sourceTree = "<group>"; };
4860+
FF6A77E8258D68E7006FA238 /* nqo */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nqo; path = nqo.lproj/InfoPlist.strings; sourceTree = "<group>"; };
48584861
FF921856252E8F4F00C39A8F /* ThanksGiving.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThanksGiving.swift; sourceTree = "<group>"; };
48594862
FF9416D724E203030070FEE7 /* OnThisDayWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnThisDayWidget.swift; sourceTree = "<group>"; usesTabs = 0; };
48604863
FF9416DD24E2098C0070FEE7 /* OnThisDayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnThisDayView.swift; sourceTree = "<group>"; };
@@ -9145,6 +9148,7 @@
91459148
ga,
91469149
sl,
91479150
hr,
9151+
nqo,
91489152
);
91499153
mainGroup = D499142C181D51DE00E6073C;
91509154
packageReferences = (
@@ -12526,6 +12530,7 @@
1252612530
D801C9211EB8E131001FA294 /* yi */,
1252712531
D801C9231EB8E131001FA294 /* zh-hans */,
1252812532
D801C9251EB8E131001FA294 /* zh-hant */,
12533+
FF6A77E8258D68E7006FA238 /* nqo */,
1252912534
);
1253012535
name = InfoPlist.strings;
1253112536
sourceTree = "<group>";
@@ -12627,6 +12632,7 @@
1262712632
8361AEC621949665006B00B0 /* ga */,
1262812633
83CF71432326D47E009DEC00 /* sl */,
1262912634
834C269B24042DBF00245BE7 /* hr */,
12635+
FF338A0A258D572900292602 /* nqo */,
1263012636
);
1263112637
name = Localizable.strings;
1263212638
sourceTree = "<group>";
@@ -12736,6 +12742,7 @@
1273612742
8361AEC721949670006B00B0 /* ga */,
1273712743
83CF71442326D48A009DEC00 /* sl */,
1273812744
834C269C24042DCF00245BE7 /* hr */,
12745+
FF338A0B258D572900292602 /* nqo */,
1273912746
);
1274012747
name = Localizable.stringsdict;
1274112748
sourceTree = "<group>";

Wikipedia/Code/AccountViewController.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ class AccountViewController: SubSettingsViewController {
113113
showLogoutAlert()
114114
case .talkPage:
115115
if let username = dataStore.authenticationManager.loggedInUsername,
116-
let language = dataStore.languageLinkController.appLanguage {
117-
let siteURL = language.siteURL()
116+
let siteURL = dataStore.primarySiteURL {
118117
let title = TalkPageType.user.titleWithCanonicalNamespacePrefix(title: username, siteURL: siteURL)
119118

120119
let loadingFlowController = TalkPageContainerViewController.talkPageContainer(title: title, siteURL: siteURL, type: .user, dataStore: dataStore, theme: theme)

Wikipedia/Code/ArticleViewController+ArticleInformation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ extension ArticleViewController {
7070
extension ArticleViewController: WMFLanguagesViewControllerDelegate {
7171
func languagesController(_ controller: WMFLanguagesViewController, didSelectLanguage language: MWKLanguageLink) {
7272
dismiss(animated: true) {
73-
self.navigate(to: language.articleURL())
73+
self.navigate(to: language.articleURL)
7474
}
7575
}
7676
}

Wikipedia/Code/BaseExploreFeedSettingsViewController.swift

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class ExploreFeedSettingsLanguage: ExploreFeedSettingsItem {
111111
title = languageLink.localizedName
112112
subtitle = languageLink.languageCode.uppercased()
113113
self.controlTag = controlTag
114-
siteURL = languageLink.siteURL()
114+
siteURL = languageLink.siteURL
115115
updateIsOn(for: displayType)
116116
}
117117

@@ -320,3 +320,29 @@ extension BaseExploreFeedSettingsViewController: WMFSettingsTableViewCellDelegat
320320
assertionFailure("Subclassers should override")
321321
}
322322
}
323+
324+
// MARK: - MWKLanguageLink Convenience Methods
325+
326+
fileprivate extension MWKLanguageLink {
327+
private var feedContentController: WMFExploreFeedContentController {
328+
MWKDataStore.shared().feedContentController
329+
}
330+
331+
/**
332+
Flag indicating whether there are any visible customizable feed content sources in this language.
333+
Returns true if there is at least one content source in this language visible in the feed.
334+
Returns false if there are no content sources in this language visible in the feed.
335+
*/
336+
var isInFeed: Bool {
337+
feedContentController.anyContentGroupsVisibleInTheFeed(forSiteURL: siteURL)
338+
}
339+
340+
/**
341+
Flag indicating whether the content group of given kind is visible in the feed in this language.
342+
Returns YES if the content group of given kind is visible in the feed in this language.
343+
Returns NO if the content group of given kind is not visible in the feed in this language.
344+
*/
345+
func isInFeed(for contentGroupKind: WMFContentGroupKind) -> Bool {
346+
feedContentController.languageCodes(for: contentGroupKind).contains(languageCode)
347+
}
348+
}

Wikipedia/Code/EditLinkViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class EditLinkViewController: ViewController {
4242

4343
init?(link: Link, siteURL: URL?, dataStore: MWKDataStore) {
4444
guard
45-
let siteURL = siteURL ?? MWKDataStore.shared().languageLinkController.appLanguage?.siteURL() ?? NSURL.wmf_URLWithDefaultSiteAndCurrentLocale(),
45+
let siteURL = siteURL ?? MWKDataStore.shared().primarySiteURL ?? NSURL.wmf_URLWithDefaultSiteAndCurrentLocale(),
4646
let articleURL = link.articleURL(for: siteURL)
4747
else {
4848
return nil

0 commit comments

Comments
 (0)