Skip to content

Commit

Permalink
fix: Academia v2 final fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
IamMuuo committed Oct 4, 2024
1 parent e159492 commit ac04123
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 20 deletions.
16 changes: 9 additions & 7 deletions lib/pages/courses/service/courses_background_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ class CoursesBackgroundService {
}
});

LocalNotifierService().showNotification(
id: LocalNotificationStatusManager().getNextId(),
title: "Class! Class! Class! ${Emojis.building_school}",
body:
"Hey, you have $coursestoday classes today ${Emojis.smile_face_screaming_in_fear}",
channelKey: LocalNotificationChannelType.reminders.channelKey,
);
if (coursestoday > 0) {
LocalNotifierService().showNotification(
id: LocalNotificationStatusManager().getNextId(),
title: "Class! Class! Class! ${Emojis.building_school}",
body:
"Hey, you have $coursestoday classes today ${Emojis.smile_face_screaming_in_fear}",
channelKey: LocalNotificationChannelType.reminders.channelKey,
);
}
});
}
}
13 changes: 7 additions & 6 deletions lib/pages/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class _SettingsPageState extends State<SettingsPage> {
await userController.deleteUser();
await LocalNotifierService().showNotification(
id: 0,
title: "Damn",
title: "Goodbye see you soon!",
notificationType: NotificationType.bigText,
body:
"Goodbye, your entire user information has been deleted from our platform, it was a pleasure being a part of your academic journey",
Expand All @@ -269,11 +269,11 @@ class _SettingsPageState extends State<SettingsPage> {
);

if (context.mounted) {
Navigator.pop(context);
Navigator.of(context).pushReplacement(
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (context) => const Academia(),
builder: (context) => const IntroPage(),
),
(predicate) => false,
);
}
},
Expand Down Expand Up @@ -317,11 +317,12 @@ class _SettingsPageState extends State<SettingsPage> {
);
if (context.mounted) {
Navigator.pop(context);
Navigator.of(context).pushReplacement(
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (context) =>
const Academia(),
const IntroPage(),
),
(predicate) => false,
);
}
},
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/util_pages/intro_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class IntroPage extends StatelessWidget {
),
floatingActionButton: FutureBuilder(
future: Future.delayed(
const Duration(seconds: 3),
const Duration(seconds: 7),
),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
Expand Down
5 changes: 5 additions & 0 deletions lib/tools/chirp/pages/post_create_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ class _PostCreatePageState extends State<PostCreatePage> {
final TextEditingController bodyController = TextEditingController();
final List<XFile> imageFiles = [];
final ChirpController chirpController = Get.find<ChirpController>();

bool isLoading = false;

@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: AppBar(
leading: IconButton(
onPressed: () {
Expand Down Expand Up @@ -121,6 +123,7 @@ class _PostCreatePageState extends State<PostCreatePage> {
);
postresponse.fold((l) {
showDialog(
barrierDismissible: false,
context: context,
builder: (context) => AlertDialog(
title: const Text("Error"),
Expand All @@ -135,6 +138,7 @@ class _PostCreatePageState extends State<PostCreatePage> {
));
}, (r) {
showDialog(
barrierDismissible: false,
context: context,
builder: (context) => AlertDialog(
title: const Text("Success"),
Expand All @@ -144,6 +148,7 @@ class _PostCreatePageState extends State<PostCreatePage> {
FilledButton(
onPressed: () {
Navigator.pop(context);
Navigator.pop(context);
},
child: const Text("okay"))
],
Expand Down
27 changes: 24 additions & 3 deletions lib/tools/chirp/widgets/post_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,30 @@ class _PostCardState extends State<PostCard> {
),
),
const Spacer(),
IconButton(
onPressed: () {},
icon: const Icon(Ionicons.ellipsis_vertical),
Visibility(
visible: widget.post.upvotes > 1000 ? true : false,
child: IconButton(
onPressed: () {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: const Text("Awesome post ✨✨"),
content: const Text(
"This post has been handpicked by the community"),
actions: [
FilledButton(
onPressed: () {
Navigator.pop(context);
},
child: const Text("Cool"),
),
],
);
});
},
icon: const Icon(Ionicons.ribbon),
),
),
],
),
Expand Down
6 changes: 3 additions & 3 deletions lib/workers/background_worker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ class BackgroundWorker {
BackgroundConfig.coursesIDentifier,
BackgroundConfig.coursesIDentifier,
initialDelay: timeUntilNextTarget(
DateTime(now.year, now.month, now.day, 12, 0, 0),
DateTime(now.year, now.month, now.day, 7, 0, 0),
),
frequency: const Duration(minutes: 15),
frequency: const Duration(hours: 8),
);

/// Todos task that is suppossed to run after every 24 hours at 8 am
Workmanager().registerPeriodicTask(
BackgroundConfig.todosIDentifier,
BackgroundConfig.todosIDentifier,
initialDelay: const Duration(seconds: 10),
frequency: const Duration(minutes: 15),
frequency: const Duration(hours: 8),
);
}
}
Expand Down

0 comments on commit ac04123

Please sign in to comment.