Skip to content
This repository was archived by the owner on Jun 7, 2020. It is now read-only.

Conversation

@rafaelks
Copy link
Contributor

@rafaelks rafaelks commented Jul 13, 2018

@RocketChat/ios

What's new in this PR

  • Swipe actions on the subscription cells using SwipeCellKit
  • Preview actions on 3D Touch
  • Use DifferenceKit for calculating diff and updating the subscriptions table view

Note: The implementation of swipe actions provided in UIKit has several bugs, and in its current state does not work well with our use case. SwipeCellKit also has some issues, working with DifferenceKit, but the simple workaround is that we don't use the .destructive style.

Closes #1518
Closes #2131

@rafaelks rafaelks added this to the 3.0.0 milestone Jul 13, 2018
@rafaelks rafaelks changed the title [NEW] Add the actions to the Subscription (Hide, Leave, Mark as Read & Unread) [WIP][NEW] Add the actions to the Subscription (Hide, Leave, Mark as Read & Unread) Jul 13, 2018
@rafaelks rafaelks modified the milestones: 3.0.0, 3.1.0 Jul 13, 2018
@codecov
Copy link

codecov bot commented Jul 27, 2018

Codecov Report

❗ No coverage uploaded for pull request base (develop@111f4c0). Click here to learn what that means.
The diff coverage is 19.92%.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop    #1960   +/-   ##
==========================================
  Coverage           ?   35.04%           
==========================================
  Files              ?      387           
  Lines              ?    18110           
  Branches           ?        0           
==========================================
  Hits               ?     6346           
  Misses             ?    11764           
  Partials           ?        0
Impacted Files Coverage Δ
Rocket.Chat/Managers/AnalyticsManager.swift 59.03% <ø> (ø)
...Chat/Models/Subscription/SubscriptionActions.swift 0% <0%> (ø)
...equests/Subscription/SubscriptionHideRequest.swift 0% <0%> (ø)
...uests/Subscription/SubscriptionUnreadRequest.swift 0% <0%> (ø)
...iews/Cells/Subscription/BaseSubscriptionCell.swift 0% <0%> (ø)
...at/Models/Subscription/UnmanagedSubscription.swift 0% <0%> (ø)
...quests/Subscription/SubscriptionLeaveRequest.swift 0% <0%> (ø)
...at/Views/Cells/Subscription/SubscriptionCell.swift 0% <0%> (ø)
Rocket.Chat/Theme/ThemeableViews.swift 77.5% <100%> (ø)
...ket.Chat/Controllers/Chat/ChatViewController.swift 29.8% <7.14%> (ø)
... and 4 more

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 111f4c0...5653a2b. Read the comment docs.

@Sameesunkaria Sameesunkaria changed the title [WIP][NEW] Add the actions to the Subscription (Hide, Leave, Mark as Read & Unread) [NEW] Add the actions to the Subscription (Hide, Leave, Mark as Read & Unread) Aug 22, 2018
@filipealva
Copy link
Contributor

@Sameesunkaria just experienced the Table section header title sometimes gets improperly laid out issue.

The Conversations header sometimes is not drawn, and when we have another section, for example the unread one, it looks like all the conversations are unread because we only see the Unread header.

reloadNotificationToken = realm?.objects(Auth.self).observe({ [weak self] _ in
if self?.realm?.objects(Auth.self).count == 1 {
DispatchQueue.main.async {
self?.reloadData?()
Copy link
Contributor

Choose a reason for hiding this comment

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

@Sameesunkaria this is to make sure we will have the Auth object accessible when first loading the SubscriptionsViewController?

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 to reload the cells so that the avatar views get updated when the server url is accessible. This is required after the first login. If you have a better solution, please let me know.

Copy link
Contributor

Choose a reason for hiding this comment

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

The solutions looks good, I was just thinking that we could invalidate the token after executing the block once. It seems that it only needs to be executed once. Does it makes sense?

Copy link
Contributor

Choose a reason for hiding this comment

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

It gets called a few times, so if we invalidate it before that (after the first time the block executes) it sometimes causes the images to not be loaded. I am not sure as to why it gets called more than once. If you can figure that out, maybe we'll be able to invalidate that notification.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it. Let's leave it this way, it's not critical, we can improve in another PR. Thanks for explaining

@filipealva
Copy link
Contributor

Found one more bug related to section header layout GitHawk Upload by filipealva

Sent with GitHawk

…metimes we were not being able to get the correct center y in runtime
<constraint firstItem="gd8-ny-3Np" firstAttribute="trailing" secondItem="SwS-x7-2jR" secondAttribute="trailing" id="MYk-K7-viX"/>
<constraint firstItem="SwS-x7-2jR" firstAttribute="trailing" secondItem="gOj-Q6-yQs" secondAttribute="trailing" constant="16" id="S8t-kq-5ZF"/>
<constraint firstItem="gOj-Q6-yQs" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="ZmT-uy-R4W"/>
<constraint firstItem="gOj-Q6-yQs" firstAttribute="top" secondItem="SwS-x7-2jR" secondAttribute="top" constant="13.5" id="zGn-Dp-2U7"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Haha, was just about to push the same change...

Copy link
Contributor

Choose a reason for hiding this comment

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

Haha, cool! 🤓

Copy link
Contributor

@filipealva filipealva left a comment

Choose a reason for hiding this comment

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

Everything working fine! Thank you guys for this PR, specially @Sameesunkaria 💯

Copy link
Member

@cardoso cardoso left a comment

Choose a reason for hiding this comment

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

Great work overall, just a few considerations.

Only change I think is critical right now is to move the new Subscription methods to struct SubscriptionsClient


extension Subscription {
func favoriteSubscription() {
SubscriptionManager.toggleFavorite(self) { (response) in
Copy link
Member

Choose a reason for hiding this comment

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

These functions should be in struct SubscriptionsClient so we can use other APIs than API.current() and also be able to test with MockAPI.

Copy link
Contributor

Choose a reason for hiding this comment

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

@cardoso Made some changes...

"subscriptions.list.actions.unread" = "Não lido";
"subscriptions.list.actions.favorite" = "Favorite"; // TODO
"subscriptions.list.actions.unfavorite" = "Unfavorite"; // TODO
"subscriptions.list.actions.hide" = "Fechar";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

"Esconder"? 🤔

"subscriptions.list.actions.read" = "Lido";
"subscriptions.list.actions.unread" = "Não lido";
"subscriptions.list.actions.favorite" = "Favorite"; // TODO
"subscriptions.list.actions.unfavorite" = "Unfavorite"; // TODO
Copy link
Contributor Author

Choose a reason for hiding this comment

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

"Remover dos Favoritos"

Copy link
Contributor

Choose a reason for hiding this comment

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

This text is shown under the swipe actions. something shorter would be preferred.

"subscriptions.list.date.yesterday" = "Ontem";
"subscriptions.list.actions.read" = "Lido";
"subscriptions.list.actions.unread" = "Não lido";
"subscriptions.list.actions.favorite" = "Favorite"; // TODO
Copy link
Contributor Author

Choose a reason for hiding this comment

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

"Adic. aos Favoritos"

Copy link
Member

Choose a reason for hiding this comment

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

"Adicionar aos Favoritos"? @rafaelks 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

Choose a reason for hiding this comment

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

This text is shown under the swipe actions. something shorter would be preferred.

@rafaelks
Copy link
Contributor Author

Great work here @Sameesunkaria and @filipealva! Is this one ready to be merged?

@Sameesunkaria
Copy link
Contributor

@rafaelks yes it is. Except the localization stuff.

Sent with GitHawk

@rafaelks rafaelks merged commit 887730f into develop Aug 30, 2018
@rafaelks rafaelks deleted the feature/implement_actions_subscriptions.1518 branch August 30, 2018 00:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants