44
55#include " Immutable/ImmutablePassport.h"
66#include " Immutable/ImmutableSubsystem.h"
7+ #include " Immutable/Misc/ImtblLogging.h"
78
89#if WITH_EDITOR
910#include " Editor.h"
1011#endif
1112
12- ASWebAuthenticationSession *_authSession;
13+ @interface ImmutableMac () {
14+ ASWebAuthenticationSession* _authSession;
15+ }
16+ @end
1317
1418@implementation ImmutableMac
1519
@@ -28,42 +32,40 @@ ASWebAuthenticationSession *_authSession;
2832}
2933
3034+ (UImmutablePassport*) getPassport {
31- UWorld* World;
35+ auto PassportFromWorld = [](UWorld* World) -> UImmutablePassport* {
36+ if (!World) return nullptr ;
37+ UGameInstance* GameInstance = World->GetGameInstance ();
38+ if (!GameInstance) return nullptr ;
39+ UImmutableSubsystem* Subsystem = GameInstance->GetSubsystem <UImmutableSubsystem>();
40+ if (!Subsystem) return nullptr ;
41+ return Subsystem->GetPassport ().Get ();
42+ };
3243#if WITH_EDITOR
3344 if (GEditor)
3445 {
35- for (const auto & Context : GEditor->GetWorldContexts ())
46+ for (const FWorldContext & Context : GEditor->GetWorldContexts ())
3647 {
37- if ((World = Context.World ()))
48+ if (UImmutablePassport* Passport = PassportFromWorld ( Context.World ()))
3849 {
39- if (auto GameInstance = World->GetGameInstance ())
40- {
41- if (auto ImmutableSubsystem = GameInstance->GetSubsystem <UImmutableSubsystem>())
42- {
43- auto WeakPassport = ImmutableSubsystem->GetPassport ();
44- if (auto Passport = WeakPassport.Get ())
45- {
46- return Passport;
47- }
48- }
49- }
50+ return Passport;
5051 }
5152 }
5253 }
54+ return nullptr ;
5355#else
56+ UWorld* World = nullptr ;
5457 if (UGameEngine* GameEngine = Cast<UGameEngine>(GEngine))
5558 {
5659 World = GameEngine->GetGameWorld ();
5760 }
61+ return PassportFromWorld (World);
5862#endif
59-
60- return nil;
6163}
6264
6365- (void )launchUrl:(const char *)url forRedirectUri:(const char *)redirectUri {
6466 // For automation, use the browser-based method
6567 if (GIsAutomationTesting) {
66- NSLog (@ " Using automation mode for authentication (GIsAutomationTesting is true)" );
68+ IMTBL_LOG ( " Using automation mode for authentication (GIsAutomationTesting is true)" );
6769 [self launchUrlInBrowser:url];
6870 return ;
6971 }
@@ -116,7 +118,7 @@ ASWebAuthenticationSession *_authSession;
116118
117119 // Open URL in default browser
118120 [[NSWorkspace sharedWorkspace] openURL:URL ];
119- NSLog (@ " Opened URL in browser for automation: %@ " , URL );
121+ IMTBL_LOG ( " Opened URL in browser for automation: %s " , URL . absoluteString . UTF8String );
120122}
121123
122124- (ASPresentationAnchor)presentationAnchorForWebAuthenticationSession:
0 commit comments