emekalites / react-native-alarm-notification

schedule alarm and local notification in react-native
https://www.npmjs.com/package/react-native-alarm-notification
MIT License
225 stars 95 forks source link

Enable the creation of alarms with the same fire date on Android. #141

Closed brunosmarppy closed 3 years ago

brunosmarppy commented 3 years ago

Removed the validation:

        boolean containAlarm = alarmUtil.checkAlarm(getAlarmDB().getAlarmList(1), alarm);
        if (!containAlarm) {
            ...
        } else {
              promise.reject(E_SCHEDULE_ALARM_FAILED, "duplicate alarm set at date");
        }

And the function:

 boolean checkAlarm(ArrayList<AlarmModel> alarms, AlarmModel alarm) {
        boolean contain = false;
        for (AlarmModel aAlarm : alarms) {
            if (aAlarm.getHour() == alarm.getHour()
                    && aAlarm.getMinute() == alarm.getMinute()
                    && aAlarm.getSecond() == alarm.getSecond()
                    && aAlarm.getDay() == alarm.getDay()
                    && aAlarm.getMonth() == alarm.getMonth()
                    && aAlarm.getYear() == alarm.getYear()
                    && aAlarm.getActive() == 1) {
                contain = true;
                break;
            }
        }

        if (contain) {
            Toast.makeText(mContext, "You have already set this Alarm", Toast.LENGTH_SHORT).show();
        }

        return contain;
    }

I altered this because the IOS allows the creation of the same alarm (with the same fire_date). And with this alteration, I can do the same on Android.

stale[bot] commented 3 years ago

Hola! So here's the deal, between open source and my day job and life and what not, I have a lot to manage, so I use a GitHub bot to automate a few things here and there. This particular GitHub bot is going to mark this as stale because it has not had recent activity for a while. It will be closed if no further activity occurs in a few days. Do not take this personally--seriously--this is a completely automated action. If this is a mistake, just make a comment, DM me, send a carrier pidgeon, or a smoke signal.

stale[bot] commented 3 years ago

Closed due to inactivity. Holler if this is a mistake, and we'll re-open it.