You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use Gmail API for Gmail accounts in all situations #2122
What about existing users? I mean who is already sign-in. Can we still use IMAP for them? On my side, it will be simpler to leave it as-is. After logout-login they will use Gmail API.
The access token is the same, right? Is it because you store different things when they use IMAP? So the problematic part is already existing local storatge / cache?
Of course, for now, you could still leave original users as they are. I just worry we'll forget about it one day, and cause trouble. Because you won't be able to change things if you still have some users on IMAP that cannot be properly tested.
Could you somewhere add a condition that if imap is used and it is gmail account, always pretend to throw an auth error when connecting to IMAP? That should pull up authorization / re-connect screen (existing code), which should cause the app to then switch to Gmail API mode (after this update). That would maybe take care of the problem easily? Just brainstorming how to do the right thin without too much extra work.
Could you somewhere add a condition that if imap is used and it is gmail account, always pretend to throw an auth error when connecting to IMAP? That should pull up authorization / re-connect screen (existing code), which should cause the app to then switch to Gmail API mode (after this update). That would maybe take care of the problem easily? Just brainstorming how to do the right thin without too much extra work.
@sosnovsky I have more details. Unfortunately, moving to use Gmail API for users who are already logged in and use IMAP protocol is impossible without logout-login. Caching - is the reason. We use some additional fields for Gmail API when we load messages which are empty in the IMAP realization. So, we will have the following logic after allowing Gmail API for all:
already logged users will use IMAP. After logout-login, they will use Gmail API
not-logged users will use Gmail API right after login
What about solution proposed by Tom - after this update throw auth error for users who use imap, so they'll need to re-login? Will it clear cache and add needed fields for Gmail API or they'll need manually logout and then re-login?
"manually logout-login" - means the user understands what he is doing. And this makes all process clear. We logout, clear all old things, then login with a new method.
"throw auth error for users who use imap, so they'll need to re-login" - this case is a bit difficult. I really need to clear old data in a few tables before proceed. If I choose this method for a user it will mean he will lost some cached data like info about messages and attachments. If it looks ok, I can try to do that. Need to add that technically we do not need to re-login via Google sign-in. We use the same token for Gmail API and IMAP. So just need to clear some cache.
Need to add that technically we do not need to re-login via Google sign-in. We use the same token for Gmail API and IMAP. So just need to clear some cache.
So, in theory, we can migrate user data from IMAP to Gmail API without any user interaction?
And for missing fields from Gmail API - can we just re-fetch them when user opens message?
Then on the first start after update we can show splash screen with message like Optimizing local data, please wait..., while in background we'll download the latest messages. When messages will be downloaded (should take just some seconds, I think) app will go to home screen.
I've added new changes that include the cache cleaning. It works fast so we don't need to show a splash screen. So I think our migration will look smooth.
Does 1.4.3 include automatic email retrieval even when the app is closed?
We used to use Gmail API for the enterprise only. From 1.4.3 we will use Gmail API for all users who use Google Sign-in. automatic email retrieval works for all users, but it works differently for Gmail API and IMAP. IMAP has idle and automatic email retrieval can work faster. Gmail API fetches updates no more than once every 15 minutes.
Activity
DenBond7 commentedon Jan 3, 2023
@tomholub @martgil Also please look at this comment, position 1). Other questions are not actual today.
#932 (comment)
tomholub commentedon Jan 3, 2023
copy @sosnovsky
you could also run a refresh every time user navigates to the inbox screen
For example:
etc
DenBond7 commentedon Jan 23, 2023
@tomholub Would you like to just switch to using Gmail API for all users or should I add an opportunity to use both options
It will not be possible to switch protocols after a setup from settings. A user will have to logout-login to choose another option.
tomholub commentedon Jan 23, 2023
I don't think we should give them option. Gmail means use Gmail API
DenBond7 commentedon Jan 23, 2023
What about existing users? I mean who is already sign-in. Can we still use IMAP for them? On my side, it will be simpler to leave it as-is. After
logout-loginthey will use Gmail API.tomholub commentedon Jan 23, 2023
The access token is the same, right? Is it because you store different things when they use IMAP? So the problematic part is already existing local storatge / cache?
DenBond7 commentedon Jan 23, 2023
Yes. In that case, I have to review all things and the migration process.
DenBond7 commentedon Jan 23, 2023
It's not a problem. Just it will be more work.
tomholub commentedon Jan 23, 2023
Of course, for now, you could still leave original users as they are. I just worry we'll forget about it one day, and cause trouble. Because you won't be able to change things if you still have some users on IMAP that cannot be properly tested.
Could you somewhere add a condition that if imap is used and it is gmail account, always pretend to throw an auth error when connecting to IMAP? That should pull up authorization / re-connect screen (existing code), which should cause the app to then switch to Gmail API mode (after this update). That would maybe take care of the problem easily? Just brainstorming how to do the right thin without too much extra work.
DenBond7 commentedon Jan 23, 2023
Got it. I will investigate my code and share more details a bit later.
6 remaining items
DenBond7 commentedon Mar 20, 2023
@sosnovsky I have more details. Unfortunately, moving to use
Gmail APIfor users who are already logged in and useIMAPprotocol is impossible without logout-login. Caching - is the reason. We use some additional fields for Gmail API when we load messages which are empty in theIMAPrealization. So, we will have the following logic after allowing Gmail API for all:IMAP. After logout-login, they will useGmail APIGmail APIright after loginUpdated RetryRule.| #2122
sosnovsky commentedon Mar 20, 2023
What about solution proposed by Tom - after this update throw auth error for users who use
imap, so they'll need to re-login? Will it clear cache and add needed fields for Gmail API or they'll need manually logout and then re-login?DenBond7 commentedon Mar 20, 2023
sosnovsky commentedon Mar 20, 2023
So, in theory, we can migrate user data from IMAP to Gmail API without any user interaction?
And for missing fields from Gmail API - can we just re-fetch them when user opens message?
DenBond7 commentedon Mar 20, 2023
Yup. For now I see that. But need to clear cache. It will look like a user just logged in.
No, we can not. Need to clear cache for a user completely. It will look like a user just logged in.
sosnovsky commentedon Mar 20, 2023
Then on the first start after update we can show splash screen with message like
Optimizing local data, please wait..., while in background we'll download the latest messages. When messages will be downloaded (should take just some seconds, I think) app will go to home screen.What do you think?
Updated the database version to 36. Added a migration.| #2122
Modified DraftViewModel.| #2122
DenBond7 commentedon Mar 22, 2023
I've added new changes that include the cache cleaning. It works fast so we don't need to show a splash screen. So I think our migration will look smooth.
DenBond7 commentedon Mar 23, 2023
@martgil Please note that starting with version 1.4.3, all users using Google Sign-in will use the Gmail API instead of IMAP.
martgil commentedon Mar 23, 2023
Got it - Thank you, sir Den. Does 1.4.3 include automatic email retrieval even when the app is closed?
DenBond7 commentedon Mar 23, 2023
We used to use
Gmail APIfor the enterprise only. From 1.4.3 we will useGmail APIfor all users who use Google Sign-in.automatic email retrievalworks for all users, but it works differently forGmail APIandIMAP.IMAPhas idle andautomatic email retrievalcan work faster.Gmail APIfetches updates no more than once every 15 minutes.Fixed DraftsGmailAPITestCorrectCreatingAndUpdatingFlowTest.| #2122
Reverted back some changes.| #2122