diff --git a/Disc.csproj b/Disc.csproj
index 0adf4a7..8fb27d4 100644
--- a/Disc.csproj
+++ b/Disc.csproj
@@ -45,7 +45,8 @@
com.reticentrobot.disc
link
1701;1702
- True
+ False
+ 2G
@@ -61,7 +62,8 @@
link
True
1701;1702
- True
+ False
+ 2G
@@ -117,7 +119,8 @@
-
+
+
diff --git a/MauiProgram.cs b/MauiProgram.cs
index 66351bd..3b695ec 100644
--- a/MauiProgram.cs
+++ b/MauiProgram.cs
@@ -1,6 +1,7 @@
using CommunityToolkit.Maui;
using Disc.Services;
using Disc.Views;
+using Sharpnado.CollectionView;
using System.Diagnostics;
namespace Disc;
@@ -38,7 +39,10 @@ public static MauiApp CreateMauiApp()
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
})
- ;
+ // Initialize SharpnadoCollectionVIew
+ .UseSharpnadoCollectionView(loggerEnable: false);
+ ;
+
// TODO: Add light mode support, for now - setting app to always load in dark mode
// Application.Current.UserAppTheme = AppTheme.Dark;
diff --git a/Models/Posts.cs b/Models/Posts.cs
index 90dd06a..b94e049 100644
--- a/Models/Posts.cs
+++ b/Models/Posts.cs
@@ -3,46 +3,13 @@
namespace Disc.Models
{
- // Root myDeserializedClass = JsonConvert.DeserializeObject(myJsonResponse);
- public class CommunityBannerImage
- {
- [JsonPropertyName("mimetype")] public string? Mimetype { get; set; }
- [JsonPropertyName("width")] public int Width { get; set; }
- [JsonPropertyName("height")] public int Height { get; set; }
- [JsonPropertyName("size")] public int Size { get; set; }
- [JsonPropertyName("averageColor")] public string? AverageColor { get; set; }
- [JsonPropertyName("url")] public string? Url { get; set; }
- [JsonPropertyName("copies")] public List? Copies { get; set; }
- }
-
- public class CommunityProPic
- {
- [JsonPropertyName("mimetype")] public string? Mimetype { get; set; }
- [JsonPropertyName("width")] public int Width { get; set; }
- [JsonPropertyName("height")] public int Height { get; set; }
- [JsonPropertyName("size")] public int Size { get; set; }
- [JsonPropertyName("averageColor")] public string? AverageColor { get; set; }
- [JsonPropertyName("url")] public string? Url { get; set; }
- [JsonPropertyName("copies")] public List? Copies { get; set; }
- }
-
public class Copy
{
- [JsonPropertyName("copyId")] public string? CopyId { get; set; }
- [JsonPropertyName("width")] public int Width { get; set; }
- [JsonPropertyName("height")] public int Height { get; set; }
- [JsonPropertyName("size")] public int Size { get; set; }
[JsonPropertyName("url")] public string? Url { get; set; }
- [JsonPropertyName("objectFit")] public string? ObjectFit { get; set; }
}
public class Image
{
- [JsonPropertyName("mimetype")] public string? Mimetype { get; set; }
- [JsonPropertyName("width")] public int Width { get; set; }
- [JsonPropertyName("height")] public int Height { get; set; }
- [JsonPropertyName("size")] public int Size { get; set; }
- [JsonPropertyName("averageColor")] public string? AverageColor { get; set; }
[JsonPropertyName("url")] public string? ImageUrl { get; set; }
[JsonPropertyName("copies")] public List? Copies { get; set; }
}
@@ -56,38 +23,18 @@ public class Link
public class Post
{
- [JsonPropertyName("id")] public string? Id { get; set; }
[JsonPropertyName("type")] public string? Type { get; set; }
- [JsonPropertyName("publicId")] public string? PublicId { get; set; }
- [JsonPropertyName("userId")] public string? UserId { get; set; }
[JsonPropertyName("username")] public string? Username { get; set; }
- [JsonPropertyName("userGroup")] public string? UserGroup { get; set; }
- [JsonPropertyName("userDeleted")] public bool UserDeleted { get; set; }
- [JsonPropertyName("isPinned")] public bool IsPinned { get; set; }
- [JsonPropertyName("communityId")] public string? CommunityId { get; set; }
[JsonPropertyName("communityName")] public string? CommunityName { get; set; }
- [JsonPropertyName("communityProPic")] public CommunityProPic? CommunityProPic { get; set; }
- [JsonPropertyName("communityBannerImage")] public CommunityBannerImage? CommunityBannerImage { get; set; }
[JsonPropertyName("title")] public string? Title { get; set; }
- [JsonPropertyName("body")] public object? Body { get; set; }
[JsonPropertyName("link")] public Link? Link { get; set; }
- [JsonPropertyName("locked")] public bool Locked { get; set; }
- [JsonPropertyName("lockedBy")] public object? LockedBy { get; set; }
- [JsonPropertyName("lockedAt")] public object? LockedAt { get; set; }
[JsonPropertyName("upvotes")] public int Upvotes { get; set; }
[JsonPropertyName("downvotes")] public int Downvotes { get; set; }
- [JsonPropertyName("hotness")] public object? Hotness { get; set; }
[JsonPropertyName("createdAt")] public DateTime CreatedAt { get; set; }
- [JsonPropertyName("editedAt")] public object? EditedAt { get; set; }
- [JsonPropertyName("lastActivityAt")] public DateTime LastActivityAt { get; set; }
- [JsonPropertyName("deleted")] public bool Deleted { get; set; }
- [JsonPropertyName("deletedAt")] public object? DeletedAt { get; set; }
- [JsonPropertyName("deletedContent")] public bool DeletedContent { get; set; }
+ //[JsonPropertyName("editedAt")] public object? EditedAt { get; set; }
[JsonPropertyName("noComments")] public int NoComments { get; set; }
- [JsonPropertyName("comments")] public object? Comments { get; set; }
- [JsonPropertyName("commentsNext")] public object? CommentsNext { get; set; }
- [JsonPropertyName("userVoted")] public string? UserVoted { get; set; }
- [JsonPropertyName("userVotedUp")] public string? UserVotedUp { get; set; }
+ //[JsonPropertyName("userVoted")] public string? UserVoted { get; set; }
+ //[JsonPropertyName("userVotedUp")] public string? UserVotedUp { get; set; }
}
diff --git a/Platforms/Android/AndroidManifest.xml b/Platforms/Android/AndroidManifest.xml
index e9937ad..cbd5bc0 100644
--- a/Platforms/Android/AndroidManifest.xml
+++ b/Platforms/Android/AndroidManifest.xml
@@ -1,6 +1,7 @@
-
-
+
+
+
\ No newline at end of file
diff --git a/Platforms/Android/env.conf b/Platforms/Android/env.conf
index 45fd9e7..0420df6 100644
--- a/Platforms/Android/env.conf
+++ b/Platforms/Android/env.conf
@@ -1 +1 @@
-MONO_GC_PARAMS=nursery-size=128m
\ No newline at end of file
+MONO_GC_PARAMS=nursery-size=256m
\ No newline at end of file
diff --git a/ViewModels/PostsViewModel.cs b/ViewModels/PostsViewModel.cs
index 1e70a39..48dcdea 100644
--- a/ViewModels/PostsViewModel.cs
+++ b/ViewModels/PostsViewModel.cs
@@ -47,23 +47,11 @@ public partial class PostsViewModel : BaseViewModel
public ObservableCollection Posts { get; set; }
- //handle refreshing
- private bool listRefreshing = false;
- public bool ListRefreshing
- {
- get => listRefreshing;
- set => SetProperty(ref listRefreshing, value);
- }
-
// constructor to initialize objects
public PostsViewModel(IServiceProvider serviceProvider)
{
- Debug.WriteLine("Setting _restService to restService");
_restService = serviceProvider.GetRequiredService();
-
var client = _restService.client;
- Debug.WriteLine("Client Value in constructor: " + client);
-
Posts = new ObservableCollection();
}
@@ -79,8 +67,6 @@ public async Task LoadPosts()
var request = new RestRequest(url);
var TotalPostsBeforePull = Posts.Count; //Total number of posts before pulling new posts
-
- Debug.WriteLine("Client Value in LoadPosts: " + client); ;
var content = await _restService.client.GetAsync(request);
//set json options
@@ -91,20 +77,16 @@ public async Task LoadPosts()
if (content.StatusCode.ToString() == "OK")
{
- //IsLoadingMoreItems = true;
Data = JsonSerializer.Deserialize(content.Content, options);
var NewPosts = Data.Posts.Count; //Total number of new posts grabbed
- var PostsCount = NewPosts + TotalPostsBeforePull; //Total number of posts after pulling new posts
-
- //var Index = NewPosts - Constants.PageSize; //Get the root index of the new posts pulled in
- var Index = 0;
- Debug.WriteLine(Index);
- while (NewPosts > Index) //while the total number of posts is greater than the total number of posts minus the limit of posts to add
+ // Loop through the new posts and add them to Data.Posts
+ var Target = 0;
+ while (NewPosts > Target)
{
- Posts.Add(Data.Posts[Index]);
- Index++;
+ Posts.Add(Data.Posts[Target]);
+ Target++;
}
}
else
diff --git a/Views/HomePage.xaml b/Views/HomePage.xaml
index b21f0d4..b8b60de 100644
--- a/Views/HomePage.xaml
+++ b/Views/HomePage.xaml
@@ -30,10 +30,10 @@
Order="Primary"
IconImageSource="icon_three_dots_darkmode.png" />
-
+
+ ColumnSpacing="0"
+ >
-
+
@@ -78,7 +79,7 @@
WidthRequest="55"
>
+ CommandParameter="{Binding Link.LinkUrl, Mode=OneTime}"/>
@@ -98,7 +99,7 @@
Grid.Column="2"
Grid.Row="1"
FontSize="14"
- Text="{Binding Title}"
+ Text="{Binding Title, Mode=OneTime}"
LineBreakMode="WordWrap"
MaxLines="2"
FontAttributes="None"
@@ -112,9 +113,11 @@
Padding="0">
-
+
+
-
+
+
@@ -126,9 +129,10 @@
Padding="0">
-
+
+
-
+
@@ -148,7 +152,8 @@
-
+
+
+
-
diff --git a/Views/HomePage.xaml.cs b/Views/HomePage.xaml.cs
index 2a0b695..7a829f4 100644
--- a/Views/HomePage.xaml.cs
+++ b/Views/HomePage.xaml.cs
@@ -61,9 +61,8 @@ private void OnChevronClicked(object sender, EventArgs e)
Grid.SetRow(imageButton, nextRow);
}
- async void OnTapGestureRecognizerTapped(object sender, TappedEventArgs args)
+ async void OnTapGestureRecognizerTapped(object sender, TappedEventArgs args)
{
-
LinkInfo linkInfo = new LinkInfo();
linkInfo.LinkUrl = args.Parameter as string;