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-1491] Add custom modal transition for message list #1760

Merged

Conversation

nuno-vieira
Copy link
Member

@nuno-vieira nuno-vieira commented Jan 19, 2022

🔗 Issue Link

CIS-1491
#1307

🎯 Goal

Introduces a custom modal transition to workaround the inverted table view on the message list. This custom transition should be used if you as a customer need to present the ChatChannelVC in a modal.

Usage:

// Make sure to have a reference to the delegate or it will be instantly deallocated.
let streamModalTransitioningDelegate = StreamModalTransitioningDelegate()

func showChannelVC() {
    let vc = ChatChannelVC()
    vc.channelController = client.channelController(for: cid)
    let navVC = UINavigationController(rootViewController: vc)
    navVC.transitioningDelegate = streamModalTransitioningDelegate
    navVC.modalPresentationStyle = .custom
    navigationController?.present(navVC, animated: true, completion: nil)
}

🛠 Implementation

Adds a new StreamModalTransitioningDelegate that mimics the native's modal transition.

🎨 Changes

ModalTransition.mp4

🧪 Testing

Check the video on how to test this in the demo app.

☑️ Checklist

  • I have signed the Stream CLA (required)
  • This change follows zero ⚠️ policy (required)
  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • Affected documentation updated (docusaurus, tutorial, CMS (task created)

@nuno-vieira nuno-vieira requested a review from a team as a code owner January 19, 2022 17:48
@nuno-vieira nuno-vieira force-pushed the fix/CIS-1491-Message-list-replace-native-gesture-modal branch from 5e9e8a6 to fa16d6c Compare January 19, 2022 17:49
@nuno-vieira nuno-vieira force-pushed the fix/CIS-1491-Message-list-replace-native-gesture-modal branch from b68c9c0 to 11816c0 Compare January 19, 2022 18:04
@codecov
Copy link

codecov bot commented Jan 19, 2022

Codecov Report

Merging #1760 (f9ca5b5) into develop (8bcce18) will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1760      +/-   ##
===========================================
- Coverage    85.39%   85.37%   -0.02%     
===========================================
  Files          234      234              
  Lines        11247    11247              
===========================================
- Hits          9604     9602       -2     
- Misses        1643     1645       +2     
Flag Coverage Δ
llc-tests 85.37% <ø> (-0.02%) ⬇️

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

Impacted Files Coverage Δ
Sources/StreamChat/Utils/Logger/Logger.swift 56.28% <0.00%> (-1.80%) ⬇️
Sources/StreamChat/ChatClient.swift 91.42% <0.00%> (+0.23%) ⬆️

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 8bcce18...f9ca5b5. Read the comment docs.

Copy link
Contributor

@bielikb bielikb left a comment

Choose a reason for hiding this comment

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

I left couple of more comments here

DemoApp/ChatPresenter.swift Outdated Show resolved Hide resolved
@nuno-vieira nuno-vieira merged commit d11b5f9 into develop Jan 20, 2022
@nuno-vieira nuno-vieira deleted the fix/CIS-1491-Message-list-replace-native-gesture-modal branch January 20, 2022 13:57
@bielikb bielikb mentioned this pull request Feb 1, 2022
@pbendersky
Copy link

We are trying to present the chat in a modal using UISheetPresentationController with detents, so the chat doesn't take over the entire screen.
Do you plan to support this scenario? Setting the presentation mode to .custom doesn't play nice with it based on our tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants