diff --git a/app/schemas/subscriptions/misc.coffee b/app/schemas/subscriptions/misc.coffee index 87ff86cac..439464851 100644 --- a/app/schemas/subscriptions/misc.coffee +++ b/app/schemas/subscriptions/misc.coffee @@ -9,6 +9,9 @@ module.exports = 'note-group-ended': {} # TODO schema + 'modal-opened': + {} # TODO schema + 'modal-closed': {} # TODO schema diff --git a/app/views/kinds/CocoView.coffee b/app/views/kinds/CocoView.coffee index 21b432dd7..264e3539c 100644 --- a/app/views/kinds/CocoView.coffee +++ b/app/views/kinds/CocoView.coffee @@ -177,6 +177,7 @@ module.exports = class CocoView extends Backbone.View $('#modal-wrapper .modal').modal(modalOptions).on 'hidden.bs.modal', @modalClosed window.currentModal = modalView @getRootView().stopListeningToShortcuts(true) + Backbone.Mediator.publish 'modal-opened', {} modalClosed: => visibleModal.willDisappear() if visibleModal @@ -190,7 +191,7 @@ module.exports = class CocoView extends Backbone.View @openModalView(wm) else @getRootView().listenToShortcuts(true) - Backbone.Mediator.publish 'modal-closed' + Backbone.Mediator.publish 'modal-closed', {} # Loading RootViews diff --git a/app/views/play/level_view.coffee b/app/views/play/level_view.coffee index 70a93f6b2..e2669b2b0 100644 --- a/app/views/play/level_view.coffee +++ b/app/views/play/level_view.coffee @@ -138,7 +138,13 @@ module.exports = class PlayLevelView extends View supermodel: @supermodel firstOnly: true @openModalView(new DocsModal(options), true) - Backbone.Mediator.subscribeOnce 'modal-closed', @onLevelStarted, @ + onGuideOpened = -> + @guideOpenTime = new Date() + onGuideClosed = -> + application.tracker?.trackTiming new Date() - @guideOpenTime, 'Intro Guide Time', @levelID, @levelID, 100 + @onLevelStarted() + Backbone.Mediator.subscribeOnce 'modal-opened', onGuideOpened, @ + Backbone.Mediator.subscribeOnce 'modal-closed', onGuideClosed, @ return true getRenderData: ->