Skip to content

Commit dc62f0b

Browse files
committed
Add delivery receipts support to user privacy settings
1 parent 2413fe8 commit dc62f0b

File tree

4 files changed

+46
-5
lines changed

4 files changed

+46
-5
lines changed

stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/mapping/DomainMapping.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package io.getstream.chat.android.client.api2.mapping
1818

19+
import io.getstream.chat.android.DeliveryReceipts
1920
import io.getstream.chat.android.PrivacySettings
2021
import io.getstream.chat.android.ReadReceipts
2122
import io.getstream.chat.android.TypingIndicators
@@ -675,6 +676,7 @@ internal class DomainMapping(
675676
*/
676677
internal fun PrivacySettingsDto.toDomain(): PrivacySettings = PrivacySettings(
677678
typingIndicators = typing_indicators?.toDomain(),
679+
deliveryReceipts = delivery_receipts?.toDomain(),
678680
readReceipts = read_receipts?.toDomain(),
679681
)
680682

@@ -685,6 +687,11 @@ internal class DomainMapping(
685687
enabled = enabled,
686688
)
687689

690+
/**
691+
* Transforms [DeliveryReceiptsDto] to [DeliveryReceipts].
692+
*/
693+
internal fun DeliveryReceiptsDto.toDomain() = DeliveryReceipts(enabled = enabled)
694+
688695
/**
689696
* Transforms [ReadReceiptsDto] to [ReadReceipts].
690697
*/

stream-chat-android-client/src/main/java/io/getstream/chat/android/client/api2/model/dto/PrivacySettings.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import com.squareup.moshi.JsonClass
2121
@JsonClass(generateAdapter = true)
2222
internal data class PrivacySettingsDto(
2323
val typing_indicators: TypingIndicatorsDto? = null,
24+
val delivery_receipts: DeliveryReceiptsDto? = null,
2425
val read_receipts: ReadReceiptsDto? = null,
2526
)
2627

@@ -29,6 +30,11 @@ internal data class TypingIndicatorsDto(
2930
val enabled: Boolean,
3031
)
3132

33+
@JsonClass(generateAdapter = true)
34+
internal data class DeliveryReceiptsDto(
35+
val enabled: Boolean,
36+
)
37+
3238
@JsonClass(generateAdapter = true)
3339
internal data class ReadReceiptsDto(
3440
val enabled: Boolean,

stream-chat-android-core/api/stream-chat-android-core.api

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
1+
public final class io/getstream/chat/android/DeliveryReceipts {
2+
public fun <init> ()V
3+
public fun <init> (Z)V
4+
public synthetic fun <init> (ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
5+
public final fun component1 ()Z
6+
public final fun copy (Z)Lio/getstream/chat/android/DeliveryReceipts;
7+
public static synthetic fun copy$default (Lio/getstream/chat/android/DeliveryReceipts;ZILjava/lang/Object;)Lio/getstream/chat/android/DeliveryReceipts;
8+
public fun equals (Ljava/lang/Object;)Z
9+
public final fun getEnabled ()Z
10+
public fun hashCode ()I
11+
public fun toString ()Ljava/lang/String;
12+
}
13+
114
public final class io/getstream/chat/android/PrivacySettings {
215
public fun <init> ()V
3-
public fun <init> (Lio/getstream/chat/android/TypingIndicators;Lio/getstream/chat/android/ReadReceipts;)V
4-
public synthetic fun <init> (Lio/getstream/chat/android/TypingIndicators;Lio/getstream/chat/android/ReadReceipts;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
16+
public fun <init> (Lio/getstream/chat/android/TypingIndicators;Lio/getstream/chat/android/DeliveryReceipts;Lio/getstream/chat/android/ReadReceipts;)V
17+
public synthetic fun <init> (Lio/getstream/chat/android/TypingIndicators;Lio/getstream/chat/android/DeliveryReceipts;Lio/getstream/chat/android/ReadReceipts;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
518
public final fun component1 ()Lio/getstream/chat/android/TypingIndicators;
6-
public final fun component2 ()Lio/getstream/chat/android/ReadReceipts;
7-
public final fun copy (Lio/getstream/chat/android/TypingIndicators;Lio/getstream/chat/android/ReadReceipts;)Lio/getstream/chat/android/PrivacySettings;
8-
public static synthetic fun copy$default (Lio/getstream/chat/android/PrivacySettings;Lio/getstream/chat/android/TypingIndicators;Lio/getstream/chat/android/ReadReceipts;ILjava/lang/Object;)Lio/getstream/chat/android/PrivacySettings;
19+
public final fun component2 ()Lio/getstream/chat/android/DeliveryReceipts;
20+
public final fun component3 ()Lio/getstream/chat/android/ReadReceipts;
21+
public final fun copy (Lio/getstream/chat/android/TypingIndicators;Lio/getstream/chat/android/DeliveryReceipts;Lio/getstream/chat/android/ReadReceipts;)Lio/getstream/chat/android/PrivacySettings;
22+
public static synthetic fun copy$default (Lio/getstream/chat/android/PrivacySettings;Lio/getstream/chat/android/TypingIndicators;Lio/getstream/chat/android/DeliveryReceipts;Lio/getstream/chat/android/ReadReceipts;ILjava/lang/Object;)Lio/getstream/chat/android/PrivacySettings;
923
public fun equals (Ljava/lang/Object;)Z
24+
public final fun getDeliveryReceipts ()Lio/getstream/chat/android/DeliveryReceipts;
1025
public final fun getReadReceipts ()Lio/getstream/chat/android/ReadReceipts;
1126
public final fun getTypingIndicators ()Lio/getstream/chat/android/TypingIndicators;
1227
public fun hashCode ()I

stream-chat-android-core/src/main/java/io/getstream/chat/android/PrivacySettings.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ import androidx.compose.runtime.Immutable
2222
* Represents the privacy settings of a user.
2323
*
2424
* @param typingIndicators Typing indicators settings.
25+
* @param deliveryReceipts Delivery receipts settings.
2526
* @param readReceipts Read receipts settings.
2627
*/
2728
@Immutable
2829
public data class PrivacySettings(
2930
public val typingIndicators: TypingIndicators? = null,
31+
public val deliveryReceipts: DeliveryReceipts? = null,
3032
public val readReceipts: ReadReceipts? = null,
3133
)
3234

@@ -41,6 +43,17 @@ public data class TypingIndicators(
4143
val enabled: Boolean = true,
4244
)
4345

46+
/**
47+
* Represents the delivery receipts settings.
48+
* If false, the user delivery events will not be sent to other users, along with the user's delivery state.
49+
*
50+
* @param enabled Whether delivery receipts are enabled or not.
51+
*/
52+
@Immutable
53+
public data class DeliveryReceipts(
54+
val enabled: Boolean = true,
55+
)
56+
4457
/**
4558
* Represents the read receipts settings.
4659
* If false, the user read events will not be sent to other users, along with the user's read state.

0 commit comments

Comments
 (0)