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

View file

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