mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-01-08 22:24:26 +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)
|
protected override void OnAppLinkRequestReceived(Uri uri)
|
||||||
{
|
{
|
||||||
base.OnAppLinkRequestReceived(uri);
|
base.OnAppLinkRequestReceived(uri);
|
||||||
// TODO: Adjust to correct host
|
|
||||||
if (uri.Host.ToLower() == "sharee.bike")
|
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();
|
Array segments = Array.ConvertAll(uri.Segments, segment => segment.Replace("/", "")).Skip(1).ToArray();
|
||||||
Dictionary<string, string> queryDict = uri.Query
|
if (uri.Query.Length > 0)
|
||||||
.Substring(1)
|
{
|
||||||
.Split("&")
|
Dictionary<string, string> queryDict = uri.Query
|
||||||
.Select(query => query.Split('='))
|
.Substring(1)
|
||||||
.ToDictionary(query => query.FirstOrDefault(), query => query.Skip(1).FirstOrDefault());
|
.Split("&")
|
||||||
// segments == ["sharee", "lastenrad"]
|
.Select(query => query.Split('='))
|
||||||
|
.ToDictionary(query => query.FirstOrDefault(), query => query.Skip(1).FirstOrDefault());
|
||||||
|
}
|
||||||
|
// segments == ["sharee"]
|
||||||
// queryDict == [{["lat", "49.921"]}], {["long", "32.51"]}]
|
// queryDict == [{["lat", "49.921"]}], {["long", "32.51"]}]
|
||||||
// => Navigate and pass params depending on linkinput
|
// => Navigate and pass params depending on linkinput
|
||||||
// If no custom navigation is configured, the app just opens as if the user opened it
|
// 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)
|
protected override void OnAppLinkRequestReceived(Uri uri)
|
||||||
{
|
{
|
||||||
base.OnAppLinkRequestReceived(uri);
|
base.OnAppLinkRequestReceived(uri);
|
||||||
// TODO: Adjust to correct host
|
|
||||||
if (uri.Host.ToLower() == "sharee.bike")
|
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();
|
Array segments = Array.ConvertAll(uri.Segments, segment => segment.Replace("/", "")).Skip(1).ToArray();
|
||||||
Dictionary<string, string> queryDict = uri.Query
|
if (uri.Query.Length > 0)
|
||||||
.Substring(1)
|
{
|
||||||
.Split("&")
|
Dictionary<string, string> queryDict = uri.Query
|
||||||
.Select(query => query.Split('='))
|
.Substring(1)
|
||||||
.ToDictionary(query => query.FirstOrDefault(), query => query.Skip(1).FirstOrDefault());
|
.Split("&")
|
||||||
// segments == ["sharee", "lastenrad"]
|
.Select(query => query.Split('='))
|
||||||
|
.ToDictionary(query => query.FirstOrDefault(), query => query.Skip(1).FirstOrDefault());
|
||||||
|
}
|
||||||
|
// segments == ["sharee"]
|
||||||
// queryDict == [{["lat", "49.921"]}], {["long", "32.51"]}]
|
// queryDict == [{["lat", "49.921"]}], {["long", "32.51"]}]
|
||||||
// => Navigate and pass params depending on linkinput
|
// => Navigate and pass params depending on linkinput
|
||||||
// If no custom navigation is configured, the app just opens as if the user opened it
|
// 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);
|
base.OnAppLinkRequestReceived(uri);
|
||||||
if (uri.Host.ToLower() == "sharee.bike")
|
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();
|
Array segments = Array.ConvertAll(uri.Segments, segment => segment.Replace("/", "")).Skip(1).ToArray();
|
||||||
Dictionary<string, string> queryDict = uri.Query
|
if (uri.Query.Length > 0)
|
||||||
.Substring(1)
|
{
|
||||||
.Split("&")
|
Dictionary<string, string> queryDict = uri.Query
|
||||||
.Select(query => query.Split('='))
|
.Substring(1)
|
||||||
.ToDictionary(query => query.FirstOrDefault(), query => query.Skip(1).FirstOrDefault());
|
.Split("&")
|
||||||
// segments == ["sharee", "lastenrad"]
|
.Select(query => query.Split('='))
|
||||||
|
.ToDictionary(query => query.FirstOrDefault(), query => query.Skip(1).FirstOrDefault());
|
||||||
|
}
|
||||||
|
// segments == ["sharee"]
|
||||||
// queryDict == [{["lat", "49.921"]}], {["long", "32.51"]}]
|
// queryDict == [{["lat", "49.921"]}], {["long", "32.51"]}]
|
||||||
// => Navigate and pass params depending on linkinput
|
// => Navigate and pass params depending on linkinput
|
||||||
// If no custom navigation is configured, the app just opens as if the user opened it
|
// If no custom navigation is configured, the app just opens as if the user opened it
|
||||||
|
|
Loading…
Reference in a new issue