Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { AppRegistry,AppState,Alert } from 'react-native';
import App from './App';
import Push from 'appcenter-push';
AppRegistry.registerComponent('goforeat_app', () => App);
Push.setListener({
onPushNotificationReceived: pushNotification => {
console.log(112312321321312321);
let message = pushNotification.message;
let title = pushNotification.title;
let customProperties = [];
let timestamp = Date.now();
// Custom name/value pairs set in the App Center web portal are in customProperties
if (
pushNotification.customProperties &&
Object.keys(pushNotification.customProperties).length > 0
) {
customProperties = pushNotification.customProperties;
}
Alert.alert(title, message);
return (
);
}
}
Push.setListener({
onPushNotificationReceived(pushNotification) {
let message = pushNotification.message;
let title = pushNotification.title;
if (message === null || message === undefined) {
// Android messages received in the background don't include a message. On Android, that fact can be used to
// check if the message was received in the background or foreground. For iOS the message is always present.
title = 'Android background';
message = '';
}
// Any custom name/value pairs added in the portal are in customProperties
if (pushNotification.customProperties && Object.keys(pushNotification.customProperties).length > 0) {
message += `\nCustom properties:\n${JSON.stringify(pushNotification.customProperties)}`;
}
AppCenter: AppCenterScreen,
Analytics: AnalyticsScreen,
Transmission: TransmissionScreen,
Crashes: CrashesScreen
},
{
tabBarOptions: {
activeBackgroundColor: 'white',
inactiveBackgroundColor: 'white',
},
}
);
export default createAppContainer(TabNavigator);
Push.setListener({
onPushNotificationReceived(pushNotification) {
let message = pushNotification.message;
const title = pushNotification.title;
// Message can be null on iOS silent push or Android background notifications.
if (message === null) {
message = '';
} else {
message += '\n';
}
// Any custom name/value pairs added in the portal are in customProperties
if (pushNotification.customProperties && Object.keys(pushNotification.customProperties).length > 0) {
message += `Custom properties:\n${JSON.stringify(pushNotification.customProperties)}`;
}
const { navigate } = this.props.navigation;
return (
Analytics: AnalyticsScreen,
Transmission: TransmissionScreen,
Crashes: CrashesScreen,
Data: DataScreen
},
{
tabBarOptions: {
activeBackgroundColor: 'white',
inactiveBackgroundColor: 'white',
},
}
);
export default createAppContainer(TabNavigator);
Push.setListener({
onPushNotificationReceived(pushNotification) {
let message = pushNotification.message;
const title = pushNotification.title;
// Message can be null on iOS silent push or Android background notifications.
if (message === null) {
message = '';
} else {
message += '\n';
}
// Any custom name/value pairs added in the portal are in customProperties
if (pushNotification.customProperties && Object.keys(pushNotification.customProperties).length > 0) {
message += `Custom properties:\n${JSON.stringify(pushNotification.customProperties)}`;
}
<button title="Test Crashes"> navigate("Crashes")} />
</button><button title="Test Analytics"> navigate("Analytics")} />
</button><button title="Test Push"> navigate("Push")} />
</button><button title="Test Other AppCenter APIs"> navigate("AppCenter")}
/>
);
}
}
Push.setListener({
onPushNotificationReceived(pushNotification) {
let message = pushNotification.message;
let title = pushNotification.title;
if (title === null) {
title = "";
}
if (message === null) {
message = "";
} else {
message += "\n";
}
// Any custom name/value pairs added in the portal are in customProperties
if (
pushNotification.customProperties &&</button>
_createPushListener = () => {
const { dispatch } = this.props;
let params = null;
let key = null;
let routeName = null;
Push.setListener({
onPushNotificationReceived(pushNotification) {
if (previousAppState !== 'active') {
const push = get(pushNotification, 'customProperties');
const type = get(push, 'type', '');
const permlink1 = get(push, 'permlink1', '');
const permlink2 = get(push, 'permlink2', '');
const permlink3 = get(push, 'permlink3', '');
//const parentPermlink1 = get(push, 'parent_permlink1', '');
//const parentPermlink2 = get(push, 'parent_permlink2', '');
//const parentPermlink3 = get(push, 'parent_permlink3', '');
//const fullParentPermlink = `${parentPermlink1}${parentPermlink2}${parentPermlink3}`;
const fullPermlink = `${permlink1}${permlink2}${permlink3}`;
const username = get(push, 'target', '');
const activity_id = get(push, 'id', '');