()
| 41 | return <Text key={i} color={getRainbowColor(i)}>{ch}</Text>; |
| 42 | } |
| 43 | export function useBuddyNotification() { |
| 44 | const $ = _c(4); |
| 45 | const { |
| 46 | addNotification, |
| 47 | removeNotification |
| 48 | } = useNotifications(); |
| 49 | let t0; |
| 50 | let t1; |
| 51 | if ($[0] !== addNotification || $[1] !== removeNotification) { |
| 52 | t0 = () => { |
| 53 | if (!feature("BUDDY")) { |
| 54 | return; |
| 55 | } |
| 56 | const config = getGlobalConfig(); |
| 57 | if (config.companion || !isBuddyTeaserWindow()) { |
| 58 | return; |
| 59 | } |
| 60 | addNotification({ |
| 61 | key: "buddy-teaser", |
| 62 | jsx: <RainbowText text="/buddy" />, |
| 63 | priority: "immediate", |
| 64 | timeoutMs: 15000 |
| 65 | }); |
| 66 | return () => removeNotification("buddy-teaser"); |
| 67 | }; |
| 68 | t1 = [addNotification, removeNotification]; |
| 69 | $[0] = addNotification; |
| 70 | $[1] = removeNotification; |
| 71 | $[2] = t0; |
| 72 | $[3] = t1; |
| 73 | } else { |
| 74 | t0 = $[2]; |
| 75 | t1 = $[3]; |
| 76 | } |
| 77 | useEffect(t0, t1); |
| 78 | } |
| 79 | export function findBuddyTriggerPositions(text: string): Array<{ |
| 80 | start: number; |
| 81 | end: number; |
no test coverage detected