Skip to content

Commit

Permalink
Check returns true if check succeeded
Browse files Browse the repository at this point in the history
  • Loading branch information
vanessagertman committed Apr 28, 2017
1 parent 121ea93 commit 46ec4f1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Magpie/Magpie/Services/Magpie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ await Check(AppInfo.AppCastUrl, CheckState.ChannelSwitch, channelId, showDebuggi
}

private async Task Check(string appcastUrl, CheckState checkState, int channelId = 1, bool showDebuggingWindow = false)
private async Task<bool> Check(string appcastUrl, CheckState checkState, int channelId = 1, bool showDebuggingWindow = false)
{
_logger.Log(string.Format("Starting fetching remote channel content from address: {0}", appcastUrl));
try
Expand All @@ -64,12 +65,15 @@ private async Task Check(string appcastUrl, CheckState checkState, int channelId
{
ShowErrorWindow();
}
return;
return false;
}

var appcast = ParseAppcast(data);

if (checkState == CheckState.ChannelSwitch && FailedToEnroll(appcast, channelId)) return;
if (checkState == CheckState.ChannelSwitch && FailedToEnroll(appcast, channelId))
{
return false;
}

var channelToUpdateFrom = BestChannelFinder.Find(channelId, appcast.Channels);

Expand All @@ -83,10 +87,12 @@ private async Task Check(string appcastUrl, CheckState checkState, int channelId
ShowNoUpdatesWindow();
}
AppInfo.SubscribedChannel = channelId;
return true;
}
catch (Exception ex)
{
_logger.Log(string.Format("Error parsing remote channel: {0}", ex.Message));
return false;
}
finally
{
Expand Down

0 comments on commit 46ec4f1

Please sign in to comment.