[Ionic Deploy] How can I determine the currently installed App snapshot?


#1

Hello,

I implemented Ionic deploy in a Ionic v1.3 App I’m working on and (so far) everything works great.

However, I’m hitting a wall when I want to delete all snapshots that are currently stored on the device except the one that is currently installed.

According to the docs the following command gives me only an unorderd array of snapshot uuids that are currently present on the device.

$ionicDeploy.getSnapshots().then(function(snapshots) {
// snapshots will be an array of snapshot uuids
});

So since the uuids are unorderd, there is no way for me to determine which uuid represents the currently installed snapshot.

I could load the metadata for each snapshot given it’s uuid using this command:

$ionicDeploy.getMetadata(uuid).then(function(metadata) {
// use metadata
});

Howerver, this would only make sense if I manually added a particular metadatum to the snapshot via the Ionic cloud web GUI, that somehow identifies the currently installed snapshot. This however, is itself very error prone in my opinion (I or a colleague of mine could forget to add it etc.) and therfore also not really an option.

So is there a way to determine with 100% accuracy which one of the currently present snapshots on the device is the currently installed one?

Regards and thanks, Matthias


#2