private void registerTokenToBandyer() { if (Device.RuntimePlatform == Device.iOS) { BandyerSdkForms.RegisterTokenToBandyerIos(); } else if (Device.RuntimePlatform == Device.Android) { BandyerSdkForms.RegisterTokenToBandyerAndroid(); } }
protected override void OnAppearing() { base.OnAppearing(); registerTokenToBandyer(); var loggedUserAlias = BandyerSdkForms.GetLoggedUserAlias(); var allUsersDetails = BandyerSdkForms.Instance.Callers.Concat(BandyerSdkForms.Instance.Callee).ToList(); BandyerSdkForms.Instance.BandyerSdk.SetUserDetails(allUsersDetails); BandyerSdkForms.Instance.BandyerSdk.Init(loggedUserAlias); BandyerSdkForms.Instance.BandyerSdk.OnPageAppearing(); }
void ListView_ItemTapped(System.Object sender, Xamarin.Forms.ItemTappedEventArgs e) { var obj = e.Item as BandyerSdkForms.User; if (obj == null) { return; } BandyerSdkForms.SetLoggedUserAlias(obj.Alias); App.Instance.ResetMainPage(); }
async void Logout() { var result = await this.DisplayAlert(null, "Logout current user?", "Yes", "No"); if (result) { BandyerSdkForms.UnregisterTokenToBandyer(); BandyerSdkForms.SetLoggedUserAlias(""); BandyerSdkForms.Instance.BandyerSdk.Stop(); App.Instance.ResetMainPage(); } }
public void ResetMainPage() { ContentPage page; if (String.IsNullOrEmpty(BandyerSdkForms.GetLoggedUserAlias())) { page = new ChooseCallerPage(); } else { page = new ChooseCalleePage(); } var navPage = new NavigationPage(page); navPage.BarTextColor = Color.White; navPage.BarBackgroundColor = Color.FromHex("#004c8c"); MainPage = navPage; }
public ChooseCalleePage() { InitializeComponent(); BandyerSdkForms.Instance.BandyerSdk.ChatStatus += ChatStatus; BandyerSdkForms.Instance.BandyerSdk.CallStatus += CallStatus; ToolbarItems.Add(new ToolbarItem() { Text = "Logout", Command = new Command(Logout), }); var loggedUserAlias = BandyerSdkForms.GetLoggedUserAlias(); mainLabel.Text = "Logged as: " + loggedUserAlias + ". Who do you want to call or chat with?"; userList.ItemsSource = BandyerSdkForms.Instance.Callee; chatPopup = new ChatConfigPopupPage(); callPopup = new CallConfigPopupPage(); }