Add capability-first account and calendar setup flow
This commit is contained in:
@@ -105,6 +105,9 @@ public partial class AccountCalendarStateService : ObservableRecipient,
|
||||
{
|
||||
lock (_calendarStateLock)
|
||||
{
|
||||
if (!GroupedAccountCalendarViewModel.SupportsCalendar(groupedAccountCalendar.Account))
|
||||
return;
|
||||
|
||||
groupedAccountCalendar.CalendarSelectionStateChanged += SingleCalendarSelectionStateChanged;
|
||||
groupedAccountCalendar.CollectiveSelectionStateChanged += SingleGroupCalendarCollectiveStateChanged;
|
||||
try
|
||||
@@ -180,6 +183,9 @@ public partial class AccountCalendarStateService : ObservableRecipient,
|
||||
{
|
||||
lock (_calendarStateLock)
|
||||
{
|
||||
if (!GroupedAccountCalendarViewModel.SupportsCalendar(accountCalendar.Account))
|
||||
return;
|
||||
|
||||
// Find the group that this calendar belongs to.
|
||||
var group = _internalGroupedAccountCalendars.FirstOrDefault(g => g.Account.Id == accountCalendar.Account.Id);
|
||||
|
||||
@@ -396,6 +402,16 @@ public partial class AccountCalendarStateService : ObservableRecipient,
|
||||
lock (_calendarStateLock)
|
||||
{
|
||||
groupedAccount = _internalGroupedAccountCalendars.FirstOrDefault(a => a.Account.Id == updatedAccount.Id);
|
||||
|
||||
if (!GroupedAccountCalendarViewModel.SupportsCalendar(updatedAccount))
|
||||
{
|
||||
if (groupedAccount != null)
|
||||
{
|
||||
RemoveGroupedAccountCalendar(groupedAccount);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
groupedAccount?.UpdateAccount(updatedAccount);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
|
||||
namespace Wino.Services;
|
||||
@@ -6,35 +7,73 @@ public class MailAuthenticatorConfiguration : IAuthenticatorConfig
|
||||
{
|
||||
public string OutlookAuthenticatorClientId => "b19c2035-d740-49ff-b297-de6ec561b208";
|
||||
|
||||
public string[] OutlookScope =>
|
||||
[
|
||||
"email",
|
||||
"mail.readwrite",
|
||||
"offline_access",
|
||||
"mail.send",
|
||||
"Mail.Send.Shared",
|
||||
"Mail.ReadWrite.Shared",
|
||||
"User.Read",
|
||||
"Calendars.ReadBasic",
|
||||
"Calendars.ReadWrite",
|
||||
"Calendars.ReadWrite.Shared",
|
||||
"Calendars.Read",
|
||||
"Calendars.Read.Shared",
|
||||
];
|
||||
|
||||
public string GmailAuthenticatorClientId => "973025879644-s7b4ur9p3rlgop6a22u7iuptdc0brnrn.apps.googleusercontent.com";
|
||||
|
||||
public string[] GmailScope =>
|
||||
[
|
||||
"https://mail.google.com/",
|
||||
"https://www.googleapis.com/auth/userinfo.profile",
|
||||
"https://www.googleapis.com/auth/gmail.labels",
|
||||
"https://www.googleapis.com/auth/userinfo.email",
|
||||
"https://www.googleapis.com/auth/calendar",
|
||||
"https://www.googleapis.com/auth/calendar.events",
|
||||
"https://www.googleapis.com/auth/calendar.settings.readonly",
|
||||
"https://www.googleapis.com/auth/drive.file",
|
||||
];
|
||||
|
||||
public string GmailTokenStoreIdentifier => "WinoMailGmailTokenStore";
|
||||
|
||||
public string[] GetOutlookScope(bool isMailAccessGranted, bool isCalendarAccessGranted)
|
||||
{
|
||||
var scopes = new List<string>
|
||||
{
|
||||
"email",
|
||||
"offline_access",
|
||||
"User.Read"
|
||||
};
|
||||
|
||||
if (isMailAccessGranted)
|
||||
{
|
||||
scopes.AddRange(
|
||||
[
|
||||
"mail.readwrite",
|
||||
"mail.send",
|
||||
"Mail.Send.Shared",
|
||||
"Mail.ReadWrite.Shared"
|
||||
]);
|
||||
}
|
||||
|
||||
if (isCalendarAccessGranted)
|
||||
{
|
||||
scopes.AddRange(
|
||||
[
|
||||
"Calendars.ReadBasic",
|
||||
"Calendars.ReadWrite",
|
||||
"Calendars.ReadWrite.Shared",
|
||||
"Calendars.Read",
|
||||
"Calendars.Read.Shared"
|
||||
]);
|
||||
}
|
||||
|
||||
return [.. scopes];
|
||||
}
|
||||
|
||||
public string[] GetGmailScope(bool isMailAccessGranted, bool isCalendarAccessGranted)
|
||||
{
|
||||
var scopes = new List<string>
|
||||
{
|
||||
"https://www.googleapis.com/auth/userinfo.profile",
|
||||
"https://www.googleapis.com/auth/userinfo.email"
|
||||
};
|
||||
|
||||
if (isMailAccessGranted)
|
||||
{
|
||||
scopes.AddRange(
|
||||
[
|
||||
"https://mail.google.com/",
|
||||
"https://www.googleapis.com/auth/gmail.labels"
|
||||
]);
|
||||
}
|
||||
|
||||
if (isCalendarAccessGranted)
|
||||
{
|
||||
scopes.AddRange(
|
||||
[
|
||||
"https://www.googleapis.com/auth/calendar",
|
||||
"https://www.googleapis.com/auth/calendar.events",
|
||||
"https://www.googleapis.com/auth/calendar.settings.readonly",
|
||||
"https://www.googleapis.com/auth/drive.file"
|
||||
]);
|
||||
}
|
||||
|
||||
return [.. scopes];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user