@planningcenter/chat-react-native 4.8.0-rc.8 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/conversation/message_form.d.ts.map +1 -1
- package/build/components/conversation/message_form.js +31 -25
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/conversations/app_update_banner.d.ts +2 -0
- package/build/components/conversations/app_update_banner.d.ts.map +1 -0
- package/build/components/conversations/app_update_banner.js +52 -0
- package/build/components/conversations/app_update_banner.js.map +1 -0
- package/build/components/conversations/bulk_conversation_actions_bar.d.ts +2 -0
- package/build/components/conversations/bulk_conversation_actions_bar.d.ts.map +1 -0
- package/build/components/conversations/bulk_conversation_actions_bar.js +215 -0
- package/build/components/conversations/bulk_conversation_actions_bar.js.map +1 -0
- package/build/components/conversations/conversation_actions.d.ts.map +1 -1
- package/build/components/conversations/conversation_actions.js +202 -161
- package/build/components/conversations/conversation_actions.js.map +1 -1
- package/build/components/conversations/conversation_preview.d.ts.map +1 -1
- package/build/components/conversations/conversation_preview.js +129 -115
- package/build/components/conversations/conversation_preview.js.map +1 -1
- package/build/components/conversations/swipeable_toggle_button.d.ts +5 -1
- package/build/components/conversations/swipeable_toggle_button.d.ts.map +1 -1
- package/build/components/conversations/swipeable_toggle_button.js +96 -67
- package/build/components/conversations/swipeable_toggle_button.js.map +1 -1
- package/build/components/display/icon.d.ts +3 -1
- package/build/components/display/icon.d.ts.map +1 -1
- package/build/components/display/icon.js +2 -0
- package/build/components/display/icon.js.map +1 -1
- package/build/components/primitive/banner_primitive.js +7 -3
- package/build/components/primitive/banner_primitive.js.map +1 -1
- package/build/screens/conversation_actions_screen.d.ts +2 -0
- package/build/screens/conversation_actions_screen.d.ts.map +1 -1
- package/build/screens/conversation_actions_screen.js +380 -46
- package/build/screens/conversation_actions_screen.js.map +1 -1
- package/build/screens/conversations/conversations_screen.d.ts +1 -0
- package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
- package/build/screens/conversations/conversations_screen.js +105 -33
- package/build/screens/conversations/conversations_screen.js.map +1 -1
- package/build/utils/native_adapters/configuration.d.ts +3 -0
- package/build/utils/native_adapters/configuration.d.ts.map +1 -1
- package/build/utils/native_adapters/configuration.js +3 -0
- package/build/utils/native_adapters/configuration.js.map +1 -1
- package/build/utils/native_adapters/index.d.ts +1 -0
- package/build/utils/native_adapters/index.d.ts.map +1 -1
- package/build/utils/native_adapters/index.js +1 -0
- package/build/utils/native_adapters/index.js.map +1 -1
- package/build/utils/native_adapters/updates.d.ts +11 -0
- package/build/utils/native_adapters/updates.d.ts.map +1 -0
- package/build/utils/native_adapters/updates.js +8 -0
- package/build/utils/native_adapters/updates.js.map +1 -0
- package/build/utils/theme.js +20 -21
- package/build/utils/theme.js.map +1 -1
- package/package.json +2 -2
- package/src/components/conversation/__tests__/message_form.test.tsx +19 -2
- package/src/components/conversation/message_form.tsx +15 -2
- package/src/components/conversations/__tests__/app_update_banner.test.tsx +27 -0
- package/src/components/conversations/__tests__/bulk_conversation_actions_bar.test.tsx +95 -0
- package/src/components/conversations/__tests__/conversation_actions.test.tsx +10 -3
- package/src/components/conversations/app_update_banner.tsx +36 -0
- package/src/components/conversations/bulk_conversation_actions_bar.tsx +140 -0
- package/src/components/conversations/conversation_actions.tsx +51 -34
- package/src/components/conversations/conversation_preview.tsx +8 -1
- package/src/components/conversations/swipeable_toggle_button.tsx +45 -16
- package/src/components/display/icon.tsx +3 -0
- package/src/components/primitive/banner_primitive.tsx +5 -1
- package/src/screens/__tests__/conversation_actions_screen.test.tsx +48 -6
- package/src/screens/conversation_actions_screen.tsx +145 -12
- package/src/screens/conversations/__tests__/conversations_screen.test.tsx +34 -8
- package/src/screens/conversations/conversations_screen.tsx +28 -2
- package/src/utils/native_adapters/configuration.ts +5 -0
- package/src/utils/native_adapters/index.ts +1 -0
- package/src/utils/native_adapters/updates.ts +16 -0
- package/src/utils/theme.ts +20 -21
package/build/utils/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","names":["Platform","PlatformColor","aliasTokensColorMap","tokens","defaultTheme","colorScheme","scheme","defaultColors","chatThemeColorMap","colors","button","borderRadius","chip","hslLightnessChipSelected","showBadgeProductLogo","iOSLinkColor","OS","undefined","colorsChatLight","name","androidModalHeaderButtonTextColor","fillColorInteractionDefault","iOSModalHeaderButtonTextColor","buttonStart","buttonEnd","interaction","androidSwitchThumbColor","conversationActionsBackground","colorNeutral100White","testColor","statusInfoIcon","iconColorStatusInfoPrimary","statusInfoText","textColorStatusInfo","statusInfoBorder","borderColorStatusInfo","statusInfoFill","fillColorStatusInfoSolid","statusSuccessIcon","iconColorStatusSuccessPrimary","statusSuccessText","textColorStatusSuccess","statusSuccessBorder","borderColorStatusSuccess","statusSuccessFill","fillColorStatusSuccessSolid","statusWarningIcon","iconColorStatusWarningPrimary","statusWarningText","textColorStatusWarning","statusWarningBorder","borderColorStatusWarning","statusWarningFill","fillColorStatusWarningSolid","statusErrorIcon","iconColorStatusErrorPrimary","statusErrorText","textColorStatusError","statusErrorBorder","borderColorStatusError","statusErrorFill","fillColorStatusErrorSolid","statusInfoComposedIcon","statusInfoComposedText","statusInfoComposedBackground","fillColorStatusInfoGhost","statusSuccessComposedIcon","statusSuccessComposedText","statusSuccessComposedBackground","fillColorStatusSuccessGhost","statusWarningComposedIcon","statusWarningComposedText","statusWarningComposedBackground","fillColorStatusWarningGhost","statusErrorComposedIcon","statusErrorComposedText","statusErrorComposedBackground","fillColorStatusErrorGhost","statusNeutralComposedIcon","iconColorStatusNeutralPrimary","statusNeutralComposedText","textColorStatusNeutral","statusNeutralComposedBackground","fillColorStatusNeutralGhost","borderColorChip","colorNeutral88","fillColorChip","textColorChip","colorNeutral45","colorsChatDark","fillColorInteractionDefaultDark","colorNeutral7","iconColorStatusInfoPrimaryDark","textColorStatusInfoDark","borderColorStatusInfoDark","fillColorStatusInfoSolidDark","iconColorStatusSuccessPrimaryDark","textColorStatusSuccessDark","borderColorStatusSuccessDark","fillColorStatusSuccessSolidDark","iconColorStatusWarningPrimaryDark","textColorStatusWarningDark","borderColorStatusWarningDark","fillColorStatusWarningSolidDark","iconColorStatusErrorPrimaryDark","textColorStatusErrorDark","borderColorStatusErrorDark","fillColorStatusErrorSolidDark","fillColorStatusInfoGhostDark","fillColorStatusSuccessGhostDark","fillColorStatusWarningGhostDark","fillColorStatusErrorGhostDark","iconColorStatusNeutralPrimaryDark","textColorStatusNeutralDark","fillColorStatusNeutralGhostDark","colorNeutral24","colorNeutral68","light","dark"],"sources":["../../src/utils/theme.ts"],"sourcesContent":["import { Platform, PlatformColor } from 'react-native'\nimport type { ColorSchemeName, ColorValue, OpaqueColorValue } from 'react-native'\nimport { aliasTokensColorMap } from '../vendor/tapestry/alias_tokens_color_map'\nimport { tokens } from '../vendor/tapestry/tokens'\n\nexport interface ChatTheme extends DefaultTheme {\n colors: DefaultTheme['colors'] &\n (typeof aliasTokensColorMap.light | typeof aliasTokensColorMap.dark)\n}\n\n/** =============================================\n NOTE: The specific values for `colors` and the `productBadge` are temporary examples that can be replaced once we start building out UI. This line's comment can be removed at that time too.\n\n The default theme is intended to support two types of customizations:\n 1. Specific color properties for a chat component (eg. `primaryButtonBackgroundColor`)\n 2. Any styles for a specific component. (Use only one level of nesting.)\n ```\n primaryButton: {\n borderRadius: number\n container: ViewStyle\n text: TextStyle\n }\n ```\n============================================= */\n\nexport interface DefaultTheme {\n colors: ChatColors\n button: {\n borderRadius: number\n }\n chip: {\n hslLightnessChipSelected: number\n }\n showBadgeProductLogo: boolean\n}\n\nexport const defaultTheme = (colorScheme: ColorSchemeName | null): ChatTheme => {\n const scheme: 'light' | 'dark' = colorScheme === 'dark' ? 'dark' : 'light'\n\n const defaultColors = {\n ...chatThemeColorMap[scheme],\n ...aliasTokensColorMap[scheme],\n }\n\n return {\n colors: defaultColors,\n button: {\n borderRadius: 40,\n },\n chip: {\n hslLightnessChipSelected: scheme === 'dark' ? 12 : 92,\n },\n showBadgeProductLogo: true, // Overrides visibility of the product logo in `src/display/badge.tsx`\n }\n}\n\nexport type TemporaryDefaultColorsType = Partial<ChatColors>\n\ninterface ChatColors {\n name: string\n buttonStart: string | undefined\n buttonEnd: string | undefined\n interaction: string\n androidModalHeaderButtonTextColor: ColorValue | string | undefined\n iOSModalHeaderButtonTextColor: OpaqueColorValue | string | undefined\n androidSwitchThumbColor: string | undefined\n conversationActionsBackground: string\n testColor: string\n statusSuccessIcon: string\n statusSuccessText: string\n statusSuccessBorder: string\n statusSuccessFill: string\n statusInfoIcon: string\n statusInfoText: string\n statusInfoBorder: string\n statusInfoFill: string\n statusWarningIcon: string\n statusWarningText: string\n statusWarningBorder: string\n statusWarningFill: string\n statusErrorIcon: string\n statusErrorText: string\n statusErrorBorder: string\n statusErrorFill: string\n statusSuccessComposedIcon: string\n statusSuccessComposedText: string\n statusSuccessComposedBackground: string\n statusInfoComposedIcon: string\n statusInfoComposedText: string\n statusInfoComposedBackground: string\n statusWarningComposedIcon: string\n statusWarningComposedText: string\n statusWarningComposedBackground: string\n statusErrorComposedIcon: string\n statusErrorComposedText: string\n statusErrorComposedBackground: string\n statusNeutralComposedIcon: string\n statusNeutralComposedText: string\n statusNeutralComposedBackground: string\n borderColorChip: string\n fillColorChip: string\n textColorChip: string\n /**\n * Selected-chip colors (border/fill/text). Never assign a static default\n * directly — these stay optional so they always fall back to\n * `colors.interaction` via `??` at the read site. Every current consumer\n * overrides `interaction` at runtime, and a seeded default here could win\n * over that override depending on merge order.\n */\n borderColorChipSelected?: string\n fillColorChipSelected?: string\n textColorChipSelected?: string\n}\n\n// 'link' is an iOS-only semantic color name — constructing it on Android is\n// undefined behavior, so only build it when the code is actually running on iOS\nconst iOSLinkColor = Platform.OS === 'ios' ? PlatformColor('link') : undefined\n\nconst colorsChatLight: ChatColors = {\n name: 'light',\n androidModalHeaderButtonTextColor: tokens.fillColorInteractionDefault,\n iOSModalHeaderButtonTextColor: iOSLinkColor,\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefault,\n androidSwitchThumbColor: undefined,\n conversationActionsBackground: tokens.colorNeutral100White,\n testColor: 'hotpink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimary,\n statusInfoText: tokens.textColorStatusInfo,\n statusInfoBorder: tokens.borderColorStatusInfo,\n statusInfoFill: tokens.fillColorStatusInfoSolid,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimary,\n statusSuccessText: tokens.textColorStatusSuccess,\n statusSuccessBorder: tokens.borderColorStatusSuccess,\n statusSuccessFill: tokens.fillColorStatusSuccessSolid,\n statusWarningIcon: tokens.iconColorStatusWarningPrimary,\n statusWarningText: tokens.textColorStatusWarning,\n statusWarningBorder: tokens.borderColorStatusWarning,\n statusWarningFill: tokens.fillColorStatusWarningSolid,\n statusErrorIcon: tokens.iconColorStatusErrorPrimary,\n statusErrorText: tokens.textColorStatusError,\n statusErrorBorder: tokens.borderColorStatusError,\n statusErrorFill: tokens.fillColorStatusErrorSolid,\n statusInfoComposedIcon: tokens.iconColorStatusInfoPrimary,\n statusInfoComposedText: tokens.textColorStatusInfo,\n statusInfoComposedBackground: tokens.fillColorStatusInfoGhost,\n statusSuccessComposedIcon: tokens.iconColorStatusSuccessPrimary,\n statusSuccessComposedText: tokens.textColorStatusSuccess,\n statusSuccessComposedBackground: tokens.fillColorStatusSuccessGhost,\n statusWarningComposedIcon: tokens.iconColorStatusWarningPrimary,\n statusWarningComposedText: tokens.textColorStatusWarning,\n statusWarningComposedBackground: tokens.fillColorStatusWarningGhost,\n statusErrorComposedIcon: tokens.iconColorStatusErrorPrimary,\n statusErrorComposedText: tokens.textColorStatusError,\n statusErrorComposedBackground: tokens.fillColorStatusErrorGhost,\n statusNeutralComposedIcon: tokens.iconColorStatusNeutralPrimary,\n statusNeutralComposedText: tokens.textColorStatusNeutral,\n statusNeutralComposedBackground: tokens.fillColorStatusNeutralGhost,\n borderColorChip: tokens.colorNeutral88,\n fillColorChip: 'transparent',\n textColorChip: tokens.colorNeutral45,\n}\n\nconst colorsChatDark: ChatColors = {\n name: 'dark',\n androidModalHeaderButtonTextColor: tokens.fillColorInteractionDefaultDark,\n iOSModalHeaderButtonTextColor: iOSLinkColor,\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefaultDark,\n androidSwitchThumbColor: undefined,\n conversationActionsBackground: tokens.colorNeutral7,\n testColor: 'pink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimaryDark,\n statusInfoText: tokens.textColorStatusInfoDark,\n statusInfoBorder: tokens.borderColorStatusInfoDark,\n statusInfoFill: tokens.fillColorStatusInfoSolidDark,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimaryDark,\n statusSuccessText: tokens.textColorStatusSuccessDark,\n statusSuccessBorder: tokens.borderColorStatusSuccessDark,\n statusSuccessFill: tokens.fillColorStatusSuccessSolidDark,\n statusWarningIcon: tokens.iconColorStatusWarningPrimaryDark,\n statusWarningText: tokens.textColorStatusWarningDark,\n statusWarningBorder: tokens.borderColorStatusWarningDark,\n statusWarningFill: tokens.fillColorStatusWarningSolidDark,\n statusErrorIcon: tokens.iconColorStatusErrorPrimaryDark,\n statusErrorText: tokens.textColorStatusErrorDark,\n statusErrorBorder: tokens.borderColorStatusErrorDark,\n statusErrorFill: tokens.fillColorStatusErrorSolidDark,\n\n // Note: CCA inverts composed status colors in dark mode\n statusInfoComposedIcon: tokens.iconColorStatusInfoPrimaryDark,\n statusInfoComposedText: tokens.textColorStatusInfoDark,\n statusInfoComposedBackground: tokens.fillColorStatusInfoGhostDark,\n statusSuccessComposedIcon: tokens.iconColorStatusSuccessPrimaryDark,\n statusSuccessComposedText: tokens.textColorStatusSuccessDark,\n statusSuccessComposedBackground: tokens.fillColorStatusSuccessGhostDark,\n statusWarningComposedIcon: tokens.iconColorStatusWarningPrimaryDark,\n statusWarningComposedText: tokens.textColorStatusWarningDark,\n statusWarningComposedBackground: tokens.fillColorStatusWarningGhostDark,\n statusErrorComposedIcon: tokens.iconColorStatusErrorPrimaryDark,\n statusErrorComposedText: tokens.textColorStatusErrorDark,\n statusErrorComposedBackground: tokens.fillColorStatusErrorGhostDark,\n statusNeutralComposedIcon: tokens.iconColorStatusNeutralPrimaryDark,\n statusNeutralComposedText: tokens.textColorStatusNeutralDark,\n statusNeutralComposedBackground: tokens.fillColorStatusNeutralGhostDark,\n borderColorChip: tokens.colorNeutral24,\n fillColorChip: 'transparent',\n textColorChip: tokens.colorNeutral68,\n}\n\nconst chatThemeColorMap = {\n light: colorsChatLight,\n dark: colorsChatDark,\n}\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,aAAa,QAAQ,cAAc;AAEtD,SAASC,mBAAmB,QAAQ,2CAA2C;AAC/E,SAASC,MAAM,QAAQ,2BAA2B;;AAOlD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,OAAO,MAAMC,YAAY,GAAIC,WAAmC,IAAgB;EAC9E,MAAMC,MAAwB,GAAGD,WAAW,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO;EAE1E,MAAME,aAAa,GAAG;IACpB,GAAGC,iBAAiB,CAACF,MAAM,CAAC;IAC5B,GAAGJ,mBAAmB,CAACI,MAAM;EAC/B,CAAC;EAED,OAAO;IACLG,MAAM,EAAEF,aAAa;IACrBG,MAAM,EAAE;MACNC,YAAY,EAAE;IAChB,CAAC;IACDC,IAAI,EAAE;MACJC,wBAAwB,EAAEP,MAAM,KAAK,MAAM,GAAG,EAAE,GAAG;IACrD,CAAC;IACDQ,oBAAoB,EAAE,IAAI,CAAE;EAC9B,CAAC;AACH,CAAC;AA4DD;AACA;AACA,MAAMC,YAAY,GAAGf,QAAQ,CAACgB,EAAE,KAAK,KAAK,GAAGf,aAAa,CAAC,MAAM,CAAC,GAAGgB,SAAS;AAE9E,MAAMC,eAA2B,GAAG;EAClCC,IAAI,EAAE,OAAO;EACbC,iCAAiC,EAAEjB,MAAM,CAACkB,2BAA2B;EACr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iBAAiB,GAAG;EACxB6G,KAAK,EAAEnG,eAAe;EACtBoG,IAAI,EAAE7B;AACR,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"theme.js","names":["Platform","PlatformColor","aliasTokensColorMap","tokens","defaultTheme","colorScheme","scheme","defaultColors","chatThemeColorMap","colors","button","borderRadius","chip","hslLightnessChipSelected","showBadgeProductLogo","iOSLinkColor","OS","undefined","colorsChatLight","name","androidModalHeaderButtonTextColor","fillColorInteractionDefault","iOSModalHeaderButtonTextColor","buttonStart","buttonEnd","interaction","androidSwitchThumbColor","conversationActionsBackground","colorNeutral100White","testColor","statusInfoIcon","iconColorStatusInfoPrimary","statusInfoText","textColorStatusInfo","statusInfoBorder","borderColorStatusInfo","statusInfoFill","fillColorStatusInfoSolid","statusSuccessIcon","iconColorStatusSuccessPrimary","statusSuccessText","textColorStatusSuccess","statusSuccessBorder","borderColorStatusSuccess","statusSuccessFill","fillColorStatusSuccessSolid","statusWarningIcon","iconColorStatusWarningPrimary","statusWarningText","textColorStatusWarning","statusWarningBorder","borderColorStatusWarning","statusWarningFill","fillColorStatusWarningSolid","statusErrorIcon","iconColorStatusErrorPrimary","statusErrorText","textColorStatusError","statusErrorBorder","borderColorStatusError","statusErrorFill","fillColorStatusErrorSolid","statusInfoComposedIcon","statusInfoComposedText","colorNeutral24","statusInfoComposedBackground","fillColorStatusInfoGhost","statusSuccessComposedIcon","statusSuccessComposedText","statusSuccessComposedBackground","fillColorStatusSuccessGhost","statusWarningComposedIcon","statusWarningComposedText","statusWarningComposedBackground","fillColorStatusWarningGhost","statusErrorComposedIcon","statusErrorComposedText","statusErrorComposedBackground","fillColorStatusErrorGhost","statusNeutralComposedIcon","textColorStatusNeutral","statusNeutralComposedText","statusNeutralComposedBackground","fillColorStatusNeutralGhost","borderColorChip","colorNeutral88","fillColorChip","textColorChip","colorNeutral45","colorsChatDark","fillColorInteractionDefaultDark","colorNeutral7","iconColorStatusInfoPrimaryDark","textColorStatusInfoDark","borderColorStatusInfoDark","fillColorStatusInfoSolidDark","iconColorStatusSuccessPrimaryDark","textColorStatusSuccessDark","borderColorStatusSuccessDark","fillColorStatusSuccessSolidDark","iconColorStatusWarningPrimaryDark","textColorStatusWarningDark","borderColorStatusWarningDark","fillColorStatusWarningSolidDark","iconColorStatusErrorPrimaryDark","textColorStatusErrorDark","borderColorStatusErrorDark","fillColorStatusErrorSolidDark","fillColorStatusInfoGhostDark","fillColorStatusSuccessGhostDark","fillColorStatusWarningGhostDark","fillColorStatusErrorGhostDark","textColorStatusNeutralDark","fillColorStatusNeutralGhostDark","colorNeutral68","light","dark"],"sources":["../../src/utils/theme.ts"],"sourcesContent":["import { Platform, PlatformColor } from 'react-native'\nimport type { ColorSchemeName, ColorValue, OpaqueColorValue } from 'react-native'\nimport { aliasTokensColorMap } from '../vendor/tapestry/alias_tokens_color_map'\nimport { tokens } from '../vendor/tapestry/tokens'\n\nexport interface ChatTheme extends DefaultTheme {\n colors: DefaultTheme['colors'] &\n (typeof aliasTokensColorMap.light | typeof aliasTokensColorMap.dark)\n}\n\n/** =============================================\n NOTE: The specific values for `colors` and the `productBadge` are temporary examples that can be replaced once we start building out UI. This line's comment can be removed at that time too.\n\n The default theme is intended to support two types of customizations:\n 1. Specific color properties for a chat component (eg. `primaryButtonBackgroundColor`)\n 2. Any styles for a specific component. (Use only one level of nesting.)\n ```\n primaryButton: {\n borderRadius: number\n container: ViewStyle\n text: TextStyle\n }\n ```\n============================================= */\n\nexport interface DefaultTheme {\n colors: ChatColors\n button: {\n borderRadius: number\n }\n chip: {\n hslLightnessChipSelected: number\n }\n showBadgeProductLogo: boolean\n}\n\nexport const defaultTheme = (colorScheme: ColorSchemeName | null): ChatTheme => {\n const scheme: 'light' | 'dark' = colorScheme === 'dark' ? 'dark' : 'light'\n\n const defaultColors = {\n ...chatThemeColorMap[scheme],\n ...aliasTokensColorMap[scheme],\n }\n\n return {\n colors: defaultColors,\n button: {\n borderRadius: 40,\n },\n chip: {\n hslLightnessChipSelected: scheme === 'dark' ? 12 : 92,\n },\n showBadgeProductLogo: true, // Overrides visibility of the product logo in `src/display/badge.tsx`\n }\n}\n\nexport type TemporaryDefaultColorsType = Partial<ChatColors>\n\ninterface ChatColors {\n name: string\n buttonStart: string | undefined\n buttonEnd: string | undefined\n interaction: string\n androidModalHeaderButtonTextColor: ColorValue | string | undefined\n iOSModalHeaderButtonTextColor: OpaqueColorValue | string | undefined\n androidSwitchThumbColor: string | undefined\n conversationActionsBackground: string\n testColor: string\n statusSuccessIcon: string\n statusSuccessText: string\n statusSuccessBorder: string\n statusSuccessFill: string\n statusInfoIcon: string\n statusInfoText: string\n statusInfoBorder: string\n statusInfoFill: string\n statusWarningIcon: string\n statusWarningText: string\n statusWarningBorder: string\n statusWarningFill: string\n statusErrorIcon: string\n statusErrorText: string\n statusErrorBorder: string\n statusErrorFill: string\n statusSuccessComposedIcon: string\n statusSuccessComposedText: string\n statusSuccessComposedBackground: string\n statusInfoComposedIcon: string\n statusInfoComposedText: string\n statusInfoComposedBackground: string\n statusWarningComposedIcon: string\n statusWarningComposedText: string\n statusWarningComposedBackground: string\n statusErrorComposedIcon: string\n statusErrorComposedText: string\n statusErrorComposedBackground: string\n statusNeutralComposedIcon: string\n statusNeutralComposedText: string\n statusNeutralComposedBackground: string\n borderColorChip: string\n fillColorChip: string\n textColorChip: string\n /**\n * Selected-chip colors (border/fill/text). Never assign a static default\n * directly — these stay optional so they always fall back to\n * `colors.interaction` via `??` at the read site. Every current consumer\n * overrides `interaction` at runtime, and a seeded default here could win\n * over that override depending on merge order.\n */\n borderColorChipSelected?: string\n fillColorChipSelected?: string\n textColorChipSelected?: string\n}\n\n// 'link' is an iOS-only semantic color name — constructing it on Android is\n// undefined behavior, so only build it when the code is actually running on iOS\nconst iOSLinkColor = Platform.OS === 'ios' ? PlatformColor('link') : undefined\n\nconst colorsChatLight: ChatColors = {\n name: 'light',\n androidModalHeaderButtonTextColor: tokens.fillColorInteractionDefault,\n iOSModalHeaderButtonTextColor: iOSLinkColor,\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefault,\n androidSwitchThumbColor: undefined,\n conversationActionsBackground: tokens.colorNeutral100White,\n testColor: 'hotpink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimary,\n statusInfoText: tokens.textColorStatusInfo,\n statusInfoBorder: tokens.borderColorStatusInfo,\n statusInfoFill: tokens.fillColorStatusInfoSolid,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimary,\n statusSuccessText: tokens.textColorStatusSuccess,\n statusSuccessBorder: tokens.borderColorStatusSuccess,\n statusSuccessFill: tokens.fillColorStatusSuccessSolid,\n statusWarningIcon: tokens.iconColorStatusWarningPrimary,\n statusWarningText: tokens.textColorStatusWarning,\n statusWarningBorder: tokens.borderColorStatusWarning,\n statusWarningFill: tokens.fillColorStatusWarningSolid,\n statusErrorIcon: tokens.iconColorStatusErrorPrimary,\n statusErrorText: tokens.textColorStatusError,\n statusErrorBorder: tokens.borderColorStatusError,\n statusErrorFill: tokens.fillColorStatusErrorSolid,\n statusInfoComposedIcon: tokens.textColorStatusInfo,\n statusInfoComposedText: tokens.colorNeutral24,\n statusInfoComposedBackground: tokens.fillColorStatusInfoGhost,\n statusSuccessComposedIcon: tokens.textColorStatusSuccess,\n statusSuccessComposedText: tokens.colorNeutral24,\n statusSuccessComposedBackground: tokens.fillColorStatusSuccessGhost,\n statusWarningComposedIcon: tokens.textColorStatusWarning,\n statusWarningComposedText: tokens.colorNeutral24,\n statusWarningComposedBackground: tokens.fillColorStatusWarningGhost,\n statusErrorComposedIcon: tokens.textColorStatusError,\n statusErrorComposedText: tokens.colorNeutral24,\n statusErrorComposedBackground: tokens.fillColorStatusErrorGhost,\n statusNeutralComposedIcon: tokens.textColorStatusNeutral,\n statusNeutralComposedText: tokens.colorNeutral24,\n statusNeutralComposedBackground: tokens.fillColorStatusNeutralGhost,\n borderColorChip: tokens.colorNeutral88,\n fillColorChip: 'transparent',\n textColorChip: tokens.colorNeutral45,\n}\n\nconst colorsChatDark: ChatColors = {\n name: 'dark',\n androidModalHeaderButtonTextColor: tokens.fillColorInteractionDefaultDark,\n iOSModalHeaderButtonTextColor: iOSLinkColor,\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefaultDark,\n androidSwitchThumbColor: undefined,\n conversationActionsBackground: tokens.colorNeutral7,\n testColor: 'pink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimaryDark,\n statusInfoText: tokens.textColorStatusInfoDark,\n statusInfoBorder: tokens.borderColorStatusInfoDark,\n statusInfoFill: tokens.fillColorStatusInfoSolidDark,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimaryDark,\n statusSuccessText: tokens.textColorStatusSuccessDark,\n statusSuccessBorder: tokens.borderColorStatusSuccessDark,\n statusSuccessFill: tokens.fillColorStatusSuccessSolidDark,\n statusWarningIcon: tokens.iconColorStatusWarningPrimaryDark,\n statusWarningText: tokens.textColorStatusWarningDark,\n statusWarningBorder: tokens.borderColorStatusWarningDark,\n statusWarningFill: tokens.fillColorStatusWarningSolidDark,\n statusErrorIcon: tokens.iconColorStatusErrorPrimaryDark,\n statusErrorText: tokens.textColorStatusErrorDark,\n statusErrorBorder: tokens.borderColorStatusErrorDark,\n statusErrorFill: tokens.fillColorStatusErrorSolidDark,\n\n statusInfoComposedIcon: tokens.textColorStatusInfoDark,\n statusInfoComposedText: tokens.colorNeutral88,\n statusInfoComposedBackground: tokens.fillColorStatusInfoGhostDark,\n statusSuccessComposedIcon: tokens.textColorStatusSuccessDark,\n statusSuccessComposedText: tokens.colorNeutral88,\n statusSuccessComposedBackground: tokens.fillColorStatusSuccessGhostDark,\n statusWarningComposedIcon: tokens.textColorStatusWarningDark,\n statusWarningComposedText: tokens.colorNeutral88,\n statusWarningComposedBackground: tokens.fillColorStatusWarningGhostDark,\n statusErrorComposedIcon: tokens.textColorStatusErrorDark,\n statusErrorComposedText: tokens.colorNeutral88,\n statusErrorComposedBackground: tokens.fillColorStatusErrorGhostDark,\n statusNeutralComposedIcon: tokens.textColorStatusNeutralDark,\n statusNeutralComposedText: tokens.colorNeutral88,\n statusNeutralComposedBackground: tokens.fillColorStatusNeutralGhostDark,\n borderColorChip: tokens.colorNeutral24,\n fillColorChip: 'transparent',\n textColorChip: tokens.colorNeutral68,\n}\n\nconst chatThemeColorMap = {\n light: colorsChatLight,\n dark: colorsChatDark,\n}\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,aAAa,QAAQ,cAAc;AAEtD,SAASC,mBAAmB,QAAQ,2CAA2C;AAC/E,SAASC,MAAM,QAAQ,2BAA2B;;AAOlD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,OAAO,MAAMC,YAAY,GAAIC,WAAmC,IAAgB;EAC9E,MAAMC,MAAwB,GAAGD,WAAW,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO;EAE1E,MAAME,aAAa,GAAG;IACpB,GAAGC,iBAAiB,CAACF,MAAM,CAAC;IAC5B,GAAGJ,mBAAmB,CAACI,MAAM;EAC/B,CAAC;EAED,OAAO;IACLG,MAAM,EAAEF,aAAa;IACrBG,MAAM,EAAE;MACNC,YAAY,EAAE;IAChB,CAAC;IACDC,IAAI,EAAE;MACJC,wBAAwB,EAAEP,MAAM,KAAK,MAAM,GAAG,EAAE,GAAG;IACrD,CAAC;IACDQ,oBAAoB,EAAE,IAAI,CAAE;EAC9B,CAAC;AACH,CAAC;AA4DD;AACA;AACA,MAAMC,YAAY,GAAGf,QAAQ,CAACgB,EAAE,KAAK,KAAK,GAAGf,aAAa,CAAC,MAAM,CAAC,GAAGgB,SAAS;AAE9E,MAAMC,eAA2B,GAAG;EAClCC,IAAI,EAAE,OAAO;EACbC,iCAAiC,EAAEjB,MAAM,CAACkB,2BAA2B;EACrEC,6BAA6B,EAAEP,YAAY;EAC3CQ,WAAW,EAAEN,SAAS;EACtBO,SAAS,EAAEP,SAAS;EACpBQ,WAAW,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
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "4.8.0
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"sf-symbols-typescript": "^2.2.0",
|
|
85
85
|
"typescript": "~6.0.3"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "94ea3fc9776b8fbb0871ad95427b539bf52739bc"
|
|
88
88
|
}
|
|
@@ -2,6 +2,7 @@ import { DefaultTheme, ThemeProvider } from '@react-navigation/native'
|
|
|
2
2
|
import { QueryClientProvider, notifyManager } from '@tanstack/react-query'
|
|
3
3
|
import { act, fireEvent, render, screen } from '@testing-library/react-native'
|
|
4
4
|
import React from 'react'
|
|
5
|
+
import { TextInput } from 'react-native'
|
|
5
6
|
import { chatQueryClient } from '../../../contexts/api_provider'
|
|
6
7
|
import type { ConversationResource } from '../../../types'
|
|
7
8
|
import { MessageForm } from '../message_form'
|
|
@@ -60,7 +61,7 @@ describe('MessageForm', () => {
|
|
|
60
61
|
await act(async () => finishSend({ data: { type: 'Message', id: 'sent', mine: true } }))
|
|
61
62
|
})
|
|
62
63
|
|
|
63
|
-
|
|
64
|
+
function renderForm() {
|
|
64
65
|
render(
|
|
65
66
|
<QueryClientProvider client={chatQueryClient}>
|
|
66
67
|
<ThemeProvider value={DefaultTheme}>
|
|
@@ -71,13 +72,29 @@ describe('MessageForm', () => {
|
|
|
71
72
|
</ThemeProvider>
|
|
72
73
|
</QueryClientProvider>
|
|
73
74
|
)
|
|
75
|
+
}
|
|
74
76
|
|
|
75
|
-
|
|
77
|
+
async function sendMessage(text: string) {
|
|
78
|
+
fireEvent.changeText(screen.getByTestId('message-composer-input'), text)
|
|
76
79
|
await act(async () => {
|
|
77
80
|
fireEvent.press(screen.getByLabelText('Send message'))
|
|
78
81
|
})
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
it('keeps the input editable while a sent message is in flight', async () => {
|
|
85
|
+
renderForm()
|
|
86
|
+
await sendMessage('hello')
|
|
79
87
|
|
|
80
88
|
expect(mockPost).toHaveBeenCalled()
|
|
81
89
|
expect(screen.getByTestId('message-composer-input').props.editable).toBe(true)
|
|
82
90
|
})
|
|
91
|
+
|
|
92
|
+
it('clears the native input after sending so iOS resizes the composer', async () => {
|
|
93
|
+
const clear = jest.spyOn(TextInput.prototype, 'clear')
|
|
94
|
+
renderForm()
|
|
95
|
+
await sendMessage('a message long enough to wrap onto more than one line in the composer')
|
|
96
|
+
|
|
97
|
+
expect(clear).toHaveBeenCalled()
|
|
98
|
+
expect(screen.getByTestId('message-composer-input').props.value).toBe('')
|
|
99
|
+
})
|
|
83
100
|
})
|
|
@@ -89,6 +89,7 @@ const MessageFormContext = React.createContext<{
|
|
|
89
89
|
reset: () => void
|
|
90
90
|
replyRootId?: string | null
|
|
91
91
|
replyRootAuthorFirstName?: string | null
|
|
92
|
+
inputRef?: React.RefObject<TextInput | null>
|
|
92
93
|
}>({
|
|
93
94
|
text: '',
|
|
94
95
|
setText: (_text: string) => {},
|
|
@@ -144,10 +145,12 @@ function MessageFormRoot({
|
|
|
144
145
|
onFlaggedInMessageForm,
|
|
145
146
|
})
|
|
146
147
|
const resetAttachmentUploader = attachmentUploader.reset
|
|
148
|
+
const inputRef = useRef<TextInput>(null)
|
|
147
149
|
|
|
148
150
|
const reset = useCallback(() => {
|
|
149
151
|
resetAttachmentUploader()
|
|
150
152
|
resetMutation()
|
|
153
|
+
inputRef.current?.clear()
|
|
151
154
|
setText('')
|
|
152
155
|
setUsingGiphy(false)
|
|
153
156
|
if (!currentlyEditingMessage) {
|
|
@@ -306,6 +309,7 @@ function MessageFormRoot({
|
|
|
306
309
|
reset,
|
|
307
310
|
replyRootId,
|
|
308
311
|
replyRootAuthorFirstName,
|
|
312
|
+
inputRef,
|
|
309
313
|
}}
|
|
310
314
|
>
|
|
311
315
|
<View style={styles.container}>
|
|
@@ -457,8 +461,16 @@ function MessageFormInput() {
|
|
|
457
461
|
const styles = useMessageFormStyles()
|
|
458
462
|
const theme = useTheme()
|
|
459
463
|
const fontScale = useFontScale()
|
|
460
|
-
const {
|
|
461
|
-
|
|
464
|
+
const {
|
|
465
|
+
text,
|
|
466
|
+
setText,
|
|
467
|
+
onSubmit,
|
|
468
|
+
inputEditable,
|
|
469
|
+
usingGiphy,
|
|
470
|
+
attachmentUploader,
|
|
471
|
+
replyRootId,
|
|
472
|
+
inputRef,
|
|
473
|
+
} = React.useContext(MessageFormContext)
|
|
462
474
|
const attachmentError = attachmentUploader?.errorMessage
|
|
463
475
|
|
|
464
476
|
const broadcastTypingStatus = useBroadcastTypingStatus()
|
|
@@ -495,6 +507,7 @@ function MessageFormInput() {
|
|
|
495
507
|
) : null}
|
|
496
508
|
|
|
497
509
|
<TextInput
|
|
510
|
+
ref={inputRef}
|
|
498
511
|
testID="message-composer-input"
|
|
499
512
|
style={[styles.textInput, usingGiphy && styles.textInputWithGiphy]}
|
|
500
513
|
multiline={true}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { fireEvent, render } from '@testing-library/react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { Updates, UpdatesAdapter } from '../../../utils/native_adapters'
|
|
4
|
+
import { AppUpdateBanner } from '../app_update_banner'
|
|
5
|
+
|
|
6
|
+
jest.mock('../../../utils/native_adapters', () => ({
|
|
7
|
+
...jest.requireActual('../../../utils/native_adapters'),
|
|
8
|
+
Updates: { useDownloadedUpdateId: jest.fn(), restart: jest.fn() },
|
|
9
|
+
}))
|
|
10
|
+
|
|
11
|
+
const mockUpdates = Updates as jest.Mocked<UpdatesAdapter>
|
|
12
|
+
|
|
13
|
+
describe('AppUpdateBanner', () => {
|
|
14
|
+
it('stays hidden until an update has downloaded', () => {
|
|
15
|
+
mockUpdates.useDownloadedUpdateId.mockReturnValue(undefined)
|
|
16
|
+
|
|
17
|
+
expect(render(<AppUpdateBanner />).queryByText('Chat update available')).toBeNull()
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it('reloads through the adapter', () => {
|
|
21
|
+
mockUpdates.useDownloadedUpdateId.mockReturnValue('update-1')
|
|
22
|
+
|
|
23
|
+
fireEvent.press(render(<AppUpdateBanner />).getByText('Reload'))
|
|
24
|
+
|
|
25
|
+
expect(mockUpdates.restart).toHaveBeenCalledTimes(1)
|
|
26
|
+
})
|
|
27
|
+
})
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { act, fireEvent, render } from '@testing-library/react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { SafeAreaProvider } from 'react-native-safe-area-context'
|
|
4
|
+
import type { ConversationResource } from '../../../types'
|
|
5
|
+
import { BulkConversationActionsBar } from '../bulk_conversation_actions_bar'
|
|
6
|
+
|
|
7
|
+
jest.mock('react-native-reanimated', () => ({
|
|
8
|
+
...jest.requireActual('react-native-reanimated/mock'),
|
|
9
|
+
LayoutAnimationConfig: ({ children }: { children: React.ReactNode }) => children,
|
|
10
|
+
useReducedMotion: () => false,
|
|
11
|
+
}))
|
|
12
|
+
|
|
13
|
+
const mockHide = jest.fn(async () => {})
|
|
14
|
+
const mockSilence = jest.fn(async () => {})
|
|
15
|
+
jest.mock('../../../hooks/use_bulk_conversation_actions', () => ({
|
|
16
|
+
useBulkConversationActions: () => ({
|
|
17
|
+
hide: mockHide,
|
|
18
|
+
unhide: jest.fn(),
|
|
19
|
+
silence: mockSilence,
|
|
20
|
+
markRead: jest.fn(),
|
|
21
|
+
}),
|
|
22
|
+
}))
|
|
23
|
+
|
|
24
|
+
const createdAt = '2026-10-01T12:00:00Z'
|
|
25
|
+
|
|
26
|
+
const conversation = (overrides: Partial<ConversationResource>): ConversationResource => ({
|
|
27
|
+
type: 'Conversation',
|
|
28
|
+
id: 1,
|
|
29
|
+
title: 'Youth Group',
|
|
30
|
+
conversationPreview: null,
|
|
31
|
+
createdAt,
|
|
32
|
+
lastMessageCreatedAt: createdAt,
|
|
33
|
+
muted: false,
|
|
34
|
+
repliesDisabled: false,
|
|
35
|
+
unreadCount: 1,
|
|
36
|
+
unreadReaction: false,
|
|
37
|
+
updatedAt: createdAt,
|
|
38
|
+
...overrides,
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
const first = conversation({ id: 1 })
|
|
42
|
+
const second = conversation({ id: 2 })
|
|
43
|
+
const archived = conversation({ id: 3, disabled: true, disabledReason: 'archived' })
|
|
44
|
+
const mockConversations = [first, second, archived]
|
|
45
|
+
|
|
46
|
+
const mockClearSelection = jest.fn()
|
|
47
|
+
let mockSelectedIds: number[] = []
|
|
48
|
+
jest.mock('../../../contexts/conversations_context', () => ({
|
|
49
|
+
useConversationsContext: () => ({
|
|
50
|
+
selectMode: true,
|
|
51
|
+
selectedIds: mockSelectedIds,
|
|
52
|
+
conversations: mockConversations,
|
|
53
|
+
hideable: true,
|
|
54
|
+
clearSelection: mockClearSelection,
|
|
55
|
+
args: {},
|
|
56
|
+
}),
|
|
57
|
+
}))
|
|
58
|
+
|
|
59
|
+
const safeAreaMetrics = {
|
|
60
|
+
frame: { x: 0, y: 0, width: 390, height: 844 },
|
|
61
|
+
insets: { top: 0, right: 0, bottom: 0, left: 0 },
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const renderBar = () =>
|
|
65
|
+
render(
|
|
66
|
+
<SafeAreaProvider initialMetrics={safeAreaMetrics}>
|
|
67
|
+
<BulkConversationActionsBar />
|
|
68
|
+
</SafeAreaProvider>
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
describe('BulkConversationActionsBar', () => {
|
|
72
|
+
beforeEach(() => jest.clearAllMocks())
|
|
73
|
+
|
|
74
|
+
it('hides every selected conversation and then clears the selection', async () => {
|
|
75
|
+
mockSelectedIds = [1, 2]
|
|
76
|
+
const view = renderBar()
|
|
77
|
+
|
|
78
|
+
await act(async () => fireEvent.press(view.getByText('Hide')))
|
|
79
|
+
|
|
80
|
+
expect(mockHide).toHaveBeenCalledWith([first, second])
|
|
81
|
+
expect(mockClearSelection).toHaveBeenCalled()
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
it('disables hide and silence when an archived conversation is selected', () => {
|
|
85
|
+
mockSelectedIds = [1, 3]
|
|
86
|
+
const view = renderBar()
|
|
87
|
+
|
|
88
|
+
fireEvent.press(view.getByText('Hide'))
|
|
89
|
+
fireEvent.press(view.getByText('Silence'))
|
|
90
|
+
|
|
91
|
+
expect(mockHide).not.toHaveBeenCalled()
|
|
92
|
+
expect(mockSilence).not.toHaveBeenCalled()
|
|
93
|
+
expect(mockClearSelection).not.toHaveBeenCalled()
|
|
94
|
+
})
|
|
95
|
+
})
|
|
@@ -13,10 +13,13 @@ jest.mock('react-native-gesture-handler/ReanimatedSwipeable', () => {
|
|
|
13
13
|
renderLeftActions,
|
|
14
14
|
}: {
|
|
15
15
|
children: React.ReactNode
|
|
16
|
-
renderLeftActions: (
|
|
16
|
+
renderLeftActions: (
|
|
17
|
+
progress: { value: number },
|
|
18
|
+
translation: { value: number }
|
|
19
|
+
) => React.ReactNode
|
|
17
20
|
}) => (
|
|
18
21
|
<MockView>
|
|
19
|
-
{renderLeftActions()}
|
|
22
|
+
{renderLeftActions({ value: 1 }, { value: 360 })}
|
|
20
23
|
{children}
|
|
21
24
|
</MockView>
|
|
22
25
|
),
|
|
@@ -141,7 +144,11 @@ describe('ConversationActions hide', () => {
|
|
|
141
144
|
|
|
142
145
|
fireEvent(view.getByTestId('conversation-7'), 'longPress')
|
|
143
146
|
|
|
144
|
-
expect(mockNavigate).toHaveBeenCalledWith('ConversationActions', {
|
|
147
|
+
expect(mockNavigate).toHaveBeenCalledWith('ConversationActions', {
|
|
148
|
+
conversation_id: 7,
|
|
149
|
+
read: false,
|
|
150
|
+
muted: false,
|
|
151
|
+
})
|
|
145
152
|
})
|
|
146
153
|
})
|
|
147
154
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyleSheet, View } from 'react-native'
|
|
3
|
+
import { Updates } from '../../utils/native_adapters'
|
|
4
|
+
import { Banner } from '../display/banner'
|
|
5
|
+
import BannerPrimitive from '../primitive/banner_primitive'
|
|
6
|
+
|
|
7
|
+
export function AppUpdateBanner() {
|
|
8
|
+
const styles = useStyles()
|
|
9
|
+
const downloadedUpdateId = Updates.useDownloadedUpdateId()
|
|
10
|
+
|
|
11
|
+
if (!downloadedUpdateId) return null
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<View style={styles.container}>
|
|
15
|
+
<Banner
|
|
16
|
+
appearance="info"
|
|
17
|
+
heading="Chat update available"
|
|
18
|
+
description={
|
|
19
|
+
<BannerPrimitive.Text>
|
|
20
|
+
<BannerPrimitive.Link onPress={Updates.restart}>Reload</BannerPrimitive.Link> to get the
|
|
21
|
+
latest fixes and improvements.
|
|
22
|
+
</BannerPrimitive.Text>
|
|
23
|
+
}
|
|
24
|
+
/>
|
|
25
|
+
</View>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const useStyles = () => {
|
|
30
|
+
return StyleSheet.create({
|
|
31
|
+
container: {
|
|
32
|
+
paddingHorizontal: 16,
|
|
33
|
+
paddingVertical: 12,
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
|
+
import { Pressable, StyleSheet } from 'react-native'
|
|
3
|
+
import Animated, { FadeIn, LayoutAnimationConfig, ReduceMotion } from 'react-native-reanimated'
|
|
4
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
5
|
+
import { useConversationsContext } from '../../contexts/conversations_context'
|
|
6
|
+
import { useReduceMotion, useTheme } from '../../hooks'
|
|
7
|
+
import { useBulkConversationActions } from '../../hooks/use_bulk_conversation_actions'
|
|
8
|
+
import { ConversationResource } from '../../types'
|
|
9
|
+
import {
|
|
10
|
+
MAX_FONT_SIZE_MULTIPLIER_LANDMARK,
|
|
11
|
+
isArchivedConversation,
|
|
12
|
+
platformPressedOpacityStyle,
|
|
13
|
+
} from '../../utils'
|
|
14
|
+
import { dismissToast } from '../../utils/toast_store'
|
|
15
|
+
import { Icon, IconString, Text } from '../display'
|
|
16
|
+
|
|
17
|
+
export function BulkConversationActionsBar() {
|
|
18
|
+
const styles = useStyles()
|
|
19
|
+
const reduceMotion = useReduceMotion() ? ReduceMotion.Always : ReduceMotion.Never
|
|
20
|
+
const {
|
|
21
|
+
selectMode,
|
|
22
|
+
selectedIds,
|
|
23
|
+
conversations,
|
|
24
|
+
hideable,
|
|
25
|
+
clearSelection,
|
|
26
|
+
args: { show_hidden: hiddenView = false },
|
|
27
|
+
} = useConversationsContext()
|
|
28
|
+
const { hide, unhide, silence, markRead } = useBulkConversationActions()
|
|
29
|
+
const [pending, setPending] = useState(false)
|
|
30
|
+
|
|
31
|
+
const selected = conversations.filter(({ id }) => selectedIds.includes(id))
|
|
32
|
+
const disabled = pending || selected.length === 0
|
|
33
|
+
const canSilence = !disabled && !selected.some(isArchivedConversation)
|
|
34
|
+
const canHide = canSilence && hideable
|
|
35
|
+
|
|
36
|
+
const run = (action: (_conversations: ConversationResource[]) => Promise<void>) => async () => {
|
|
37
|
+
setPending(true)
|
|
38
|
+
try {
|
|
39
|
+
await action(selected)
|
|
40
|
+
} finally {
|
|
41
|
+
setPending(false)
|
|
42
|
+
clearSelection()
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (selectMode) dismissToast()
|
|
48
|
+
}, [selectMode])
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<LayoutAnimationConfig skipEntering>
|
|
52
|
+
{selectMode && (
|
|
53
|
+
<Animated.View
|
|
54
|
+
entering={FadeIn.duration(300).reduceMotion(reduceMotion)}
|
|
55
|
+
style={styles.container}
|
|
56
|
+
testID="bulk-conversation-actions-bar"
|
|
57
|
+
>
|
|
58
|
+
<BulkAction
|
|
59
|
+
title="Mark read"
|
|
60
|
+
iconName="general.check"
|
|
61
|
+
disabled={disabled}
|
|
62
|
+
onPress={run(markRead)}
|
|
63
|
+
/>
|
|
64
|
+
<BulkAction
|
|
65
|
+
title="Silence"
|
|
66
|
+
iconName="general.bellMuted"
|
|
67
|
+
disabled={!canSilence}
|
|
68
|
+
onPress={run(silence)}
|
|
69
|
+
/>
|
|
70
|
+
<BulkAction
|
|
71
|
+
title={hiddenView ? 'Unhide' : 'Hide'}
|
|
72
|
+
iconName={hiddenView ? 'general.showEye' : 'general.hideEye'}
|
|
73
|
+
disabled={!canHide}
|
|
74
|
+
onPress={run(hiddenView ? unhide : hide)}
|
|
75
|
+
/>
|
|
76
|
+
</Animated.View>
|
|
77
|
+
)}
|
|
78
|
+
</LayoutAnimationConfig>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function BulkAction({
|
|
83
|
+
title,
|
|
84
|
+
iconName,
|
|
85
|
+
disabled,
|
|
86
|
+
onPress,
|
|
87
|
+
}: {
|
|
88
|
+
title: string
|
|
89
|
+
iconName: IconString
|
|
90
|
+
disabled: boolean
|
|
91
|
+
onPress: () => void
|
|
92
|
+
}) {
|
|
93
|
+
const styles = useStyles({ disabled })
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<Pressable
|
|
97
|
+
onPress={onPress}
|
|
98
|
+
disabled={disabled}
|
|
99
|
+
accessibilityRole="button"
|
|
100
|
+
accessibilityState={{ disabled }}
|
|
101
|
+
style={({ pressed }) => [styles.action, pressed && platformPressedOpacityStyle]}
|
|
102
|
+
>
|
|
103
|
+
<Icon name={iconName} size={20} style={styles.actionIcon} accessibilityElementsHidden />
|
|
104
|
+
<Text style={styles.actionTitle} maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}>
|
|
105
|
+
{title}
|
|
106
|
+
</Text>
|
|
107
|
+
</Pressable>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const useStyles = ({ disabled = false }: { disabled?: boolean } = {}) => {
|
|
112
|
+
const { bottom } = useSafeAreaInsets()
|
|
113
|
+
const { colors } = useTheme()
|
|
114
|
+
const containerVerticalPadding = 12
|
|
115
|
+
const actionColor = disabled ? colors.textColorDefaultDisabled : colors.textColorDefaultPrimary
|
|
116
|
+
|
|
117
|
+
return StyleSheet.create({
|
|
118
|
+
container: {
|
|
119
|
+
flexDirection: 'row',
|
|
120
|
+
backgroundColor: colors.surfaceColor090,
|
|
121
|
+
paddingHorizontal: 16,
|
|
122
|
+
paddingTop: containerVerticalPadding,
|
|
123
|
+
paddingBottom: bottom + containerVerticalPadding,
|
|
124
|
+
borderTopWidth: 1,
|
|
125
|
+
borderTopColor: colors.borderColorDefaultDim,
|
|
126
|
+
},
|
|
127
|
+
action: {
|
|
128
|
+
flex: 1,
|
|
129
|
+
alignItems: 'center',
|
|
130
|
+
gap: 4,
|
|
131
|
+
},
|
|
132
|
+
actionIcon: {
|
|
133
|
+
color: actionColor,
|
|
134
|
+
},
|
|
135
|
+
actionTitle: {
|
|
136
|
+
color: actionColor,
|
|
137
|
+
fontWeight: '600',
|
|
138
|
+
},
|
|
139
|
+
})
|
|
140
|
+
}
|