Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Threema/ThreemaFramework/Message/   (Threema ©)  Datei vom 26.9.2026 mit Größe 2 kB image not shown  

SSL IDNASafetyHelper.swift   Interaktion und
PortierbarkeitJAVA

 

import CocoaLumberjackSwift
import Foundation
import ThreemaMacros
import UIKit

final class IDNASafetyHelper: NSObject {
    class func safeOpen(url: URL, viewController: UIViewController) {
        if url.isIDNASafe {
            if url.host?.lowercased() == "threema.id" {
                URLHandler().handle(url)
            }
            else {
                UIApplication.shared.open(url as URL, options: [:], completionHandler: nil)
            }
        }
        else {
            showAlert(url: url, viewController: viewController)
        }
    }
    
    class func isLegalURL(url: URL, viewController: UIViewController) -> Bool {
        guard url.isIDNASafe else {
            showAlert(url: url, viewController: viewController)
            return false
        }
        return true
    }
    
    private class func showAlert(url: URL, viewController: UIViewController) {
        let body = String.localizedStringWithFormat(
            #localize("url_warning_body"),
            url.host!.idnaDecoded!,
            url.host!
        )
        let alert = UIAlertController(
            title: #localize("url_warning_title"),
            message: body,
            preferredStyle: .alert
        )
        alert
            .addAction(UIAlertAction(
                title: #localize("ok"),
                style: .default,
                handler: { _ in
                    UIApplication.shared.open(url as URL, options: [:], completionHandler: nil)
                }
            ))
        alert
            .addAction(UIAlertAction(
                title: #localize("cancel"),
                style: .cancel,
                handler: nil
            ))
        
        viewController.present(alert, animated: true)
    }
}

Messung
CHZG
801009290

¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.0Angebot  (Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-11-24) ¤

*Bot Zugriff