Skip to content

Commit

Permalink
Clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
Guerra24 committed Oct 16, 2021
1 parent f0588d8 commit 4fee281
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 28 deletions.
8 changes: 4 additions & 4 deletions LRReader.Shared/ApiConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static async Task<GenericApiResponse<T>> GetResultInternal<T>(this IRestR
}
catch (Exception e)
{
var properties = new Dictionary<string, string>
/*var properties = new Dictionary<string, string>
{
{ "Path", restResponse.ResponseUri?.PathAndQuery ?? "" },
{ "Code", restResponse.StatusCode.ToString() }
Expand All @@ -125,7 +125,7 @@ public static async Task<GenericApiResponse<T>> GetResultInternal<T>(this IRestR
{
ErrorAttachmentLog.AttachmentWithBinary(json, "input.json.bz2", "application/x-bzip2")
};
Crashes.TrackError(e, properties, attachments); // We are getting bad data from the instance, send stack trace
Crashes.TrackError(e, properties, attachments);*/ // We are getting bad data from the instance, send stack trace
return default;
}
});
Expand Down Expand Up @@ -157,7 +157,7 @@ public static async Task<GenericApiResult> GetError(this IRestResponse restRespo
}
catch (Exception e)
{
var properties = new Dictionary<string, string>
/*var properties = new Dictionary<string, string>
{
{ "Path", restResponse.ResponseUri?.PathAndQuery ?? "" },
{ "Code", restResponse.StatusCode.ToString() }
Expand All @@ -166,7 +166,7 @@ public static async Task<GenericApiResult> GetError(this IRestResponse restRespo
{
ErrorAttachmentLog.AttachmentWithText(restResponse.Content, "error-response.txt")
};
Crashes.TrackError(e, properties, attachments);
Crashes.TrackError(e, properties, attachments);*/
return null;
}
});
Expand Down
15 changes: 15 additions & 0 deletions LRReader.Shared/Internal/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@
using System.Threading;
using System.Threading.Tasks;

namespace LRReader.Shared
{
[AttributeUsage(AttributeTargets.All)]
public class IntAttribute : Attribute
{
public int Value { get; private set; }

public IntAttribute(int value)
{
this.Value = value;
}

}
}

namespace LRReader.Shared.Internal
{
internal static class Util
Expand Down
6 changes: 3 additions & 3 deletions LRReader.Shared/Providers/ArchivesProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public static async Task<bool> Validate()
if (r.StatusCode != HttpStatusCode.OK)
return false;

var decoded = GetArchives();

return decoded != null;
//var decoded = GetArchives();
//return decoded != null;
return true;
}

public static async Task<List<Archive>> GetArchives()
Expand Down
6 changes: 3 additions & 3 deletions LRReader.Shared/Providers/CategoriesProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public static async Task<bool> Validate()
if (r.StatusCode != HttpStatusCode.OK)
return false;

var decoded = GetCategories();

return decoded != null;
//var decoded = GetCategories();
//return decoded != null;
return true;
}

public static async Task<List<Category>> GetCategories()
Expand Down
6 changes: 3 additions & 3 deletions LRReader.Shared/Providers/DatabaseProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public static async Task<bool> Validate()
if (r.StatusCode != HttpStatusCode.OK)
return false;

var decoded = GetTagStats();

return decoded != null;
//var decoded = GetTagStats();
//return decoded != null;
return true;
}

public static async Task<List<TagStats>> GetTagStats()
Expand Down
7 changes: 6 additions & 1 deletion LRReader.Shared/Services/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,11 @@ public enum AppTheme
}
public enum TagsPopupLocation
{
Top, Middle, Bottom
[Int(12)]
Top,
[Int(3)]
Middle,
[Int(11)]
Bottom
}
}
18 changes: 4 additions & 14 deletions LRReader.UWP/Views/Items/GenericArchiveItem.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using LRReader.Shared.Models.Main;
using LRReader.Shared;
using LRReader.Shared.Models.Main;
using LRReader.Shared.Services;
using LRReader.Shared.ViewModels.Items;
using LRReader.UWP.Extensions;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
using Windows.ApplicationModel.Resources;
using Windows.Devices.Input;
Expand Down Expand Up @@ -189,19 +191,7 @@ public async void TagsGrid_PointerEntered(object sender, PointerRoutedEventArgs
if (_open && !TagsFlyout.IsOpen)
{
_open = false;
FlyoutPlacementMode placement = FlyoutPlacementMode.Auto;
switch (Service.Settings.TagsPopup)
{
case TagsPopupLocation.Top:
placement = FlyoutPlacementMode.RightEdgeAlignedBottom;
break;
case TagsPopupLocation.Middle:
placement = FlyoutPlacementMode.Right;
break;
case TagsPopupLocation.Bottom:
placement = FlyoutPlacementMode.RightEdgeAlignedTop;
break;
}
var placement = (FlyoutPlacementMode)typeof(TagsPopupLocation).GetMember(Service.Settings.TagsPopup.ToString())[0].GetCustomAttribute<IntAttribute>(false).Value;
TagsFlyout.ShowAt(TagsGrid, new FlyoutShowOptions
{
Position = e.GetCurrentPoint(TagsGrid).Position,
Expand Down

0 comments on commit 4fee281

Please sign in to comment.