cm show requesting rather than connected when not authorized

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2022-11-21 18:45:36 +08:00
parent 16165dae27
commit a9773035c9
27 changed files with 42 additions and 8 deletions

View File

@ -304,7 +304,9 @@ class _CmHeaderState extends State<_CmHeader>
void initState() {
super.initState();
_timer = Timer.periodic(Duration(seconds: 1), (_) {
if (!client.disconnected) _time.value = _time.value + 1;
if (client.authorized && !client.disconnected) {
_time.value = _time.value + 1;
}
});
}
@ -358,10 +360,13 @@ class _CmHeaderState extends State<_CmHeader>
FittedBox(
child: Row(
children: [
Text(client.disconnected
Text(client.authorized
? client.disconnected
? translate("Disconnected")
: translate("Connected"))
: translate("Connected")
: "${translate("Request access to your device")}...")
.marginOnly(right: 8.0),
if (client.authorized)
Obx(() => Text(
formatDurationToTime(Duration(seconds: _time.value))))
],

View File

@ -393,5 +393,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", "一次性密码"),
("Use one-time password", "使用一次性密码"),
("One-time password length", "一次性密码长度"),
("Request access to your device", "请求访问你的设备"),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -393,5 +393,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", "رمز عبور یکبار مصرف"),
("Use one-time password", "استفاده از رمز عبور یکبار مصرف"),
("One-time password length", "طول رمز عبور یکبار مصرف"),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", "一次性密碼"),
("Use one-time password", "使用一次性密碼"),
("One-time password length", "一次性密碼長度"),
("Request access to your device", "請求訪問你的設備"),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect();
}

View File

@ -41,7 +41,10 @@ class Body: Reactor.Component
<div>
<div .id style="font-weight: bold; font-size: 1.2em;">{c.name}</div>
<div .id>({c.peer_id})</div>
<div style="margin-top: 1.2em">{disconnected ? translate('Disconnected') : translate('Connected')} {" "} <span #time>{getElaspsed(c.time, c.now)}</span></div>
<div style="margin-top: 1.2em">{auth
? <span>{disconnected ? translate('Disconnected') : translate('Connected')}{" "}<span #time>{getElaspsed(c.time, c.now)}</span></span>
: <span>{translate('Request access to your device')}{"..."}</span>}
</div>
</div>
</div>
<div />
@ -472,12 +475,13 @@ function updateTime() {
self.timer(1s, function() {
var now = new Date();
connections.map(function(c) {
if (!c.authorized) c.time = now;
if (!c.disconnected) c.now = now;
});
var el = $(#time);
if (el) {
var c = connections[body.cur];
if (c && !c.disconnected) {
if (c && c.authorized && !c.disconnected) {
el.text = getElaspsed(c.time, c.now);
}
}