{"id":360,"date":"2019-10-05T13:21:27","date_gmt":"2019-10-05T12:21:27","guid":{"rendered":"https:\/\/willow.systems\/?p=360"},"modified":"2019-10-05T14:37:20","modified_gmt":"2019-10-05T13:37:20","slug":"a-quick-and-dirty-dev-portal-for-the-rebble-app-store","status":"publish","type":"post","link":"https:\/\/willow.systems\/blog\/a-quick-and-dirty-dev-portal-for-the-rebble-app-store\/","title":{"rendered":"A quick and dirty dev portal for the rebble app store"},"content":{"rendered":"\n<p>The <a href=\"https:\/\/apps.rebble.io\">rebble app store <\/a>now accepts new apps, thanks to the hard work of <a href=\"https:\/\/www.joshuawise.com\/\">@Joshua<\/a> and co, and he describes the process required to submit an app <a href=\"https:\/\/github.com\/pebble-dev\/wiki\/wiki\/Preparing-a-new-app-for-the-Rebble-App-Store\">here<\/a>. Currently though, it&#8217;s a bit of a manual process. To fix that, I&#8217;ve put together <a href=\"https:\/\/willow.systems\/pebble\/dev-portal\/\">a dev portal of sorts<\/a>, in which you upload your screenshots, pbw, and more, and the SPA will auto generate the yaml and wrap everything up nicely in a .zip file, which you can then send to @Joshua on the <a href=\"https:\/\/discordapp.com\/invite\/aRUAYFN\">rebble discord<\/a> to get your app on the store.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2>Instructions for use<\/h2>\n\n\n\n<p>So you have an app you want to submit? Nice! To get started, head on over to <a href=\"https:\/\/willow.systems\/pebble\/dev-portal\/\">https:\/\/willow.systems\/pebble\/dev-portal\/<\/a>, where you&#8217;ll be greeted with any empty form. Read the heading at the top, and maybe glance at the <a href=\"https:\/\/developer.rebble.io\/developer.pebble.com\/guides\/appstore-publishing\/publishing-an-app\/index.html\">original pebble guidelines<\/a> too. Once you&#8217;ve got everything you need, simply start filling in the fields, the function of which are described below:<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><strong>Field<\/strong><\/td><td><strong>Function<\/strong><\/td><td>Required?<\/td><\/tr><tr><td><strong>App Name<\/strong><\/td><td>The name of your app, used in the store<\/td><td>Yes<\/td><\/tr><tr><td><strong>Website URL<\/strong><\/td><td>The address of the author&#8217;s website, will be displayed in the store<\/td><td>No<\/td><\/tr><tr><td><strong>Source URL<\/strong><\/td><td>The address of the source code repository, will be displayed in the store<\/td><td>No<\/td><\/tr><tr><td><strong>App Type<\/strong><\/td><td>Is it a watchface or watch app?<\/td><td>Yes<\/td><\/tr><tr><td><strong>Category<\/strong><\/td><td>The category the watch app fits into. This is only for watchapps, not faces. See the <a href=\"https:\/\/developer.rebble.io\/developer.pebble.com\/guides\/appstore-publishing\/publishing-an-app\/index.html\">original pebble guidelines<\/a> for a description of the categories.<\/td><td>Yes (If watchapp)<\/td><\/tr><tr><td><strong>App Description<\/strong><\/td><td>A description of the app and it&#8217;s functions<\/td><td>Yes<\/td><\/tr><tr><td><strong>Release Notes<\/strong><\/td><td>A description of the changes for this release only<\/td><td>Yes<\/td><\/tr><tr><td><strong>Large Icon<\/strong><\/td><td>A large app icon, used in the rebble store<\/td><td>Yes<\/td><\/tr><tr><td><strong>Small Icon<\/strong><\/td><td>A small icon used in the app&#8217;s profile<\/td><td>Yes<\/td><\/tr><tr><td><strong>Screenshots<\/strong><\/td><td>At least one screenshot of the watchapp. By default the same screenshots are used for every platform, but you can use the toggle to provide platform specific screenshots.<\/td><td>Yes<\/td><\/tr><tr><td><strong>Appstore Banner<\/strong><\/td><td>The title banner that&#8217;s used in the appstore. Currently only 1 is supported.<\/td><td>Yes<br><\/td><\/tr><tr><td><strong>The pbw<\/strong><\/td><td>The .pbw file for the app<\/td><td>Yes<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>Once you&#8217;ve filled those out, simply press the button at the bottom to generate a .zip file:<\/p>\n\n\n\n<div onclick=\"alert('No, this is just a picture of the button')\" class=\"wp-block-image\"><figure class=\"aligncenter\"><img src=\"https:\/\/i.imgur.com\/H2ejK5t.png\" alt=\"\"><\/figure><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Any missing fields or issues will appear as messages in the button itself, but if everything is there, your browser should download a .zip file with the .yaml file and all the resources, which you should then send to @Joshua to be uploaded the the rebble store.<\/p>\n\n\n\n<h2>How it works<\/h2>\n\n\n\n<p>I built the dev portal in a couple of hours a few weeks ago, it uses some cool libraries to do all of the generation client side. <a href=\"https:\/\/stuk.github.io\/jszip\/\">JSZip<\/a> is the library used to create the zip files, the code is really simple:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var zip = new JSZip();\n\n zip.file(\"build.yaml\", yaml);\n zip.file(pbwfile, app.pbw, {base64: true})\n\n var ban = zip.folder(\"banners\");\n ban.file(\"Banner.png\", app.header, {base64: true});\n\n...\n\nzip.generateAsync({type:\"blob\"}).then(function(content) {\n    \/\/ see FileSaver.js\n    saveAs(content, app.title.replace(\/\\s\/g,'') + \".zip\");\n});<\/code><\/pre>\n\n\n\n<p><a href=\"https:\/\/github.com\/eligrey\/FileSaver.js\/\">Filesaver.js<\/a> handles the .zip download and exposes the handy saveAs() function.<\/p>\n\n\n\n<p>The YAML is generated manually, because I didn&#8217;t see the need to add another dependency. If I cared about code readability more maybe I would have used one of the many JSON-to-YAML libraries out there to convert the JSON object directly to YAML. As it stands, the code for the yaml looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yaml = yaml + \"pbw_file: \" + pbwfile + \"\\n\"\n  yaml = yaml + \"header: banners\/Banner.png\\n\"\n  yaml = yaml + \"description: |\\n\" + app.description + \"\\n\"\n  yaml = yaml + \"assets:\\n\"\n  yaml = yaml + \"-\\n\"\n  yaml = yaml + \"  name: aplite\\n\"\n  yaml = yaml + \"  screenshots:\\n\"\n  for (var i = 0; i &lt; app.screenshots.aplite.length; i++) {\n    yaml = yaml + \"    - screenshots\/screenshot-aplite-\" + i + \".png\\n\"\n  }\n....<\/code><\/pre>\n\n\n\n<p>which is a bit gross, but it works. <\/p>\n\n\n\n<p>The code is <a href=\"https:\/\/github.com\/Willow-Systems\/psuedo-dev-portal\">available on Github<\/a>, all the good stuff happens in main.js. The bulk of the code is sanity checking. There&#8217;s probably a library out there which would avoid all the jquery if statements, but hey.<\/p>\n\n\n\n<h2>Questions on a postcard<\/h2>\n\n\n\n<p>It&#8217;s a somewhat hacky solution, but it removes the need to write YAML by hand so it&#8217;s a win in my book. If you run in to any problems, leave a comment below of reach out to me (@Will0) on the rebble discord.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The rebble app store now accepts new apps, thanks to the hard work of @Joshua and co, and he describes the process required to submit an app here. Currently though, it&#8217;s a bit of a &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[5],"_links":{"self":[{"href":"https:\/\/willow.systems\/blog\/wp-json\/wp\/v2\/posts\/360"}],"collection":[{"href":"https:\/\/willow.systems\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/willow.systems\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/willow.systems\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/willow.systems\/blog\/wp-json\/wp\/v2\/comments?post=360"}],"version-history":[{"count":21,"href":"https:\/\/willow.systems\/blog\/wp-json\/wp\/v2\/posts\/360\/revisions"}],"predecessor-version":[{"id":412,"href":"https:\/\/willow.systems\/blog\/wp-json\/wp\/v2\/posts\/360\/revisions\/412"}],"wp:attachment":[{"href":"https:\/\/willow.systems\/blog\/wp-json\/wp\/v2\/media?parent=360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/willow.systems\/blog\/wp-json\/wp\/v2\/categories?post=360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/willow.systems\/blog\/wp-json\/wp\/v2\/tags?post=360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}