parent
1523a15b8e
commit
ed36b7286e
|
|
@ -135,8 +135,7 @@ function timerCalc() {
|
||||||
let timerfn = exitApp;
|
let timerfn = exitApp;
|
||||||
let timerdly = 10000;
|
let timerdly = 10000;
|
||||||
let id = state.id;
|
let id = state.id;
|
||||||
if (id != -1) {
|
if (id != -1 && state.hotp.hotp != "") {
|
||||||
if (state.hotp.hotp != "") {
|
|
||||||
if (tokens[id].period > 0) {
|
if (tokens[id].period > 0) {
|
||||||
// timed HOTP
|
// timed HOTP
|
||||||
if (state.hotp.next < Date.now()) {
|
if (state.hotp.next < Date.now()) {
|
||||||
|
|
@ -164,7 +163,6 @@ function timerCalc() {
|
||||||
timerfn = updateCurrentToken;
|
timerfn = updateCurrentToken;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (state.drawtimer) {
|
if (state.drawtimer) {
|
||||||
clearTimeout(state.drawtimer);
|
clearTimeout(state.drawtimer);
|
||||||
}
|
}
|
||||||
|
|
@ -183,8 +181,7 @@ function updateProgressBar() {
|
||||||
|
|
||||||
function drawProgressBar() {
|
function drawProgressBar() {
|
||||||
let id = state.id;
|
let id = state.id;
|
||||||
if (id != -1) {
|
if (id != -1 && tokens[id].period > 0) {
|
||||||
if (tokens[id].period > 0) {
|
|
||||||
let rem = Math.floor((state.hotp.next - Date.now()) / 1000);
|
let rem = Math.floor((state.hotp.next - Date.now()) / 1000);
|
||||||
if (rem >= 0) {
|
if (rem >= 0) {
|
||||||
let y1 = tokenY(id);
|
let y1 = tokenY(id);
|
||||||
|
|
@ -208,7 +205,6 @@ function drawProgressBar() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// id = token ID number (0...)
|
// id = token ID number (0...)
|
||||||
|
|
@ -265,10 +261,10 @@ function drawToken(id) {
|
||||||
drawProgressBar();
|
drawProgressBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g.setClipRect(0, 0, g.getWidth(), g.getHeight());
|
g.setClipRect(0, 0, g.getWidth() - 1, g.getHeight() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function startupDraw() {
|
function drawAll() {
|
||||||
if (tokens.length > 0) {
|
if (tokens.length > 0) {
|
||||||
let id = 0;
|
let id = 0;
|
||||||
let y = tokenY(id);
|
let y = tokenY(id);
|
||||||
|
|
@ -391,8 +387,13 @@ function bangle1Btn(e) {
|
||||||
id = E.clip(id, 0, tokens.length - 1);
|
id = E.clip(id, 0, tokens.length - 1);
|
||||||
var fakee = {b:1,x:0,y:0,dx:0};
|
var fakee = {b:1,x:0,y:0,dx:0};
|
||||||
fakee.dy = state.listy - E.clip(id * TOKEN_HEIGHT - half(AR.h - TOKEN_HEIGHT), 0, tokens.length * TOKEN_HEIGHT - AR.h);
|
fakee.dy = state.listy - E.clip(id * TOKEN_HEIGHT - half(AR.h - TOKEN_HEIGHT), 0, tokens.length * TOKEN_HEIGHT - AR.h);
|
||||||
onDrag(fakee);
|
//onDrag(fakee);
|
||||||
changeId(id);
|
//changeId(id);
|
||||||
|
// onDrag() (specifically g.scroll()) doesn't appear to work with the Bangle1
|
||||||
|
state.id = id;
|
||||||
|
state.hotp.hotp = CALCULATING;
|
||||||
|
state.listy -= fakee.dy;
|
||||||
|
drawAll();
|
||||||
} else {
|
} else {
|
||||||
timerCalc();
|
timerCalc();
|
||||||
}
|
}
|
||||||
|
|
@ -415,5 +416,5 @@ if (typeof BTN2 == 'number') {
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
const AR = Bangle.appRect;
|
const AR = Bangle.appRect;
|
||||||
g.clear(); // Clear the screen once, at startup
|
g.clear(); // Clear the screen once, at startup
|
||||||
startupDraw();
|
drawAll();
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue