Skip to content

Commit

Permalink
Added unzip
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonash committed Aug 30, 2018
1 parent 454a448 commit 607c640
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
16 changes: 10 additions & 6 deletions www/app/maps/offline-maps/archive-tiles.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,10 @@
vm.map.progress.message = response.data.error;
vm.map.percentDownload = 100;
}else{
vm.map.progress.message = response.data.status;
vm.map.percentDownload = response.data.percent;
if(vm.map.progress.message != 'Downloading Zip File...') {
vm.map.progress.message = response.data.status;
vm.map.percentDownload = response.data.percent;
}
}


Expand All @@ -300,13 +302,15 @@
if(vm.tryCount <= 200 && vm.map.progress.message!='Zip File Ready.' && vm.map.zipError==''){
$timeout(arguments.callee, 1000);
}else{
vm.map.progress.message = 'Downloading Zip File...';
OfflineTilesFactory.downloadZip(vm.zipUID,vm.map.mapid).then(function () {
$ionicPopup.alert({
'title': 'Testing!',
'template': 'Download done!'
LocalStorageFactory.unzipFile(vm.map.mapid).then(function (){
$ionicPopup.alert({
'title': 'Testing!',
'template': 'Zip File unzipped!'
});
});
});

}
}
}
Expand Down
13 changes: 12 additions & 1 deletion www/app/shared/localstorage.factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
'getDb': getDb,
'importImages': importImages,
'importProject': importProject,
'setupLocalforage': setupLocalforage
'setupLocalforage': setupLocalforage,
'unzipFile': unzipFile
};


Expand Down Expand Up @@ -231,6 +232,16 @@
return exportData(zipsDirectory, data, fileName)
}

function unzipFile(mapid) {
var deferred = $q.defer(); // init promise
$log.log(zipsDirectory+'/'+mapid+'.zip to '+zipsDirectory+'/');
zip.unzip(zipsDirectory+'/'+mapid+'.zip', zipsDirectory+'/', function(returnvar){
deferred.resolve();
alert('done.'+returnvar);
});
return deferred.promise;
}

function exportImages() {
var deferred = $q.defer(); // init promise
var promises = [];
Expand Down

0 comments on commit 607c640

Please sign in to comment.