cache useTor information in activity
This commit is contained in:
		
							parent
							
								
									72c551d128
								
							
						
					
					
						commit
						31dfb0c704
					
				@ -1252,7 +1252,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void checkPermissionAndTriggerAudioCall() {
 | 
			
		||||
        if (activity.xmppConnectionService.useTorToConnect() || conversation.getAccount().isOnion()) {
 | 
			
		||||
        if (activity.mUseTor || conversation.getAccount().isOnion()) {
 | 
			
		||||
            Toast.makeText(activity, R.string.disable_tor_to_make_call, Toast.LENGTH_SHORT).show();
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
@ -1262,7 +1262,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void checkPermissionAndTriggerVideoCall() {
 | 
			
		||||
        if (activity.xmppConnectionService.useTorToConnect() || conversation.getAccount().isOnion()) {
 | 
			
		||||
        if (activity.mUseTor || conversation.getAccount().isOnion()) {
 | 
			
		||||
            Toast.makeText(activity, R.string.disable_tor_to_make_call, Toast.LENGTH_SHORT).show();
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -383,7 +383,6 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
 | 
			
		||||
            if (isCameraFeatureAvailable()) {
 | 
			
		||||
                Fragment fragment = getFragmentManager().findFragmentById(R.id.main_fragment);
 | 
			
		||||
                boolean visible = getResources().getBoolean(R.bool.show_qr_code_scan)
 | 
			
		||||
                        && fragment != null
 | 
			
		||||
                        && fragment instanceof ConversationsOverviewFragment;
 | 
			
		||||
                qrCodeScanMenuItem.setVisible(visible);
 | 
			
		||||
            } else {
 | 
			
		||||
 | 
			
		||||
@ -67,6 +67,7 @@ import eu.siacs.conversations.entities.Message;
 | 
			
		||||
import eu.siacs.conversations.entities.Presences;
 | 
			
		||||
import eu.siacs.conversations.services.AvatarService;
 | 
			
		||||
import eu.siacs.conversations.services.BarcodeProvider;
 | 
			
		||||
import eu.siacs.conversations.services.QuickConversationsService;
 | 
			
		||||
import eu.siacs.conversations.services.XmppConnectionService;
 | 
			
		||||
import eu.siacs.conversations.services.XmppConnectionService.XmppConnectionBinder;
 | 
			
		||||
import eu.siacs.conversations.ui.service.EmojiService;
 | 
			
		||||
@ -96,6 +97,7 @@ public abstract class XmppActivity extends ActionBarActivity {
 | 
			
		||||
 | 
			
		||||
	protected int mTheme;
 | 
			
		||||
	protected boolean mUsingEnterKey = false;
 | 
			
		||||
	protected boolean mUseTor = false;
 | 
			
		||||
	protected Toast mToast;
 | 
			
		||||
	public Runnable onOpenPGPKeyPublished = () -> Toast.makeText(XmppActivity.this, R.string.openpgp_has_been_published, Toast.LENGTH_SHORT).show();
 | 
			
		||||
	protected ConferenceInvite mPendingConferenceInvite = null;
 | 
			
		||||
@ -211,6 +213,8 @@ public abstract class XmppActivity extends ActionBarActivity {
 | 
			
		||||
			this.registerListeners();
 | 
			
		||||
			this.onBackendConnected();
 | 
			
		||||
		}
 | 
			
		||||
		this.mUsingEnterKey = usingEnterKey();
 | 
			
		||||
		this.mUseTor = useTor();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void connectToBackend() {
 | 
			
		||||
@ -408,8 +412,6 @@ public abstract class XmppActivity extends ActionBarActivity {
 | 
			
		||||
		}
 | 
			
		||||
		this.mTheme = findTheme();
 | 
			
		||||
		setTheme(this.mTheme);
 | 
			
		||||
 | 
			
		||||
		this.mUsingEnterKey = usingEnterKey();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	protected boolean isCameraFeatureAvailable() {
 | 
			
		||||
@ -451,10 +453,14 @@ public abstract class XmppActivity extends ActionBarActivity {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	protected boolean usingEnterKey() {
 | 
			
		||||
	private boolean usingEnterKey() {
 | 
			
		||||
		return getBooleanPreference("display_enter_key", R.bool.display_enter_key);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private boolean useTor() {
 | 
			
		||||
		return QuickConversationsService.isConversations() && getBooleanPreference("use_tor", R.bool.use_tor);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	protected SharedPreferences getPreferences() {
 | 
			
		||||
		return PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user