react-native-biometrics - check if another faceid is added in ios - react-native

Lets say i setup FaceId on the phone. Then i registered for biometrics in the app. Everything works fine. But now when i add another FaceId, and when i try to login again, it should be able to detect that a new faceId has been added and it should give me an error or something. How can this be achieved with react-native-biometrics library. In android it can be detected if a new fingerprint is added but not when delete a fingerprint. but in ios cannot detect if the faceid is reset or a new one addded.
eg. code
const checkKeyExist = yield rnBiometrics.biometricKeysExist()
if (checkKeyExist.keysExist) {
const epochTimeSeconds = Math.round(new Date().getTime() / 1000).toString()
try {
const createSignature = yield rnBiometrics.createSignature({
promptMessage: 'Sign in',
payload: epochTimeSeconds
})
} catch (err) {
// Should catch that error here
}
}
any help would be much appreciated

Related

react-native-share wouldn't open anything in real ios device but app doesn't freeze

I'm trying to implement sharing a pdf feature using react-native-share. When I click 'share' button, there should be a pop-up with different sharing options but nothing pops up when I connect to my real ios device and test it. The app doesn't freeze or anything. Weird thing is everything works as expected when I test it on ios simulator.
Here's my code snippet
const sharePdf = async () => {
const shareOptions = {
url: `file://${reportUri}`,
type: 'application/pdf',
failOnCancel: true,
};
await Share.open(shareOptions);
};

OneSignal notification does not appear on iOS, but it does on Android (In App message works perfectly on both)

So I added onesignal-expo-plugin and react-native-onesignal to my project, I made everything what was wrote on the website
After this i made a developmen-simulator build for my app
I tested the app on IOS and on Android too, on android i get the notification instantly but on IOS i'm not.
So i checked the notification report on OneSignal dashboard and the ios fall into failed. I checked everything, I added everything what i had to, the p12 file is correct, I did everything multiple times before i write here,
I haven't ejected my ios app because I want to keep expo managing my ios/android application well.
What should I try to fix this issue?
Android works correctly but ios don't and I really need your help!
The in-app message works correctly just the push notification don't
Versions:
"react-native-onesignal": "^4.5.0",
"onesignal-expo-plugin": "^1.3.0",
I don't want to eject my ios code and I saw too many articles and videos how others use it and works. Please help me whats wrong.
My code example what I tried just now:
const initialOnesignal = async () => {
OneSignal.setAppId('HIDEN FOR STACKOVERFLOW');
OneSignal.promptForPushNotificationsWithUserResponse();
OneSignal.setNotificationWillShowInForegroundHandler(
notificationReceivedEvent => {
console.log(
'OneSignal: notification will show in foreground:',
notificationReceivedEvent,
);
let notification = notificationReceivedEvent.getNotification();
console.log('notification: ', notification);
const data = notification.additionalData;
console.log('additionalData: ', data);
notificationReceivedEvent.complete(notification);
},
);
OneSignal.setNotificationOpenedHandler(notification => {
console.log('OneSignal: notification opened:', notification);
});
};
And I also tried this way:
useEffect(() => {
OneSignal.setAppId('HIDEN FOR STACKOVERFLOW');
OneSignal.promptForPushNotificationsWithUserResponse(response => {
console.log('Prompt response:', response);
});
OneSignal.setNotificationWillShowInForegroundHandler(
notificationReceivedEvent => {
console.log(
'OneSignal: notification will show in foreground:',
notificationReceivedEvent,
);
let notification = notificationReceivedEvent.getNotification();
console.log('notification: ', notification);
const data = notification.additionalData;
console.log('additionalData: ', data);
// Complete with null means don't show a notification.
notificationReceivedEvent.complete(notification);
},
);
OneSignal.setNotificationOpenedHandler(notification => {
console.log('OneSignal: notification opened:', notification);
});
}, []);
Tried to only add my AppId as well. I guess i tried everyting.
I have tried to regenerate p12 file, try multiple code examples, run on simultaor and on device too.
Tried to use useEffect and simple function as well.

openUrl is not working in first attempt for mailto option in emulator in react native

I have tried to open gmail using linking.openUrl - mailto option. I can open gmail in my real device with first attempt.But In emulator its not open in first attempt and if I click same link second time it open gmail.
I couldn't understand what could be the cause.
Sample code:
Linking.canOpenURL(url)
.then(ok => {
if (ok) {
console.log(Linking.openURL(url));
return Linking.openURL(url);
} else {
console.warn("can't open mailto: iOS sim doesn't support it");
}
})
.catch(err => {
console.error(err);
});
Initially checking given url is valid or not. If valid try to open using openUrl concept

Testing Branch.IO referral links on react native

We use branch for referrals in our react native application. I have implemented branch successfully, now I want to test some scenarios.
When we click on a referral link, it navigates to app store or play store. But I want to do some debugging to identify if the params I pass are successfully send or not.
I have subscribed it like this. But how can I debug this with react-native debugger to see the console logs?
BranchIO.subscribe(async ({ error, params }) => {
if (error) {
console.log('Error from Branch: ', error);
return;
}
// Handle non-Branch URL.
if (params['+non_branch_link']) return;
// Indicates initialization success.
// No link was opened.
if (!params['+clicked_branch_link']) return;
const installParams = await BranchIO.getFirstReferringParams();
if (installParams?.$canonical_identifier === DeepLinkTypes.referral) {
store.dispatch(setReferralKey(installParams.referralKey));
}
// A Branch link was opened.
// Route link based on data in params
navigatePath(params.$deeplink_path);
});
To debug if you are able to fetch the associated link data or not you can put in a debugger at the following line-
const installParams = await BranchIO.getFirstReferringParams();
Also we would suggest you to kindly use/update the above line to use getLatestReferringParams
let lastParams = await branch.getLatestReferringParams()
instead of getFirstReferringParams() since there are some recent issues reported lately with this method.
You can print out the parameters in the console and see for the link data.

Twitter signin returns nothing on ios

I have simple code where i use react-native-twitter-signin to log in to twitter. I followed the instructions to set up my project. When i click in the button that calls this method:
const { RNTwitterSignIn } = NativeModules;
const twitterAuth = async () => {
console.log('point 1')
await RNTwitterSignIn.init(TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET);
console.log('point 2');
}
on android i get to signin and works accordingly. but on ios i’m stuck on that await and don't get to point 2. Nothing happens even in the debug console. I tried everything i could find on here. Please help.