-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from fiskaltrust/user/tsc/scu-config
Make SCU params configurable via intent
- Loading branch information
Showing
7 changed files
with
54 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/fiskaltrust.AndroidLauncher/Extensions/IntentExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Android.Content; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace fiskaltrust.AndroidLauncher.Extensions | ||
{ | ||
public static class IntentExtensions | ||
{ | ||
private const string SCU_CONFIG_PREFIX = "scu-config-"; | ||
|
||
public static Dictionary<string, object> GetScuConfigParameters(this Intent intent, bool removePrefix = false) | ||
{ | ||
string GetKey(string key) => removePrefix ? key.Substring(SCU_CONFIG_PREFIX.Length) : key; | ||
|
||
return intent.Extras.KeySet() | ||
.Where(x => x.StartsWith(SCU_CONFIG_PREFIX)) | ||
.ToDictionary<string, string, object>(key => GetKey(key), key => intent.Extras.Get(key)); | ||
} | ||
|
||
public static void PutExtras(this Intent intent, Dictionary<string, object> dict) | ||
{ | ||
foreach (var extra in dict) | ||
{ | ||
intent.PutExtra(extra.Key, extra.Value.ToString()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters