diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 3d6e49dc..53049cc8 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -9,6 +9,7 @@ + + diff --git a/.idea/misc.xml b/.idea/misc.xml index b2630b0c..53531625 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -78,7 +78,15 @@ + + + + + + + + diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/bridgeManager/bridgeController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/bridgeManager/bridgeController.java index b6ad76c2..50c2e8dd 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/bridgeManager/bridgeController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/bridgeManager/bridgeController.java @@ -145,7 +145,7 @@ public class bridgeController extends AppCompatActivity implements View.OnFocusC mBridgeModel.onTrigger(bridgeEnums.eBridgeModelCommands.M_REQUEST_BRIDGE, null); pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(constants.CONST_BACKEND_GOOGLE_URL, this), M_BRIDGE_MAIL); } - else if(view.getId() == R.id.pBridgeSettingOption2){ + else if(view.getId() == R.id.pSearchSettingOption2){ mBridgeModel.onTrigger(bridgeEnums.eBridgeModelCommands.M_MEEK_BRIDGE, null); mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250, status.sBridgeCustomType)); } @@ -153,7 +153,7 @@ public class bridgeController extends AppCompatActivity implements View.OnFocusC mBridgeModel.onTrigger(bridgeEnums.eBridgeModelCommands.M_SNOWFLAKES_BRIDGE, null); mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250, status.sBridgeCustomType)); } - else if(view.getId() == R.id.pBridgeSettingOption1){ + else if(view.getId() == R.id.pSearchSettingOption1){ mBridgeModel.onTrigger(bridgeEnums.eBridgeModelCommands.M_OBFS_CHECK, null); mBridgeViewController.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sBridgeCustomBridge,250, status.sBridgeCustomType)); } diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/externalCommandManager/externalShortcutController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/externalCommandManager/externalShortcutController.java index 547ccd39..dd18d2e9 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/externalCommandManager/externalShortcutController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/externalCommandManager/externalShortcutController.java @@ -2,6 +2,8 @@ package com.hiddenservices.onionservices.appManager.externalCommandManager; import android.content.Intent; import android.os.Bundle; +import android.os.Handler; +import android.util.Log; import android.view.View; import androidx.appcompat.app.AppCompatActivity; @@ -39,29 +41,31 @@ public class externalShortcutController extends AppCompatActivity { case CONST_EXTERNAL_SHORTCUT_COMMAND_ERASE: setContentView(R.layout.popup_data_cleared_shortcut); panicExitInvoked(); + helperMethod.onDelayHandler(this, 3000, () -> { + finishAndRemoveTask(); + return null; + }); + return; case constants.CONST_EXTERNAL_SHORTCUT_COMMAND_ERASE_OPEN: - setContentView(R.layout.empty_view); panicExitInvoked(); + helperMethod.restartAndOpen(true); + break; case constants.CONST_EXTERNAL_SHORTCUT_COMMAND_RESTART: - activityContextManager.getInstance().onClearStack(); + helperMethod.restartAndOpen(false); break; } } } - /* Start Required Activity */ - - helperMethod.openIntent(mIntent, this, constants.CONST_LIST_EXTERNAL_SHORTCUT); - } /* UI TRIGGERS */ public void onUITrigger(View view){ if(view.getId() == R.id.pDataClearedDismiss){ - finishAffinity(); + finishAndRemoveTask(); } } @@ -69,9 +73,5 @@ public class externalShortcutController extends AppCompatActivity { public void panicExitInvoked() { dataController.getInstance().clearData(this); - helperMethod.onDelayHandler(this, 3000, () -> { - finish(); - return null; - }); } } \ No newline at end of file diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoClients.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoClients.java index 032237a9..ce975e33 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoClients.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoClients.java @@ -186,15 +186,17 @@ public class geckoClients } String mYAML = helperMethod.readFromFile(cacheFile.getPath()); - mYAML = mYAML.replace("# network.proxy.socks: \"127.0.0.1\"","network.proxy.socks: \"127.0.0.1\""); - mYAML = mYAML.replace("# network.proxy.socks_port: 9050","network.proxy.socks_port: 9050"); - mYAML = mYAML.replace("network.proxy.socks: \"127.0.0.1\"","network.proxy.socks: \"127.0.0.1\""); + if(status.sTorBrowsing){ + mYAML = mYAML.replace("# network.proxy.socks: \"127.0.0.1\"","network.proxy.socks: \"127.0.0.1\""); + mYAML = mYAML.replace("# network.proxy.socks_port: 9050","network.proxy.socks_port: 9050"); + + StringBuilder buf = new StringBuilder(mYAML); + int portIndex = mYAML.indexOf("network.proxy.socks_port"); + int breakIndex = mYAML.indexOf("\n",portIndex); + mYAML = buf.replace(portIndex, breakIndex,"network.proxy.socks_port: "+ orbotLocalConstants.mSOCKSPort).toString(); + helperMethod.writeToFile(cacheFile.getPath(), mYAML); + } - StringBuilder buf = new StringBuilder(mYAML); - int portIndex = mYAML.indexOf("network.proxy.socks_port"); - int breakIndex = mYAML.indexOf("\n",portIndex); - mYAML = buf.replace(portIndex, breakIndex,"network.proxy.socks_port: "+ orbotLocalConstants.mSOCKSPort).toString(); - helperMethod.writeToFile(cacheFile.getPath(), mYAML); return cacheFile.getAbsolutePath(); @@ -408,6 +410,7 @@ public class geckoClients if(mSession==null){ return; } + Log.i("FERROR : ", "FERROR" + url); if(mSession.onGetInitializeFromStartup()){ mSession.initURL(url); if(!url.startsWith(CONST_REPORT_URL) && (url.startsWith("http://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion/?pG") || url.startsWith("https://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion?pG") || url.endsWith("trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion") || url.endsWith(constants.CONST_GENESIS_DOMAIN_URL_SLASHED))){ diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeController.java index e77a50d3..49cef756 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeController.java @@ -121,6 +121,7 @@ import static com.hiddenservices.onionservices.constants.enums.etype.open_new_ta import static com.hiddenservices.onionservices.constants.keys.EXTERNAL_SHORTCUT_COMMAND; import static com.hiddenservices.onionservices.constants.keys.EXTERNAL_SHORTCUT_COMMAND_NAVIGATE; import static com.hiddenservices.onionservices.constants.keys.M_ACTIVITY_RESPONSE; +import static com.hiddenservices.onionservices.constants.keys.M_RESTART_APP_KEY; import static com.hiddenservices.onionservices.constants.responses.BOOKMARK_SETTING_CONTROLLER_SHOW_DELETE_ALERT; import static com.hiddenservices.onionservices.constants.responses.BOOKMARK_SETTING_CONTROLLER_SHOW_SUCCESS_ALERT; import static com.hiddenservices.onionservices.constants.sql.SQL_CLEAR_HISTORY; @@ -182,6 +183,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba private ImageView mImageDivider; private ImageButton mPopoupFindCopy; private ImageButton mPopoupFindPaste; + private ImageView mTorDisabled; /*Redirection Objects*/ private GeckoResult mRenderedBitmap = null; @@ -244,6 +246,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba status.sSettingIsAppRunning = true; initPreFixes(); initBundle(); + initTor(); + + } + + public void initTor(){ + if(!status.sTorBrowsing){ + onStartApplication(null); + } } public void initBundle(){ @@ -261,8 +271,15 @@ public class homeController extends AppCompatActivity implements ComponentCallba status.sExternalWebsite = mShortcutCommandNavigate; onStartApplication(null); } + if(getIntent().getExtras().containsKey(M_RESTART_APP_KEY)){ + boolean mStatus = getIntent().getExtras().getBoolean(M_RESTART_APP_KEY); + if(mStatus){ + onStartApplication(null); + } + } } getIntent().setData(null); + } public boolean isSplashScreenLoading(){ @@ -513,13 +530,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba mGenesisLogo = findViewById(R.id.pGenesisLogo); mPopoupFindCopy = findViewById(R.id.pPopoupFindCopy); mPopoupFindPaste = findViewById(R.id.pPopoupFindPaste); + mTorDisabled = findViewById(R.id.pTorDisabled); mGeckoView.setSaveEnabled(false); mGeckoView.setSaveFromParentEnabled(false); mGeckoView.setAutofillEnabled(true); mGeckoClient = new geckoClients(); - mHomeViewController.initialization(new homeViewCallback(),this,mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds, mGatewaySplash, mTopBar, mGeckoView, mBackSplash, mConnectButton, mFindBar, mFindText, mFindCount, mTopLayout, mVoiceInput, mMenu, mNestedScroll, mBlocker, mBlockerFullSceen, mSearchEngineBar, mCopyright, mHintListView, mAppBar, mOrbotLogManager, mInfoLandscape, mInfoPortrait, mProgressBarIndeterminate, mTabFragment, mTopBarContainer, mSearchLock, mTopBarHider, mNewTabBlocker, mCoordinatorLayout, mImageDivider, mPanicButton, mGenesisLogo, mPanicButtonLandscape); + mHomeViewController.initialization(new homeViewCallback(),this,mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds, mGatewaySplash, mTopBar, mGeckoView, mBackSplash, mConnectButton, mFindBar, mFindText, mFindCount, mTopLayout, mVoiceInput, mMenu, mNestedScroll, mBlocker, mBlockerFullSceen, mSearchEngineBar, mCopyright, mHintListView, mAppBar, mOrbotLogManager, mInfoLandscape, mInfoPortrait, mProgressBarIndeterminate, mTabFragment, mTopBarContainer, mSearchLock, mTopBarHider, mNewTabBlocker, mCoordinatorLayout, mImageDivider, mPanicButton, mGenesisLogo, mPanicButtonLandscape, mTorDisabled); mGeckoView.onSetHomeEvent(new nestedGeckoViewCallback()); mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,false); mGeckoClient.onValidateInitializeFromStartup(mGeckoView, homeController.this); @@ -1712,7 +1730,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba mBlocker.setClickable(true); mBlocker.setFocusable(true); mBlocker.setEnabled(true); - Log.i("FUCKKKKK","SADADS3"); } static boolean mStateService = false; @@ -1727,12 +1744,19 @@ public class homeController extends AppCompatActivity implements ComponentCallba } } - mHomeViewController.initHomePage(); + Log.i("fuck","fuck"); + if(status.sTorBrowsing){ + mHomeViewController.initHomePage(); + } + int mDelay = 1000; + if(!status.sTorBrowsing){ + mDelay = 0; + } new Handler().postDelayed(() -> { pluginController.getInstance().onOrbotInvoke(Arrays.asList(status.sBridgeCustomBridge, status.sBridgeGatewayManual, status.sBridgeCustomType, status.sBridgeStatus, status.sShowImages, status.sClearOnExit, (String)dataController.getInstance().invokeBridges(dataEnums.eBridgeWebsiteCommands.M_FETCH, null)), pluginEnums.eOrbotManager.M_START_ORBOT); onInvokeProxyLoading(); - }, 1000); + }, mDelay); } public void onDownloadFile(){ @@ -1874,6 +1898,18 @@ public class homeController extends AppCompatActivity implements ComponentCallba onNewTab(isKeyboardOpened, true); } } + else if (menuId == R.id.menu29) { + if(status.sTorBrowsing){ + status.sTorBrowsing = false; + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, constants.CONST_BACKEND_DUCK_DUCK_GO_URL)); + }else { + status.sTorBrowsing = true; + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, constants.CONST_BACKEND_GENESIS_URL)); + } + + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TOR_BROWSING,status.sTorBrowsing)); + pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_IMAGE_UPDATE); + } else if (menuId == R.id.menuItem25) { String mFileName = DownloadUtils.guessFileName(null,"",mGeckoClient.getSession().getCurrentURL(),null); String mURL = mGeckoClient.getSession().getCurrentURL(); @@ -1930,6 +1966,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_NEW_CIRCUIT); pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_NEW_IDENTITY); mGeckoClient.onReload(mGeckoView, this, false); + onLoadURL(mSearchbar.getText().toString()); } else if (menuId == R.id.pMenuOpenCurrentTab) { @@ -2105,6 +2142,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_HISTORY,null)); dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null); dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_INSTALLED,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TOR_BROWSING,true)); mGeckoClient.onClearAll(); activityContextManager.getInstance().getHomeController().onClearCache(); diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeViewController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeViewController.java index d22d701a..8b34dc87 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeViewController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeViewController.java @@ -110,6 +110,7 @@ class homeViewController private ImageButton mPanicButton; private ImageButton mPanicButtonLandscape; private ImageView mGenesisLogo; + private ImageView mTorDisabled; /*Local Variables*/ private Callable mLogs = null; @@ -119,7 +120,7 @@ class homeViewController private boolean mIsTopBarExpanded = true; private NestedScrollView.MarginLayoutParams mDefaultMargin = null; - void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, ConstraintLayout webviewContainer, TextView loadingText, ProgressBar progressBar, editTextManager searchbar, ConstraintLayout splashScreen, ImageView loading, MaxAdView banner_ads, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_button, View pFindBar, EditText pFindText, TextView pFindCount, androidx.constraintlayout.widget.ConstraintLayout pTopLayout, ImageButton pVoiceInput, ImageButton pMenu, androidx.core.widget.NestedScrollView pNestedScroll, ImageView pBlocker, ImageView pBlockerFullSceen, View mSearchEngineBar, TextView pCopyright, RecyclerView pHistListView, com.google.android.material.appbar.AppBarLayout pAppBar, ImageButton pOrbotLogManager, ConstraintLayout pInfoLandscape, ConstraintLayout pInfoPortrait, ProgressBar pProgressBarIndeterminate, FragmentContainerView pTabFragment, LinearLayout pTopBarContainer, ImageView pSearchLock, ImageView pTopBarHider, ImageView pNewTabBlocker, CoordinatorLayout mCoordinatorLayout, ImageView pImageDivider, ImageButton pPanicButton, ImageView pGenesisLogo, ImageButton pPanicButtonLandscape){ + void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, ConstraintLayout webviewContainer, TextView loadingText, ProgressBar progressBar, editTextManager searchbar, ConstraintLayout splashScreen, ImageView loading, MaxAdView banner_ads, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_button, View pFindBar, EditText pFindText, TextView pFindCount, androidx.constraintlayout.widget.ConstraintLayout pTopLayout, ImageButton pVoiceInput, ImageButton pMenu, androidx.core.widget.NestedScrollView pNestedScroll, ImageView pBlocker, ImageView pBlockerFullSceen, View mSearchEngineBar, TextView pCopyright, RecyclerView pHistListView, com.google.android.material.appbar.AppBarLayout pAppBar, ImageButton pOrbotLogManager, ConstraintLayout pInfoLandscape, ConstraintLayout pInfoPortrait, ProgressBar pProgressBarIndeterminate, FragmentContainerView pTabFragment, LinearLayout pTopBarContainer, ImageView pSearchLock, ImageView pTopBarHider, ImageView pNewTabBlocker, CoordinatorLayout mCoordinatorLayout, ImageView pImageDivider, ImageButton pPanicButton, ImageView pGenesisLogo, ImageButton pPanicButtonLandscape, ImageView pTorDisabled){ this.mContext = context; this.mProgressBar = progressBar; this.mSearchbar = searchbar; @@ -161,6 +162,7 @@ class homeViewController this.mGenesisLogo = pGenesisLogo; this.mPanicButtonLandscape = pPanicButtonLandscape; this.mLogHandler = new LogHandler(); + this.mTorDisabled = pTorDisabled; initSplashScreen(); createUpdateUiHandler(); @@ -225,7 +227,14 @@ class homeViewController } params1.setMargins(0, 0, 0,(helperMethod.pxFromDp(60)+mBannerHeight)*-1); mNestedScroll.setLayoutParams(params1); - + if(!status.sTorBrowsing){ + mTorDisabled.setAlpha(1); + mTorDisabled.setVisibility(View.VISIBLE); + mConnectButton.setVisibility(View.GONE); + mOrbotLogManager.setVisibility(View.GONE); + mGatewaySplash.setVisibility(View.GONE); + mCopyright.setVisibility(View.GONE); + } } @@ -492,7 +501,7 @@ class homeViewController public void initStatusBarColor(boolean mInstant) { int mDelay = 1000; - if(status.mThemeApplying || mInstant || status.sSettingIsAppStarted){ + if(!status.sTorBrowsing || status.mThemeApplying || mInstant || status.sSettingIsAppStarted){ mDelay = 0; } @@ -616,7 +625,7 @@ class homeViewController protected Void doInBackground(Void...arg0) { AppCompatActivity temp_context = mContext; int mCounter = 0; - while (orbotLocalConstants.mSOCKSPort==-1 && (!orbotLocalConstants.mIsTorInitialized || !orbotLocalConstants.mNetworkState)){ + while (status.sTorBrowsing && (orbotLocalConstants.mSOCKSPort==-1 || !orbotLocalConstants.mIsTorInitialized || !orbotLocalConstants.mNetworkState)){ try { boolean mFastConnect = status.sSettingIsAppStarted || !status.sRestoreTabs && status.sAppInstalled && status.sSettingDefaultSearchEngine.equals(constants.CONST_BACKEND_GENESIS_URL) && !status.sBridgeStatus && status.sExternalWebsite.equals(strings.GENERIC_EMPTY_STR); @@ -638,7 +647,7 @@ class homeViewController sleep(500); if(mCounter>20 && orbotLocalConstants.mSOCKSPort!=-1){ break; - }else { + }else if (orbotLocalConstants.mNetworkState && status.sBridgeStatus){ mCounter+=1; } if(mFastConnect){ @@ -853,8 +862,22 @@ class homeViewController ImageButton mRefresh = popupView.findViewById(R.id.menu21); ImageButton mDownload = popupView.findViewById(R.id.menuItem25); CheckBox desktop = popupView.findViewById(R.id.menu27); + CheckBox torBrowsing = popupView.findViewById(R.id.menu30); + LinearLayout newIdentity = popupView.findViewById(R.id.menu28); LinearLayout newTab = popupView.findViewById(R.id.menu11); + LinearLayout genesisLogs = popupView.findViewById(R.id.menu12); desktop.setChecked(userAgent==USER_AGENT_MODE_DESKTOP); + + if(status.sTorBrowsing){ + torBrowsing.setChecked(true); + newIdentity.setVisibility(View.VISIBLE); + genesisLogs.setVisibility(View.VISIBLE); + } + else { + torBrowsing.setChecked(false); + newIdentity.setVisibility(View.GONE); + genesisLogs.setVisibility(View.GONE); + } if(pIsBookmarked){ try { bookmark .setImageDrawable(helperMethod.getDrawableXML(mContext,R.xml.ic_baseline_bookmark_filled)); diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/clearManager/settingClearController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/clearManager/settingClearController.java index c897193d..dc97f864 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/clearManager/settingClearController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/clearManager/settingClearController.java @@ -229,6 +229,7 @@ public class settingClearController extends AppCompatActivity { dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_INSTALLED,false)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TOR_BROWSING,true)); if(mIsThemeChangable) { status.mThemeApplying = true; diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/generalManager/settingGeneralController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/generalManager/settingGeneralController.java index 67e26f88..f339f54a 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/generalManager/settingGeneralController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/generalManager/settingGeneralController.java @@ -227,7 +227,7 @@ public class settingGeneralController extends AppCompatActivity { public void onSelectTheme(View view){ if(!mIsThemeChanging){ mIsThemeChanging = true; - if(view.getId() == R.id.pBridgeSettingOption1){ + if(view.getId() == R.id.pSearchSettingOption1){ if(status.sTheme != enums.Theme.THEME_DARK) { mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null); mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_DARK)); @@ -238,7 +238,7 @@ public class settingGeneralController extends AppCompatActivity { }else { mIsThemeChanging = false; } - }else if(view.getId() == R.id.pBridgeSettingOption2) { + }else if(view.getId() == R.id.pSearchSettingOption2) { if(status.sTheme != enums.Theme.THEME_LIGHT) { mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_RESET_THEME, null); mSettingGeneralViewController.onTrigger(settingGeneralEnums.eGeneralViewController.M_SET_THEME, Collections.singletonList(enums.Theme.THEME_LIGHT)); diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/searchEngineManager/settingSearchController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/searchEngineManager/settingSearchController.java index 53df1d72..d3c9715f 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/searchEngineManager/settingSearchController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/searchEngineManager/settingSearchController.java @@ -3,6 +3,7 @@ package com.hiddenservices.onionservices.appManager.settingManager.searchEngineM import android.content.res.Configuration; import android.os.Bundle; import android.view.View; +import android.widget.LinearLayout; import android.widget.RadioButton; import androidx.annotation.NonNull; @@ -34,6 +35,7 @@ public class settingSearchController extends AppCompatActivity { private SwitchMaterial mSearchSuggestions; private settingSearchModel mSettingSearchModel; private settingSearchViewController mSettingSearchViewController; + private LinearLayout mSearchSettingOption1 = null; @Override protected void onCreate(Bundle savedInstanceState) { @@ -63,9 +65,10 @@ public class settingSearchController extends AppCompatActivity { mSearchEngines.add(findViewById(R.id.mRadioSearch_5)); mSearchHistory = findViewById(R.id.pSearchHistory); mSearchSuggestions = findViewById(R.id.pSearchSuggestions); + mSearchSettingOption1 = findViewById(R.id.pSearchSettingOption1); activityContextManager.getInstance().onStack(this); - mSettingSearchViewController = new settingSearchViewController(this, new settingSearchViewCallback(), mSearchEngines, mSearchHistory, mSearchSuggestions); + mSettingSearchViewController = new settingSearchViewController(this, new settingSearchViewCallback(), mSearchEngines, mSearchHistory, mSearchSuggestions, mSearchSettingOption1); mSettingSearchModel = new settingSearchModel(new settingSearchModelCallback()); } @@ -127,23 +130,23 @@ public class settingSearchController extends AppCompatActivity { } public void onSelectSearchEngine(View view) { - if(view.getId() == R.id.pBridgeSettingOption1){ + if(view.getId() == R.id.pSearchSettingOption1){ mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_GENESIS_URL)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, status.sSettingDefaultSearchEngine)); } - else if(view.getId() == R.id.pBridgeSettingOption2){ + else if(view.getId() == R.id.pSearchSettingOption2){ mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_DUCK_DUCK_GO_URL)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, status.sSettingDefaultSearchEngine)); } - else if(view.getId() == R.id.pOption3){ + else if(view.getId() == R.id.pSearchSettingOption3){ mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_GOOGLE_URL)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, status.sSettingDefaultSearchEngine)); } - else if(view.getId() == R.id.pOption4){ + else if(view.getId() == R.id.pSearchSettingOption4){ mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_BING_URL)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, status.sSettingDefaultSearchEngine)); } - else if(view.getId() == R.id.pOption5){ + else if(view.getId() == R.id.pSearchSettingOption5){ mSettingSearchModel.onTrigger(settingSearchEnums.eSearchModel.M_SET_SEARCH_ENGINE, Collections.singletonList(constants.CONST_BACKEND_WIKI_URL)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, status.sSettingDefaultSearchEngine)); } diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/searchEngineManager/settingSearchViewController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/searchEngineManager/settingSearchViewController.java index 0f3e0fa8..e384f0bc 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/searchEngineManager/settingSearchViewController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/searchEngineManager/settingSearchViewController.java @@ -5,6 +5,7 @@ import android.os.Build; import android.view.View; import android.view.Window; import android.view.WindowManager; +import android.widget.LinearLayout; import android.widget.RadioButton; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; @@ -26,16 +27,18 @@ class settingSearchViewController private ArrayList mSearchEngines; private SwitchMaterial mSearchHistory; private SwitchMaterial mSearchSuggestions; + private LinearLayout mSearchSettingOption1 = null; /*Initializations*/ - settingSearchViewController(settingSearchController pContext, eventObserver.eventListener pEvent, ArrayList pSearchEngines, SwitchMaterial pSearchHistory, SwitchMaterial pSearchSuggestions) + settingSearchViewController(settingSearchController pContext, eventObserver.eventListener pEvent, ArrayList pSearchEngines, SwitchMaterial pSearchHistory, SwitchMaterial pSearchSuggestions, LinearLayout pSearchSettingOption1) { this.mEvent = pEvent; this.mContext = pContext; this.mSearchEngines = pSearchEngines; this.mSearchHistory = pSearchHistory; this.mSearchSuggestions = pSearchSuggestions; + this.mSearchSettingOption1 = pSearchSettingOption1; initViews(); initPostUI(); @@ -48,21 +51,24 @@ class settingSearchViewController } private void initPostUI(){ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - Window window = mContext.getWindow(); - window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + Window window = mContext.getWindow(); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); - if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { - window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); - } - else { - if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ - mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); - } - mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); - } + if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { + window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark)); + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.landing_ease_blue)); } + else { + if(AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO){ + mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.c_background)); + } + + if(!status.sTorBrowsing){ + mSearchSettingOption1.setVisibility(View.GONE); + } + } private void initSearchViews(){ diff --git a/app/src/main/java/com/hiddenservices/onionservices/constants/keys.java b/app/src/main/java/com/hiddenservices/onionservices/constants/keys.java index f58b10f3..6f6ebba4 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/constants/keys.java +++ b/app/src/main/java/com/hiddenservices/onionservices/constants/keys.java @@ -6,6 +6,7 @@ public class keys public static final String M_ACTIVITY_RESPONSE = "M_ACTIVITY_RESPONSE"; public static final String M_ACTIVITY_NAVIGATION_BUNDLE_KEY = "M_ACTIVITY_NAVIGATION_BUNDLE_KEY"; + public static final String M_RESTART_APP_KEY = "M_RESTART_APP_KEY"; /*Home Manager*/ @@ -22,13 +23,8 @@ public class keys public static final String PROXY_SOCKS_PORT = "network.proxy.socks_port"; public static final String PROXY_SOCKS_VERSION = "network.proxy.socks_version"; public static final String PROXY_SOCKS_REMOTE_DNS = "network.proxy.socks_remote_dns"; - public static final String PROXY_CACHE = "browser.cache.disk.enable"; - public static final String PROXY_MEMORY = "browser.cache.memory.enable"; - public static final String PROXY_DO_NOT_TRACK_HEADER_ENABLED = "privacy.donottrackheader.enabled"; - public static final String PROXY_DO_NOT_TRACK_HEADER_VALUE = "privacy.donottrackheader.value"; public static final String PROXY_IS_APP_RATED = "IS_APP_RATED"; public static final String PROXY_LIST_TYPE = "list_type"; - public static final String PROXY_IMAGE = "permissions.default.image"; /*Settings*/ @@ -41,6 +37,7 @@ public class keys public static final String SETTING_POPUP = "POPUP_V1"; public static final String SETTING_HISTORY_CLEAR = "HISTORY_CLEAR_V1"; public static final String SETTING_GATEWAY = "pref_bridges_enabled_auto_V1"; + public static final String SETTING_TOR_BROWSING = "pref_tor_browsing_V1"; public static final String SETTING_GATEWAY_MANUAL = "pref_bridges_enabled_manual_V1"; public static final String SETTING_IS_BOOTSTRAPPED = "IS_BOOTSTRAPPED_V1"; public static final String SETTING_IS_WELCOME_ENABLED = "IS_WELCOME_ENABLED_V1"; diff --git a/app/src/main/java/com/hiddenservices/onionservices/constants/status.java b/app/src/main/java/com/hiddenservices/onionservices/constants/status.java index 755020b9..22cb5615 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/constants/status.java +++ b/app/src/main/java/com/hiddenservices/onionservices/constants/status.java @@ -34,6 +34,7 @@ public class status public static String sExternalWebsite = strings.GENERIC_EMPTY_STR; public static String sBridgesDefault = strings.BRIDGES_DEFAULT; + public static boolean sTorBrowsing = false; public static boolean sExternalWebsiteLoading = false; public static boolean sUIInteracted = false; public static boolean sSettingEnableZoom = true; @@ -136,10 +137,14 @@ public class status status.sTabGridLayoutEnabled = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SHOW_TAB_GRID,true)); status.sGlobalURLCount = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_RATE_COUNT, 0)); status.sAppInstalled = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_INSTALLED,false)); + status.sTorBrowsing = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_TOR_BROWSING,true)); if(status.sGlobalURLCount <=10 && status.sGlobalURLCount>=8){ status.sGlobalURLCount = 6; } + if(!status.sTorBrowsing && status.sSettingDefaultSearchEngine.equals(constants.CONST_BACKEND_GENESIS_URL)){ + status.sSettingDefaultSearchEngine = constants.CONST_BACKEND_DUCK_DUCK_GO_URL; + } } } diff --git a/app/src/main/java/com/hiddenservices/onionservices/dataManager/dataController.java b/app/src/main/java/com/hiddenservices/onionservices/dataManager/dataController.java index 412afd95..17cd6042 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/dataManager/dataController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/dataManager/dataController.java @@ -251,6 +251,7 @@ public class dataController dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_POPUP,true)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4)); dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_INSTALLED,false)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TOR_BROWSING,true)); invokeSQLCipher(dataEnums.eSqlCipherCommands.M_INIT, Collections.singletonList(mContext)); invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_HISTORY,null)); diff --git a/app/src/main/java/com/hiddenservices/onionservices/helperManager/helperMethod.java b/app/src/main/java/com/hiddenservices/onionservices/helperManager/helperMethod.java index 4e6e8033..5edca779 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/helperManager/helperMethod.java +++ b/app/src/main/java/com/hiddenservices/onionservices/helperManager/helperMethod.java @@ -10,6 +10,7 @@ import android.app.PendingIntent; import android.content.ActivityNotFoundException; import android.content.ClipData; import android.content.ClipboardManager; +import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; @@ -32,6 +33,7 @@ import android.os.Vibrator; import android.text.SpannableString; import android.text.Spanned; import android.text.style.ForegroundColorSpan; +import android.util.Log; import android.view.Display; import android.view.Gravity; import android.view.LayoutInflater; @@ -53,6 +55,8 @@ import androidx.core.content.ContextCompat; import androidx.core.content.FileProvider; import androidx.core.graphics.ColorUtils; +import com.example.myapplication.BuildConfig; +import com.hiddenservices.onionservices.appManager.activityContextManager; import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession; import com.hiddenservices.onionservices.appManager.kotlinHelperLibraries.defaultBrowser; import com.hiddenservices.onionservices.constants.constants; @@ -108,6 +112,7 @@ import static com.hiddenservices.onionservices.constants.constants.CONST_LIST_EX import static com.hiddenservices.onionservices.constants.constants.CONST_PACKAGE_NAME; import static com.hiddenservices.onionservices.constants.constants.CONST_PLAYSTORE_URL; import static com.hiddenservices.onionservices.constants.keys.M_ACTIVITY_NAVIGATION_BUNDLE_KEY; +import static com.hiddenservices.onionservices.constants.keys.M_RESTART_APP_KEY; import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_OPEN_ACTIVITY_FAILED; public class helperMethod @@ -306,7 +311,7 @@ public class helperMethod } public static String completeURL(String pURL){ - if(pURL.equals("about:blank") || pURL.equals("about:config")){ + if(pURL.equals("about:blank") || pURL.equals("about:config") || pURL.startsWith("resource://")){ return pURL; } URL weburl; @@ -1071,4 +1076,32 @@ public class helperMethod return popupWindow; } + public static void restartAndOpen(boolean pOpenOnRestart) { + ActivityManager manager = (ActivityManager) activityContextManager.getInstance().getHomeController().getSystemService(Context.ACTIVITY_SERVICE); + List runningProcesses = manager + .getRunningAppProcesses(); + if (runningProcesses != null) { + for (ActivityManager.RunningAppProcessInfo processInfo : runningProcesses) { + if (!BuildConfig.APPLICATION_ID.equalsIgnoreCase(processInfo.processName)) { + android.os.Process.killProcess(processInfo.pid); + } + } + } + + Runtime.getRuntime().addShutdownHook(new Thread() { + @Override + public void run() { + super.run(); + + PackageManager packageManager = activityContextManager.getInstance().getHomeController().getPackageManager(); + Intent intent = packageManager.getLaunchIntentForPackage(activityContextManager.getInstance().getHomeController().getPackageName()); + ComponentName componentName = intent.getComponent(); + Intent mainIntent = Intent.makeRestartActivityTask(componentName); + mainIntent.putExtra(M_RESTART_APP_KEY, pOpenOnRestart); + activityContextManager.getInstance().getHomeController().getApplicationContext().startActivity(mainIntent); + } + }); + Runtime.getRuntime().exit(0); + } + } diff --git a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/downloadPluginManager/downloadReciever.java b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/downloadPluginManager/downloadReciever.java index acb76e8c..058e1100 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/downloadPluginManager/downloadReciever.java +++ b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/downloadPluginManager/downloadReciever.java @@ -92,6 +92,7 @@ public class downloadReciever extends AsyncTask { mNotifyManager = (NotificationManager) mContext.get().getSystemService(Context.NOTIFICATION_SERVICE); mNotificationBuilder = new NotificationCompat.Builder(mContext.get()); + mNotificationBuilder = new NotificationCompat.Builder(mContext.get()); mNotificationBuilder.setContentTitle(mFileName) .setContentText("starting...") .setChannelId(mNotificationID + "") @@ -134,12 +135,21 @@ public class downloadReciever extends AsyncTask { HttpURLConnection conection; Proxy proxy; if(helperMethod.getDomainName(fURL).contains(".onion")){ - proxy = new Proxy(Proxy.Type.SOCKS, InetSocketAddress.createUnresolved("localhost", orbotLocalConstants.mSOCKSPort)); - conection = (HttpURLConnection) url.openConnection(proxy); + if(orbotLocalConstants.mSOCKSPort==-1){ + proxy = new Proxy(Proxy.Type.SOCKS, InetSocketAddress.createUnresolved("localhost", orbotLocalConstants.mSOCKSPort)); + conection = (HttpURLConnection) url.openConnection(proxy); + }else { + conection = (HttpURLConnection) url.openConnection(); + } }else { - Proxy mProxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", orbotLocalConstants.mHTTPPort)); - URLConnection mURLConnection = new URI(fURL).toURL().openConnection(mProxy); - conection = (HttpURLConnection) mURLConnection; + if(orbotLocalConstants.mSOCKSPort==-1){ + Proxy mProxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", orbotLocalConstants.mHTTPPort)); + URLConnection mURLConnection = new URI(fURL).toURL().openConnection(mProxy); + conection = (HttpURLConnection) mURLConnection; + }else{ + URLConnection mURLConnection = new URI(fURL).toURL().openConnection(); + conection = (HttpURLConnection) mURLConnection; + } } conection.setRequestProperty("User-Agent","Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0"); @@ -156,10 +166,12 @@ public class downloadReciever extends AsyncTask { String urlEncoded = Uri.encode(f_url[0], ALLOWED_URI_CHARS); StrongHttpsClient httpclient = new StrongHttpsClient(mContext.get()); - if(helperMethod.getDomainName(f_url[0]).contains(".onion")){ - httpclient.useProxy(true, "SOCKS", "127.0.0.1", orbotLocalConstants.mSOCKSPort); - }else { - httpclient.useProxy(true, "SOCKS", "127.0.0.1", orbotLocalConstants.mSOCKSPort); + if(orbotLocalConstants.mSOCKSPort!=-1){ + if(helperMethod.getDomainName(f_url[0]).contains(".onion")){ + httpclient.useProxy(true, "SOCKS", "127.0.0.1", orbotLocalConstants.mSOCKSPort); + }else { + httpclient.useProxy(true, "SOCKS", "127.0.0.1", orbotLocalConstants.mSOCKSPort); + } } HttpGet httpget = new HttpGet(urlEncoded); diff --git a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/orbotPluginManager/orbotManager.java b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/orbotPluginManager/orbotManager.java index 67bf9aae..17a2ac94 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/orbotPluginManager/orbotManager.java +++ b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/orbotPluginManager/orbotManager.java @@ -11,6 +11,7 @@ import java.util.Collections; import java.util.List; import com.hiddenservices.onionservices.constants.constants; import com.hiddenservices.onionservices.constants.keys; +import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.helperManager.helperMethod; import com.hiddenservices.onionservices.pluginManager.pluginEnums; @@ -60,22 +61,25 @@ public class orbotManager } private void onInitailizeService(){ + if(status.sTorBrowsing){ + Intent startTorIntent = new Intent(mAppContext.get(), OrbotService.class); + startTorIntent.setAction(ACTION_START); + if (mAppContext.get().getPackageName() != null) { + startTorIntent.putExtra(OrbotService.EXTRA_PACKAGE_NAME, mAppContext.get().getPackageName()); + } + mAppContext.get().startService(startTorIntent); - Intent startTorIntent = new Intent(mAppContext.get(), OrbotService.class); - startTorIntent.setAction(ACTION_START); - if (mAppContext.get().getPackageName() != null) { - startTorIntent.putExtra(OrbotService.EXTRA_PACKAGE_NAME, mAppContext.get().getPackageName()); + SharedPreferences settings = mAppContext.get().getSharedPreferences("se", MODE_PRIVATE); + SharedPreferences.Editor editor = settings.edit(); + editor.putInt(keys.PROXY_TYPE, 1); + editor.putString(keys.PROXY_SOCKS, constants.CONST_PROXY_SOCKS); + editor.putInt(keys.PROXY_SOCKS_PORT, orbotLocalConstants.mSOCKSPort); + editor.putInt(keys.PROXY_SOCKS_VERSION,constants.CONST_PROXY_SOCKS_VERSION); + editor.putBoolean(keys.PROXY_SOCKS_REMOTE_DNS,constants.CONST_PROXY_SOCKS_REMOTE_DNS); + editor.apply(); + }else { + orbotLocalConstants.mIsTorInitialized = true; } - mAppContext.get().startService(startTorIntent); - - SharedPreferences settings = mAppContext.get().getSharedPreferences("se", MODE_PRIVATE); - SharedPreferences.Editor editor = settings.edit(); - editor.putInt(keys.PROXY_TYPE, 1); - editor.putString(keys.PROXY_SOCKS, constants.CONST_PROXY_SOCKS); - editor.putInt(keys.PROXY_SOCKS_PORT, orbotLocalConstants.mSOCKSPort); - editor.putInt(keys.PROXY_SOCKS_VERSION,constants.CONST_PROXY_SOCKS_VERSION); - editor.putBoolean(keys.PROXY_SOCKS_REMOTE_DNS,constants.CONST_PROXY_SOCKS_REMOTE_DNS); - editor.apply(); } diff --git a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/pluginController.java b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/pluginController.java index 0326ee6f..d8bb24f7 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/pluginController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/pluginController.java @@ -1,17 +1,9 @@ package com.hiddenservices.onionservices.pluginManager; -import android.annotation.SuppressLint; -import android.app.AlarmManager; -import android.app.PendingIntent; -import android.content.Context; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.os.Handler; import android.view.WindowManager; import android.widget.ImageView; import androidx.appcompat.app.AppCompatActivity; -import com.example.myapplication.R; import com.hiddenservices.onionservices.appManager.activityContextManager; import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession; import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeController; @@ -350,7 +342,8 @@ public class pluginController mHomeController.get().runOnUiThread(() -> mHomeController.get().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)); } else if(pEventType.equals(M_IMAGE_UPDATE_RESTART)){ - ((homeController)mHomeController.get()).onRestartApp(); + onOrbotInvoke(Collections.singletonList(status.mThemeApplying), pluginEnums.eOrbotManager.M_DESTROY); + helperMethod.restartAndOpen(false); } return null; } diff --git a/app/src/main/res/drawable-hdpi/tor_logo.png b/app/src/main/res/drawable-hdpi/tor_logo.png new file mode 100644 index 00000000..5d23c5f6 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/tor_logo.png differ diff --git a/app/src/main/res/layouts/bridge/layout/bridge_settings_view.xml b/app/src/main/res/layouts/bridge/layout/bridge_settings_view.xml index 4e573c5c..0969042a 100644 --- a/app/src/main/res/layouts/bridge/layout/bridge_settings_view.xml +++ b/app/src/main/res/layouts/bridge/layout/bridge_settings_view.xml @@ -171,7 +171,7 @@ android:background="@color/c_white"/> + + + android:src="@drawable/tor_logo"/> + + + + + + + + + + + + + أفتح الإعدادات - طلب جديد Bridge - REQUEST Bridge + طلب جديد Bridge حدد البريد الإلكتروني أدناه لطلب عنوان Bridge بمجرد أن يكون لديك عنوان ، انسخه والصقه في المربع أعلاه وابدأ التطبيق. البريد @@ -391,6 +390,7 @@ تصفح روابط الويب اعدادات النظام موقع سطح المكتب + Tor اتصال احفظ هذه الصفحة إشارات مرجعية تقرير الموقع diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index 94c06601..7dc14567 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -94,9 +94,8 @@ obre la configuració - Sol·licita Un Nou Bridge - REQUEST Bridge - Seleccioneu el correu electrònic següent per sol·licitar una adreça Bridge. Un cop tingueu una adreça, copieu-la i enganxeu-la al quadre anterior i inicieu l\'aplicació. + Sol·licita Un Nou Bridge +\ Seleccioneu el correu electrònic següent per sol·licitar una adreça Bridge. Un cop tingueu una adreça, copieu-la i enganxeu-la al quadre anterior i inicieu l\'aplicació. Correu @@ -322,7 +321,6 @@ elimineu la personalització del navegador - Bridge ... lloc web de marcadors suprimiu els enllaços web i les dades navegats neteja el marcador i les dades @@ -385,6 +383,7 @@ enllaços web navegats Configuració del sistema lloc d\'escriptori + Tor Connexió deseu aquesta pàgina marcadors lloc web d\'informes diff --git a/app/src/main/res/values-ch/strings.xml b/app/src/main/res/values-ch/strings.xml index fb29f35f..9292bbe7 100644 --- a/app/src/main/res/values-ch/strings.xml +++ b/app/src/main/res/values-ch/strings.xml @@ -107,8 +107,7 @@ otevřete nastavení - Vyžádat Nový Bridge - REQUEST Bridge + Vyžádat Nový Bridge Níže vyberte E-mail a požádejte o adresu Bridge. Jakmile adresu zadáte, zkopírujte ji a vložte do výše uvedeného pole a spusťte aplikaci. Pošta @@ -396,6 +395,7 @@ procházené webové odkazy Systémové nastavení web pro počítače + Tor Spojení uložit tuto stránku záložky nahlásit web diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 403a7099..900ed618 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -108,8 +108,7 @@ Einstellungen öffnen - Anfrage Neu Bridge - REQUEST Bridge + Anfrage Neu Bridge Wählen Sie unten E-Mail aus, um eine Bridge-Adresse anzufordern. Sobald Sie eine Adresse haben, kopieren Sie sie und fügen Sie sie in das obige Feld ein und starten Sie die Anwendung. E-Mail @@ -398,6 +397,7 @@ durchsuchte Weblinks Systemeinstellung Desktop-Site + Tor Verbindung Speichern Sie diese Seite Lesezeichen report website diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index f34339d6..4500abc1 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -159,8 +159,7 @@ Λήψη αρχείου εικόνας - Αίτημα Νέο Bridge - REQUEST Bridge + Αίτημα Νέο Bridge Επιλέξτε E-mail παρακάτω για να ζητήσετε μια διεύθυνση Bridge. Μόλις έχετε μια διεύθυνση, αντιγράψτε και επικολλήστε την στο παραπάνω πλαίσιο και ξεκινήστε την εφαρμογή. Αλληλογραφία @@ -388,6 +387,7 @@ περιηγημένοι σύνδεσμοι ιστού Ρυθμίσεις συστήματος επιτραπέζιος ιστότοπος + Tor Σύνδεση αποθηκεύστε αυτήν τη σελίδα σελιδοδείκτες αναφέρετε τον ιστότοπο diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index ec7fae98..9cb74d80 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -84,10 +84,9 @@ Meek-azur (Chine) - demander nouveau Bridge + demander nouveau Bridge sélectionnez mail pour demander une adresse bridge. une fois que vous l\'avez reçu, copiez-le et collez-le dans la case ci-dessus et démarrez le logiciel. mail - REQUEST Bridge changer la façon dont le journal système apparaît @@ -404,6 +403,7 @@ liens Web parcourus Paramètres système desktop site + Tor Lien enregistrer cette page signets rapport site Web diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index de32f573..066579b6 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -108,8 +108,7 @@ nyisd meg a beállításokat - Új Kérés Bridge - REQUEST Bridge + Új Kérés Bridge Válassza ki az alábbi e-mailt az Bridge-es cím kéréséhez. Ha megvan a címe, másolja ki és illessze be a fenti mezőbe, és indítsa el az alkalmazást. Mail @@ -338,8 +337,6 @@ távolítsa el a böngésző testreszabását - Bridge ... - könyvjelző weboldal törölje a böngészett weblinkeket és az adatokat törölje a könyvjelzőt és az adatokat @@ -390,6 +387,7 @@ böngészett weblinkek Rendszerbeállítás asztali webhely + Tor Kapcsolat mentsd el ezt az oldalt könyvjelzők jelentés honlapja diff --git a/app/src/main/res/values-in-rID/strings.xml b/app/src/main/res/values-in-rID/strings.xml index 875a5739..64f8d256 100644 --- a/app/src/main/res/values-in-rID/strings.xml +++ b/app/src/main/res/values-in-rID/strings.xml @@ -80,7 +80,7 @@ Meek-biru (Cina) - aanvragen selecteer mail om een ​​bridge-adres aan te vragen. Zodra u het heeft ontvangen, kopieert en plakt u het in het bovenstaande vak en start u de software.​taal niet ondersteund + REQUEST BRIDGE systeemtaal wordt niet ondersteund door deze software. we werken eraan om het binnenkort op te nemen mail @@ -108,9 +108,6 @@ Identitas baru dibuat buka pengaturan - - REQUEST Bridge - MAAF MENDENGARNYA Jika Anda mengalami kesulitan saat menggunakan aplikasi ini, silakan hubungi kami melalui email. Kami akan mencoba menyelesaikan masalah Anda sesegera mungkin @@ -386,7 +383,8 @@ downloads bladwijzers Sla Deze Pagina Op - desktop site + desktop Verbinding + Tor Connection rapport website beoordeel deze app vind op pagina diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 411eaa1f..5b1ae5eb 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -108,8 +108,7 @@ apri impostazioni - Richiedi Nuovo Bridge - REQUEST Bridge + Richiedi Nuovo Bridge Seleziona E-mail qui sotto per richiedere un indirizzo Bridge. Una volta che hai un indirizzo, copialo e incollalo nella casella sopra e avvia l\'applicazione. Posta @@ -355,8 +354,6 @@ rimuovere la personalizzazione del browser - Bridge ... - sito web di segnalibro eliminare i collegamenti Web ei dati esplorati segnalibro chiaro e dati @@ -408,6 +405,7 @@ collegamenti Web visitati Impostazioni di sistema sito desktop + Tor Connessione salva questa pagina segnalibri sito web di report diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml index 53ac37ab..8477df87 100644 --- a/app/src/main/res/values-ja-rJP/strings.xml +++ b/app/src/main/res/values-ja-rJP/strings.xml @@ -338,8 +338,6 @@ ブラウザのカスタマイズを削除する - Bridge ... - ブックマークのウェブサイト 閲覧したウェブリンクとデータを削除する ブックマークとデータをクリアする @@ -391,6 +389,7 @@ 閲覧したWebリンク システム設定 デスクトップサイト + Tor 繋がり このページを保存する ブックマーク レポートのウェブサイト diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index a5f7f937..00e8015b 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -108,8 +108,7 @@ 설정 열기 - 새로운 요청 Bridge - REQUEST Bridge + 새로운 요청 Bridge Bridge 주소를 요청하려면 아래 이메일을 선택하십시오. 주소가 있으면 복사하여 위의 상자에 붙여넣고 응용 프로그램을 시작하십시오. 메일 @@ -343,8 +342,6 @@ 브라우저 사용자 정의 제거 - Bridge ... - 북마크 웹 사이트 탐색 한 웹 링크 및 데이터 삭제 책갈피 및 데이터 지우기 @@ -396,6 +393,7 @@ 탐색 한 웹 링크 시스템 설정 데스크탑 사이트 + Tor 연결 이 페이지 저장 북마크 웹 사이트 신고 diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 4f3c2d51..30fc1902 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -104,8 +104,7 @@ open instellingen - Nieuw Bridge Aanvragen - REQUEST Bridge + Nieuw Bridge Aanvragen Selecteer E-mail hieronder om een ​​Bridge-adres aan te vragen. Zodra u een adres heeft, kopieert en plakt u het in het bovenstaande vak en start u de aanvraag. Mail @@ -335,8 +334,6 @@ Browserinstellingen wissen - brug snaar ... - Bookmark Website Geschiedenis en gegevens wissen Bladwijzer en gegevens wissen @@ -386,6 +383,7 @@ Geschiedenis Instellingen Desktopsite + Tor Verbinding Maak Een Bladwijzer Voor Deze Pagina Bladwijzers Rapport website diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index bdd81395..8a9d6315 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -108,8 +108,7 @@ abrir configurações - Solicitar Novo Bridge - REQUEST Bridge + Solicitar Novo Bridge Selecione E-mail abaixo para solicitar um endereço Bridge.Uma vez que você tenha um endereço, copie e cole na caixa acima e inicie o aplicativo. Mail @@ -347,8 +346,6 @@ remover personalização do navegador - Bridge ... - site de favoritos excluir links da web navegados e dados limpar favorito e dados @@ -399,6 +396,7 @@ links da web navegados Configuração de sistema desktop site + Tor Conexão salve esta página favoritos site do relatório diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 7fa49aee..aadaeefa 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -108,8 +108,7 @@ deschide setările - Cerere Nouă Bridge - REQUEST Bridge + Cerere Nouă Bridge Selectați E-mailul de mai jos pentru a solicita o adresă Bridge. După ce aveți o adresă, copiați-o și lipiți-o în caseta de mai sus și porniți aplicația. Mail @@ -341,8 +340,6 @@ eliminați personalizarea browserului - Bridge ... - site de marcaje ștergeți linkurile web și datele navigate marcaj clar și date @@ -394,6 +391,7 @@ legături web navigate Setarea sistemului desktop site + Tor Conexiune salvați această pagină marcaje raportați site-ul web diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index fa6c8560..93bb6419 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -108,8 +108,7 @@ открыть настройки - Запросить новый Bridge - REQUEST Bridge + Запросить новый Bridge Выберите адрес электронной почты ниже, чтобы запросить адрес Bridge. Как только у вас есть адрес, скопируйте и вставьте его в поле выше и запустите приложение. Почта @@ -336,8 +335,6 @@ удалить настройки браузера - Bridge ... - сайт закладок удалить просмотренные веб-ссылки и данные очистить закладку и данные @@ -386,6 +383,7 @@ просмотренные веб-ссылки Системные настройки настольный сайт + Tor Связь сохранить эту страницу закладки веб-сайт отчета diff --git a/app/src/main/res/values-th/strings.xml b/app/src/main/res/values-th/strings.xml index 2bd7dc74..4f2a0273 100644 --- a/app/src/main/res/values-th/strings.xml +++ b/app/src/main/res/values-th/strings.xml @@ -108,8 +108,7 @@ เปิดการตั้งค่า - ขอใหม่ Bridge - REQUEST Bridge + ขอใหม่ Bridge เลือกอีเมลด้านล่างเพื่อขอที่อยู่ Bridge เมื่อคุณมีที่อยู่แล้ว ให้คัดลอกและวางลงในช่องด้านบนแล้วเริ่มแอปพลิเคชัน จดหมาย @@ -346,8 +345,6 @@ ลบการปรับแต่งเบราว์เซอร์ - Bridge ... - เว็บไซต์บุ๊คมาร์ค ลบเว็บลิงค์และข้อมูลที่เรียกดู ล้างบุ๊คมาร์คและข้อมูล @@ -399,6 +396,7 @@ ลิงก์เว็บที่เรียกดู การตั้งค่าระบบ ไซต์เดสก์ท็อป + Tor การเชื่อมต่อ บันทึกหน้านี้ บุ๊คมาร์ค รายงานเว็บไซต์ diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index f71e98b5..bdf20ca6 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -159,8 +159,7 @@ Resim dosyasını indirin - Yeni Bridge Talebi - REQUEST Bridge + Yeni Bridge Talebi Bridge adresi istemek için aşağıdaki E-posta\'yı seçin. Bir adresiniz olduğunda, kopyalayıp yukarıdaki kutuya yapıştırın ve uygulamayı başlatın. Posta @@ -391,6 +390,7 @@ taranan web bağlantıları Sistem ayarı masaüstü sitesi + Tor Bağ bu sayfayı kaydet yer imleri web sitesini bildir diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index e2ab5334..784976a0 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -104,8 +104,7 @@ відкрити налаштування - Запит нового Bridge - REQUEST Bridge + Запит нового Bridge Виберіть E-mail нижче, щоб надіслати запит на адресу Bridge. Після того, як у вас є адреса, скопіюйте та вставте її у вікно вище та запустіть програму. Пошта @@ -338,8 +337,6 @@ Очистити налаштування браузера - мостова струна ... - Закладка Веб-сайт Очистити історію та дані Очистити закладки та дані @@ -387,6 +384,7 @@ Історія Налаштування Сайт для робочого столу + Tor Підключення Додати цю сторінку в закладки Закладки Веб-сайт звітів diff --git a/app/src/main/res/values-ur/strings.xml b/app/src/main/res/values-ur/strings.xml index ed0c661c..97fb207d 100644 --- a/app/src/main/res/values-ur/strings.xml +++ b/app/src/main/res/values-ur/strings.xml @@ -399,6 +399,7 @@ براؤز ویب لنکس سسٹم سیٹنگ ڈیسک ٹاپ سائٹ + Tor کنکشن اس صفحے کو محفوظ کریں بُک مارکس رپورٹ ویب سائٹ diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 96323351..0bea2cd1 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -108,8 +108,7 @@ mở cài đặt - Yêu Cầu Mới Bridge - REQUEST Bridge + Yêu Cầu Mới Bridge Chọn E-mail bên dưới để yêu cầu địa chỉ Bridge. Sau khi bạn có địa chỉ, hãy sao chép và dán nó vào ô trên và khởi động ứng dụng. Thư tín @@ -390,6 +389,7 @@ liên kết web đã duyệt Thiết lập hệ thống trang máy tính để bàn + Tor Sự liên quan lưu trang này dấu trang báo cáo trang web diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 178d0e8c..bf5a9b40 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -108,8 +108,7 @@ 打开设置 - 请求新的 Bridge - REQUEST Bridge + 请求新的 Bridge 选择下面的电子邮件以请求 Bridge 地址。获得地址后,将其复制并粘贴到上面的框中并启动应用程序。 邮件 @@ -341,8 +340,6 @@ 删除浏览器自定义 - Bridge ... - 书签网站 删除浏览的网页链接和数据 清除书签和数据 @@ -394,6 +391,7 @@ 浏览的网页链接 系统设定 桌面网站 + Tor 联系 保存此页面 书签 报告网站 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9bd37e4a..1fc3fa47 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -279,15 +279,15 @@ Stop all known trackers, Pages will load faster but some functionality might not work Allow Javascript | Toggle to Enable Javascript Disable java scripting for various script attacks - Block Popup | Toggle to Disable Popup Advert - Remove popup advertizement. Might break functionaly of some websites + Block Popup | Toggle to Disable Popup Advert + Remove popup advertizement. Might break functionaly of some websites Settings | Advance Restore tabs Don\'t restore after quitting browser Toolbar Theme Set toolbar theme as defined in website - Tab view - Switch between Tab manager Grid Layout and List Layout + Tab view + Switch between Tab manager Grid Layout and List Layout Show Images Always load website images Show web fonts @@ -300,8 +300,8 @@ Media Change default data saver settings Change default media settings - Grid Design - List Design + Grid Design + List Design Always show images Only show images over WI-FI Block all images @@ -326,8 +326,6 @@ Home, language Full-screen browsing Hide the browser toolbar when scrolling down a page - Searchbar theme - Automatically change search bar theme according to website Language Change the language of your browser Theme @@ -337,7 +335,7 @@ Change full-screen browsing and language settings System Default Home - about:blank + about:blank New Tab Open homepage in new tab Clear all tabs @@ -357,7 +355,7 @@ Clearing data will remove history, cookies, and other browsing data Remove all bookmarks ? Clear - Confirm + Confirm Report Report Website If you think this URL is illegal or disturbing, report it to us, so we can take legal action @@ -387,12 +385,12 @@ No application found to handle email Download File | Data Cleared | Restart Required - Data Cleared Successfully - Private data cleared successfully. Application will close in a moment. Now you can safely continue browsing - Closing Genesis Please Wait ... - Genesis Connecting ... - Application closed unexpectedly - Request New Bridge   Application crashed due to unexpected error. We are looking into the issue mean while you can continue with this application + Data Cleared Successfully + Private data cleared successfully. Application will close in a moment. Now you can safely continue browsing + Closing Genesis Please Wait ... + Genesis Connecting ... + Application closed unexpectedly + Request New Bridge   Application crashed due to unexpected error. We are looking into the issue mean while you can continue with this application New identity @@ -404,8 +402,9 @@ Downloads History Settings - New identity created + New identity created Desktop site + Tor Connection Bookmark This Page Bookmarks Recent tabs @@ -433,14 +432,14 @@ History Clear - Pages that you visit appear here + Pages that you visit appear here Search ... Bookmark Clear Search ... - Pages that you bookmark appear here + Pages that you bookmark appear here Retry diff --git a/orbotmanager/src/main/java/org/torproject/android/service/OrbotService.java b/orbotmanager/src/main/java/org/torproject/android/service/OrbotService.java index dfe852f0..1595bd31 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/OrbotService.java +++ b/orbotmanager/src/main/java/org/torproject/android/service/OrbotService.java @@ -6,6 +6,8 @@ package org.torproject.android.service; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static org.torproject.android.service.TorServiceConstants.CMD_SETTING; import static org.torproject.android.service.TorServiceConstants.CMD_NEWNYM; +import static java.lang.Thread.sleep; + import android.annotation.SuppressLint; import android.app.Application; import android.app.Notification; @@ -106,7 +108,7 @@ public class OrbotService extends VpnService implements OrbotConstants { Handler mHandler; final Random bridgeSelectRandom = new Random(System.nanoTime()); - ActionBroadcastReceiver mActionBroadcastReceiver; + ActionBroadcastReceiver mActionBroadcastReceiver = null; private String mCurrentStatus = STATUS_OFF; TorControlConnection conn = null; private ServiceConnection torServiceConnection; @@ -148,8 +150,8 @@ public class OrbotService extends VpnService implements OrbotConstants { } private void showConnectedToTorNetworkNotification() { - mNotifyBuilder.setProgress(0, 0, false); - showToolbarNotification(getString(R.string.status_activated), NOTIFY_ID, R.mipmap.ic_stat_tor_logo); + // mNotifyBuilder.setProgress(0, 0, false); + // showToolbarNotification(getString(R.string.status_activated), NOTIFY_ID, R.mipmap.ic_stat_tor_logo); } @Override @@ -209,15 +211,15 @@ public class OrbotService extends VpnService implements OrbotConstants { mNotifyBuilder.mActions.clear(); if (conn != null && orbotLocalConstants.mIsTorInitialized) { - Intent intentRefresh = new Intent(CMD_NEWNYM); - PendingIntent pendingIntentNewNym = PendingIntent.getBroadcast(this, 0, intentRefresh, PendingIntent.FLAG_IMMUTABLE); - mNotifyBuilder.addAction(R.mipmap.ic_stat_tor_logo, getString(R.string.menu_new_identity), pendingIntentNewNym); - Intent intentSetting = new Intent(CMD_SETTING); - PendingIntent pendingIntentSetting = PendingIntent.getBroadcast(this, 0, intentSetting, PendingIntent.FLAG_IMMUTABLE); - mNotifyBuilder.addAction(0, "Notification Settings", pendingIntentSetting); + if (conn != null && mCurrentStatus.equals(STATUS_ON)) { + var pendingIntentNewNym = PendingIntent.getBroadcast(this, 0, new Intent(TorControlCommands.SIGNAL_NEWNYM), PendingIntent.FLAG_UPDATE_CURRENT|PendingIntent.FLAG_IMMUTABLE); + mNotifyBuilder.addAction(R.drawable.ic_refresh_white_24dp, getString(R.string.menu_new_identity), pendingIntentNewNym); + + var pendingIntentNotification = PendingIntent.getBroadcast(this, 0, new Intent(CMD_SETTING), PendingIntent.FLAG_UPDATE_CURRENT|PendingIntent.FLAG_IMMUTABLE); + mNotifyBuilder.addAction(0, "Notification Settings", pendingIntentNotification); + } } - mNotifyBuilder.setContentText(notifyMsg) .setSmallIcon(icon) .setTicker(notifyType != NOTIFY_ID ? notifyMsg : null); @@ -249,6 +251,10 @@ public class OrbotService extends VpnService implements OrbotConstants { public int onStartCommand(Intent intent, int flags, int startId) { showToolbarNotification(getString(org.torproject.android.service.R.string.newnym), NOTIFY_ID, org.torproject.android.service.R.drawable.ic_stat_starting_tor_logo); + createNetworkStateReciever(); + IntentFilter mNetworkStateFilter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION); + registerReceiver(mNetworkStateReceiver , mNetworkStateFilter); + self = this; if (intent != null) mExecutor.execute(new org.torproject.android.service.OrbotService.IncomingIntentRouter(intent)); @@ -259,7 +265,7 @@ public class OrbotService extends VpnService implements OrbotConstants { } private void showDeactivatedNotification() { - showToolbarNotification(getString(R.string.open_orbot_to_connect_to_tor), NOTIFY_ID, R.drawable.ic_stat_starting_tor_logo); + //showToolbarNotification(getString(R.string.open_orbot_to_connect_to_tor), NOTIFY_ID, R.drawable.ic_stat_starting_tor_logo); } @Override @@ -268,8 +274,12 @@ public class OrbotService extends VpnService implements OrbotConstants { try { disableNotification(); clearNotifications(); - //unregisterReceiver(mNetworkStateReceiver); - //unregisterReceiver(mActionBroadcastReceiver); + if(mNetworkStateReceiver!=null){ + unregisterReceiver(mNetworkStateReceiver); + } + if(mActionBroadcastReceiver!=null){ + unregisterReceiver(mActionBroadcastReceiver); + } }catch (Exception ex){ Log.i("sad","asd"); ex.printStackTrace(); @@ -288,60 +298,73 @@ public class OrbotService extends VpnService implements OrbotConstants { super.onDestroy(); } - private final BroadcastReceiver mNetworkStateReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { + private BroadcastReceiver mNetworkStateReceiver = null; + private void createNetworkStateReciever(){ + try { + mNetworkStateReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { - SharedPreferences prefs = org.torproject.android.service.util.Prefs.getSharedPrefs(getApplicationContext()); + SharedPreferences prefs = org.torproject.android.service.util.Prefs.getSharedPrefs(getApplicationContext()); - boolean doNetworKSleep = prefs.getBoolean(PREF_DISABLE_NETWORK, true); + boolean doNetworKSleep = prefs.getBoolean(PREF_DISABLE_NETWORK, true); - final ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); - final NetworkInfo netInfo = cm.getActiveNetworkInfo(); + final ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); + final NetworkInfo netInfo = cm.getActiveNetworkInfo(); - boolean newConnectivityState; - if(netInfo != null && netInfo.isConnected()) { - // WE ARE CONNECTED: DO SOMETHING - newConnectivityState = true; - } - else { - // WE ARE NOT: DO SOMETHING ELSE - newConnectivityState = false; - } - - if (newConnectivityState != mConnectivity) { - mConnectivity = newConnectivityState; - orbotLocalConstants.mNetworkState = mConnectivity; - - if (mConnectivity){ - newIdentity(); - } - } - - if (doNetworKSleep) - { - //setTorNetworkEnabled (mConnectivity); - if (!mConnectivity) - { - //sendCallbackStatus(STATUS_OFF); - orbotLocalConstants.mTorLogsStatus = "No internet connection"; - if(orbotLocalConstants.mNotificationStatus!=0){ - showToolbarNotification(getString(R.string.newnym), getNotifyId(), R.drawable.ic_stat_tor_off); - showToolbarNotification("Genesis is sleeping | Internet connectivity issue",NOTIFY_ID,R.drawable.ic_stat_tor_off); + boolean newConnectivityState; + if(netInfo != null && netInfo.isConnected()) { + // WE ARE CONNECTED: DO SOMETHING + newConnectivityState = true; } - } - else - { - //sendCallbackStatus(STATUS_STARTING); - if(orbotLocalConstants.mNotificationStatus!=0){ - showToolbarNotification(getString(R.string.status_starting_up),NOTIFY_ID,R.drawable.ic_stat_starting_tor_logo); + else { + // WE ARE NOT: DO SOMETHING ELSE + newConnectivityState = false; } - } - } - orbotLocalConstants.mNetworkState = mConnectivity; + if (newConnectivityState != mConnectivity) { + mConnectivity = newConnectivityState; + orbotLocalConstants.mNetworkState = mConnectivity; + + if (mConnectivity){ + newIdentity(); + } + } + try { + sleep(100); + } catch (InterruptedException e) { + e.printStackTrace(); + } + if (doNetworKSleep) + { + //setTorNetworkEnabled (mConnectivity); + if (!mConnectivity) + { + //sendCallbackStatus(STATUS_OFF); + orbotLocalConstants.mTorLogsStatus = "No internet connection"; + if(orbotLocalConstants.mNotificationStatus!=0){ + showToolbarNotification(getString(R.string.newnym), getNotifyId(), R.drawable.ic_stat_tor_off); + showToolbarNotification("Genesis is sleeping | Internet connectivity issue",NOTIFY_ID,R.drawable.ic_stat_tor_off); + } + } + else + { + //sendCallbackStatus(STATUS_STARTING); + + if(orbotLocalConstants.mNotificationStatus!=0){ + showToolbarNotification(getString(R.string.status_starting_up),NOTIFY_ID,R.drawable.ic_stat_starting_tor_logo); + } + } + + } + orbotLocalConstants.mNetworkState = mConnectivity; + } + }; + }catch (Exception ex){ + Log.i("asd","asd"); } - }; + Log.i("asd","asd"); + } public int getNotifyId() { return NOTIFY_ID; } @@ -579,6 +602,7 @@ public class OrbotService extends VpnService implements OrbotConstants { IntentFilter filter = new IntentFilter(TorControlCommands.SIGNAL_NEWNYM); filter.addAction(CMD_ACTIVE); + filter.addAction(CMD_SETTING); filter.addAction(ACTION_STATUS); filter.addAction(LOCAL_ACTION_NOTIFICATION_START); @@ -869,14 +893,14 @@ public class OrbotService extends VpnService implements OrbotConstants { while ((conn = torService.getTorControlConnection())==null) { try { - Thread.sleep(500); + sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } } try { - Thread.sleep(1000); + sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } @@ -1214,7 +1238,7 @@ public class OrbotService extends VpnService implements OrbotConstants { } void showBandwidthNotification(String message, boolean isActiveTransfer) { - if (!mCurrentStatus.equals(STATUS_ON)) return; + if (!mCurrentStatus.equals(STATUS_ON) || !mConnectivity) return; var icon = !isActiveTransfer ? R.mipmap.ic_stat_tor_logo : R.mipmap.ic_stat_tor_logo; showToolbarNotification(message, NOTIFY_ID, icon); } @@ -1270,7 +1294,7 @@ public class OrbotService extends VpnService implements OrbotConstants { if (v3auths != null) { for (File file : mV3AuthBasePath.listFiles()) { if (!file.isDirectory()) - file.delete(); // todo the adapter should maybe just write these files and not do this in service... + file.delete(); } torrc.append("ClientOnionAuthDir " + mV3AuthBasePath.getAbsolutePath()).append('\n'); try { @@ -1569,6 +1593,9 @@ public class OrbotService extends VpnService implements OrbotConstants { case TorControlCommands.SIGNAL_NEWNYM: newIdentity(); break; + case CMD_SETTING: + onSettingRegister(); + break; case CMD_ACTIVE: sendSignalActive(); break; @@ -1594,6 +1621,7 @@ public class OrbotService extends VpnService implements OrbotConstants { private class ActionBroadcastReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { + switch (intent.getAction()) { case TorControlCommands.SIGNAL_NEWNYM: { newIdentity(); @@ -1609,6 +1637,7 @@ public class OrbotService extends VpnService implements OrbotConstants { } case CMD_SETTING: { onSettingRegister(); + sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); break; } case ACTION_STATUS: { diff --git a/orbotmanager/src/main/java/org/torproject/android/service/wrapper/orbotLocalConstants.java b/orbotmanager/src/main/java/org/torproject/android/service/wrapper/orbotLocalConstants.java index d8106363..1f84e30d 100644 --- a/orbotmanager/src/main/java/org/torproject/android/service/wrapper/orbotLocalConstants.java +++ b/orbotmanager/src/main/java/org/torproject/android/service/wrapper/orbotLocalConstants.java @@ -10,7 +10,7 @@ public class orbotLocalConstants { public static ArrayList mTorLogsHistory = new ArrayList<>(); public static String mTorLogsStatus = "Loading..."; - public static boolean mIsTorInitialized = true; + public static boolean mIsTorInitialized = false; public static boolean mForcedQuit = false; public static int mNotificationStatus = 0; public static WeakReference mHomeContext; diff --git a/orbotmanager/src/main/res/values/strings.xml b/orbotmanager/src/main/res/values/strings.xml index d14a77e6..70b1a0a0 100644 --- a/orbotmanager/src/main/res/values/strings.xml +++ b/orbotmanager/src/main/res/values/strings.xml @@ -25,8 +25,8 @@ Waiting for control port… Connecting to control port: - KiB/s - MiB/s + KB/s + MB/s %s Your snowflake proxy helped someone circumvent censorship %s