Jump to content

Open an App and pass it some data


pconkie

Recommended Posts

I've seen this in action in frog e.g. frog drive can be opened to a particular folder, quiz manager can be opened to a particular quiz etc

If I have built a frog code app, how could i open it from a site and send it some data? This works to open a site....

FrogOS.openSite({
  site: $assignment.data('assignment-link'),
  assignment_uuid: $assignment.data('assignment-uuid')
});

But i can not get any variations of this to work...

FrogOS.openApp({
  app: app.uuid,
  param: app.data
});

@Chris.Smith, @Graham Quince ideas?

Paul

Link to comment
Share on other sites

On 13/08/2017 at 13:38, pconkie said:

I've seen this in action in frog e.g. frog drive can be opened to a particular folder, quiz manager can be opened to a particular quiz etc

If I have built a frog code app, how could i open it from a site and send it some data? This works to open a site....


FrogOS.openSite({
  site: $assignment.data('assignment-link'),
  assignment_uuid: $assignment.data('assignment-uuid')
});

But i can not get any variations of this to work...


FrogOS.openApp({
  app: app.uuid,
  param: app.data
});

@Chris.Smith, @Graham Quince ideas?

Paul

Hi @pconkie,

 

Sorry for the delay... It's taken me til today to get back at the head of the charge...

Hopefully this should help.

https://froglearn.backwellschool.net/app/lib/packaging/docs/FrogOS.html#.openApp__anchor

 

FrogOS comes with some built in documentation which is install-able via the Package Manager; here's the relevant page though.

 

Let me know how you get on,

 

Chris

  • Thanks 1
Link to comment
Share on other sites

Hi @Chris.Smith

Glad to see you back!  Thanks for the updates today, first issue.....

No matter what app i pick, i get a uncaught steal.js error.  Code, widget and console error below.

Capture.thumb.PNG.24c03e4375d86052eae0d6c2e6ebae69.PNG

 

Plus if this was working, how would i access the string: 'student' in the app?

Cheers

Paul

 

Link to comment
Share on other sites

On 17/08/2017 at 16:22, pconkie said:

Hi @Chris.Smith

Glad to see you back!  Thanks for the updates today, first issue.....

No matter what app i pick, i get a uncaught steal.js error.  Code, widget and console error below.

Capture.thumb.PNG.24c03e4375d86052eae0d6c2e6ebae69.PNG

 

Plus if this was working, how would i access the string: 'student' in the app?

Cheers

Paul

 

@pconkie,

There is are a differences between native platform apps and FrogCode apps and unfortunately this is one. Because there may be another app on the system called 'polls', you have to enter your package's id. There is currently a problem with the openApp method however, so use the following example to get you started:
 

this.trigger('os.internal.launchapp', {
    name: appID,
    view: 'student',
    appModel: new Com.Frog.Model({
        'uuid' : appID,
        'role_name': Object.values(_Roles.serialize()).filter(function(role) {
            return /app\.externalapps\.(?:[0-9A-F]{8}\.)+polls$/gim.test(role);
        })[0],
        'extended_data' : {
            'from_package' : true
        }
    })
});

Don't look deeply into exactly what is going on here, as I will be fixing this as soon as I get chance.

~ Chris

  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...

Thanks @Chris.Smith I've been able to get this to work now.

I could really do with disconnecting firebase when the site or app is closed rather than what it does by default (when the browser is closed).

According to the docs....

Quote

new Application()

Listens to Events:
  • event:'app.launch'
  • event:'app.close'
  • event:'app.blur'
  • event:'app.focus'

So, is there an event i can use from inside the app that runs code every time the app is closed?

Thanks

Paul

Link to comment
Share on other sites

13 hours ago, pconkie said:

Thanks @Chris.Smith I've been able to get this to work now.

I could really do with disconnecting firebase when the site or app is closed rather than what it does by default (when the browser is closed).

According to the docs....

 

So, is there an event i can use from inside the app that runs code every time the app is closed?

Thanks

Paul

Hi Paul,

There are two methods of catching the "close" event on an app. The first is move involved than the other.

{
    'app.close': function(el, ev) {
        this.closeFirebaseConnection();
        this.trigger('os.app.close'); // <--- This has to be run or the app will not close!!!
    }
}

The next one is the advised one to use...

{
    onClose: function(close) {
        this.closeFirebaseConnection();
        close(); // <-- Tells FrogOS that you are ready for the app to close.
    }
}

Both are fine to use, however the onClose hook is safe from future changes.

 

Hope that answers your question,

~ Chris

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...