Avatar for ungoosed

ungoosed

Member since Jun 2024 • Last active Jun 2024
  • 1 conversations
  • 2 comments

Got my bangle.js 2 January 2024.

Most recent activity

  • in Bangle.js
    Avatar for ungoosed

    So I was trying to sort apps into groups based on their tag, but when I try to get the tag by writing it to the launchCache it returns undefined when I try and use it. The other properties seem to work, so I'm not sure why the tags don't. I checked the .info files on my Bangle and they all have the tags property.

    
      let s = require("Storage");
      
      let launchCache = s.readJSON("launch.cache.json", true) || {};
      let launchHash = require("Storage").hash(/\.info/);
      if (launchCache.hash != launchHash) {
        launchCache = {
          hash: launchHash,
          apps: s.list(/\.info$/)
            .map(app => { var a = s.readJSON(app, 1); return a && { name: a.name, type: a.type, icon: a.icon, sortorder: a.sortorder, src: a.src, tags: a.tags}; }) // added tags: a.tags
            .filter(app => app && (app.type == "app" || (app.type == "clock" && settings.showClocks) || !app.type))
            .sort((a, b) => {
              var n = (0 | a.sortorder) - (0 | b.sortorder);
              if (n) return n; 
              if (a.name < b.name) return -1;
              if (a.name > b.name) return 1;
              return 0;
            })
        };
        s.writeJSON("launch.cache.json", launchCache);
      }
      let apps = launchCache.apps;
      apps.forEach(app => {
        if (app.icon)
          {app.icon = s.read(app.icon);}
          console.log(app.tags)//returns undefined
    
      });
    
Actions