[ios] Add default email client support to about menu #7862
No reviewers
Labels
No labels
Accessibility
Accessibility
Address
Address
Android
Android
Android Auto
Android Auto
Android Automotive (AAOS)
Android Automotive (AAOS)
API
API
AppGallery
AppGallery
AppStore
AppStore
Battery and Performance
Battery and Performance
Blocker
Blocker
Bookmarks and Tracks
Bookmarks and Tracks
Borders
Borders
Bug
Bug
Build
Build
CarPlay
CarPlay
Classificator
Classificator
Community
Community
Core
Core
CrashReports
CrashReports
Cycling
Cycling
Desktop
Desktop
DevEx
DevEx
DevOps
DevOps
dev_sandbox
dev_sandbox
Directions
Directions
Documentation
Documentation
Downloader
Downloader
Drape
Drape
Driving
Driving
Duplicate
Duplicate
Editor
Editor
Elevation
Elevation
Enhancement
Enhancement
Epic
Epic
External Map Datasets
External Map Datasets
F-Droid
F-Droid
Fonts
Fonts
Frequently User Reported
Frequently User Reported
Fund
Fund
Generator
Generator
Good first issue
Good first issue
Google Play
Google Play
GPS
GPS
GSoC
GSoC
iCloud
iCloud
Icons
Icons
iOS
iOS
Legal
Legal
Linux Desktop
Linux Desktop
Linux packaging
Linux packaging
Linux Phone
Linux Phone
Mac OS
Mac OS
Map Data
Map Data
Metro
Metro
Navigation
Navigation
Need Feedback
Need Feedback
Night Mode
Night Mode
NLnet 2024-06-281
NLnet 2024-06-281
No Feature Parity
No Feature Parity
Opening Hours
Opening Hours
Outdoors
Outdoors
POI Info
POI Info
Privacy
Privacy
Public Transport
Public Transport
Raw Idea
Raw Idea
Refactoring
Refactoring
Regional
Regional
Regression
Regression
Releases
Releases
RoboTest
RoboTest
Route Planning
Route Planning
Routing
Routing
Ruler
Ruler
Search
Search
Security
Security
Styles
Styles
Tests
Tests
Track Recording
Track Recording
Translations
Translations
TTS
TTS
UI
UI
UX
UX
Walk Navigation
Walk Navigation
Watches
Watches
Web
Web
Wikipedia
Wikipedia
Windows
Windows
Won't fix
Won't fix
World Map
World Map
No milestone
No project
No assignees
2 participants
Due date
No due date set.
Dependencies
No dependencies set.
Reference: organicmaps/organicmaps-tmp#7862
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "aboutemail"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
These changes are to add default email client support in the about menu. Issue #7758.
I tested it on my ipad 11 running 17.0.3
I would post a video but opening the email app does share some personal info
Thanks! Did you test it with other mail clients? GMail, Proton for example?
@kirylkaveryn PTAL
@ -484,0 +488,4 @@
URLQueryItem(name: "subject", value: subject),
URLQueryItem(name: "body", value: body.replacingOccurrences(of: "\n", with: "\r\n")),
]
This code doesn't work for me... I'm using Spark (

to
field):The Problem is in the
toRecipients
- it is an array of Strings. And to work as a subject it should be joined using;
.Please take a look at the code used before for opening other apps:
So you can create the same method and handle the default app using URLComponents.
Here is the hardcoded one that I've made just as a reference (needs to be refactored):
As a result:

@ -519,4 +522,3 @@
// MARK: - UIStackView + AddArrangedSubviewWithSeparator
private extension UIStackView {
func addArrangedSubviewWithSeparator(_ view: UIView) {
Maybe dont' remove MWMMailViewController?
Lets make as we discussed earlier in the issue:
if (canOpenDefaultApp) {
open default...
} else MWMMailViewController.canSendMail() {
send with internal mail controller
} else {
show error
}
@ -519,4 +522,3 @@
// MARK: - UIStackView + AddArrangedSubviewWithSeparator
private extension UIStackView {
func addArrangedSubviewWithSeparator(_ view: UIView) {
So if I'm not mistaken it will never reach the first else and execute the MWMMailViewController.canSendMail() because it will always open with the default email app, even if that is the native app. If it can't open with URL then it shouldn't be able to open with .canSendMail() and would go to the error
@ -484,0 +489,4 @@
URLQueryItem(name: "body", value: body.replacingOccurrences(of: "\n", with: "\r\n")),
]
if let url = components?.url, UIApplication.shared.canOpenURL(url) {
When does it return false?
@ -484,0 +489,4 @@
URLQueryItem(name: "body", value: body.replacingOccurrences(of: "\n", with: "\r\n")),
]
if let url = components?.url, UIApplication.shared.canOpenURL(url) {
when UIApplication.shared.canOpenURL(url) returns false or components?.url doesnt construct properly
@biodranik is there anything else needed for this?
LGTM
Did you test the else case here? Does it work?
honestly, i'm not sure of a case when it would be triggered. There will always be a default app even if its the native app. This will trigger the openDefaultApp
Then do we need to keep that old code?
i had initially removed it but @kirylkaveryn had asked that perhaps i dont. I can remove it, just let me know
@v-lozko let's remove it if you are sure that this code will never be triggered
Done, I also removed the delegate alongside it as it'll no longer be needed
Thanks! So the only case when user will see the error dialog is when no any mail client is installed, right? Does it work properly on iOS 12 too?
are you updating the name of the function on line 485 as well? I see only 510 being updated, and it would not work if we just change this line.
As a reviewer, I'm suggesting to use a more clear name of the function. It's an author's responsibility to make it work (or disagree with arguments).
Sorry, i do agree with the changes. I was thinking to sign and accept the changes from here to simplify. In any case i did update the naming
Thanks! A minor nit )
No problem, signed off and committed.