feat(invite): gate AddToWalletButton to iOS only for v1 launch
This commit is contained in:
@@ -156,33 +156,13 @@ test('iOS: mints token then calls addPass with the returned URL', async () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Test 6: Android press flow
|
// Test 6: Android is gated out for iOS-only launch (Google Wallet backend not provisioned)
|
||||||
test('Android: fetches JWT then calls addPassWithSignedJwt', async () => {
|
test('Android: renders null until Google Wallet backend is wired', () => {
|
||||||
;(Platform as {OS: string}).OS = 'android'
|
;(Platform as {OS: string}).OS = 'android'
|
||||||
global.fetch = jest.fn().mockResolvedValue({
|
const {toJSON} = render(
|
||||||
ok: true,
|
|
||||||
json: () => Promise.resolve({jwt: 'signed-jwt'}),
|
|
||||||
})
|
|
||||||
const {UNSAFE_getByType} = render(
|
|
||||||
<AddToWalletButton themeKey="day" handle="bob.bsky.social" />,
|
<AddToWalletButton themeKey="day" handle="bob.bsky.social" />,
|
||||||
)
|
)
|
||||||
await waitFor(() =>
|
expect(toJSON()).toBeNull()
|
||||||
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')
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Test 7: error path
|
// Test 7: error path
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ export function AddToWalletButton({
|
|||||||
}, [handle])
|
}, [handle])
|
||||||
|
|
||||||
if (IS_WEB) return null
|
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 (!handle || handle === 'handle.invalid') return null
|
||||||
if (canAdd !== true) return null
|
if (canAdd !== true) return null
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user