11import * as G from 'typings/graphql'
22import * as CR from 'typings'
33import * as git from '../../services/git'
4+ import { machine } from '../../extension'
45import * as storage from '../storage'
56import api from '../api'
67import tutorialQuery from '../../services/api/gql/getTutorial'
@@ -60,13 +61,16 @@ class Tutorial implements TutorialModel {
6061// })
6162
6263}
63- public async launch ( tutorialId :string ) {
64+ public launch = async ( tutorialId :string ) => {
6465console . log ( 'launch tutorial' )
66+ machine . send ( 'TUTORIAL_START' )
6567
6668const { tutorial} :{ tutorial :G . Tutorial | null } = await api . request ( tutorialQuery , {
6769tutorialId, // TODO: add selection of tutorial id
6870} )
6971
72+ console . log ( 'tutorial' , tutorial )
73+
7074if ( ! tutorial ) {
7175throw new Error ( `Tutorial${ tutorialId } not found` )
7276}
@@ -83,6 +87,8 @@ class Tutorial implements TutorialModel {
8387}
8488// version containing level data
8589this . version = tutorial . version
90+ console . log ( 'version' , this . version )
91+
8692// set initial position
8793this . position = {
8894levelId :this . version . levels [ 0 ] . id ,
@@ -112,7 +118,9 @@ class Tutorial implements TutorialModel {
112118storage . setPosition ( this . position ) ,
113119storage . setProgress ( this . progress )
114120] )
115- // machine.send('TUTORIAL_LOADED')
121+
122+ console . log ( 'tutorial loaded' )
123+ machine . send ( 'TUTORIAL_LOADED' )
116124}
117125
118126public async hasExisting ( ) :Promise < boolean > {