notes.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. const stripAnsi = require('strip-ansi')
  2. const iPhoneBackup = require('../util/iphone_backup.js').iPhoneBackup
  3. const normalizeCols = require('../util/normalize.js')
  4. module.exports.name = 'notes'
  5. module.exports.description = 'List all iOS notes'
  6. // Specify this only works for iOS 10+
  7. module.exports.supportedVersions = '>=9.0'
  8. // Specify this reporter requires a backup.
  9. // The second parameter to func() is now a backup instead of the path to one.
  10. module.exports.requiresBackup = true
  11. // Specify this reporter supports the promises API for allowing chaining of reports.
  12. module.exports.usesPromises = true
  13. module.exports.func = function (program, backup, resolve, reject) {
  14. backup.getNotes(program.dump)
  15. .then((items) => {
  16. // Format the output
  17. var result = program.formatter.format(items, {
  18. program: program,
  19. columns: {
  20. 'Modified': el => (el.XFORMATTEDDATESTRING || el.XFORMATTEDDATESTRING1) + '',
  21. 'ID': el => el.Z_PK,
  22. 'Title2': el => (el.ZTITLE2 + '').trim().substring(0, 128),
  23. 'Title1': el => (el.ZTITLE1 + '').trim() || ''
  24. }
  25. })
  26. resolve(result)
  27. })
  28. .catch(reject)
  29. }