mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-14 14:26:28 +01:00
34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using System;
|
|
using TINK.Model.Device;
|
|
using TINK.Repository;
|
|
|
|
namespace TINK.Model.Connector
|
|
{
|
|
public class ConnectorFactory
|
|
{
|
|
/// <summary>
|
|
/// Gets a connector object depending on whether beein onlin or offline.
|
|
/// </summary>
|
|
/// <param name="isConnected">
|
|
/// True if online, false if offline.
|
|
/// If offline cache connector is returned to avoid performance penalty which would happen when trying to communicate with backend in offline scenario.
|
|
/// </param>
|
|
/// <param name="appContextInfo">Provides app related info (app name and version, merchantid) to pass to COPRI.</param>
|
|
/// <param name="uiIsoLangugageName">Two letter ISO language name.</param>
|
|
/// <param name="smartDevice">Holds info about smart device.</param>
|
|
public static IConnector Create(
|
|
bool isConnected,
|
|
Uri activeUri,
|
|
AppContextInfo appContextInfo,
|
|
string uiIsoLangugageName,
|
|
string sessionCookie,
|
|
string mail,
|
|
ISmartDevice smartDevice = null,
|
|
TimeSpan? expiresAfter = null)
|
|
{
|
|
return isConnected
|
|
? new Connector(activeUri, appContextInfo, uiIsoLangugageName, sessionCookie, mail, smartDevice, expiresAfter: expiresAfter) as IConnector
|
|
: new ConnectorCache(appContextInfo, uiIsoLangugageName, sessionCookie, mail, smartDevice);
|
|
}
|
|
}
|
|
}
|