Skip to content

Commit 8f5b0a1

Browse files
committed
refactor: remove track balance alarm and related analytics functionality
1 parent 1666b53 commit 8f5b0a1

File tree

4 files changed

+0
-73
lines changed

4 files changed

+0
-73
lines changed

src/api/background/background-setup.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { handleActiveAddressChange } from "~api/background/handlers/storage/acti
99
import { handleWalletsChange } from "~api/background/handlers/storage/wallet-change/wallet-change.handler";
1010
import { handleAppsChange } from "~api/background/handlers/storage/apps-change/app-change.handler";
1111
import { handleAppConfigChange } from "~api/background/handlers/storage/app-config-change/app-config-change.handler";
12-
import { handleTrackBalanceAlarm } from "~api/background/handlers/alarms/track-balance/track-balance-alarm.handler";
1312
import { handleGetPrinters } from "~api/background/handlers/browser/printer/get-printers/get-printers.handler";
1413
import { handleGetCapabilities } from "~api/background/handlers/browser/printer/get-capabilities/get-capabilities.handler";
1514
import { handlePrint } from "~api/background/handlers/browser/printer/print/print.handler";
@@ -98,7 +97,6 @@ export function setupBackgroundService() {
9897
// ALARMS:
9998
browser.alarms.onAlarm.addListener(handleNotificationsAlarm);
10099
browser.alarms.onAlarm.addListener(handleSubscriptionsAlarm);
101-
browser.alarms.onAlarm.addListener(handleTrackBalanceAlarm);
102100
browser.alarms.onAlarm.addListener(handleGatewayUpdateAlarm);
103101
browser.alarms.onAlarm.addListener(handleSyncLabelsAlarm);
104102
browser.alarms.onAlarm.addListener(handleKeyRemovalAlarm);

src/api/background/handlers/alarms/track-balance/track-balance-alarm.handler.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/api/background/handlers/browser/install/install.handler.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { scheduleGatewayUpdate } from "~gateways/cache";
22
import browser, { type Runtime } from "webextension-polyfill";
33
import { loadTokens } from "~tokens/token";
4-
import { initializeARBalanceMonitor } from "~utils/analytics";
54
import { handleGatewayUpdateAlarm } from "~api/background/handlers/alarms/gateway-update/gateway-update-alarm.handler";
65
import { openOrSelectWelcomePage } from "~wallets";
76
import { ExtensionStorage } from "~utils/storage";
@@ -38,9 +37,6 @@ export async function handleInstall(details: Runtime.OnInstalledDetailsType) {
3837
browser.alarms.create("sync_labels", { delayInMinutes: 1, periodInMinutes: 360 });
3938
}
4039

41-
// init monthly AR
42-
await initializeARBalanceMonitor();
43-
4440
// initialize alarm to fetch notifications
4541
browser.alarms.create("notifications", { periodInMinutes: 10 });
4642

src/utils/analytics.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export enum EventType {
2222
CONNECTED_APP = "CONNECTED_APP",
2323
LOGIN = "LOGIN",
2424
ONBOARDED = "ONBOARDED",
25-
BALANCE = "BALANCE",
2625
SIGNED = "SIGNED",
2726
TRANSACTION_INCOMPLETE = "TRANSACTION_INCOMPLETE",
2827
FALLBACK = "FALLBACK",
@@ -228,32 +227,6 @@ export const trackEvent = async (eventName: EventType, properties: any) => {
228227
}
229228
};
230229

231-
/**
232-
* Initializes the AR balance event tracker.
233-
* This function sets up a monthly alarm to track the total balance.
234-
* It schedules the first alarm to the start of the next month and
235-
* stores this schedule time in the extension storage.
236-
*/
237-
238-
export const initializeARBalanceMonitor = async () => {
239-
const timer = setToStartOfNextMonth(new Date());
240-
browser.alarms.create("track-balance", {
241-
when: timer.getTime(),
242-
});
243-
};
244-
245-
/**
246-
* Sets the given date to the start of the next month in UTC
247-
* The time is set to beginning of the month (00:00:00.000).
248-
* @param {Date} currentDate
249-
* @returns {Date} Date to trigger alarm
250-
*/
251-
252-
export const setToStartOfNextMonth = (currentDate: Date): Date => {
253-
const newDate = new Date(Date.UTC(currentDate.getUTCFullYear(), currentDate.getUTCMonth() + 1, 1, 0, 0, 0, 0));
254-
return newDate;
255-
};
256-
257230
export interface WalletBitsCheck {
258231
checked: boolean;
259232
mismatch: boolean;

0 commit comments

Comments
 (0)