public CognitoSyncManager(CognitoAWSCredentials cognitoCredentials, RegionEndpoint endpoint) : this(cognitoCredentials, new AmazonCognitoSyncConfig { RegionEndpoint = endpoint }) { }
// Use this for initialization void Start() { UnityInitializer.AttachToGameObject(this.gameObject); _credentials = new CognitoAWSCredentials(IdentityPoolId, _CognitoIdentityRegion); analyticsManager = MobileAnalyticsManager.GetOrCreateInstance(appId, _credentials, _AnalyticsRegion); }
public CognitoSyncStorage(CognitoAWSCredentials cognitoCredentials, AmazonCognitoSyncConfig config) { if (cognitoCredentials == null) { throw new ArgumentNullException("cognitoCredentials"); } this.identityPoolId = cognitoCredentials.IdentityPoolId; this.cognitoCredentials = cognitoCredentials; this.client = new AmazonCognitoSyncClient(cognitoCredentials, config); }
public SimpleDBStorage () { var credentials = new CognitoAWSCredentials ( Constants.CognitoIdentityPoolId, RegionEndpoint.USEast1); var config = new AmazonSimpleDBConfig (); config.RegionEndpoint = RegionEndpoint.USWest2; client = new AmazonSimpleDBClient (credentials, config); Items = new List<TodoItem> (); SetupDomain (); }
public CognitoSyncManager(CognitoAWSCredentials cognitoCredentials, AmazonCognitoSyncConfig config) { if (cognitoCredentials == null) { throw new ArgumentNullException("cognitoCredentials"); } if (string.IsNullOrEmpty(cognitoCredentials.IdentityPoolId)) { throw new ArgumentNullException("cognitoCredentials.IdentityPoolId"); } this.cognitoCredentials = cognitoCredentials; Local = new SQLiteLocalStorage(System.IO.Path.Combine(Application.persistentDataPath, DATABASE_NAME)); remote = new CognitoSyncStorage(cognitoCredentials, config); cognitoCredentials.IdentityChangedEvent += this.IdentityChanged; _logger = Logger.GetLogger(this.GetType()); }
private void Init(string authProvider, string accessToken) { enabled = true; if (string.IsNullOrEmpty(IDENTITY_POOL_ID)) { throw new NotSupportedException ("Please setup your the identity pool id in SceneController"); } //Create a Credentials provider that uses Cognito Identity credentials = new CognitoAWSCredentials(IDENTITY_POOL_ID, ENDPOINT); //If fbAccesToken is set, we can use Cognito's authenticated identities if (accessToken != null) { credentials.AddLogin(authProvider, accessToken); } syncManager = new CognitoSyncManager (credentials, new AmazonCognitoSyncConfig { RegionEndpoint = ENDPOINT }); InitializeCharactersDataset(); }
// Use this for initialization void Start() { #if UNITY_EDITOR /// This is just to spoof the application to think that its running on iOS platform AmazonHookedPlatformInfo.Instance.Platform = "iPhoneOS"; AmazonHookedPlatformInfo.Instance.Model = "iPhone"; AmazonHookedPlatformInfo.Instance.Make = "Apple"; AmazonHookedPlatformInfo.Instance.Locale = "en_US"; AmazonHookedPlatformInfo.Instance.PlatformVersion = "8.1.2"; AmazonHookedPlatformInfo.Instance.Title = "YourApp"; AmazonHookedPlatformInfo.Instance.VersionName = "v1.0"; AmazonHookedPlatformInfo.Instance.VersionCode = "1.0"; AmazonHookedPlatformInfo.Instance.PackageName = "com.yourcompany.yourapp"; #endif _credentials = new CognitoAWSCredentials(IdentityPoolId, Amazon.RegionEndpoint.USEast1); analyticsManager = MobileAnalyticsManager.GetOrCreateInstance(_credentials, Amazon.RegionEndpoint.USEast1, appId); }
public CognitoSyncManager(CognitoAWSCredentials cognitoCredentials) : this(cognitoCredentials, new AmazonCognitoSyncConfig()) { }
/// <summary> /// A helper function to get the identity id of the dataset from credentials /// provider. If the identity id is null, UNKNOWN_IDENTITY_ID will be /// returned. /// </summary> /// <returns>The identity identifier.</returns> /// <param name="provider">Provider.</param> public static string GetIdentityId(CognitoAWSCredentials credentials) { return string.IsNullOrEmpty(credentials.GetCachedIdentityId()) ? UNKNOWN_IDENTITY_ID : credentials.GetCachedIdentityId(); }
/// <summary> /// Creates a new Dataset /// </summary> /// <param name="datasetName">The name of the dataset</param> /// <param name="cognitoCredentials">The Cognito Credentials associated with the dataset</param> /// <param name="local">Local storage, can be InMemoryStorage or SQLiteStorage or Some Custom Storage Class which implements <see cref="Amazon.CognitoSync.SyncManager.ILocalStorage"/></param> /// <param name="remote">Remote storage</param> internal Dataset(string datasetName, CognitoAWSCredentials cognitoCredentials, ILocalStorage local, CognitoSyncStorage remote) { this._datasetName = datasetName; this._cognitoCredentials = cognitoCredentials; this._local = local; this._remote = remote; _logger = Logger.GetLogger(this.GetType()); DatasetSetupInternal(); }
public Dataset(string datasetName, CognitoAWSCredentials cognitoCredentials, ILocalStorage local, IRemoteDataStorage remote) { this._datasetName = datasetName; this._cognitoCredentials = cognitoCredentials; this._local = local; this._remote = remote; _logger = Logger.GetLogger(this.GetType()); UnityMainThreadDispatcher.OnRefresh += HandleConnectivityRefresh; }
/// <summary> /// Creates an instance of CognitoSyncManager using cognito credentials and a configuration object /// <code> /// CognitoSyncManager cognitoSyncManager = new CognitoSyncManager(credentials,new AmazonCognitoSyncConfig { RegionEndpoint = RegionEndpoint.USEAST1}) /// </code> /// </summary> /// <param name="cognitoCredentials"><see cref="Amazon.CognitoIdentity.CognitoAWSCredentials"/></param> /// <param name="config"><see cref="Amazon.CognitoSync.AmazonCognitoSyncConfig"/></param> public CognitoSyncManager(CognitoAWSCredentials cognitoCredentials, AmazonCognitoSyncConfig config) { if (cognitoCredentials == null) { throw new ArgumentNullException("cognitoCredentials"); } #if BCL ValidateParameters(); #endif this.CognitoCredentials = cognitoCredentials; Local = new SQLiteLocalStorage(); Remote = new CognitoSyncStorage(cognitoCredentials, config); cognitoCredentials.IdentityChangedEvent += this.IdentityChanged; _logger = Logger.GetLogger(this.GetType()); }
private void Init(string authProvider, string accessToken) { if (string.IsNullOrEmpty(IDENTITY_POOL_ID)) { throw new NotSupportedException ("Identity Pool ID is not set"); } //Create a Credentials provider that uses Cognito Identity credentials = new CognitoAWSCredentials(IDENTITY_POOL_ID, ENDPOINT); myIdentity = credentials.GetIdentityId(); credentials.IdentityChangedEvent += (object sender, Amazon.CognitoIdentity.CognitoAWSCredentials.IdentityChangedArgs e) => { Debug.Log("Identity Changed (old: '"+e.OldIdentityId+"', new: '"+e.NewIdentityId+"')"); myIdentity = e.NewIdentityId; }; //If fbAccesToken is set, we can use Cognito's authenticated identities if (accessToken != null) { credentials.AddLogin(authProvider, accessToken); } loggedIn = true; UpdateIdentity(); }
public override void Start() { lock (_locker) { RegionEndpoint amazonRegion = RegionEndpoint.GetBySystemName(_cognitoIdentityPoolId.Substring(0, _cognitoIdentityPoolId.IndexOf(":"))); CognitoAWSCredentials credentials = new CognitoAWSCredentials(_cognitoIdentityPoolId, amazonRegion); _s3 = new AmazonS3Client(credentials, amazonRegion); base.Start(); } }