1
+ // @flow
1
2
import React , { Component } from 'react' ;
2
3
import Dialog from '../../UI/Dialog' ;
3
4
import FlatButton from 'material-ui/FlatButton' ;
@@ -9,9 +10,11 @@ import { findGDJS } from './LocalGDJSFinder';
9
10
import localFileSystem from './LocalFileSystem' ;
10
11
import LocalFolderPicker from '../../UI/LocalFolderPicker' ;
11
12
import HelpButton from '../../UI/HelpButton' ;
12
- import { displaySanityCheck } from '../SanityChecker' ;
13
- import { getSanityMessages } from '../SanityChecker/ProjectSanityChecker' ;
14
- import { translate } from 'react-i18next' ;
13
+ import {
14
+ displayProjectErrorsBox ,
15
+ getErrors ,
16
+ } from '../../ProjectManager/ProjectErrorsChecker' ;
17
+ import { translate , type TranslatorProps } from 'react-i18next' ;
15
18
import assignIn from 'lodash/assignIn' ;
16
19
import optionalRequire from '../../Utils/OptionalRequire' ;
17
20
import Window from '../../Utils/Window' ;
@@ -20,7 +23,16 @@ const shell = electron ? electron.shell : null;
20
23
21
24
const gd = global . gd ;
22
25
23
- class LocalCordovaExport extends Component {
26
+ type Props = TranslatorProps & { |
27
+ project : gdProject ,
28
+ | } ;
29
+
30
+ type State = { |
31
+ outputDir : string ,
32
+ exportFinishedDialogOpen : boolean ,
33
+ | } ;
34
+
35
+ class LocalCordovaExport extends Component < Props , State > {
24
36
state = {
25
37
exportFinishedDialogOpen : false ,
26
38
outputDir : '' ,
@@ -61,7 +73,7 @@ class LocalCordovaExport extends Component {
61
73
62
74
sendExportLaunched ( 'local-cordova' ) ;
63
75
64
- if ( ! displaySanityCheck ( t , getSanityMessages ( t , project ) ) ) return ;
76
+ if ( ! displayProjectErrorsBox ( t , getErrors ( t , project ) ) ) return ;
65
77
66
78
const outputDir = this . state . outputDir ;
67
79
project . setLastCompilationDirectory ( outputDir ) ;
@@ -70,14 +82,10 @@ class LocalCordovaExport extends Component {
70
82
. then ( ( { exporter } ) => {
71
83
const exportOptions = new gd . MapStringBoolean ( ) ;
72
84
exportOptions . set ( 'exportForCordova' , true ) ;
73
- exporter . exportWholePixiProject (
74
- project ,
75
- outputDir ,
76
- exportOptions
77
- ) ;
85
+ exporter . exportWholePixiProject ( project , outputDir , exportOptions ) ;
78
86
exportOptions . delete ( ) ;
79
87
exporter . delete ( ) ;
80
-
88
+
81
89
this . setState ( {
82
90
exportFinishedDialogOpen : true ,
83
91
} ) ;
@@ -88,7 +96,7 @@ class LocalCordovaExport extends Component {
88
96
} ;
89
97
90
98
openExportFolder = ( ) => {
91
- shell . openItem ( this . state . outputDir ) ;
99
+ if ( shell ) shell . openItem ( this . state . outputDir ) ;
92
100
} ;
93
101
94
102
openPhoneGapBuild = ( ) => {
0 commit comments