Skip to content
Snippets Groups Projects
  • Pierre Nicolas's avatar
    a5898bcf
    cleanup: remove author from copyright · a5898bcf
    Pierre Nicolas authored
    - Meaningless: lot of people work on files, so there is no one author
    - Outdated: nobody append their name while working on files
    - History is already managed by git
    - ...
    
    Change-Id: Id383a19aab5aea191bfa91a52adbb6371b53d084
    a5898bcf
    History
    cleanup: remove author from copyright
    Pierre Nicolas authored
    - Meaningless: lot of people work on files, so there is no one author
    - Outdated: nobody append their name while working on files
    - History is already managed by git
    - ...
    
    Change-Id: Id383a19aab5aea191bfa91a52adbb6371b53d084
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
VCardService.kt 2.00 KiB
/*
 *  Copyright (C) 2004-2023 Savoir-faire Linux Inc.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
package net.jami.services

import ezvcard.VCard
import io.reactivex.rxjava3.core.Maybe
import io.reactivex.rxjava3.core.Observable
import io.reactivex.rxjava3.core.Single
import net.jami.model.Account
import net.jami.model.Profile
import java.io.File

abstract class VCardService {
    abstract fun loadProfile(account: Account): Observable<Profile>
    abstract fun loadSmallVCard(accountId: String, maxSize: Int): Maybe<VCard>
    fun loadSmallVCardWithDefault(accountId: String, maxSize: Int): Single<VCard> {
        return loadSmallVCard(accountId, maxSize)
            .switchIfEmpty(Single.fromCallable { VCard() })
    }

    abstract fun saveVCardProfile(accountId: String, uri: String?, displayName: String?, picture: String?): Single<VCard>

    abstract fun loadVCardProfile(vcard: VCard): Single<Profile>
    abstract fun peerProfileReceived(accountId: String, peerId: String, vcard: File): Single<Profile>
    abstract fun loadConversationProfile(info: Map<String, String>): Single<Profile>
    abstract fun accountProfileReceived(accountId: String, vcardFile: File): Single<Profile>
    abstract fun base64ToBitmap(base64: String?): Any?

    companion object {
        const val MAX_SIZE_SIP = 256 * 1024
        const val MAX_SIZE_REQUEST = 16 * 1024
    }
}