diff --git a/src/pages/blockly/blockly.module.ts b/src/pages/blockly/blockly.module.ts index 5cce705..f8500c8 100644 --- a/src/pages/blockly/blockly.module.ts +++ b/src/pages/blockly/blockly.module.ts @@ -3,6 +3,7 @@ import { IonicPageModule } from 'ionic-angular'; import { TranslateModule } from '@ngx-translate/core'; import { BlocklyPage } from './blockly'; +import { LoggingProvider } from '../../providers/logging/logging'; @NgModule({ declarations: [ @@ -12,5 +13,8 @@ import { BlocklyPage } from './blockly'; TranslateModule, IonicPageModule.forChild(BlocklyPage) ], + providers: [ + LoggingProvider, + ] }) export class BlocklyPageModule {} diff --git a/src/pages/blockly/blockly.ts b/src/pages/blockly/blockly.ts index 71259ea..2b3be10 100644 --- a/src/pages/blockly/blockly.ts +++ b/src/pages/blockly/blockly.ts @@ -4,6 +4,7 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular'; import { TranslateService } from '@ngx-translate/core'; import { OtaWizardPage } from '../ota-wizard/ota-wizard'; +import { LoggingProvider } from '../../providers/logging/logging'; @IonicPage() @Component({ @@ -15,13 +16,16 @@ export class BlocklyPage { blocklyUrl: SafeResourceUrl private messageHandler: (ev: IframePostMessageEvent) => void + private log: LoggingProvider constructor( public navCtrl: NavController, public navParams: NavParams, private sanitizer: DomSanitizer, + logger: LoggingProvider, translate: TranslateService, ) { + this.log = logger.createChild('BlocklyPage') this.blocklyUrl = this.buildBlocklyUrl(translate.currentLang) // need to assign it here to keep the function reference for unsubscribing again @@ -30,6 +34,7 @@ export class BlocklyPage { const { type, data } = ev.data; switch (type) { case 'sketch': + this.log.debug('sketch received, launching ota wizard page', { sketch: data }) this.navCtrl.push(OtaWizardPage, { sketch: data }) break default: @@ -44,10 +49,12 @@ export class BlocklyPage { } launchOtaWizard () { + this.log.debug('clicked launch ota') this.blocklyFrame.nativeElement.contentWindow.postMessage('getSketch', '*') } toggleView () { + this.log.debug('clicked toggle view') this.blocklyFrame.nativeElement.contentWindow.postMessage('toggleView', '*') }