mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-02-04 07:20:39 +00:00
update
This commit is contained in:
parent
d2981b1895
commit
bb6de7ff67
|
@ -172,5 +172,8 @@
|
|||
"_comment": "messages in modals",
|
||||
"1": "Сервер с таким именем уже существует",
|
||||
"2": "Уничтожить сервер и создать новый?"
|
||||
},
|
||||
"timer": {
|
||||
"sec": "{} sec"
|
||||
}
|
||||
}
|
|
@ -172,5 +172,8 @@
|
|||
"_comment": "messages in modals",
|
||||
"1": "Сервер с таким именем уже существует",
|
||||
"2": "Уничтожить сервер и создать новый?"
|
||||
},
|
||||
"timer": {
|
||||
"sec": "{} сек"
|
||||
}
|
||||
}
|
|
@ -13,10 +13,11 @@ class ServerApi extends ApiMap {
|
|||
|
||||
Future<bool> isHttpServerWorking() async {
|
||||
bool res;
|
||||
|
||||
print('start');
|
||||
Response response;
|
||||
try {
|
||||
response = await loggedClient.get('/serviceStatus');
|
||||
print(response);
|
||||
res = response.statusCode == HttpStatus.ok;
|
||||
} catch (e) {
|
||||
res = false;
|
||||
|
|
|
@ -36,9 +36,9 @@ class AppConfigState extends Equatable {
|
|||
final CloudFlareDomain? cloudFlareDomain;
|
||||
final User? rootUser;
|
||||
final HetznerServerDetails? hetznerServer;
|
||||
final bool? isServerStarted;
|
||||
final bool? isServerReseted;
|
||||
final bool? hasFinalChecked;
|
||||
final bool isServerStarted;
|
||||
final bool isServerReseted;
|
||||
final bool hasFinalChecked;
|
||||
|
||||
final bool? isLoading;
|
||||
final Exception? error;
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'dart:async';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:selfprivacy/ui/components/brand_text/brand_text.dart';
|
||||
import 'package:selfprivacy/utils/named_font_weight.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
class BrandTimer extends StatefulWidget {
|
||||
const BrandTimer({
|
||||
|
@ -11,8 +12,8 @@ class BrandTimer extends StatefulWidget {
|
|||
required this.duration,
|
||||
}) : super(key: key);
|
||||
|
||||
final DateTime? startDateTime;
|
||||
final Duration? duration;
|
||||
final DateTime startDateTime;
|
||||
final Duration duration;
|
||||
|
||||
@override
|
||||
_BrandTimerState createState() => _BrandTimerState();
|
||||
|
@ -31,8 +32,8 @@ class _BrandTimerState extends State<BrandTimer> {
|
|||
_timerStart() {
|
||||
_timeString = diffenceFromStart;
|
||||
timer = Timer.periodic(Duration(seconds: 1), (Timer t) {
|
||||
var timePassed = DateTime.now().difference(widget.startDateTime!);
|
||||
if (timePassed > widget.duration!) {
|
||||
var timePassed = DateTime.now().difference(widget.startDateTime);
|
||||
if (timePassed > widget.duration) {
|
||||
t.cancel();
|
||||
} else {
|
||||
_getTime();
|
||||
|
@ -66,14 +67,14 @@ class _BrandTimerState extends State<BrandTimer> {
|
|||
}
|
||||
|
||||
String get diffenceFromStart =>
|
||||
_durationToString(DateTime.now().difference(widget.startDateTime!));
|
||||
_durationToString(DateTime.now().difference(widget.startDateTime));
|
||||
|
||||
String _durationToString(Duration duration) {
|
||||
String twoDigits(int n) => n.toString().padLeft(2, "0");
|
||||
String twoDigitSeconds =
|
||||
twoDigits(widget.duration!.inSeconds - duration.inSeconds.remainder(60));
|
||||
twoDigits(widget.duration.inSeconds - duration.inSeconds.remainder(60));
|
||||
|
||||
return "$twoDigitSeconds cек";
|
||||
return "timer.sec".tr(args: [twoDigitSeconds]);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -431,10 +431,10 @@ class InitializingPage extends StatelessWidget {
|
|||
assert(appConfigCubit.state is TimerState, 'wronge state');
|
||||
var state = appConfigCubit.state as TimerState;
|
||||
|
||||
String? text;
|
||||
if (state.isServerReseted!) {
|
||||
late String? text;
|
||||
if (state.isServerReseted) {
|
||||
text = 'initializing.13'.tr();
|
||||
} else if (state.isServerStarted!) {
|
||||
} else if (state.isServerStarted) {
|
||||
text = 'initializing.14'.tr();
|
||||
} else if (state.isServerCreated) {
|
||||
text = 'initializing.15'.tr();
|
||||
|
@ -452,8 +452,8 @@ class InitializingPage extends StatelessWidget {
|
|||
children: [
|
||||
BrandText.body2('initializing.16'.tr()),
|
||||
BrandTimer(
|
||||
startDateTime: state.timerStart,
|
||||
duration: state.duration,
|
||||
startDateTime: state.timerStart!,
|
||||
duration: state.duration!,
|
||||
)
|
||||
],
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue