Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

Commit

Permalink
#295 Handle failure in agreeing to Tumblr privacy consent
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneszab committed Dec 6, 2018
1 parent 1aebd2e commit 5aed0a9
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@
<data name="Body" xml:space="preserve">
<value>Body: {0]</value>
</data>
<data name="ConfirmingTumblrPrivacyConsentFailed" xml:space="preserve">
<value>Confirming the Tumblr privacy consent failed. There might a connection issue.</value>
</data>
<data name="Conversation" xml:space="preserve">
<value>Conversation: {0}</value>
</data>
Expand Down Expand Up @@ -342,7 +345,7 @@
<value>Text file</value>
</data>
<data name="TimeoutReached" xml:space="preserve">
<value>A connection timout occured during {0} of {1}.</value>
<value>A connection timeout occured during {0} of {1}.</value>
</data>
<data name="Title" xml:space="preserve">
<value>Title: {0}</value>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Globalization;
using System.Net;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

using TumblThree.Applications.Properties;
using TumblThree.Domain;

namespace TumblThree.Applications.Services
{
[Export(typeof(IConfirmTumblrPrivacyConsent)), Export]
Expand All @@ -25,6 +29,27 @@ public ConfirmTumblrPrivacyConsent(IShellService shellService, ISharedCookieServ
}

public async Task ConfirmPrivacyConsentAsync()
{
try
{
await PerformPrivacyConsentRequestAsync();
}
catch (TimeoutException timeoutException)
{
const string message = "confirming the Tumblr privacy consent";
Logger.Error("{0}, {1}", string.Format(CultureInfo.CurrentCulture, Resources.TimeoutReached, message),
timeoutException);
shellService.ShowError(timeoutException, Resources.TimeoutReached, message);
}
catch (Exception exception)
{
Logger.Error("{0}, {1}", string.Format(CultureInfo.CurrentCulture, Resources.ConfirmingTumblrPrivacyConsentFailed),
exception);
shellService.ShowError(exception, Resources.ConfirmingTumblrPrivacyConsentFailed);
}
}

private async Task PerformPrivacyConsentRequestAsync()
{
if (CheckIfLoggedInAsync())
return;
Expand Down

0 comments on commit 5aed0a9

Please sign in to comment.