Skip to content

Commit

Permalink
troubleshoot iOS < 10 oauth button
Browse files Browse the repository at this point in the history
  • Loading branch information
schlawg committed Jan 15, 2025
1 parent 9d99dd0 commit 94d37e9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion modules/oauth/src/main/ui/AuthorizeUi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ final class AuthorizeUi(helpers: Helpers)(lightUserFallback: UserId => LightUser
)
case None =>
submitButton(
cls := List(s"${buttonClass(prompt)} disabled" -> true, "danger" -> isDanger),
cls := List(s"${buttonClass(prompt)} disabled" -> true),
dataIcon := isDanger.option(Icon.CautionTriangle),
disabled := true,
id := "oauth-authorize",
Expand Down
6 changes: 2 additions & 4 deletions ui/bits/src/bits.oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
// as the oauth page can be embedded in very dubious webviews

const el: HTMLElement = document.getElementById('oauth-authorize')!;
const danger: boolean = el.classList.contains('danger');

setTimeout(
() => {
el.removeAttribute('disabled');
el.className = 'button';
if (danger) el.classList.add('button-red', 'ok-cancel-confirm', 'text');
el.classList.remove('disabled');
},
danger ? 5000 : 2000,
el.classList.contains('button-red') ? 5000 : 2000,
);
4 changes: 2 additions & 2 deletions ui/local/src/gameCtrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ export class GameCtrl {
this.triggerStart();
}

reset(params: LocalSetup): void {
reset(params?: LocalSetup): void {
this.stop();
this.history = undefined;
this.live = new LocalGame({ setup: { ...params } });
this.live = new LocalGame({ setup: { ...this.live.setup, ...params } });
env.bot.reset();
env.bot.setUids(this.live);
env.assets.preload();
Expand Down
20 changes: 10 additions & 10 deletions ui/local/src/localGame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,6 @@ export class LocalGame implements LocalSetup {
return co.fen.makeFen(this.chess.toSetup());
}

get setup(): LocalSetup {
return {
initialFen: this.initialFen,
initial: this.initial,
increment: this.increment,
white: this.white,
black: this.black,
};
}

get dests(): { [from: string]: string } {
return Object.fromEntries([...this.cgDests].map(([src, dests]) => [src, dests.join('')]));
}
Expand Down Expand Up @@ -226,6 +216,16 @@ export class LocalGame implements LocalSetup {
}
return draws;
}

get setup(): LocalSetup {
return {
initialFen: this.initialFen,
initial: this.initial,
increment: this.increment,
white: this.white,
black: this.black,
};
}
}

export function normalMove(chess: co.Chess, uci: Uci): { uci: Uci; move: co.NormalMove } | undefined {
Expand Down
2 changes: 1 addition & 1 deletion ui/local/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export type MoveResult = { uci: string; thinkTime: Seconds };
export interface LocalSetup {
white?: string;
black?: string;
initialFen?: string;
initialFen?: FEN;
initial?: Seconds;
increment?: Seconds;
go?: boolean;
Expand Down

0 comments on commit 94d37e9

Please sign in to comment.