RuStore Remote Config

This commit is contained in:
2024-12-22 16:39:43 +03:00
parent 86e539daf1
commit 0cda6f9a48
27 changed files with 693 additions and 380 deletions

View File

@@ -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);
}
}

View File

@@ -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();