apps.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. const iPhoneBackup = require('../util/iphone_backup.js').iPhoneBackup
  2. module.exports.name = 'apps'
  3. module.exports.description = 'List all installed applications and container IDs.'
  4. // Specify this reporter requires a backup.
  5. // The second parameter to func() is now a backup instead of the path to one.
  6. module.exports.requiresBackup = true
  7. // Specify this reporter supports the promises API for allowing chaining of reports.
  8. module.exports.usesPromises = true
  9. module.exports.func = function (program, backup, resolve, reject) {
  10. if (!backup.manifest) return reject(new Error('Manifest does not exist in this version'))
  11. // Enumerate the apps in the backup
  12. var apps = []
  13. for (var key in backup.manifest.Applications) {
  14. var app = backup.manifest.Applications[key]
  15. apps.push({ bundleID: app.CFBundleIdentifier, path: app.Path})
  16. }
  17. var result = program.formatter.format(apps, {
  18. program: program,
  19. columns: {
  20. 'Bundle ID': el => el.bundleID,
  21. 'Bundle Path': el => el.path
  22. }
  23. })
  24. resolve(result)
  25. }