Skip to content

Commit

Permalink
add device messages about removed oauth2, resulting in non-working gm…
Browse files Browse the repository at this point in the history
…ail logins
  • Loading branch information
r10s committed Aug 14, 2024
1 parent 19b890c commit f260a1b
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static org.thoughtcrime.securesms.ConversationActivity.CHAT_ID_EXTRA;
import static org.thoughtcrime.securesms.ConversationActivity.STARTING_POSITION_EXTRA;
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_SERVER_FLAGS;
import static org.thoughtcrime.securesms.util.RelayUtil.acquireRelayMessageContent;
import static org.thoughtcrime.securesms.util.RelayUtil.getDirectSharingChatId;
import static org.thoughtcrime.securesms.util.RelayUtil.getSharedTitle;
Expand Down Expand Up @@ -141,6 +142,21 @@ protected void onCreate(Bundle icicle, boolean ready) {
}
// /add info


// add info about how to exit gmail's oauth2.
// we add the info just by checking DC_LP_AUTH_OAUTH2,
// as there are eg. custom domains and we do not have the information "is-google" in the frontend,
// and it is not worth trying to get that, majority of oauth2 is google.
// also, we cannot really test this.
// (there may be false positive in case of yandex, but that is probably an even smaller number)
final int serverFlags = dcContext.getConfigInt(CONFIG_SERVER_FLAGS);
if ((serverFlags & DcContext.DC_LP_AUTH_OAUTH2)!=0) {
DcMsg msg = new DcMsg(dcContext, DcMsg.DC_MSG_TEXT);
msg.setText("⚠️ GMail Users: If you have problems using GMail, go to \"Settings / Advanced / Password and Account\" and login again using an \"App Password\".\n\nThe login will show more hints.");
dcContext.addDeviceMsg("info_about_gmail_oauth2_removal4", msg);
}
// /add info

} catch(Exception e) {
e.printStackTrace();
}
Expand Down

0 comments on commit f260a1b

Please sign in to comment.