Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notify user that notifications are disabled #55

Open
github-actions bot opened this issue Nov 12, 2023 · 0 comments
Open

Notify user that notifications are disabled #55

github-actions bot opened this issue Nov 12, 2023 · 0 comments
Labels

Comments

@github-actions
Copy link

DEBUG _notification.ScheduleNotification(item.Id, title, text, DateOnly.FromDateTime(DateTime.Now), TimeOnly.FromDateTime(DateTime.Now.AddSeconds(15)));

private bool _isPaid;

https://github.com/morning4coffe-dev/project-sbs/blob/9a2eec10171dac3e8db9caf9a97eac6b19563151/ProjectSBS/ProjectSBS/Presentation/Components/ItemViewModel.cs#L90

        return _billingService.GetFuturePayments(billing.InitialDate, billing.PeriodType, billing.RecurEvery, numberOfPayments);
    }

    public void Updated()
    {
        ScheduleBilling();
    }

    public async void ScheduleBilling()
    {
        if (Item is not { } item || !Item.IsNotify)
        {
            return;
        }

        _notification.RemoveScheduledNotifications();

        if (!_notification.IsEnabledOnDevice())
        {
            //TODO Notify user that notifications are disabled
            return;
        }

#if !HAS_UNO
        var paymentDates = GetFuturePayments();

        var tasks = paymentDates.Select(date =>
        Task.Run(() =>
        {
            var title = item.Name ?? "";
            //(≈{2})
            var text = string.Format("Your {0}{1} payment for {2} is due tomorrow!", item.Billing.BasePrice, item.Billing.CurrencyId, item.Name);

            //- time period before e.g. one day, time that user selected
            //DEBUG _notification.ScheduleNotification(item.Id, title, text, DateOnly.FromDateTime(DateTime.Now), TimeOnly.FromDateTime(DateTime.Now.AddSeconds(15)));
            _notification.ScheduleNotification(item.Id, title, text, date.AddDays(-1), new TimeOnly(8, 00));
        })).ToArray();

        await Task.WhenAll(tasks);
#endif
    }

    #region FEAT: feature/IndividualPayments
    //[ObservableProperty]
    //private bool _isPaid;
@github-actions github-actions bot added the todo label Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants