Пример #1
0
        /// <summary>
        /// Query push notifications configuration
        /// </summary>
        /// <param name="appHandle">App handle</param>
        /// <param name="platformType">Platform type</param>
        /// <returns>Validation configuration entity</returns>
        public async Task <IPushNotificationsConfigurationEntity> QueryPushNotificationsConfiguration(string appHandle, PlatformType platformType)
        {
            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.Apps);

            ObjectTable table = this.tableStoreManager.GetTable(ContainerIdentifier.Apps, TableIdentifier.AppPushNotificationsConfigurationsObject) as ObjectTable;
            PushNotificationsConfigurationEntity pushNotificationsConfigurationEntity = await store.QueryObjectAsync <PushNotificationsConfigurationEntity>(table, appHandle, platformType.ToString());

            return(pushNotificationsConfigurationEntity);
        }
Пример #2
0
        /// <summary>
        /// Insert app
        /// </summary>
        /// <param name="storageConsistencyMode">Storage consistency mode</param>
        /// <param name="appHandle">App handle</param>
        /// <param name="developerId">Developer id</param>
        /// <param name="name">App name</param>
        /// <param name="iconHandle">Icon handle</param>
        /// <param name="platformType">Platform type</param>
        /// <param name="deepLink">Deep link</param>
        /// <param name="storeLink">Store link</param>
        /// <param name="createdTime">Created time</param>
        /// <param name="disableHandleValidation">whether to disable validation of app-provided handles</param>
        /// <returns>Create app task</returns>
        public async Task InsertApp(
            StorageConsistencyMode storageConsistencyMode,
            string appHandle,
            string developerId,
            string name,
            string iconHandle,
            PlatformType platformType,
            string deepLink,
            string storeLink,
            DateTime createdTime,
            bool disableHandleValidation)
        {
            AppProfileEntity appProfileEntity = new AppProfileEntity()
            {
                DeveloperId             = developerId,
                Name                    = name,
                IconHandle              = iconHandle,
                PlatformType            = platformType,
                DeepLink                = deepLink,
                StoreLink               = storeLink,
                CreatedTime             = createdTime,
                LastUpdatedTime         = createdTime,
                AppStatus               = AppStatus.Active,
                DisableHandleValidation = disableHandleValidation,
            };

            IdentityProviderCredentialsEntity facebookCredentialsEntity  = new IdentityProviderCredentialsEntity();
            IdentityProviderCredentialsEntity microsoftCredentialsEntity = new IdentityProviderCredentialsEntity();
            IdentityProviderCredentialsEntity googleCredentialsEntity    = new IdentityProviderCredentialsEntity();
            IdentityProviderCredentialsEntity twitterCredentialsEntity   = new IdentityProviderCredentialsEntity();
            IdentityProviderCredentialsEntity aadCredentialsEntity       = new IdentityProviderCredentialsEntity();

            ValidationConfigurationEntity validationConfigurationEntity = new ValidationConfigurationEntity()
            {
                Enabled = false
            };

            PushNotificationsConfigurationEntity windowsPushNotificationsConfigurationEntity = new PushNotificationsConfigurationEntity()
            {
                Enabled = false
            };

            PushNotificationsConfigurationEntity androidPushNotificationsConfigurationEntity = new PushNotificationsConfigurationEntity()
            {
                Enabled = false
            };

            PushNotificationsConfigurationEntity iosPushNotificationsConfigurationEntity = new PushNotificationsConfigurationEntity()
            {
                Enabled = false
            };

            CTStore store = await this.tableStoreManager.GetStore(ContainerIdentifier.Apps);

            ObjectTable profilesTable          = this.tableStoreManager.GetTable(ContainerIdentifier.Apps, TableIdentifier.AppProfilesObject) as ObjectTable;
            ObjectTable credentialsTable       = this.tableStoreManager.GetTable(ContainerIdentifier.Apps, TableIdentifier.AppIdentityProviderCredentialsObject) as ObjectTable;
            ObjectTable validationConfigsTable = this.tableStoreManager.GetTable(ContainerIdentifier.Apps, TableIdentifier.AppValidationConfigurationsObject) as ObjectTable;
            ObjectTable pushConfigsTable       = this.tableStoreManager.GetTable(ContainerIdentifier.Apps, TableIdentifier.AppPushNotificationsConfigurationsObject) as ObjectTable;
            Transaction transaction            = new Transaction();

            transaction.Add(Operation.Insert(profilesTable, appHandle, appHandle, appProfileEntity));
            transaction.Add(Operation.Insert(credentialsTable, appHandle, IdentityProviderType.Facebook.ToString(), facebookCredentialsEntity));
            transaction.Add(Operation.Insert(credentialsTable, appHandle, IdentityProviderType.Microsoft.ToString(), microsoftCredentialsEntity));
            transaction.Add(Operation.Insert(credentialsTable, appHandle, IdentityProviderType.Google.ToString(), googleCredentialsEntity));
            transaction.Add(Operation.Insert(credentialsTable, appHandle, IdentityProviderType.Twitter.ToString(), twitterCredentialsEntity));
            transaction.Add(Operation.Insert(credentialsTable, appHandle, IdentityProviderType.AADS2S.ToString(), aadCredentialsEntity));
            transaction.Add(Operation.Insert(validationConfigsTable, appHandle, appHandle, validationConfigurationEntity));
            transaction.Add(Operation.Insert(pushConfigsTable, appHandle, PlatformType.Windows.ToString(), windowsPushNotificationsConfigurationEntity));
            transaction.Add(Operation.Insert(pushConfigsTable, appHandle, PlatformType.Android.ToString(), androidPushNotificationsConfigurationEntity));
            transaction.Add(Operation.Insert(pushConfigsTable, appHandle, PlatformType.IOS.ToString(), iosPushNotificationsConfigurationEntity));
            await store.ExecuteTransactionAsync(transaction, storageConsistencyMode.ToConsistencyMode());
        }