Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosrdz committed Oct 27, 2024
1 parent 51813d9 commit 14b1b1d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/openapi/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ import { components } from "./api";
export const NOTIFICATION_LEVEL_TRANSACTIONS: components["schemas"]["NotificationLevel"] = "transactions";
export const NOTIFICATION_LEVEL_NEWS: components["schemas"]["NotificationLevel"] = "news";
export const NOTIFICATION_LEVEL_PRICE: components["schemas"]["NotificationLevel"] = "price";
export const NOTIFICATION_LEVEL_TIPS: components["schemas"]["NotificationLevel"] = "tips";
export const NOTIFICATION_CATEGORY_TRANSACTION = "TRANSACTION_CATEGORY"; // Add category only for type 2, 3 and 4
export const NOTIFICATION_LEVEL_TIPS: components["schemas"]["NotificationLevel"] = "tips";
5 changes: 0 additions & 5 deletions src/worker-processmempool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ async function processMempool() {
os: "ios",
};

// Add category only if type is 2, 3, or 4
if ([2, 3, 4].includes(payload.type)) {
payload.category = NOTIFICATION_CATEGORY_TRANSACTION;
}

allPotentialPushPayloadsArray.push(payload);
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/worker-sender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import "reflect-metadata";
import { SendQueue } from "./entity/SendQueue";
import { GroundControlToMajorTom } from "./class/GroundControlToMajorTom";
import { TokenConfiguration } from "./entity/TokenConfiguration";
import { NOTIFICATION_CATEGORY_TRANSACTION, NOTIFICATION_LEVEL_NEWS, NOTIFICATION_LEVEL_PRICE, NOTIFICATION_LEVEL_TIPS, NOTIFICATION_LEVEL_TRANSACTIONS } from "./openapi/constants";
import { NOTIFICATION_LEVEL_NEWS, NOTIFICATION_LEVEL_PRICE, NOTIFICATION_LEVEL_TIPS, NOTIFICATION_LEVEL_TRANSACTIONS } from "./openapi/constants";
import dataSource from "./data-source";
import { components } from "./openapi/api";
require("dotenv").config();
Expand Down Expand Up @@ -107,14 +107,12 @@ dataSource
switch (payload.type) {
case 2:
payload = <components["schemas"]["PushNotificationOnchainAddressGotPaid"]>payload;
payload.category = NOTIFICATION_CATEGORY_TRANSACTION;
process.env.VERBOSE && console.log("pushing to token", payload.token, payload.os);
await GroundControlToMajorTom.pushOnchainAddressWasPaid(connection, GroundControlToMajorTom.getGoogleServerKey(), GroundControlToMajorTom.getApnsJwtToken(), payload);
await sendQueueRepository.remove(record);
break;
case 3:
payload = <components["schemas"]["PushNotificationOnchainAddressGotUnconfirmedTransaction"]>payload;
payload.category = NOTIFICATION_CATEGORY_TRANSACTION;
process.env.VERBOSE && console.log("pushing to token", payload.token, payload.os);
await GroundControlToMajorTom.pushOnchainAddressGotUnconfirmedTransaction(connection, GroundControlToMajorTom.getGoogleServerKey(), GroundControlToMajorTom.getApnsJwtToken(), payload);
await sendQueueRepository.remove(record);
Expand All @@ -127,7 +125,6 @@ dataSource
break;
case 4:
payload = <components["schemas"]["PushNotificationTxidGotConfirmed"]>payload;
payload.category = NOTIFICATION_CATEGORY_TRANSACTION;
process.env.VERBOSE && console.log("pushing to token", payload.token, payload.os);
await GroundControlToMajorTom.pushOnchainTxidGotConfirmed(connection, GroundControlToMajorTom.getGoogleServerKey(), GroundControlToMajorTom.getApnsJwtToken(), payload);
await sendQueueRepository.remove(record);
Expand Down

0 comments on commit 14b1b1d

Please sign in to comment.