diff --git a/packages/app/components/login.component.js b/packages/app/components/login.component.js index 8a8adc95a..ef4e2c166 100644 --- a/packages/app/components/login.component.js +++ b/packages/app/components/login.component.js @@ -1,4 +1,5 @@ import React, { useEffect } from 'react'; +import { Platform } from 'react-native'; import { SafeAreaView, StyleSheet, Image, Linking } from 'react-native'; import { Button, Icon, Modal, Card, Text, ImageBackground, Divider, Layout, TopNavigation, Input } from '@ui-kitten/components'; import Personnummer from 'personnummer' @@ -18,7 +19,8 @@ export const Login = ({ navigation }) => { useEffect(() => { setValid(Personnummer.valid(socialSecurityNumber)) - //setHasBankId(Linking.canOpenURL('bankid://')) + const url = Platform.OS == 'ios' ? 'https://app.bankid.com/' : 'bankid:///'; + setHasBankId(Linking.canOpenURL(url)) }, [socialSecurityNumber]) useEffect(() => { @@ -62,7 +64,9 @@ export const Login = ({ navigation }) => { const token = await fetch(`${baseUrl}/login?socialSecurityNumber=${socialSecurityNumber}`, {method: 'POST'}).then(res => res.json()) console.log('got token', token) - try {if (hasBankId) Linking.openURL(`bankid:///?autostarttoken=${token.token}`)} catch(err){ setHasBankId(false)} + const bankIdUrl = Platform.OS === 'ios' ? `https://app.bankid.com/?autostarttoken=${token.token}&redirect=null` : `bankid:///?autostarttoken=${token.token}&redirect=null` + console.log(`Open BankID: ${bankIdUrl}`) + try {if (hasBankId) Linking.openURL(bankIdUrl)} catch(err){ setHasBankId(false)} const jwt = await fetch(`${baseUrl}/login/${token.order}/jwt`, {timeoutInterval: 60000}).then(res => res.ok ? res : Promise.reject(res.json())).then(res => res.json()) await setJwt(jwt.token || jwt) setVisible(false) diff --git a/packages/app/ios/Skolplattformen.xcworkspace/xcuserdata/hellman.xcuserdatad/UserInterfaceState.xcuserstate b/packages/app/ios/Skolplattformen.xcworkspace/xcuserdata/hellman.xcuserdatad/UserInterfaceState.xcuserstate index d64a71fa8..452f42b75 100644 Binary files a/packages/app/ios/Skolplattformen.xcworkspace/xcuserdata/hellman.xcuserdatad/UserInterfaceState.xcuserstate and b/packages/app/ios/Skolplattformen.xcworkspace/xcuserdata/hellman.xcuserdatad/UserInterfaceState.xcuserstate differ