diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index fbe2d04..8b56351 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,4 +1,5 @@ + create() async { + return await FlutterRustoreRemoteconfig.create( Configuration.ruStoreRemoteConfigAppID, PluginUpdateBehavior.defaultBehavior, 15, diff --git a/lib/application/services/schedule.dart b/lib/application/services/schedule.dart index 3c163d2..b4a3985 100644 --- a/lib/application/services/schedule.dart +++ b/lib/application/services/schedule.dart @@ -43,6 +43,9 @@ class ScheduleService { final dateEnd = datetime.copyWith(hour: 23, minute: 59, second: 59, microsecond: 999, millisecond: 999); final datetimeStartWithOffset = dateStart.copyWith().add(dayOffset); + final usedDatetimeStartWithOffset = datetime.isAfter(datetimeStartWithOffset) + ? datetimeStartWithOffset + : datetimeStartWithOffset.copyWith().subtract(const Duration(days: 1)); final DateTime usedScheduleDatetime = datetime.isAfter(datetimeStartWithOffset) ? datetime : datetime.copyWith().subtract(const Duration(days: 1)); @@ -65,8 +68,8 @@ class ScheduleService { int durationOffset = 0; for (var i = 0; i < schedule.length; i++) { final ScheduleItem scheduleItem = schedule[i]; - DateTime start = datetimeStartWithOffset.copyWith().add(Duration(minutes: durationOffset)); - DateTime end = datetimeStartWithOffset.copyWith().add(Duration(minutes: durationOffset + scheduleItem.duration)); + DateTime start = usedDatetimeStartWithOffset.copyWith().add(Duration(minutes: durationOffset)); + DateTime end = usedDatetimeStartWithOffset.copyWith().add(Duration(minutes: durationOffset + scheduleItem.duration)); durationOffset += scheduleItem.duration; if(!force) { diff --git a/lib/configuration.dart b/lib/configuration.dart index b350e47..d63951b 100644 --- a/lib/configuration.dart +++ b/lib/configuration.dart @@ -1,3 +1,6 @@ class Configuration { static const String ruStoreRemoteConfigAppID = '12cbda1f-4601-4f6d-924d-64a210005e96'; + + static const String sentryDsn = 'https://360e4280ce9e9d1caaa3e4c1720ac16e@sentry.nngasu.ru/4'; + static const double sentryTraceSampleRate = 0.25; } \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 03aace8..5f559dc 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,11 +2,19 @@ import 'package:flutter/material.dart'; import 'package:get_storage/get_storage.dart'; import 'package:reverse_nn/application.dart'; import 'package:reverse_nn/application/services/remote_config/service.dart'; +import 'package:reverse_nn/configuration.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; void main() async { await GetStorage.init(); - ReverseNNRuStoreRemoteConfig().create(); - runApp(const ReversNNApplication()); + await ReverseNNRuStoreRemoteConfig().create(); + + await SentryFlutter.init((options) { + options.dsn = Configuration.sentryDsn; + options.tracesSampleRate = Configuration.sentryTraceSampleRate; + }, + appRunner: () => runApp(const ReversNNApplication()), + ); } diff --git a/lib/ui/components/current_status_component.dart b/lib/ui/components/current_status_component.dart index c5a94b1..cf1fea4 100644 --- a/lib/ui/components/current_status_component.dart +++ b/lib/ui/components/current_status_component.dart @@ -1,3 +1,5 @@ +import 'dart:developer'; + import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:reverse_nn/application/controllers/schedule_controller.dart'; @@ -12,7 +14,18 @@ class CurrentStatusComponent extends StatelessWidget { return GetBuilder( builder: (controller) { - if(controller.currentSchedule.value == null) { return Container(); } + if(controller.currentSchedule.value == null) { + return Container( + margin: const EdgeInsets.only(top: 10), + padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 10), + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.secondaryContainer, + borderRadius: BorderRadius.circular(10), + ), + alignment: Alignment.center, + child: Text('Что-то пошло не так...', style: Theme.of(context).textTheme.bodyLarge), + ); + } return ScheduleItemComponent(item: controller.currentSchedule.value!); } diff --git a/pubspec.lock b/pubspec.lock index 8e2102c..e745126 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -269,6 +269,11 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" frontend_server_client: dependency: transitive description: @@ -309,6 +314,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.2" + http: + dependency: transitive + description: + name: http + sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 + url: "https://pub.dev" + source: hosted + version: "1.2.2" http_multi_server: dependency: transitive description: @@ -461,6 +474,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" + package_info_plus: + dependency: transitive + description: + name: package_info_plus + sha256: "70c421fe9d9cc1a9a7f3b05ae56befd469fe4f8daa3b484823141a55442d858d" + url: "https://pub.dev" + source: hosted + version: "8.1.2" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + sha256: a5ef9986efc7bf772f2696183a3992615baa76c1ffb1189318dd8803778fb05b + url: "https://pub.dev" + source: hosted + version: "3.0.2" path: dependency: transitive description: @@ -565,6 +594,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.4.0" + sentry: + dependency: transitive + description: + name: sentry + sha256: b1ead7ca4da0949aed9482c4962f172021a4417f0a126fa974878c2301c16df7 + url: "https://pub.dev" + source: hosted + version: "8.11.2" + sentry_flutter: + dependency: "direct main" + description: + name: sentry_flutter + sha256: d978861bc413ef98b663b065a65e780b255bfcdc0e2fa307884f7f6df0f1a406 + url: "https://pub.dev" + source: hosted + version: "8.11.2" shelf: dependency: transitive description: @@ -682,6 +727,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.4.0" + uuid: + dependency: transitive + description: + name: uuid + sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff + url: "https://pub.dev" + source: hosted + version: "4.5.1" vector_math: dependency: transitive description: @@ -730,6 +783,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.1" + win32: + dependency: transitive + description: + name: win32 + sha256: "8b338d4486ab3fbc0ba0db9f9b4f5239b6697fcee427939a40e720cbb9ee0a69" + url: "https://pub.dev" + source: hosted + version: "5.9.0" xdg_directories: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index e79a188..af4bb62 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.1.1+4 +version: 1.1.2+5 environment: sdk: '>=3.3.3 <4.0.0' @@ -43,6 +43,7 @@ dependencies: sprintf: "^7.0.0" flutter_rustore_remoteconfig: ^7.0.0 json_annotation: ^4.9.0 + sentry_flutter: ^8.11.2 dev_dependencies: flutter_test: