Example #1
0
 public static async Task TryUpdateTags(this IPushManager pushManager, params string[] tags)
 {
     if (pushManager is IPushTagSupport tagEnabled)
     {
         await tagEnabled.UpdateTags(tags);
     }
 }
Example #2
0
        public PushViewModel(IPushManager pushManager)
        {
            this.Register = ReactiveCommand.CreateFromTask(
                async() =>
            {
                this.foreground = pushManager
                                  .WhenReceived()
                                  .Subscribe(push =>
                {
                    this.Message = push.Notification?.Message ?? "There was no message but something kicked you!";
                });

                var result = await pushManager.RequestAccess();
                if (result.Status == AccessState.Available)
                {
                    this.Result = "Your push token is " + result.RegistrationToken;
                }
                else
                {
                    this.Result = "FAILED!!";
                }
            }
                );
            this.UnRegister = ReactiveCommand.CreateFromTask(
                async() =>
            {
                await pushManager.UnRegister();
                this.foreground?.Dispose();
            }
                );
        }
Example #3
0
        public SyncManager(bool streamingEnabled,
                           ISynchronizer synchronizer,
                           IPushManager pushManager,
                           ISSEHandler sseHandler,
                           INotificationManagerKeeper notificationManagerKeeper,
                           ITelemetryRuntimeProducer telemetryRuntimeProducer,
                           IStatusManager statusManager,
                           ITasksManager tasksManager,
                           IWrapperAdapter wrapperAdapter,
                           ITelemetrySyncTask telemetrySyncTask,
                           ISplitLogger log = null)
        {
            _streamingEnabled = streamingEnabled;
            _synchronizer     = synchronizer;
            _pushManager      = pushManager;
            _sseHandler       = sseHandler;
            _log = log ?? WrapperAdapter.GetLogger(typeof(Synchronizer));
            _telemetryRuntimeProducer = telemetryRuntimeProducer;
            _statusManager            = statusManager;
            _tasksManager             = tasksManager;
            _wrapperAdapter           = wrapperAdapter;
            _telemetrySyncTask        = telemetrySyncTask;

            _sseHandler.ActionEvent += OnProcessFeedbackSSE;
            notificationManagerKeeper.ActionEvent += OnProcessFeedbackSSE;

            _shutdownCancellationTokenSource = new CancellationTokenSource();
        }
Example #4
0
 public TradersManager(ICryptoApi cryptoApi, IClusterClient clusterClient, IHubNotifier hubNotifier, IPushManager pushManager)
 {
     _cryptoApi     = cryptoApi;
     _clusterClient = clusterClient;
     _hubNotifier   = hubNotifier;
     _pushManager   = pushManager;
 }
 public NotificationsController(IPushManager pushManager,
                                ISubscriptionsRepository subscriptionsRepository, IClusterClient clusterClient)
 {
     _pushManager             = pushManager;
     _subscriptionsRepository = subscriptionsRepository;
     _clusterClient           = clusterClient;
 }
Example #6
0
 public UserManager(IFootChatUserRepository userRepository,
                    ServiceAgent oAuth2Service,
                    IChannelProviderService <IUserManagerService> userManagerServiceChannelProvider,
                    IChannelProviderService <IUserInfoService> userInfoServiceChannelProvider,
                    IMobileManager mobileManager,
                    IStaticResourceManager staticResourceManager,
                    IUserServiceStateRepository userServiceStateRepository,
                    IRepository <Data.UserViewFootPrintRecord> userViewFootPrintRecordRepository,
                    IRepository <Data.UserBusinessArea> userBusinessAreaRepository,
                    IPushManager pushManager,
                    Tgnet.Data.IRepository <Data.ImportUserRecord> importUserRecordRepository,
                    IRepository <Data.UserProduct> userProductRepository
                    )
 {
     _UserRepository = userRepository;
     _OAuth2Service  = oAuth2Service;
     _MobileManager  = mobileManager;
     _UserInfoServiceChannelProvider    = userInfoServiceChannelProvider;
     _UserManagerServiceChannelProvider = userManagerServiceChannelProvider;
     _StaticResourceManager             = staticResourceManager;
     _UserServiceStateRepository        = userServiceStateRepository;
     _UserViewFootPrintRecordRepository = userViewFootPrintRecordRepository;
     _UserBusinessAreaRepository        = userBusinessAreaRepository;
     _PushManager = pushManager;
     _ImportUserRecordRepository = importUserRecordRepository;
     _UserProductRepository      = userProductRepository;
 }
Example #7
0
        public PushManagerTests()
        {
            _authApiClient = new Mock <IAuthApiClient>();
            _log           = new Mock <ISplitLogger>();
            _sseHandler    = new Mock <ISSEHandler>();

            _pushManager = new PushManager(AuthRetryBackOffBase, _sseHandler.Object, _authApiClient.Object, log: _log.Object);
        }
Example #8
0
 public CoinTrader(IClusterClient orleansClient, IHubNotifier hubNotifier, IPushManager pushManager, ICryptoBroker cryptoBroker)
 {
     _orleansClient        = orleansClient;
     _hubNotifier          = hubNotifier;
     _pushManager          = pushManager;
     _cryptoBroker         = cryptoBroker;
     _taskCompletionSource = new TaskCompletionSource <Budget>();
 }
        public AccessViewModel(IJobManager jobs,
                               INotificationManager notifications = null,
                               ISpeechRecognizer speech           = null,
                               IGeofenceManager geofences         = null,
                               IGpsManager gps           = null,
                               ICentralManager bluetooth = null,
                               IBeaconManager beacons    = null,
                               IPushManager push         = null,
                               INfcManager nfc           = null)
        {
            this.Append("Jobs", AccessState.Unknown, () => jobs.RequestAccess());

            if (notifications != null)
            {
                this.Append("Notifications", AccessState.Unknown, () => notifications.RequestAccess());
            }

            if (speech != null)
            {
                this.Append("Speech", AccessState.Unknown, () => speech.RequestAccess());
            }

            if (gps != null)
            {
                this.Append("GPS (Background)", gps.GetCurrentStatus(true), () => gps.RequestAccess(true));
            }

            if (geofences != null)
            {
                this.Append("Geofences", geofences.Status, () => geofences.RequestAccess());
            }

            if (bluetooth != null)
            {
                this.Append("BluetoothLE Central", bluetooth.Status, () => bluetooth.RequestAccess().ToTask(CancellationToken.None));
            }

            if (beacons != null)
            {
                this.Append("iBeacons (Monitoring)", beacons.GetCurrentStatus(true), () => beacons.RequestAccess(true));
            }

            if (push != null)
            {
                this.Append("Push", AccessState.Unknown, async() =>
                {
                    var status = await push.RequestAccess();
                    return(status.Status);
                });
            }

            if (nfc != null)
            {
                this.Append("NFC", AccessState.Unknown, () => nfc.RequestAccess().ToTask(CancellationToken.None));
            }
        }
Example #10
0
 public CryptoHostedService(IOptions <EnvironmentConfig> options, IPushManager pushManager, ICryptoApi cryptoApi, IClusterClient clusterClient, IHubContext <ApplicationHub> hubContext, ITradersManager tradersManager)
 {
     _options        = options;
     _pushManager    = pushManager;
     _cryptoApi      = cryptoApi;
     _clusterClient  = clusterClient;
     _tradersManager = tradersManager;
     _hubNotifier    = new HubNotifier(hubContext);
     _cryptoApi.Initialize(options.Value.BittrexApiKey, options.Value.BittrexApiSecret, options.Value.TestMode, true);
 }
Example #11
0
        /// <summary>
        /// If manager supports tags, it will set the tags
        /// </summary>
        /// <param name="pushManager"></param>
        /// <param name="tags"></param>
        /// <returns></returns>
        public static async Task <bool> TrySetTags(this IPushManager pushManager, params string[] tags)
        {
            if (pushManager is IPushTagSupport tagEnabled)
            {
                await tagEnabled.SetTags(tags).ConfigureAwait(false);

                return(true);
            }
            return(false);
        }
Example #12
0
        /// <summary>
        /// If manager supports tags & permission is granted to push, it will set the tags
        /// </summary>
        /// <param name="pushManager"></param>
        /// <param name="tags"></param>
        /// <returns></returns>
        public static async Task <PushAccessState> TryRequestAccessWithTags(this IPushManager pushManager, params string[] tags)
        {
            var result = await pushManager.RequestAccess().ConfigureAwait(false);

            if (result.Status == AccessState.Available)
            {
                await pushManager.TrySetTags(tags).ConfigureAwait(false);
            }

            return(result);
        }
Example #13
0
 public NotifyServiceProxy(
     IMessageService messageService,
     IUserNameProviderFactory userNameProviderFactory,
     IPushManager pushManager,
     IUserNotifyTypeProvider userNotifyTypeProvider)
 {
     _MessageService          = messageService;
     _UserNameProviderFactory = userNameProviderFactory;
     _PushManager             = pushManager;
     _UserNotifyTypeProvider  = userNotifyTypeProvider;
 }
Example #14
0
        public PushManagerTests()
        {
            _authApiClient            = new Mock <IAuthApiClient>();
            _log                      = new Mock <ISplitLogger>();
            _sseHandler               = new Mock <ISSEHandler>();
            _telemetryRuntimeProducer = new Mock <ITelemetryRuntimeProducer>();
            var wrapper = new WrapperAdapter();
            var backoff = new BackOff(1, 1);

            _pushManager = new PushManager(_sseHandler.Object, _authApiClient.Object, wrapper, _telemetryRuntimeProducer.Object, backoff, _log.Object);
        }
Example #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pushManager"></param>
        /// <param name="tags"></param>
        /// <param name="cancelToken"></param>
        /// <returns></returns>
        public static async Task <PushAccessState> TryRequestAccessWithTags(this IPushManager pushManager, string[] tags, bool throwOnFail = false, CancellationToken cancelToken = default)
        {
            var result = await pushManager.RequestAccess(cancelToken);

            if (pushManager is IPushTagSupport tagEnabled)
            {
                await tagEnabled.SetTags(tags);
            }

            return(result);
        }
Example #16
0
        public PushViewModel(SampleSqliteConnection conn,
                             IUserDialogs dialogs,
                             IPushManager pushManager = null) : base(dialogs)
        {
            this.conn = conn;

            this.CheckPermission = ReactiveCommand.CreateFromTask(async() =>
            {
                var status        = await pushManager.RequestAccess();
                this.AccessStatus = status.Status;
                this.RegToken     = status.RegistrationToken;
            });
        }
Example #17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pushManager"></param>
        /// <param name="tags"></param>
        /// <param name="throwOnFail"></param>
        /// <param name="cancelToken"></param>
        /// <returns></returns>
        public static Task <PushAccessState> TryRequestAccessWithTags(this IPushManager pushManager, string[] tags, bool throwOnFail = false, CancellationToken cancelToken = default)
        {
            if (pushManager is IPushTagSupport tagEnabled)
            {
                return(tagEnabled.RequestAccess(tags, cancelToken));
            }

            if (throwOnFail)
            {
                throw new ArgumentException("Push mananger is not tag enabled");
            }

            return(pushManager.RequestAccess(cancelToken));
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="navigationService">NavigationService</param>
        /// <param name="pushManager">PushManager</param>
        /// /// <param name="pageDialogService">PageDialogService</param>
        public PushManagerPageViewModel(INavigationService navigationService, IPushManager pushManager, IPageDialogService pageDialogService) : base(navigationService)
        {
            this.Title             = Message.PageTitle.PushManagerPage;
            this.pageDialogService = pageDialogService;
            this.ButtonTypes.Value = new string[] { "All", "User", "Category" };

            this.notificationCategories.Add(new NotificationCategory("JapaneseFood", "和食", false));
            this.notificationCategories.Add(new NotificationCategory("FrenchFood", "フレンチ", false));
            this.notificationCategories.Add(new NotificationCategory("ChineseFood", "中華", false));
            this.Categories.Value = this.notificationCategories;

            // Pushボタンイベント付与
            this.PushCommand.Subscribe(async(x) => await this.SendPush(x));
            this.pushManager = pushManager;
        }
Example #19
0
        public TagsViewModel(IPushManager pushManager, IDialogs dialogs)
        {
            var tags = pushManager as IPushTagSupport;

            this.Add = ReactiveCommand.CreateFromTask(async() =>
            {
                var result = await dialogs.Input("Name of tag?");
                if (!result.IsEmpty())
                {
                    await tags.AddTag(result);
                    this.Load.Execute(null);
                }
            });

            this.Clear = ReactiveCommand.CreateFromTask(async() =>
            {
                var result = await dialogs.Confirm("Are you sure you wish to clear all tags?");
                if (result)
                {
                    await tags.ClearTags();
                    this.Load.Execute(null);
                }
            });

            this.Load = ReactiveCommand.Create(() =>
            {
                this.Tags = tags
                            .RegisteredTags
                            .Select(tag => new CommandItem
                {
                    Text           = tag,
                    PrimaryCommand = ReactiveCommand.CreateFromTask(async() =>
                    {
                        var result = await dialogs.Confirm($"Are you sure you wish to remove tag '{tag}'?");
                        if (result)
                        {
                            await tags.RemoveTag(tag);
                            this.Load.Execute(null);
                        }
                    })
                })
                            .ToList();

                this.RaisePropertyChanged(nameof(this.Tags));
            });
        }
Example #20
0
        public SyncManager(bool streamingEnabled,
                           ISynchronizer synchronizer,
                           IPushManager pushManager,
                           ISSEHandler sseHandler,
                           INotificationManagerKeeper notificationManagerKeeper,
                           ISplitLogger log = null)
        {
            _streamingEnabled = streamingEnabled;
            _synchronizer     = synchronizer;
            _pushManager      = pushManager;
            _sseHandler       = sseHandler;
            _log = log ?? WrapperAdapter.GetLogger(typeof(Synchronizer));

            _sseHandler.ConnectedEvent  += OnProcessFeedbackSSE;
            _sseHandler.DisconnectEvent += OnProcessFeedbackSSE;
            notificationManagerKeeper.OccupancyEvent    += OnOccupancyEvent;
            notificationManagerKeeper.PushShutdownEvent += OnPushShutdownEvent;
        }
Example #21
0
 public AndroidPushDelegate(IPushManager pushManager) => this.pushManager = pushManager;
Example #22
0
 public PushDelegate(CoreDelegateServices services, IPushManager pushManager)
 {
     this.services    = services;
     this.pushManager = pushManager;
 }
Example #23
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="push"></param>
 /// <returns></returns>
 public static bool IsTagsSupport(this IPushManager push)
 => push is IPushTagSupport;
Example #24
0
 /// <summary>
 /// If the push manager supports tags, this will call the ClearTags method
 /// </summary>
 /// <param name="pushManager"></param>
 /// <returns></returns>
 public static Task TryClearTags(this IPushManager pushManager)
 => (pushManager as IPushTagSupport)?.ClearTags() ?? Task.CompletedTask;
Example #25
0
 /// <summary>
 /// If the push manager supports tags, this will call the RemoveTag method
 /// </summary>
 /// <param name="pushManager"></param>
 /// <param name="tag"></param>
 /// <returns></returns>
 public static Task TryRemoveTag(this IPushManager pushManager, string tag)
 => (pushManager as IPushTagSupport)?.RemoveTag(tag) ?? Task.CompletedTask;
Example #26
0
 public static void TrySetProperties(this IPushManager push, params (string Property, string Value)[] properties)
Example #27
0
 public WalletController(ICryptoApi cryptoApi, IOptions <EnvironmentConfig> options, IPushManager pushManager)
 {
     _cryptoApi   = cryptoApi;
     _pushManager = pushManager;
     _cryptoApi.Initialize(options.Value.BittrexApiKey, options.Value.BittrexApiSecret, options.Value.TestMode);
 }
Example #28
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="push"></param>
 /// <returns></returns>
 public static string[]? TryGetTags(this IPushManager push)
 => (push as IPushTagSupport)?.RegisteredTags;
Example #29
0
 public NotificationBackgroundJob(AbpTimer timer, IRepository <PhoneNotification> phoneNotificationsRepository, IPushManager pushManager) : base(timer)
 {
     _phoneNotificationsRepository = phoneNotificationsRepository;
     _pushManager = pushManager;
     timer.Period = 5000;
 }
Example #30
0
 public static IReadOnlyDictionary <string, string>?TryGetProperties(this IPushManager push)
 => (push as IPushPropertySupport)?.CurrentProperties;