mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
mailto links now open on iOS
fixes #2036 Extends `URL` with an email address `var` for `mailto` schemes and adds a decisionHandler for `mailto` schemes on `WebViewController`. If the device cannot send mail, an alert is displayed.
This commit is contained in:
17
Shared/Extensions/URL-Extensions.swift
Normal file
17
Shared/Extensions/URL-Extensions.swift
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// URL-Extensions.swift
|
||||
// NetNewsWire
|
||||
//
|
||||
// Created by Stuart Breckenridge on 03/05/2020.
|
||||
// Copyright © 2020 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension URL {
|
||||
|
||||
/// Extracts email address from a `URL` with a `mailto` scheme, otherwise `nil`.
|
||||
var emailAddress: String? {
|
||||
scheme == "mailto" ? URLComponents(url: self, resolvingAgainstBaseURL: false)?.path : nil
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user