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

Quelle  ShortcutItemProvider.swift   Sprache: JAVA

 

import Foundation
import ThreemaMacros

/// Provides list of available shortcut items
///
/// To add a new shortcut item:
/// 1. Add a new case to the `ActionType` enum
/// 2. Add the new case to the `items(for:)` method
enum UIApplicationShortcutItemProvider {
    
    enum ActionType {
        case newMessage
        case myID
        case scanQrCode
        
        var localizedTitle: String {
            switch self {
            case .newMessage:
                #localize("application_shortcut_item_new_message")
            case .myID:
                #localize("application_shortcut_item_my_id")
            case .scanQrCode:
                #localize("scan_qr_code_sentence")
            }
        }
      
        var icon: String {
            switch self {
            case .newMessage:
                "square.and.pencil"
            case .myID:
                "person.crop.rectangle.fill"
            case .scanQrCode:
                "qrcode.viewfinder"
            }
        }
        
        var type: String {
            switch self {
            case .newMessage:
                "ch.threema.newmessage"
            case .myID:
                "ch.threema.myid"
            case .scanQrCode:
                "ch.threema.scanid"
            }
        }
        
        var item: UIApplicationShortcutItem {
            .init(
                type: type,
                localizedTitle: localizedTitle,
                localizedSubtitle: nil,
                icon: UIApplicationShortcutIcon(systemImageName: icon)
            )
        }
    }
    
    /// This method will return an array of shortcut items that are displayed on the home screen.
    ///
    /// - Parameter mdm: used for dynamic shortcut items
    /// - Returns: an array of shortcut items
    static func items(for mdm: MDMSetup) -> [UIApplicationShortcutItem] {
        var items: [ActionType] = [.newMessage, .myID]

        if !mdm.disableAddContact() {
            items.append(.scanQrCode)
        }
        
        return items.map(\.item)
    }
}

Messung
CHZG
90979493

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet am  2026-11-24) ¤

*© Formatika GbR, Deutschland