Skip to content

Commit ffa1de6

Browse files
authored
release 4.1.0 (#12)
1 parent 9da92c1 commit ffa1de6

File tree

51 files changed

+479
-14
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+479
-14
lines changed

CHANGELOG.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
# Change Log
22

3-
## 4.0.1 (Nov 4, 2024)
3+
## 4.1.0 (Nov 29, 2024)
44
### Features
5+
- Added `SetPushTriggerOption` to `SendbirdChatClient`
6+
- Added `GetPushTriggerOption` to `SendbirdChatClient`
7+
- Added `SetMyPushTriggerOption` to `SbGroupChannel`
8+
- Added `GetMyPushTriggerOption` to `SbGroupChannel`
9+
- Added `SbPushTriggerOption`
10+
### Bug Fixes
11+
- Fixed an issue with `SendbirdChat.BlockUser` where 'User not found error' occurs due to URL encoding
12+
13+
## 4.0.1 (Nov 4, 2024)
14+
### Bug Fixes
515
- Fixed an issue where build failed on the Windows platform
616

717
## 4.0.0 (Sep 25, 2024)
@@ -19,7 +29,7 @@
1929
- Added support for .NET 4.x
2030

2131
## 4.0.0-beta.1 (Sep 15, 2023)
22-
### Improvements
32+
### Bug Fixes
2333
- Fixed the bug regarding the URL encoding
2434

2535
## 4.0.0-beta (Aug 25, 2023)
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
//
2+
// Copyright (c) 2024 Sendbird, Inc.
3+
//
4+
5+
namespace Sendbird.Chat
6+
{
7+
public partial class SbGroupChannel
8+
{
9+
private void GetMyPushTriggerOptionInternal(SbGroupChannelGetMyPushTriggerOptionHandler inCompletionHandler)
10+
{
11+
if (inCompletionHandler == null)
12+
return;
13+
14+
void OnCompletionHandler(ApiCommandAbstract.Response inResponse, SbError inError, bool inIsCanceled)
15+
{
16+
if (inResponse is GetMyPushTriggerOptionApiCommand.Response response)
17+
{
18+
inCompletionHandler.Invoke(response.GroupChannelPushTriggerOption, inError);
19+
return;
20+
}
21+
22+
inCompletionHandler.Invoke(inMyPushTriggerOption: null, inError);
23+
}
24+
25+
GetMyPushTriggerOptionApiCommand.Request apiCommand = new GetMyPushTriggerOptionApiCommand.Request(
26+
chatMainContextRef.CurrentUserId, Url, OnCompletionHandler);
27+
28+
chatMainContextRef.CommandRouter.RequestApiCommand(apiCommand);
29+
}
30+
31+
private void SetMyPushTriggerOptionInternal(SbGroupChannelPushTriggerOption inGroupChannelPushTriggerOption, SbErrorHandler inCompletionHandler)
32+
{
33+
if (inCompletionHandler == null)
34+
return;
35+
36+
void OnCompletionHandler(ApiCommandAbstract.Response inResponse, SbError inError, bool inIsCanceled)
37+
{
38+
if (inResponse is SetMyPushTriggerOptionApiCommand.Response response)
39+
{
40+
_myPushTriggerOption = response.GroupChannelPushTriggerOption;
41+
}
42+
43+
inCompletionHandler.Invoke(inError);
44+
}
45+
46+
SetMyPushTriggerOptionApiCommand.Request apiCommand = new SetMyPushTriggerOptionApiCommand.Request(
47+
chatMainContextRef.CurrentUserId, Url, inGroupChannelPushTriggerOption, OnCompletionHandler);
48+
49+
chatMainContextRef.CommandRouter.RequestApiCommand(apiCommand);
50+
}
51+
}
52+
}

Runtime/Scripts/Internal/ChatClient/Channel/BaseChannelExtends/GroupChannel/SbGroupChannel+MyPushTriggerOption.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//
2+
// Copyright (c) 2023 Sendbird, Inc.
3+
//
4+
5+
using System;
6+
7+
namespace Sendbird.Chat
8+
{
9+
internal static class SbPushTriggerOptionExtension
10+
{
11+
private static int _enumCount = 0;
12+
13+
internal static SbPushTriggerOption? JsonNameToType(string inJsonName)
14+
{
15+
if (string.IsNullOrEmpty(inJsonName) == false)
16+
{
17+
if (_enumCount <= 0)
18+
_enumCount = Enum.GetValues(typeof(SbPushTriggerOption)).Length;
19+
20+
for (SbPushTriggerOption enumType = 0; enumType < (SbPushTriggerOption)_enumCount; enumType++)
21+
{
22+
if (enumType.ToJsonName().Equals(inJsonName, StringComparison.OrdinalIgnoreCase))
23+
return enumType;
24+
}
25+
26+
Logger.Warning(Logger.CategoryType.Command, $"SbPushTriggerOption::ToJsonName Invalid type name:{inJsonName}");
27+
}
28+
29+
return null;
30+
}
31+
}
32+
}

Runtime/Scripts/Internal/ChatClient/SbGroupChannelPushTriggerOptionExtension.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Runtime/Scripts/Internal/ChatClient/SendbirdChatMain/SendbirdChatMain+Push.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,43 @@ internal void GetDoNotDisturb(SbDoNotDisturbHandler inCompletionHandler)
5555
{
5656
ChatMainContext.PushManager.GetDoNotDisturb(inCompletionHandler);
5757
}
58+
59+
internal void GetPushTriggerOption(SbPushTriggerOptionHandler inCompletionHandler)
60+
{
61+
if (inCompletionHandler == null)
62+
return;
63+
64+
void OnCompletionHandler(ApiCommandAbstract.Response inResponse, SbError inError, bool inIsCanceled)
65+
{
66+
if (inResponse is GetPushTriggerOptionApiCommand.Response response)
67+
{
68+
inCompletionHandler.Invoke(response.GroupChannelPushTriggerOptionNullable, inError);
69+
return;
70+
}
71+
72+
inCompletionHandler.Invoke(inPushTriggerOption: null, inError);
73+
}
74+
75+
GetPushTriggerOptionApiCommand.Request apiCommand = new GetPushTriggerOptionApiCommand.Request(
76+
ChatMainContext.CurrentUserId, OnCompletionHandler);
77+
78+
ChatMainContext.CommandRouter.RequestApiCommand(apiCommand);
79+
}
80+
81+
internal void SetPushTriggerOption(SbPushTriggerOption inPushTriggerOption, SbErrorHandler inCompletionHandler)
82+
{
83+
if (inCompletionHandler == null)
84+
return;
85+
86+
void OnCompletionHandler(ApiCommandAbstract.Response inResponse, SbError inError, bool inIsCanceled)
87+
{
88+
inCompletionHandler.Invoke(inError);
89+
}
90+
91+
SetPushTriggerOptionApiCommand.Request apiCommand = new SetPushTriggerOptionApiCommand.Request(
92+
ChatMainContext.CurrentUserId, inPushTriggerOption, OnCompletionHandler);
93+
94+
ChatMainContext.CommandRouter.RequestApiCommand(apiCommand);
95+
}
5896
}
5997
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// Copyright (c) 2022 Sendbird, Inc.
3+
//
4+
5+
using System;
6+
using System.Net;
7+
using Newtonsoft.Json;
8+
9+
namespace Sendbird.Chat
10+
{
11+
internal sealed class GetMyPushTriggerOptionApiCommand
12+
{
13+
internal sealed class Request : ApiCommandAbstract.GetRequest
14+
{
15+
internal Request(string inUserId, string inChannelUrl, ResultHandler inResultHandler)
16+
{
17+
string encodedUserId = WebUtility.UrlEncode(inUserId);
18+
string encodedChannelUrl = WebUtility.UrlEncode(inChannelUrl);
19+
Url = $"{USERS_PREFIX_URL}/{encodedUserId}/push_preference/{encodedChannelUrl}";
20+
ResponseType = typeof(Response);
21+
resultHandler = inResultHandler;
22+
}
23+
}
24+
25+
[Serializable]
26+
internal sealed class Response : ApiCommandAbstract.Response
27+
{
28+
[JsonProperty("push_trigger_option")] internal readonly string pushTriggerOption;
29+
30+
internal SbGroupChannelPushTriggerOption? GroupChannelPushTriggerOption { get; private set; } = null;
31+
32+
internal override void OnResponseAfterDeserialize(string inJsonString)
33+
{
34+
if (string.IsNullOrEmpty(pushTriggerOption) == false)
35+
{
36+
GroupChannelPushTriggerOption = SbGroupChannelPushTriggerOptionExtension.JsonNameToType(pushTriggerOption);
37+
}
38+
}
39+
}
40+
}
41+
}

Runtime/Scripts/Internal/Command/ApiCommand/ApiCommandExtends/Channel/GroupChannel/GetMyPushTriggerOptionApiCommand.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
//
2+
// Copyright (c) 2022 Sendbird, Inc.
3+
//
4+
5+
using System;
6+
using System.Net;
7+
using Newtonsoft.Json;
8+
9+
namespace Sendbird.Chat
10+
{
11+
internal sealed class SetMyPushTriggerOptionApiCommand
12+
{
13+
internal sealed class Request : ApiCommandAbstract.PutRequest
14+
{
15+
[Serializable]
16+
private struct Payload
17+
{
18+
#pragma warning disable CS0649
19+
[JsonProperty("push_trigger_option")] internal string pushTriggerOption;
20+
#pragma warning restore CS0649
21+
}
22+
23+
internal Request(string inUserId, string inChannelUrl, SbGroupChannelPushTriggerOption inGroupChannelPushTriggerOption, ResultHandler inResultHandler)
24+
{
25+
string encodedUserId = WebUtility.UrlEncode(inUserId);
26+
string encodedChannelUrl = WebUtility.UrlEncode(inChannelUrl);
27+
Url = $"{USERS_PREFIX_URL}/{encodedUserId}/push_preference/{encodedChannelUrl}";
28+
ResponseType = typeof(Response);
29+
resultHandler = inResultHandler;
30+
31+
Payload tempPayload = new Payload
32+
{
33+
pushTriggerOption = inGroupChannelPushTriggerOption.ToJsonName()
34+
};
35+
36+
ContentBody = NewtonsoftJsonExtension.SerializeObjectIgnoreException(tempPayload);
37+
}
38+
}
39+
40+
[Serializable]
41+
internal sealed class Response : ApiCommandAbstract.Response
42+
{
43+
[JsonProperty("push_trigger_option")] internal readonly string pushTriggerOption;
44+
45+
internal SbGroupChannelPushTriggerOption GroupChannelPushTriggerOption { get; private set; }
46+
47+
internal override void OnResponseAfterDeserialize(string inJsonString)
48+
{
49+
if (string.IsNullOrEmpty(pushTriggerOption) == false)
50+
{
51+
GroupChannelPushTriggerOption = SbGroupChannelPushTriggerOptionExtension.JsonNameToType(pushTriggerOption);
52+
}
53+
}
54+
}
55+
}
56+
}

Runtime/Scripts/Internal/Command/ApiCommand/ApiCommandExtends/Channel/GroupChannel/SetMyPushTriggerOptionApiCommand.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)