Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const facebookLogin = async (): Promise => {
setSigningInFacebook(true);
try {
await Facebook.initializeAsync(
Constants.manifest.facebookAppId,
undefined,
);
const result = await Facebook.logInWithReadPermissionsAsync({
permissions: ['email', 'public_profile'],
});
if (result.type === 'success') {
const { token, expires, permissions, declinedPermissions } = result;
const response = await fetch(
`https://graph.facebook.com/me?fields=
id,name,email,birthday,gender,first_name,last_name,picture
&access_token=${token}`,
);
// console.log('success', response);
const responseObject = JSON.parse(await response.text());
const fileExtension = meta.type ? `.${encodeURIComponent(meta.type)}` : '';
const suffix = `/${encodeURIComponent(
meta.name
)}${fileScale}${fileExtension}?platform=${encodeURIComponent(
Platform.OS
)}&hash=${encodeURIComponent(meta.hash)}`;
// For assets with a specified absolute URL, we use the existing origin instead of prepending the
// development server or production CDN URL origin
if (/^https?:\/\//.test(meta.httpServerLocation)) {
const uri = meta.httpServerLocation + suffix;
return { uri, hash };
}
// For assets during development, we use the development server's URL origin
if (Constants.manifest && Constants.manifest.developer) {
const baseUrl = new URL(Constants.manifest.bundleUrl);
baseUrl.set('pathname', meta.httpServerLocation + suffix);
return { uri: baseUrl.href, hash };
}
// Production CDN URIs are based on each asset file hash
return {
uri: `https://d1wp6m56sqw74a.cloudfront.net/~assets/${encodeURIComponent(hash)}`,
hash,
};
}
.then(userAgent => {
this.userAgent = userAgent;
this.parameters = {
an: Constants.manifest.name,
aid: Constants.manifest.slug,
av: Constants.manifest.version,
sr: `${width}x${height}`,
...additionalParameters
};
if(this.options.debug){
console.log(`[expo-analytics] UserAgent=${userAgent}`);
console.log(`[expo-analytics] Additional parameters=`, this.parameters);
}
});
}
function getRedirectUrl() {
const redirectUrl = `${BASE_URL}/${Constants.manifest.id}`;
if (__DEV__) {
_warnIfAnonymous(Constants.manifest.id, redirectUrl);
}
return redirectUrl;
}
function getDefaultReturnUrl() {
function getRedirectUrl(): string {
const redirectUrl = `${BASE_URL}/${Constants.manifest.id}`;
if (__DEV__) {
_warnIfAnonymous(Constants.manifest.id, redirectUrl);
}
return redirectUrl;
}
loadResourcesAsync = async () => Promise.all([
Asset.loadAsync([
require('./assets/images/robot-dev.png'),
require('./assets/images/robot-prod.png'),
]),
twitter.setConsumerKey(
Constants.manifest.extra.twitter.consumerKey,
Constants.manifest.extra.twitter.consumerKeySecret,
),
])
async function _subscribeUserToPushAsync(): Promise {
if (!Constants.manifest.notification || !Constants.manifest.notification.vapidPublicKey) {
throw new CodedError(
'E_NOTIFICATIONS_PUSH_WEB_MISSING_CONFIG',
'You must provide `notification.vapidPublicKey` in `app.json` to use push notifications on web. Learn more: https://docs.expo.io/versions/latest/guides/using-vapid/.'
);
}
if (!Constants.manifest.notification || !Constants.manifest.notification.serviceWorkerPath) {
throw new CodedError(
'E_NOTIFICATIONS_PUSH_WEB_MISSING_CONFIG',
'You must provide `notification.serviceWorkerPath` in `app.json` to use push notifications on web. Please provide path to the service worker that will handle notifications.'
);
}
guardPermission();
const registration = await navigator.serviceWorker.register(Constants.manifest.notification.serviceWorkerPath);
await navigator.serviceWorker.ready;
function getRedirectUrl() {
const redirectUrl = `${BASE_URL}/${Constants.manifest.id}`;
if (__DEV__) {
_warnIfAnonymous(Constants.manifest.id, redirectUrl);
}
return redirectUrl;
}
function getDefaultReturnUrl() {
render() {
if (this.state.invalidExperienceId) {
return (
);
}
return (