fix, chore, feat: refactor of settings app, fix of Google Auth migration parse, added rename button(testing), added sort feature, added timeout to screen turning off, formated codes with space between 6-digits codes
Co-authored-by: DemiarUA <demiar97@gmail.com> https://github.com/Lisoveliy/totpfit/pull/1
This commit is contained in:
@@ -22,15 +22,16 @@ function renderContainers(buffer) {
|
||||
}
|
||||
|
||||
const renderData = [];
|
||||
|
||||
function renderTOTPs(buffer) {
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let otpData = TOTP.copy(buffer[i]).getOTP();
|
||||
renderData[i] = {
|
||||
OTP: RenderOTPValue(i, otpData.otp),
|
||||
OTP: RenderOTPValue(i, formatOTP(otpData.otp)),
|
||||
expireBar: RenderExpireBar(
|
||||
i,
|
||||
otpData.createdTime,
|
||||
buffer[i].fetchTime
|
||||
buffer[i].fetchTime,
|
||||
),
|
||||
};
|
||||
setInterval(() => {
|
||||
@@ -38,7 +39,7 @@ function renderTOTPs(buffer) {
|
||||
(Date.now() - otpData.createdTime) /
|
||||
1000 /
|
||||
buffer[i].fetchTime -
|
||||
1
|
||||
1,
|
||||
);
|
||||
|
||||
renderData[i].expireBar.setProperty(prop.MORE, {
|
||||
@@ -49,9 +50,15 @@ function renderTOTPs(buffer) {
|
||||
if (otpData.expireTime < Date.now()) {
|
||||
otpData = TOTP.copy(buffer[i]).getOTP();
|
||||
renderData[i].OTP.setProperty(prop.MORE, {
|
||||
text: otpData.otp,
|
||||
text: formatOTP(otpData.otp),
|
||||
});
|
||||
}
|
||||
}, 50);
|
||||
}
|
||||
}
|
||||
|
||||
function formatOTP(otp) {
|
||||
if (otp.length === 6) return `${otp.substring(0, 3)} ${otp.substring(3)}`;
|
||||
|
||||
return otp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user