Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat[ios]: dialog prompting push notification permission (#2760)
Peter Chinmand9651ebf799b
diff --git a/js/app/packages/app/component/Root.tsx b/js/app/packages/app/component/Root.tsxindex c5b24d0067..157743314d 100644--- a/js/app/packages/app/component/Root.tsx+++ b/js/app/packages/app/component/Root.tsx@@ -12,6 +12,7 @@ import {useUserId,useUserInfo,} from '@core/context/user';+import { IosPushNotificationModal } from '@core/mobile/IosPushNotificationModal';import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';import { createBlockOrchestrator } from '@core/orchestrator';import { formatTabTitle, tabTitleSignal } from '@core/signal/tabTitle';@@ -434,6 +435,7 @@ export function Root() {<EntityProvider><UserContextProvider><BrowserNotificationModal />+ <IosPushNotificationModal /><QuerySyncProviderWithUserId /><UserInfoSideEffects /><ConfiguredGlobalAppStateProvider>diff --git a/js/app/packages/core/component/DialogWrapper.tsx b/js/app/packages/core/component/DialogWrapper.tsxindex 737aaf6b90..a9bad2b04f 100644--- a/js/app/packages/core/component/DialogWrapper.tsx+++ b/js/app/packages/core/component/DialogWrapper.tsx@@ -30,7 +30,7 @@ export function DialogWrapper(props: DialogWrapperProps) {<div class="z-modal fixed inset-0"><Dialog.Contentclass={cn(- 'max-w-[calc(100vw-16px)] mt-20 sm:mt-40 mx-auto overflow-hidden portal-scope'+ 'max-w-[calc(100vw-16px)] mt-40 mx-auto overflow-hidden portal-scope')}style={{ width: width }}>diff --git a/js/app/packages/core/mobile/IosPushNotificationModal.tsx b/js/app/packages/core/mobile/IosPushNotificationModal.tsxnew file mode 100644index 0000000000..b7ee54dd00--- /dev/null+++ b/js/app/packages/core/mobile/IosPushNotificationModal.tsx@@ -0,0 +1,63 @@+import { DialogWrapper } from '@core/component/DialogWrapper';+import { isPlatform } from '@core/util/platform';+import { useIsAuthenticated } from '@queries/auth';+import { useNotificationSettings } from '@notifications/notification-settings';+import { Button } from '@ui/components/Button';+import { Dialog } from '@kobalte/core/dialog';+import { createMemo } from 'solid-js';++const DEBUG_FORCE_OPEN = false;++export function IosPushNotificationModal() {+ if (!isPlatform('ios')) return null;++ const settings = useNotificationSettings();+ const isAuthenticated = useIsAuthenticated();++ if (!settings.isSupported) return null;++ const shouldShow = createMemo(+ () => DEBUG_FORCE_OPEN || (settings.shouldPrompt() && isAuthenticated())+ );++ return (+ <Dialog+ open={shouldShow()}+ onOpenChange={(open) => {+ if (!open) settings.dismissPrompt();+ }}+ >+ <Dialog.Portal>+ <DialogWrapper width="90%">+ <div class="flex flex-col gap-4 px-4 py-6">+ <Dialog.Title class="text-lg font-semibold text-ink">+ Enable Push Notifications+ </Dialog.Title>+ <Dialog.Description class="text-sm text-ink-extra-muted">+ Get notified about new messages, mentions, comments, and emails.+ </Dialog.Description>+ <div class="flex gap-2 w-full justify-end pt-2">+ <Dialog.CloseButton class="text-sm text-ink-muted hover:text-ink px-3 py-1.5">+ Later+ </Dialog.CloseButton>+ <Button+ variant="accent"+ size="sm"+ class="text-sm"+ onClick={async () => {+ try {+ await settings.toggle(true);+ } catch (error) {+ console.error('Failed to enable notifications:', error);+ }+ }}+ >+ Enable+ </Button>+ </div>+ </div>+ </DialogWrapper>+ </Dialog.Portal>+ </Dialog>+ );+}diff --git a/js/app/packages/notifications/components/BrowserNotificationModal.tsx b/js/app/packages/notifications/components/BrowserNotificationModal.tsxindex 4b5145eddc..a87ef5e229 100644--- a/js/app/packages/notifications/components/BrowserNotificationModal.tsx+++ b/js/app/packages/notifications/components/BrowserNotificationModal.tsx@@ -1,6 +1,7 @@import Bell from '@icon/regular/bell.svg';import { toast } from '@core/component/Toast/Toast';import { useTutorialCompleted } from '@core/context/user';+import { isPlatform } from '@core/util/platform';import { useIsAuthenticated } from '@queries/auth';import { createMemo, onMount, Show } from 'solid-js';import {@@ -18,6 +19,7 @@ export const BrowserNotificationModal = () => {const shouldShow = createMemo(() =>!import.meta.env.DEV &&+ !isPlatform('ios') &&settings.shouldPrompt() &&isAuthenticated() &&!!tutorialCompleted()diff --git a/js/app/packages/tauri/src/PushNotification.tsx b/js/app/packages/tauri/src/PushNotification.tsxindex df9d3f136d..43235aa4a0 100644--- a/js/app/packages/tauri/src/PushNotification.tsx+++ b/js/app/packages/tauri/src/PushNotification.tsx@@ -196,6 +196,10 @@ export function MaybePushNotificationRegistration(props: {return baseShowNotification(data);},getCurrentPermission: async () => {+ const sysPerm = await checkPermissions();+ if (sysPerm.status === 'prompt') {+ return 'default';+ }const appNotification = await getCurrentPermission();if (appNotification === 'granted' && push.permission() === 'granted') {return 'granted';