Skip to content

Commit

Permalink
fix: removed debug mode notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
IamMuuo committed Oct 19, 2024
1 parent 3604b4b commit f7e6d58
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 23 deletions.
48 changes: 29 additions & 19 deletions lib/tools/chirp/pages/feed_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class _FeedPageState extends State<FeedPage>
@override
void initState() {
super.initState();
setState(() {
pageLoading = true;
});
_service.fetchPosts(userController.authHeaders).then((value) {
value.fold((l) {
debugPrint(l);
Expand All @@ -52,36 +55,43 @@ class _FeedPageState extends State<FeedPage>
super.build(context);
return RefreshIndicator(
onRefresh: () async {
setState(() {
pageLoading = true;
});

feedPosts.clear();
_service.fetchPosts(userController.authHeaders).then((value) {
value.fold((l) {
debugPrint(l);
}, (r) {
feedPosts.addAll(r["posts"]);
if (nextPage == r["nextPage"]) {
setState(() {
hasMorePages = false;
});
return;
}
final result = await _service.fetchPosts(userController.authHeaders);
return result.fold((l) {
debugPrint(l);
setState(() {
pageLoading = false;
});
}, (r) {
feedPosts.addAll(r["posts"]);
if (nextPage == r["nextPage"]) {
setState(() {
hasMorePages = false;
pageLoading = false;
});
return;
}

nextPage = r["nextPage"];
setState(() {});
nextPage = r["nextPage"];
setState(() {
pageLoading = false;
});
});
setState(() {
pageLoading = false;
});
},
child: pageLoading
? ListView.separated(
itemBuilder: (context, index) {
return const EmptyPostCard();
},
separatorBuilder: (context, index) => const SizedBox(
height: 4,
),
itemCount: 12)
height: 4,
),
itemCount: 12,
)
: feedPosts.isEmpty
? const Center(
child: Text("No posts here yet"),
Expand Down
6 changes: 4 additions & 2 deletions lib/tools/chirp/pages/post_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ class _PostViewPageState extends State<PostViewPage> {
floating: true,
snap: true,
backgroundColor: Theme.of(context).colorScheme.primaryContainer,
title: Text("@${widget.post.user?.username ?? 'anon'}"),
flexibleSpace: FlexibleSpaceBar(
title:
Text("@${widget.post.user?.username ?? 'anon'}${"'"}s post"),
),
),
SliverPadding(
padding: const EdgeInsets.symmetric(
Expand Down Expand Up @@ -165,7 +168,6 @@ class _PostViewPageState extends State<PostViewPage> {
),
SliverFillRemaining(
hasScrollBody: true,
fillOverscroll: true,
child: Stack(
children: [
FutureBuilder(
Expand Down
3 changes: 2 additions & 1 deletion lib/tools/chirp/widgets/comment_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ class _CommentWidgetState extends State<CommentWidget> {
children: [
Row(
children: [
widget.comment.user.profilePhoto != null
widget.comment.user.profilePhoto != null &&
widget.comment.user.profilePhoto != ""
? CircleAvatar(
backgroundImage: CachedNetworkImageProvider(
widget.comment.user.profilePhoto ?? '',
Expand Down
2 changes: 1 addition & 1 deletion lib/workers/background_worker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class BackgroundWorker {
if (Platform.isAndroid || Platform.isIOS) {
await Workmanager().initialize(
callbackDispatcher,
isInDebugMode: true,
isInDebugMode: false,
);

DateTime now = DateTime.now();
Expand Down

0 comments on commit f7e6d58

Please sign in to comment.