• I've been working on a launcher, and like everyone else, have been creating two separate apps because of the form factor differences (screen/buttons) between Bangle.js 1 and 2. I think that we need a way to make it easier to create single apps that support both models. Obviously, sometimes this is as simple as some if statements checking the hardware version. But when that isn't the case, there has to be a better way to do this where we can create a single app but it will install/run different code depending on the model it is used on instead of maintaining two copies of the same app for that reason.

    Below is my recommendation on how we could do this. In an attempt to future proof this, I have included a hypothetical Bangle.js 3 which would have a similar form factor to the real Bangle.js 2 and therefore would be able to use the same code for both models. Under Storage, I added the same supports list to the files used to install that app.

    The default value for supports is implicitly all models. This is what you would use for setting, icon, and boot files when it would be the same for all 3 models. When you explicitly list the model(s) in supports, it is only written to Storage on install for that model(s). This would allow for more code reuse and reduce app storage use on the watch.

    In the hypothetical launch app below, only one launch.app.js file is written to a BANGLEJS or BANGLEJS2/BANGLEJS3. In the hypothetical welcome app below, only one welcome.app.js file and welcome.boot.js file is written to a BANGLEJS, BANGLEJS2, or BANGLEJS3.

    Example of my proposed apps.json format for supporting this recommendation.

      {
        "id": "launch",
        "name": "Launcher (Bangle.js 1, 2, & 3)",
        "shortName": "Launcher",
        "version": "0.08",
        "description": "This is needed by Bangle.js to display a menu allowing you to choose your own applications. You can replace this with a customised launcher.",
        "icon": "app.png",
        "type": "launch",
        "tags": "tool,system,launcher",
        "supports": ["BANGLEJS","BANGLEJS2","BANGLEJS3"],
        "storage": [
            {"supports": ["BANGLEJS"],"name":"launch.app.js","url­":"app-b1.js"},
            {"supports": ["BANGLEJS2","BANGLEJS3"],"name":"launch­.app.js","url":"app.js"}
        ],
        "sortorder": -10
      },
      {
        "id": "welcome",
        "name": "Welcome (Bangle.js 1, 2, & 3)",
        "shortName": "Welcome",
        "version": "0.13",
        "description": "Appears at first boot and explains how to use Bangle.js",
        "icon": "app.png",
        "tags": "start,welcome",
        "supports": ["BANGLEJS","BANGLEJS2","BANGLEJS3"],
        "allow_emulator": true,
        "storage": [
              {"supports": ["BANGLEJS"],"name":"welcome.boot.js","u­rl":"boot-b1.js"},
              {"supports": ["BANGLEJS"],"name":"welcome.app.js","ur­l":"app-b1.js"},
              {"supports": ["BANGLEJS2"],"name":"welcome.boot.js","­url":"boot-b2.js"},
              {"supports": ["BANGLEJS2"],"name":"welcome.app.js","u­rl":"app-b2.js"},
              {"supports": ["BANGLEJS3"],"name":"welcome.boot.js","­url":"boot-b3.js"},
              {"supports": ["BANGLEJS3"],"name":"welcome.app.js","u­rl":"app-b3.js"},
              {"name":"welcome.settings.js","url":"set­tings.js"},
              {"name":"welcome.img","url":"app-icon.js­","evaluate":true}
        ],
        "data": [{"name":"welcome.json"}]
      }
    

    I hope that I did a good job of explaining this and that others think that this would be a useful improvement. Please let me know if you have any questions or suggestions.

  • Thanks - actually yes, that looks like a really good idea - and it'd avoid this mess of having to have things like launch and launchb2 apps.

    Anyone else have any thoughts? My inclination is to try and get this in as soon as possible, and then to merge welcome/launch back together before all the bangle 2s get shipped out.

  • Just added - check out the launch app (will push in a few minutes)

  • Good idea, but to be clear this is about the app loader view from the user perspective. It still allows for seperate versions of the code in the src/app directory.

    Creating a single App that supports all Bangle Js devices ideally means a single source file. That means..

    • conditional code based on hw version
    • using the layout manager
    • using tricks like g.setFont('Vector', g.getWidth()/8)
  • Yes - by far the best way is to have one app that works on both devices.

    It's just very occasionally (eg welcome/launcher) the code is just so different it doesn't make sense to have it in the same file

  • @labarks - how is the launcher coming along. I'm interested to see what it looks like. What name have you given it?

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Creating a single app that supports Bangle.js 1 and 2

Posted by Avatar for labarks @labarks

Actions