bastd.ui.account

UI functionality related to accounts.

 1# Released under the MIT License. See LICENSE for details.
 2#
 3"""UI functionality related to accounts."""
 4
 5from __future__ import annotations
 6
 7import ba
 8
 9
10def show_sign_in_prompt(account_type: str | None = None) -> None:
11    """Bring up a prompt telling the user they must sign in."""
12    from bastd.ui.confirm import ConfirmWindow
13    from bastd.ui.account import settings
14    from ba.internal import sign_in_v1
15
16    if account_type == 'Google Play':
17        ConfirmWindow(
18            ba.Lstr(resource='notSignedInGooglePlayErrorText'),
19            lambda: sign_in_v1('Google Play'),
20            ok_text=ba.Lstr(resource='accountSettingsWindow.signInText'),
21            width=460,
22            height=130,
23        )
24    else:
25        ConfirmWindow(
26            ba.Lstr(resource='notSignedInErrorText'),
27            lambda: settings.AccountSettingsWindow(
28                modal=True, close_once_signed_in=True
29            ),
30            ok_text=ba.Lstr(resource='accountSettingsWindow.signInText'),
31            width=460,
32            height=130,
33        )
def show_sign_in_prompt(account_type: str | None = None) -> None:
11def show_sign_in_prompt(account_type: str | None = None) -> None:
12    """Bring up a prompt telling the user they must sign in."""
13    from bastd.ui.confirm import ConfirmWindow
14    from bastd.ui.account import settings
15    from ba.internal import sign_in_v1
16
17    if account_type == 'Google Play':
18        ConfirmWindow(
19            ba.Lstr(resource='notSignedInGooglePlayErrorText'),
20            lambda: sign_in_v1('Google Play'),
21            ok_text=ba.Lstr(resource='accountSettingsWindow.signInText'),
22            width=460,
23            height=130,
24        )
25    else:
26        ConfirmWindow(
27            ba.Lstr(resource='notSignedInErrorText'),
28            lambda: settings.AccountSettingsWindow(
29                modal=True, close_once_signed_in=True
30            ),
31            ok_text=ba.Lstr(resource='accountSettingsWindow.signInText'),
32            width=460,
33            height=130,
34        )

Bring up a prompt telling the user they must sign in.