Initial version.

This commit is contained in:
Oliver Hauff 2021-05-13 20:16:41 +02:00
parent e4fb48f6ab
commit 10dbeb5a90
737 changed files with 61885 additions and 0 deletions

View file

@ -0,0 +1,47 @@
using Foundation;
using System;
using TINK.iOS.Device;
using TINK.Model.Device;
using Xamarin.Forms;
[assembly: Dependency(typeof(AppInfo))]
namespace TINK.iOS.Device
{
/// <summary> Holds information about the TINK- app. </summary>
public class AppInfo : IAppInfo
{
/// <summary> Holds the the version of the app.</summary>
private static Version m_oVersion = null;
/// <summary> Constructs a app info object. </summary>
public AppInfo()
{
}
/// <summary> Constructs a app info object for initialization. </summary>
/// <param name="p_strVersionText"> Version to initializ object with.</param>
internal AppInfo(string p_strVersionText)
{
if (m_oVersion != null)
{
// Set version only once.
return;
}
if (!Version.TryParse(p_strVersionText, out Version l_oVersion))
{
m_oVersion = new Version(0, 8);
}
m_oVersion = l_oVersion;
}
/// <summary> Get the version of the app. </summary>
public Version Version => m_oVersion ?? new Version(0, 9);
/// <summary> Gets the URL to the app store. </summary>
/// <remarks> TINK Url was @"http://itunes.apple.com/de/app/tink-konstanz/id1181519270?mt=8"</remarks>
/// <value>The store URL.</value>
public string StoreUrl => $"https://itunes.apple.com/de/app/apple-store/{NSBundle.MainBundle.BundleIdentifier}?mt=8";
}
}

View file

@ -0,0 +1,29 @@
using System;
using System.Runtime.InteropServices;
using TINK.Model.Device;
[assembly: Xamarin.Forms.Dependency(typeof(TINK.iOS.Device.Device))]
namespace TINK.iOS.Device
{
public class Device : IDevice
{
[DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")]
private static extern uint IOServiceGetMatchingService(uint masterPort, IntPtr matching);
[DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")]
private static extern IntPtr IOServiceMatching(string s);
[DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")]
private static extern IntPtr IORegistryEntryCreateCFProperty(uint entry, IntPtr key, IntPtr allocator, uint options);
[DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")]
private static extern int IOObjectRelease(uint o);
/// <summary> Gets unitque device identifier. </summary>
/// <returns>Gets the identifies specifying device.</returns>
public string GetIdentifier()
{
return UIKit.UIDevice.CurrentDevice?.IdentifierForVendor?.AsString() ?? string.Empty;
}
}
}

View file

@ -0,0 +1,23 @@
using TINK.Model.Device;
using Xamarin.Forms;
using TINK.iOS.Device;
using UIKit;
using Foundation;
[assembly: Dependency(typeof(ExternalBrowseService))]
namespace TINK.iOS.Device
{
public class ExternalBrowseService : IExternalBrowserService
{
/// <summary> Opens an external browser. </summary>
/// <param name="p_strUrl">Url to open.</param>
public void OpenUrl(string p_strUrl)
{
var l_oUrl = NSUrl.FromString(p_strUrl);
if (l_oUrl == null)
return;
UIApplication.SharedApplication.OpenUrl(l_oUrl);
}
}
}

View file

@ -0,0 +1,10 @@
using TINK.Model.Device;
[assembly: Xamarin.Forms.Dependency(typeof(TINK.iOS.Device.Gps))]
namespace TINK.iOS.Device
{
public class Gps : IGeolodationDependent
{
public bool IsGeolcationEnabled => true;
}
}

View file

@ -0,0 +1,27 @@
using System;
using TINK.Model.Device;
using Xamarin.Forms;
[assembly: Dependency(typeof(TINK.iOS.Device.SpecialFolder))]
namespace TINK.iOS.Device
{
public class SpecialFolder : ISpecialFolder
{
/// <summary>
/// Get the folder name of external folder to write to.
/// </summary>
/// <returns></returns>
public string GetExternalFilesDir()
{
return Environment.GetFolderPath(Environment.SpecialFolder.Personal);
}
/// <summary> Gets the folder name of the personal data folder dir on internal storage. </summary>
/// <returns>Directory name.</returns>
public string GetInternalPersonalDir()
{
return Environment.GetFolderPath(Environment.SpecialFolder.Personal);
}
}
}

View file

@ -0,0 +1,18 @@

using Foundation;
using TINK.Model.Device;
[assembly: Xamarin.Forms.Dependency(typeof(TINK.iOS.Device.WebView))]
namespace TINK.iOS.Device
{
public class WebView : IWebView
{
/// <summary> Clears the cookie cache for all web views. </summary>
public void ClearCookies()
{
NSHttpCookieStorage CookieStorage = NSHttpCookieStorage.SharedStorage;
foreach (var cookie in CookieStorage.Cookies)
CookieStorage.DeleteCookie(cookie);
}
}
}

View file

@ -0,0 +1,28 @@
using Xamarin.Forms;
using TINK.Model.Device;
using System;
[assembly: Dependency(typeof(TINK.iOS.Device.IOSCipher))]
namespace TINK.iOS.Device
{
public class IOSCipher : ICipher
{
/// <summary> Encrypt data.</summary>
/// <param name="key">Key to encrypt data.</param>
/// <param name="clear">Data to entrycpt.</param>
/// <returns></returns>
public byte[] Encrypt(byte[] key, byte[] clear)
{
throw new NotSupportedException();
}
/// <summary> Decrypt data. </summary>
/// <param name="key">Key to decrypt data with.</param>
/// <param name="encrypted">Encrpyted data to decrypt.</param>
/// <returns>Decrypted data.</returns>
public byte[] Decrypt(byte[] key, byte[] encrypted)
{
throw new NotSupportedException();
}
}
}