Code Monkey home page Code Monkey logo

Comments (12)

richard-edwards avatar richard-edwards commented on July 19, 2024

I'm finding the same thing. In my case I have a secondary page of comments. After a user adds a comment to the initial object, I'd like to pass that back to the initial page in the ReverseInit method. Is this the proper way to do this or should my secondary screen be modal with a close toolbar item that I could use to pop it?

from freshmvvm.

 avatar commented on July 19, 2024

This needs fixed.

from freshmvvm.

rid00z avatar rid00z commented on July 19, 2024

@mathewgrabau @robertbaker @redwards1966 What would you like to happen when the Android back button is pressed?

from freshmvvm.

richard-edwards avatar richard-edwards commented on July 19, 2024

Hi Michael,
I'd like to see it call the ReverseInit function on the previous model.

from freshmvvm.

BNoohi avatar BNoohi commented on July 19, 2024

Has anyone picked this issue up? As a note, I think this issue will likely be tied to the result of this issue: #24 in that the ReverseInit will likely need a similar change.

from freshmvvm.

rid00z avatar rid00z commented on July 19, 2024

I haven't picked this up. If you're already there feel free to take a look.

from freshmvvm.

olexale avatar olexale commented on July 19, 2024

@redwards1966, In order to make ReverseInit work we need to pass some data to PopPageModel. When user tap on hardware back button we just have no information which data should be passed. The most obvious (and dirty) solution would be to override OnBackPressed in your secondary page and call ReverseInit by hand the same way it is called in the framework source code.

As an alternative (if you don’t want to mess with Pages) you may use ViewIsDisappearing method from FreshBasePageModel, but in that case ReverseInit will be invoked twice in case if user tap on non-hardware back.

@rid00z, not a solution of the current problem, but just to simplify such scenarios I propose to create a FreshBasePage that will fire OnBackPressed and Appearing/Disappearing events to its FreshBasePageModel. Honestly current WireEvents method makes me think about memory leaks. Maybe I’m wrong and everything is fine there, but when I see event subscriptions and do not see unsubscriptions I feel not comfortable.
Those changes should not break backward compatibility with current framework. Will you approve that?

from freshmvvm.

allenmoatallen avatar allenmoatallen commented on July 19, 2024

Is someone working on this? I ran into this today. :)

from freshmvvm.

rid00z avatar rid00z commented on July 19, 2024

ReverseInit was designed to collect data when returning pushed page. It's seems it's being used for more purposes than intended. We can definately add the ability if everyone would like like it.

On the FreshBasePageModel there's appearing and disappearing events, why wouldn't those events work?

from freshmvvm.

escamoteur avatar escamoteur commented on July 19, 2024

The problem is, that pressing the hardware backbutton does not fire these Events but the virtual Method Page.OnBackButtonPressed is called.

from freshmvvm.

Brosten avatar Brosten commented on July 19, 2024

Couldn't it be good to know, in the ViewModel when the Page is dissappearing (could be removed, or Another page could be put on top of it), AND when the page is really popped from the stack?Perhaps some kind of Clean-up should be done when popped from the stack. And it really doesn't matter if it's popped because of some code saying Pop()… or if the user presses a hardware back button.

Or am I missing something here?

from freshmvvm.

tele-bird avatar tele-bird commented on July 19, 2024

@rid00z Do you mean to say that ReverseInit() is not invoked on the page that was popped? But instead on the page beneath it? (that pushed it)

from freshmvvm.

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.