mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 10:20:25 +01:00
Fix sticker backup import/export.
This commit is contained in:
@@ -7,10 +7,13 @@ package org.thoughtcrime.securesms.backup.v2.processor
|
||||
|
||||
import okio.ByteString.Companion.toByteString
|
||||
import org.signal.core.util.Hex
|
||||
import org.signal.core.util.insertInto
|
||||
import org.thoughtcrime.securesms.backup.v2.proto.Frame
|
||||
import org.thoughtcrime.securesms.backup.v2.proto.StickerPack
|
||||
import org.thoughtcrime.securesms.backup.v2.stream.BackupFrameEmitter
|
||||
import org.thoughtcrime.securesms.database.SQLiteDatabase
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase
|
||||
import org.thoughtcrime.securesms.database.StickerTable
|
||||
import org.thoughtcrime.securesms.database.StickerTable.StickerPackRecordReader
|
||||
import org.thoughtcrime.securesms.database.model.StickerPackRecord
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies
|
||||
@@ -31,8 +34,27 @@ object StickerBackupProcessor {
|
||||
}
|
||||
|
||||
fun import(stickerPack: StickerPack) {
|
||||
SignalDatabase.rawDatabase
|
||||
.insertInto(StickerTable.TABLE_NAME)
|
||||
.values(
|
||||
StickerTable.PACK_ID to Hex.toStringCondensed(stickerPack.packId.toByteArray()),
|
||||
StickerTable.PACK_KEY to Hex.toStringCondensed(stickerPack.packKey.toByteArray()),
|
||||
StickerTable.PACK_TITLE to "",
|
||||
StickerTable.PACK_AUTHOR to "",
|
||||
StickerTable.INSTALLED to 1,
|
||||
StickerTable.COVER to 1,
|
||||
StickerTable.EMOJI to "",
|
||||
StickerTable.CONTENT_TYPE to "",
|
||||
StickerTable.FILE_PATH to ""
|
||||
)
|
||||
.run(SQLiteDatabase.CONFLICT_IGNORE)
|
||||
|
||||
AppDependencies.jobManager.add(
|
||||
StickerPackDownloadJob.forInstall(Hex.toStringCondensed(stickerPack.packId.toByteArray()), Hex.toStringCondensed(stickerPack.packKey.toByteArray()), false)
|
||||
StickerPackDownloadJob.forInstall(
|
||||
Hex.toStringCondensed(stickerPack.packId.toByteArray()),
|
||||
Hex.toStringCondensed(stickerPack.packKey.toByteArray()),
|
||||
false
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user