more work on google play v2 logins

This commit is contained in:
Eric 2022-11-16 08:00:32 -08:00
parent 450c4770a4
commit e3f3f28c62
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
7 changed files with 161 additions and 83 deletions

View File

@ -4003,50 +4003,50 @@
"assets/src/ba_data/python/ba/_generated/__init__.py": "https://files.ballistica.net/cache/ba1/ee/e8/cad05aa531c7faf7ff7b96db7f6e",
"assets/src/ba_data/python/ba/_generated/enums.py": "https://files.ballistica.net/cache/ba1/1c/77/ac670a5118abdf8a7687af0e159b",
"ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a",
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/d0/2d/5ba2ae8fdd8ec38082ab0b471c3e",
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/72/69/753d1c239352656618c4987e9f2b",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c0/e3/61ece7bc939f549f8675ead9d9bf",
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/1d/2e/a41e2a742a66287ccf81e08b9726",
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/5e/37/cc067903b234596ef9176cebbdec",
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/d5/53/29691d4d3d044fad89ef4308495f",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/91/2b/1c1a3b96d1e9230f12cd921901fd",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/4c/8b/6d9a52744c4ece964a5c2b6e5be1",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/88/12/76637bbaa25d6fec32285a4b13a5",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/ce/bd/85386b90badc4c751ba7310b5f43",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c3/e2/af79d4f0710a6fecf0390dd7a2c6",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/53/a7/08303f6fafc37e9d1c7948dbc6c7",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/71/b8/39b1ca3d01e13b54454da847500e",
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/82/be/8eb198cd8bf25d5987e166563264",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a7/68/f6c73860e8cda226a3a4890404e8",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/51/e6/b273a1c7ec54b8cb45f4cf1a475b",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/07/cc/dc3cfbcfc0c579b08de0dfaa5a8a",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/ca/a4/b70093becb628ba5749f65576e5e",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/43/03/dfb3bbb72ff8e20a7d455e0b0a7a",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/8f/18/6118624ce297c36db89f093b8841",
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/57/96/4cbfe1f81e4ca60d9e9784efb94d",
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9b/6d/0e4fbe33cb0d4788f5596e19a513",
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/14/a3/5897210b586a1b0dafe050a23935",
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4d/4f/a1597dbe27a0966837767e3a123b",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a9/0f/5db9c428e11f2a26ead2f3dd4328",
"build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/5e/e5/529dd532d1a6efc96f3c188d5313",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/90/e7/9eb8b31b08b3b0f0cec560c681c8",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/73/6d/b3d59317a6398d722484a362a77a",
"build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b2/34/59d72cb97e7176575e9f4b63be79",
"build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/20/b4/72eab8c7eb4c9bc07e414c4d5550",
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/12/d6/b4bcc5631b1e3a126dfc3fe62700",
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/45/e4/7ca842d2db36bb16b99a5913077f",
"build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/13/6a/523c0f271ea69bf351c61bb96d15",
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/58/24/5276a52c6e65d8c4e7e0ce0c4a3c",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/0b/f4/f7435e1af6365e113b2cc7cfcd3d",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/62/82/99c33a0e1e100c3cba13f9ceab16",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/c2/96/73f89a464ea88959b217db32f2d9",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/92/81/55efdae351ebba06dded2d5721aa",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/49/7e/b7ced9f50ac2618e9348c7d07d36",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/3f/f9/ff2c03e03d2c0380e5a3434d4bed",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/b8/79/303407d4f83e25f801dcafaa88f3",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/5c/76/e6ec57882e720f980d4b05b8aa42",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/73/8e/7539498b3d2c215bcd991ebd1839",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/24/49/f3038ed9884a531ececf97aa5b9a",
"build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/bd/82/98ea775b22a1113323a1ddf12b6a",
"build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/e1/0d/0a431edcdee394a4e4d5b18608d7",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e8/94/162a944636170ac881d3f3dfd805",
"build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/f8/96/fea047474c276064176b65f7e48a",
"build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/12/eb/226aba01e295a807614c64c44d40",
"build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/23/71/f60c8e90699d887979c4ad26a2e2",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/8d/80/05e3d712c67d0fcde0e8605d0be7",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/7f/05/498a538fd28fcd1de964c046b8f2",
"build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/d1/6e/01e46632d17db0597d1aef3394d1",
"build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/aa/12/7992a25feae2b0bf2c8fe2023187",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/99/a9/2b251e46b2e9e4ef143a0308d9f3",
"build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/6a/93/faee77acd35111d083998df65aaa",
"build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/25/c1/9b6efb09c364beae30a40510bfcf",
"build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/18/76/3f8e144f6727ee8f5f5f4b0b6ddc",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/3c/e8/02284ba36b4de9ca68cdd7c3e689",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/15/cf/c02041bdc6fa5d0042408e591dcf",
"build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/62/98/ee64d80a6332d7d9fc57a2605a2d",
"build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/54/e6/c4c75d29a7c19c34ba5876c4c350",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/69/3c/96b8690702f596182a305b5b4489",
"build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/b4/b4/81668b3afad33372276a46545aae",
"build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c3/1a/ae199ada4bf5a649f73fe1663868",
"build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a2/4f/2cf4047fdbac4a661ca99d4aedb8",
"build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/06/f5/b0fdcf55008fc53e1660f7bc841f",
"build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2c/af/159cc0021a3751da19f4d6832602",
"build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/cc/4d/0586cbf47105ba1224a445cd72f4",
"build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f8/33/ae7f84447a19e465c134355b359e",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/40/eb/004a4ea3094210114fd739cb9fcb",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/45/ed/36918bf061396d6e1f9814afce8c",
"build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8f/28/7c06af16187bf2db92cf99763f4e",
"build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/44/69/aeba19cb88e6b57c4ab9325f5877",
"build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/69/4e/b8354e50de6f2afb45b342919868",
"build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/70/65/f35430e7328bc7ac30de3960dfc7",
"build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d8/47/c89b62ea5a71854b303f9e85e5d7",
"build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f2/19/280f6773b3563e012ad6bfad33dc",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1e/17/e5ef6ce0e41360a43c63ef9c0974",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/cd/78/1adf82e5c3e456d2ea2d4290c61c",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/6b/5f/c5dc0b2a2809bc1d3ea57fb985d0",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/56/ee/49a4a2d7940fd239a66c04657c90",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/39/72/fb9b3400c5d128ad156818ede03d",
"build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/22/65/550d27a960822b8846c0c0a440be",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/33/3b/9b38515580edd4616f9955f7e33c",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/fe/1a/80ddcd73df9985ab768e617a6c2b",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/1d/27/0d69901bb721f986fdbfc490100f",
"build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/e9/59/ab5278ceeae3656f91c6d3c68c83",
"src/ballistica/generated/python_embedded/binding.inc": "https://files.ballistica.net/cache/ba1/25/77/8093dfffddaa80cd513ddaa61867",
"src/ballistica/generated/python_embedded/bootstrap.inc": "https://files.ballistica.net/cache/ba1/2d/4f/f4fe67827f36cd59cd5193333a02",
"src/ballistica/generated/python_embedded/bootstrap_monolithic.inc": "https://files.ballistica.net/cache/ba1/ef/c1/aa5f1aa10af89f5c0b1e616355fd"

View File

@ -1,10 +1,11 @@
### 1.7.14 (build 20929, api 7, 2022-11-15)
### 1.7.14 (build 20934, api 7, 2022-11-16)
- Android Google Play logins now provide V2 accounts with access to all V2 features such as a globally-unique account tag, cloud-console, and workspaces. They should still retain their V1 data as well.
- V2 accounts now have a 'Manage Account' button in the app account window which will sign you into a browser with your current account.
- Removed Google App Invite functionality which has been deprecated for a while now. Google Play users can still get tickets by sharing the app via codes (same as other platforms).
- Updated Android root-detection library to the latest version. Please holler if you are getting new false 'your device is rooted' errors when trying to play tournaments or anything like that.
- Removed a few obsolete internal functions: `_ba.is_ouya_build()`, `_ba.android_media_scan_file()`.
- Renaming some methods/data to disambiguate 'login' vs 'sign-in', both in the app and on ballistica.net. Those two terms are somewhat ambiguous and interchangeable in English and can either be a verb or a noun. I'd like to keep things clear in Ballistica by always using 'sign-in' for the verb form and 'login' for the noun. For example: 'You can now sign in to your account using your Google Play login'.
- WARNING: There are currently some rough edges with Google Play V2 accounts; for example Google Play achievements and leaderboards UIs are not currently showing up. I will be cleaning all of this up before the official 1.7.14 release.
### 1.7.13 (build 20919, api 7, 2022-11-03)
- Android target-sdk has been updated to 33 (Android 13). Please holler if anything seems broken or is behaving differently than before on Android.

View File

@ -4,7 +4,6 @@
from __future__ import annotations
import logging
from typing import TYPE_CHECKING
import _ba
@ -203,13 +202,29 @@ class AccountV2Subsystem:
and not signed_in_v2
and self._implicit_signed_in_adapter is not None
):
self._auto_signed_in = True
self._auto_signed_in = True # Only attempt this once
self._implicit_signed_in_adapter.sign_in(self._on_sign_in_completed)
def _on_sign_in_completed(
self, result: LoginAdapter.SignInResult | Exception
self,
adapter: LoginAdapter,
result: LoginAdapter.SignInResult | Exception,
) -> None:
logging.debug('GOT SIGN-IN COMPLETED WITH %s', result)
from ba._internal import get_v1_account_state
del adapter # Unused.
# Silently ignore errors.
if isinstance(result, Exception):
return
# If we're still connected and still not signed in,
# plug in the credentials we got.
connected = _ba.app.cloud.is_connected()
signed_in_v1 = get_v1_account_state() == 'signed_in'
signed_in_v2 = _ba.app.accounts_v2.have_primary_credentials()
if connected and not signed_in_v1 and not signed_in_v2:
_ba.app.accounts_v2.set_primary_credentials(result.credentials)
def _on_set_active_workspace_completed(self) -> None:
if not self._initial_login_completed:

View File

@ -47,7 +47,7 @@ def bootstrap() -> None:
# Give a soft warning if we're being used with a different binary
# version than we expect.
expected_build = 20929
expected_build = 20934
running_build: int = env['build_number']
if running_build != expected_build:
print(

View File

@ -15,7 +15,7 @@ if TYPE_CHECKING:
from typing import Callable
DEBUG_LOG = True
DEBUG_LOG = False
class LoginAdapter:
@ -34,6 +34,8 @@ class LoginAdapter:
class SignInResult:
"""Describes the final result of a sign-in attempt."""
credentials: str
@dataclass
class ImplicitLoginState:
"""Describes the current state of an implicit login."""
@ -135,7 +137,8 @@ class LoginAdapter:
@final
def sign_in(
self, result_cb: Callable[[SignInResult | Exception], None]
self,
result_cb: Callable[[LoginAdapter, SignInResult | Exception], None],
) -> None:
"""Attempt an explicit sign in via this adapter.
@ -146,8 +149,6 @@ class LoginAdapter:
assert _ba.in_logic_thread()
from ba._general import Call
del result_cb # Unused.
if DEBUG_LOG:
logging.debug(
'LoginAdapter: %s adapter sign_in() called;'
@ -167,7 +168,11 @@ class LoginAdapter:
self.login_type.name,
)
_ba.pushcall(
Call(result_cb, RuntimeError('fetch-sign-in-token failed'))
Call(
result_cb,
self,
RuntimeError('fetch-sign-in-token failed'),
)
)
return
@ -184,29 +189,44 @@ class LoginAdapter:
def _got_sign_in_response(
response: bacommon.cloud.SignInResponse | Exception,
) -> None:
from ba._language import Lstr
# from ba._language import Lstr
if DEBUG_LOG:
logging.debug(
'LoginAdapter: %s adapter got sign-in response %s...',
self.login_type.name,
response,
)
if isinstance(response, Exception):
_ba.screenmessage(
Lstr(resource='errorText'), color=(1, 0, 0)
)
_ba.playsound(_ba.getsound('error'))
if DEBUG_LOG:
logging.debug(
'LoginAdapter: %s adapter got error'
' sign-in response: %s',
self.login_type.name,
response,
)
# _ba.screenmessage(
# Lstr(resource='errorText'), color=(1, 0, 0)
# )
# _ba.playsound(_ba.getsound('error'))
_ba.pushcall(Call(result_cb, self, response))
else:
_ba.app.accounts_v2.set_primary_credentials(
response.credentials
)
if DEBUG_LOG:
logging.debug(
'LoginAdapter: %s adapter got successful'
' sign-in response',
self.login_type.name,
)
if response.credentials is None:
result2: LoginAdapter.SignInResult | Exception = (
RuntimeError('No credentials returned.')
)
else:
result2 = self.SignInResult(
credentials=response.credentials
)
_ba.pushcall(Call(result_cb, self, result2))
_ba.app.cloud.send_message_cb(
bacommon.cloud.SignInMessage(self.login_type, result),
on_response=_got_sign_in_response,
)
# Kick off the process by fetching a sign-in token.
self.get_sign_in_token(completion_cb=_got_sign_in_token_result)
def get_sign_in_token(

View File

@ -33,6 +33,7 @@ class AccountSettingsWindow(ba.Window):
self._sign_in_v2_proxy_button: ba.Widget | None = None
self._sign_in_device_button: ba.Widget | None = None
self._signing_in_adapter: LoginAdapter | None = None
self._close_once_signed_in = close_once_signed_in
ba.set_analytics_screen('Account Window')
@ -228,10 +229,10 @@ class AccountSettingsWindow(ba.Window):
# pylint: disable=cyclic-import
from bastd.ui import confirm
account_state = ba.internal.get_v1_account_state()
v1_state = ba.internal.get_v1_account_state()
account_type = (
ba.internal.get_v1_account_type()
if account_state == 'signed_in'
if v1_state == 'signed_in'
else 'unknown'
)
@ -246,19 +247,24 @@ class AccountSettingsWindow(ba.Window):
show_sign_in_benefits = not self._signed_in
sign_in_benefits_space = 80.0
show_signing_in_text = account_state == 'signing_in'
show_signing_in_text = (
v1_state == 'signing_in' or self._signing_in_adapter is not None
)
signing_in_text_space = 80.0
show_google_play_sign_in_button = (
account_state == 'signed_out'
v1_state == 'signed_out'
and self._signing_in_adapter is None
and 'Google Play' in self._show_sign_in_buttons
)
show_device_sign_in_button = (
account_state == 'signed_out'
v1_state == 'signed_out'
and self._signing_in_adapter is None
and 'Local' in self._show_sign_in_buttons
)
show_v2_proxy_sign_in_button = (
account_state == 'signed_out'
v1_state == 'signed_out'
and self._signing_in_adapter is None
and 'V2Proxy' in self._show_sign_in_buttons
)
sign_in_button_space = 70.0
@ -326,9 +332,12 @@ class AccountSettingsWindow(ba.Window):
]
sign_out_button_space = 70.0
show_cancel_sign_in_button = (
account_state == 'signing_in'
and ba.app.accounts_v2.have_primary_credentials()
# We can show cancel if we're either waiting on an adapter to
# provide us with v2 credentials or waiting for those credentials
# to be verified.
show_cancel_sign_in_button = self._signing_in_adapter is not None or (
ba.app.accounts_v2.have_primary_credentials()
and ba.app.accounts_v2.primary is None
)
cancel_sign_in_button_space = 70.0
@ -1239,9 +1248,15 @@ class AccountSettingsWindow(ba.Window):
)
def _cancel_sign_in_press(self) -> None:
# Just say we don't wanna be signed in anymore.
# If we're waiting on an adapter to give us credentials, abort.
self._signing_in_adapter = None
# Say we don't wanna be signed in anymore if we are.
ba.app.accounts_v2.set_primary_credentials(None)
self._needs_refresh = True
# Speed UI updates along.
ba.timer(0.1, ba.WeakCall(self._update), timetype=ba.TimeType.REAL)
@ -1284,17 +1299,44 @@ class AccountSettingsWindow(ba.Window):
# V2 login sign-in buttons generally go through adapters.
adapter = ba.app.accounts_v2.login_adapters.get(login_type)
if adapter is not None:
self._signing_in_adapter = adapter
adapter.sign_in(
result_cb=ba.WeakCall(self._on_adapter_sign_in_result)
)
# Will get 'Signing in...' to show.
self._needs_refresh = True
ba.timer(0.1, ba.WeakCall(self._update), timetype=ba.TimeType.REAL)
else:
ba.screenmessage(f'Unsupported login_type: {login_type.name}')
def _on_adapter_sign_in_result(
self, result: LoginAdapter.SignInResult | Exception
self,
adapter: LoginAdapter,
result: LoginAdapter.SignInResult | Exception,
) -> None:
ba.screenmessage('GOT SIGN IN RESULT')
logging.debug('GOT SIGN IN RESULT %s', result)
is_us = self._signing_in_adapter is adapter
# If this isn't our current one we don't care.
if not is_us:
return
# If it is us, note that we're done.
self._signing_in_adapter = None
if isinstance(result, Exception):
# For now just make a bit of noise if anything went wrong;
# can get more specific as needed later.
ba.screenmessage(ba.Lstr(resource='errorText'), color=(1, 0, 0))
ba.playsound(ba.getsound('error'))
else:
# Success! Plug in these credentials which will begin
# verifying them and set our primary account-handle
# when finished.
ba.app.accounts_v2.set_primary_credentials(result.credentials)
# Speed any UI updates along.
self._needs_refresh = True
ba.timer(0.1, ba.WeakCall(self._update), timetype=ba.TimeType.REAL)
def _v2_proxy_sign_in_press(self) -> None:
# pylint: disable=cyclic-import

View File

@ -32,7 +32,7 @@
namespace ballistica {
// These are set automatically via script; don't modify them here.
const int kAppBuildNumber = 20929;
const int kAppBuildNumber = 20934;
const char* kAppVersion = "1.7.14";
// Our standalone globals.