Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Always default to GitHub login
  • Loading branch information
jcansdale committed Mar 15, 2020
commit 74c80c24b26d7f2a7b94ff525244638422e992ac
21 changes: 1 addition & 20 deletions src/GitHub.App/ViewModels/Dialog/LoginCredentialsViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.ComponentModel.Composition;
using System.Reactive.Linq;
using GitHub.App;
using GitHub.Primitives;
using GitHub.Services;
using ReactiveUI;

Expand All @@ -28,8 +26,7 @@ public LoginCredentialsViewModel(
(x, y) => x.Value || y.Value
).ToProperty(this, vm => vm.IsLoginInProgress);

UpdateLoginMode();
connectionManager.Connections.CollectionChanged += (_, __) => UpdateLoginMode();
LoginMode = LoginMode.DotComOrEnterprise;

Done = Observable.Merge(
loginToGitHubViewModel.Login,
Expand All @@ -55,21 +52,5 @@ public LoginMode LoginMode
public bool IsLoginInProgress { get { return isLoginInProgress.Value; } }

public IObservable<object> Done { get; }

void UpdateLoginMode()
{
var result = LoginMode.DotComOrEnterprise;

foreach (var connection in ConnectionManager.Connections)
{
if (connection.IsLoggedIn)
{
result &= ~((connection.HostAddress == HostAddress.GitHubDotComHostAddress) ?
LoginMode.DotComOnly : LoginMode.EnterpriseOnly);
}
}

LoginMode = result;
}
}
}