Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
e029441
Menu backup commit
ccbrowndev Nov 21, 2023
be9fe96
Fix backup branch
ccbrowndev Nov 26, 2023
ca1e643
List saves even if a new list isn't not added
ccbrowndev Nov 26, 2023
51cffa9
Revert saving list on item add/delete while diagnosing issues
ccbrowndev Nov 26, 2023
58e358b
Add save button
ccbrowndev Nov 26, 2023
37d346c
Remove listItems from UserList
ccbrowndev Nov 27, 2023
e6b8c99
UI changes
ZLongC Feb 17, 2024
98a4aac
YFJD2/18
AbelXia12138 Feb 18, 2024
50e3076
123
AbelXia12138 Feb 18, 2024
5284d3a
Update MainPage.xaml
AbelXia12138 Feb 18, 2024
f1f9c9e
Fix initial startup of app
ccbrowndev Feb 18, 2024
f3243dc
deadline
YifeiYang20 Feb 18, 2024
da42726
Update App.xaml
ZLongC Feb 18, 2024
21ac7a3
Update App.xaml
ZLongC Feb 18, 2024
5621748
Merge branch 'DD_presentation' into reality-ui
ZLongC Feb 18, 2024
322b6b4
Merge pull request #21 from ccbrowndev/reality-ui
ZLongC Feb 18, 2024
bed99d2
1
YifeiYang20 Feb 18, 2024
63d9ff4
ui for time picker
ZLongC Feb 18, 2024
d25552c
UI of ShareCenter and Share & basic functions
ZLongC Mar 2, 2024
150b073
recycle bin page
ZLongC Mar 7, 2024
ebdb501
1
YifeiYang20 Mar 21, 2024
270c65d
2
YifeiYang20 Mar 21, 2024
798bd3f
good try for sharing code
AbelXia12138 Mar 21, 2024
0d89aa6
3
YifeiYang20 Mar 24, 2024
a35b56c
4
YifeiYang20 Mar 27, 2024
29ff80a
1
YifeiYang20 Mar 27, 2024
37fa052
2
YifeiYang20 Mar 27, 2024
e048dcb
3
YifeiYang20 Mar 27, 2024
5649bf3
5
YifeiYang20 Mar 27, 2024
a7741b5
6
YifeiYang20 Mar 27, 2024
1702ef6
7
YifeiYang20 Mar 27, 2024
e8b50c6
7
YifeiYang20 Mar 27, 2024
f00d625
8
YifeiYang20 Mar 28, 2024
ee9b8e7
enter
ZLongC Mar 28, 2024
be10d0e
bin position changes
ZLongC Mar 29, 2024
4394c16
add annotation
ZLongC Mar 29, 2024
a9daab1
1
YifeiYang20 Mar 29, 2024
2f61bb5
2
YifeiYang20 Mar 29, 2024
0cb6606
3
YifeiYang20 Mar 29, 2024
56d5850
4
YifeiYang20 Mar 29, 2024
981c1d5
5
YifeiYang20 Mar 29, 2024
41c9821
6
YifeiYang20 Mar 29, 2024
cda1807
Add ignored appsettings.json and related nuget packages
ccbrowndev Mar 29, 2024
a6c23b0
1
YifeiYang20 Mar 31, 2024
9d7bebc
1
YifeiYang20 Mar 31, 2024
1ddc778
2
YifeiYang20 Mar 31, 2024
b85754b
Add http service
ccbrowndev Mar 31, 2024
f48a9ae
Merge branch 'RecycleBin_0328_bin&click' into ShareCodeFix
YifeiYang20 Mar 31, 2024
d88b818
4
YifeiYang20 Mar 31, 2024
d65dd31
WIP: adding sharing service, azure models, user model
ccbrowndev Mar 31, 2024
a5bd54a
WIP: add fields to azure related models
ccbrowndev Mar 31, 2024
58d9a3e
WIP:Remove list of userlist from default user as it's not needed for …
ccbrowndev Mar 31, 2024
8d9b4ae
WIP: more sharing related changes and run code cleanup
ccbrowndev Mar 31, 2024
abaa399
wip: add receive shared list function to sharing service
ccbrowndev Mar 31, 2024
f844143
wip: add check queue function to sharing service
ccbrowndev Mar 31, 2024
5d6d469
fix copy button
ZLongC Mar 31, 2024
e202d9a
UI for sharecenter
ZLongC Mar 31, 2024
0ce9597
change
ZLongC Mar 31, 2024
ab4c7c5
Add functions for updating a list
ccbrowndev Apr 1, 2024
8dda329
add sharing service to dependency injection
ccbrowndev Apr 1, 2024
f800741
Merge branch 'ShareCodeFix-2' into SharingHttpRequests
ccbrowndev Apr 1, 2024
444ae8c
Merge pull request #24 from ccbrowndev/SharingHttpRequests
ccbrowndev Apr 1, 2024
1c24f00
Remove enter page
ccbrowndev Apr 1, 2024
08083d9
Fix app.xaml.cs
ccbrowndev Apr 1, 2024
23f34b6
wip: hooking up sharing service with share code generation
ccbrowndev Apr 1, 2024
7200f12
change how deadline detection is triggered
ccbrowndev Apr 1, 2024
5435fcc
merge develop to resolve conflicts
ccbrowndev Apr 1, 2024
14b4711
code cleanup pass
ccbrowndev Apr 1, 2024
0528fe0
wip: adding receiving logic to sharecenter
ccbrowndev Apr 1, 2024
80b4666
Code cleanup
ccbrowndev Apr 1, 2024
bcbb19d
fix debugging
ccbrowndev Apr 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
##
## Get latest from `dotnet new gitignore`

appsettings.json

# dotenv files
.env

Expand Down
16 changes: 1 addition & 15 deletions App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
using menu.Data;
using menu.ViewModels;

namespace menu
namespace menu
{
public partial class App : Application
{
public App()
{
InitializeComponent();

MainPage = new AppShell();
}

protected override void OnStart()
{
CheckDeadlinesAsync();
}

private async void CheckDeadlinesAsync()
{
var database = new MenuDatabase();

var viewModel = new MainViewModel(database);

await viewModel.CheckDeadlinesAsync();
}

protected override void OnSleep()
Expand Down
4 changes: 4 additions & 0 deletions AppShell.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@
Title="List"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />
<ShellContent
Title="Share Center"
ContentTemplate="{DataTemplate local:ShareCenter}"
Route="ShareCenter"/>
</Shell>
97 changes: 97 additions & 0 deletions Data/AzureFunctionService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
using Microsoft.Extensions.Configuration;

namespace menu.Data
{
public class AzureFunctionService
{
private readonly HttpClient httpClient;
private readonly IConfiguration configuration;

public AzureFunctionService(HttpClient httpClient, IConfiguration configuration)
{
this.httpClient = httpClient;
this.configuration = configuration;
}

public async Task<string> ShareListAzure(string shareCode, string senderID, string listID, string listData)
{
string shareListUrl = $"https://anonylistfunctions.azurewebsites.net/api/ShareList?shareCode={shareCode}&senderID={senderID}&listID={listID}&listData={listData}";
string functionKey = configuration["SHARE_LIST_KEY"];

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, shareListUrl);
request.Headers.Add("x-functions-key", functionKey);

var response = await httpClient.SendAsync(request);

if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStringAsync();
}
else
{
throw new Exception("Error sharing list");
}
}

public async Task<string> ReceiveSharedListAzure(string shareCode, string senderID)
{
string receiveSharedListUrl = $"https://anonylistfunctions.azurewebsites.net/api/ReceiveSharedList?shareCode={shareCode}&senderID={senderID}";
string functionKey = configuration["RECEIVE_SHARED_LIST_KEY"];

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, receiveSharedListUrl);
request.Headers.Add("x-functions-key", functionKey);

var response = await httpClient.SendAsync(request);

if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStringAsync();
}
else
{
throw new Exception("Error receiving shared list");
}
}

public async Task<string> CheckQueueAzure(string userID)
{
string checkQueueUrl = $"https://anonylistfunctions.azurewebsites.net/api/CheckQueue?userID={userID}";
string functionKey = configuration["CHECK_QUEUE_KEY"];

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, checkQueueUrl);
request.Headers.Add("x-functions-key", functionKey);

var response = await httpClient.SendAsync(request);

if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStringAsync();
}
else
{
throw new Exception("Error checking the queue for list updates");
}
}

public async Task<string> UpdateListAzure(string senderID, string listID, string recipientIDList, string listData)
{
string updateListUrl = $"https://anonylistfunctions.azurewebsites.net/api/UpdateList?senderID={senderID}&listID={listID}&recipientIDList={recipientIDList}&listData={listData}";
string functionKey = configuration["UPDATE_LIST_KEY"];

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, updateListUrl);
request.Headers.Add("x-functions-key", functionKey);

var response = await httpClient.SendAsync(request);

if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStringAsync();
}
else
{
throw new Exception("Error updating the list " + listID);
}

}
}
}
91 changes: 74 additions & 17 deletions Data/MenuDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,75 @@ namespace menu.Data
{
public class MenuDatabase
{
private SQLiteConnection db;
private readonly SQLiteConnection db;

private static string DatabasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "menu.db");
private static readonly string DatabasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "menu.db");

public MenuDatabase()
{
db = new SQLiteConnection(DatabasePath);
db.CreateTable<UserList>();
db.CreateTable<ListItem>();
db.CreateTable<User>();
}

public User GetDefaultUser()
{
return db.Query<User>("SELECT * FROM user WHERE id = 0").FirstOrDefault();
}

public List<UserList> GetUserLists()
{
List<UserList> lists = db.Query<UserList>("SELECT * FROM user_lists");
List<UserList> lists;

lists = db.Query<UserList>("SELECT * FROM user_lists WHERE is_in_trash = 0");

if (lists == null || lists.Count == 0)
{
db.Insert(defaultUser);

db.Insert(defaultUserList);

db.Insert(changeTitleItem);
db.Insert(addListItemItem);
db.Insert(addListItem);
db.Insert(deleteListItemItem);
lists = db.Query<UserList>("SELECT * FROM user_lists");

lists = db.Query<UserList>("SELECT * FROM user_lists WHERE is_in_trash = 0");
}

return lists;
}

public List<UserList> GetTrashUserLists()
{
List<UserList> trashLists;

trashLists = db.Query<UserList>("SELECT * FROM user_lists WHERE is_in_trash = 1");

if (trashLists == null || trashLists.Count == 0)
{
db.Insert(defaultUser);

db.Insert(defaultUserList);

db.Insert(changeTitleItem);
db.Insert(addListItemItem);
db.Insert(addListItem);
db.Insert(deleteListItemItem);

trashLists = db.Query<UserList>("SELECT * FROM user_lists WHERE is_in_trash = 1");
}

return trashLists;
}

public int SaveUserList(UserList list)
{
if (list.Id != 0)
{
db.Update(list);
return list.Id;
return list.Id;
}
else
{
Expand All @@ -49,27 +83,41 @@ public int SaveUserList(UserList list)
}
}

public UserList DeleteUserList(UserList list)
public void MoveToTrash(UserList list)
{
int result = db.Delete(list);
if (result == 0)
if (list.Id == 1)
{
return null;
} else if (result == 1)
{
return list;
} else
db.Update(list);
}
if (list.Id != 1)
{
throw new Exception(string.Format("Error occurred trying to delete UserList {0}", list));
list.IsInTrash = true;
db.Update(list);
}
}

public void RestoreFromTrash(UserList list)
{
list.IsInTrash = false;
db.Update(list);
}

public void DeleteUserListPermanently()
{
db.Execute("DELETE FROM user_lists WHERE is_in_trash = 1");
}


public List<ListItem> GetListItemsByListId(int id)
{
return db.Table<ListItem>().Where(li => li.UserListId == id).ToList();
}

public List<UserList> GetTrashLists()
{
return db.Table<UserList>().Where(li => li.IsInTrash == true).ToList();
}

public ListItem GetListItemById(int id)
{
return db.Table<ListItem>().Where(li => li.Id == id).FirstOrDefault();
Expand All @@ -80,7 +128,8 @@ public int SaveListItem(ListItem li)
if (li.Id != 0)
{
return db.Update(li);
} else
}
else
{
return db.Insert(li);
}
Expand All @@ -92,15 +141,23 @@ public ListItem DeleteListItem(ListItem li)
if (result == 0)
{
return null;
} else if (result == 1)
}
else if (result == 1)
{
return li;
} else
}
else
{
throw new Exception(string.Format("Error occurred trying to delete ListItem {0}", li));
}
}

private readonly User defaultUser = new()
{
Id = 0,
Uuid = Guid.NewGuid().ToString()
};

private readonly UserList defaultUserList = new()
{
Name = "Welcome",
Expand Down
Loading