Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.
TypeScript adeagent-ideai-agentsautomationbotclaude-codecodexghosttygrok-bothermes-agentmobile-appmuseopenclawopencodeorchestrationpiruntimeterminalworktreesyc-backed
import { Platform } from 'react-native'
import * as Notifications from 'expo-notifications'
import { canPresentForegroundPush } from './push-receive'
import { readOrcaPushPayload } from './push-payload'
export async function presentForegroundPush(
identifier: string,
content: Pick<Notifications.NotificationContent, 'title' | 'body' | 'data' | 'sound'>,
prepare: () => boolean | Promise<boolean> = () => true,
isCurrent: () => boolean = () => true
): Promise<void> {
const payload = readOrcaPushPayload(content.data)
if (
!payload ||
!(await prepare()) ||
!(await canPresentForegroundPush(payload)) ||
!isCurrent()
) {
return
}
await Notifications.scheduleNotificationAsync({
identifier,
content: {
title: content.title,
body: content.body,
data: content.data,
sound: content.sound === 'default' ? 'default' : false
},
trigger:
typeof content.data?.channelId === 'string' ? { channelId: content.data.channelId } : null
})
}
export function startAndroidForegroundPushPresentation(): () => void {
if (Platform.OS !== 'android') {
return () => {}
}
const subscription = Notifications.addNotificationReceivedListener((notification) => {
const { trigger, content, identifier } = notification.request
// Expo emits foreground data pushes but only auto-presents them in the background.
if (
!trigger ||
!('type' in trigger) ||
trigger.type !== 'push' ||
trigger.remoteMessage?.notification !== null
) {
return
}
const payload = readOrcaPushPayload(content.data)
if (!payload || payload.kind === 'dismiss' || (!content.title && !content.body)) {
return
}
void presentForegroundPush(identifier, content).catch((error: unknown) => {
console.warn('[push] Foreground notification presentation failed', error)
})
})
return () => subscription.remove()
}