@@ -60,6 +60,7 @@ public partial class APIAccess : Component, IAPIProvider
60
60
61
61
public IBindable < APIUser > LocalUser => localUser ;
62
62
public IBindableList < APIRelation > Friends => friends ;
63
+ public Bindable < UserStatus > Status { get ; } = new Bindable < UserStatus > ( UserStatus . Online ) ;
63
64
public IBindable < UserActivity > Activity => activity ;
64
65
65
66
public INotificationsClient NotificationsClient { get ; }
@@ -73,7 +74,6 @@ public partial class APIAccess : Component, IAPIProvider
73
74
private Bindable < UserActivity > activity { get ; } = new Bindable < UserActivity > ( ) ;
74
75
75
76
private Bindable < UserStatus ? > configStatus { get ; } = new Bindable < UserStatus ? > ( ) ;
76
- private Bindable < UserStatus ? > localUserStatus { get ; } = new Bindable < UserStatus ? > ( ) ;
77
77
78
78
protected bool HasLogin => authentication . Token . Value != null || ( ! string . IsNullOrEmpty ( ProvidedUsername ) && ! string . IsNullOrEmpty ( password ) ) ;
79
79
@@ -121,17 +121,6 @@ public APIAccess(OsuGameBase game, OsuConfigManager config, EndpointConfiguratio
121
121
state . Value = APIState . Connecting ;
122
122
}
123
123
124
- localUser . BindValueChanged ( u =>
125
- {
126
- u . OldValue ? . Activity . UnbindFrom ( activity ) ;
127
- u . NewValue . Activity . BindTo ( activity ) ;
128
-
129
- u . OldValue ? . Status . UnbindFrom ( localUserStatus ) ;
130
- u . NewValue . Status . BindTo ( localUserStatus ) ;
131
- } , true ) ;
132
-
133
- localUserStatus . BindTo ( configStatus ) ;
134
-
135
124
var thread = new Thread ( run )
136
125
{
137
126
Name = "APIAccess" ,
@@ -342,9 +331,8 @@ private void attemptConnect()
342
331
{
343
332
Debug . Assert ( ThreadSafety . IsUpdateThread ) ;
344
333
345
- me . Status . Value = configStatus . Value ?? UserStatus . Online ;
346
-
347
334
localUser . Value = me ;
335
+ Status . Value = configStatus . Value ?? UserStatus . Online ;
348
336
349
337
state . Value = me . SessionVerified ? APIState . Online : APIState . RequiresSecondFactorAuth ;
350
338
failureCount = 0 ;
@@ -381,9 +369,10 @@ private void setPlaceholderLocalUser()
381
369
382
370
localUser . Value = new APIUser
383
371
{
384
- Username = ProvidedUsername ,
385
- Status = { Value = configStatus . Value ?? UserStatus . Online }
372
+ Username = ProvidedUsername
386
373
} ;
374
+
375
+ Status . Value = configStatus . Value ?? UserStatus . Online ;
387
376
}
388
377
389
378
public void Perform ( APIRequest request )
0 commit comments