@@ -7,6 +7,7 @@ import downloadBlob from '../lib/download-blob';
77import { setProjectUnchanged } from '../reducers/project-changed' ;
88import { showStandardAlert , showAlertWithTimeout } from '../reducers/alerts' ;
99import { setFileHandle } from '../reducers/tw' ;
10+ import FileSystemAPI from '../lib/tw-filesystem-api' ;
1011import { getIsShowingProject } from '../reducers/project-state' ;
1112import log from '../lib/log' ;
1213
@@ -96,18 +97,7 @@ class SB3Downloader extends React.Component {
9697 return ;
9798 }
9899 try {
99- const handle = await this . props . showSaveFilePicker ( {
100- suggestedName : this . props . projectFilename ,
101- types : [
102- {
103- description : 'CodeTorch Project' ,
104- accept : {
105- 'application/x.scratch.sb3' : '.torch'
106- }
107- }
108- ] ,
109- excludeAcceptAllOption : true
110- } ) ;
100+ const handle = await FileSystemAPI . showSaveFilePicker ( this . props . projectFilename ) ;
111101 await this . saveToHandle ( handle ) ;
112102 this . props . onSetFileHandle ( handle ) ;
113103 const title = getProjectTitleFromFilename ( handle . name ) ;
@@ -251,7 +241,7 @@ class SB3Downloader extends React.Component {
251241 return children (
252242 this . props . className ,
253243 this . downloadProject ,
254- this . props . showSaveFilePicker ? {
244+ FileSystemAPI . available ( ) ? {
255245 available : true ,
256246 name : this . props . fileHandle ? this . props . fileHandle . name : null ,
257247 saveAsNew : this . saveAsNew ,
@@ -290,12 +280,10 @@ SB3Downloader.propTypes = {
290280 onShowSavingAlert : PropTypes . func ,
291281 onShowSaveSuccessAlert : PropTypes . func ,
292282 onShowSaveErrorAlert : PropTypes . func ,
293- onProjectUnchanged : PropTypes . func ,
294- showSaveFilePicker : PropTypes . func
283+ onProjectUnchanged : PropTypes . func
295284} ;
296285SB3Downloader . defaultProps = {
297- className : '' ,
298- showSaveFilePicker : typeof showSaveFilePicker === 'function' ? window . showSaveFilePicker . bind ( window ) : null
286+ className : ''
299287} ;
300288
301289const mapStateToProps = state => ( {
0 commit comments