This is my first project in React-Native that too with CarPlay.
Now the code is already done by some other team.
My first task here is, whenever I open CarPlay app, I need to check if the user is logged in or not inside app on Phone.
I have created bridging and send the value from React-Native side to swift.
but i am not getting in which method I should validate that if user is logged In or not.
The code I did so far is.
In CarPlayBridge.Swift file
@objc func setCarplayParameter(_ isAuthenticated: Bool){
print("if user is authenticated : (isAuthenticated)")
var isAuth: Bool = isAuthenticated
}
In my Config.swift file
var isAuthenticated : Bool = false
In CarPlaySceneDelegate.Swift
if(isAuthenticated){
//true : go to dashbaord
}else{
//false : show alert
}
In CaRPlayBridge.m file
RCT_EXTERN_METHOD(setCarplayParameter:
(bool *)isAuthenticated
)
In my Index.tsx
useEffect(() => {
NativeModules.CarPlayBridge.setCarplayParameter(isAuthenticate);
}, [isAuthenticate]);
Now can anyone please help me out with understanding of, how can I check that value I am receiving CarPlayBridge.Swift for isAuthenticated
is correct, and where I should write the code to check that user is logged in or not when he open CarPlay app on his CarPlay device.
Any help will be appreciated. Thank you.