/// Method use to set campaign list data into recycler view. /// </summary> /// <param name="data"></param> /// <param name="recordType"></param> public void SetInboxList(List <EmailResponse> data) { if (mAdapter == null) { mAdapter = new InboxAdapter(Activity); mAdapter.ItemClick += MAdapter_ItemClick; mAdapter.SetData(data); rvInbox.SetAdapter(mAdapter); } else { mAdapter.NotifyDataSetChanged(); } if (mAdapter.GetData() != null && mAdapter.GetData().Count > 0) { rvInbox.Visibility = ViewStates.Visible; tvPullRefresh.Visibility = ViewStates.Gone; } else { rvInbox.Visibility = ViewStates.Gone; tvPullRefresh.Visibility = ViewStates.Visible; } }
static async Task Inbox_SlackAdapterPerAppTestAsync() { using (Inbox inbox = new Inbox()) { InboxAdapter slackAdapter = inbox.AddAdapter(Str.NewGuid(), Consts.InboxProviderNames.Slack_App, new InboxAdapterAppCredential { ClientId = "687264585408.675851234162", ClientSecret = "_________________" }); inbox.StartAdapter(slackAdapter.Guid, new InboxAdapterUserCredential { AccessToken = "_________________" }); inbox.StateChangeEventListener.RegisterCallback((caller, type, state, eventArg) => { var box = inbox.GetMessageBox(); box._PrintAsJson(); }); Con.ReadLine(); } await Task.CompletedTask; }
static async Task Inbox_GmailAdapterTestAsync() { using (Inbox inbox = new Inbox()) { InboxAdapter gmailAdapter = inbox.AddAdapter(Str.NewGuid(), Consts.InboxProviderNames.Gmail, new InboxAdapterAppCredential { ClientId = "651284401399-d2bth85kk6rks1no1dllb3k0d6mrornt.apps.googleusercontent.com", ClientSecret = "_________________" }); inbox.StartAdapter(gmailAdapter.Guid, new InboxAdapterUserCredential { AccessToken = "_________________" }); inbox.StateChangeEventListener.RegisterCallback((caller, type, state, eventArg) => { var box = inbox.GetMessageBox(); box._PrintAsJson(); }); Con.ReadLine(); } await Task.CompletedTask; }
public string AddAccount(Account a) { string guid = Str.NewGuid(); InboxAdapter adapter = Inbox.AddAdapter(guid, a.ProviderName, new InboxAdapterAppCredential { ClientId = a.AppClientId, ClientSecret = a.AppClientSecret }); SaveSettingsFile(); return(guid); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.Inflate(Resource.Layout.InboxFragment, container, false); // v.SetLayerType(LayerType.Hardware, null); lstSource = new List <Chat>(); rv = v.FindViewById <RecyclerView>(Resource.Id.recycle); layoutmanager = new LinearLayoutManager(this.Activity); lstSource.Add(new Chat() { sid = 1, name = "George", msg = "Hiiii,How are u???", time = "4:00 AM", count = 10, image = Resource.Drawable.user5 }); lstSource.Add(new Chat() { sid = 2, name = "Hank", msg = "Hellooo", time = "5:00 AM", count = 11, image = Resource.Drawable.user5 }); lstSource.Add(new Chat() { sid = 3, name = "Harry", msg = "303-304,Airen Heights,wore House roadrrrrrrrrrrrrrrrrrrrrrrrrrr", time = "6:00 AM", count = 1, image = Resource.Drawable.user5 }); lstSource.Add(new Chat() { sid = 4, name = "Henryy", msg = "303-304,Airen Heights,wore House roadrrrrrrrrrrrrrrrrrrrrrrrrrr", time = "6:00 AM", count = 4, image = Resource.Drawable.user5 }); lstSource.Add(new Chat() { sid = 5, name = "Benjamin", msg = "303-304,Airen Heights,wore House roadrrrrrrrrrrrrrrrrrrrrrrrrrr", time = "6:00 AM", count = 10, image = Resource.Drawable.user5 }); lstSource.Add(new Chat() { sid = 6, name = "Benjamin", msg = "303-304,Airen Heights,wore House roadrrrrrrrrrrrrrrrrrrrrrrrrrr", time = "6:00 AM", count = 10, image = Resource.Drawable.user5 }); lstSource.Add(new Chat() { sid = 7, name = "Benjamin", msg = "303-304,Airen Heights,wore House roadrrrrrrrrrrrrrrrrrrrrrrrrrr", time = "6:00 AM", count = 10, image = Resource.Drawable.user5 }); lstSource.Add(new Chat() { sid = 8, name = "Benjamin", msg = "303-304,Airen Heights,wore House roadrrrrrrrrrrrrrrrrrrrrrrrrrr", time = "6:00 AM", count = 10, image = Resource.Drawable.user5 }); adp = new InboxAdapter(lstSource); adp.ItemClick += Adp_ItemClick; rv.SetAdapter(adp); rv.SetLayoutManager(layoutmanager); return(v); }
public FastReader() { try { this.Inbox = new Inbox(new InboxOptions(recordRealtimeTextLog: true)); this.Inbox.StateChangeEventListener.RegisterCallback(async(caller, type, state, args) => { UpdatedCallback(); await Task.CompletedTask; }); this.AccountsHive = Hive.LocalAppSettingsEx["Accounts"]; this.AccountsHive.AccessData(true, k => { var initial = new AccountSettingList(); AccountSettingList o = k.Get("AccountList", initial) !; foreach (AccountSetting account in o.List) { if (account.ProviderName._IsSamei(Consts.InboxProviderNames.Slack_Old)) { account.ProviderName = Consts.InboxProviderNames.Slack_App; } InboxAdapter a = this.Inbox.AddAdapter(account.Guid, account.ProviderName, new InboxAdapterAppCredential { ClientId = account.AppClientId, ClientSecret = account.AppClientSecret }); if (account.UserAccessToken._IsFilled()) { a.Start(new InboxAdapterUserCredential { AccessToken = account.UserAccessToken }); } else if (account.ProviderName._IsSamei(Consts.InboxProviderNames.Slack_User)) { // Special: Slack legacy tokens a.Start(new InboxAdapterUserCredential()); } } }); } catch { this._DisposeSafe(); throw; } }
public async Task <IActionResult> AuthCallback(string code, string state) { if (code._IsEmpty() || state._IsEmpty()) { throw new ApplicationException($"この URL は認証サービスからのコールバック専用です。直接アクセスすることはできません。"); } string id = state; InboxAdapter adapter = Reader.GetAdapter(id); InboxAdapterUserCredential credential = await adapter.AuthGetCredentialAsync(code, this.GenerateAbsoluteUrl(nameof(AuthCallback))); adapter.Start(credential); Reader.SaveSettingsFile(); return(Redirect("/")); }
public IActionResult AuthStart(string id) { InboxAdapter adapter = Reader.GetAdapter(id); string callbackUrl = this.GenerateAbsoluteUrl(nameof(AuthCallback)); string authUrl = adapter.AuthStartGetUrl(callbackUrl, id); if (authUrl._IsEmpty()) { // No need to auth redirect adapter.Start(new InboxAdapterUserCredential()); Reader.SaveSettingsFile(); return(Redirect("/")); } return(Redirect(authUrl)); }
private void LoadElements() { if (_inboxList != null && _inboxList.Any()) { _inboxListView = _view.FindViewById <ListView>(Resource.Id.inboxListView); var notificationAdapter = new InboxAdapter(Activity, _inboxList); var inboxLayout = _view.FindViewById <LinearLayout>(Resource.Id.inboxListLayout); inboxLayout.Visibility = ViewStates.Visible; _lottieAnimation.Visibility = ViewStates.Gone; _inboxListView.Adapter = notificationAdapter; notificationAdapter.NotifyDataSetChanged(); } else { _emptyState = _view.FindViewById <LinearLayout>(Resource.Id.empty_state); _emptyState.Visibility = ViewStates.Visible; _lottieAnimation.Visibility = ViewStates.Gone; } _lottieAnimation.Dispose(); GarbageCollector(); }
private void GetInboxRemote() { AndHUD.Shared.Show(this, "Please wait ...", -1, MaskType.Clear); string url = Settings.InstanceURL; var url2 = url + "/Api/GetInboxItems"; var json2 = new { Item = new { ReferenceNumber = Settings.RefNumber, } }; try { var ObjectReturn2 = new InboxReturnModel(); string results = ConnectWebAPI.Request(url2, json2); if (string.IsNullOrEmpty(results)) { AndHUD.Shared.Dismiss(); this.RunOnUiThread(() => alert = new Alert(this, "Error", Resources.GetString(Resource.String.NoServer))); this.RunOnUiThread(() => alert.Show()); } else { ObjectReturn2 = Newtonsoft.Json.JsonConvert.DeserializeObject <InboxReturnModel>(results); AndHUD.Shared.Dismiss(); if (ObjectReturn2.IsSuccess) { this.InboxNewList = ObjectReturn2.InboxList.ToList(); // Save New inbox item into Local Database InsertNewInboxItem(); //Sort List this.InboxFinalList = InboxFinalList.OrderByDescending(o => o.MessageNo).ToList(); if (this.InboxFinalList.Count == 0) { this.inboxListView.Clickable = false; this.inboxListView.ChoiceMode = ChoiceMode.None; this.inboxListView.Selector = Resources.GetDrawable(Android.Resource.Color.Transparent); } else { this.inboxListView.ItemClick += inboxList_ItemClick; } this.inboxAdapter = new InboxAdapter(this, this.InboxFinalList); this.inboxListView.Adapter = this.inboxAdapter; this.inboxListView.InvalidateViews(); } else { this.RunOnUiThread(() => alert = new Alert(this, "Error", ObjectReturn2.Errors[0].ErrorMessage)); this.RunOnUiThread(() => alert.Show()); } } } catch (Exception ee) { AndHUD.Shared.Dismiss(); } }