From bd5b51c62f2b5c74b68bddef8c30749b818e1cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Kaan=20K=C3=B6se?= Date: Sat, 22 Feb 2025 17:51:38 +0100 Subject: [PATCH] Added capability to detect disabled gmail service for Google Workspace accounts during account creation. (#580) --- .../Exceptions/GmailServiceDisabledException.cs | 3 +++ Wino.Core.Domain/Translations/en_US/resources.json | 2 ++ Wino.Core/Synchronizers/GmailSynchronizer.cs | 14 +++++++++++++- Wino.Mail.ViewModels/AccountManagementViewModel.cs | 13 +++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 Wino.Core.Domain/Exceptions/GmailServiceDisabledException.cs diff --git a/Wino.Core.Domain/Exceptions/GmailServiceDisabledException.cs b/Wino.Core.Domain/Exceptions/GmailServiceDisabledException.cs new file mode 100644 index 00000000..7ff28a47 --- /dev/null +++ b/Wino.Core.Domain/Exceptions/GmailServiceDisabledException.cs @@ -0,0 +1,3 @@ +namespace Wino.Core.Domain.Exceptions; + +public class GmailServiceDisabledException : System.Exception { } diff --git a/Wino.Core.Domain/Translations/en_US/resources.json b/Wino.Core.Domain/Translations/en_US/resources.json index f5c9a24b..243151c0 100644 --- a/Wino.Core.Domain/Translations/en_US/resources.json +++ b/Wino.Core.Domain/Translations/en_US/resources.json @@ -214,6 +214,8 @@ "GeneralTitle_Error": "Error", "GeneralTitle_Info": "Information", "GeneralTitle_Warning": "Warning", + "GmailServiceDisabled_Title": "Gmail Error", + "GmailServiceDisabled_Message": "Your Google Workspace account seems to be disabled for Gmail service. Please contact your administrator to enable Gmail service for your account.", "HoverActionOption_Archive": "Archive", "HoverActionOption_Delete": "Delete", "HoverActionOption_MoveJunk": "Move to Junk", diff --git a/Wino.Core/Synchronizers/GmailSynchronizer.cs b/Wino.Core/Synchronizers/GmailSynchronizer.cs index 9ede3831..29ed5063 100644 --- a/Wino.Core/Synchronizers/GmailSynchronizer.cs +++ b/Wino.Core/Synchronizers/GmailSynchronizer.cs @@ -5,6 +5,7 @@ using System.Net.Http; using System.Threading; using System.Threading.Tasks; using CommunityToolkit.Mvvm.Messaging; +using Google; using Google.Apis.Calendar.v3.Data; using Google.Apis.Gmail.v1; using Google.Apis.Gmail.v1.Data; @@ -120,7 +121,18 @@ public class GmailSynchronizer : WinoSynchronizer