@@ -81,28 +81,31 @@ export class CoreFileProvider {
8181
8282 this . logger = logger . getInstance ( 'CoreFileProvider' ) ;
8383
84- if ( appProvider . isAndroid ( ) && ! Object . getOwnPropertyDescriptor ( FileReader . prototype , 'onloadend' ) ) {
85- // Cordova File plugin creates some getters and setter for FileReader, but Ionic's polyfills override them in Android.
86- // Create the getters and setters again. This code comes from FileReader.js in cordova-plugin-file.
87- this . defineGetterSetter ( FileReader . prototype , 'readyState' , function ( ) : any {
88- return this . _localURL ? this . _readyState : this . _realReader . readyState ;
89- } ) ;
84+ platform . ready ( ) . then ( ( ) => {
85+ if ( appProvider . isAndroid ( ) && ! Object . getOwnPropertyDescriptor ( FileReader . prototype , 'onloadend' ) ) {
86+ // Cordova File plugin creates some getters and setter for FileReader, but
87+ // Ionic's polyfills override them in Android.
88+ // Create the getters and setters again. This code comes from FileReader.js in cordova-plugin-file.
89+ this . defineGetterSetter ( FileReader . prototype , 'readyState' , function ( ) : any {
90+ return this . _localURL ? this . _readyState : this . _realReader . readyState ;
91+ } ) ;
9092
91- this . defineGetterSetter ( FileReader . prototype , 'error' , function ( ) : any {
92- return this . _localURL ? this . _error : this . _realReader . error ;
93- } ) ;
93+ this . defineGetterSetter ( FileReader . prototype , 'error' , function ( ) : any {
94+ return this . _localURL ? this . _error : this . _realReader . error ;
95+ } ) ;
9496
95- this . defineGetterSetter ( FileReader . prototype , 'result' , function ( ) : any {
96- return this . _localURL ? this . _result : this . _realReader . result ;
97- } ) ;
97+ this . defineGetterSetter ( FileReader . prototype , 'result' , function ( ) : any {
98+ return this . _localURL ? this . _result : this . _realReader . result ;
99+ } ) ;
98100
99- this . defineEvent ( 'onloadstart' ) ;
100- this . defineEvent ( 'onprogress' ) ;
101- this . defineEvent ( 'onload' ) ;
102- this . defineEvent ( 'onerror' ) ;
103- this . defineEvent ( 'onloadend' ) ;
104- this . defineEvent ( 'onabort' ) ;
105- }
101+ this . defineEvent ( 'onloadstart' ) ;
102+ this . defineEvent ( 'onprogress' ) ;
103+ this . defineEvent ( 'onload' ) ;
104+ this . defineEvent ( 'onerror' ) ;
105+ this . defineEvent ( 'onloadend' ) ;
106+ this . defineEvent ( 'onabort' ) ;
107+ }
108+ } ) ;
106109 }
107110
108111 /**
0 commit comments