(source: string)
| 20 | * prompts. |
| 21 | */ |
| 22 | export const useRateAppRow = (source: string): UseRateAppRow => { |
| 23 | const { logEvent } = useLogContext(); |
| 24 | const isEnabled = useFeature(featureAppStoreReview); |
| 25 | // The bridge is only known on the client, so read it after mount. |
| 26 | const [canReview, setCanReview] = useState(false); |
| 27 | |
| 28 | useEffect(() => { |
| 29 | setCanReview(iOSSupportsReview()); |
| 30 | }, []); |
| 31 | |
| 32 | return { |
| 33 | isVisible: canReview && !!isEnabled, |
| 34 | onClick: () => { |
| 35 | logEvent({ |
| 36 | event_name: LogEvent.Click, |
| 37 | target_type: TargetType.AppStoreReview, |
| 38 | target_id: source, |
| 39 | }); |
| 40 | openIOSWriteReview(); |
| 41 | }, |
| 42 | }; |
| 43 | }; |
no test coverage detected