diff --git a/app/app.js b/app/app.js index 355c16e..0cb3dd6 100644 --- a/app/app.js +++ b/app/app.js @@ -17,6 +17,15 @@ function previousPage(currentPageID) { } } +function sdkNextPage(currentPageID) { + currentPageID++; + if (currentPageID == 3) { + window.location.href = `../${pages[currentPageID]}/index.html`; + } else if (currentPageID < pages.length) { + window.location.href = `../sdk_${pages[currentPageID]}/index.html`; + } +} + function closeWindow() { var window = remote.getCurrentWindow(); window.close(); diff --git a/app/download/index.html b/app/download/index.html index c9e7be4..b389dbf 100644 --- a/app/download/index.html +++ b/app/download/index.html @@ -20,6 +20,7 @@
+ Flutter Logo
These components will be downloaded:
diff --git a/app/finish/index.html b/app/finish/index.html index b5cda9e..6cf1c7c 100644 --- a/app/finish/index.html +++ b/app/finish/index.html @@ -19,18 +19,25 @@
+ Flutter Logo
Installation Successful
-

We've successfully installed Flutter SDK on your PC. If you feedback for the utility or if you want - to contribute, visit the repository on Flutter SDK was successfully installed on your PC. To give feedback, suggestions or contribute to the installer please visit the repository on GitHub.

+

+ To install additional SDK Tools refer to the Android sdkmanager documentation here. +

+
-

Flutter, Android and the related logos are trademarks of Google LLC.

+

Flutter, Android and the related logos are trademarks of Google LLC.
Visual + Studio and the related logos are trademarks of Microsoft Corporation.

diff --git a/app/home/index.html b/app/home/index.html index cc23dea..1493f39 100644 --- a/app/home/index.html +++ b/app/home/index.html @@ -19,16 +19,33 @@
-
-

Does not install Android Studio.
Installs minimal - amount - of components to build Flutter applications with Visual Studio Code.

+

+ Choose Install SDK Only if you already have Android Studio installed. +

+
+
diff --git a/app/install/index.html b/app/install/index.html index 0479195..8ceba40 100644 --- a/app/install/index.html +++ b/app/install/index.html @@ -20,6 +20,7 @@
+ Flutter Logo
Extracting components:
@@ -45,6 +46,11 @@
Extracting components:
done +
  • + Installing SDK Tools: API 28     +
    + done +
  • @@ -52,7 +58,7 @@
    Extracting components:
    - Next
    diff --git a/app/install/install.js b/app/install/install.js index e6a8c3f..12bfff8 100644 --- a/app/install/install.js +++ b/app/install/install.js @@ -5,15 +5,14 @@ const exec = util.promisify(require('child_process').exec); const extract = require('extract-zip'); -const folder = "D:\\Android"; +const folder = "C:\\Android"; // Set this constant to `true` while debugging // Should always be `false` while building a release -const debug = true; +const debug = false; function installComponents() { var urls; - var jdkDirName; dwn.getURLs('https://raw.githubusercontent.com/sampathbalivada/flutter_installer/master/urls.json?token=AGLFFNEZK75GHLTNLMTQOR26X57GO') .then((fetchedURLs) => { urls = fetchedURLs; @@ -27,6 +26,9 @@ function installComponents() { return; } var fileName = dwn.getFilenameFromUrl(urls['command-line-tools']) + if (fs.existsSync(folder + "\\cmdline-tools\\latest")) { + return + } return extract(folder + "\\" + fileName, { dir: folder + "\\cmdline-tools" }); @@ -44,6 +46,9 @@ function installComponents() { return; } var fileName = dwn.getFilenameFromUrl(urls['jdk']); + if (fs.existsSync(folder + "\\openjdk")) { + return + } return extract(folder + "\\" + fileName, { dir: folder }); @@ -61,6 +66,9 @@ function installComponents() { return; } var fileName = dwn.getFilenameFromUrl(urls['flutter-sdk']) + if (fs.existsSync(folder + "\\flutter")) { + return + } return extract(folder + "\\" + fileName, { dir: folder }); @@ -84,17 +92,22 @@ function renameDirectories() { document.getElementById('progress-bar').value = 80; addComponentsToPath(); } else { - fs.renameSync(folder + "\\cmdline-tools\\tools", folder + "\\cmdline-tools\\latest"); - fs.readdir(folder, (err, files) => { - files.forEach((name) => { - if (name.substr(0, 3) == 'jdk') { - jdkDirName = name; - fs.renameSync(folder + "\\" + name, folder + "\\openjdk"); - document.getElementById('progress-bar').value = 80; - addComponentsToPath(); - } + if (!fs.existsSync(folder + "\\cmdline-tools\\latest")) { + fs.renameSync(folder + "\\cmdline-tools\\tools", folder + "\\cmdline-tools\\latest"); + } + if (!fs.existsSync(folder + "\\openjdk")) { + //find JDK folder in the directory and rename + fs.readdir(folder, (err, files) => { + files.forEach((name) => { + if (name.substr(0, 3) == 'jdk') { + jdkDirName = name; + fs.renameSync(folder + "\\" + name, folder + "\\openjdk"); + } + }); }); - }); + } + document.getElementById('progress-bar').value = 80; + addComponentsToPath(); } } @@ -103,7 +116,9 @@ function addComponentsToPath() { document.getElementById('progress-bar').value = 100; document.getElementById('path-loader').style.display = 'none'; document.getElementById('path-done').style.visibility = 'visible'; - enableFinish(); + document.getElementById('tools-loader').style.visibility = 'visible'; + + installSDKComponents(); return } else { exec('setx ANDROID_HOME "C:\\Android\\') @@ -130,13 +145,33 @@ function addComponentsToPath() { } document.getElementById('path-loader').style.display = 'none'; document.getElementById('path-done').style.visibility = 'visible'; - document.getElementById('progress-bar').value = 100; + document.getElementById('tools-loader').style.visibility = 'visible'; + document.getElementById('progress-bar').value = 95; + + installSDKComponents(); + }) + } +} + +function installSDKComponents() { + if (debug) { + document.getElementById('progress-bar').value = 100; + document.getElementById('tools-loader').style.display = 'none'; + document.getElementById('tools-done').style.visibility = 'visible'; + enableNext(); + return + } else { + exec('sdkmanager "platform-tools" "platforms;android-28" "build-tools;28.0.3"') + .then(() => { + document.getElementById('tools-loader').style.display = 'none'; + document.getElementById('tools-done').style.visibility = 'visible'; + enableNext(); }) } } -function enableFinish(params) { - document.getElementById('finish-button').classList.remove('disabled'); +function enableNext(params) { + document.getElementById('next-button').classList.remove('disabled'); } // Comment this line while debugging. diff --git a/app/sdk_download/download.js b/app/sdk_download/download.js new file mode 100644 index 0000000..3e79f00 --- /dev/null +++ b/app/sdk_download/download.js @@ -0,0 +1,43 @@ +const fs = require('fs'); +const dwn = require('../download-helper'); + +function startDownload() { + var download_button = document.getElementById('download-button'); + var urls; + var downloadPath = "C:\\Android"; + const progressIndicator = document.getElementById('progress-bar'); + download_button.onclick = ''; + download_button.classList.add("disabled"); + dwn.getURLs('https://raw.githubusercontent.com/sampathbalivada/flutter_installer/master/urls.json?token=AGLFFNEZK75GHLTNLMTQOR26X57GO') + .then((fetchedURLs) => { + urls = fetchedURLs; + showFileNames(urls); + + //Downloading Flutter SDK + document.getElementById('sdk-loader').style.visibility = 'visible'; + var finalPath = downloadPath + "\\" + dwn.getFilenameFromUrl(urls['flutter-sdk']); + if (fs.existsSync(finalPath)) { + return + } + return dwn.downloadFile({ + remoteFile: urls['flutter-sdk'], + localFile: finalPath, + onProgress: function (received, total) { + var percentage = (received * 100) / total; + progressIndicator.value = percentage; + } + }) + }) + .then(() => { + document.getElementById('sdk-loader').style.display = 'none'; + document.getElementById('sdk-done').style.visibility = 'visible'; + progressIndicator.value = 100; + download_button.classList.remove("disabled"); + download_button.innerHTML = 'Install Components'; + download_button.setAttribute('onclick', 'sdkNextPage(1)'); + }) +} + +function showFileNames(urls) { + document.getElementById('sdk-name').innerHTML += dwn.getFilenameFromUrl(urls['flutter-sdk']); +} \ No newline at end of file diff --git a/app/sdk_download/index.html b/app/sdk_download/index.html new file mode 100644 index 0000000..21f44d0 --- /dev/null +++ b/app/sdk_download/index.html @@ -0,0 +1,50 @@ + + + + + + + Flutter Installer + + + + + + + +
    + +
    + +
    +
    + Flutter Logo +
    +
    The Flutter SDK will be downloaded:
    +
    +
    +
      +
    • + Flutter SDK     +
      + done +

      version:

      +
    • +
    +
    + +
    + +
    + + + + + + + \ No newline at end of file diff --git a/app/sdk_install/index.html b/app/sdk_install/index.html new file mode 100644 index 0000000..36e7e6d --- /dev/null +++ b/app/sdk_install/index.html @@ -0,0 +1,53 @@ + + + + + + + Flutter Installer + + + + + + + +
    + +
    + +
    +
    + Flutter Logo +
    +
    Extracting components:
    +
    +
    +
      +
    • + Flutter SDK     +
      + done +
    • +
    • + Adding components to Windows PATH     +
      + done +
    • +
    +
    +
    +
    + + +
    + Next +
    + + + + + \ No newline at end of file diff --git a/app/sdk_install/install.js b/app/sdk_install/install.js new file mode 100644 index 0000000..f07d614 --- /dev/null +++ b/app/sdk_install/install.js @@ -0,0 +1,79 @@ +const fs = require('fs'); +const dwn = require('../download-helper'); +const util = require('util'); +const exec = util.promisify(require('child_process').exec); + +const extract = require('extract-zip'); + +const folder = "C:\\Android"; + +// Set this constant to `true` while debugging +// Should always be `false` while building a release +const debug = false; + +function installComponents() { + var urls; + dwn.getURLs('https://raw.githubusercontent.com/sampathbalivada/flutter_installer/master/urls.json?token=AGLFFNEZK75GHLTNLMTQOR26X57GO') + .then((fetchedURLs) => { + urls = fetchedURLs; + + // Show loaders + document.getElementById('sdk-loader').style.visibility = 'visible'; + + + // Unzip Flutter SDK + if (debug) { + return; + } + var fileName = dwn.getFilenameFromUrl(urls['flutter-sdk']) + if (fs.existsSync(folder + "\\flutter")) { + return + } else { + return extract(folder + "\\" + fileName, { + dir: folder + }); + } + }) + .then(() => { + // Reflect progress and modify loaders for current state + document.getElementById('progress-bar').value = 90; + document.getElementById('sdk-loader').style.display = 'none'; + document.getElementById('sdk-done').style.visibility = 'visible'; + document.getElementById('path-loader').style.visibility = 'visible'; + + addComponentsToPath(); + }) + + +} + +function addComponentsToPath() { + if (debug) { + document.getElementById('progress-bar').value = 100; + document.getElementById('path-loader').style.display = 'none'; + document.getElementById('path-done').style.visibility = 'visible'; + + enableNext(); + return + } else { + exec('setx path "%path%;"C:\\Android\\flutter\\bin"') + .then((stdout, stderr) => { + if (stderr) { + console.log("Error Encountered"); + console.log(stderr.toString()); + } + document.getElementById('path-loader').style.display = 'none'; + document.getElementById('path-done').style.visibility = 'visible'; + document.getElementById('progress-bar').value = 100; + + enableNext(); + }) + } +} + +function enableNext(params) { + document.getElementById('next-button').classList.remove('disabled'); +} + +// Comment this line while debugging. +document.onload = installComponents(); \ No newline at end of file diff --git a/assets/flutter_logo_lockup.svg b/assets/flutter_logo_lockup.svg new file mode 100644 index 0000000..8ac9f69 --- /dev/null +++ b/assets/flutter_logo_lockup.svg @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/minimal.svg b/assets/minimal.svg new file mode 100644 index 0000000..cef120d --- /dev/null +++ b/assets/minimal.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/assets/sdk-only.png b/assets/sdk-only.png new file mode 100644 index 0000000..c339a10 Binary files /dev/null and b/assets/sdk-only.png differ diff --git a/assets/sdk-only.svg b/assets/sdk-only.svg new file mode 100644 index 0000000..9795429 --- /dev/null +++ b/assets/sdk-only.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + +