Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  GroupManagerProtocol.swift   Sprache: JAVA

 

import Foundation
import ThreemaEssentials

/// Receivers of control message for group changes
public enum GroupManagerProtocolReceivers {
    /// All members
    case all
    /// A selected set of members
    case members([ThreemaIdentity])
}

public protocol GroupManagerProtocol: GroupManagerProtocolObjc {
    func createOrUpdate(
        for groupIdentity: GroupIdentity,
        members: Set<String>,
        systemMessageDate: Date
    ) async throws -> (Group, Set<String>?)
    @discardableResult func createOrUpdateDB(
        for groupIdentity: GroupIdentity,
        members: Set<String>,
        systemMessageDate: Date?,
        sourceCaller: SourceCaller
    ) async throws -> Group?
    func getConversation(for groupIdentity: GroupIdentity) -> ConversationEntity?
    func getAllActiveGroups() async -> [Group]
    func setName(groupID: Data, creator: String, name: String?, systemMessageDate: Date, send: Bool) async throws
    func setName(group: Group, name: String?, systemMessageDate: Date, send: Bool) async throws
    func setPhoto(groupID: Data, creator: String, imageData: Data, sentDate: Date, send: Bool) async throws
    func setPhoto(group: Group, imageData: Data, sentDate: Date, send: Bool) async throws
    func deletePhoto(groupID: Data, creator: String, sentDate: Date, send: Bool) async throws
    func sync(group: Group, to identities: Set<String>?, withoutCreateMessage: Bool) async throws
    func sendEmptyMemberList(groupIdentity: GroupIdentity, to identities: Set<ThreemaIdentity>)
    func periodicSyncIfNeeded(for group: Group)
}

// Define "default" arguments for certain protocol methods
extension GroupManagerProtocol {
    public func setName(groupID: Data, creator: String, name: String?, systemMessageDate: Date) async throws {
        try await setName(
            groupID: groupID,
            creator: creator,
            name: name,
            systemMessageDate: systemMessageDate,
            send: true
        )
    }
    
    public func setName(group: Group, name: String?) async throws {
        try await setName(group: group, name: name, systemMessageDate: Date(), send: true)
    }
    
    public func setPhoto(groupID: Data, creator: String, imageData: Data, sentDate: Date) async throws {
        try await setPhoto(groupID: groupID, creator: creator, imageData: imageData, sentDate: sentDate, send: true)
    }
    
    public func setPhoto(group: Group, imageData: Data, sentDate: Date) async throws {
        try await setPhoto(group: group, imageData: imageData, sentDate: sentDate, send: true)
    }
    
    public func deletePhoto(groupID: Data, creator: String, sentDate: Date) async throws {
        try await deletePhoto(groupID: groupID, creator: creator, sentDate: sentDate, send: true)
    }
    
    public func sync(group: Group) async throws {
        try await sync(group: group, to: nil, withoutCreateMessage: false)
    }
}

// Convenience functions for GroupIdentity type
extension GroupManagerProtocol {
    public func group(for groupIdentity: GroupIdentity) -> Group? {
        getGroup(groupIdentity.id, creator: groupIdentity.creator.rawValue)
    }
    
    public func leave(groupWith groupIdentity: GroupIdentity, inform receivers: GroupManagerProtocolReceivers) {
        let members: [String]? =
            switch receivers {
            case .all:
                nil
            case let .members(list):
                list.map(\.rawValue)
            }
        
        leave(groupIdentity: groupIdentity, toMembers: members)
    }
    
    public func sendSyncRequest(for groupIdentity: GroupIdentity) {
        sendSyncRequest(groupID: groupIdentity.id, creator: groupIdentity.creator.rawValue)
    }
}

@objc public protocol GroupManagerProtocolObjc {
    func createOrUpdateDBObjc(
        groupID: Data,
        creator: String,
        members: Set<String>,
        systemMessageDate: Date?,
        sourceCaller: SourceCaller
    ) async throws
    func deletePhotoObjc(
        groupID: Data,
        creator: String,
        sentDate: Date,
        send: Bool
    ) async throws
    func getGroup(_ groupID: Data, creator: String) -> Group?
    func getGroup(conversation: ConversationEntity) -> Group?
    func leave(groupID: Data, creator: String, toMembers: [String]?, systemMessageDate: Date)
    func leaveDB(groupID: Data, creator: String, member: String, systemMessageDate: Date)
    func dissolve(groupID: Data, to identities: Set<String>?)
    func setNameObjc(
        groupID: Data,
        creator: String,
        name: String?,
        systemMessageDate: Date,
        send: Bool
    ) async throws
    func setPhotoObjc(
        groupID: Data,
        creator: String,
        imageData: Data,
        sentDate: Date,
        send: Bool
    ) async throws
    func syncObjc(
        group: Group,
        to identities: Set<String>?,
        withoutCreateMessage: Bool
    ) async throws
    func sendSyncRequest(groupID: Data, creator: String, force: Bool)
}

// Define "default" arguments for certain protocol methods
extension GroupManagerProtocolObjc {
    public func leave(groupIdentity: GroupIdentity, toMembers: [String]?) {
        leave(
            groupID: groupIdentity.id,
            creator: groupIdentity.creator.rawValue,
            toMembers: toMembers,
            systemMessageDate: Date()
        )
    }

    public func dissolve(groupID: Data, to identities: Set<String>?) {
        dissolve(groupID: groupID, to: identities)
    }
    
    public func sendSyncRequest(groupID: Data, creator: String) {
        sendSyncRequest(groupID: groupID, creator: creator, force: false)
    }
}

Messung
CHZG
879310093

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

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover


Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1104852
#Domains=417148