feat: ship Wave 5-6 multi-surface hygiene, optimization, and bug fixes

This commit is contained in:
Yun Chan 2026-11-14 11:51:41 +09:00
parent 01ef3293cf
commit 66b6b45ba9
399 changed files with 17828 additions and 11330 deletions

View file

@ -4,6 +4,7 @@ import {
BannerAd,
BannerAdSize,
} from 'react-native-google-mobile-ads'
import { useResponsiveLayout } from '@d3ro/ui-native'
import { useMobileAds } from '../lib/mobile-ads-context'
import { useMobilePreferences } from '../lib/preferences-context'
import { ThemeText } from '../theme/themed-components'
@ -16,10 +17,12 @@ export default function FreeTierBanner(): React.ReactElement | null {
const { t } = useI18n()
const ads = useMobileAds()
const { palette } = useMobilePreferences()
const { bannerSlotMinHeight } = useResponsiveLayout()
const [loaded, setLoaded] = useState(false)
const [failed, setFailed] = useState(false)
const [retryAttempt, setRetryAttempt] = useState(0)
const [retryKey, setRetryKey] = useState(0)
const [measuredHeight, setMeasuredHeight] = useState(0)
useEffect(() => {
setLoaded(false)
@ -28,6 +31,10 @@ export default function FreeTierBanner(): React.ReactElement | null {
setRetryKey(0)
}, [ads.bannerUnitId])
useEffect(() => {
setMeasuredHeight(0)
}, [ads.bannerUnitId, ads.eligible, bannerSlotMinHeight])
useEffect(() => {
if (!failed || !ads.bannerUnitId) return undefined
const delay = Math.min(
@ -45,11 +52,20 @@ export default function FreeTierBanner(): React.ReactElement | null {
if (!ads.eligible) return null
const reservedMinHeight = Math.max(bannerSlotMinHeight, measuredHeight)
return (
<View
onLayout={(event) => {
const nextHeight = Math.round(event.nativeEvent.layout.height)
if (nextHeight > measuredHeight) {
setMeasuredHeight(nextHeight)
}
}}
style={[
styles.slot,
{
minHeight: reservedMinHeight,
backgroundColor: palette.bg.inset,
borderTopColor: palette.border.subtle,
},