1+ import i18n from '../i18n/index' ;
2+
13class CoderBot {
24 constructor ( CB , APIv1 , APIv2 , axios , store ) {
35 this . CB = CB + APIv2 ;
46 this . CBv1 = CB + APIv1 ;
57 this . $axios = axios ;
68 this . $store = store ;
9+ this . $i18n = i18n ;
10+ this . initActivity ( ) ;
711 }
812
913 load ( ) {
@@ -13,6 +17,89 @@ class CoderBot {
1317 return Promise . all ( [ p1 , p2 , p3 ] ) ;
1418 }
1519
20+ initActivity ( ) {
21+ this . loadActivity ( null , true ) . then ( ( activity ) => {
22+ if ( activity . data == '' ) {
23+ const toolbox_full = require ( '../assets/toolbox_adv.json' ) ;
24+ const defaultActivity = {
25+ stock : true ,
26+ default : true ,
27+ uiLang : 'browser' ,
28+ defaultView : null ,
29+ exec : {
30+ camera : true ,
31+ log : false
32+ } ,
33+ name : 'default' ,
34+ drawerEnabled : true ,
35+ showName : true ,
36+ description : '' ,
37+ fontSize : 'Medio' ,
38+ capsSwitch : true ,
39+ bodyFont : 'Roboto' ,
40+ codeFont : 'ubuntumono' ,
41+ maxBlocks : 0 ,
42+ availableViews : [ ] ,
43+ viewSource : null ,
44+ autoRecVideo : null ,
45+ toolbox : null ,
46+ buttons : [
47+ {
48+ action : 'clearProgramDlg' ,
49+ icon : 'clear' ,
50+ label : this . $i18n . t ( 'message.activity_program_clear' ) ,
51+ type : 'text' ,
52+ } ,
53+ {
54+ action : 'saveProgram' ,
55+ icon : 'save' ,
56+ label : this . $i18n . t ( 'message.activity_program_save' ) ,
57+ type : 'text' ,
58+ } ,
59+ {
60+ action : 'toggleSaveAs' ,
61+ icon : 'edit' ,
62+ label : this . $i18n . t ( 'message.activity_program_save_as' ) ,
63+ type : 'text' ,
64+ } ,
65+ {
66+ action : 'loadProgramList' ,
67+ icon : 'folder_open' ,
68+ label : this . $i18n . t ( 'message.activity_program_load' ) ,
69+ type : 'text' ,
70+ } ,
71+ {
72+ action : 'runProgram' ,
73+ icon : 'play_arrow' ,
74+ label : this . $i18n . t ( 'message.activity_program_run' ) ,
75+ type : 'text' ,
76+ } ,
77+ {
78+ action : 'getProgramCode' ,
79+ icon : 'code' ,
80+ label : this . $i18n . t ( 'message.activity_program_show_code' ) ,
81+ type : 'text' ,
82+ } ,
83+ {
84+ action : 'exportProgram' ,
85+ icon : 'fa-file-export' ,
86+ label : this . $i18n . t ( 'message.activity_program_export' ) ,
87+ type : 'text' ,
88+ } ,
89+ {
90+ action : 'pickFile' ,
91+ icon : 'fa-file-import' ,
92+ label : this . $i18n . t ( 'message.activity_program_import' ) ,
93+ type : 'text' ,
94+ }
95+ ]
96+ } ;
97+ defaultActivity . toolbox = toolbox_full ;
98+ this . saveActivity ( defaultActivity ) ;
99+ }
100+ } ) ;
101+ }
102+
16103 async loadMusicPackages ( ) {
17104 const result = await this . $axios . get ( `${ this . CB } /listMusicPackages` ) ;
18105 const packagesInstalled = [ ] ;
0 commit comments