Skip to content

Commit

Permalink
Added support for sidequest protocol in the browser webview - only th…
Browse files Browse the repository at this point in the history
…e first item
  • Loading branch information
sidequestlegend authored Aug 1, 2019
1 parent 09a009a commit f82b4e4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion BeatOn/ToastInjectorWebViewClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Android.Webkit;
using Android.Widget;
using BeatOn.ClientModels;
using Newtonsoft.Json;

namespace BeatOn
{
Expand Down Expand Up @@ -61,6 +62,19 @@ public override bool ShouldOverrideUrlLoading(WebView view, IWebResourceRequest

return true;
}
else if (lowerUrl.StartsWith("sidequest://bsaber-multi/#"))
{
string dlurls = url.Substring(26)
.Replace("%22,%22", "\",\"")
.Replace("[%22", "[\"")
.Replace("%22]", "\"]");
JArray urls = JArray.Parse(json);
if(urls.Count > 0)
{
Download?.Invoke(this, urls[0]);
return true;
}
}
else if (lowerUrl.StartsWith("beatsaver://"))
{
string dlurl = url.Substring(12);
Expand All @@ -74,4 +88,4 @@ public override WebResourceResponse ShouldInterceptRequest(WebView view, IWebRes
return base.ShouldInterceptRequest(view, request);
}
}
}
}

0 comments on commit f82b4e4

Please sign in to comment.