Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Mizar/mml/   (Mizar Prover Version 8.1.15©)  Datei vom 6.10.2026 mit Größe 121 kB image not shown  

Quelle  ThreemaURLProvider.swift   Sprache: JAVA

 

import Foundation

/// Use this class to get your URL to threema.com or threema.com/work
public enum ThreemaURLProvider {
    
    private static let defaultURLString = "https://threema.com/"
    
    // Consumer
    public static let rogueDeviceInfo =
        URL(string: defaultURLString + "/faq/another_connection")!
    public static let resetSafePassword = URL(string: defaultURLString + "faq/safepw")!
    public static let consumerDownload = URL(string: defaultURLString + "download")!
    public static let privacyPolicy = URL(string: defaultURLString + "privacy_policy")!
    public static let termsOfService = URL(string: defaultURLString + "tos")!
    public static let multiDeviceReset = URL(string: defaultURLString + "faq/md_reset")!
    public static let multiDeviceLimit = URL(string: defaultURLString + "faq/md_limit")!
    public static let iOSBackupManualEN =
        URL(string: defaultURLString + "docs/threema/ios_backup_manual_en.pdf")!
    public static let safeWebdav = URL(string: defaultURLString + "faq/threema_safe_webdav")!
    public static let flavorInfoWork =
        URL(string: defaultURLString + "products/work?mtm_campaign=introduction-work-promo&mtm_kwd=ios"span>)
    public static let flavorInfoOnPrem =
        URL(string: defaultURLString + "products/onprem?mtm_campaign=introduction-onprem-promo&mtm_kwd=ios")
    public static let backupFAQ = URL(string: defaultURLString + "faq/backup-options")!
    public static let notificationTypesFAQ = URL(string: defaultURLString + "faq/ios-notification-types")!
    public static let interactionFAQ = URL(string: defaultURLString + "faq/ios-interactions")!
    public static let thisDeviceOnlyFAQ = URL(string: defaultURLString + "faq/quickstart")!
        
    // Work
    public static let workDownload = URL(string: defaultURLString + "/work/download")!
    public static let workInfo = URL(string: defaultURLString + "work_info")!
    public static let privateDownloadAppStore: URL? = URL(string: "itms-apps://itunes.apple.com/app/id578665578")
    public static let workReferralInviteURL =
        URL(
            string: "
https://threema.com/threema-work-invitation?referral=" + BusinessInjector.ui.profileStore.profile
                .myIdentity.rawValue
        )!
    public static let workReferralToSURL = URL(string: "https://threema.com/referral-tos")!
    
    private static let supportFAQURL = URL(string: defaultURLString + "
ios/support")!
    private static let deviceJoinDownloadPrivateString = "
https://three.ma/md"
    private static let deviceJoinDownloadWorkString = "https://three.ma/mdw"
    private static let deviceJoinDownloadOnPremString = "https://three.ma/mdo"
    
    public static let supportFAQ: URL? = {
        switch TargetManager.current {
        case .threema, .green:
            return supportFAQURL
            
        case .work, .blue, .onPrem:
            guard let licenseURL = BusinessInjector.ui.myIdentityStore.licenseSupportURL,
                  let url = URL(string: licenseURL),
                  !licenseURL.isEmpty else {
                return supportFAQURL
            }
            
            return url
            
        case .customOnPrem:
            if let presetSupportFAQ = BundleUtil.object(forInfoDictionaryKey: "SupportFAQURL") as? String,
               !presetSupportFAQ.isEmpty,
               let presetSupportFAQURL = URL(string: presetSupportFAQ) {
                return presetSupportFAQURL
            }
            
            guard let licenseURL = BusinessInjector.ui.myIdentityStore.licenseSupportURL,
                  let url = URL(string: licenseURL),
                  !licenseURL.isEmpty else {
                return nil
            }
            
            return url
        }
    }()
    
    /// Support page for private users, in the app's language with an English fallback
    public static var privateSupport: URL {
        privateSupport(for: Bundle.main.preferredLocalizations.first)
    }

    /// Support page for private users in the language closest to the provided one
    /// - Parameter languageTag: BCP-47 language tag, e.g. `de-CH`, `gsw-CH` or `pt-BR`
    static func privateSupport(for languageTag: String?) -> URL {
        URL(string: defaultURLString + supportPageLanguage(for: languageTag) + "/support/private")!
    }

    /// Language of the support page closest to the provided language, `en` if there is none
    private static func supportPageLanguage(for languageTag: String?) -> String {
        let languageCode = languageTag
            .flatMap { Locale(identifier: $0).language.languageCode?.identifier } ?? "en"

        return switch languageCode {
        case "de", "gsw", "rm": "de"
        case "fr": "fr"
        case "es", "ca", "gl": "es"
        default: "en"
        }
    }

    public static let deviceJoinDownloadString = {
        switch TargetManager.current {
        case .threema, .green:
            return deviceJoinDownloadPrivateString
        case .work, .blue:
            return deviceJoinDownloadWorkString
        case .onPrem:
            return deviceJoinDownloadOnPremString
        case .customOnPrem:
            guard let predefinedDeviceJoinDownloadString = BundleUtil
                .object(forInfoDictionaryKey: "DeviceJoinDownloadURL") as? String,
                !predefinedDeviceJoinDownloadString.isEmpty else {
                return "URL is missing"
            }
            
            return predefinedDeviceJoinDownloadString
        }
    }
}

/// Use this class to get your URL to threema.com or threema.com/work
///
/// - returns: URL
@available(swift, obsoleted: 1.0, renamed: "ThreemaURLProvider", message: "Only use from Objective-C")
public final class ThreemaURLProviderObjC: NSObject {
    @objc public enum ThreemaURLProviderType: Int, RawRepresentable {
        case rogueDeviceInfo
        case multiDeviceReset
        case privacyPolicy
    }
    
    @objc public class func getURL(_ threemaURLProvider: ThreemaURLProviderType) -> URL {
        switch threemaURLProvider {
        case .rogueDeviceInfo:
            ThreemaURLProvider.rogueDeviceInfo
        case .multiDeviceReset:
            ThreemaURLProvider.multiDeviceReset
        case .privacyPolicy:
            ThreemaURLProvider.privacyPolicy
        }
    }
}

Messung
CHZG
89979292

¤ Dauer der Verarbeitung: 0.2 Sekunden  (vorverarbeitet am  2026-11-23) ¤

*© Formatika GbR, Deutschland