mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-12-22 06:56:25 +01:00
Fixed issue where urls without query parameters caused the app to crash on deeplink received
This commit is contained in:
parent
b0c0929253
commit
26c4439841
3 changed files with 30 additions and 23 deletions
|
@ -259,17 +259,19 @@ namespace TINK
|
|||
protected override void OnAppLinkRequestReceived(Uri uri)
|
||||
{
|
||||
base.OnAppLinkRequestReceived(uri);
|
||||
// TODO: Adjust to correct host
|
||||
if (uri.Host.ToLower() == "sharee.bike")
|
||||
{
|
||||
// Input e.g. sharee.bike/sharee/lastenrad/?lat=49.921&long=32.51
|
||||
// Input e.g. sharee.bike/sharee?lat=49.921&long=32.51
|
||||
Array segments = Array.ConvertAll(uri.Segments, segment => segment.Replace("/", "")).Skip(1).ToArray();
|
||||
Dictionary<string, string> queryDict = uri.Query
|
||||
.Substring(1)
|
||||
.Split("&")
|
||||
.Select(query => query.Split('='))
|
||||
.ToDictionary(query => query.FirstOrDefault(), query => query.Skip(1).FirstOrDefault());
|
||||
// segments == ["sharee", "lastenrad"]
|
||||
if (uri.Query.Length > 0)
|
||||
{
|
||||
Dictionary<string, string> queryDict = uri.Query
|
||||
.Substring(1)
|
||||
.Split("&")
|
||||
.Select(query => query.Split('='))
|
||||
.ToDictionary(query => query.FirstOrDefault(), query => query.Skip(1).FirstOrDefault());
|
||||
}
|
||||
// segments == ["sharee"]
|
||||
// queryDict == [{["lat", "49.921"]}], {["long", "32.51"]}]
|
||||
// => Navigate and pass params depending on linkinput
|
||||
// If no custom navigation is configured, the app just opens as if the user opened it
|
||||
|
|
|
@ -259,17 +259,19 @@ namespace TINK
|
|||
protected override void OnAppLinkRequestReceived(Uri uri)
|
||||
{
|
||||
base.OnAppLinkRequestReceived(uri);
|
||||
// TODO: Adjust to correct host
|
||||
if (uri.Host.ToLower() == "sharee.bike")
|
||||
{
|
||||
// Input e.g. sharee.bike/sharee/lastenrad/?lat=49.921&long=32.51
|
||||
// Input e.g. sharee.bike/sharee/?lat=49.921&long=32.51
|
||||
Array segments = Array.ConvertAll(uri.Segments, segment => segment.Replace("/", "")).Skip(1).ToArray();
|
||||
Dictionary<string, string> queryDict = uri.Query
|
||||
.Substring(1)
|
||||
.Split("&")
|
||||
.Select(query => query.Split('='))
|
||||
.ToDictionary(query => query.FirstOrDefault(), query => query.Skip(1).FirstOrDefault());
|
||||
// segments == ["sharee", "lastenrad"]
|
||||
if (uri.Query.Length > 0)
|
||||
{
|
||||
Dictionary<string, string> queryDict = uri.Query
|
||||
.Substring(1)
|
||||
.Split("&")
|
||||
.Select(query => query.Split('='))
|
||||
.ToDictionary(query => query.FirstOrDefault(), query => query.Skip(1).FirstOrDefault());
|
||||
}
|
||||
// segments == ["sharee"]
|
||||
// queryDict == [{["lat", "49.921"]}], {["long", "32.51"]}]
|
||||
// => Navigate and pass params depending on linkinput
|
||||
// If no custom navigation is configured, the app just opens as if the user opened it
|
||||
|
|
|
@ -261,14 +261,17 @@ namespace TINK
|
|||
base.OnAppLinkRequestReceived(uri);
|
||||
if (uri.Host.ToLower() == "sharee.bike")
|
||||
{
|
||||
// Input e.g. sharee.bike/sharee/lastenrad/?lat=49.921&long=32.51
|
||||
// Input e.g. sharee.bike/sharee/?lat=49.921&long=32.51
|
||||
Array segments = Array.ConvertAll(uri.Segments, segment => segment.Replace("/", "")).Skip(1).ToArray();
|
||||
Dictionary<string, string> queryDict = uri.Query
|
||||
.Substring(1)
|
||||
.Split("&")
|
||||
.Select(query => query.Split('='))
|
||||
.ToDictionary(query => query.FirstOrDefault(), query => query.Skip(1).FirstOrDefault());
|
||||
// segments == ["sharee", "lastenrad"]
|
||||
if (uri.Query.Length > 0)
|
||||
{
|
||||
Dictionary<string, string> queryDict = uri.Query
|
||||
.Substring(1)
|
||||
.Split("&")
|
||||
.Select(query => query.Split('='))
|
||||
.ToDictionary(query => query.FirstOrDefault(), query => query.Skip(1).FirstOrDefault());
|
||||
}
|
||||
// segments == ["sharee"]
|
||||
// queryDict == [{["lat", "49.921"]}], {["long", "32.51"]}]
|
||||
// => Navigate and pass params depending on linkinput
|
||||
// If no custom navigation is configured, the app just opens as if the user opened it
|
||||
|
|
Loading…
Reference in a new issue