using System;
using TINK.Repository;
namespace TINK.Model.Connector
{
public class ConnectorFactory
{
///
/// Gets a connector object depending on whether beein onlin or offline.
///
/// True if online, false if offline. If offline cache connector is returned.
/// Provides app related info (app name and version, merchantid) to pass to COPRI.
///
public static IConnector Create(
bool isConnected,
Uri activeUri,
AppContextInfo appContextInfo,
string sessionCookie,
string mail,
TimeSpan? expiresAfter = null)
{
return isConnected
? new Connector(activeUri, appContextInfo, sessionCookie, mail, expiresAfter: expiresAfter) as IConnector
: new ConnectorCache(sessionCookie, mail);
}
}
}