allow to open troubleshooting menu option directly from offline help (#2997)

* allow to open troubleshooting menu option directly from offline help

* add comment

* Update src/org/thoughtcrime/securesms/PassphraseRequiredActionBarActivity.java

Co-authored-by: bjoern <r10s@b44t.com>

---------

Co-authored-by: bjoern <r10s@b44t.com>
This commit is contained in:
Asiel Díaz Benítez
2024-04-24 13:46:55 +02:00
committed by GitHub
parent 7afef221a1
commit b0be653ded
4 changed files with 21 additions and 5 deletions
@@ -12,6 +12,9 @@ public class LocalHelpActivity extends WebViewActivity
{
public static final String SECTION_EXTRA = "section_extra";
@Override
protected boolean allowInLockedMode() { return true; }
@Override
protected void onCreate(Bundle state, boolean ready) {
super.onCreate(state, ready);
@@ -14,6 +14,12 @@ public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarA
protected final void onCreate(Bundle savedInstanceState) {
Log.w(TAG, "onCreate(" + savedInstanceState + ")");
if (allowInLockedMode()) {
super.onCreate(savedInstanceState);
onCreate(savedInstanceState, true);
return;
}
if (GenericForegroundService.isForegroundTaskStarted()) {
// this does not prevent intent set by onNewIntent(),
// however, at least during onboarding,
@@ -38,4 +44,13 @@ public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarA
}
protected void onCreate(Bundle savedInstanceState, boolean ready) {}
// "Locked Mode" is when the account is not configured (Welcome screen)
// or when sharing a backup (Add second device).
// The app is "locked" to an activity if you will.
// In "Locked Mode" the user should not leave that activity otherwise the state would be lost -
// so eg. tapping app icon or notifications MUST NOT replace activity stack.
// However, sometimes it is fine to allow to pushing activities in these situations,
// like to see the logs or offline help.
protected boolean allowInLockedMode() { return false; }
}
@@ -20,7 +20,6 @@ import org.thoughtcrime.securesms.BaseActionBarActivity;
import org.thoughtcrime.securesms.ConversationListActivity;
import org.thoughtcrime.securesms.LogViewActivity;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.WebViewActivity;
import org.thoughtcrime.securesms.connect.DcHelper;
import org.thoughtcrime.securesms.service.GenericForegroundService;
import org.thoughtcrime.securesms.service.NotificationController;
@@ -118,8 +117,7 @@ public class BackupTransferActivity extends BaseActionBarActivity {
finishOrAskToFinish();
return true;
case R.id.troubleshooting:
// once help is evolved, it may be a more visible button, may be localized, may be offline
WebViewActivity.openUrlInBrowser(this, "https://delta.chat/en/help#multiclient");
DcHelper.openHelp(this, "#multiclient");
return true;
case R.id.view_log_button:
startActivity(new Intent(this, LogViewActivity.class));
@@ -16,7 +16,7 @@ import com.journeyapps.barcodescanner.CompoundBarcodeView;
import org.thoughtcrime.securesms.BaseActionBarActivity;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.WebViewActivity;
import org.thoughtcrime.securesms.connect.DcHelper;
import org.thoughtcrime.securesms.permissions.Permissions;
public class RegistrationQrActivity extends BaseActionBarActivity {
@@ -80,7 +80,7 @@ public class RegistrationQrActivity extends BaseActionBarActivity {
finish();
return true;
case R.id.troubleshooting:
WebViewActivity.openUrlInBrowser(this, "https://delta.chat/en/help#multiclient");
DcHelper.openHelp(this, "#multiclient");
return true;
}