Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
const rnpmlink = require('appcenter-link-scripts');
// Configure Android first.
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();
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
const rnpmlink = require('appcenter-link-scripts');
// Configure Android first.
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(() => {
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
const rnpmlink = require('appcenter-link-scripts');
// Configure Android first.
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 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(() => {
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
const rnpmlink = require('appcenter-link-scripts');
console.log('Please enter your Android and iOS app secrets below.');
console.log('For more information: https://docs.microsoft.com/en-us/appcenter/sdk/getting-started/react-native');
// Configure Android first.
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(() => {
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
const rnpmlink = require('appcenter-link-scripts');
// Configure Android first.
let promise;
if (rnpmlink.android.checkIfAndroidDirectoryExists()) {
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()) {
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)
],