PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: gregbown on February 14, 2009, 08:47:32



Title: should proxy share notifications?
Post by: gregbown on February 14, 2009, 08:47:32
I have an application that allows customers to preview media, login purchase and and view full library.
Init proxy returns the preview and price only. Login and buy proxy returns the complete library.
There was a request for maintaining the logged in state if a user returns to the page. I now check for a stored session id in a shared object in my init proxy. If it exists I post it to my API and get the complete library back.
My Question
Should I handle the new post structure in init proxy or communicate the session to a application mediator and then handle it in the login proxy.
My other finding.??? I can send the login proxy notification to my application mediator from the init proxy and application mediator handles it as if it came from login proxy and I don't need to write any additional code to handle the response because the structure is already there to handle it ...
Weird.  I guess the proxy's are in the same package so if the sendNotification is public that would explain it


Title: Re: should proxy share notifications?
Post by: puremvc on February 24, 2009, 06:01:20
It doesn't matter where a notification comes from, any interested mediator will handle it.

As for handling the automatic login, it would be best to have a command that invokes the LoginProxy's login method. Then send the same notification to trigger that command from either your mediator that is listening to your login view component OR from your code that has just pulled the login info from the local shared object.

Here, again the notification can come from different places but still trigger the same command.

-=Cliff>