Jump to content
pconkie

Open an App and pass it some data

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

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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...