/* Facebook Page */
        // page => OK / Android
        //await Xamarin.Essentials.Launcher.OpenAsync("fb://page/115592608462989");
        // page => OK / iOS
        //await Xamarin.Essentials.Launcher.OpenAsync("fb://profile/115592608462989");
        public async Task OpenFacebookPageAsync(string uri, string pageId)
        {
            try
            {
                var fbDlS = await IsFacebookDeepLinkingSupported();

                if (fbDlS)
                {
                    if (Device.RuntimePlatform == Device.iOS)
                    {
                        await Launcher.OpenAsync($"fb://profile/{pageId}");
                    }
                    else if (Device.RuntimePlatform == Device.Android)
                    {
                        await Launcher.OpenAsync($"fb://page/{pageId}");
                    }
                }
                else
                {
                    await _browser.OpenAsync(uri);
                }
            }
            catch (Exception ex)
            {
                // An error has occurred
                _eventTracker.Error(ex);

                await _browser.OpenAsync(uri);
            }
        }
Exemplo n.º 2
0
 public Task OpenAsync(string uri)
 {
     try
     {
         return(Xamarin.Essentials.Browser.OpenAsync(uri));
     }
     catch (Exception ex)
     {
         _eventTracker.Error(ex);
         return(Task.CompletedTask);
     }
 }
        private void Refresh(object sender)
        {
            Debug.WriteLine($"BookingViewModel - Refresh()");
            _eventTracker?.Click(EventName.RefreshBookingWebview, EventPage.BookingPage, EventPage.BookingPage);

            try
            {
                var webView = sender as CustomWebView;
                ReloadWebview(webView);
            }
            catch (Exception ex)
            {
                _eventTracker.Error(ex);
            }
        }
Exemplo n.º 4
0
 public async Task OpenAsync(Placemark placemark, MapLaunchOptions options)
 {
     try
     {
         await Xamarin.Essentials.Map.OpenAsync(placemark, options);
     }
     catch (Exception ex)
     {
         // No map application available to open or placemark can not be located
         _eventTracker.Error(ex);
     }
 }
Exemplo n.º 5
0
        private async Task GetNewsAsync(bool forceRefresh = false)
        {
            Debug.WriteLine("NewsViewModel - GetNewsAsync()");
            try
            {
                ShowErrorView = false;
                ErrorKind     = ServiceErrorKind.None;
                IsBusy        = true;

                ShowLoadingView = HasEmptyData;

                await Task.Delay(250);

                var newsAndEvents = await _dataService.GetNewsAndEvents(forceRefresh);

                News   = new ObservableCollection <News>(newsAndEvents.news);
                Events = new ObservableCollection <Event>(newsAndEvents.events);
            }
            catch (IOException ioEx)
            {
                Debug.WriteLine($"NewsViewModel - GetNewsAsync() - IOException : {ioEx.Message}");
                _eventTracker.Error(ioEx);
                ErrorKind = ServiceErrorKind.NoInternetAccess;
            }
            catch (WebException wEx)
            {
                Debug.WriteLine($"NewsViewModel - GetNewsAsync() - WebException : {wEx.Message}");
                _eventTracker.Error(wEx);
                ErrorKind = ServiceErrorKind.ServiceIssue;
            }
            catch (TimeoutRejectedException trEx)
            {
                Debug.WriteLine($"NewsViewModel - GetNewsAsync() - TimeoutRejectedException : {trEx.Message}");
                _eventTracker.Error(trEx);
                ErrorKind = ServiceErrorKind.Timeout;
            }
            catch (Exception ex)
            {
                _eventTracker.Error(ex);
                Debug.WriteLine($"NewsViewModel - GetNewsAsync() - Exception : {ex.Message}");
                ErrorKind = ServiceErrorKind.ServiceIssue;
            }
            finally
            {
                Debug.WriteLine("NewsViewModel - GetNewsAsync() - Finally");

                IsBusy = false;

                if (News.Count > 0 || Events.Count > 0)
                {
                    HasEmptyData = false;
                }

                if (IsRefreshing)
                {
                    await SetErrorViewAsync();
                }
            }
        }
Exemplo n.º 6
0
 public void Call(string phoneNumber)
 {
     try
     {
         PhoneDialer.Open(phoneNumber);
     }
     catch (ArgumentNullException anEx)
     {
         // Number was null or white space
         _eventTracker.Error(anEx);
     }
     catch (FeatureNotSupportedException fnsEx)
     {
         // Phone Dialer is not supported on this device
         _eventTracker.Error(fnsEx);
     }
     catch (Exception ex)
     {
         // Other error has occurred
         _eventTracker.Error(ex);
     }
 }