Gmail UI Refresh

427 views
Skip to first unread message

Benjamin Edwards

unread,
Oct 26, 2016, 5:44:34 PM10/26/16
to InboxSDK
Hey guys,

So far love the API and it seems to be working great.

Right know I am using InboxSDK to register some buttons on the Message Toolbar. When the user clicks this button I am making requests to the Gmail API such as:


POST https://www.googleapis.com/gmail/v1/users/userId/messages/id/trash


Where I get the ID from the MessageView passed in.

This appropriately marks the message as trash, but can I have the UI update without causing a full page refresh?

When you 'Delete' a message using the standard Gmail UI you get returned to your inbox and a "butter bar" pops up saying the conversation was moved to trash.

Now obviously I know since I am interacting with the REST API, its not going to magically refresh the UI, but I was wondering if InboxSDK had any hooks into this behaviour?

Thanks,

Ben

Chris Cowan

unread,
Oct 26, 2016, 5:52:47 PM10/26/16
to InboxSDK
If the user is at a ListRouteView (ie. the inbox) then the ListRouteView object has a refresh() method which simulates a click on the gmail reload button which will update the UI. If the user is inside the thread, then if you want the behavior of seeing a butter bar message and redirecting the user to the inbox, then you'll need to do that yourself with the SDK (with our ButterBar and Router.goto(...) APIs) because I don't believe Gmail ever does that itself except when the local user hits the delete button in that session.

Benjamin Edwards

unread,
Oct 26, 2016, 5:55:05 PM10/26/16
to InboxSDK
Just started looking at the Route API...duh. Thanks man.
Reply all
Reply to author
Forward
0 new messages