fix issue
This commit is contained in:
parent
5b209cc19c
commit
8ba6f4bf85
@ -85,7 +85,7 @@ namespace Billing
|
|||||||
|
|
||||||
public static bool OpenUrl(Uri uri)
|
public static bool OpenUrl(Uri uri)
|
||||||
{
|
{
|
||||||
if (uri == null)
|
if (uri == null || !uri.IsFile)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ namespace Billing
|
|||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
var result = await StoreHelper.ReloadDatabase(url);
|
var result = await StoreHelper.ReloadDatabase(url);
|
||||||
//if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
await InitializeData();
|
await InitializeData();
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ namespace Billing.Store
|
|||||||
public static string DatabasePath => Path.Combine(PersonalFolder, dbfile);
|
public static string DatabasePath => Path.Combine(PersonalFolder, dbfile);
|
||||||
|
|
||||||
#region Sqlite3
|
#region Sqlite3
|
||||||
private const string dbfile = "data.db3";
|
private const string dbfile = ".master.db3";
|
||||||
private static SQLiteAsyncConnection database;
|
private static SQLiteAsyncConnection database;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -42,6 +42,7 @@ namespace Billing.Store
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.Copy(file, path, true);
|
File.Copy(file, path, true);
|
||||||
|
File.Delete(file);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -167,8 +168,16 @@ namespace Billing.Store
|
|||||||
public static async Task<int> GetLogsCount()
|
public static async Task<int> GetLogsCount()
|
||||||
{
|
{
|
||||||
await Instance;
|
await Instance;
|
||||||
|
try
|
||||||
|
{
|
||||||
return await database.ExecuteScalarAsync<int>("SELECT COUNT(Id) FROM [Logs]");
|
return await database.ExecuteScalarAsync<int>("SELECT COUNT(Id) FROM [Logs]");
|
||||||
}
|
}
|
||||||
|
catch (SQLiteException)
|
||||||
|
{
|
||||||
|
await database.CreateTableAsync<Logs>();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
public static async Task<int> SaveLogItemAsync(Logs log)
|
public static async Task<int> SaveLogItemAsync(Logs log)
|
||||||
{
|
{
|
||||||
var instance = await Instance;
|
var instance = await Instance;
|
||||||
|
@ -50,6 +50,17 @@ namespace Billing.Views
|
|||||||
groupLayout.Refresh(accounts);
|
groupLayout.Refresh(accounts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnRefresh()
|
||||||
|
{
|
||||||
|
accounts.Clear();
|
||||||
|
foreach (var account in App.Accounts)
|
||||||
|
{
|
||||||
|
AddToAccountGroup(account);
|
||||||
|
}
|
||||||
|
RefreshBalance(true);
|
||||||
|
groupLayout.Refresh(accounts);
|
||||||
|
}
|
||||||
|
|
||||||
private void RefreshBalance(bool calc = false)
|
private void RefreshBalance(bool calc = false)
|
||||||
{
|
{
|
||||||
if (calc)
|
if (calc)
|
||||||
|
@ -60,19 +60,23 @@ namespace Billing.Views
|
|||||||
billingDate.SetDateTime(DateTime.Today);
|
billingDate.SetDateTime(DateTime.Today);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDateSelected(object sender, DateEventArgs e)
|
protected override void OnRefresh()
|
||||||
{
|
{
|
||||||
SelectedDate = e.Date;
|
|
||||||
|
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
var bills = App.Bills.Where(b => Helper.IsSameDay(b.CreateTime, e.Date));
|
var bills = App.Bills.Where(b => Helper.IsSameDay(b.CreateTime, SelectedDate));
|
||||||
Bills = new List<UIBill>(bills.OrderBy(b => b.CreateTime).Select(b => Helper.WrapBill(b)));
|
Bills = new List<UIBill>(bills.OrderBy(b => b.CreateTime).Select(b => Helper.WrapBill(b)));
|
||||||
RefreshBalance(Bills);
|
RefreshBalance(Bills);
|
||||||
MainThread.BeginInvokeOnMainThread(async () => await scrollView.ScrollToAsync(0, 0, true));
|
MainThread.BeginInvokeOnMainThread(async () => await scrollView.ScrollToAsync(0, 0, true));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnDateSelected(object sender, DateEventArgs e)
|
||||||
|
{
|
||||||
|
SelectedDate = e.Date;
|
||||||
|
OnRefresh();
|
||||||
|
}
|
||||||
|
|
||||||
private void RefreshBalance(List<UIBill> bills)
|
private void RefreshBalance(List<UIBill> bills)
|
||||||
{
|
{
|
||||||
SetValue(NoBillsProperty, bills.Count == 0);
|
SetValue(NoBillsProperty, bills.Count == 0);
|
||||||
|
@ -229,6 +229,11 @@ namespace Billing.Views
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnRefresh()
|
||||||
|
{
|
||||||
|
OnDateChanged(this);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnDateTypeCommand(DateType index)
|
private void OnDateTypeCommand(DateType index)
|
||||||
{
|
{
|
||||||
if (index < DateType.Monthly || index > DateType.Total)
|
if (index < DateType.Monthly || index > DateType.Total)
|
||||||
|
@ -59,6 +59,12 @@ namespace Billing.Views
|
|||||||
//Light.Instance.RefreshColor(Color.FromHex(color));
|
//Light.Instance.RefreshColor(Color.FromHex(color));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override async void OnRefresh()
|
||||||
|
{
|
||||||
|
var count = await StoreHelper.GetLogsCount();
|
||||||
|
SetValue(ManyRecordsProperty, string.Format(Resource.ManyRecords, count));
|
||||||
|
}
|
||||||
|
|
||||||
private async void OnShareCommand()
|
private async void OnShareCommand()
|
||||||
{
|
{
|
||||||
if (Tap.IsBusy)
|
if (Tap.IsBusy)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using Foundation;
|
using Foundation;
|
||||||
using UIKit;
|
using UIKit;
|
||||||
using Xamarin.Essentials;
|
|
||||||
|
|
||||||
namespace Billing.iOS
|
namespace Billing.iOS
|
||||||
{
|
{
|
||||||
|
@ -45,9 +45,10 @@
|
|||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleTypeName</key>
|
<key>CFBundleTypeName</key>
|
||||||
<string>Master SQLite file</string>
|
<string>SQLite Database</string>
|
||||||
<key>LSItemContentTypes</key>
|
<key>LSItemContentTypes</key>
|
||||||
<array>
|
<array>
|
||||||
|
<string>org.tsanie.billing.db3</string>
|
||||||
<string>public.database</string>
|
<string>public.database</string>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleTypeIconFiles</key>
|
<key>CFBundleTypeIconFiles</key>
|
||||||
@ -55,18 +56,40 @@
|
|||||||
<string>Assets.xcassets/AppIcon.appiconset/Icon180</string>
|
<string>Assets.xcassets/AppIcon.appiconset/Icon180</string>
|
||||||
</array>
|
</array>
|
||||||
<key>LSHandlerRank</key>
|
<key>LSHandlerRank</key>
|
||||||
<string>Default</string>
|
<string>Alternate</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>UTExportedTypeDeclarations</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>UTTypeConformsTo</key>
|
||||||
|
<array>
|
||||||
|
<string>public.data</string>
|
||||||
|
</array>
|
||||||
|
<key>UTTypeDescription</key>
|
||||||
|
<string>SQLite Database</string>
|
||||||
|
<key>UTTypeIdentifier</key>
|
||||||
|
<string>org.tsanie.billing.db3</string>
|
||||||
|
<key>UTTypeTagSpecification</key>
|
||||||
|
<dict>
|
||||||
|
<key>public.filename-extension</key>
|
||||||
|
<string>db3</string>
|
||||||
|
<key>public.mime-type</key>
|
||||||
|
<string>application/vnd.sqlite3</string>
|
||||||
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>13</string>
|
<string>13</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.1.315</string>
|
<string>1.1.315</string>
|
||||||
<key>LSSupportsOpeningDocumentsInPlace</key>
|
|
||||||
<true/>
|
|
||||||
<key>LSApplicationQueriesSchemes</key>
|
<key>LSApplicationQueriesSchemes</key>
|
||||||
<array>
|
<array>
|
||||||
<string>mailto</string>
|
<string>mailto</string>
|
||||||
</array>
|
</array>
|
||||||
|
<key>UIFileSharingEnabled</key>
|
||||||
|
<true/>
|
||||||
|
<key>LSSupportsOpeningDocumentsInPlace</key>
|
||||||
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user