mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Rewrite in-app-payment flows to prepare for backups support.
This commit is contained in:
committed by
Cody Henthorne
parent
b36b00a11c
commit
d719edf104
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2024 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.thoughtcrime.securesms.util.parcelers
|
||||
|
||||
import android.os.Parcel
|
||||
import kotlinx.parcelize.Parceler
|
||||
import kotlin.time.Duration
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
/**
|
||||
* Parceler for non-null durations, storing them in milliseconds.
|
||||
*/
|
||||
object MillisecondDurationParceler : Parceler<Duration> {
|
||||
override fun create(parcel: Parcel): Duration {
|
||||
return parcel.readLong().milliseconds
|
||||
}
|
||||
|
||||
override fun Duration.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeLong(inWholeMilliseconds)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2024 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.thoughtcrime.securesms.util.parcelers
|
||||
|
||||
import android.os.Parcel
|
||||
import kotlinx.parcelize.Parceler
|
||||
import org.whispersystems.signalservice.api.subscriptions.SubscriberId
|
||||
|
||||
/**
|
||||
* Parceler for nullable SubscriberIds
|
||||
*/
|
||||
object NullableSubscriberIdParceler : Parceler<SubscriberId?> {
|
||||
override fun create(parcel: Parcel): SubscriberId? {
|
||||
return parcel.readString()?.let { SubscriberId.deserialize(it) }
|
||||
}
|
||||
|
||||
override fun SubscriberId?.write(parcel: Parcel, flags: Int) {
|
||||
parcel.writeString(this?.serialize())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user