RuStore Remote Config
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:reverse_nn/application/dto/schedule.dart';
|
||||
import 'package:reverse_nn/application/services/remote_config/service.dart';
|
||||
import 'package:reverse_nn/application/services/schedule.dart';
|
||||
import 'package:reverse_nn/ui/screens/calendar_screen.dart';
|
||||
|
||||
class CalendarScheduleController extends GetxController {
|
||||
Rx<DateTime> date = DateTime.now().copyWith(hour: 12, minute: 00).obs;
|
||||
RxBool loading = false.obs;
|
||||
Rx<List<Map<String, dynamic>>?> schedule = null.obs;
|
||||
Rx<List<ScheduleItem>?> schedule = null.obs;
|
||||
|
||||
@override void onReady() {
|
||||
super.onReady();
|
||||
@@ -26,14 +28,26 @@ class CalendarScheduleController extends GetxController {
|
||||
}
|
||||
|
||||
void goToPrevDay() async {
|
||||
if(date.value.isBefore(DateTime(2024, 8, 1, 23, 59))) return;
|
||||
date = (date.value.copyWith().subtract(const Duration(days: 1)).copyWith(hour: 12, minute: 0)).obs;
|
||||
final newDate = date.value
|
||||
.copyWith(hour: 12, minute: 0, second: 0, microsecond: 0, millisecond: 0)
|
||||
.subtract(const Duration(days: 1));
|
||||
final dateStart = await ReverseNNRuStoreRemoteConfig().getStartScheduleDate();
|
||||
|
||||
if(newDate.isBefore(dateStart)) return;
|
||||
|
||||
date = newDate.obs;
|
||||
loadSchedule(date.value);
|
||||
}
|
||||
|
||||
void goToNextDay() async {
|
||||
if(date.value.isAfter(DateTime(2025, 12, 31))) return;
|
||||
date = (date.value.copyWith().add(const Duration(days: 1)).copyWith(hour: 12, minute: 0)).obs;
|
||||
final newDate = date.value
|
||||
.copyWith(hour: 12, minute: 0, second: 0, microsecond: 0, millisecond: 0)
|
||||
.add(const Duration(days: 1));
|
||||
final dateEnd = await ReverseNNRuStoreRemoteConfig().getEndScheduleDate();
|
||||
|
||||
if(newDate.isAfter(dateEnd)) return;
|
||||
|
||||
date = newDate.obs;
|
||||
loadSchedule(date.value);
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,11 @@ import 'dart:developer';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:reverse_nn/application/dto/schedule.dart';
|
||||
import 'package:reverse_nn/application/services/schedule.dart';
|
||||
|
||||
class ScheduleController extends GetxController {
|
||||
Rx<Map<String, dynamic>?> currentSchedule = null.obs;
|
||||
Rx<ScheduleItem?> currentSchedule = null.obs;
|
||||
|
||||
@override void onReady() {
|
||||
super.onReady();
|
||||
|
||||
Reference in New Issue
Block a user