Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,6 @@ const ONYXKEYS = {
/** Stores the information if mobile selection mode is active */
RAM_ONLY_MOBILE_SELECTION_MODE: 'mobileSelectionMode',

/** Session-scoped flag: user dismissed the "enable notifications" banner in the Concierge chat */
RAM_ONLY_HAS_DISMISSED_CONCIERGE_NOTIFICATION_BANNER: 'hasDismissedConciergeNotificationBanner',

NVP_PRIVATE_CANCELLATION_DETAILS: 'nvp_private_cancellationDetails',

/** Stores the information about duplicated workspace */
Expand Down Expand Up @@ -1587,7 +1584,6 @@ type OnyxValuesMapping = {
[ONYXKEYS.ADD_NEW_PERSONAL_CARD]: OnyxTypes.AddNewPersonalCard;
[ONYXKEYS.ASSIGN_CARD]: OnyxTypes.AssignCard;
[ONYXKEYS.RAM_ONLY_MOBILE_SELECTION_MODE]: boolean;
[ONYXKEYS.RAM_ONLY_HAS_DISMISSED_CONCIERGE_NOTIFICATION_BANNER]: boolean;
[ONYXKEYS.DUPLICATE_WORKSPACE]: OnyxTypes.DuplicateWorkspace;
[ONYXKEYS.COPY_POLICY_SETTINGS]: OnyxTypes.CopyPolicySettings;
[ONYXKEYS.NVP_FIRST_DAY_FREE_TRIAL]: string;
Expand Down
21 changes: 8 additions & 13 deletions src/components/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ type BannerProps = {

/** Callback called when pressing the button */
onButtonPress?: () => void;

/** Custom action content rendered in the right side of the banner. Overrides the configured `shouldShowButton` when provided. */
children?: React.ReactNode;
};

function Banner({
Expand All @@ -67,7 +64,6 @@ function Banner({
onButtonPress,
containerStyles,
textStyles,
children,
shouldRenderHTML = false,
shouldShowIcon = false,
shouldShowCloseButton = false,
Expand Down Expand Up @@ -122,15 +118,14 @@ function Banner({
</Text>
))}
</View>
{children ??
(shouldShowButton && (
<Button
success
style={[styles.ph3]}
text={translate('common.chatNow')}
onPress={onButtonPress}
/>
))}
{shouldShowButton && (
<Button
success
style={[styles.ph3]}
text={translate('common.chatNow')}
onPress={onButtonPress}
/>
)}
{shouldShowCloseButton && !!onClose && (
<Tooltip text={translate('common.close')}>
<PressableWithFeedback
Expand Down
1 change: 0 additions & 1 deletion src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,6 @@ const translations: TranslationDeepObject<typeof en> = {
concierge: {
collapseReasoning: 'Begründung einklappen',
expandReasoning: 'Begründung erweitern',
enableNotifications: {prompt: 'Möchten Sie benachrichtigt werden, wenn Concierge antwortet?', cta: 'Benachrichtigen'},
},
supportalNoAccess: {
title: 'Nicht so schnell',
Expand Down
4 changes: 0 additions & 4 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,6 @@ const translations = {
concierge: {
collapseReasoning: 'Collapse reasoning',
expandReasoning: 'Expand reasoning',
enableNotifications: {
prompt: 'Want to be notified when Concierge responds?',
cta: 'Notify',
},
},
supportalNoAccess: {
title: 'Not so fast',
Expand Down
4 changes: 0 additions & 4 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,6 @@ const translations: TranslationDeepObject<typeof en> = {
concierge: {
collapseReasoning: 'Contraer razonamiento',
expandReasoning: 'Expandir razonamiento',
enableNotifications: {
prompt: '¿Quieres que te avisemos cuando Concierge responda?',
cta: 'Notificar',
},
},
supportalNoAccess: {
title: 'No tan rápido',
Expand Down
1 change: 0 additions & 1 deletion src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,6 @@ const translations: TranslationDeepObject<typeof en> = {
concierge: {
collapseReasoning: 'Réduire le raisonnement',
expandReasoning: 'Développer le raisonnement',
enableNotifications: {prompt: 'Vous souhaitez être averti lorsque Concierge répond ?', cta: 'Notifier'},
},
supportalNoAccess: {
title: 'Pas si vite',
Expand Down
1 change: 0 additions & 1 deletion src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,6 @@ const translations: TranslationDeepObject<typeof en> = {
concierge: {
collapseReasoning: 'Comprimi ragionamento',
expandReasoning: 'Espandi ragionamento',
enableNotifications: {prompt: 'Vuoi ricevere una notifica quando Concierge risponde?', cta: 'Notifica'},
},
supportalNoAccess: {
title: 'Non così in fretta',
Expand Down
4 changes: 0 additions & 4 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,6 @@ const translations: TranslationDeepObject<typeof en> = {
concierge: {
collapseReasoning: '推論を折りたたむ',
expandReasoning: '推論を展開',
enableNotifications: {
prompt: 'Conciergeから返信があったときに通知を受け取りますか?',
cta: '通知',
},
},
supportalNoAccess: {
title: 'ちょっと待ってください',
Expand Down
1 change: 0 additions & 1 deletion src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,6 @@ const translations: TranslationDeepObject<typeof en> = {
concierge: {
collapseReasoning: 'Redenering inklappen',
expandReasoning: 'Redenering uitklappen',
enableNotifications: {prompt: 'Wil je een melding krijgen wanneer Concierge reageert?', cta: 'Melden'},
},
supportalNoAccess: {
title: 'Niet zo snel',
Expand Down
1 change: 0 additions & 1 deletion src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,6 @@ const translations: TranslationDeepObject<typeof en> = {
concierge: {
collapseReasoning: 'Zwiń rozumowanie',
expandReasoning: 'Rozwiń rozumowanie',
enableNotifications: {prompt: 'Chcesz otrzymywać powiadomienia, gdy Concierge odpowie?', cta: 'Powiadom'},
},
supportalNoAccess: {
title: 'Nie tak szybko',
Expand Down
1 change: 0 additions & 1 deletion src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,6 @@ const translations: TranslationDeepObject<typeof en> = {
concierge: {
collapseReasoning: 'Recolher raciocínio',
expandReasoning: 'Expandir raciocínio',
enableNotifications: {prompt: 'Quer ser avisado quando o Concierge responder?', cta: 'Notificar'},
},
supportalNoAccess: {
title: 'Calma aí',
Expand Down
4 changes: 0 additions & 4 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,6 @@ const translations: TranslationDeepObject<typeof en> = {
concierge: {
collapseReasoning: '收起推理',
expandReasoning: '展开推理',
enableNotifications: {
prompt: '希望在Concierge回复时收到通知吗?',
cta: '通知',
},
},
supportalNoAccess: {
title: '先别急',
Expand Down
27 changes: 18 additions & 9 deletions src/libs/Notification/LocalNotification/BrowserNotifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import EXPENSIFY_ICON_URL from '@assets/images/expensify-logo-round-clearspace.p
import * as AppUpdate from '@libs/actions/AppUpdate';
import {translateLocal} from '@libs/Localize';
import {getForReportAction} from '@libs/ModifiedExpenseMessage';
import NotificationPermission from '@libs/Notification/notificationPermission';
import {getTextFromHtml} from '@libs/ReportActionsUtils';
import {getReportName} from '@libs/ReportNameUtils';
import * as ReportUtils from '@libs/ReportUtils';
Expand All @@ -17,18 +16,28 @@ import type {LocalNotificationClickHandler, LocalNotificationData, LocalNotifica
const notificationCache: Record<string, Notification> = {};

/**
* Checks if the user has granted permission to show browser notifications, prompting them
* if they have not yet decided.
* Checks if the user has granted permission to show browser notifications
*/
function canUseBrowserNotifications(): Promise<boolean> {
return NotificationPermission.getStatus().then((status) => {
if (status === 'granted') {
return true;
return new Promise((resolve) => {
// They have no browser notifications so we can't use this feature
if (!window.Notification) {
resolve(false);
return;
}
if (status === 'denied') {
return false;

// Check if they previously granted or denied us access to send a notification
const permissionGranted = Notification.permission === 'granted';

if (permissionGranted || Notification.permission === 'denied') {
resolve(permissionGranted);
return;
}
return NotificationPermission.request().then((requested) => requested === 'granted');

// Check their global preferences for browser notifications and ask permission if they have none
Notification.requestPermission().then((status) => {
resolve(status === 'granted');
});
});
}

Expand Down

This file was deleted.

33 changes: 0 additions & 33 deletions src/libs/Notification/notificationPermission/index.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/libs/Notification/notificationPermission/types.ts

This file was deleted.

11 changes: 0 additions & 11 deletions src/libs/actions/ConciergeNotificationBanner.ts

This file was deleted.

63 changes: 0 additions & 63 deletions src/pages/inbox/report/EnableNotificationsBanner.tsx

This file was deleted.

14 changes: 3 additions & 11 deletions src/pages/inbox/report/ReportFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,12 @@ import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import {isLoadingInitialReportActionsSelector} from '@src/selectors/ReportMetaData';
import type * as OnyxTypes from '@src/types/onyx';
import EnableNotificationsBanner, {BANNER_COMPOSER_OVERLAP_PX} from './EnableNotificationsBanner';
import ReportActionCompose from './ReportActionCompose/ReportActionCompose';
import SystemChatReportFooterMessage from './SystemChatReportFooterMessage';
import useShouldShowComposerForActiveEditDraft from './useShouldShowComposerForActiveEditDraft';
import useShouldShowEnableNotificationsBanner from './useShouldShowEnableNotificationsBanner';

const policyRoleSelector = (policy: OnyxEntry<OnyxTypes.Policy>) => policy?.role;

const composerOverlapStyle = {marginTop: -BANNER_COMPOSER_OVERLAP_PX};

/**
* Footer component that decides between the composer and
* archived/anonymous/blocked/system chat/admins-only footer.
Expand Down Expand Up @@ -75,7 +71,6 @@ function ReportFooter() {

const isUserPolicyAdmin = policyRole === CONST.POLICY.ROLE.ADMIN;
const isArchivedRoom = isArchivedNonExpenseReport(report, isReportArchived);
const shouldShowEnableNotificationsBanner = useShouldShowEnableNotificationsBanner(reportIDFromRoute);

const shouldShowComposerOptimistically = !isAnonymousUser && isPublicRoom(report) && !!isLoadingInitialReportActions;
const canPerformWriteAction = canUserPerformWriteAction(report, isReportArchived) ?? shouldShowComposerOptimistically;
Expand All @@ -95,12 +90,9 @@ function ReportFooter() {
if (!shouldHideComposer) {
return (
<View style={[chatFooterStyles, isComposerFullSize && styles.chatFooterFullCompose]}>
{shouldShowEnableNotificationsBanner && <EnableNotificationsBanner />}
<View style={shouldShowEnableNotificationsBanner ? composerOverlapStyle : undefined}>
<SwipeableView onSwipeDown={Keyboard.dismiss}>
<ReportActionCompose reportID={reportIDFromRoute} />
</SwipeableView>
</View>
<SwipeableView onSwipeDown={Keyboard.dismiss}>
<ReportActionCompose reportID={reportIDFromRoute} />
</SwipeableView>
</View>
);
}
Expand Down
Loading
Loading