This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +27
-24
lines changed
src/UnityExtension/Assets/Editor/GitHub.Unity/UI Expand file tree Collapse file tree 2 files changed +27
-24
lines changed Original file line number Diff line number Diff line change @@ -596,29 +596,31 @@ private void MaybeUpdateData()
596
596
597
597
if ( keychainHasUpdate || currentRemoteHasUpdate )
598
598
{
599
- Connection [ ] connections ;
600
- if ( HasRepository && ! string . IsNullOrEmpty ( Repository . CloneUrl ) )
599
+ var username = String . Empty ;
600
+ if ( Repository != null )
601
601
{
602
- var host = Repository . CloneUrl
603
- . ToRepositoryUri ( )
604
- . GetComponents ( UriComponents . Host , UriFormat . SafeUnescaped ) ;
602
+ Connection connection ;
603
+ if ( ! string . IsNullOrEmpty ( Repository . CloneUrl ) )
604
+ {
605
+ var host = Repository . CloneUrl
606
+ . ToRepositoryUri ( )
607
+ . GetComponents ( UriComponents . Host , UriFormat . SafeUnescaped ) ;
605
608
606
- connections = Platform . Keychain . Connections . OrderByDescending ( x => x . Host == host ) . ToArray ( ) ;
607
- }
608
- else
609
- {
610
- connections = Platform . Keychain . Connections . OrderByDescending ( HostAddress . IsGitHubDotCom ) . ToArray ( ) ;
611
- }
609
+ connection = Platform . Keychain . Connections . FirstOrDefault ( x => x . Host == host ) ;
610
+ }
611
+ else
612
+ {
613
+ connection = Platform . Keychain . Connections . FirstOrDefault ( HostAddress . IsGitHubDotCom ) ;
614
+ }
612
615
613
- if ( connections . Any ( ) )
614
- {
615
- currentUsername = connections . First ( ) . Username ;
616
- }
617
- else
618
- {
619
- currentUsername = "" ;
616
+ if ( connection != null )
617
+ {
618
+ username = connection . Username ;
619
+ }
620
620
}
621
621
622
+ currentUsername = username ;
623
+
622
624
keychainHasUpdate = false ;
623
625
currentRemoteHasUpdate = false ;
624
626
}
Original file line number Diff line number Diff line change @@ -103,22 +103,23 @@ private static void UpdateCurrentUsername()
103
103
var username = String . Empty ;
104
104
if ( Repository != null )
105
105
{
106
- Connection [ ] connections ;
106
+ Connection connection ;
107
107
if ( ! string . IsNullOrEmpty ( Repository . CloneUrl ) )
108
108
{
109
- var host = Repository . CloneUrl . ToRepositoryUri ( )
109
+ var host = Repository . CloneUrl
110
+ . ToRepositoryUri ( )
110
111
. GetComponents ( UriComponents . Host , UriFormat . SafeUnescaped ) ;
111
112
112
- connections = Platform . Keychain . Connections . OrderByDescending ( x => x . Host == host ) . ToArray ( ) ;
113
+ connection = Platform . Keychain . Connections . FirstOrDefault ( x => x . Host == host ) ;
113
114
}
114
115
else
115
116
{
116
- connections = Platform . Keychain . Connections . OrderByDescending ( HostAddress . IsGitHubDotCom ) . ToArray ( ) ;
117
+ connection = Platform . Keychain . Connections . FirstOrDefault ( HostAddress . IsGitHubDotCom ) ;
117
118
}
118
119
119
- if ( connections . Any ( ) )
120
+ if ( connection != null )
120
121
{
121
- username = connections . First ( ) . Username ;
122
+ username = connection . Username ;
122
123
}
123
124
}
124
125
You can’t perform that action at this time.
0 commit comments