Comments (11)
For now, that's the only way to deal with it.
thx again.
from chatlayout.
Hi @std-s If there is some interface action happens when you can not update the collection view (for example you are updating the content offset animatingly and the state of collection view is undefined in that moment) if at this very moment an update comes, it stores it, and the reaction will be called when the currentInterfaceActions are empty. SetActor there behaves like a simple state machine.
from chatlayout.
guard currentInterfaceActions.options.isEmpty else { print("A:\(Date())") let reaction = SetActor<Set<InterfaceActions>, ReactionTypes>.Reaction(type: .delayedUpdate, action: .onEmpty, executionType: .once, actionBlock: { [weak self] in guard let self else { return } print("B:\(Date())") processUpdates(with: sections, animated: animated, requiresIsolatedProcess: requiresIsolatedProcess, completion: completion) print("C:\(Date())") }) currentInterfaceActions.add(reaction: reaction) return }
hi, @ekazaev
I printed the current time of three locations A, B, C; found that A and B took a lot of time before, why is that?
As a result, after the page jumps, there is a blank page time.
RPReplay_Final1691117094.mov
from chatlayout.
@std-s Detailed answer you can probably find here. #51 It s a bit vague as at the begining I couldnt understadn the question. But the problem is that you need to populate cells syncroniously before the push animation starts. That is the issue there. And the function you are referencing to is asynchorios.
The difference in time there is because B will be called only when the currentInterfaceActions
are empty again and after the previous animating insertion is completed. It is not the issue there.
from chatlayout.
@std-s Anything else I can help you with or it is safe to close the issue?
from chatlayout.
@std-s Detailed answer you can probably find here. #51 It s a bit vague as at the begining I couldnt understadn the question. But the problem is that you need to populate cells syncroniously before the push animation starts. That is the issue there. And the function you are referencing to is asynchorios.
The difference in time there is because B will be called only when the
currentInterfaceActions
are empty again and after the previous animating insertion is completed. It is not the issue there.
@ekazaev hi, the related method of issue #51 is not applicable. The effect is still as shown in the video above.
from chatlayout.
How to reduce the time spent from A to B is what I want.
from chatlayout.
@std-s You need to add a flag there and avoid async processing on appearance. Keep in mind it will require change in the Chat Controller as well. You want to get messages and update the collection view before the pushing animation starts.
This is what you want to get
gif
- So
chatController.loadInitialMessages {
- is asynchronious function. You need a synchronous for the initial appearance. Synchronous meanslet sections = chatController.getCachedMessages()
- then add a flag to
processUpdates
that on initial appearance it would ignore thecurrentInterfaceActions.options
count likeguard ignoreInterfaceActions || currentInterfaceActions.options.isEmpty else {
and process those changes anyway. Keep this flag off for all the other times. - Keep in mind that you must precess those
sections
synchronously from the first call ofviewDidLayoutSubviews
. It is the first time when your UINavigationController sets the correct size of the ChatViewController inside of it. Otherwise the view size is not correct.
from chatlayout.
@std-s Anything else I can help you with?
from chatlayout.
@std-s You need to add a flag there and avoid async processing on appearance. Keep in mind it will require change in the Chat Controller as well. You want to get messages and update the collection view before the pushing animation starts.
This is what you want to get gif
- So
chatController.loadInitialMessages {
- is asynchronious function. You need a synchronous for the initial appearance. Synchronous meanslet sections = chatController.getCachedMessages()
- then add a flag to
processUpdates
that on initial appearance it would ignore thecurrentInterfaceActions.options
count likeguard ignoreInterfaceActions || currentInterfaceActions.options.isEmpty else {
and process those changes anyway. Keep this flag off for all the other times.- Keep in mind that you must precess those
sections
synchronously from the first call ofviewDidLayoutSubviews
. It is the first time when your UINavigationController sets the correct size of the ChatViewController inside of it. Otherwise the view size is not correct.
👌,Ok, I'll try these methods.
from chatlayout.
@std-s My pleasure. good luck
from chatlayout.
Related Issues (20)
- The message list will shake. HOT 4
- Performance when push to ChatViewController not good HOT 12
- Bottom offset keeping issues HOT 8
- Incorrect chat layout frame when running on iOS 17 HOT 7
- Audio message HOT 5
- Image View Play Button Constraints HOT 2
- chat layout blinking HOT 3
- Text message bubble calc in ex app
- Can you write an example where inputBarView is a subview? HOT 2
- transitioning into the chat interface from the conversationList page is slow HOT 10
- Forgot to use self. in closure HOT 3
- PDF cells HOT 2
- Include replica of iMessage curved lines connecting replies HOT 11
- How to use ChatLayout in SwiftUI project? HOT 3
- Include replica of iMessage curved lines connecting replies HOT 6
- Message bubble jumps when reloading collection view HOT 10
- chat container refresh in some strange conditions HOT 1
- Seeking help about keepContentOffsetAtBottomOnBatchUpdates HOT 4
- Random crash in propagateLatestMessages HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chatlayout.