Skip to content

Commit f80c326

Browse files
leofelix077piyalbasuaristidesstaffieriCassioMG
committed
Dismissable App Promo Banner (#2394)
* Feature/move history fetch to bg (#2273) * upgrade to yarn 2 and use resolutions to block vulnerable package versions (#2239) * upgrade to yarn 2 and use resolutions to block vulnerable package versions * rm deprecated .yarnrc * rm yarnpath * try committing yarn binary to repo * try corepack enable for gha * update run tests cmd * rm yarnpath * rm npm i yarn * update all pipelines * rm superfluous history types * ensure invoke host function tx shows contract parameters (#2243) * ensure invoke host function tx shows contract parameters * add test for fallback if contract spec retrieval fails * Bugfix/rm auth param names (#2244) * ensure invoke host function tx shows contract parameters * add test for fallback if contract spec retrieval fails * do not show contract parameters for authorizations * add tests for create contract v1 and invoke contract * add issuer for changeTrust op (#2246) * add issuer for changeTrust op * programmatically disable overflow:hidden when copying a value * Revert "add issuer for changeTrust op (#2246)" (#2247) This reverts commit 19c8a68. * Bugfix/add issuer for changetrust (#2249) * ensure invoke host function tx shows contract parameters * add test for fallback if contract spec retrieval fails * do not show contract parameters for authorizations * add tests for create contract v1 and invoke contract * add issuer for changeTrust op * programmatically disable overflow:hidden when copying a value * cache account balances and poll for updates * fix CI tests * rm `force:true` which was causing action to happen too fast * do a fresh balance fetch on account/network change * first pass at async history * pr comments * allow for history caching * add more sentry tracking for Account and Wallets views (#2268) * add more sentry tracking for Account and Wallets views * adding more sentry reporting * gracefully degrade on errors from Blockaid (#2269) * gracefully degrade on errors from Blockaid * should not be necessary to skip dapp scanning on custom network * rm extra dep * add a test for persisting configurations in the send flow (#2271) * add a test for persisting configurations in the send flow * rm logs and update muxed acct; lower xlm payment * rm slow loading simulation * handle missing scan-tx result; add disabled state for Confirm Anyway (#2272) * handle missing scan-tx result; add disabled state for Confirm Anyway * assertions to show correct confirm button on Blockaid error * add cache for balances to ensure we do a fresh lookup when needed (#2275) * add cache for balances to ensure we do a fresh lookup when needed * add try...catch to token-prices polling * rm log * only dispatch saveBalancesForAccount when fresh data has been fetched * adjust test to wait for UI change * replace yarn setup with just yarn * rm unnecessary return * clear token details on redux clear action * make history row construction async and check for redux state for updates * add tests for assetdetails * increase timeout for flakey test * pr comments * refresh account history every time account balances refresh * check for updated appdata before showing password modal (#2300) * check for updated appdata before showing password modal * update error msg * rm unused redirect logic * stringify errors rather than using `cause` (#2302) * Feature/move icons to own hook (#2308) * move get icons out of critical path; rely on background's cache * add tests and comments * add comment * add comment * only dispatch if we have cached icons * PR comments * skip blockaid scan on first fetch of account-balances (#2310) * skip blockaid scan on first fetch of account-balances * rm stub change * rm more stubs * rm log * add comments and update boolean naming * Dropdown menu option to copy wallet address (#2316) * add button to copy address from dropdown * Added translations * revert translation file changes * revert translation file changes * Added translations * revert changes to translation files * move copy address button to first dropdown position * scroll on long strings; pretty print json (#2320) * scroll on long strings; pretty print json * rm log * add correct snapshot for json message * rm log * finish comment * add error case for JSON * don't use carat for lib * update yarn.lock * move scrollbar to btm of container; reduce json font size * update snapshot * re-searching so should abort any in flight API requests (#2323) * re-searching so should abort any in flight API requests * add comment * fix test name * make test more reliable * add check for correct search results * fix jest locator * [FEATURE] new send/swap navigation flow (#2353) * adds SelectionTile and AddressTile, updates nav flows to match updates. Adds query parameter for default values in send flow * Added translations * adds address tile and uses it in swap flow, tweaks selection tile styles * adds unit tests for new tile components * Added translations * updates swap navigation flow to match updates, updates tests flows to match * updates back icon for send and swap steps, fixes bad test references * tweaks locator in address tile tests * adds store state to asset tile tests, removes asset icon mock * updates SelectionTile prop name, adds isSuspicious prop for AssetTile * adds placeholder value in TokenList for missing token USD value * uses real IdenticonImg in address tile unit tests * adds query param validation for send and swap flow * Update extension/src/popup/views/SendPayment/index.tsx Co-authored-by: Cássio Marcos Goulart <3228151+CassioMG@users.noreply.github.com> * adds missing import * adds class for tile icon --------- Co-authored-by: Cássio Marcos Goulart <3228151+CassioMG@users.noreply.github.com> * [FEATURE] adds send and swap buttons to asset detail view (#2351) * adds send and swap buttons to asset detail view * uses secondary button styles * removes run snapshots job (#2355) * release/5.35.4 (#2354) * upgrade to ledger-hq/hw-transport-webhid (#2350) * upgrade to ledger-hq/hw-transport-webhid * add tests * add ledger support for new trustline flow (#2352) * upgrade to ledger-hq/hw-transport-webhid * add ledger support for new trustline flow * only re-fetch balances if we were successful * test for fetching balances on success * add reset spys * adjust spacing at top of hw wallet modal * Now that `Done` button properly shows, click it in tests (#2356) * skip flakey test * skip flakey test * renames local vars to follow convention * adds tests for LP share and tweaks LP title * adds links with query params for asset detail CTAs --------- Co-authored-by: Piyal Basu <pbasu235@gmail.com> * only fetch asset list data if needed (#2369) * only fetch asset list data if needed * correctly show icon loading state * [BUG] SAC token management improvements (#2374) * adds SAC detection when changing trust in the add and remove token flows * updates arg signature for isAssetSac * Feature/cache token prices (#2373) * cache token prices and batch loading wallets * use similar methodology for token price and account balance caching * fix loading state trigger * fix tests * use helper for cache clearing * set isFetchingTokenPrices to false in catch handler * rollback error change * load backend settings async on Account view (#2381) * load backend settings async on Account view * rm console.logs * Feature/use ledger key for home domains (#2363) * use ledger-key/accounts endpoint for home domains * fix tests * create generic ledger key account helper; add tests * rm unneeded data-test prop * rm unused import * [CHORE] git process updates (#2361) * moves the add translations hook to the pre commit stage, removes standalone translations commit * adds script to update app version, removes version update from submit production action, adds update version step to test run action for release branches * removes version input, now uses package version * fetch asset domains in one calls * fix tests * cache home domains while iterating over account history rows * fitler non-G keys * rm .only * fix test param * PR comments --------- Co-authored-by: aristides <aristides.staffieri@stellar.org> * update version numbers for release * add v1 of dismissable app promo banner * rm unnecessary calls to make flows even faster (#2391) * makes send swap buttons stay in the container in full screen mode (#2392) * makes send swap buttons stay in the container in full screen mode * add a pause to make sure flakey e2e test has time to save changes * send app promotion store messages to background * use redux selector for allAccounts to properly update rename (#2403) * use redux selector for allAccounts to properly update rename * add longer timeout for flakey btn * adjust unified package imports * adjust dismiss app banner constants and return logic * revert add asset test change --------- Co-authored-by: Piyal Basu <pbasu235@gmail.com> Co-authored-by: aristides <aristides.staffieri@stellar.org> Co-authored-by: Cássio Marcos Goulart <3228151+CassioMG@users.noreply.github.com>
1 parent 0194dc2 commit f80c326

15 files changed

Lines changed: 270 additions & 2 deletions

File tree

@shared/api/internal.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,6 +1868,34 @@ export const getTokenIds = async ({
18681868
return tokenIdList;
18691869
};
18701870

1871+
export const getMobileAppBannerDismissed = async (): Promise<boolean> => {
1872+
const { isDismissed, error } = await sendMessageToBackground({
1873+
activePublicKey: null,
1874+
type: SERVICE_TYPES.GET_MOBILE_APP_BANNER_DISMISSED,
1875+
});
1876+
1877+
if (error) {
1878+
return false;
1879+
}
1880+
1881+
return !!isDismissed;
1882+
};
1883+
1884+
export const dismissMobileAppBanner = async (): Promise<{
1885+
isDismissed: boolean;
1886+
}> => {
1887+
const { isDismissed, error } = await sendMessageToBackground({
1888+
activePublicKey: null,
1889+
type: SERVICE_TYPES.DISMISS_MOBILE_APP_BANNER,
1890+
});
1891+
1892+
if (error) {
1893+
throw new Error(error);
1894+
}
1895+
1896+
return { isDismissed: !!isDismissed };
1897+
};
1898+
18711899
export const removeTokenId = async ({
18721900
activePublicKey,
18731901
contractId,

@shared/api/types/message-request.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,14 @@ export interface GetHiddenAssetsMessage extends BaseMessage {
352352
type: SERVICE_TYPES.GET_HIDDEN_ASSETS;
353353
}
354354

355+
export interface GetMobileAppBannerDismissedMessage extends BaseMessage {
356+
type: SERVICE_TYPES.GET_MOBILE_APP_BANNER_DISMISSED;
357+
}
358+
359+
export interface DismissMobileAppBannerMessage extends BaseMessage {
360+
type: SERVICE_TYPES.DISMISS_MOBILE_APP_BANNER;
361+
}
362+
355363
export type ServiceMessageRequest =
356364
| FundAccountMessage
357365
| CreateAccountMessage
@@ -407,4 +415,6 @@ export type ServiceMessageRequest =
407415
| ModifyAssetsListMessage
408416
| GetIsAccountMismatchMessage
409417
| ChangeAssetVisibilityMessage
410-
| GetHiddenAssetsMessage;
418+
| GetHiddenAssetsMessage
419+
| GetMobileAppBannerDismissedMessage
420+
| DismissMobileAppBannerMessage;

@shared/api/types/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export interface Response {
117117
};
118118
hiddenAssets: Record<IssuerKey, AssetVisibility>;
119119
isOverwritingAccount: boolean;
120+
isDismissed: boolean;
120121
}
121122

122123
export interface MemoRequiredAccount {

@shared/constants/services.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ export enum SERVICE_TYPES {
5454
CHANGE_ASSET_VISIBILITY = "CHANGE_ASSET_VISIBILITY",
5555
GET_HIDDEN_ASSETS = "GET_HIDDEN_ASSETS",
5656
GET_IS_ACCOUNT_MISMATCH = "GET_IS_ACCOUNT_MISMATCH",
57+
GET_MOBILE_APP_BANNER_DISMISSED = "GET_MOBILE_APP_BANNER_DISMISSED",
58+
DISMISS_MOBILE_APP_BANNER = "DISMISS_MOBILE_APP_BANNER",
5759
}
5860

5961
export enum EXTERNAL_SERVICE_TYPES {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { DataStorageAccess } from "background/helpers/dataStorageAccess";
2+
import { MOBILE_APP_BANNER_DISMISSED } from "constants/localStorageTypes";
3+
4+
export const dismissMobileAppBanner = async ({
5+
localStore,
6+
}: {
7+
localStore: DataStorageAccess;
8+
}): Promise<{ isDismissed: boolean }> => {
9+
await localStore.setItem(MOBILE_APP_BANNER_DISMISSED, true);
10+
const isDismissed = await localStore.getItem(MOBILE_APP_BANNER_DISMISSED);
11+
return { isDismissed: !!isDismissed };
12+
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { DataStorageAccess } from "background/helpers/dataStorageAccess";
2+
import { MOBILE_APP_BANNER_DISMISSED } from "constants/localStorageTypes";
3+
4+
export const getMobileAppBannerDismissed = async ({
5+
localStore,
6+
}: {
7+
localStore: DataStorageAccess;
8+
}): Promise<{ isDismissed: boolean }> => {
9+
const dismissed = await localStore.getItem(MOBILE_APP_BANNER_DISMISSED);
10+
return { isDismissed: !!dismissed };
11+
};

extension/src/background/messageListener/popupMessageListener.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ import { modifyAssetsList } from "./handlers/modifyAssetsList";
7373
import { getIsAccountMismatch } from "./handlers/getIsAccountMismatch";
7474
import { changeAssetVisibility } from "./handlers/changeAssetVisibility";
7575
import { getHiddenAssets } from "./handlers/getHiddenAssets";
76+
import { getMobileAppBannerDismissed } from "./handlers/getMobileAppBannerDismissed";
77+
import { dismissMobileAppBanner } from "./handlers/dismissMobileAppBanner";
7678
import { loadBackendSettings } from "./handlers/loadBackendSettings";
7779

7880
const numOfPublicKeysToCheck = 5;
@@ -470,6 +472,16 @@ export const popupMessageListener = (
470472
localStore,
471473
});
472474
}
475+
case SERVICE_TYPES.GET_MOBILE_APP_BANNER_DISMISSED: {
476+
return getMobileAppBannerDismissed({
477+
localStore,
478+
});
479+
}
480+
case SERVICE_TYPES.DISMISS_MOBILE_APP_BANNER: {
481+
return dismissMobileAppBanner({
482+
localStore,
483+
});
484+
}
473485
default:
474486
return { error: "Message type not supported" };
475487
}

extension/src/constants/localStorageTypes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ export const IS_HIDE_DUST_ENABLED_ID = "isHideDustEnabled";
2626
export const HIDDEN_ASSETS = "hiddenAssets";
2727
export const TEMPORARY_STORE_ID = "temporaryStore";
2828
export const TEMPORARY_STORE_EXTRA_ID = "temporaryStoreExtra";
29+
export const MOBILE_APP_BANNER_DISMISSED = "mobileAppBannerDismissed";
4.48 KB
Loading

extension/src/popup/components/account/AccountHeader/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { signOut } from "popup/ducks/accountServices";
2424
import { AccountHeaderModal } from "popup/components/account/AccountHeaderModal";
2525
import { NetworkIcon } from "popup/components/manageNetwork/NetworkIcon";
2626
import { NetworkDetails } from "@shared/constants/stellar";
27+
import { MobileAppBanner } from "popup/components/account/MobileAppBanner";
2728
import { AccountTabs } from "popup/components/account/AccountTabs";
2829

2930
import "./styles.scss";
@@ -381,7 +382,7 @@ export const AccountHeader = ({
381382
</div>
382383
</NavLink>
383384
</div>
384-
385+
<MobileAppBanner />
385386
{isBackgroundActive
386387
? createPortal(
387388
<LoadingBackground

0 commit comments

Comments
 (0)