release new version

This commit is contained in:
2022-03-17 21:34:26 +08:00
parent ef5e91aad1
commit 5cbcfbcd56
7 changed files with 41 additions and 12 deletions

View File

@@ -14,7 +14,6 @@ namespace Billing
public class App : Application
{
internal const string NewBillAction = "/newbill";
private const string SaveLocationKey = nameof(SaveLocationKey);
public static AppTheme CurrentTheme { get; private set; }
public static PlatformCulture CurrentCulture { get; private set; }
@@ -35,8 +34,10 @@ namespace Billing
public App(string url = null)
{
if (url == NewBillAction)
{
mainRoute = "//Bills/Details";
{
#if __ANDROID__
mainRoute = "//Bills/Details";
#endif
}
else
{
@@ -44,6 +45,7 @@ namespace Billing
initialUrl = url;
}
CurrentCulture = new PlatformCulture();
saveLocation = Preferences.Get(Definition.SaveLocationKey, false);
InitResources();
MainPage = new MainShell();
@@ -101,7 +103,6 @@ namespace Billing
public static void SetSaveLocation(bool flag)
{
saveLocation = flag;
Preferences.Set(SaveLocationKey, flag);
}
public static async Task InitializeData()
@@ -113,7 +114,11 @@ namespace Billing
Task.Run(async () => bills = await instance.GetListAsync<Bill>()));
}
#if __ANDROID
public static async Task<bool> OpenUrl(string url)
#elif __IOS__
public static bool OpenUrl(string url)
#endif
{
if (string.IsNullOrEmpty(url))
{
@@ -121,11 +126,13 @@ namespace Billing
}
if (File.Exists(url))
{
#if __ANDROID__
var status = await Helper.CheckAndRequestPermissionAsync<Permissions.StorageRead>();
if (status != PermissionStatus.Granted)
{
return false;
}
#endif
_ = Task.Run(async () =>
{
var result = await StoreHelper.ReloadDatabase(url);

View File

@@ -12,9 +12,12 @@ namespace Billing
protected override async void OnLoaded()
{
await App.InitializeData();
if (!string.IsNullOrEmpty(App.MainRoute))
{
await App.InitializeData();
await Shell.Current.GoToAsync(App.MainRoute);
await Shell.Current.GoToAsync(App.MainRoute);
}
}
}
}

View File

@@ -7,6 +7,7 @@ namespace Billing.UI
{
public static partial class Definition
{
public const string SaveLocationKey = "SaveLocationKey";
public const string PrimaryColorKey = "PrimaryColor";
public const string DefaultIcon = "ic_default";
public const long TransparentColor = 0x00ffffffL;

View File

@@ -61,6 +61,7 @@ namespace Billing.Views
base.OnDisappearing();
App.SetSaveLocation(SaveLocation);
Preferences.Set(Definition.SaveLocationKey, SaveLocation);
Preferences.Set(Definition.PrimaryColorKey, PrimaryColor);
}