moved v2 accounts under plus subsystem

This commit is contained in:
Eric 2023-06-04 21:24:04 -07:00
parent 26cc24d345
commit a393d014a6
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
10 changed files with 114 additions and 83 deletions

View File

@ -4072,50 +4072,50 @@
"build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/c5/09/4f10b8a21ba87aa5509cff7a164b", "build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/c5/09/4f10b8a21ba87aa5509cff7a164b",
"build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/ff/0a/a354984f9c074dab0676ac7e4877", "build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/ff/0a/a354984f9c074dab0676ac7e4877",
"build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/2a/1c/9ee5db6d1bceca7fa6638fb8abde", "build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/2a/1c/9ee5db6d1bceca7fa6638fb8abde",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/1b/d0/f94119594604e67652924b434416", "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/82/20/d88ac9183152d3fff627c085156b",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/13/18/48dc17a460c2ee0fa4a22b2d8005", "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/27/bd/08e8940bf210e405498e22c5a562",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/c2/2d/bf75444af834501f9e443618786c", "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/61/6e/21407a080ea17b106bdd8f76dc1b",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/ec/88/ab5016ebb0ad9bdce10301267793", "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/54/96/c8a9a5f6d1a9beff596fa933f7c7",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/2c/1d/e26f457ba90fdd700dee7cc6252b", "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/4c/87/6465e89fc281a13474e80b3830cc",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/04/f5/59af762745bef4e8660e95a07226", "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/5c/83/67b651e2873751f56f0f68eeb356",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/0f/32/d374d10065061ee0a6ca67b6a4af", "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/df/73/75f0101efebeb4dca2cc106880b9",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/94/30/c61c2114828f360d21bf81d2c39a", "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/26/02/69eb7a7719ff1549a200bbfda9e6",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/4c/2b/c6aa202a104e49c82461e6d084af", "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/64/44/b3f73b55e0ad8607004eadfb26a0",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/94/ff/ac435f0ade27ad8220c945e77c2b", "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/53/5e/6562e551f506dd6ab758eef90b8e",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/21/b5/7f010c0be5f14b2b14a823afba57", "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/3b/e7/d23a4ebce96bd2b0aa4afca690cd",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/12/75/79f8ec088e1c946e9d60db3e91cf", "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/bf/5d/edb9317ef7a0aefd1123c3e37b0d",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/d9/e1/4791926365ecf2a19b9528163ae0", "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/26/0a/2f0bf14a05e9a301bd39f72e93f3",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/e0/99/a86cb331308904b24f1a48342d2d", "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/29/bc/072199165f1d4f37c789f5495582",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/94/7d/aa5e4fb93de4681bb4bf002e28cf", "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/0f/7d/aa71783907138adbb07918581fad",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d1/cf/fa4136e93ded15dbab93fd57d1b8", "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/a3/9b/06ad43e3e318cd42ae2632a45555",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/b4/0e/1522c860e33f5001f71cfe12aa7a", "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/46/d9/2a66ac6c6f8b4227876e35d127ce",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/a5/fb/cb9bb39ac98d0c5b0747094f54c2", "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/1b/16/91b80d81b3d517f258e80c8a8a40",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/63/60/cba991152f215d0e6ff1b0801a54", "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/97/e2/55c945ef87a0271dba2667695d93",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/2a/29/e323dbaaa208c40a569d85a82527", "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/f4/09/a4348a49f4340bd4d69b87b6a277",
"build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/0f/d7/034299d84dde9b8a36933c3d6640", "build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/d8/0d/b5717dd9fd02bcbe914bf071c978",
"build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/8c/0c/209d7fef648785021b2442b92a37", "build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/b5/29/14ac971b2cdea603a2a57e1e94c7",
"build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/de/6b/14e766a2d2db860276553b7c3e9d", "build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/6d/4f/1b7acb823bd7503e0ed8ee619295",
"build/prefab/lib/linux_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/db/d6/42e603000c13737e60f693336d4e", "build/prefab/lib/linux_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/93/76/765a91d310cdb00e75cb81774145",
"build/prefab/lib/linux_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/95/86/052441f8ccaa13006c9d38dbb79d", "build/prefab/lib/linux_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/ba/02/09d36a52e5cdaf42c01e06c7b47b",
"build/prefab/lib/linux_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/64/40/f06fe4f0d7537e50b6e880c6590c", "build/prefab/lib/linux_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/c6/22/1e9463ab9fd863b31e2653d4a8c0",
"build/prefab/lib/linux_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/ed/bf/45c4771f7d77985b26f3612591e0", "build/prefab/lib/linux_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/9c/25/49b7b8dc100e249ee6b65066db1e",
"build/prefab/lib/linux_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/54/10/a2c3d3a1076eb1b9812b736ca34b", "build/prefab/lib/linux_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/e6/0c/e61fe4918c0a966056be240cac10",
"build/prefab/lib/mac_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/c3/2d/e1e05f01647e92c65cbcc3599705", "build/prefab/lib/mac_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/aa/be/5e218d5966608f01e2512ea80bd3",
"build/prefab/lib/mac_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/89/cd/db7719b6851e28d7969d807be3d8", "build/prefab/lib/mac_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/86/20/e7a96baf84f78de0f24bef3f7305",
"build/prefab/lib/mac_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/37/43/84a1fc8169db34054378f11fe4c1", "build/prefab/lib/mac_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/28/20/64a26bad7cb6b5c0db53b1bb3124",
"build/prefab/lib/mac_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/5b/cb/4be9adf2aa44aae442bda6f39112", "build/prefab/lib/mac_arm64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/07/04/3290f33262d54af2d8b44fe87eed",
"build/prefab/lib/mac_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/3d/92/ea42decffa28fb7540d72248f79e", "build/prefab/lib/mac_x86_64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/2a/38/0ca29cce468e61421829d3bacae3",
"build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/8a/34/5d1b029d1a393139890f600ff91d", "build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/aa/48/320c3e3858c0fd25c304922f6602",
"build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/98/e0/0772edc2ae173e7f8ab07d4e1230", "build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/48/4f/4fc37b53ccc62c552b5255306912",
"build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/ba/f0/c7dcdd6472a348663d104d490e77", "build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/d7/0b/e41f188e0425316039315b238e72",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/ef/f4/61c64323efa3fd0b1e6ef2042d2e", "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/52/ce/f22e458249e21addd27e4138da94",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/43/58/6797ab58417599aefa2719e9ed70", "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/21/59/ad3bf492800dbaca2b2edca48fe2",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/8d/9d/6e683b4a8ff61138041318470352", "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/c3/e8/9c75f61b01c5b9ae66f66cd19666",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/b6/1a/ad49bd349c7c0f59a6dcf2efd70e", "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/e3/13/ff1c971694f6c9d9854bd2666e07",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/df/7a/6bdd5096bb65a99d39d922b1743a", "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/b7/e1/809a020e16a1933e53606a8e0283",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/fb/15/19719ece74758579110612e93adb", "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/19/e8/25e93d897669ef9fd075e397b8f2",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/80/fe/13417c54861d3bc076c173590175", "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/a5/aa/0f903bb779e465f14ff842f6303f",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/2b/32/3d8e3e131fd27908742aac0df030", "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/d0/ee/7dc6b4aff72fa9d9bdf9a709d99b",
"src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/52/c6/c11130af7b10d6c0321add5518fa", "src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/52/c6/c11130af7b10d6c0321add5518fa",
"src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/38/c3/1dedd5e74f2508efc5974c8815a1", "src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/38/c3/1dedd5e74f2508efc5974c8815a1",
"src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/d5/4a/0e480a855ce83709bd7f6761107d", "src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/d5/4a/0e480a855ce83709bd7f6761107d",

View File

@ -255,6 +255,11 @@
precompiled native portion of the `plus` feature set). Also by removing the precompiled native portion of the `plus` feature set). Also by removing the
'kit' from the end it will no longer be renamed in spinoff projects, meaning 'kit' from the end it will no longer be renamed in spinoff projects, meaning
we should be able to recycle the same built libraries in those cases. we should be able to recycle the same built libraries in those cases.
- Moved `babase.app.accounts` to `babase.app.plus.accounts`. This is a little
more verbose but is cleaner in a way since that functionality is part of plus
and is not available when plus is missing. So now there's
`babase.app.classic.accounts` for v1 stuff and `babase.app.plus.accounts` for
v2 stuff.
### 1.7.19 (build 20997, api 7, 2023-01-19) ### 1.7.19 (build 20997, api 7, 2023-01-19)

View File

@ -273,7 +273,7 @@ class AccountV2Subsystem:
'AccountV2: Signing out as result' 'AccountV2: Signing out as result'
' of implicit state change...', ' of implicit state change...',
) )
_babase.app.accounts.set_primary_credentials(None) plus.accounts.set_primary_credentials(None)
self._implicit_state_changed = False self._implicit_state_changed = False
# Once we've made a move here we don't want to # Once we've made a move here we don't want to
@ -318,7 +318,7 @@ class AccountV2Subsystem:
# may be auto-signed back in). # may be auto-signed back in).
connected = _babase.app.cloud.is_connected() connected = _babase.app.cloud.is_connected()
signed_in_v1 = plus.get_v1_account_state() == 'signed_in' signed_in_v1 = plus.get_v1_account_state() == 'signed_in'
signed_in_v2 = _babase.app.accounts.have_primary_credentials() signed_in_v2 = plus.accounts.have_primary_credentials()
if ( if (
connected connected
and not signed_in_v1 and not signed_in_v1
@ -344,6 +344,9 @@ class AccountV2Subsystem:
del adapter # Unused. del adapter # Unused.
plus = _babase.app.plus
assert plus is not None
# Make some noise on errors since the user knows a # Make some noise on errors since the user knows a
# sign-in attempt is happening in this case (the 'explicit' part). # sign-in attempt is happening in this case (the 'explicit' part).
if isinstance(result, Exception): if isinstance(result, Exception):
@ -365,10 +368,10 @@ class AccountV2Subsystem:
# Also I suppose we should sign them out in this case since # Also I suppose we should sign them out in this case since
# it could be misleading to be still signed in with the old # it could be misleading to be still signed in with the old
# account. # account.
_babase.app.accounts.set_primary_credentials(None) plus.accounts.set_primary_credentials(None)
return return
_babase.app.accounts.set_primary_credentials(result.credentials) plus.accounts.set_primary_credentials(result.credentials)
def _on_implicit_sign_in_completed( def _on_implicit_sign_in_completed(
self, self,
@ -399,9 +402,9 @@ class AccountV2Subsystem:
# kicked off. # kicked off.
connected = _babase.app.cloud.is_connected() connected = _babase.app.cloud.is_connected()
signed_in_v1 = plus.get_v1_account_state() == 'signed_in' signed_in_v1 = plus.get_v1_account_state() == 'signed_in'
signed_in_v2 = _babase.app.accounts.have_primary_credentials() signed_in_v2 = plus.accounts.have_primary_credentials()
if connected and not signed_in_v1 and not signed_in_v2: if connected and not signed_in_v1 and not signed_in_v2:
_babase.app.accounts.set_primary_credentials(result.credentials) plus.accounts.set_primary_credentials(result.credentials)
def _on_set_active_workspace_completed(self) -> None: def _on_set_active_workspace_completed(self) -> None:
if not self._initial_sign_in_completed: if not self._initial_sign_in_completed:

View File

@ -28,7 +28,6 @@ if TYPE_CHECKING:
from efro.log import LogHandler from efro.log import LogHandler
import babase import babase
from babase import CloudSubsystem, AppIntent, AppMode, AppSubsystem from babase import CloudSubsystem, AppIntent, AppMode, AppSubsystem
from babase._accountv2 import AccountV2Subsystem
from babase._apputils import AppHealthMonitor from babase._apputils import AppHealthMonitor
# __FEATURESET_APP_SUBSYSTEM_IMPORTS_BEGIN__ # __FEATURESET_APP_SUBSYSTEM_IMPORTS_BEGIN__
@ -53,8 +52,6 @@ class App:
# pylint: disable=too-many-public-methods # pylint: disable=too-many-public-methods
# Implementations for these will be filled in by internal libs.
accounts: AccountV2Subsystem
cloud: CloudSubsystem cloud: CloudSubsystem
plugins: PluginSubsystem plugins: PluginSubsystem
@ -517,10 +514,10 @@ class App:
if self.plus is not None: if self.plus is not None:
self.plus.on_app_launching() self.plus.on_app_launching()
self.accounts.on_app_launching() # self.accounts.on_app_launching()
# Make sure this runs after we init our accounts stuff, since # Make sure this runs after we init our plus, since
# classic accounts key off of our v2 ones. # classic accounts here key off of our v2 ones in plus.
if self.classic is not None: if self.classic is not None:
self.classic.on_app_launching() self.classic.on_app_launching()
@ -683,6 +680,7 @@ class App:
def on_app_resume(self) -> None: def on_app_resume(self) -> None:
"""Called when resuming.""" """Called when resuming."""
assert _babase.in_logic_thread()
self.fg_state += 1 self.fg_state += 1
# Resume all app subsystems in the same order they were inited. # Resume all app subsystems in the same order they were inited.
@ -696,6 +694,7 @@ class App:
def on_app_shutdown(self) -> None: def on_app_shutdown(self) -> None:
"""(internal)""" """(internal)"""
assert _babase.in_logic_thread()
self.state = self.State.SHUTTING_DOWN self.state = self.State.SHUTTING_DOWN
# Shutdown all app subsystems in the opposite order they were # Shutdown all app subsystems in the opposite order they were

View File

@ -39,9 +39,12 @@ class CloudSubsystem(AppSubsystem):
if DEBUG_LOG: if DEBUG_LOG:
logging.debug('CloudSubsystem: Connectivity is now %s.', connected) logging.debug('CloudSubsystem: Connectivity is now %s.', connected)
plus = _babase.app.plus
assert plus is not None
# Inform things that use this. # Inform things that use this.
# (TODO: should generalize this into some sort of registration system) # (TODO: should generalize this into some sort of registration system)
_babase.app.accounts.on_cloud_connectivity_changed(connected) plus.accounts.on_cloud_connectivity_changed(connected)
@overload @overload
def send_message_cb( def send_message_cb(

View File

@ -342,7 +342,8 @@ def hash_strings(inputs: list[str]) -> str:
def have_account_v2_credentials() -> bool: def have_account_v2_credentials() -> bool:
"""Do we have primary account-v2 credentials set?""" """Do we have primary account-v2 credentials set?"""
return _babase.app.accounts.have_primary_credentials() assert _babase.app.plus is not None
return _babase.app.plus.accounts.have_primary_credentials()
def implicit_sign_in( def implicit_sign_in(
@ -351,7 +352,8 @@ def implicit_sign_in(
"""An implicit login happened.""" """An implicit login happened."""
from bacommon.login import LoginType from bacommon.login import LoginType
_babase.app.accounts.on_implicit_sign_in( assert _babase.app.plus is not None
_babase.app.plus.accounts.on_implicit_sign_in(
login_type=LoginType(login_type_str), login_type=LoginType(login_type_str),
login_id=login_id, login_id=login_id,
display_name=display_name, display_name=display_name,
@ -362,7 +364,8 @@ def implicit_sign_out(login_type_str: str) -> None:
"""An implicit logout happened.""" """An implicit logout happened."""
from bacommon.login import LoginType from bacommon.login import LoginType
_babase.app.accounts.on_implicit_sign_out( assert _babase.app.plus is not None
_babase.app.plus.accounts.on_implicit_sign_out(
login_type=LoginType(login_type_str) login_type=LoginType(login_type_str)
) )
@ -378,7 +381,8 @@ def login_adapter_get_sign_in_token_response(
attempt_id = int(attempt_id_str) attempt_id = int(attempt_id_str)
result = None if result_str == '' else result_str result = None if result_str == '' else result_str
adapter = _babase.app.accounts.login_adapters[login_type] assert _babase.app.plus is not None
adapter = _babase.app.plus.accounts.login_adapters[login_type]
assert isinstance(adapter, LoginAdapterNative) assert isinstance(adapter, LoginAdapterNative)
adapter.on_sign_in_complete(attempt_id=attempt_id, result=result) adapter.on_sign_in_complete(attempt_id=attempt_id, result=result)

View File

@ -306,9 +306,10 @@ class LoginAdapter:
self.login_type.name, self.login_type.name,
) )
assert _babase.app.plus is not None
_babase.pushcall( _babase.pushcall(
Call( Call(
_babase.app.accounts.on_implicit_login_state_changed, _babase.app.plus.accounts.on_implicit_login_state_changed,
self.login_type, self.login_type,
self._implicit_login_state, self._implicit_login_state,
) )

View File

@ -12,6 +12,7 @@ if TYPE_CHECKING:
from typing import Callable, Any from typing import Callable, Any
from babase import App from babase import App
from babase._accountv2 import AccountV2Subsystem
class PlusSubsystem(AppSubsystem): class PlusSubsystem(AppSubsystem):
@ -29,6 +30,13 @@ class PlusSubsystem(AppSubsystem):
# type-checking purposes. Maybe there's some smart way we could skip # type-checking purposes. Maybe there's some smart way we could skip
# the overhead of this wrapper at runtime. # the overhead of this wrapper at runtime.
accounts: AccountV2Subsystem
def on_app_launching(self) -> None:
"""(internal)"""
_baplus.on_app_launching()
self.accounts.on_app_launching()
@staticmethod @staticmethod
def add_v1_account_transaction( def add_v1_account_transaction(
transaction: dict, callback: Callable | None = None transaction: dict, callback: Callable | None = None
@ -154,11 +162,6 @@ class PlusSubsystem(AppSubsystem):
""" """
return _baplus.mark_config_dirty() return _baplus.mark_config_dirty()
@staticmethod
def on_app_launching() -> None:
"""(internal)"""
_baplus.on_app_launching()
@staticmethod @staticmethod
def power_ranking_query(callback: Callable, season: Any = None) -> None: def power_ranking_query(callback: Callable, season: Any = None) -> None:
"""(internal)""" """(internal)"""

View File

@ -95,7 +95,7 @@ class AccountSettingsWindow(bui.Window):
# Determine which sign-in/sign-out buttons we should show. # Determine which sign-in/sign-out buttons we should show.
self._show_sign_in_buttons: list[str] = [] self._show_sign_in_buttons: list[str] = []
if LoginType.GPGS in bui.app.accounts.login_adapters: if LoginType.GPGS in plus.accounts.login_adapters:
self._show_sign_in_buttons.append('Google Play') self._show_sign_in_buttons.append('Google Play')
# Always want to show our web-based v2 login option. # Always want to show our web-based v2 login option.
@ -227,7 +227,7 @@ class AccountSettingsWindow(bui.Window):
plus = bui.app.plus plus = bui.app.plus
assert plus is not None assert plus is not None
primary_v2_account = bui.app.accounts.primary primary_v2_account = plus.accounts.primary
v1_state = plus.get_v1_account_state() v1_state = plus.get_v1_account_state()
v1_account_type = ( v1_account_type = (
@ -237,7 +237,7 @@ class AccountSettingsWindow(bui.Window):
# We expose GPGS-specific functionality only if it is 'active' # We expose GPGS-specific functionality only if it is 'active'
# (meaning the current GPGS player matches one of our account's # (meaning the current GPGS player matches one of our account's
# logins). # logins).
gpgs_adapter = bui.app.accounts.login_adapters.get(LoginType.GPGS) gpgs_adapter = plus.accounts.login_adapters.get(LoginType.GPGS)
is_gpgs = ( is_gpgs = (
False if gpgs_adapter is None else gpgs_adapter.is_back_end_active() False if gpgs_adapter is None else gpgs_adapter.is_back_end_active()
) )
@ -339,7 +339,7 @@ class AccountSettingsWindow(bui.Window):
# provide us with v2 credentials or waiting for those credentials # provide us with v2 credentials or waiting for those credentials
# to be verified. # to be verified.
show_cancel_sign_in_button = self._signing_in_adapter is not None or ( show_cancel_sign_in_button = self._signing_in_adapter is not None or (
bui.app.accounts.have_primary_credentials() plus.accounts.have_primary_credentials()
and primary_v2_account is None and primary_v2_account is None
) )
cancel_sign_in_button_space = 70.0 cancel_sign_in_button_space = 70.0
@ -1164,14 +1164,17 @@ class AccountSettingsWindow(bui.Window):
def _on_manage_account_press(self) -> None: def _on_manage_account_press(self) -> None:
bui.screenmessage(bui.Lstr(resource='oneMomentText')) bui.screenmessage(bui.Lstr(resource='oneMomentText'))
plus = bui.app.plus
assert plus is not None
# We expect to have a v2 account signed in if we get here. # We expect to have a v2 account signed in if we get here.
if bui.app.accounts.primary is None: if plus.accounts.primary is None:
logging.exception( logging.exception(
'got manage-account press without v2 account present' 'got manage-account press without v2 account present'
) )
return return
with bui.app.accounts.primary: with plus.accounts.primary:
bui.app.cloud.send_message_cb( bui.app.cloud.send_message_cb(
bacommon.cloud.ManageAccountMessage(), bacommon.cloud.ManageAccountMessage(),
on_response=bui.WeakCall(self._on_manage_account_response), on_response=bui.WeakCall(self._on_manage_account_response),
@ -1217,8 +1220,11 @@ class AccountSettingsWindow(bui.Window):
bui.textwidget(edit=self._unlink_accounts_button_label, color=clr) bui.textwidget(edit=self._unlink_accounts_button_label, color=clr)
def _should_show_legacy_unlink_button(self) -> bool: def _should_show_legacy_unlink_button(self) -> bool:
plus = bui.app.plus
assert plus is not None
# Only show this when fully signed in to a v2 account. # Only show this when fully signed in to a v2 account.
if not self._v1_signed_in or bui.app.accounts.primary is None: if not self._v1_signed_in or plus.accounts.primary is None:
return False return False
out = self._have_unlinkable_v1_accounts() out = self._have_unlinkable_v1_accounts()
@ -1233,7 +1239,7 @@ class AccountSettingsWindow(bui.Window):
# Disable this by default when signed in to a V2 account # Disable this by default when signed in to a V2 account
# (since this shows V1 links which we should no longer care about). # (since this shows V1 links which we should no longer care about).
if bui.app.accounts.primary is not None and not FORCE_ENABLE_V1_LINKING: if plus.accounts.primary is not None and not FORCE_ENABLE_V1_LINKING:
return return
# if this is not present, we haven't had contact from the server so # if this is not present, we haven't had contact from the server so
@ -1373,8 +1379,11 @@ class AccountSettingsWindow(bui.Window):
# If we're waiting on an adapter to give us credentials, abort. # If we're waiting on an adapter to give us credentials, abort.
self._signing_in_adapter = None self._signing_in_adapter = None
plus = bui.app.plus
assert plus is not None
# Say we don't wanna be signed in anymore if we are. # Say we don't wanna be signed in anymore if we are.
bui.app.accounts.set_primary_credentials(None) plus.accounts.set_primary_credentials(None)
self._needs_refresh = True self._needs_refresh = True
@ -1385,13 +1394,13 @@ class AccountSettingsWindow(bui.Window):
plus = bui.app.plus plus = bui.app.plus
assert plus is not None assert plus is not None
if bui.app.accounts.have_primary_credentials(): if plus.accounts.have_primary_credentials():
if ( if (
bui.app.accounts.primary is not None plus.accounts.primary is not None
and LoginType.GPGS in bui.app.accounts.primary.logins and LoginType.GPGS in plus.accounts.primary.logins
): ):
self._explicitly_signed_out_of_gpgs = True self._explicitly_signed_out_of_gpgs = True
bui.app.accounts.set_primary_credentials(None) plus.accounts.set_primary_credentials(None)
else: else:
plus.sign_out_v1() plus.sign_out_v1()
@ -1427,7 +1436,7 @@ class AccountSettingsWindow(bui.Window):
return return
# V2 login sign-in buttons generally go through adapters. # V2 login sign-in buttons generally go through adapters.
adapter = bui.app.accounts.login_adapters.get(login_type) adapter = plus.accounts.login_adapters.get(login_type)
if adapter is not None: if adapter is not None:
self._signing_in_adapter = adapter self._signing_in_adapter = adapter
adapter.sign_in( adapter.sign_in(
@ -1463,7 +1472,9 @@ class AccountSettingsWindow(bui.Window):
# Success! Plug in these credentials which will begin # Success! Plug in these credentials which will begin
# verifying them and set our primary account-handle # verifying them and set our primary account-handle
# when finished. # when finished.
bui.app.accounts.set_primary_credentials(result.credentials) plus = bui.app.plus
assert plus is not None
plus.accounts.set_primary_credentials(result.credentials)
# Special case - if the user has explicitly logged out and # Special case - if the user has explicitly logged out and
# logged in again with GPGS via this button, warn them that # logged in again with GPGS via this button, warn them that

View File

@ -188,8 +188,10 @@ class V2ProxySignInWindow(bui.Window):
isinstance(response, bacommon.cloud.LoginProxyStateQueryResponse) isinstance(response, bacommon.cloud.LoginProxyStateQueryResponse)
and response.state is response.State.SUCCESS and response.state is response.State.SUCCESS
): ):
plus = bui.app.plus
assert plus is not None
assert response.credentials is not None assert response.credentials is not None
bui.app.accounts.set_primary_credentials(response.credentials) plus.accounts.set_primary_credentials(response.credentials)
# As a courtesy, tell the server we're done with this proxy # As a courtesy, tell the server we're done with this proxy
# so it can clean up (not a huge deal if this fails) # so it can clean up (not a huge deal if this fails)