diff --git a/labs/meteor-client/.meteor/packages b/labs/meteor-client/.meteor/packages index 3fd0fc1cff..27cb9d489c 100644 --- a/labs/meteor-client/.meteor/packages +++ b/labs/meteor-client/.meteor/packages @@ -12,3 +12,5 @@ less bootstrap-3 iron-router bootstrap +underscore +amplify diff --git a/labs/meteor-client/client/globals.coffee b/labs/meteor-client/client/globals.coffee index 7f2f17efdc..a7b87e5de9 100755 --- a/labs/meteor-client/client/globals.coffee +++ b/labs/meteor-client/client/globals.coffee @@ -2,19 +2,21 @@ Handlebars.registerHelper 'equals', (a, b) -> # equals operator was dropped in M a is b # Allow access through all templates -Handlebars.registerHelper "setInSession", (k, v) -> Session.set k, v -Handlebars.registerHelper "getInSession", (k) -> Session.get k +Handlebars.registerHelper "setInSession", (k, v) -> SessionAmplify.set k,v #Session.set k, v +Handlebars.registerHelper "getInSession", (k) -> SessionAmplify.get k #Session.get k # Allow access throughout all coffeescript/js files -@setInSession = (k, v) -> Session.set k, v -@getInSession = (k) -> Session.get k +@setInSession = (k, v) -> SessionAmplify.set k,v #Session.set k, v +@getInSession = (k) -> SessionAmplify.get k # retrieve account for selected user @getCurrentUserFromSession = -> - Meteor.Users.findOne("userId": Session.get("userId")) + Meteor.Users.findOne("userId": SessionAmplify.get("userId")) # retrieve account for selected user Handlebars.registerHelper "getCurrentUser", => - @window.getCurrentUserFromSession() + # @window.getCurrentUserFromSession() + id = SessionAmplify.get("userId") + Meteor.Users.findOne("userId": SessionAmplify.get("userId")) # toggle state of field in the database @toggleCam = (event) -> @@ -49,6 +51,7 @@ Handlebars.registerHelper "getCurrentUser", => Meteor.methods sendMeetingInfoToClient: (meetingId, userId) -> + console.log "inside sendMeetingInfoToClient" Session.set("userId", userId) Session.set("meetingId", meetingId) Session.set("currentChatId", meetingId) @@ -56,6 +59,13 @@ Meteor.methods Session.set("bbbServerVersion", "0.90") Session.set("userName", null) + SessionAmplify.set("userId", userId) + SessionAmplify.set("meetingId", meetingId) + SessionAmplify.set("currentChatId", meetingId) + SessionAmplify.set("meetingName", null) + SessionAmplify.set("bbbServerVersion", "0.90") + SessionAmplify.set("userName", null) + @getUsersName = -> name = Session.get("userName") # check if we actually have one in the session if name? then name # great return it, no database query diff --git a/labs/meteor-client/client/main.coffee b/labs/meteor-client/client/main.coffee index 7030de9585..f195979f8c 100755 --- a/labs/meteor-client/client/main.coffee +++ b/labs/meteor-client/client/main.coffee @@ -1,5 +1,16 @@ # These settings can just be stored locally in session, created at start up Meteor.startup -> + console.log "inside startup" + `this.SessionAmplify = _.extend({}, Session, { + keys: _.object(_.map(amplify.store(), function(value, key) { + return [key, JSON.stringify(value)] + })), + set: function (key, value) { + Session.set.apply(this, arguments); + amplify.store(key, value); + }, + });` + Session.setDefault "display_usersList", true Session.setDefault "display_navbar", true Session.setDefault "display_chatbar", true @@ -9,6 +20,15 @@ Meteor.startup -> Session.setDefault "joinedAt", getTime() Session.setDefault "isSharingAudio", false + SessionAmplify.set "display_usersList", true + SessionAmplify.set "display_navbar", true + SessionAmplify.set "display_chatbar", true + SessionAmplify.set "display_whiteboard", false + SessionAmplify.set "display_chatPane", true + SessionAmplify.set 'inChatWith', "PUBLIC_CHAT" + SessionAmplify.set "joinedAt", getTime() + SessionAmplify.set "isSharingAudio", false + @myTabs = new WatchValue() @myTabs.updateValue [ {isActive:true, name:"Public", class: "publicChatTab"} diff --git a/labs/meteor-client/lib/router.coffee b/labs/meteor-client/lib/router.coffee index 1ddb809e4d..fb41759a43 100755 --- a/labs/meteor-client/lib/router.coffee +++ b/labs/meteor-client/lib/router.coffee @@ -5,11 +5,11 @@ Router.map -> path: "/meeting_id=*" action: () -> @redirect('/') - Meteor.subscribe 'users', Session.get('meetingId') - Meteor.subscribe 'chat', Session.get('meetingId') - Meteor.subscribe 'shapes', Session.get('meetingId') - Meteor.subscribe 'slides', Session.get('meetingId') - Meteor.subscribe 'meetings', Session.get('meetingId') + Meteor.subscribe 'users', getInSession('meetingId') + Meteor.subscribe 'chat', getInSession('meetingId') + Meteor.subscribe 'shapes', getInSession('meetingId') + Meteor.subscribe 'slides', getInSession('meetingId') + Meteor.subscribe 'meetings', getInSession('meetingId') onBeforeAction: ()-> url = location.href @@ -36,6 +36,12 @@ Router.map -> console.log "unable to extract the required information for the meeting from the URL" @route "main", path: "/" + onBeforeAction: -> + Meteor.subscribe 'users', getInSession('meetingId') + Meteor.subscribe 'chat', getInSession('meetingId') + Meteor.subscribe 'shapes', getInSession('meetingId') + Meteor.subscribe 'slides', getInSession('meetingId') + Meteor.subscribe 'meetings', getInSession('meetingId') @route "logout", path: "logout"