Skip to content

Commit

Permalink
Merge pull request #5087 from wikimedia/fix-sharing-2
Browse files Browse the repository at this point in the history
[YiR] Fix sharing bugs
  • Loading branch information
mazevedofs authored Nov 21, 2024
2 parents e1e6356 + 4c51bde commit fbc5509
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ struct WMFYearInReviewShareableSlideView: View {
var slideTitle: String
var slideSubtitle: String
var hashtag: String

private func subtitleAttributedString() -> AttributedString {
return (try? AttributedString(markdown: slideSubtitle)) ?? AttributedString(slideSubtitle)
}

var body: some View {
GeometryReader { geometry in
Expand All @@ -34,8 +38,6 @@ struct WMFYearInReviewShareableSlideView: View {

if let imageOverlay {
Image(imageOverlay, bundle: .module)
.padding(.horizontal, 100)
.padding(.vertical, 50)
}

if let overlayText = textOverlay {
Expand All @@ -49,14 +51,14 @@ struct WMFYearInReviewShareableSlideView: View {
Text(slideTitle)
.font(Font(WMFFont.for(.boldTitle1, compatibleWith: UITraitCollection(preferredContentSizeCategory: .medium))))
.foregroundStyle(Color(uiColor: theme.text))
Text(slideSubtitle)
Text(subtitleAttributedString())
.font(Font(WMFFont.for(.title3, compatibleWith: UITraitCollection(preferredContentSizeCategory: .medium))))
.foregroundStyle(Color(uiColor: theme.text))
.accentColor(Color(uiColor: theme.link))
}
.padding(28)
}


Spacer(minLength: 10)

HStack {
Expand Down
16 changes: 15 additions & 1 deletion Wikipedia/Code/YearInReviewCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,21 @@ class YiRShareActivityContentProvider: UIActivityItemProvider, @unchecked Sendab
}

override var item: Any {
return YiRShareActivityContentProvider.messageRepresentation(text: text, appStoreURL: appStoreURL, hashtag: hashtag)
return YiRShareActivityContentProvider.messageRepresentation(text: text, appStoreURL: appStoreURL, hashtag: hashtag)
}

override func activityViewController(_ activityViewController: UIActivityViewController, itemForActivityType activityType: UIActivity.ActivityType?) -> Any? {
switch activityType {
case .postToFacebook:
return nil
default:
if let activityType,
activityType.rawValue.contains("instagram") {
return nil
}

return item
}
}

override func activityViewController(_ activityViewController: UIActivityViewController, subjectForActivityType activityType: UIActivity.ActivityType?) -> String {
Expand Down

0 comments on commit fbc5509

Please sign in to comment.