Skip to content

Commit

Permalink
TW-1456: Limit DApps list for iOS (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-tsx authored May 20, 2024
1 parent 3a5a915 commit 05e6803
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/getDAppsStats.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { dappList } from './utils/dapp-list-constants';
import { DAPPS_LIST, IOS_DAPPS_LIST } from './utils/dapp-list-constants';
import logger from './utils/logger';

const getDAppsStats = async () => {
const getDAppsStats = (forIOs: boolean) => {
logger.info('Getting dApps list...');

return {
dApps: dappList
dApps: forIOs ? IOS_DAPPS_LIST : DAPPS_LIST
};
};

Expand Down
10 changes: 7 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ app.use(pinoHttp(PINO_LOGGER));
app.use(cors());
app.use(bodyParser.json());

const dAppsProvider = new SingleQueryDataProvider(15 * 60 * 1000, getDAppsStats);

const androidApp = firebaseAdmin.initializeApp(
{
projectId: 'templewallet-fa3b3'
Expand Down Expand Up @@ -162,7 +160,13 @@ app.post('/api/notifications', basicAuth, async (req, res) => {
}
});

app.get('/api/dapps', makeProviderDataRequestHandler(dAppsProvider));
app.get('/api/dapps', (req, res) => {
const platform = req.query.platform;

const data = getDAppsStats(platform === 'ios');

res.status(200).header('Cache-Control', 'public, max-age=300').send(data);
});

app.get('/api/abtest', (_, res) => {
const data = getABData();
Expand Down
39 changes: 37 additions & 2 deletions src/utils/dapp-list-constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
interface DappList {
interface DappListItem {
name: string;
dappUrl: string;
type: DappType;
Expand All @@ -16,7 +16,7 @@ enum DappType {
Other = 'Other'
}

export const dappList: DappList[] = [
export const DAPPS_LIST: DappListItem[] = [
{
name: 'QuipuSwap',
dappUrl: 'https://quipuswap.com',
Expand Down Expand Up @@ -154,3 +154,38 @@ export const dappList: DappList[] = [
categories: [DappType.DeFi]
}
];

export const IOS_DAPPS_LIST: DappListItem[] = [
{
name: 'Tezos Projects',
dappUrl: 'https://ecosystem.tezos.com',
logo: 'https://temple-wallet-stage-bucket.nyc3.cdn.digitaloceanspaces.com/dapps/tezos.png',
slug: 'ecosystem.tezos.com',
type: DappType.Other,
categories: []
},
{
name: 'Mad.Fish',
dappUrl: 'https://mad.fish/products',
logo: 'https://temple-wallet-stage-bucket.nyc3.cdn.digitaloceanspaces.com/dapps/madfish.png',
slug: 'mad.fish/products',
type: DappType.Other,
categories: []
},
{
name: 'Temple Wallet',
dappUrl: 'https://templewallet.com/download?platform=extension',
logo: 'https://temple-wallet-stage-bucket.nyc3.cdn.digitaloceanspaces.com/dapps/temple.png',
slug: 'download-tw-extension',
type: DappType.Other,
categories: []
},
{
name: 'TZKT',
dappUrl: 'https://tzkt.io/dapps',
logo: 'https://temple-wallet-stage-bucket.nyc3.cdn.digitaloceanspaces.com/dapps/tzkt.png',
slug: 'tzkt.io/dapps',
type: DappType.Other,
categories: []
}
];

0 comments on commit 05e6803

Please sign in to comment.