feat(invite): gate AddToWalletButton to iOS only for v1 launch

This commit is contained in:
vineyardbovines
2026-06-26 11:08:04 -04:00
parent b98699c379
commit 7027dfdd3b
2 changed files with 7 additions and 24 deletions
@@ -156,33 +156,13 @@ test('iOS: mints token then calls addPass with the returned URL', async () => {
)
})
// Test 6: Android press flow
test('Android: fetches JWT then calls addPassWithSignedJwt', async () => {
// Test 6: Android is gated out for iOS-only launch (Google Wallet backend not provisioned)
test('Android: renders null until Google Wallet backend is wired', () => {
;(Platform as {OS: string}).OS = 'android'
global.fetch = jest.fn().mockResolvedValue({
ok: true,
json: () => Promise.resolve({jwt: 'signed-jwt'}),
})
const {UNSAFE_getByType} = render(
const {toJSON} = render(
<AddToWalletButton themeKey="day" handle="bob.bsky.social" />,
)
await waitFor(() =>
UNSAFE_getByType('RNWalletView' as unknown as ComponentType),
)
const view = UNSAFE_getByType(
'RNWalletView' as unknown as ComponentType,
) as unknown as {
props: {onPress: () => Promise<void>}
}
const {onPress} = view.props
await act(async () => {
await onPress()
})
expect(global.fetch).toHaveBeenCalledWith(
'https://bsky.app/invite/wallet/jwt?theme=day',
expect.objectContaining({headers: expect.any(Object)}),
)
expect(RNWallet.addPassWithSignedJwt).toHaveBeenCalledWith('signed-jwt')
expect(toJSON()).toBeNull()
})
// Test 7: error path
@@ -43,6 +43,9 @@ export function AddToWalletButton({
}, [handle])
if (IS_WEB) return null
// iOS-only launch: Google Wallet backend is not yet provisioned. Once
// the Google Wallet API issuer + service account land, drop this gate.
if (Platform.OS !== 'ios') return null
if (!handle || handle === 'handle.invalid') return null
if (canAdd !== true) return null