Skip to content

Commit

Permalink
Merge branch 'main' into 7.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tonisevener authored Feb 14, 2025
2 parents 1287981 + d7d30a1 commit 286b18d
Show file tree
Hide file tree
Showing 63 changed files with 486 additions and 108 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/check_versions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Checks the PR label against the app version, fails if they do not match.
# This is to prevent unwanted PRs from being merged into main.
name: Check PR and App Versions

on:
pull_request:
types:
- opened
branches:
- 'main'
workflow_dispatch: # allows workflow to be triggered manually

jobs:
check-version:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v4
- name: Check PR label and App Versions
continue-on-error: false
run: |
echo "Testing"
2 changes: 1 addition & 1 deletion ContinueReadingWidget/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>7.7.1</string>
<string>7.7.2</string>
<key>CFBundleVersion</key>
<string>0</string>
<key>NSExtension</key>
Expand Down
2 changes: 1 addition & 1 deletion NotificationServiceExtension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>7.7.1</string>
<string>7.7.2</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSExtension</key>
Expand Down
2 changes: 1 addition & 1 deletion WMF Framework/Event Platform/EventPlatformClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ import WMFData
case watchlist = "/analytics/mobile_apps/ios_watchlists/4.1.0"
case appInteraction = "/analytics/mobile_apps/app_interaction/1.1.0"
case imageRecommendation = "/analytics/mobile_apps/android_image_recommendation_event/1.1.0"
case articleLinkInteraction = "/analytics/mobile_apps/ios_article_link_interaction/1.0.0"
case articleLinkInteraction = "/analytics/mobile_apps/ios_article_link_interaction/2.0.0"
}

/**
Expand Down
2 changes: 1 addition & 1 deletion WMF Framework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>7.7.1</string>
<string>7.7.2</string>
<key>CFBundleVersion</key>
<string>0</string>
<key>NSPrincipalClass</key>
Expand Down
2 changes: 1 addition & 1 deletion Widgets/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>7.7.1</string>
<string>7.7.2</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSExtension</key>
Expand Down
2 changes: 1 addition & 1 deletion Wikipedia Stickers/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>7.7.1</string>
<string>7.7.2</string>
<key>CFBundleVersion</key>
<string>0</string>
<key>UIRequiredDeviceCapabilities</key>
Expand Down
6 changes: 3 additions & 3 deletions Wikipedia/Code/AltTextArticleEditorOnboardingPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ final class AltTextArticleEditorOnboardingPresenter {
let sheetLocalizedStrings = WMFAltTextExperimentModalSheetViewModel.LocalizedStrings(title: addAltTextTitle, nextButton: CommonStrings.nextTitle, textViewPlaceholder: textViewPlaceholder, textViewBottomDescription: textViewBottomDescription, characterCounterWarning: characterCounterWarningText, characterCounterFormat: characterCounterFormat, guidance: guidanceText)

let bottomSheetViewModel = WMFAltTextExperimentModalSheetViewModel(altTextViewModel: altTextViewModel, localizedStrings: sheetLocalizedStrings)
if let articleViewController = ArticleViewController(articleURL: articleViewController.articleURL, dataStore: articleViewController.dataStore, theme: articleViewController.theme, altTextExperimentViewModel: altTextViewModel, needsAltTextExperimentSheet: true, altTextBottomSheetViewModel: bottomSheetViewModel, altTextDelegate: articleViewController) {

if let articleViewController = ArticleViewController(articleURL: articleViewController.articleURL, dataStore: articleViewController.dataStore, theme: articleViewController.theme, source: .undefined, altTextExperimentViewModel: altTextViewModel, needsAltTextExperimentSheet: true, altTextBottomSheetViewModel: bottomSheetViewModel, altTextDelegate: articleViewController) {

self.articleViewController?.navigationController?.pushViewController(articleViewController, animated: true)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ final class AltTextImageRecommendationsOnboardingPresenter {

if let siteURL = imageRecommendationsViewModel.project.siteURL,
let articleURL = siteURL.wmf_URL(withTitle: articleTitle),
let articleViewController = ArticleViewController(articleURL: articleURL, dataStore: exploreViewController.dataStore, theme: exploreViewController.theme, altTextExperimentViewModel: altTextViewModel, needsAltTextExperimentSheet: true, altTextBottomSheetViewModel: bottomSheetViewModel, altTextDelegate: exploreViewController) {
let articleViewController = ArticleViewController(articleURL: articleURL, dataStore: exploreViewController.dataStore, theme: exploreViewController.theme, source: .undefined, altTextExperimentViewModel: altTextViewModel, needsAltTextExperimentSheet: true, altTextBottomSheetViewModel: bottomSheetViewModel, altTextDelegate: exploreViewController) {

imageRecommendationsViewController.navigationController?.pushViewController(articleViewController, animated: true)
}
Expand Down
6 changes: 3 additions & 3 deletions Wikipedia/Code/ArticleCollectionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import UIKit

@objc(WMFArticleCollectionViewController)
class ArticleCollectionViewController: ColumnarCollectionViewController, EditableCollection, MEPEventsProviding, CollectionViewContextMenuShowing {

@objc var dataStore: MWKDataStore!
var cellLayoutEstimate: ColumnarCollectionViewLayoutHeightEstimate?

var editController: CollectionViewEditController!
var contentGroup: WMFContentGroup?

override func viewDidLoad() {
super.viewDidLoad()
layoutManager.register(ArticleRightAlignedImageCollectionViewCell.self, forCellWithReuseIdentifier: ArticleRightAlignedImageCollectionViewCell.identifier, addPlaceholder: true)
Expand Down Expand Up @@ -142,7 +143,7 @@ class ArticleCollectionViewController: ColumnarCollectionViewController, Editabl

previewedIndexPath = indexPath

guard let articleViewController = ArticleViewController(articleURL: articleURL, dataStore: dataStore, theme: self.theme) else {
guard let articleViewController = ArticleViewController(articleURL: articleURL, dataStore: dataStore, theme: self.theme, source: .undefined) else {
return nil
}
articleViewController.articlePreviewingDelegate = self
Expand Down Expand Up @@ -181,7 +182,6 @@ extension ArticleCollectionViewController {
collectionView.deselectItem(at: indexPath, animated: true)
return
}

navigate(to: articleURL)
}

Expand Down
27 changes: 21 additions & 6 deletions Wikipedia/Code/ArticleLinkInteractionFunnel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,39 @@ final class ArticleLinkInteractionFunnel {
let action: Action
let pageID: Int
let wikiID: String

let source: Int?

enum CodingKeys: String, CodingKey {
case action = "action"
case pageID = "page_id"
case wikiID = "wiki_db"
case source
}
}

private func logEvent(action: ArticleLinkInteractionFunnel.Action, pageID: Int, project: WikimediaProject) {
private func logEvent(action: ArticleLinkInteractionFunnel.Action, pageID: Int, project: WikimediaProject, source: Int? = nil) {

let wikiID = project.notificationsApiWikiIdentifier

let event: ArticleLinkInteractionFunnel.Event = ArticleLinkInteractionFunnel.Event(action: action, pageID: pageID, wikiID: wikiID)
let event: ArticleLinkInteractionFunnel.Event = ArticleLinkInteractionFunnel.Event(action: action, pageID: pageID, wikiID: wikiID, source: source)
EventPlatformClient.shared.submit(stream: .articleLinkInteraction, event: event)
}

func logArticleView(pageID: Int, project: WikimediaProject) {
logEvent(action: .navigate, pageID: pageID, project: project)
func logArticleView(pageID: Int, project: WikimediaProject, source: ArticleSource? = nil) {
// Avoid sending 0 to backend. It doesn't throw an error, but is unexpected
let loggingSource = source == .undefined ? nil : source?.rawValue
logEvent(action: .navigate, pageID: pageID, project: project, source: loggingSource)
}
}

@objc
public enum ArticleSource: Int {
case undefined = 0 // temporary
case search = 1
case history = 4
case places = 9
}

public struct ArticleSourceUserInfoKeys {
static let articleSource = "articleSource"
}
11 changes: 8 additions & 3 deletions Wikipedia/Code/ArticleLocationCollectionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ class ArticleLocationCollectionViewController: ColumnarCollectionViewController,
private var previewedIndexPath: IndexPath?
private let contentGroup: WMFContentGroup?
private let needsCloseButton: Bool
var articleSource: ArticleSource

let contentGroupIDURIString: String?

required init(articleURLs: [URL], dataStore: MWKDataStore, contentGroup: WMFContentGroup?, theme: Theme, needsCloseButton: Bool = false) {
required init(articleURLs: [URL], dataStore: MWKDataStore, contentGroup: WMFContentGroup?, theme: Theme, needsCloseButton: Bool = false, source: ArticleSource) {
self.articleURLs = articleURLs
self.dataStore = dataStore
self.contentGroup = contentGroup
contentGroupIDURIString = contentGroup?.objectID.uriRepresentation().absoluteString
self.needsCloseButton = needsCloseButton
self.articleSource = source
super.init(nibName: nil, bundle: nil)
self.theme = theme
if needsCloseButton {
Expand All @@ -34,6 +36,7 @@ class ArticleLocationCollectionViewController: ColumnarCollectionViewController,
self.contentGroup = nil
self.contentGroupIDURIString = nil
self.needsCloseButton = false
self.articleSource = .undefined
super.init(coder: aDecoder)
if needsCloseButton {
hidesBottomBarWhenPushed = true
Expand Down Expand Up @@ -185,15 +188,17 @@ extension ArticleLocationCollectionViewController: LocationManagerDelegate {
// MARK: - UICollectionViewDelegate
extension ArticleLocationCollectionViewController {
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
navigate(to: articleURLs[indexPath.item])
let userInfo: [AnyHashable:Any]? = [ArticleSourceUserInfoKeys.articleSource: articleSource.rawValue]
navigate(to: articleURLs[indexPath.item], userInfo: userInfo)
}
}

// MARK: - CollectionViewContextMenuShowing
extension ArticleLocationCollectionViewController: CollectionViewContextMenuShowing {
func articleViewController(for indexPath: IndexPath) -> ArticleViewController? {

let articleURL = articleURL(at: indexPath)
let articleViewController = ArticleViewController(articleURL: articleURL, dataStore: dataStore, theme: theme)
let articleViewController = ArticleViewController(articleURL: articleURL, dataStore: dataStore, theme: theme, source: articleSource)
return articleViewController
}

Expand Down
2 changes: 1 addition & 1 deletion Wikipedia/Code/ArticleViewController+LinkPreviewing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ extension ArticleViewController: ArticleContextMenuPresenting, WKUIDelegate {
return nil
}

let articleVC = ArticleViewController(articleURL: newArticleURL, dataStore: dataStore, theme: theme)
let articleVC = ArticleViewController(articleURL: newArticleURL, dataStore: dataStore, theme: theme, source: .undefined)
articleVC?.articlePreviewingDelegate = self
articleVC?.wmf_addPeekableChildViewController(for: newArticleURL, dataStore: dataStore, theme: theme)
return articleVC
Expand Down
21 changes: 11 additions & 10 deletions Wikipedia/Code/ArticleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,17 @@ class ArticleViewController: ThemeableViewController, HintPresenting, UIScrollVi

private var finishedLoadingArticleDuringPeek = false

convenience init?(articleURL: URL, dataStore: MWKDataStore, theme: Theme, schemeHandler: SchemeHandler? = nil, altTextExperimentViewModel: WMFAltTextExperimentViewModel, needsAltTextExperimentSheet: Bool, altTextBottomSheetViewModel: WMFAltTextExperimentModalSheetViewModel?, altTextDelegate: AltTextDelegate?) {
self.init(articleURL: articleURL, dataStore: dataStore, theme: theme)
internal var articleViewSource: ArticleSource

convenience init?(articleURL: URL, dataStore: MWKDataStore, theme: Theme, source: ArticleSource, schemeHandler: SchemeHandler? = nil, altTextExperimentViewModel: WMFAltTextExperimentViewModel, needsAltTextExperimentSheet: Bool, altTextBottomSheetViewModel: WMFAltTextExperimentModalSheetViewModel?, altTextDelegate: AltTextDelegate?) {
self.init(articleURL: articleURL, dataStore: dataStore, theme: theme, source: source)
self.altTextExperimentViewModel = altTextExperimentViewModel
self.altTextBottomSheetViewModel = altTextBottomSheetViewModel
self.needsAltTextExperimentSheet = needsAltTextExperimentSheet
self.altTextDelegate = altTextDelegate
}

@objc init?(articleURL: URL, dataStore: MWKDataStore, theme: Theme, schemeHandler: SchemeHandler? = nil) {
@objc init?(articleURL: URL, dataStore: MWKDataStore, theme: Theme, source: ArticleSource, schemeHandler: SchemeHandler? = nil) {

guard let article = dataStore.fetchOrCreateArticle(with: articleURL) else {
return nil
Expand All @@ -195,6 +197,7 @@ class ArticleViewController: ThemeableViewController, HintPresenting, UIScrollVi
self.dataStore = dataStore
self.schemeHandler = schemeHandler ?? SchemeHandler(scheme: "app", session: dataStore.session)
self.cacheController = cacheController
self.articleViewSource = source

super.init(nibName: nil, bundle: nil)
self.theme = theme
Expand Down Expand Up @@ -355,13 +358,13 @@ class ArticleViewController: ThemeableViewController, HintPresenting, UIScrollVi
view.isUserInteractionEnabled = true
return view
}()

lazy var searchBarButtonItem: UIBarButtonItem = {
let button = UIBarButtonItem(image: UIImage(named: "search"), style: .plain, target: self, action: #selector(userDidTapSearchButton))
button.accessibilityLabel = CommonStrings.searchButtonAccessibilityLabel
return button
}()

override func updateViewConstraints() {
super.updateViewConstraints()
updateLeadImageMargins()
Expand Down Expand Up @@ -482,8 +485,7 @@ class ArticleViewController: ThemeableViewController, HintPresenting, UIScrollVi

self.showSurveyAnnouncementPanel(surveyAnnouncementResult: result, linkState: self.articleAsLivingDocController.surveyLinkState)
}



}

override func viewWillAppear(_ animated: Bool) {
Expand Down Expand Up @@ -651,7 +653,6 @@ class ArticleViewController: ThemeableViewController, HintPresenting, UIScrollVi

self.shareIfNecessary()
self.restoreScrollStateIfNecessary()

self.logPageViewAfterArticleLoad()
self.articleLoadWaitGroup = nil
}
Expand All @@ -663,7 +664,7 @@ class ArticleViewController: ThemeableViewController, HintPresenting, UIScrollVi
let project = WikimediaProject(siteURL: siteURL) {

if !isBeingPresentedAsPeek {
ArticleLinkInteractionFunnel.shared.logArticleView(pageID: pageID.intValue, project: project)
ArticleLinkInteractionFunnel.shared.logArticleView(pageID: pageID.intValue, project: project, source: articleViewSource)
} else {
// Set flag, will log later in viewDidAppear()
finishedLoadingArticleDuringPeek = true
Expand All @@ -685,7 +686,7 @@ class ArticleViewController: ThemeableViewController, HintPresenting, UIScrollVi
return
}

ArticleLinkInteractionFunnel.shared.logArticleView(pageID: pageID.intValue, project: project)
ArticleLinkInteractionFunnel.shared.logArticleView(pageID: pageID.intValue, project: project, source: articleViewSource)
}

private func setupForAltTextExperiment() {
Expand Down
8 changes: 4 additions & 4 deletions Wikipedia/Code/ExploreViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ class ExploreViewController: ColumnarCollectionViewController, ExploreCardViewCo
return
}

if let vc = group.detailViewControllerForPreviewItemAtIndex(0, dataStore: dataStore, theme: theme) {
if let vc = group.detailViewControllerForPreviewItemAtIndex(0, dataStore: dataStore, theme: theme, source: .undefined) {
if vc is WMFImageGalleryViewController {
present(vc, animated: true)
} else {
Expand Down Expand Up @@ -749,7 +749,7 @@ class ExploreViewController: ColumnarCollectionViewController, ExploreCardViewCo
func exploreCardViewController(_ exploreCardViewController: ExploreCardViewController, didSelectItemAtIndexPath indexPath: IndexPath) {
guard
let contentGroup = exploreCardViewController.contentGroup,
let vc = contentGroup.detailViewControllerForPreviewItemAtIndex(indexPath.row, dataStore: dataStore, theme: theme, imageRecDelegate: self, imageRecLoggingDelegate: self) else {
let vc = contentGroup.detailViewControllerForPreviewItemAtIndex(indexPath.row, dataStore: dataStore, theme: theme, source: .undefined, imageRecDelegate: self, imageRecLoggingDelegate: self) else {
return
}

Expand Down Expand Up @@ -868,7 +868,7 @@ class ExploreViewController: ColumnarCollectionViewController, ExploreCardViewCo
func viewController(for contentGroup: WMFContentGroup, at itemIndex: Int) -> UIViewController? {
previewed.context = contentGroup

if let viewControllerToCommit = contentGroup.detailViewControllerForPreviewItemAtIndex(itemIndex, dataStore: dataStore, theme: theme) {
if let viewControllerToCommit = contentGroup.detailViewControllerForPreviewItemAtIndex(itemIndex, dataStore: dataStore, theme: theme, source: .undefined) {
if let potd = viewControllerToCommit as? WMFImageGalleryViewController {
potd.setOverlayViewTopBarHidden(true)
} else if let avc = viewControllerToCommit as? ArticleViewController {
Expand Down Expand Up @@ -1472,7 +1472,7 @@ extension ExploreViewController: WMFImageRecommendationsDelegate {

guard let siteURL = project.siteURL,
let articleURL = siteURL.wmf_URL(withTitle: title),
let articleViewController = ArticleViewController(articleURL: articleURL, dataStore: dataStore, theme: theme) else {
let articleViewController = ArticleViewController(articleURL: articleURL, dataStore: dataStore, theme: theme, source: .undefined) else {
return
}

Expand Down
26 changes: 25 additions & 1 deletion Wikipedia/Code/HistoryViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,21 @@ class HistoryViewController: ArticleFetchedResultsViewController, WMFNavigationB
}
}
}


override func previewingViewController(for indexPath: IndexPath, at location: CGPoint) -> UIViewController? {
guard let vc = super.previewingViewController(for: indexPath, at: location) else {
return nil
}

guard let articleVC = (vc as? ArticleViewController) else {
return nil
}

articleVC.articleViewSource = .history

return articleVC
}

private func configureNavigationBar() {

var titleConfig: WMFNavigationBarTitleConfig = WMFNavigationBarTitleConfig(title: CommonStrings.historyTabTitle, customView: nil, alignment: .leadingCompact)
Expand Down Expand Up @@ -245,6 +259,16 @@ class HistoryViewController: ArticleFetchedResultsViewController, WMFNavigationB
configureNavigationBar()
}

override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
guard let articleURL = articleURL(at: indexPath) else {
collectionView.deselectItem(at: indexPath, animated: true)
return
}

let userInfo: [AnyHashable:Any]? = [ArticleSourceUserInfoKeys.articleSource: ArticleSource.history.rawValue]
navigate(to: articleURL, userInfo: userInfo)
}

func updateVisibleHeaders() {
for indexPath in collectionView.indexPathsForVisibleSupplementaryElements(ofKind: UICollectionView.elementKindSectionHeader) {
guard let headerView = collectionView.supplementaryView(forElementKind: UICollectionView.elementKindSectionHeader, at: indexPath) as? CollectionViewHeader else {
Expand Down
Loading

0 comments on commit 286b18d

Please sign in to comment.