Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("must call inFocusDisplaying with FocusBehaviors type", () => {
OneSignal.inFocusDisplaying(0);
OneSignal.inFocusDisplaying(1);
OneSignal.inFocusDisplaying(2);
// $ExpectError
OneSignal.inFocusDisplaying(3);
// $ExpectError
OneSignal.inFocusDisplaying();
});
});
it('must call inFocusDisplaying with FocusBehaviors type', () => {
OneSignal.inFocusDisplaying(0);
OneSignal.inFocusDisplaying(1);
OneSignal.inFocusDisplaying(2);
// $ExpectError
OneSignal.inFocusDisplaying(3);
// $ExpectError
OneSignal.inFocusDisplaying();
});
});
it("must call inFocusDisplaying with FocusBehaviors type", () => {
OneSignal.inFocusDisplaying(0);
OneSignal.inFocusDisplaying(1);
OneSignal.inFocusDisplaying(2);
// $ExpectError
OneSignal.inFocusDisplaying(3);
// $ExpectError
OneSignal.inFocusDisplaying();
});
});
it("must call inFocusDisplaying with FocusBehaviors type", () => {
OneSignal.inFocusDisplaying(0);
OneSignal.inFocusDisplaying(1);
OneSignal.inFocusDisplaying(2);
// $ExpectError
OneSignal.inFocusDisplaying(3);
// $ExpectError
OneSignal.inFocusDisplaying();
});
});
it('must call inFocusDisplaying with FocusBehaviors type', () => {
OneSignal.inFocusDisplaying(0);
OneSignal.inFocusDisplaying(1);
OneSignal.inFocusDisplaying(2);
// $ExpectError
OneSignal.inFocusDisplaying(3);
// $ExpectError
OneSignal.inFocusDisplaying();
});
});
componentDidMount() {
OneSignal.addEventListener('ids', this.onIds);
OneSignal.addEventListener('opened', this._onOpened.bind(this));
OneSignal.inFocusDisplaying(global.inAppNotification);
AppState.addEventListener('change', this._handleAppStateChange);
// Android only: clear notifications (badge count) when user is in app
if (Platform.OS !== 'ios') {
OneSignal.clearOneSignalNotifications();
}
AsyncStorage.getItem('@Discourse.skipLogin').then(json => {
if (json && json === 'loginSkipped') {
this.setState({skipLogin: true});
}
});
this.keyboardDidShowListener = Keyboard.addListener(
'keyboardDidShow',
initPushNotifications(){
console.log('setting up PushNotifications OneSignal SDK');
OneSignal.init(config.ONE_SIGNAL_APP_ID,{kOSSettingsKeyAutoPrompt : true});
OneSignal.inFocusDisplaying(0);
OneSignal.setLocationShared(false);
OneSignal.setExternalUserId(AnalyticsService.uniqueClientId);
}
bindNotificationListeners(){
constructor(props) {
super(props);
this.deviceID = ''
OneSignal.init("df4cae47-cd9d-4dd5-b97f-5f63593f39fb")
OneSignal.inFocusDisplaying(2)
OneSignal.addEventListener('received', this.onReceived);
OneSignal.addEventListener('opened', this.onOpened);
OneSignal.addEventListener('ids', device => {
this.deviceID = device.userId
});
OneSignal.configure();
this.state = {
checked: false,
count: 0,
isLoading: false,
data: [
{
id: '1',
seller: 'grosir.outdoor.shop',
componentDidMount() {
console.log("-------xxxx------ App - componentDidMount ------xxxx-------")
OneSignal.inFocusDisplaying(0)
OneSignal.configure({
onNotificationReceived: function(notification) {
//console.log('NOTIFICATION RECEIVED: ', notification)
if (notification.payload.additionalData.new_message && appStore.current_puid != notification.payload.additionalData.puid) {
console.log(" appStore.new_messages + 1 : " + appStore.current_puid)
appStore.new_messages = appStore.new_messages + 1
}
},
onNotificationOpened: function(openResult) {
console.log(openResult);
console.log('MESSAGE: ', openResult.notification.payload.body)
console.log('CURRENT PUID:' + appStore.current_pui)
console.log('ISACTIVE: ', openResult.notification.isAppInFocus)
console.log('DATA: ', openResult.notification.payload.additionalData)
if (!openResult.notification.isAppInFocus) {
if (openResult.notification.payload.additionalData) {
componentWillMount() {
OneSignal.inFocusDisplaying(2);
OneSignal.addEventListener('ids', this.onIds);
OneSignal.addEventListener('registered', this.onPNRegistered);
OneSignal.addEventListener('received', this.onReceived);
OneSignal.addEventListener('opened', this.onOpened);
this.unsubscribe = store.subscribe(this.onStoreUpdate);
this.unsubscribeCreate = KitsuLibrary.subscribe(KitsuLibraryEvents.LIBRARY_ENTRY_CREATE, this.onLibraryEntryCreated);
this.unsubscribeUpdate = KitsuLibrary.subscribe(KitsuLibraryEvents.LIBRARY_ENTRY_UPDATE, this.onLibraryEntryUpdated);
this.unsubscribeDelete = KitsuLibrary.subscribe(KitsuLibraryEvents.LIBRARY_ENTRY_DELETE, this.onLibraryEntryDeleted);
}