Skip to content

Commit

Permalink
Merge branch 'main' into T282189
Browse files Browse the repository at this point in the history
  • Loading branch information
staykids authored May 11, 2021
2 parents 0200871 + 8f30c8d commit 01c1d61
Show file tree
Hide file tree
Showing 63 changed files with 41 additions and 56 deletions.
2 changes: 1 addition & 1 deletion Wikipedia.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -4071,7 +4071,7 @@
83F1096323D0D4F6003F3E9E /* ArticlePreviewingDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticlePreviewingDelegate.swift; sourceTree = "<group>"; };
83F1096823D0DB0F003F3E9E /* ViewController+ArticlePreviewing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ViewController+ArticlePreviewing.swift"; sourceTree = "<group>"; };
83F1096D23D0E787003F3E9E /* RandomArticleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RandomArticleViewController.swift; sourceTree = "<group>"; };
83F1097223D0F115003F3E9E /* HelpViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HelpViewController.swift; sourceTree = "<group>"; };
83F1097223D0F115003F3E9E /* HelpViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HelpViewController.swift; sourceTree = "<group>"; usesTabs = 0; };
83F26B29220B62EC002D87A4 /* SectionEditorButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SectionEditorButton.swift; sourceTree = "<group>"; };
83FBE96E1F6172ED0026C7EB /* ShareAFactActivityTextItemProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareAFactActivityTextItemProvider.swift; sourceTree = "<group>"; };
83FBE9741F6181E00026C7EB /* ShareAFactActivityImageItemProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareAFactActivityImageItemProvider.swift; sourceTree = "<group>"; };
Expand Down
35 changes: 14 additions & 21 deletions Wikipedia/Code/HelpViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,25 @@ class HelpViewController: SinglePageWebViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}

@objc func sendEmail() {
guard MFMailComposeViewController.canSendMail() else {
WMFAlertManager.sharedInstance.showErrorAlertWithMessage(WMFLocalizedString("no-email-account-alert", value: "Please setup an email account on your device and try again.", comment: "Displayed to the user when they try to send a feedback email, but they have never set up an account on their device"), sticky: false, dismissPreviousAlerts: false)
return
}
let vc = MFMailComposeViewController()
vc.setSubject(HelpViewController.emailSubject)
vc.setToRecipients([HelpViewController.emailAddress])
vc.setMessageBody("\n\n\n\nVersion: \(WikipediaAppUtils.versionedUserAgent())", isHTML: false)
if let data = DDLog.wmf_currentLogFile()?.data(using: .utf8) {
vc.addAttachmentData(data, mimeType: "text/plain", fileName: "Log.txt")
}
vc.mailComposeDelegate = self
present(vc, animated: true)
}


private func setupToolbar() {
enableToolbar()
toolbar.items = [UIBarButtonItem.flexibleSpaceToolbar(), sendEmailToolbarItem, UIBarButtonItem.wmf_barButtonItem(ofFixedWidth: 8)]
setToolbarHidden(false, animated: false)
}
}

@objc func sendEmail() {
let address = HelpViewController.emailAddress
let subject = HelpViewController.emailSubject
let body = "\n\n\n\nVersion: \(WikipediaAppUtils.versionedUserAgent())"
let mailto = "mailto:\(address)?subject=\(subject)&body=\(body)".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)

guard let encodedMailto = mailto, let mailtoURL = URL(string: encodedMailto), UIApplication.shared.canOpenURL(mailtoURL) else {
WMFAlertManager.sharedInstance.showErrorAlertWithMessage(WMFLocalizedString("no-email-account-alert", value: "Please setup an email account on your device and try again.", comment: "Displayed to the user when they try to send a feedback email, but they have never set up an account on their device"), sticky: false, dismissPreviousAlerts: false)
return
}

extension HelpViewController: MFMailComposeViewControllerDelegate {
func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
dismiss(animated: true)
UIApplication.shared.open(mailtoURL)
}

}
38 changes: 6 additions & 32 deletions Wikipedia/Code/WMFAlertManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,24 @@ import MessageUI
extension NSError {

public func alertMessage() -> String {
if(self.wmf_isNetworkConnectionError()){
if self.wmf_isNetworkConnectionError() {
return CommonStrings.noInternetConnection
}else{
} else {
return self.localizedDescription
}
}

public func alertType() -> RMessageType {
if(self.wmf_isNetworkConnectionError()){
if self.wmf_isNetworkConnectionError() {
return .warning
}else{
} else {
return .error
}
}

}


open class WMFAlertManager: NSObject, RMessageProtocol, MFMailComposeViewControllerDelegate, Themeable {
open class WMFAlertManager: NSObject, RMessageProtocol, Themeable {

@objc static let sharedInstance = WMFAlertManager()

Expand Down Expand Up @@ -137,30 +136,5 @@ open class WMFAlertManager: NSObject, RMessageProtocol, MFMailComposeViewControl
messageView.titleTextColor = theme.colors.link
}
}

@objc func showEmailFeedbackAlertViewWithError(_ error: NSError) {
let message = WMFLocalizedString("request-feedback-on-error", value:"The app has encountered a problem that our developers would like to know more about. Please tap here to send us an email with the error details.", comment:"Displayed to beta users when they encounter an error we'd like feedback on")
showErrorAlertWithMessage(message, sticky: true, dismissPreviousAlerts: true) {
self.dismissAllAlerts()
if MFMailComposeViewController.canSendMail() {
guard let rootVC = UIApplication.shared.keyWindow?.rootViewController else {
return
}
let vc = MFMailComposeViewController()
vc.setSubject("Bug:\(WikipediaAppUtils.versionedUserAgent())")
vc.setToRecipients(["[email protected]"])
vc.mailComposeDelegate = self
vc.setMessageBody("Domain:\t\(error.domain)\nCode:\t\(error.code)\nDescription:\t\(error.localizedDescription)\n\n\n\nVersion:\t\(WikipediaAppUtils.versionedUserAgent())", isHTML: false)
rootVC.present(vc, animated: true, completion: nil)
} else {
self.showErrorAlertWithMessage(WMFLocalizedString("no-email-account-alert", value:"Please setup an email account on your device and try again.", comment:"Displayed to the user when they try to send a feedback email, but they have never set up an account on their device"), sticky: false, dismissPreviousAlerts: false) {

}
}
}
}

@objc public func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
controller.dismiss(animated: true, completion: nil)
}

}
4 changes: 4 additions & 0 deletions Wikipedia/Experimental-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>mailto</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
</dict>
Expand Down
4 changes: 4 additions & 0 deletions Wikipedia/Local-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>mailto</string>
</array>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>org.wikimedia.wikipedia.appRefresh</string>
Expand Down
1 change: 0 additions & 1 deletion Wikipedia/Localizations/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,6 @@
"replace-replace-all-results-count" = "{{PLURAL:$1|$1 item replaced|$1 items replaced}}";
"replace-textfield-accessibility" = "Replace";
"replace-textfield-placeholder" = "Replace with…";
"request-feedback-on-error" = "The app has encountered a problem that our developers would like to know more about. Please tap here to send us an email with the error details.";
"reverted-edit-back-to-article-button-title" = "Back to article";
"reverted-edit-notification-body" = "The edit you made of the article $1 was reverted by $2";
"reverted-edit-notification-read-more-action-title" = "Read more";
Expand Down
1 change: 0 additions & 1 deletion Wikipedia/Localizations/qqq.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,6 @@
"replace-replace-all-results-count" = "Alert view label that tells the user how many instances they just replaced via \"Replace all\". $1 is replaced with the number of instances that were replaced.";
"replace-textfield-accessibility" = "Accessibility label for the replace text field.";
"replace-textfield-placeholder" = "Placeholder text seen in replace textfield before textfield is focused.";
"request-feedback-on-error" = "Displayed to beta users when they encounter an error we'd like feedback on";
"reverted-edit-back-to-article-button-title" = "Title for button that allows the user to go back to the article they edited";
"reverted-edit-notification-body" = "Title for notification telling user that the edit they made was reverted. $1 is replaced with the title of the affected article, $2 is replaced with the username of the person who reverted the edit.";
"reverted-edit-notification-read-more-action-title" = "Title on the 'Read more' action button";
Expand Down
4 changes: 4 additions & 0 deletions Wikipedia/Staging-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>mailto</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
</dict>
Expand Down
4 changes: 4 additions & 0 deletions Wikipedia/User Testing-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>mailto</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
</dict>
Expand Down
4 changes: 4 additions & 0 deletions Wikipedia/Wikipedia-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>mailto</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
</dict>
Expand Down
Binary file modified Wikipedia/iOS Native Localizations/af.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/ar.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/ast.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/bn.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/br.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/bs.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/ca.lproj/Localizable.strings
Binary file not shown.
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/cs.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/da.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/de.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/en.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/eo.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/es.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/eu.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/fa.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/fi.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/fr.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/gl.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/he.lproj/Localizable.strings
Binary file not shown.
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/hu.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/id.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/is.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/it.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/ja.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/jv.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/kab.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/ko.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/ksh.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/lb.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/mk.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/ms.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/nb.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/nl.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/pl.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/pt-br.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/pt.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/ro.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/ru.lproj/Localizable.strings
Binary file not shown.
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/sd.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/sk.lproj/Localizable.strings
Binary file not shown.
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/sr-el.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/su.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/sv.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/tr.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/uk.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/ur.lproj/Localizable.strings
Binary file not shown.
Binary file modified Wikipedia/iOS Native Localizations/vi.lproj/Localizable.strings
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 01c1d61

Please sign in to comment.