diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 121c127..21acceb 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -78,7 +78,7 @@ jobs: strategy: max-parallel: 4 matrix: - variant: ['full', 'lite'] + variant: ['full', 'lite', 'mac'] steps: - name: Build info @@ -136,6 +136,14 @@ jobs: npm run build npm run build-zip + - name: Build Mac version + if: matrix.variant == 'mac' + shell: bash + run: | + npm install + npm run build:mac + npm run build-zip + - name: Package extension run: | ZIP_NAME=$(find dist-zip -type f -name '*.zip' | head -n 1) diff --git a/README.md b/README.md index 33fe78f..4e25b00 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,12 @@ In order to build the extension yourself, please follow these steps: - (Optional, only useful for beta build) Build beta version: change `betaRev` in `package.json`, then generate zip file using +## How to build a version for Mac + +For the development, you can run `npm run start:mac` for the Mac app. + +For the production release, `npm run build:mac` + ```bash npm run build:beta && npm run build-zip ``` \ No newline at end of file diff --git a/package.json b/package.json index ef03020..eb37417 100644 --- a/package.json +++ b/package.json @@ -13,11 +13,13 @@ "build:lite": "cross-env NODE_ENV=production LITE=1 webpack", "build:beta": "cross-env NODE_ENV=production BETA=1 webpack", "build:dev": "cross-env NODE_ENV=development BETA=1 webpack", + "build:mac": "cross-env NODE_ENV=production MAC=1 webpack", "build-zip": "node scripts/build-zip.js", "generate:buildconfig": "node scripts/generateBuildConfig.js", "watch": "npm run build -- --watch", "watch:dev": "cross-env HMR=true npm run build:dev -- --watch", - "start": "cross-env HMR=true npm run build:dev -- --watch" + "start": "cross-env HMR=true npm run build:dev -- --watch", + "start:mac": "cross-env HMR=true MAC=1 npm run build:dev -- --watch" }, "dependencies": { "@fortawesome/fontawesome-svg-core": "^1.2.36", diff --git a/src/popup/components/AppSettings.vue b/src/popup/components/AppSettings.vue index 38ea19e..a12c006 100644 --- a/src/popup/components/AppSettings.vue +++ b/src/popup/components/AppSettings.vue @@ -5,6 +5,18 @@ App Settings ({{ userEmail }})
+|
@@ -27,7 +39,9 @@
v-show="showSLButton"
target="_blank"
>
- + |
@@ -114,6 +128,7 @@ export default {
extension_version: "development",
userEmail: "",
theme: "",
+ freeAccount: false,
THEMES,
THEME_LABELS,
};
@@ -136,6 +151,11 @@ export default {
API_ON_ERR.TOAST
);
this.userEmail = userInfo.data.email;
+ if (userInfo.data.in_trial) {
+ this.freeAccount = true;
+ } else {
+ this.freeAccount = !userInfo.data.is_premium;
+ }
},
methods: {
async handleToggleSLButton() {
@@ -165,6 +185,16 @@ export default {
await SLStorage.remove(SLStorage.SETTINGS.API_KEY);
EventManager.broadcast(EventManager.EVENT.SETTINGS_CHANGED);
Navigation.clearHistoryAndNavigateTo(Navigation.PATH.LOGIN);
+
+ if (process.env.MAC) {
+ console.log("send log out event to host app");
+ await browser.runtime.sendNativeMessage(
+ "application.id",
+ JSON.stringify({
+ logged_out: {},
+ })
+ );
+ }
},
async setMailToUri() {
@@ -175,6 +205,22 @@ export default {
);
this.reportURISLButton = `mailto:extension@simplelogin.io?subject=${subject}&body=${body}`;
},
+ async upgrade() {
+ if (process.env.MAC) {
+ console.log("send upgrade event to host app");
+ await browser.runtime.sendNativeMessage(
+ "application.id",
+ JSON.stringify({
+ upgrade: {},
+ })
+ );
+ } else {
+ console.info("can't send data to native app", error);
+ let apiUrl = await SLStorage.get(SLStorage.SETTINGS.API_URL);
+ let upgradeURL = apiUrl + "/dashboard/pricing";
+ browser.tabs.create({ url: upgradeURL });
+ }
+ },
},
computed: {},
watch: {
diff --git a/src/popup/components/Main.vue b/src/popup/components/Main.vue
index afdc2e7..3757036 100644
--- a/src/popup/components/Main.vue
+++ b/src/popup/components/Main.vue
@@ -93,14 +93,19 @@
class="btn btn-outline-primary btn-sm"
@click="createRandomAlias"
>
-