Add download button in dialog when app outdated
This commit is contained in:
parent
113a3d8876
commit
db1b58e499
|
@ -1,4 +1,5 @@
|
|||
using Http.Core.Contexts;
|
||||
using Http.Core.Exceptions;
|
||||
using PCUT.Entities;
|
||||
using PCUT.Entities.ApiResponse;
|
||||
using System;
|
||||
|
@ -28,7 +29,7 @@ namespace Http.Core.Extensions
|
|||
return permittedCategories;
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
}
|
||||
return Enumerable.Empty<Category>();
|
||||
|
|
|
@ -9,6 +9,8 @@ using Newtonsoft.Json;
|
|||
using Newtonsoft.Json.Serialization;
|
||||
using PCUT.Entities.ApiResponse;
|
||||
using PCUT.Entities;
|
||||
using Http.Core.Exceptions;
|
||||
using System;
|
||||
|
||||
namespace Http.Core.Extensions
|
||||
{
|
||||
|
@ -68,7 +70,7 @@ namespace Http.Core.Extensions
|
|||
response.EnsureSuccessStatusCode();
|
||||
await response.Content.CopyToAsync(outputStream);
|
||||
}
|
||||
catch
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
isSuccess = false;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using Http.Core.Constants;
|
||||
using Http.Core.Contexts;
|
||||
using Http.Core.Exceptions;
|
||||
using Http.Core.Extensions;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
|
@ -60,7 +61,7 @@ namespace Http.Core.Handlers
|
|||
return await client.RefreshTokenAsync();
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException)) { }
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,7 +135,17 @@ namespace PCUT
|
|||
if (e.Exception is AppOutdatedException outdatedException)
|
||||
{
|
||||
e.Handled = true;
|
||||
await new MessageDialog(outdatedException.Message, "App Outdated!").ShowAsync();
|
||||
var dialog = new MessageDialog(outdatedException.Message);
|
||||
dialog.Commands.Add(new UICommand("Download", async (command) =>
|
||||
{
|
||||
var _ = await Windows.System.Launcher.LaunchUriAsync(
|
||||
new Uri("https://pcut.vn/download"),
|
||||
new Windows.System.LauncherOptions { TreatAsUntrusted = false });
|
||||
}));
|
||||
dialog.Commands.Add(new UICommand("Close"));
|
||||
dialog.DefaultCommandIndex = 0;
|
||||
dialog.CancelCommandIndex = 1;
|
||||
await dialog.ShowAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using Http.Core;
|
||||
using Http.Core.Exceptions;
|
||||
using Http.Core.Extensions;
|
||||
using PCUT.Extensions;
|
||||
using Windows.Security.Cryptography.Certificates;
|
||||
|
@ -102,7 +103,7 @@ namespace PCUT.Factories
|
|||
stream.Dispose();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<Identity
|
||||
Name="ac171214-3336-4e02-845d-9bdc107cce71"
|
||||
Publisher="CN=pcut, O=PCUT, L=HN, S=HN, C=VN"
|
||||
Version="1.3.4.8" />
|
||||
Version="1.3.4.10" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="ac171214-3336-4e02-845d-9bdc107cce71" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ using PCUT.Models.Categories;
|
|||
using System.Linq;
|
||||
using Windows.UI.Popups;
|
||||
using System.Reflection;
|
||||
using Http.Core.Exceptions;
|
||||
|
||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
|
@ -108,7 +109,7 @@ namespace PCUT.Pages
|
|||
await ShowDialog("Error!", "Cant delete category");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
await ShowDialog("Error!", $"Got exception: {ex.Message}");
|
||||
}
|
||||
|
@ -218,7 +219,7 @@ namespace PCUT.Pages
|
|||
await messegaDialog.ShowAsync();
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ using static PCUT.App;
|
|||
using Windows.UI.Core;
|
||||
using System.Threading;
|
||||
using PCUT.Models;
|
||||
using Http.Core.Exceptions;
|
||||
|
||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
|
@ -174,7 +175,7 @@ namespace PCUT.Pages
|
|||
await ShowDialog("Error!", "Cant delete file");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
await ShowDialog("Error!", $"Got exception: {ex.Message}");
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ using Windows.UI.Xaml.Navigation;
|
|||
using Http.Core;
|
||||
using Http.Core.Extensions;
|
||||
using static Http.Core.Constants.HttpConstants;
|
||||
using Http.Core.Exceptions;
|
||||
|
||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
|
@ -107,7 +108,7 @@ namespace PCUT.Pages
|
|||
await ShowDialog("Error!", "Cant delete user");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
await ShowDialog("Error!", $"Got exception: {ex.Message}");
|
||||
}
|
||||
|
@ -132,7 +133,7 @@ namespace PCUT.Pages
|
|||
await ShowDialog("Error!", "Failed to unlock user's device");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
await ShowDialog("Error!", $"Got exception: {ex.Message}");
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ using static Http.Core.Constants.HttpConstants;
|
|||
using PCUT.Entities.ApiResponse;
|
||||
using PCUT.Models.Categories;
|
||||
using Windows.ApplicationModel.Core;
|
||||
using Http.Core.Exceptions;
|
||||
|
||||
namespace PCUT.ViewModels
|
||||
{
|
||||
|
@ -70,7 +71,7 @@ namespace PCUT.ViewModels
|
|||
FilteredCategories.Load(categories);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -104,7 +105,7 @@ namespace PCUT.ViewModels
|
|||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ using Http.Core.Extensions;
|
|||
using static Http.Core.Constants.HttpConstants;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using PCUT.Models.Users;
|
||||
using Http.Core.Exceptions;
|
||||
|
||||
namespace PCUT.ViewModels
|
||||
{
|
||||
|
@ -102,7 +103,7 @@ namespace PCUT.ViewModels
|
|||
};
|
||||
await ChangePasswordAsync(UserId, passwordChange);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
var failDialog = new MessageDialog(ex.Message.ToString());
|
||||
await failDialog.ShowAsync();
|
||||
|
@ -120,7 +121,7 @@ namespace PCUT.ViewModels
|
|||
};
|
||||
await ChangePasswordAsync(UserId, passwordChange);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
var failDialog = new MessageDialog(ex.Message.ToString());
|
||||
await failDialog.ShowAsync();
|
||||
|
@ -145,7 +146,7 @@ namespace PCUT.ViewModels
|
|||
await failDialog.ShowAsync();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
var errorDialog = new MessageDialog($"error: {ex.Message}");
|
||||
await errorDialog.ShowAsync();
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Http.Core;
|
||||
using Http.Core.Exceptions;
|
||||
using Http.Core.Extensions;
|
||||
using Newtonsoft.Json;
|
||||
using PCUT.Entities;
|
||||
|
@ -162,7 +163,7 @@ namespace PCUT.ViewModels
|
|||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ using Http.Core;
|
|||
using Http.Core.Extensions;
|
||||
using static Http.Core.Constants.HttpConstants;
|
||||
using PCUT.Entities.ApiResponse;
|
||||
using Http.Core.Exceptions;
|
||||
|
||||
namespace PCUT.ViewModels
|
||||
{
|
||||
|
@ -137,7 +138,7 @@ namespace PCUT.ViewModels
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
var errorDialog = new MessageDialog($"Error: {ex.Message}");
|
||||
await errorDialog.ShowAsync();
|
||||
|
@ -176,7 +177,7 @@ namespace PCUT.ViewModels
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
var exceptionDialog = new MessageDialog($"Error: {ex.Message}");
|
||||
await exceptionDialog.ShowAsync();
|
||||
|
|
|
@ -26,6 +26,7 @@ using static Http.Core.Constants.HttpConstants;
|
|||
using Windows.Graphics.Imaging;
|
||||
using Windows.UI.Xaml.Media.Imaging;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Http.Core.Exceptions;
|
||||
|
||||
namespace PCUT.ViewModels
|
||||
{
|
||||
|
@ -116,7 +117,7 @@ namespace PCUT.ViewModels
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +200,7 @@ namespace PCUT.ViewModels
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
var errorDialog = new MessageDialog($"Error: {ex.Message}");
|
||||
await errorDialog.ShowAsync();
|
||||
|
@ -238,7 +239,7 @@ namespace PCUT.ViewModels
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
var exceptionDialog = new MessageDialog($"Error: {ex.Message}");
|
||||
await exceptionDialog.ShowAsync();
|
||||
|
|
|
@ -19,6 +19,7 @@ using Http.Core.Extensions;
|
|||
using static Http.Core.Constants.HttpConstants;
|
||||
using System.ComponentModel;
|
||||
using Windows.ApplicationModel.Core;
|
||||
using Http.Core.Exceptions;
|
||||
|
||||
namespace PCUT.ViewModels
|
||||
{
|
||||
|
@ -168,7 +169,7 @@ namespace PCUT.ViewModels
|
|||
FilteredFiles.Load(files);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Http.Core;
|
||||
using Http.Core.Exceptions;
|
||||
using Http.Core.Extensions;
|
||||
using PCUT.Entities;
|
||||
using PCUT.Entities.ApiResponse;
|
||||
|
@ -48,7 +49,7 @@ namespace PCUT.ViewModels
|
|||
Users.Load(data);
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +84,7 @@ namespace PCUT.ViewModels
|
|||
Logs.Add(log);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using Http.Core;
|
||||
using Http.Core.Contexts;
|
||||
using Http.Core.Exceptions;
|
||||
using Http.Core.Extensions;
|
||||
using Http.Core.Models;
|
||||
using PCUT.Extensions;
|
||||
|
@ -96,7 +97,7 @@ namespace PCUT.ViewModels
|
|||
if (!loginSuccess)
|
||||
errorMessage = loginResult.Message;
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
errorMessage = ex.Message;
|
||||
}
|
||||
|
@ -114,7 +115,7 @@ namespace PCUT.ViewModels
|
|||
{
|
||||
await client.LoadUserProfileAsync();
|
||||
}
|
||||
catch { }
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException)) { }
|
||||
}
|
||||
|
||||
if (RememberMe)
|
||||
|
|
|
@ -10,6 +10,7 @@ using System.Threading.Tasks;
|
|||
using Http.Core.Extensions;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using static Http.Core.Constants.HttpConstants;
|
||||
using Http.Core.Exceptions;
|
||||
|
||||
namespace PCUT.ViewModels
|
||||
{
|
||||
|
@ -194,7 +195,7 @@ namespace PCUT.ViewModels
|
|||
return content.Data;
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ using PCUT.Models;
|
|||
using PCUT.Helpers;
|
||||
using System.Windows.Input;
|
||||
using PCUT.Entities.ApiResponse;
|
||||
using Http.Core.Exceptions;
|
||||
|
||||
namespace PCUT.ViewModels
|
||||
{
|
||||
|
@ -63,7 +64,7 @@ namespace PCUT.ViewModels
|
|||
Description = categoryData.Data.Description;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException)) { }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +97,7 @@ namespace PCUT.ViewModels
|
|||
else
|
||||
return "Failed to add the category!";
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
return $"error: {ex.Message}";
|
||||
}
|
||||
|
@ -117,7 +118,7 @@ namespace PCUT.ViewModels
|
|||
else
|
||||
return "Failed to edit the category!";
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
return $"error: {ex.Message}";
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ using PCUT.Models.Categories;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using Http.Core.Exceptions;
|
||||
|
||||
namespace PCUT.ViewModels
|
||||
{
|
||||
|
@ -72,7 +73,7 @@ namespace PCUT.ViewModels
|
|||
var response = await client.PostAsJsonAsync(Api.Metadata, request);
|
||||
return response.IsSuccessStatusCode ? "Metadata added successfully!" : "Failed to add the metadata!";
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
return $"error: {ex.Message}";
|
||||
}
|
||||
|
@ -89,7 +90,7 @@ namespace PCUT.ViewModels
|
|||
var response = await client.PutAsJsonAsync(Api.MetadataById.FormatRoute(Id), request);
|
||||
return response.IsSuccessStatusCode ? "Metadata edited successfully!" : "Failed to edit the metadata!";
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
return $"error: {ex.Message}";
|
||||
}
|
||||
|
@ -113,7 +114,7 @@ namespace PCUT.ViewModels
|
|||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException)) { }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ using Windows.UI.Xaml.Controls;
|
|||
using Windows.UI.Xaml;
|
||||
using System.ComponentModel;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Http.Core.Exceptions;
|
||||
|
||||
namespace PCUT.ViewModels
|
||||
{
|
||||
|
@ -209,7 +210,7 @@ namespace PCUT.ViewModels
|
|||
Description = _profile.Description;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -286,7 +287,7 @@ namespace PCUT.ViewModels
|
|||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
await ShowDialogAsync(ex.Message);
|
||||
return false;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Http.Core;
|
||||
using Http.Core.Exceptions;
|
||||
using Http.Core.Extensions;
|
||||
using PCUT.Entities.ApiResponse;
|
||||
using PCUT.Extensions;
|
||||
|
@ -71,7 +72,7 @@ namespace PCUT.ViewModels
|
|||
FilteredUsers.Load(users);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (!(ex is AppOutdatedException))
|
||||
{
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue