From f260a1bcaaccd4c500ec6e20f6c608b55af3bea0 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Wed, 14 Aug 2024 15:25:34 +0200 Subject: [PATCH] add device messages about removed oauth2, resulting in non-working gmail logins --- .../securesms/ConversationListActivity.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/org/thoughtcrime/securesms/ConversationListActivity.java b/src/main/java/org/thoughtcrime/securesms/ConversationListActivity.java index 852298cad0..df6b238649 100644 --- a/src/main/java/org/thoughtcrime/securesms/ConversationListActivity.java +++ b/src/main/java/org/thoughtcrime/securesms/ConversationListActivity.java @@ -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; @@ -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(); }