Only show pack installed tooltip for non-blessed, local installs

This commit is contained in:
Scott Nonnenberg 2020-01-09 06:35:33 -08:00 committed by Ken Powers
parent a0e9bb80a9
commit 0f9bc57ccb
2 changed files with 14 additions and 5 deletions

View File

@ -103,6 +103,7 @@ type StickerAddedAction = {
type InstallStickerPackPayloadType = {
packId: string;
fromSync: boolean;
status: 'installed';
installedAt: number;
recentStickers: Array<RecentStickerType>;
@ -121,6 +122,7 @@ type ClearInstalledStickerPackAction = {
type UninstallStickerPackPayloadType = {
packId: string;
fromSync: boolean;
status: 'downloaded';
installedAt: null;
recentStickers: Array<RecentStickerType>;
@ -258,8 +260,9 @@ async function doInstallStickerPack(
return {
packId,
installedAt: timestamp,
fromSync,
status,
installedAt: timestamp,
recentStickers: recentStickers.map(item => ({
packId: item.packId,
stickerId: item.id,
@ -298,6 +301,7 @@ async function doUninstallStickerPack(
return {
packId,
fromSync,
status,
installedAt: null,
recentStickers: recentStickers.map(item => ({
@ -426,7 +430,7 @@ export function reducer(
action.type === 'stickers/UNINSTALL_STICKER_PACK_FULFILLED'
) {
const { payload } = action;
const { installedAt, packId, status, recentStickers } = payload;
const { fromSync, installedAt, packId, status, recentStickers } = payload;
const { packs } = state;
const existingPack = packs[packId];
@ -440,9 +444,12 @@ export function reducer(
};
}
const isBlessed = state.blessedPacks[packId];
const installedPack = !fromSync && !isBlessed ? packId : null;
return {
...state,
installedPack: packId,
installedPack,
packs: {
...packs,
[packId]: {

View File

@ -13,6 +13,7 @@ import {
getInstalledStickerPacks,
getKnownStickerPacks,
getReceivedStickerPacks,
getRecentlyInstalledStickerPack,
getRecentStickers,
} from '../selectors/stickers';
@ -40,6 +41,8 @@ const mapStateToProps = (state: StateType, props: ExternalProps) => {
const blessedPacks = getBlessedStickerPacks(state);
const knownPacks = getKnownStickerPacks(state);
const installedPack = getRecentlyInstalledStickerPack(state);
const recentStickers = getRecentStickers(state);
const showIntroduction = get(
state.items,
@ -61,8 +64,7 @@ const mapStateToProps = (state: StateType, props: ExternalProps) => {
skinTone: get(state, ['items', 'skinTone'], 0),
// Stickers
receivedPacks,
// 'Installed Pack' tooltip disabled for now
installedPack: null,
installedPack,
blessedPacks,
knownPacks,
installedPacks,