From 330313ae593ebf98fb37712cbdcf8f06c81c2e37 Mon Sep 17 00:00:00 2001 From: Sam Steele Date: Mon, 15 Jul 2024 10:08:46 -0400 Subject: [PATCH] imgur migration notice --- .../irccloud/android/IRCCloudApplication.java | 1 + .../android/activity/MainActivity.java | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/com/irccloud/android/IRCCloudApplication.java b/src/com/irccloud/android/IRCCloudApplication.java index c5af6128..3888a017 100644 --- a/src/com/irccloud/android/IRCCloudApplication.java +++ b/src/com/irccloud/android/IRCCloudApplication.java @@ -113,6 +113,7 @@ public synchronized void onReceive(Context context, Intent intent) { editor.remove("imgur_refresh_token"); editor.remove("imgur_token_type"); editor.remove("imgur_expires_in"); + editor.putBoolean("imgur_removed", true); editor.apply(); } diff --git a/src/com/irccloud/android/activity/MainActivity.java b/src/com/irccloud/android/activity/MainActivity.java index 9232ba67..ae02d790 100644 --- a/src/com/irccloud/android/activity/MainActivity.java +++ b/src/com/irccloud/android/activity/MainActivity.java @@ -154,6 +154,7 @@ import com.irccloud.android.IRCEditText; import com.irccloud.android.NetworkConnection; import com.irccloud.android.R; +import com.irccloud.android.data.IRCCloudDatabase; import com.irccloud.android.data.collection.AvatarsList; import com.irccloud.android.data.collection.BuffersList; import com.irccloud.android.data.collection.ChannelsList; @@ -2231,6 +2232,24 @@ public void onSuccess(@NonNull String s) { sendBtn.setEnabled(conn.getState() == NetworkConnection.STATE_CONNECTED && messageTxt.getText().length() > 0); photoBtn.setVisibility(bubble ? View.GONE : View.VISIBLE); IRCCloudLinkMovementMethod.bubble = bubble; + + if(prefs.getBoolean("imgur_removed", false)) { + AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); + builder.setTitle("Imgur Uploading Unavailable"); + builder.setMessage("Uploading images to imgur is no longer available due to limitations in imgur's API.\n\nNew images will be stored on IRCCloud, and your existing images will remain available on imgur.\n\nImages from imgur can still be shared by using the 'share' button in an external application."); + builder.setNegativeButton("Close", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + SharedPreferences.Editor editor = prefs.edit(); + editor.remove("imgur_removed"); + editor.apply(); + dialogInterface.dismiss(); + } + }); + AlertDialog d = builder.create(); + d.setOwnerActivity(MainActivity.this); + d.show(); + } } CustomTabsServiceConnection mCustomTabsConnection = new CustomTabsServiceConnection() {