@@ -84,8 +84,12 @@ export class Tab1Page {
8484 return ;
8585 }
8686
87+ const options = {
88+ maximumImagesCount : 100
89+ } ;
90+
8791 try {
88- const uris : Array < string > = await this . imagePicker . getPictures ( { } ) ;
92+ const uris : Array < string > = await this . imagePicker . getPictures ( options ) ;
8993 const generatedKeys = this . generateUniqueIds ( uris . length ) ;
9094 console . log ( uris ) ;
9195 uris . forEach ( ( uri , i ) => {
@@ -140,19 +144,46 @@ export class Tab1Page {
140144 }
141145 }
142146
143- uploadImage ( id : number ) {
144- const uri = this . imageUris . get ( id ) ;
145- console . log ( 'Upload id' , id ) ;
147+ onTapUploadButton ( ) {
148+ for ( const id of this . uploadStates . keys ( ) ) {
149+ if ( ! this . uploadStates . has ( id ) ) {
150+ // Start upload
151+ this . uploadImage ( id ) ;
152+ } else {
153+ // Remove download
154+ const state = this . uploadStates . get ( id ) ;
155+ this . uploader . removeUpload ( id , ( res ) => {
156+ console . log ( 'Remove result:' , res ) ;
157+ this . zone . run ( ( ) => {
158+ state . status = UploadStatus . Aborted ;
159+ state . progress = 1.0 ;
160+ } ) ;
161+ } , async ( err ) => {
162+ console . warn ( 'Remove error:' , err ) ;
163+ const alert = await this . alertController . create ( {
164+ header : 'Error removing upload' ,
165+ } ) ;
166+ await alert . present ( ) ;
167+ } ) ;
168+ }
169+ }
170+ }
146171
147- const options = {
148- serverUrl : 'https://zfir.ngrok.io' ,
149- filePath : uri ,
150- fileKey : 'file' ,
151- id,
152- notificationTitle : 'Uploading image'
153- } ;
154- this . uploader . startUpload ( options ) ;
155- console . log ( 'Upload submitted' ) ;
172+ uploadImage ( id : number ) {
173+ for ( let i = 0 ; i < 10 ; i ++ ) {
174+ const uri = this . imageUris . get ( id ) ;
175+ console . log ( 'Upload id' , id ) ;
176+
177+ const options = {
178+ serverUrl : 'https://zfir.ngrok.io' ,
179+ filePath : uri ,
180+ fileKey : 'file' ,
181+ id,
182+ notificationTitle : 'Uploading image'
183+ } ;
184+ this . uploader . startUpload ( options ) ;
185+ console . log ( 'Upload submitted' ) ;
186+ }
156187 }
157188
158189 generateUniqueIds ( count : number ) : Array < number > {
0 commit comments