Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let promise = null;
if (rnpmlink.android.checkIfAndroidDirectoryExists()) {
console.log('Configuring AppCenter Auth for Android');
promise = rnpmlink.android.initAppCenterConfig()
.then(() => {
rnpmlink.android.removeAndroidDuplicateLinks();
}).catch((e) => {
console.error(`Could not configure AppCenter Auth for Android. Error Reason - ${e.message}`);
return Promise.resolve();
});
} else {
promise = Promise.resolve();
}
// Then iOS even if Android failed.
if (rnpmlink.ios.checkIfAppDelegateExists()) {
promise
.then(() => {
console.log('Configuring AppCenter Auth for iOS');
return rnpmlink.ios.initAppCenterConfig();
})
.then(() => {
const code = '[AppCenterReactNativeAuth register]; // Initialize AppCenter auth';
return rnpmlink.ios.initInAppDelegate('#import ', code, /.*\[AppCenterReactNativeAuth register.*/g);
})
.then((file) => {
console.log(`Added code to initialize iOS Auth SDK in ${file}`);
return rnpmlink.ios.addPodDeps(
[
{ pod: 'AppCenter/Auth', version: '2.5.1' },
{ pod: 'AppCenterReactNativeShared', version: '2.6.0' } // in case people don't link appcenter (core)
],
console.log('Configuring AppCenter Crashes for Android');
promise = rnpmlink.android.initAppCenterConfig()
.then(() => {
rnpmlink.android.patchStrings('appCenterCrashes_whenToSendCrashes',
'ALWAYS_SEND');
rnpmlink.android.removeAndroidDuplicateLinks();
}).catch((e) => {
console.error(`Could not configure AppCenter Crashes for Android. Error Reason - ${e.message}`);
return Promise.resolve();
});
} else {
promise = Promise.resolve();
}
// Then iOS even if Android failed.
if (rnpmlink.ios.checkIfAppDelegateExists()) {
promise
.then(() => {
console.log('Configuring AppCenter Crashes for iOS');
return rnpmlink.ios.initAppCenterConfig();
})
.then(() => {
const code = '[AppCenterReactNativeCrashes registerWithAutomaticProcessing]; // Initialize AppCenter crashes';
return rnpmlink.ios.initInAppDelegate('#import ', code, /.*\[AppCenterReactNativeCrashes register.*/g);
})
.then((file) => {
console.log(`Added code to initialize iOS Crashes SDK in ${file}`);
return rnpmlink.ios.addPodDeps(
[
{ pod: 'AppCenter/Crashes', version: '2.5.1' },
{ pod: 'AppCenterReactNativeShared', version: '2.6.0' } // in case people don't link appcenter (core)
],
let promise = null;
if (rnpmlink.android.checkIfAndroidDirectoryExists()) {
console.log('Configuring AppCenter Analytics for Android');
promise = rnpmlink.android.initAppCenterConfig()
.then(() => {
rnpmlink.android.removeAndroidDuplicateLinks();
}).catch((e) => {
console.error(`Could not configure AppCenter Push for Android. Error Reason - ${e.message}`);
return Promise.resolve();
});
} else {
promise = Promise.resolve();
}
// Then iOS even if Android failed.
if (rnpmlink.ios.checkIfAppDelegateExists()) {
promise
.then(() => {
console.log('Configuring AppCenter Push for iOS');
return rnpmlink.ios.initAppCenterConfig();
})
.then(() => {
const code = '[AppCenterReactNativePush register]; // Initialize AppCenter push';
return rnpmlink.ios.initInAppDelegate('#import ', code);
})
.then((file) => {
console.log(`Added code to initialize iOS Push SDK in ${file}`);
return rnpmlink.ios.addPodDeps(
[
{ pod: 'AppCenter/Push', version: '2.5.1' },
{ pod: 'AppCenterReactNativeShared', version: '2.6.0' } // in case people don't link appcenter (core)
],
.then((file) => {
console.log(`Added code to initialize iOS Crashes SDK in ${file}`);
return rnpmlink.ios.addPodDeps(
[
{ pod: 'AppCenter/Crashes', version: '2.5.1' },
{ pod: 'AppCenterReactNativeShared', version: '2.6.0' } // in case people don't link appcenter (core)
],
{ platform: 'ios', version: '9.0' }
);
})
.catch((e) => {
let promise = null;
if (rnpmlink.android.checkIfAndroidDirectoryExists()) {
console.log('Configuring AppCenter Data for Android');
promise = rnpmlink.android.initAppCenterConfig()
.then(() => {
rnpmlink.android.removeAndroidDuplicateLinks();
}).catch((e) => {
console.error(`Could not configure AppCenter Data for Android. Error Reason - ${e.message}`);
return Promise.resolve();
});
} else {
promise = Promise.resolve();
}
// Then iOS even if Android failed.
if (rnpmlink.ios.checkIfAppDelegateExists()) {
promise
.then(() => {
console.log('Configuring AppCenter Data for iOS');
return rnpmlink.ios.initAppCenterConfig();
})
.then(() => {
const code = '[AppCenterReactNativeData register]; // Initialize AppCenter data';
return rnpmlink.ios.initInAppDelegate('#import ', code, /.*\[AppCenterReactNativeData register.*/g);
})
.then((file) => {
console.log(`Added code to initialize iOS Data SDK in ${file}`);
return rnpmlink.ios.addPodDeps(
[
{ pod: 'AppCenter/Data', version: '2.5.1' },
{ pod: 'AppCenterReactNativeShared', version: '2.6.0' } // in case people don't link appcenter (core)
],
.then((file) => {
console.log(`Added code to initialize iOS Push SDK in ${file}`);
return rnpmlink.ios.addPodDeps(
[
{ pod: 'AppCenter/Push', version: '2.5.1' },
{ pod: 'AppCenterReactNativeShared', version: '2.6.0' } // in case people don't link appcenter (core)
],
{ platform: 'ios', version: '9.0' }
);
})
.catch((e) => {
.then(() => {
const code = '[AppCenterReactNativeAuth register]; // Initialize AppCenter auth';
return rnpmlink.ios.initInAppDelegate('#import ', code, /.*\[AppCenterReactNativeAuth register.*/g);
})
.then((file) => {
.then(() => {
const code = '[AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true]; // Initialize AppCenter analytics';
return rnpmlink.ios.initInAppDelegate('#import ', code, /.*\[AppCenterReactNativeAnalytics register.*/g);
})
.then((file) => {
.then(() => {
console.log('Configuring AppCenter Data for iOS');
return rnpmlink.ios.initAppCenterConfig();
})
.then(() => {
.then((file) => {
console.log(`Added code to initialize iOS AppCenter SDK in ${file}`);
return rnpmlink.ios.addPodDeps(
[{ pod: 'AppCenterReactNativeShared', version: '2.6.1' }],
{ platform: 'ios', version: '9.0' }
);
})
.catch((e) => {