Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'react-native-intercom' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
wallet = { ...encryptedWallet, privateKey, address: walletAddress };
} else {
// nothing provided, invalid login
throw new Error();
}
const network = findEthereumNetwork(ethereumNetwork);
dispatch(setEthereumNetwork(network));
let { user = {} } = await storage.get('user');
const userState = user.walletId ? REGISTERED : PENDING;
if (userState === REGISTERED) {
const fcmToken = await firebase.messaging().getToken().catch(() => null);
dispatch({ type: UPDATE_SESSION, payload: { fcmToken } });
await Intercom.sendTokenToIntercom(fcmToken).catch(() => null);
const signalCredentials = {
userId: user.id,
username: user.username,
walletId: user.walletId,
ethAddress: wallet.address,
fcmToken,
};
const updateOAuth = updateOAuthTokensCB(dispatch, signalCredentials);
const onOAuthTokensFailed = onOAuthTokensFailedCB(dispatch);
api.init(updateOAuth, oAuthTokens, onOAuthTokensFailed, network);
if (onLoginSuccess && wallet.privateKey) {
let { privateKey: privateKeyParam } = wallet;
privateKeyParam = privateKeyParam.indexOf('0x') === 0 ? privateKeyParam.slice(2) : privateKeyParam;
await onLoginSuccess(privateKeyParam);
}
const getTokenWalletAndRegister = async (
privateKey: string,
api: Object, // FIXME: this should be api: SDKWrapper
user: Object,
dispatch: Dispatch,
) => {
await firebase.messaging().requestPermission().catch(() => { });
const fcmToken = await firebase.messaging().getToken().catch(() => { });
await Intercom.sendTokenToIntercom(fcmToken).catch(() => null);
const sdkWallet = await api.registerOnAuthServer(privateKey, fcmToken, user.username);
const registrationSucceed = !sdkWallet.error;
const userInfo = await api.userInfo(sdkWallet.walletId);
const userState = Object.keys(userInfo).length ? REGISTERED : PENDING;
if (Object.keys(userInfo).length) {
dispatch(saveDbAction('user', { user: userInfo }, true));
}
const oAuthTokens = {
refreshToken: sdkWallet.refreshToken,
accessToken: sdkWallet.accessToken,
};
const updateOAuth = updateOAuthTokensCB(dispatch);
await updateOAuth(oAuthTokens);
componentWillMount() {
Intercom.setInAppMessageVisibility('GONE'); // prevent messanger launcher to appear
}
onNextPress={() => Intercom.displayMessenger()}
/>
onPress: () => Intercom.displayMessenger(),
withBackground: true,
onSendFeedback: () => () => Intercom.displayMessenger(),
})(ComponentToWrap);
onPress={() => Intercom.displayMessenger()}
/>
const rightItems = [{ label: 'Support', onPress: () => Intercom.displayMessenger(), key: 'getHelp' }];
if ((!isEmpty(exchangeAllowances) || !isEmpty(connectedProviders))
rightItems: [{ link: 'Support', onPress: () => Intercom.displayMessenger() }],
sideFlex: 2,
rightItems: [{ link: 'Support', onPress: () => Intercom.displayMessenger() }],
sideFlex: 2,