From bbc9c13b3ab20207e87e131af59771049c8d6896 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 12:15:58 -0700 Subject: [PATCH 01/34] Auto update desktop app --- .github/workflows/android.yml | 2 +- .github/workflows/desktop.yml | 10 ++++- .github/workflows/main.yml | 60 ------------------------------ .github/workflows/version.yml | 29 +++++++++++++++ .github/workflows/web.yml | 51 ++++++++++++++++++++++++++ desktop/electron.config.js | 6 ++- main.js | 11 +++++- package-lock.json | 69 ++++++++++++++++++++++++++++++++--- package.json | 4 +- 9 files changed, 171 insertions(+), 71 deletions(-) delete mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/version.yml create mode 100644 .github/workflows/web.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index a1d16d13044d..630ca715e7b7 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -2,7 +2,7 @@ name: Build and Deploy Android on: push: - branches: [ master ] + tags: '**' jobs: build: diff --git a/.github/workflows/desktop.yml b/.github/workflows/desktop.yml index ac5f3d87bdb0..daf73c37ce70 100644 --- a/.github/workflows/desktop.yml +++ b/.github/workflows/desktop.yml @@ -2,7 +2,7 @@ name: Build and Deploy Desktop on: push: - branches: [ master ] + tags: '**' jobs: build: @@ -25,6 +25,12 @@ jobs: aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 + - name: Update version + run: | + git config user.name github-actions + npm run version prerelease + + - name: Decrypt Developer ID Certificate run: cd desktop && gpg --quiet --batch --yes --decrypt --passphrase="$DEVELOPER_ID_SECRET_PASSPHRASE" --output developer_id.p12 developer_id.p12.gpg env: @@ -37,6 +43,8 @@ jobs: CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} APPLE_ID: ${{ secrets.APPLE_ID }} APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - name: Zip desktop build run: 7z a $GITHUB_WORKSPACE/dist/mac/Chat.app.zip $GITHUB_WORKSPACE/dist/mac/Chat.app diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index bb3f364bedaa..000000000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,60 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: Build and Deploy Web - -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch -on: - push: - branches: [ master ] - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on - runs-on: ubuntu-16.04 - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - # Installs node - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: '14.x' - - # Install python pre-reqs - - name: Setup python - run: sudo apt-get install python3-setuptools - - # Installs Cloudflare CLI, after installing/upgrading dependencies - - name: Setup Cloudflare CLI - run: | - pip3 install --upgrade pip - pip3 install wheel # need wheel before cloudflare, this is the only way to ensure order. - pip3 install cloudflare - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - # Install node modules - - name: Install dependenices - run: npm install - - - name: Build web - run: npm run build - - - name: Deploy to S3 - run: aws s3 cp --recursive --acl public-read $GITHUB_WORKSPACE/dist s3://chat-test-expensify-com/ - - - name: Purge Cloudflare cache - run: /home/runner/.local/bin/cli4 --delete hosts=["chat.expensify.com"] /zones/:9ee042e6cfc7fd45e74aa7d2f78d617b/purge_cache - env: - CF_API_KEY: ${{ secrets.CLOUDFLARE_TOKEN }} diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml new file mode 100644 index 000000000000..ffe6d8e42a91 --- /dev/null +++ b/.github/workflows/version.yml @@ -0,0 +1,29 @@ +name: Create a new version + +on: + push: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-16.04 + + steps: + - uses: actions/checkout@v2 + + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: '14.x' + + - name: Install dependenices + run: npm install + + - name: Generate version + run: npm version prerelease -m "Update version to %s" + + - name: Push new version + run: | + git config user.name github-actions + git push + git push --tags diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml new file mode 100644 index 000000000000..368ccf6b77ca --- /dev/null +++ b/.github/workflows/web.yml @@ -0,0 +1,51 @@ +name: Build and Deploy Web + +on: + push: + tags: '**' + +jobs: + build: + runs-on: ubuntu-16.04 + + steps: + - uses: actions/checkout@v2 + + # Installs node + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: '14.x' + + # Install python pre-reqs + - name: Setup python + run: sudo apt-get install python3-setuptools + + # Installs Cloudflare CLI, after installing/upgrading dependencies + - name: Setup Cloudflare CLI + run: | + pip3 install --upgrade pip + pip3 install wheel # need wheel before cloudflare, this is the only way to ensure order. + pip3 install cloudflare + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + + # Install node modules + - name: Install dependenices + run: npm install + + - name: Build web + run: npm run build + + - name: Deploy to S3 + run: aws s3 cp --recursive --acl public-read $GITHUB_WORKSPACE/dist s3://chat-test-expensify-com/ + + - name: Purge Cloudflare cache + run: /home/runner/.local/bin/cli4 --delete hosts=["chat.expensify.com"] /zones/:9ee042e6cfc7fd45e74aa7d2f78d617b/purge_cache + env: + CF_API_KEY: ${{ secrets.CLOUDFLARE_TOKEN }} diff --git a/desktop/electron.config.js b/desktop/electron.config.js index cf4ab39a9f84..27d85b3d7278 100644 --- a/desktop/electron.config.js +++ b/desktop/electron.config.js @@ -13,5 +13,9 @@ module.exports = { files: [ './dist/**/*', './main.js' - ] + ], + publish: { + provider: 's3', + bucket: 'chat-test-expensify-com' + } }; diff --git a/main.js b/main.js index 17e05f407ca9..be8903248ebd 100644 --- a/main.js +++ b/main.js @@ -1,6 +1,7 @@ const {app, BrowserWindow, shell} = require('electron'); const serve = require('electron-serve'); const contextMenu = require('electron-context-menu'); +const {autoUpdater} = require('electron-updater'); /** * Electron main process that handles wrapping the web application. @@ -8,7 +9,7 @@ const contextMenu = require('electron-context-menu'); * @see: https://www.electronjs.org/docs/tutorial/application-architecture#main-and-renderer-processes */ -// TODO: Turn this off, use web-security after alpha launch, currently we recieve a CORS issue preventing +// TODO: Turn this off, use web-security after alpha launch, currently we receive a CORS issue preventing // the electron app from making any API requests. app.commandLine.appendSwitch('disable-web-security'); @@ -44,6 +45,14 @@ const mainWindow = (async () => { e.preventDefault(); shell.openExternal(url); }); + + // TODO: Remove this before merging, just used for testing + const log = require('electron-log'); + log.transports.file.level = 'debug'; + autoUpdater.logger = log; + + // Check for auto updates + await autoUpdater.checkForUpdatesAndNotify(); }); mainWindow(); diff --git a/package-lock.json b/package-lock.json index 1f24912cbfc1..fb0a8703d8cc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1981,6 +1981,11 @@ "integrity": "sha512-IkVfat549ggtkZUthUzEX49562eGikhSYeVGX97SkMFn+sTZrgRewXjQ4tPKFPCykZHkX1Zfd9OoELGqKU2jJA==", "dev": true }, + "@types/semver": { + "version": "7.3.3", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.3.tgz", + "integrity": "sha512-jQxClWFzv9IXdLdhSaTf16XI3NYe6zrEbckSpb5xhKfPbWgIyAY0AFyWWWfaiDcBuj3UHmMkCIwSRqpKMTZL2Q==" + }, "@types/source-list-map": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/@types/source-list-map/-/source-list-map-0.1.2.tgz", @@ -3033,8 +3038,7 @@ "at-least-node": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "dev": true + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==" }, "atob": { "version": "2.1.2", @@ -3972,7 +3976,6 @@ "version": "8.7.2", "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-8.7.2.tgz", "integrity": "sha512-xBqv+8bg6cfnzAQK1k3OGpfaHg+QkPgIgpEkXNhouZ0WiUkyZCftuRc2LYzQrLucFywpa14Xbc6+hTbpq83yRA==", - "dev": true, "requires": { "debug": "^4.1.1", "sax": "^1.2.4" @@ -3982,7 +3985,6 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, "requires": { "ms": "^2.1.1" } @@ -5928,6 +5930,11 @@ "resolved": "https://registry.npmjs.org/electron-is-dev/-/electron-is-dev-1.2.0.tgz", "integrity": "sha512-R1oD5gMBPS7PVU8gJwH6CtT0e6VSoD0+SzSnYpNm+dBkcijgA+K7VAMHDfnRq/lkKPZArpzplTW6jfiMYosdzw==" }, + "electron-log": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/electron-log/-/electron-log-4.2.4.tgz", + "integrity": "sha512-CXbDU+Iwi+TjKzugKZmTRIORIPe3uQRqgChUl19fkW/reFUn5WP7dt+cNGT3bkLV8xfPilpkPFv33HgtmLLewQ==" + }, "electron-notarize": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/electron-notarize/-/electron-notarize-1.0.0.tgz", @@ -6040,6 +6047,52 @@ "integrity": "sha512-HiroW5ZbGwgT8kCnoEO8qnGjoTPzJxduvV/Vv/wH63eo2N6Zj3xT5fmmaSPAPUM05iN9/5fIEkIg3owTtV6QZg==", "dev": true }, + "electron-updater": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-4.3.4.tgz", + "integrity": "sha512-ekpgxDrYl+Wi24ktO4qfj2CtCABxrmK1C/oekp0tai6q4VR4ZdPkit4CX8+GenvKMme7uMmfPFnLp/vwhP/ThQ==", + "requires": { + "@types/semver": "^7.3.1", + "builder-util-runtime": "8.7.2", + "fs-extra": "^9.0.1", + "js-yaml": "^3.14.0", + "lazy-val": "^1.0.4", + "lodash.isequal": "^4.5.0", + "semver": "^7.3.2" + }, + "dependencies": { + "fs-extra": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz", + "integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==", + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^1.0.0" + } + }, + "jsonfile": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.0.1.tgz", + "integrity": "sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^1.0.0" + } + }, + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" + }, + "universalify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz", + "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==" + } + } + }, "electron-webpack": { "version": "2.8.2", "resolved": "https://registry.npmjs.org/electron-webpack/-/electron-webpack-2.8.2.tgz", @@ -10785,8 +10838,7 @@ "lazy-val": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/lazy-val/-/lazy-val-1.0.4.tgz", - "integrity": "sha512-u93kb2fPbIrfzBuLjZE+w+fJbUUMhNDXxNmMfaqNgpfQf1CO5ZSe2LfsnBqVAk7i/2NF48OSoRj+Xe2VT+lE8Q==", - "dev": true + "integrity": "sha512-u93kb2fPbIrfzBuLjZE+w+fJbUUMhNDXxNmMfaqNgpfQf1CO5ZSe2LfsnBqVAk7i/2NF48OSoRj+Xe2VT+lE8Q==" }, "lcid": { "version": "1.0.0", @@ -10922,6 +10974,11 @@ "resolved": "https://registry.npmjs.org/lodash.has/-/lodash.has-4.5.2.tgz", "integrity": "sha1-0Z9NwQlQWMzL4rDN9O4P5Ko3yGI=" }, + "lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=" + }, "lodash.sortby": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", diff --git a/package.json b/package.json index 26bb299eece4..becad97878af 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "start": "react-native start", "web": "webpack-dev-server --open --config webpack.dev.js", "build": "webpack --config webpack.prod.js", - "desktop-build": "webpack --config webpack.prod.js && electron-builder --dir --config desktop/electron.config.js", + "desktop-build": "webpack --config webpack.prod.js && electron-builder --dir --config desktop/electron.config.js --publish always", "test": "jest", "lint": "eslint .", "deploy-ios": "npm version prerelease && git push && fastlane ios beta", @@ -23,7 +23,9 @@ "babel-plugin-transform-remove-console": "^6.9.4", "dotenv": "^8.2.0", "electron-context-menu": "^2.3.0", + "electron-log": "^4.2.4", "electron-serve": "^1.0.0", + "electron-updater": "^4.3.4", "file-loader": "^6.0.0", "html-entities": "^1.3.1", "jquery": "^3.5.1", From cfe8da8893b6256bb046dfd23283d51e3e736ca9 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 12:16:51 -0700 Subject: [PATCH 02/34] Testing...! --- .github/workflows/version.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index ffe6d8e42a91..1ec17c9e077c 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -1,8 +1,6 @@ name: Create a new version -on: - push: - branches: [ master ] +on: push jobs: build: From cd1e0b5682861a513c510c13a3efbe4ba8c343c8 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 12:23:36 -0700 Subject: [PATCH 03/34] Set name before version --- .github/workflows/version.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index 1ec17c9e077c..09f74d859c99 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -17,11 +17,11 @@ jobs: - name: Install dependenices run: npm install + - name: Set git user + run: git config user.name github-action + - name: Generate version run: npm version prerelease -m "Update version to %s" - name: Push new version - run: | - git config user.name github-actions - git push - git push --tags + run: git push && git push --tags From 0dfe73f5852889d56a3153b6ed0feb979461db9d Mon Sep 17 00:00:00 2001 From: github-action Date: Mon, 31 Aug 2020 19:25:02 +0000 Subject: [PATCH 04/34] Update version to 1.0.1-5 --- android/app/build.gradle | 4 ++-- ios/ReactNativeChat/Info.plist | 2 +- ios/ReactNativeChatTests/Info.plist | 2 +- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index ba0b3890da91..8e05df88c5ba 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,8 +138,8 @@ android { applicationId "com.expensifyreactnative.chat" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 5 - versionName "1.0.1-4" + versionCode 6 + versionName "1.0.1-5" } splits { abi { diff --git a/ios/ReactNativeChat/Info.plist b/ios/ReactNativeChat/Info.plist index 725edbf72f02..b3490c687125 100644 --- a/ios/ReactNativeChat/Info.plist +++ b/ios/ReactNativeChat/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 5 + 6 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/ReactNativeChatTests/Info.plist b/ios/ReactNativeChatTests/Info.plist index 2a1c32ed7c00..412a1b82faaf 100644 --- a/ios/ReactNativeChatTests/Info.plist +++ b/ios/ReactNativeChatTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 5 + 6 diff --git a/package-lock.json b/package-lock.json index fb0a8703d8cc..cd16af49bc66 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-4", + "version": "1.0.1-5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index becad97878af..dc1a467a9f62 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-4", + "version": "1.0.1-5", "author": "Expensify, Inc.", "homepage": "https://expensify.com", "private": true, From 9b1270768686caba6d2640ce7b44e6462d112022 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 12:28:09 -0700 Subject: [PATCH 05/34] Tweaking on event --- .github/workflows/android.yml | 2 +- .github/workflows/desktop.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/web.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 630ca715e7b7..8238a471fc6f 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -2,7 +2,7 @@ name: Build and Deploy Android on: push: - tags: '**' + tags: ['**'] jobs: build: diff --git a/.github/workflows/desktop.yml b/.github/workflows/desktop.yml index daf73c37ce70..a0c4b04fb067 100644 --- a/.github/workflows/desktop.yml +++ b/.github/workflows/desktop.yml @@ -2,7 +2,7 @@ name: Build and Deploy Desktop on: push: - tags: '**' + tags: ['**'] jobs: build: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 167217ae4a27..e66724314d51 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,6 +1,6 @@ name: eslint -on: [push] +on: push jobs: build: diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index 368ccf6b77ca..5696cd4b6744 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -2,7 +2,7 @@ name: Build and Deploy Web on: push: - tags: '**' + tags: ['**'] jobs: build: From 7a329a19c08ceb55d8e822a582c4514f82fcb2e4 Mon Sep 17 00:00:00 2001 From: github-action Date: Mon, 31 Aug 2020 19:32:07 +0000 Subject: [PATCH 06/34] Update version to 1.0.1-6 --- android/app/build.gradle | 4 ++-- ios/ReactNativeChat/Info.plist | 2 +- ios/ReactNativeChatTests/Info.plist | 2 +- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 8e05df88c5ba..863eb6ccf55e 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,8 +138,8 @@ android { applicationId "com.expensifyreactnative.chat" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 6 - versionName "1.0.1-5" + versionCode 7 + versionName "1.0.1-6" } splits { abi { diff --git a/ios/ReactNativeChat/Info.plist b/ios/ReactNativeChat/Info.plist index b3490c687125..5693887d1aed 100644 --- a/ios/ReactNativeChat/Info.plist +++ b/ios/ReactNativeChat/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 6 + 7 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/ReactNativeChatTests/Info.plist b/ios/ReactNativeChatTests/Info.plist index 412a1b82faaf..168c78907d10 100644 --- a/ios/ReactNativeChatTests/Info.plist +++ b/ios/ReactNativeChatTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 6 + 7 diff --git a/package-lock.json b/package-lock.json index cd16af49bc66..08ab34ef993c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-5", + "version": "1.0.1-6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index dc1a467a9f62..339a69bd6e72 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-5", + "version": "1.0.1-6", "author": "Expensify, Inc.", "homepage": "https://expensify.com", "private": true, From 35ee77bb9c79b0a203aacd1891aded40c6167dc9 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 12:34:35 -0700 Subject: [PATCH 07/34] Test via push --- .github/workflows/desktop.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/desktop.yml b/.github/workflows/desktop.yml index a0c4b04fb067..7944f6bd3a12 100644 --- a/.github/workflows/desktop.yml +++ b/.github/workflows/desktop.yml @@ -1,8 +1,6 @@ name: Build and Deploy Desktop -on: - push: - tags: ['**'] +on: push jobs: build: @@ -25,12 +23,6 @@ jobs: aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 - - name: Update version - run: | - git config user.name github-actions - npm run version prerelease - - - name: Decrypt Developer ID Certificate run: cd desktop && gpg --quiet --batch --yes --decrypt --passphrase="$DEVELOPER_ID_SECRET_PASSPHRASE" --output developer_id.p12 developer_id.p12.gpg env: From c4794970fed7630c4493ded97912efbb8baaec16 Mon Sep 17 00:00:00 2001 From: github-action Date: Mon, 31 Aug 2020 19:37:31 +0000 Subject: [PATCH 08/34] Update version to 1.0.1-7 --- android/app/build.gradle | 4 ++-- ios/ReactNativeChat/Info.plist | 2 +- ios/ReactNativeChatTests/Info.plist | 2 +- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 863eb6ccf55e..ce5ec652852f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,8 +138,8 @@ android { applicationId "com.expensifyreactnative.chat" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 7 - versionName "1.0.1-6" + versionCode 8 + versionName "1.0.1-7" } splits { abi { diff --git a/ios/ReactNativeChat/Info.plist b/ios/ReactNativeChat/Info.plist index 5693887d1aed..9799b5992f48 100644 --- a/ios/ReactNativeChat/Info.plist +++ b/ios/ReactNativeChat/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 7 + 8 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/ReactNativeChatTests/Info.plist b/ios/ReactNativeChatTests/Info.plist index 168c78907d10..f6a518b53a09 100644 --- a/ios/ReactNativeChatTests/Info.plist +++ b/ios/ReactNativeChatTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 7 + 8 diff --git a/package-lock.json b/package-lock.json index 08ab34ef993c..d6abef187025 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-6", + "version": "1.0.1-7", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 339a69bd6e72..3b956d6c0d2c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-6", + "version": "1.0.1-7", "author": "Expensify, Inc.", "homepage": "https://expensify.com", "private": true, From 964ea71fda86283645a279270e9400a715f171d4 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 13:09:27 -0700 Subject: [PATCH 09/34] Tweak logging --- main.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/main.js b/main.js index be8903248ebd..dd14148bdb96 100644 --- a/main.js +++ b/main.js @@ -2,6 +2,7 @@ const {app, BrowserWindow, shell} = require('electron'); const serve = require('electron-serve'); const contextMenu = require('electron-context-menu'); const {autoUpdater} = require('electron-updater'); +const log = require('electron-log'); /** * Electron main process that handles wrapping the web application. @@ -13,6 +14,11 @@ const {autoUpdater} = require('electron-updater'); // the electron app from making any API requests. app.commandLine.appendSwitch('disable-web-security'); +// TODO: Remove this before merging, just used for testing +autoUpdater.logger = log; +autoUpdater.logger.transports.file.level = 'info'; +log.info('App starting...'); + const mainWindow = (async () => { const loadURL = serve({directory: 'dist'}); @@ -46,11 +52,6 @@ const mainWindow = (async () => { shell.openExternal(url); }); - // TODO: Remove this before merging, just used for testing - const log = require('electron-log'); - log.transports.file.level = 'debug'; - autoUpdater.logger = log; - // Check for auto updates await autoUpdater.checkForUpdatesAndNotify(); }); From 89198f9303c5b8f70aeaa0e75d5d05c5c59ea50d Mon Sep 17 00:00:00 2001 From: github-action Date: Mon, 31 Aug 2020 20:11:06 +0000 Subject: [PATCH 10/34] Update version to 1.0.1-8 --- android/app/build.gradle | 4 ++-- ios/ReactNativeChat/Info.plist | 2 +- ios/ReactNativeChatTests/Info.plist | 2 +- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index ce5ec652852f..04e9b982e653 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,8 +138,8 @@ android { applicationId "com.expensifyreactnative.chat" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 8 - versionName "1.0.1-7" + versionCode 9 + versionName "1.0.1-8" } splits { abi { diff --git a/ios/ReactNativeChat/Info.plist b/ios/ReactNativeChat/Info.plist index 9799b5992f48..c44754f8799d 100644 --- a/ios/ReactNativeChat/Info.plist +++ b/ios/ReactNativeChat/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 8 + 9 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/ReactNativeChatTests/Info.plist b/ios/ReactNativeChatTests/Info.plist index f6a518b53a09..67e1b2368794 100644 --- a/ios/ReactNativeChatTests/Info.plist +++ b/ios/ReactNativeChatTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 8 + 9 diff --git a/package-lock.json b/package-lock.json index d6abef187025..12cd8a58e9d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-7", + "version": "1.0.1-8", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 3b956d6c0d2c..aa864e7f4b96 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-7", + "version": "1.0.1-8", "author": "Expensify, Inc.", "homepage": "https://expensify.com", "private": true, From 1ed1c6a47def2c2b0eb960a165f82aac7123ba02 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 13:36:14 -0700 Subject: [PATCH 11/34] Add lots of logs --- main.js | 29 +++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 30 insertions(+) diff --git a/main.js b/main.js index dd14148bdb96..dcda5babcf15 100644 --- a/main.js +++ b/main.js @@ -16,9 +16,38 @@ app.commandLine.appendSwitch('disable-web-security'); // TODO: Remove this before merging, just used for testing autoUpdater.logger = log; +Object.assign(console, log.functions); autoUpdater.logger.transports.file.level = 'info'; + log.info('App starting...'); +autoUpdater.on('checking-for-update', () => { + log.info('Checking for update...'); +}); + +autoUpdater.on('update-available', (info) => { + log.info(`Update available ${JSON.stringify(info)}`); +}); + +autoUpdater.on('update-not-available', (info) => { + log.info(`Update not available ${JSON.stringify(info)}`); +}); + +autoUpdater.on('error', (err) => { + log.info(`Error in auto-updater. ${err}`); +}); + +autoUpdater.on('download-progress', (progressObj) => { + let log_message = `Download speed: ${progressObj.bytesPerSecond}`; + log_message = `${log_message} - Downloaded ${progressObj.percent}%`; + log_message = `${log_message} (${progressObj.transferred}/${progressObj.total})`; + log.info(log_message); +}); + +autoUpdater.on('update-downloaded', (info) => { + log.info(`Update downloaded ${JSON.stringify(info)}`); +}); + const mainWindow = (async () => { const loadURL = serve({directory: 'dist'}); diff --git a/package.json b/package.json index aa864e7f4b96..04f85a2c721b 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "web": "webpack-dev-server --open --config webpack.dev.js", "build": "webpack --config webpack.prod.js", "desktop-build": "webpack --config webpack.prod.js && electron-builder --dir --config desktop/electron.config.js --publish always", + "local-desktop-build": "webpack --config webpack.prod.js && electron-builder --dir --config desktop/electron.config.js", "test": "jest", "lint": "eslint .", "deploy-ios": "npm version prerelease && git push && fastlane ios beta", From f7aabbdbf9a8405c0e54cda731a4fb75f85647e1 Mon Sep 17 00:00:00 2001 From: github-action Date: Mon, 31 Aug 2020 20:37:34 +0000 Subject: [PATCH 12/34] Update version to 1.0.1-9 --- android/app/build.gradle | 4 ++-- ios/ReactNativeChat/Info.plist | 2 +- ios/ReactNativeChatTests/Info.plist | 2 +- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 04e9b982e653..c1d55e829ef8 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,8 +138,8 @@ android { applicationId "com.expensifyreactnative.chat" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 9 - versionName "1.0.1-8" + versionCode 10 + versionName "1.0.1-9" } splits { abi { diff --git a/ios/ReactNativeChat/Info.plist b/ios/ReactNativeChat/Info.plist index c44754f8799d..0c9b55b47f90 100644 --- a/ios/ReactNativeChat/Info.plist +++ b/ios/ReactNativeChat/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 9 + 10 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/ReactNativeChatTests/Info.plist b/ios/ReactNativeChatTests/Info.plist index 67e1b2368794..c28475433d9e 100644 --- a/ios/ReactNativeChatTests/Info.plist +++ b/ios/ReactNativeChatTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 9 + 10 diff --git a/package-lock.json b/package-lock.json index 12cd8a58e9d9..73e7c23d8ed5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-8", + "version": "1.0.1-9", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 04f85a2c721b..f03cc74029f7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-8", + "version": "1.0.1-9", "author": "Expensify, Inc.", "homepage": "https://expensify.com", "private": true, From f849edd70fd38f418fc6d28e3352efd8b70e6f46 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 13:55:43 -0700 Subject: [PATCH 13/34] Continue to debug auto-update --- desktop/electron.config.js | 12 +++++----- desktop/updater.js | 49 ++++++++++++++++++++++++++++++++++++++ main.js | 32 ++++++++++++++++++++++++- 3 files changed, 86 insertions(+), 7 deletions(-) create mode 100644 desktop/updater.js diff --git a/desktop/electron.config.js b/desktop/electron.config.js index 27d85b3d7278..7788b2169b91 100644 --- a/desktop/electron.config.js +++ b/desktop/electron.config.js @@ -8,14 +8,14 @@ module.exports = { hardenedRuntime: true, entitlements: 'desktop/entitlements.mac.plist', entitlementsInherit: 'desktop/entitlements.mac.plist', - type: 'distribution' + type: 'distribution', + publish: { + provider: 's3', + bucket: 'chat-test-expensify-com' + } }, files: [ './dist/**/*', './main.js' - ], - publish: { - provider: 's3', - bucket: 'chat-test-expensify-com' - } + ] }; diff --git a/desktop/updater.js b/desktop/updater.js new file mode 100644 index 000000000000..65635bf4f565 --- /dev/null +++ b/desktop/updater.js @@ -0,0 +1,49 @@ +const {dialog} = require('electron'); +const {autoUpdater} = require('electron-updater'); + +let updater; +autoUpdater.autoDownload = false; + +autoUpdater.on('error', (error) => { + dialog.showErrorBox('Error', error == null ? 'unknown' : (error.stack || error).toString()); +}); + +autoUpdater.on('update-available', () => { + dialog.showMessageBox({ + type: 'info', + title: 'Found Updates', + message: 'Found updates, do you want update now?', + buttons: ['Sure', 'No'] + }, (buttonIndex) => { + if (buttonIndex === 0) { + autoUpdater.downloadUpdate(); + } else { + updater.enabled = true; + updater = null; + } + }); +}); + +autoUpdater.on('update-not-available', () => { + dialog.showMessageBox({ + title: 'No Updates', + message: 'Current version is up-to-date.' + }); + updater.enabled = true; + updater = null; +}); + +autoUpdater.on('update-downloaded', () => { + dialog.showMessageBox({ + title: 'Install Updates', + message: 'Updates downloaded, application will be quit for update...' + }, () => { + setImmediate(() => autoUpdater.quitAndInstall()); + }); +}); + +// export this to MenuItem click callback +function checkForUpdates() { + autoUpdater.checkForUpdates(); +} +module.exports.checkForUpdates = checkForUpdates; diff --git a/main.js b/main.js index dcda5babcf15..3bfe2849088d 100644 --- a/main.js +++ b/main.js @@ -1,8 +1,11 @@ -const {app, BrowserWindow, shell} = require('electron'); +const { + app, BrowserWindow, shell, Menu +} = require('electron'); const serve = require('electron-serve'); const contextMenu = require('electron-context-menu'); const {autoUpdater} = require('electron-updater'); const log = require('electron-log'); +const {checkForUpdates} = require('./desktop/updater'); /** * Electron main process that handles wrapping the web application. @@ -48,6 +51,30 @@ autoUpdater.on('update-downloaded', (info) => { log.info(`Update downloaded ${JSON.stringify(info)}`); }); +const template = []; +if (process.platform === 'darwin') { + // OS X + const name = app.getName(); + template.unshift({ + label: name, + submenu: [ + { + label: `About ${name}`, + role: 'about' + }, + { + label: 'Check for updates...', + click() { checkForUpdates(); } + }, + { + label: 'Quit', + accelerator: 'Command+Q', + click() { app.quit(); } + }, + ] + }); +} + const mainWindow = (async () => { const loadURL = serve({directory: 'dist'}); @@ -81,6 +108,9 @@ const mainWindow = (async () => { shell.openExternal(url); }); + const menu = Menu.buildFromTemplate(template); + Menu.setApplicationMenu(menu); + // Check for auto updates await autoUpdater.checkForUpdatesAndNotify(); }); From e17a8c0571c467f9e49588b611aaa520060d2935 Mon Sep 17 00:00:00 2001 From: github-action Date: Mon, 31 Aug 2020 20:57:29 +0000 Subject: [PATCH 14/34] Update version to 1.0.1-10 --- android/app/build.gradle | 4 ++-- ios/ReactNativeChat/Info.plist | 2 +- ios/ReactNativeChatTests/Info.plist | 2 +- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index c1d55e829ef8..14d90836e313 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,8 +138,8 @@ android { applicationId "com.expensifyreactnative.chat" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 10 - versionName "1.0.1-9" + versionCode 11 + versionName "1.0.1-10" } splits { abi { diff --git a/ios/ReactNativeChat/Info.plist b/ios/ReactNativeChat/Info.plist index 0c9b55b47f90..2ecb8af938f8 100644 --- a/ios/ReactNativeChat/Info.plist +++ b/ios/ReactNativeChat/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 10 + 11 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/ReactNativeChatTests/Info.plist b/ios/ReactNativeChatTests/Info.plist index c28475433d9e..480c4926e502 100644 --- a/ios/ReactNativeChatTests/Info.plist +++ b/ios/ReactNativeChatTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 10 + 11 diff --git a/package-lock.json b/package-lock.json index 73e7c23d8ed5..0d53233e9461 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-9", + "version": "1.0.1-10", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index f03cc74029f7..eafa9f6f1fec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-9", + "version": "1.0.1-10", "author": "Expensify, Inc.", "homepage": "https://expensify.com", "private": true, From 7108851507cdad644cbf3cfaf7658ec0ba9954e7 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 14:15:01 -0700 Subject: [PATCH 15/34] Tweak config --- desktop/electron.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/desktop/electron.config.js b/desktop/electron.config.js index 7788b2169b91..d86778601176 100644 --- a/desktop/electron.config.js +++ b/desktop/electron.config.js @@ -16,6 +16,7 @@ module.exports = { }, files: [ './dist/**/*', - './main.js' + './main.js', + './desktop/updater.js' ] }; From b53e7ac84814bef277d0ec436d9121886137019f Mon Sep 17 00:00:00 2001 From: github-action Date: Mon, 31 Aug 2020 21:16:47 +0000 Subject: [PATCH 16/34] Update version to 1.0.1-11 --- android/app/build.gradle | 4 ++-- ios/ReactNativeChat/Info.plist | 2 +- ios/ReactNativeChatTests/Info.plist | 2 +- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 14d90836e313..2bc9622a77e3 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,8 +138,8 @@ android { applicationId "com.expensifyreactnative.chat" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 11 - versionName "1.0.1-10" + versionCode 12 + versionName "1.0.1-11" } splits { abi { diff --git a/ios/ReactNativeChat/Info.plist b/ios/ReactNativeChat/Info.plist index 2ecb8af938f8..82294239f947 100644 --- a/ios/ReactNativeChat/Info.plist +++ b/ios/ReactNativeChat/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 11 + 12 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/ReactNativeChatTests/Info.plist b/ios/ReactNativeChatTests/Info.plist index 480c4926e502..fede74a78dca 100644 --- a/ios/ReactNativeChatTests/Info.plist +++ b/ios/ReactNativeChatTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 11 + 12 diff --git a/package-lock.json b/package-lock.json index 0d53233e9461..e1c2216278f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-10", + "version": "1.0.1-11", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index eafa9f6f1fec..021e0e471a34 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-10", + "version": "1.0.1-11", "author": "Expensify, Inc.", "homepage": "https://expensify.com", "private": true, From be69c157f1e066040bea40237e80ad245b154df8 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 15:53:29 -0700 Subject: [PATCH 17/34] Fix auto update bugs --- desktop/electron.config.js | 10 ++++---- desktop/updater.js | 49 -------------------------------------- main.js | 32 +------------------------ package.json | 4 ++-- 4 files changed, 8 insertions(+), 87 deletions(-) delete mode 100644 desktop/updater.js diff --git a/desktop/electron.config.js b/desktop/electron.config.js index d86778601176..222cb4ff91ba 100644 --- a/desktop/electron.config.js +++ b/desktop/electron.config.js @@ -9,14 +9,14 @@ module.exports = { entitlements: 'desktop/entitlements.mac.plist', entitlementsInherit: 'desktop/entitlements.mac.plist', type: 'distribution', - publish: { + publish: [{ provider: 's3', - bucket: 'chat-test-expensify-com' - } + bucket: 'chat-test-expensify-com', + channel: 'latest' + }] }, files: [ './dist/**/*', - './main.js', - './desktop/updater.js' + './main.js' ] }; diff --git a/desktop/updater.js b/desktop/updater.js deleted file mode 100644 index 65635bf4f565..000000000000 --- a/desktop/updater.js +++ /dev/null @@ -1,49 +0,0 @@ -const {dialog} = require('electron'); -const {autoUpdater} = require('electron-updater'); - -let updater; -autoUpdater.autoDownload = false; - -autoUpdater.on('error', (error) => { - dialog.showErrorBox('Error', error == null ? 'unknown' : (error.stack || error).toString()); -}); - -autoUpdater.on('update-available', () => { - dialog.showMessageBox({ - type: 'info', - title: 'Found Updates', - message: 'Found updates, do you want update now?', - buttons: ['Sure', 'No'] - }, (buttonIndex) => { - if (buttonIndex === 0) { - autoUpdater.downloadUpdate(); - } else { - updater.enabled = true; - updater = null; - } - }); -}); - -autoUpdater.on('update-not-available', () => { - dialog.showMessageBox({ - title: 'No Updates', - message: 'Current version is up-to-date.' - }); - updater.enabled = true; - updater = null; -}); - -autoUpdater.on('update-downloaded', () => { - dialog.showMessageBox({ - title: 'Install Updates', - message: 'Updates downloaded, application will be quit for update...' - }, () => { - setImmediate(() => autoUpdater.quitAndInstall()); - }); -}); - -// export this to MenuItem click callback -function checkForUpdates() { - autoUpdater.checkForUpdates(); -} -module.exports.checkForUpdates = checkForUpdates; diff --git a/main.js b/main.js index 3bfe2849088d..dcda5babcf15 100644 --- a/main.js +++ b/main.js @@ -1,11 +1,8 @@ -const { - app, BrowserWindow, shell, Menu -} = require('electron'); +const {app, BrowserWindow, shell} = require('electron'); const serve = require('electron-serve'); const contextMenu = require('electron-context-menu'); const {autoUpdater} = require('electron-updater'); const log = require('electron-log'); -const {checkForUpdates} = require('./desktop/updater'); /** * Electron main process that handles wrapping the web application. @@ -51,30 +48,6 @@ autoUpdater.on('update-downloaded', (info) => { log.info(`Update downloaded ${JSON.stringify(info)}`); }); -const template = []; -if (process.platform === 'darwin') { - // OS X - const name = app.getName(); - template.unshift({ - label: name, - submenu: [ - { - label: `About ${name}`, - role: 'about' - }, - { - label: 'Check for updates...', - click() { checkForUpdates(); } - }, - { - label: 'Quit', - accelerator: 'Command+Q', - click() { app.quit(); } - }, - ] - }); -} - const mainWindow = (async () => { const loadURL = serve({directory: 'dist'}); @@ -108,9 +81,6 @@ const mainWindow = (async () => { shell.openExternal(url); }); - const menu = Menu.buildFromTemplate(template); - Menu.setApplicationMenu(menu); - // Check for auto updates await autoUpdater.checkForUpdatesAndNotify(); }); diff --git a/package.json b/package.json index eafa9f6f1fec..8b9efe89c392 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "1.0.1-10", "author": "Expensify, Inc.", "homepage": "https://expensify.com", + "description": "Expensify Chat", "private": true, "scripts": { "android": "react-native run-android", @@ -11,8 +12,7 @@ "start": "react-native start", "web": "webpack-dev-server --open --config webpack.dev.js", "build": "webpack --config webpack.prod.js", - "desktop-build": "webpack --config webpack.prod.js && electron-builder --dir --config desktop/electron.config.js --publish always", - "local-desktop-build": "webpack --config webpack.prod.js && electron-builder --dir --config desktop/electron.config.js", + "desktop-build": "webpack --config webpack.prod.js && electron-builder --config desktop/electron.config.js --publish always", "test": "jest", "lint": "eslint .", "deploy-ios": "npm version prerelease && git push && fastlane ios beta", From 6525c4076f820b644b8a264ddc4660a02da758a6 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 15:53:56 -0700 Subject: [PATCH 18/34] 1.0.1-11 --- android/app/build.gradle | 4 ++-- ios/ReactNativeChat/Info.plist | 2 +- ios/ReactNativeChatTests/Info.plist | 2 +- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 14d90836e313..2bc9622a77e3 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,8 +138,8 @@ android { applicationId "com.expensifyreactnative.chat" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 11 - versionName "1.0.1-10" + versionCode 12 + versionName "1.0.1-11" } splits { abi { diff --git a/ios/ReactNativeChat/Info.plist b/ios/ReactNativeChat/Info.plist index 2ecb8af938f8..82294239f947 100644 --- a/ios/ReactNativeChat/Info.plist +++ b/ios/ReactNativeChat/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 11 + 12 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/ReactNativeChatTests/Info.plist b/ios/ReactNativeChatTests/Info.plist index 480c4926e502..fede74a78dca 100644 --- a/ios/ReactNativeChatTests/Info.plist +++ b/ios/ReactNativeChatTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 11 + 12 diff --git a/package-lock.json b/package-lock.json index 0d53233e9461..e1c2216278f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-10", + "version": "1.0.1-11", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 8b9efe89c392..44d637e1bf09 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-10", + "version": "1.0.1-11", "author": "Expensify, Inc.", "homepage": "https://expensify.com", "description": "Expensify Chat", From a1f34626db33419f845e95edb9739191ae041882 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 16:06:15 -0700 Subject: [PATCH 19/34] Tweak configs more --- desktop/electron.config.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/desktop/electron.config.js b/desktop/electron.config.js index 222cb4ff91ba..821308505355 100644 --- a/desktop/electron.config.js +++ b/desktop/electron.config.js @@ -15,6 +15,10 @@ module.exports = { channel: 'latest' }] }, + dmg: { + artifactName: 'Chat', + internetEnabled: true + }, files: [ './dist/**/*', './main.js' From 992e05283f60cbebb713bc7a4830b40ce9a021f9 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 16:06:29 -0700 Subject: [PATCH 20/34] 1.0.1-12 --- android/app/build.gradle | 4 ++-- ios/ReactNativeChat/Info.plist | 2 +- ios/ReactNativeChatTests/Info.plist | 2 +- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 2bc9622a77e3..88d8b57f35e0 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,8 +138,8 @@ android { applicationId "com.expensifyreactnative.chat" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 12 - versionName "1.0.1-11" + versionCode 13 + versionName "1.0.1-12" } splits { abi { diff --git a/ios/ReactNativeChat/Info.plist b/ios/ReactNativeChat/Info.plist index 82294239f947..f79a56c0d264 100644 --- a/ios/ReactNativeChat/Info.plist +++ b/ios/ReactNativeChat/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 12 + 13 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/ReactNativeChatTests/Info.plist b/ios/ReactNativeChatTests/Info.plist index fede74a78dca..1e7111e53158 100644 --- a/ios/ReactNativeChatTests/Info.plist +++ b/ios/ReactNativeChatTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 12 + 13 diff --git a/package-lock.json b/package-lock.json index e1c2216278f0..43ed50f54159 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-11", + "version": "1.0.1-12", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 44d637e1bf09..96b2ece007f6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-11", + "version": "1.0.1-12", "author": "Expensify, Inc.", "homepage": "https://expensify.com", "description": "Expensify Chat", From f19fa3c1dcbcb94bb613be10477e08eb1d554c4f Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 16:29:48 -0700 Subject: [PATCH 21/34] Fix s3 region --- desktop/electron.config.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/desktop/electron.config.js b/desktop/electron.config.js index 821308505355..13def9176751 100644 --- a/desktop/electron.config.js +++ b/desktop/electron.config.js @@ -12,11 +12,13 @@ module.exports = { publish: [{ provider: 's3', bucket: 'chat-test-expensify-com', + region: 'us-east-1', channel: 'latest' }] }, dmg: { - artifactName: 'Chat', + title: 'Chat', + artifactName: 'Chat.dmg', internetEnabled: true }, files: [ From a09b0d6ddebafd8d08bee43f4cb774cb108e8d0d Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 16:30:06 -0700 Subject: [PATCH 22/34] 1.0.1-13 --- android/app/build.gradle | 4 ++-- ios/ReactNativeChat/Info.plist | 2 +- ios/ReactNativeChatTests/Info.plist | 2 +- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 88d8b57f35e0..7c27bc910244 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,8 +138,8 @@ android { applicationId "com.expensifyreactnative.chat" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 13 - versionName "1.0.1-12" + versionCode 14 + versionName "1.0.1-13" } splits { abi { diff --git a/ios/ReactNativeChat/Info.plist b/ios/ReactNativeChat/Info.plist index f79a56c0d264..41aa1fb34cc4 100644 --- a/ios/ReactNativeChat/Info.plist +++ b/ios/ReactNativeChat/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 13 + 14 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/ReactNativeChatTests/Info.plist b/ios/ReactNativeChatTests/Info.plist index 1e7111e53158..f7d9ebcc824c 100644 --- a/ios/ReactNativeChatTests/Info.plist +++ b/ios/ReactNativeChatTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 13 + 14 diff --git a/package-lock.json b/package-lock.json index 43ed50f54159..670f7f1570cf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-12", + "version": "1.0.1-13", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 96b2ece007f6..e6cab335ee09 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-12", + "version": "1.0.1-13", "author": "Expensify, Inc.", "homepage": "https://expensify.com", "description": "Expensify Chat", From 77de4cf32ce17d426c325954986a41363474b8bc Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 16:59:55 -0700 Subject: [PATCH 23/34] Move publish to root --- desktop/electron.config.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/desktop/electron.config.js b/desktop/electron.config.js index 13def9176751..846733d1fa59 100644 --- a/desktop/electron.config.js +++ b/desktop/electron.config.js @@ -8,19 +8,18 @@ module.exports = { hardenedRuntime: true, entitlements: 'desktop/entitlements.mac.plist', entitlementsInherit: 'desktop/entitlements.mac.plist', - type: 'distribution', - publish: [{ - provider: 's3', - bucket: 'chat-test-expensify-com', - region: 'us-east-1', - channel: 'latest' - }] + type: 'distribution' }, dmg: { title: 'Chat', artifactName: 'Chat.dmg', internetEnabled: true }, + publish: [{ + provider: 's3', + bucket: 'chat-test-expensify-com', + channel: 'latest' + }], files: [ './dist/**/*', './main.js' From 09d06b3a4488cedf826f67aba9c55a3dc795d285 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 17:00:16 -0700 Subject: [PATCH 24/34] 1.0.1-14 --- android/app/build.gradle | 4 ++-- ios/ReactNativeChat/Info.plist | 2 +- ios/ReactNativeChatTests/Info.plist | 2 +- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 7c27bc910244..d8d5032f5389 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,8 +138,8 @@ android { applicationId "com.expensifyreactnative.chat" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 14 - versionName "1.0.1-13" + versionCode 15 + versionName "1.0.1-14" } splits { abi { diff --git a/ios/ReactNativeChat/Info.plist b/ios/ReactNativeChat/Info.plist index 41aa1fb34cc4..29a23a538d09 100644 --- a/ios/ReactNativeChat/Info.plist +++ b/ios/ReactNativeChat/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 14 + 15 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/ReactNativeChatTests/Info.plist b/ios/ReactNativeChatTests/Info.plist index f7d9ebcc824c..d22a425eb373 100644 --- a/ios/ReactNativeChatTests/Info.plist +++ b/ios/ReactNativeChatTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 14 + 15 diff --git a/package-lock.json b/package-lock.json index 670f7f1570cf..f9cbcf5d41aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-13", + "version": "1.0.1-14", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index e6cab335ee09..d646ec7a5405 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-13", + "version": "1.0.1-14", "author": "Expensify, Inc.", "homepage": "https://expensify.com", "description": "Expensify Chat", From af2059a1d673c287d145e4bc323dfe2a267f83e8 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 17:23:25 -0700 Subject: [PATCH 25/34] Move to promises away from await --- main.js | 101 ++++++++++++++++++-------------------------------------- 1 file changed, 33 insertions(+), 68 deletions(-) diff --git a/main.js b/main.js index dcda5babcf15..b55b4ac81cf2 100644 --- a/main.js +++ b/main.js @@ -2,7 +2,6 @@ const {app, BrowserWindow, shell} = require('electron'); const serve = require('electron-serve'); const contextMenu = require('electron-context-menu'); const {autoUpdater} = require('electron-updater'); -const log = require('electron-log'); /** * Electron main process that handles wrapping the web application. @@ -14,75 +13,41 @@ const log = require('electron-log'); // the electron app from making any API requests. app.commandLine.appendSwitch('disable-web-security'); -// TODO: Remove this before merging, just used for testing -autoUpdater.logger = log; -Object.assign(console, log.functions); -autoUpdater.logger.transports.file.level = 'info'; +// Initialize the right click menu +// See https://github.com/sindresorhus/electron-context-menu +contextMenu(); -log.info('App starting...'); - -autoUpdater.on('checking-for-update', () => { - log.info('Checking for update...'); -}); - -autoUpdater.on('update-available', (info) => { - log.info(`Update available ${JSON.stringify(info)}`); -}); - -autoUpdater.on('update-not-available', (info) => { - log.info(`Update not available ${JSON.stringify(info)}`); -}); - -autoUpdater.on('error', (err) => { - log.info(`Error in auto-updater. ${err}`); -}); - -autoUpdater.on('download-progress', (progressObj) => { - let log_message = `Download speed: ${progressObj.bytesPerSecond}`; - log_message = `${log_message} - Downloaded ${progressObj.percent}%`; - log_message = `${log_message} (${progressObj.transferred}/${progressObj.total})`; - log.info(log_message); -}); - -autoUpdater.on('update-downloaded', (info) => { - log.info(`Update downloaded ${JSON.stringify(info)}`); -}); - -const mainWindow = (async () => { +const mainWindow = (() => { const loadURL = serve({directory: 'dist'}); - await app.whenReady(); - - // Initialize the right click menu - // See https://github.com/sindresorhus/electron-context-menu - contextMenu(); - - const browserWindow = new BrowserWindow({ - backgroundColor: '#FAFAFA', - width: 1200, - height: 900, - webPreferences: { - nodeIntegration: true, - }, - }); - - await loadURL(browserWindow); - - // When the user clicks a link that has target="_blank" (which is all external links) - // open the default browser instead of a new electron window - browserWindow.webContents.on('new-window', (e, url) => { - // make sure local urls stay in electron perimeter - if (url.substr(0, 'file://'.length) === 'file://') { - return; - } - - // and open every other protocol in the browser - e.preventDefault(); - shell.openExternal(url); - }); - - // Check for auto updates - await autoUpdater.checkForUpdatesAndNotify(); + return app.whenReady() + .then(() => { + const browserWindow = new BrowserWindow({ + backgroundColor: '#FAFAFA', + width: 1200, + height: 900, + webPreferences: { + nodeIntegration: true, + }, + }); + + // When the user clicks a link that has target="_blank" (which is all external links) + // open the default browser instead of a new electron window + browserWindow.webContents.on('new-window', (e, url) => { + // make sure local urls stay in electron perimeter + if (url.substr(0, 'file://'.length) === 'file://') { + return; + } + + // and open every other protocol in the browser + e.preventDefault(); + return shell.openExternal(url); + }); + + return browserWindow; + }) + .then(browserWindow => loadURL(browserWindow)) + .then(() => autoUpdater.checkForUpdatesAndNotify()); }); -mainWindow(); +mainWindow().then(window => window); From 8fee1f6a4c5e7768c95697dea7777b2f4514bfe2 Mon Sep 17 00:00:00 2001 From: github-action Date: Tue, 1 Sep 2020 00:26:20 +0000 Subject: [PATCH 26/34] Update version to 1.0.1-15 --- android/app/build.gradle | 4 ++-- ios/ReactNativeChat/Info.plist | 2 +- ios/ReactNativeChatTests/Info.plist | 2 +- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index d8d5032f5389..265f9f204ccc 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,8 +138,8 @@ android { applicationId "com.expensifyreactnative.chat" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 15 - versionName "1.0.1-14" + versionCode 16 + versionName "1.0.1-15" } splits { abi { diff --git a/ios/ReactNativeChat/Info.plist b/ios/ReactNativeChat/Info.plist index 29a23a538d09..e58a3b238e79 100644 --- a/ios/ReactNativeChat/Info.plist +++ b/ios/ReactNativeChat/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 15 + 16 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/ReactNativeChatTests/Info.plist b/ios/ReactNativeChatTests/Info.plist index d22a425eb373..dd42a075f69b 100644 --- a/ios/ReactNativeChatTests/Info.plist +++ b/ios/ReactNativeChatTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 15 + 16 diff --git a/package-lock.json b/package-lock.json index f9cbcf5d41aa..8f1bbc09670f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-14", + "version": "1.0.1-15", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index d646ec7a5405..4fd252c13d56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-14", + "version": "1.0.1-15", "author": "Expensify, Inc.", "homepage": "https://expensify.com", "description": "Expensify Chat", From f0a9a10e66d6281b07115ca524ba70ba8b279c3f Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 17:33:11 -0700 Subject: [PATCH 27/34] Remove s3 from desktop as build does it now --- .github/workflows/desktop.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.github/workflows/desktop.yml b/.github/workflows/desktop.yml index 7944f6bd3a12..63e2533386a3 100644 --- a/.github/workflows/desktop.yml +++ b/.github/workflows/desktop.yml @@ -16,13 +16,6 @@ jobs: - name: Install node packages run: npm install - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - name: Decrypt Developer ID Certificate run: cd desktop && gpg --quiet --batch --yes --decrypt --passphrase="$DEVELOPER_ID_SECRET_PASSPHRASE" --output developer_id.p12 developer_id.p12.gpg env: @@ -37,9 +30,3 @@ jobs: APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - - - name: Zip desktop build - run: 7z a $GITHUB_WORKSPACE/dist/mac/Chat.app.zip $GITHUB_WORKSPACE/dist/mac/Chat.app - - - name: Deploy to S3 - run: aws s3 cp --acl public-read $GITHUB_WORKSPACE/dist/mac/Chat.app.zip s3://chat-test-expensify-com/Chat.app.zip From 5def1d61063426bc2aae573a8775fbb7b9c4bb64 Mon Sep 17 00:00:00 2001 From: github-action Date: Tue, 1 Sep 2020 00:34:52 +0000 Subject: [PATCH 28/34] Update version to 1.0.1-16 --- android/app/build.gradle | 4 ++-- ios/ReactNativeChat/Info.plist | 2 +- ios/ReactNativeChatTests/Info.plist | 2 +- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 265f9f204ccc..1d0b828bb42d 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,8 +138,8 @@ android { applicationId "com.expensifyreactnative.chat" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 16 - versionName "1.0.1-15" + versionCode 17 + versionName "1.0.1-16" } splits { abi { diff --git a/ios/ReactNativeChat/Info.plist b/ios/ReactNativeChat/Info.plist index e58a3b238e79..ab945b3285e6 100644 --- a/ios/ReactNativeChat/Info.plist +++ b/ios/ReactNativeChat/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 16 + 17 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/ReactNativeChatTests/Info.plist b/ios/ReactNativeChatTests/Info.plist index dd42a075f69b..d29f289ee53f 100644 --- a/ios/ReactNativeChatTests/Info.plist +++ b/ios/ReactNativeChatTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 16 + 17 diff --git a/package-lock.json b/package-lock.json index 8f1bbc09670f..fa1a629fb273 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-15", + "version": "1.0.1-16", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4fd252c13d56..2bdfaa1bbf59 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-15", + "version": "1.0.1-16", "author": "Expensify, Inc.", "homepage": "https://expensify.com", "description": "Expensify Chat", From 2d9e0d65f2a286a67731a780d6c2ad798fa51597 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 18:05:52 -0700 Subject: [PATCH 29/34] Update link with new install link and revert testing --- .github/workflows/desktop.yml | 4 +++- src/page/home/sidebar/AppLinks.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/desktop.yml b/.github/workflows/desktop.yml index 63e2533386a3..ecbb24894832 100644 --- a/.github/workflows/desktop.yml +++ b/.github/workflows/desktop.yml @@ -1,6 +1,8 @@ name: Build and Deploy Desktop -on: push +on: + push: + tags: ['**'] jobs: build: diff --git a/src/page/home/sidebar/AppLinks.js b/src/page/home/sidebar/AppLinks.js index dec89abad542..421263a09045 100644 --- a/src/page/home/sidebar/AppLinks.js +++ b/src/page/home/sidebar/AppLinks.js @@ -6,7 +6,7 @@ const AppLinks = () => ( <> Desktop From 31b3c2ae4b6fd132c0656ea4c8119450a7fc1821 Mon Sep 17 00:00:00 2001 From: github-action Date: Tue, 1 Sep 2020 01:07:45 +0000 Subject: [PATCH 30/34] Update version to 1.0.1-17 --- android/app/build.gradle | 4 ++-- ios/ReactNativeChat/Info.plist | 2 +- ios/ReactNativeChatTests/Info.plist | 2 +- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 1d0b828bb42d..777de1007303 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -138,8 +138,8 @@ android { applicationId "com.expensifyreactnative.chat" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 17 - versionName "1.0.1-16" + versionCode 18 + versionName "1.0.1-17" } splits { abi { diff --git a/ios/ReactNativeChat/Info.plist b/ios/ReactNativeChat/Info.plist index ab945b3285e6..2f0c281472fe 100644 --- a/ios/ReactNativeChat/Info.plist +++ b/ios/ReactNativeChat/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 17 + 18 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/ios/ReactNativeChatTests/Info.plist b/ios/ReactNativeChatTests/Info.plist index d29f289ee53f..061521b8cc17 100644 --- a/ios/ReactNativeChatTests/Info.plist +++ b/ios/ReactNativeChatTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 17 + 18 diff --git a/package-lock.json b/package-lock.json index fa1a629fb273..6813e8b4ffb3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-16", + "version": "1.0.1-17", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 2bdfaa1bbf59..e412a5c5dfd4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-chat", - "version": "1.0.1-16", + "version": "1.0.1-17", "author": "Expensify, Inc.", "homepage": "https://expensify.com", "description": "Expensify Chat", From 2fab683788c74b32bd3987afab65040b475573a8 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 18:15:18 -0700 Subject: [PATCH 31/34] Change version to happen on push to master only --- .github/workflows/version.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index 09f74d859c99..1c77ac4f69b9 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -1,6 +1,8 @@ name: Create a new version -on: push +on: + push: + branches: [ master ] jobs: build: From 91431a812516334c9bc712f1952d18baeef75c3a Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 18:15:56 -0700 Subject: [PATCH 32/34] Tweak style --- .github/workflows/version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index 1c77ac4f69b9..7f5826026e53 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -2,7 +2,7 @@ name: Create a new version on: push: - branches: [ master ] + branches: [master] jobs: build: From b314d0b6e200ccedb3b827b34e8c0288d0b3aec8 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 31 Aug 2020 18:36:38 -0700 Subject: [PATCH 33/34] Add logs back, they are helpful --- main.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.js b/main.js index b55b4ac81cf2..1b0b28944172 100644 --- a/main.js +++ b/main.js @@ -2,6 +2,7 @@ const {app, BrowserWindow, shell} = require('electron'); const serve = require('electron-serve'); const contextMenu = require('electron-context-menu'); const {autoUpdater} = require('electron-updater'); +const log = require('electron-log'); /** * Electron main process that handles wrapping the web application. @@ -17,6 +18,15 @@ app.commandLine.appendSwitch('disable-web-security'); // See https://github.com/sindresorhus/electron-context-menu contextMenu(); +// Send all autoUpdater logs to a log file: ~/Library/Logs/react-native-chat/main.log +// See https://www.npmjs.com/package/electron-log +autoUpdater.logger = log; +autoUpdater.logger.transports.file.level = 'info'; + +// Send all Console logs to a log file: ~/Library/Logs/react-native-chat/main.log +// See https://www.npmjs.com/package/electron-log +Object.assign(console, log.functions); + const mainWindow = (() => { const loadURL = serve({directory: 'dist'}); From 4de9d8fd5a758782073e3573194a2f6d4e9bc727 Mon Sep 17 00:00:00 2001 From: andrew Date: Tue, 1 Sep 2020 10:20:43 -0700 Subject: [PATCH 34/34] Set an hour timer to check for new app updates --- main.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 1b0b28944172..ad1c5ebabee3 100644 --- a/main.js +++ b/main.js @@ -10,6 +10,9 @@ const log = require('electron-log'); * @see: https://www.electronjs.org/docs/tutorial/application-architecture#main-and-renderer-processes */ +// Interval that we check for new versions of the app +const UPDATE_INTERVAL = 1000 * 60 * 60; + // TODO: Turn this off, use web-security after alpha launch, currently we receive a CORS issue preventing // the electron app from making any API requests. app.commandLine.appendSwitch('disable-web-security'); @@ -56,8 +59,15 @@ const mainWindow = (() => { return browserWindow; }) + + // After initializing and configuring the browser window, load the compiled JavaScript .then(browserWindow => loadURL(browserWindow)) - .then(() => autoUpdater.checkForUpdatesAndNotify()); + + // Check for a new version of the app on launch + .then(() => autoUpdater.checkForUpdatesAndNotify()) + + // Set a timer to check for new versions of the app + .then(() => setInterval(() => autoUpdater.checkForUpdatesAndNotify(), UPDATE_INTERVAL)); }); mainWindow().then(window => window);