GithubHelp home page GithubHelp logo

Comments (11)

std-s avatar std-s commented on May 22, 2024 1

For now, that's the only way to deal with it.

thx again.

from chatlayout.

ekazaev avatar ekazaev commented on May 22, 2024

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.

std-s avatar std-s commented on May 22, 2024
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.

ekazaev avatar ekazaev commented on May 22, 2024

@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.

ekazaev avatar ekazaev commented on May 22, 2024

@std-s Anything else I can help you with or it is safe to close the issue?

from chatlayout.

std-s avatar std-s commented on May 22, 2024

@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.

std-s avatar std-s commented on May 22, 2024

How to reduce the time spent from A to B is what I want.

from chatlayout.

ekazaev avatar ekazaev commented on May 22, 2024

@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

  1. So chatController.loadInitialMessages { - is asynchronious function. You need a synchronous for the initial appearance. Synchronous means let sections = chatController.getCachedMessages()
  2. then add a flag to processUpdates that on initial appearance it would ignore the currentInterfaceActions.options count like guard ignoreInterfaceActions || currentInterfaceActions.options.isEmpty else { and process those changes anyway. Keep this flag off for all the other times.
  3. Keep in mind that you must precess those sections synchronously from the first call of viewDidLayoutSubviews. 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.

ekazaev avatar ekazaev commented on May 22, 2024

@std-s Anything else I can help you with?

from chatlayout.

std-s avatar std-s commented on May 22, 2024

@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

  1. So chatController.loadInitialMessages { - is asynchronious function. You need a synchronous for the initial appearance. Synchronous means let sections = chatController.getCachedMessages()
  2. then add a flag to processUpdates that on initial appearance it would ignore the currentInterfaceActions.options count like guard ignoreInterfaceActions || currentInterfaceActions.options.isEmpty else { and process those changes anyway. Keep this flag off for all the other times.
  3. Keep in mind that you must precess those sections synchronously from the first call of viewDidLayoutSubviews. 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.

ekazaev avatar ekazaev commented on May 22, 2024

@std-s My pleasure. good luck

from chatlayout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.