Skip to content

Commit

Permalink
[i239] Support skipPush flag in add/remove members
Browse files Browse the repository at this point in the history
  • Loading branch information
kanat authored and JcMinarro committed Jan 23, 2024
1 parent d81d88a commit 81da926
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 9 deletions.
12 changes: 6 additions & 6 deletions stream-chat-android-client/api/stream-chat-android-client.api
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public final class io/getstream/chat/android/client/ChatClient {
public static final field DEFAULT_SORT Lio/getstream/chat/android/models/querysort/QuerySorter;
public final fun acceptInvite (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lio/getstream/result/call/Call;
public final fun addDevice (Lio/getstream/chat/android/models/Device;)Lio/getstream/result/call/Call;
public final fun addMembers (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Lio/getstream/chat/android/models/Message;Ljava/lang/Boolean;)Lio/getstream/result/call/Call;
public static synthetic fun addMembers$default (Lio/getstream/chat/android/client/ChatClient;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Lio/getstream/chat/android/models/Message;Ljava/lang/Boolean;ILjava/lang/Object;)Lio/getstream/result/call/Call;
public final fun addMembers (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Lio/getstream/chat/android/models/Message;Ljava/lang/Boolean;Ljava/lang/Boolean;)Lio/getstream/result/call/Call;
public static synthetic fun addMembers$default (Lio/getstream/chat/android/client/ChatClient;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Lio/getstream/chat/android/models/Message;Ljava/lang/Boolean;Ljava/lang/Boolean;ILjava/lang/Object;)Lio/getstream/result/call/Call;
public final fun addSocketListener (Lio/getstream/chat/android/client/socket/SocketListener;)V
public final fun appSettings ()Lio/getstream/result/call/Call;
public final fun banUser (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;)Lio/getstream/result/call/Call;
Expand Down Expand Up @@ -77,8 +77,8 @@ public final class io/getstream/chat/android/client/ChatClient {
public final fun hideChannel (Ljava/lang/String;Ljava/lang/String;Z)Lio/getstream/result/call/Call;
public static synthetic fun hideChannel$default (Lio/getstream/chat/android/client/ChatClient;Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Lio/getstream/result/call/Call;
public static final fun instance ()Lio/getstream/chat/android/client/ChatClient;
public final fun inviteMembers (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Lio/getstream/chat/android/models/Message;)Lio/getstream/result/call/Call;
public static synthetic fun inviteMembers$default (Lio/getstream/chat/android/client/ChatClient;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Lio/getstream/chat/android/models/Message;ILjava/lang/Object;)Lio/getstream/result/call/Call;
public final fun inviteMembers (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Lio/getstream/chat/android/models/Message;Ljava/lang/Boolean;)Lio/getstream/result/call/Call;
public static synthetic fun inviteMembers$default (Lio/getstream/chat/android/client/ChatClient;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Lio/getstream/chat/android/models/Message;Ljava/lang/Boolean;ILjava/lang/Object;)Lio/getstream/result/call/Call;
public final fun isSocketConnected ()Z
public final fun keystroke (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lio/getstream/result/call/Call;
public static synthetic fun keystroke$default (Lio/getstream/chat/android/client/ChatClient;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lio/getstream/result/call/Call;
Expand Down Expand Up @@ -117,8 +117,8 @@ public final class io/getstream/chat/android/client/ChatClient {
public final fun queryUsers (Lio/getstream/chat/android/client/api/models/QueryUsersRequest;)Lio/getstream/result/call/Call;
public final fun reconnectSocket ()Lio/getstream/result/call/Call;
public final fun rejectInvite (Ljava/lang/String;Ljava/lang/String;)Lio/getstream/result/call/Call;
public final fun removeMembers (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Lio/getstream/chat/android/models/Message;)Lio/getstream/result/call/Call;
public static synthetic fun removeMembers$default (Lio/getstream/chat/android/client/ChatClient;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Lio/getstream/chat/android/models/Message;ILjava/lang/Object;)Lio/getstream/result/call/Call;
public final fun removeMembers (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Lio/getstream/chat/android/models/Message;Ljava/lang/Boolean;)Lio/getstream/result/call/Call;
public static synthetic fun removeMembers$default (Lio/getstream/chat/android/client/ChatClient;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Lio/getstream/chat/android/models/Message;Ljava/lang/Boolean;ILjava/lang/Object;)Lio/getstream/result/call/Call;
public final fun removeShadowBan (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lio/getstream/result/call/Call;
public final fun removeSocketListener (Lio/getstream/chat/android/client/socket/SocketListener;)V
public final fun searchMessages (Lio/getstream/chat/android/models/FilterObject;Lio/getstream/chat/android/models/FilterObject;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;Lio/getstream/chat/android/models/querysort/QuerySorter;)Lio/getstream/result/call/Call;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2308,6 +2308,7 @@ internal constructor(
* @param memberIds The list of the member ids to be added.
* @param systemMessage The system message that will be shown in the channel.
* @param hideHistory Hides the history of the channel to the added member.
* @param skipPush If true, skips sending push notifications.
*
* @return Executable async [Call] responsible for adding the members.
*/
Expand All @@ -2318,13 +2319,15 @@ internal constructor(
memberIds: List<String>,
systemMessage: Message? = null,
hideHistory: Boolean? = null,
skipPush: Boolean? = null,
): Call<Channel> {
return api.addMembers(
channelType,
channelId,
memberIds,
systemMessage,
hideHistory,
skipPush,
)
}

Expand All @@ -2335,6 +2338,7 @@ internal constructor(
* @param channelId The channel id. ie 123.
* @param memberIds The list of the member ids to be removed.
* @param systemMessage The system message that will be shown in the channel.
* @param skipPush If true, skips sending push notifications.
*
* @return Executable async [Call] responsible for removing the members.
*/
Expand All @@ -2344,11 +2348,13 @@ internal constructor(
channelId: String,
memberIds: List<String>,
systemMessage: Message? = null,
skipPush: Boolean? = null,
): Call<Channel> = api.removeMembers(
channelType,
channelId,
memberIds,
systemMessage,
skipPush,
)

/**
Expand All @@ -2358,6 +2364,7 @@ internal constructor(
* @param channelId The channel id. ie 123.
* @param memberIds The list of the member ids to be invited.
* @param systemMessage The system message that will be shown in the channel.
* @param skipPush If true, skips sending push notifications.
*
* @return Executable async [Call] responsible for inviting the members.
*/
Expand All @@ -2367,11 +2374,13 @@ internal constructor(
channelId: String,
memberIds: List<String>,
systemMessage: Message? = null,
skipPush: Boolean? = null,
): Call<Channel> = api.inviteMembers(
channelType,
channelId,
memberIds,
systemMessage,
skipPush,
)

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ internal interface ChatApi {
members: List<String>,
systemMessage: Message?,
hideHistory: Boolean?,
skipPush: Boolean?,
): Call<Channel>

@CheckResult
Expand All @@ -318,6 +319,7 @@ internal interface ChatApi {
channelId: String,
members: List<String>,
systemMessage: Message?,
skipPush: Boolean?,
): Call<Channel>

@CheckResult
Expand All @@ -326,6 +328,7 @@ internal interface ChatApi {
channelId: String,
members: List<String>,
systemMessage: Message?,
skipPush: Boolean?,
): Call<Channel>

@CheckResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,11 +674,12 @@ constructor(
members: List<String>,
systemMessage: Message?,
hideHistory: Boolean?,
skipPush: Boolean?,
): Call<Channel> {
return channelApi.addMembers(
channelType = channelType,
channelId = channelId,
body = AddMembersRequest(members, systemMessage?.toDto(), hideHistory),
body = AddMembersRequest(members, systemMessage?.toDto(), hideHistory, skipPush),
).map(this::flattenChannel)
}

Expand All @@ -687,11 +688,12 @@ constructor(
channelId: String,
members: List<String>,
systemMessage: Message?,
skipPush: Boolean?,
): Call<Channel> {
return channelApi.removeMembers(
channelType = channelType,
channelId = channelId,
body = RemoveMembersRequest(members, systemMessage?.toDto()),
body = RemoveMembersRequest(members, systemMessage?.toDto(), skipPush),
).map(this::flattenChannel)
}

Expand All @@ -700,11 +702,12 @@ constructor(
channelId: String,
members: List<String>,
systemMessage: Message?,
skipPush: Boolean?,
): Call<Channel> {
return channelApi.inviteMembers(
channelType = channelType,
channelId = channelId,
body = InviteMembersRequest(members, systemMessage?.toDto()),
body = InviteMembersRequest(members, systemMessage?.toDto(), skipPush),
).map(this::flattenChannel)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ internal data class AddMembersRequest(
val add_members: List<String>,
val message: UpstreamMessageDto?,
val hide_history: Boolean?,
val skip_push: Boolean?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ import io.getstream.chat.android.client.api2.model.dto.UpstreamMessageDto
internal data class InviteMembersRequest(
val invites: List<String>,
val message: UpstreamMessageDto?,
val skip_push: Boolean?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ import io.getstream.chat.android.client.api2.model.dto.UpstreamMessageDto
internal data class RemoveMembersRequest(
val remove_members: List<String>,
val message: UpstreamMessageDto?,
val skip_push: Boolean?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ internal class UsersApiCallsTests {
mock.channelId,
listOf("a-id", "b-id"),
null,
null,
),
).thenReturn(RetroSuccess(channel).toRetrofitCall())

Expand Down

0 comments on commit 81da926

Please sign in to comment.