Session v1.18.2版本的 MD5 值为:92ce129e957021e1a845dcaca5ce957d
以下内容为反编译后的 HelpSettingsFragment.java 源代码,内容仅作参考
package org.thoughtcrime.securesms.preferences;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.fragment.app.FragmentActivity;
import androidx.preference.Preference;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import network.loki.messenger.R;
import org.session.libsignal.utilities.Log;
import org.thoughtcrime.securesms.permissions.Permissions;
@Metadata(d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\b\u0007\u0018\u0000 \u00122\u00020\u0001:\u0001\u0012B\u0005¢\u0006\u0002\u0010\u0002J\u001c\u0010\u0003\u001a\u00020\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\b\u0010\u0007\u001a\u0004\u0018\u00010\bH\u0016J\u0010\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\fH\u0016J\u0010\u0010\r\u001a\u00020\u00042\u0006\u0010\u000e\u001a\u00020\bH\u0002J\b\u0010\u000f\u001a\u00020\u0004H\u0002J\u0010\u0010\u0010\u001a\u00020\u00042\u0006\u0010\u0011\u001a\u00020\nH\u0002¨\u0006\u0013"}, d2 = {"Lorg/thoughtcrime/securesms/preferences/HelpSettingsFragment;", "Lorg/thoughtcrime/securesms/preferences/CorrectedPreferenceFragment;", "()V", "onCreatePreferences", "", "savedInstanceState", "Landroid/os/Bundle;", "rootKey", "", "onPreferenceTreeClick", "", "preference", "Landroidx/preference/Preference;", "openLink", "url", "shareLogs", "updateExportButtonAndProgressBarUI", "exportJobRunning", "Companion", "app_playRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class HelpSettingsFragment extends CorrectedPreferenceFragment {
public static final int $stable = 0;
private static final String CROWDIN_URL = "https://crowdin.com/project/session-android";
private static final String EXPORT_LOGS = "export_logs";
private static final String FAQ = "faq";
private static final String FAQ_URL = "https://getsession.org/faq";
private static final String FEEDBACK = "feedback";
private static final String FEEDBACK_URL = "https://getsession.org/survey";
private static final String SUPPORT = "support";
private static final String SUPPORT_URL = "https://sessionapp.zendesk.com/hc/en-us";
private static final String TRANSLATE = "translate_session";
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.preferences_help);
}
@Override
public boolean onPreferenceTreeClick(Preference preference) {
Intrinsics.checkNotNullParameter(preference, "preference");
String key = preference.getKey();
if (key != null) {
switch (key.hashCode()) {
case -2095015078:
if (key.equals(EXPORT_LOGS)) {
shareLogs();
return true;
}
break;
case -1854767153:
if (key.equals(SUPPORT)) {
openLink(SUPPORT_URL);
return true;
}
break;
case -191501435:
if (key.equals(FEEDBACK)) {
openLink(FEEDBACK_URL);
return true;
}
break;
case 101142:
if (key.equals(FAQ)) {
openLink(FAQ_URL);
return true;
}
break;
case 452586661:
if (key.equals(TRANSLATE)) {
openLink(CROWDIN_URL);
return true;
}
break;
}
}
return super.onPreferenceTreeClick(preference);
}
public final void updateExportButtonAndProgressBarUI(final boolean exportJobRunning) {
FragmentActivity activity = getActivity();
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public final void run() {
HelpSettingsFragment.updateExportButtonAndProgressBarUI$lambda$0(HelpSettingsFragment.this, exportJobRunning);
}
});
}
}
public static final void updateExportButtonAndProgressBarUI$lambda$0(HelpSettingsFragment this$0, boolean z) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
FragmentActivity activity = this$0.getActivity();
TextView textView = activity != null ? (TextView) activity.findViewById(R.id.export_logs_button) : null;
if (textView == null) {
Log.w("Loki", "Could not find export logs button view.");
}
if (textView != null) {
textView.setText(this$0.getString(z ? R.string.cancel : R.string.activity_help_settings__export_logs));
}
FragmentActivity activity2 = this$0.getActivity();
ProgressBar progressBar = activity2 != null ? (ProgressBar) activity2.findViewById(R.id.export_progress_bar) : null;
if (progressBar == null) {
return;
}
progressBar.setVisibility(z ^ true ? 4 : 0);
}
private final void shareLogs() {
Permissions.with(this).request("android.permission.WRITE_EXTERNAL_STORAGE").maxSdkVersion(28).withPermanentDenialDialog(getString(R.string.MediaPreviewActivity_signal_needs_the_storage_permission_in_order_to_write_to_external_storage_but_it_has_been_permanently_denied)).onAnyDenied(new Runnable() {
@Override
public final void run() {
HelpSettingsFragment.shareLogs$lambda$1(HelpSettingsFragment.this);
}
}).onAllGranted(new Runnable() {
@Override
public final void run() {
HelpSettingsFragment.shareLogs$lambda$2(HelpSettingsFragment.this);
}
}).execute();
}
public static final void shareLogs$lambda$1(HelpSettingsFragment this$0) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Toast.makeText(this$0.requireActivity(), R.string.MediaPreviewActivity_unable_to_write_to_external_storage_without_permission, 1).show();
}
public static final void shareLogs$lambda$2(HelpSettingsFragment this$0) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
new ShareLogsDialog(new HelpSettingsFragment$shareLogs$2$1(this$0)).show(this$0.getParentFragmentManager(), "Share Logs Dialog");
}
private final void openLink(String url) {
try {
startActivity(new Intent("android.intent.action.VIEW", Uri.parse(url)));
} catch (Exception unused) {
Toast.makeText(requireActivity(), "Can't open URL", 1).show();
}
}
}