protected override Installation CreateInstallation(PushConfig pushConfig) { string operatingSystem = Environment.OSVersion.Platform.ToString(); string osVersion = Environment.OSVersion.Version.ToString(); Installation installation = new Installation() { alias = pushConfig.Alias, operatingSystem = operatingSystem, osVersion = osVersion, categories = pushConfig.Categories }; return installation; }
public async Task SendMetricWhenAppLaunched(PushConfig pushConfig) { ILocalStore store = CreateChannelStore(); var pushIdentifier = store.Read(PUSH_ID_KEY); var client = CreateUPSHttpClient(pushConfig); await client.SendMetrics(pushIdentifier); store.Save(PUSH_ID_KEY, null); }
AeroGear.Push.PushConfig Convert(PushConfig config) { var result = new AeroGear.Push.PushConfig(); result.Alias = config.Alias; result.Categories = config.Categories; result.VariantId = config.VariantId; result.VariantSecret = config.VariantSecret; result.UnifiedPushUri = config.UnifiedPushUri; return result; }
public override async Task<string> Register(PushConfig pushConfig, IUPSHttpClient client) { Installation installation = CreateInstallation(pushConfig); ILocalStore store = CreateChannelStore(); string channelUri = await ChannelUri(); var token = pushConfig.VariantId + channelUri; installation.deviceToken = channelUri; await client.Register(installation); return installation.deviceToken; }
AeroGear.Push.PushConfig Convert(PushConfig config) { var result = new AeroGear.Push.PushConfig(); result.Alias = config.Alias; result.Categories = config.Categories; result.VariantId = config.VariantId; result.VariantSecret = config.VariantSecret; result.UnifiedPushUri = config.UnifiedPushUri; return(result); }
protected override Installation CreateInstallation(PushConfig pushConfig) { _config = (AndroidPushConfig) pushConfig; return _installation = new Installation { alias = pushConfig.Alias, categories = pushConfig.Categories, operatingSystem = "android", osVersion = Build.VERSION.Release }; }
protected override Installation CreateInstallation(PushConfig pushConfig) { var device = new UIDevice(); return new Installation { alias = pushConfig.Alias, categories = pushConfig.Categories, operatingSystem = device.SystemName, osVersion = device.SystemVersion }; }
protected override Installation CreateInstallation(PushConfig pushConfig) { var deviceInformation = new EasClientDeviceInformation(); var os = deviceInformation.OperatingSystem; var deviceType = deviceInformation.SystemProductName; var installation = new Installation { alias = pushConfig.Alias, operatingSystem = os, osVersion = deviceType, categories = pushConfig.Categories }; return installation; }
public async virtual Task<string> Register(PushConfig pushConfig, IUPSHttpClient client) { Installation installation = CreateInstallation(pushConfig); ILocalStore store = CreateChannelStore(); string channelUri = await ChannelUri(); var token = pushConfig.VariantId + channelUri; if (!token.Equals(store.Read(CHANNEL_KEY))) { installation.deviceToken = channelUri; await client.Register(installation); store.Save(CHANNEL_KEY, token); } return installation.deviceToken; }
public async Task <string> Register(PushConfig pushConfig, IUPSHttpClient client) { Installation installation = CreateInstallation(pushConfig); ILocalStore store = CreateChannelStore(); string channelUri = await ChannelUri(); var token = pushConfig.VariantId + channelUri; if (!token.Equals(store.Read(CHANNEL_KEY))) { installation.deviceToken = channelUri; await client.Register(installation); store.Save(CHANNEL_KEY, token); } return(installation.deviceToken); }
public PushConfig ReadPushConfig() { var configName = FHConfig.GetInstance().IsLocalDevelopment ? Constants.LocalConfigFileName : Constants.ConfigFileName; var appProps = ReadAppProps(); var configLocation = Path.Combine(GetPackageDir(), configName); var json = ServiceFinder.Resolve<IIOService>().ReadFile(configLocation); var config = (JObject) JsonConvert.DeserializeObject(json); var configWindows = config["windows"]; var pushConfig = new PushConfig { Alias = (string) config["Alias"], Categories = config["Categories"]?.ToObject<List<string>>(), UnifiedPushUri = new Uri(appProps.host + "/api/v2/ag-push"), VariantId = (string) (configWindows != null ? configWindows["variantID"] : config["variantID"]), VariantSecret = (string) (configWindows != null ? configWindows["variantSecret"] : config["variantSecret"]) }; return pushConfig; }
public async Task <string> Register(PushConfig pushConfig) { return(await Register(pushConfig, CreateUPSHttpClient(pushConfig))); }
/// <summary> /// Create an installation with as much details as posible so it's easy to find it again in UPS /// </summary> /// <param name="pushConfig">Push configuration to base the installation off</param> /// <returns>Installation filled with the details</returns> protected abstract Installation CreateInstallation(PushConfig pushConfig);
private IUPSHttpClient CreateUPSHttpClient(PushConfig pushConfig) { return(new UPSHttpClient(pushConfig.UnifiedPushUri, pushConfig.VariantId, pushConfig.VariantSecret)); }
public async Task SendMetricWhenAppLaunched(PushConfig pushConfig, string pushIdentifier) { var client = CreateUPSHttpClient(pushConfig); await client.SendMetrics(pushIdentifier); }
/// <summary> /// Update the entire configuration /// </summary> /// <param name="pushConfig">the configuration to update</param> /// <returns>Void</returns> public async Task UpdateConfig(PushConfig pushConfig) { await UpdateConfig(pushConfig, CreateUPSHttpClient(pushConfig)); }
public async Task <string> Register(PushConfig pushConfig, IUPSHttpClient client) { return(await Register(CreateInstallation(pushConfig), client)); }
public async Task UpdateConfig(PushConfig pushConfig, IUPSHttpClient client) { var installation = CreateInstallation(pushConfig); installation.deviceToken = CreateChannelStore().Read(CHANNEL_KEY).Substring(pushConfig.VariantId.Length); await client.Register(installation); }
public async Task <string> Register(PushConfig pushConfig) { Installation installation = CreateInstallation(pushConfig); return(await Register(installation, CreateUPSHttpClient(pushConfig))); }
public async Task<string> Register(PushConfig pushConfig) { return await Register(pushConfig, CreateUPSHttpClient(pushConfig)); }
private IUPSHttpClient CreateUPSHttpClient(PushConfig pushConfig) { return new UPSHttpClient(pushConfig.UnifiedPushUri, pushConfig.VariantId, pushConfig.VariantSecret); }