Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIS-835] Introduce channel freeze/unfreeze #1090

Merged
merged 4 commits into from
May 20, 2021
Merged

Conversation

b-onc
Copy link
Contributor

@b-onc b-onc commented May 20, 2021

This is actually partial channel update, but we don't have the bandwidth to figure it out completely now. It's in our backlog and will be implemented fully soon.

@b-onc b-onc added 🙏 Feature Request A new feature request 🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK labels May 20, 2021
@b-onc b-onc requested a review from VojtaStavik May 20, 2021 11:57
@b-onc b-onc force-pushed the cis-835-channel-freeze branch from 18902f2 to 72f30e8 Compare May 20, 2021 11:59
Copy link
Contributor

@VojtaStavik VojtaStavik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great 👍 Thank you

Comment on lines +52 to +59
log.debug(
"Making URL request: \(endpoint.method.rawValue.uppercased()) \(endpoint.path)\n"
+ "Body:\n\(urlRequest.httpBody?.debugPrettyPrintedJSON ?? "<Empty>")\n"
+ "Query items:\n\(urlRequest.queryItems.prettyPrinted)"
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 😍

Comment on lines +180 to +189

static func freezeChannel(_ freeze: Bool, cid: ChannelId) -> Endpoint<EmptyResponse> {
.init(
path: "channels/" + cid.apiPath,
method: .patch,
queryItems: nil,
requiresConnectionId: false,
body: ["set": ["frozen": freeze]]
)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a very nice and elegant workaround 👍

@codecov-commenter
Copy link

codecov-commenter commented May 20, 2021

Codecov Report

Merging #1090 (5c88449) into main (673c52f) will decrease coverage by 0.17%.
The diff coverage is 93.54%.

❗ Current head 5c88449 differs from pull request most recent head bfba236. Consider uploading reports for the commit bfba236 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1090      +/-   ##
==========================================
- Coverage   91.71%   91.53%   -0.18%     
==========================================
  Files         216      216              
  Lines        9145     9195      +50     
==========================================
+ Hits         8387     8417      +30     
- Misses        758      778      +20     
Flag Coverage Δ
llc-tests 91.37% <93.54%> (-0.18%) ⬇️
llc-tests-ios12 88.26% <93.54%> (-0.16%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
Sources/StreamChat/APIClient/APIClient.swift 62.96% <50.00%> (-37.04%) ⬇️
...eamChat/APIClient/Endpoints/ChannelEndpoints.swift 100.00% <100.00%> (ø)
...trollers/ChannelController/ChannelController.swift 92.34% <100.00%> (+0.29%) ⬆️
Sources/StreamChat/Workers/ChannelUpdater.swift 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 673c52f...bfba236. Read the comment docs.

Bahadir Oncel added 4 commits May 20, 2021 15:07
Sample output:
---
2021-05-19 17:29:32.126 [DEBUG] [NSManagedObjectContext 0x6000037095f0] [APIClient.swift:52] [request(endpoint:completion:)] > Making URL request: POST sync
Body:
{
  "last_sync_at" : "2021-05-19T15:28:20.066Z",
  "channel_cids" : [
    "messaging:201BD2D3-E",
    .... //goes on
  ]
}
Query items:
<Empty>
---
or
---
2021-05-19 17:29:31.567 [DEBUG] [NSManagedObjectContext 0x60000370f740] [APIClient.swift:52] [request(endpoint:completion:)] > Making URL request: GET channels
Body:
<Empty>
Query items:
- payload={
  "filter_conditions" : {
    "members" : {
      "$in" : [
        "luke_skywalker"
      ]
    }
  },
  "watch" : true,
  "message_limit" : 25,
  "limit" : 20
}
- connection_id=60a253bc-0a05-2761-0000-00000039c862
---
@b-onc b-onc force-pushed the cis-835-channel-freeze branch from 5c88449 to bfba236 Compare May 20, 2021 13:07
@b-onc b-onc merged commit 5386a9d into main May 20, 2021
@b-onc b-onc deleted the cis-835-channel-freeze branch May 20, 2021 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙏 Feature Request A new feature request 🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants