Skip to content

Commit

Permalink
Merge pull request #454 from enkryptcom/devop/ff-pp-changes-2
Browse files Browse the repository at this point in the history
devop: open pp as the first on install
  • Loading branch information
kvhnuke authored Jun 7, 2024
2 parents 08b6e1d + 4a6e43b commit eb78331
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 28 deletions.
2 changes: 1 addition & 1 deletion packages/extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@enkryptcom/extension",
"version": "1.40.2",
"version": "1.40.3",
"private": true,
"scripts": {
"zip": "cd dist; zip -r release.zip *;",
Expand Down
12 changes: 7 additions & 5 deletions packages/extension/src/libs/metrics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ const trackDAppsEvents = (
};

const optOutofMetrics = (optOut: boolean) => {
metrics.setOptOut(false);
metrics.track("settings", {
event: SettingEventType.OptOut,
value: optOut ? 1 : 0,
});
if (!process.env.IS_FIREFOX) {
metrics.setOptOut(false);
metrics.track("settings", {
event: SettingEventType.OptOut,
value: optOut ? 1 : 0,
});
}
metrics.setOptOut(optOut);
};

Expand Down
6 changes: 6 additions & 0 deletions packages/extension/src/libs/utils/open-onboard.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import Browser from "webextension-polyfill";

export const openPrivacy = () => {
const onboardURL = Browser.runtime.getURL("onboard.html#/user-privacy");
Browser.tabs.create({
url: onboardURL,
});
};
export default () => {
const onboardURL = Browser.runtime.getURL("onboard.html");
Browser.tabs.create({
Expand Down
4 changes: 3 additions & 1 deletion packages/extension/src/scripts/firefox/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import { InternalOnMessageResponse } from "@/types/messenger";
import { OnMessageResponse } from "@enkryptcom/types";
import Browser from "webextension-polyfill";
import openOnboard from "@/libs/utils/open-onboard";
import openOnboard, { openPrivacy } from "@/libs/utils/open-onboard";

import(/* webpackChunkName: "background-chunk" */ "@/libs/background").then(
({ default: BackgroundHandler }) => {
Expand Down Expand Up @@ -42,5 +42,7 @@ import(/* webpackChunkName: "background-chunk" */ "@/libs/background").then(
Browser.runtime.onInstalled.addListener((object) => {
if (object.reason === "install") {
openOnboard();
} else if (object.reason === "update") {
openPrivacy();
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,7 @@ const nextAction = () => {
isInitializing.value = true;
onboardInitializeWallets(phrase, password).then(() => {
isInitializing.value = false;
if (process.env.IS_FIREFOX) {
router.push({ name: routes.userAnalytics.name });
} else {
router.push({ name: routes.walletReady.name });
}
router.push({ name: routes.walletReady.name });
});
};
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,9 @@ const nextAction = () => {
isInitializing.value = true;
onboardInitializeWallets(store.mnemonic, store.password).then(() => {
isInitializing.value = false;
if (process.env.IS_FIREFOX) {
router.push({ name: routes.userAnalytics.name });
} else {
router.push({
name: routes.walletReady.name,
});
}
router.push({
name: routes.walletReady.name,
});
});
}
};
Expand Down
25 changes: 20 additions & 5 deletions packages/extension/src/ui/onboard/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,24 @@ let uiRoutes: RouteRecordRaw[] = [];
uiRoutes = uiRoutes.concat(CreateWalletUI());
uiRoutes = uiRoutes.concat(RestoreWalletUI());
uiRoutes = uiRoutes.concat(HardwareWalletUI());
const routes = [
{ path: "/", component: NewWallet, name: "new-wallet" },
{ path: "/user-analytics", component: UserAnalytics, name: "user-analytics" },
...uiRoutes,
];
const routes = [...uiRoutes];
if (process.env.IS_FIREFOX) {
routes.unshift({
path: "/new-wallet",
component: NewWallet,
name: "new-wallet",
});
routes.unshift({
path: "/",
component: UserAnalytics,
name: "user-analytics",
});
routes.unshift({
path: "/user-privacy",
component: UserAnalytics,
name: "user-privacy",
});
} else {
routes.unshift({ path: "/", component: NewWallet, name: "new-wallet" });
}
export default routes;
16 changes: 12 additions & 4 deletions packages/extension/src/ui/onboard/user-analytics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ import LogoBig from "@action/icons/common/logo-big.vue";
import BaseButton from "@action/components/base-button/index.vue";
import SettingsState from "@/libs/settings-state";
import { optOutofMetrics } from "@/libs/metrics";
import { routes as cwalletRoutes } from "./create-wallet/routes";
import { useRouter } from "vue-router";
import { useRouter, useRoute } from "vue-router";
const router = useRouter();
const route = useRoute();
const settingsState = new SettingsState();
Expand All @@ -47,15 +47,23 @@ const agree = async () => {
enkryptSettings.isMetricsEnabled = true;
await settingsState.setEnkryptSettings(enkryptSettings);
optOutofMetrics(false);
router.push({ name: cwalletRoutes.walletReady.name });
if (route.name === "user-privacy") {
window.close();
} else {
router.push({ name: "new-wallet" });
}
};
const deny = async () => {
const enkryptSettings = await settingsState.getEnkryptSettings();
enkryptSettings.isMetricsEnabled = false;
await settingsState.setEnkryptSettings(enkryptSettings);
optOutofMetrics(true);
router.push({ name: cwalletRoutes.walletReady.name });
if (route.name === "user-privacy") {
window.close();
} else {
router.push({ name: "new-wallet" });
}
};
</script>

Expand Down

2 comments on commit eb78331

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.