From 5817c45cbb9c36f5a51df33094c6b04e197044d0 Mon Sep 17 00:00:00 2001 From: Abdul Mannan Saeed <111820160@umt.edu.pk> Date: Wed, 15 Feb 2023 02:09:35 +0500 Subject: [PATCH] Bug Fixes Bug Fixes --- .idea/deploymentTargetDropDown.xml | 17 --- .safedk/hashes.safedk | 4 +- .safedk/plugin.properties | 2 +- .../results.bin | 0 .../assets/policy/style/home/cs-privacy.css | 8 +- .../bookmarkHome/bookmarkAdapter.java | 5 +- .../historyManager/historyAdapter.java | 5 +- .../dataModel/geckoDataModel.java | 3 +- .../delegateModel/contentDelegate.java | 31 +++--- .../delegateModel/historyDelegate.java | 4 +- .../delegateModel/mediaSessionDelegate.java | 8 +- .../delegateModel/navigationDelegate.java | 3 +- .../delegateModel/progressDelegate.java | 17 +-- .../geckoManager/geckoClients.java | 32 +++--- .../geckoManager/geckoSession.java | 7 +- .../homeController/homeController.java | 102 ++++++++++-------- .../homeManager/homeController/homeEnums.java | 4 +- .../homeManager/homeController/homeModel.java | 5 + .../homeController/homeViewController.java | 80 ++++++++++---- .../languageManager/languageController.java | 1 - .../languageManager/languageModel.java | 2 +- .../settingGeneralController.java | 2 +- .../settingNotificationController.java | 7 +- .../settingNotificationModel.java | 9 +- .../settingNotificationViewController.java | 2 +- .../onionservices/constants/status.java | 5 +- .../langPluginManager/langManager.java | 2 +- .../res/layouts/home/layout/home_view.xml | 34 +++--- app/src/main/res/values/strings.xml | 4 +- .../results.bin | 0 30 files changed, 227 insertions(+), 178 deletions(-) delete mode 100644 .idea/deploymentTargetDropDown.xml create mode 100644 OrbotLib/build/.transforms/1d0023a7697bafdf49208cbf2ae824d8/results.bin create mode 100644 tor-android/build/.transforms/6d1e181b428a2684388189241bc7d778/results.bin diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml deleted file mode 100644 index 774c5408..00000000 --- a/.idea/deploymentTargetDropDown.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.safedk/hashes.safedk b/.safedk/hashes.safedk index 3ad15a2f..9044fa7f 100644 --- a/.safedk/hashes.safedk +++ b/.safedk/hashes.safedk @@ -1,3 +1,3 @@ -#Sun Feb 12 18:54:23 PKT 2023 +#Wed Feb 15 00:42:23 PKT 2023 \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000= -json=321093871 +json=337604914 diff --git a/.safedk/plugin.properties b/.safedk/plugin.properties index 27ad291c..793f0798 100644 --- a/.safedk/plugin.properties +++ b/.safedk/plugin.properties @@ -1,5 +1,5 @@ # -#Sun Feb 12 19:27:01 PKT 2023 +#Wed Feb 15 01:32:40 PKT 2023 \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000= sdk_analysis_plugin_version=4.8.5 set_multidex=true diff --git a/OrbotLib/build/.transforms/1d0023a7697bafdf49208cbf2ae824d8/results.bin b/OrbotLib/build/.transforms/1d0023a7697bafdf49208cbf2ae824d8/results.bin new file mode 100644 index 00000000..e69de29b diff --git a/app/src/main/assets/policy/style/home/cs-privacy.css b/app/src/main/assets/policy/style/home/cs-privacy.css index 3b5e39dc..f270a5d2 100644 --- a/app/src/main/assets/policy/style/home/cs-privacy.css +++ b/app/src/main/assets/policy/style/home/cs-privacy.css @@ -30,12 +30,12 @@ padding-top: 3px } .privacy__welcome-mail{ - font-size: 15px;/ - text-align:center; + font-size: 15px; + text-align:center !important; margin: 25px auto auto; font-weight: bold; - padding: 13px 13px 13px 33px; - width: 200px; + padding: 13px 13px 13px 13px; + max-width: 200px; border-radius: 5px; border: 2px solid white; cursor: pointer; diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/bookmarkManager/bookmarkHome/bookmarkAdapter.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/bookmarkManager/bookmarkHome/bookmarkAdapter.java index d10e4ab7..901db596 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/bookmarkManager/bookmarkHome/bookmarkAdapter.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/bookmarkManager/bookmarkHome/bookmarkAdapter.java @@ -21,6 +21,7 @@ import com.hiddenservices.onionservices.dataManager.models.bookmarkRowModel; import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.helperManager.helperMethod; import com.hiddenservices.onionservices.R; +import com.hiddenservices.onionservices.pluginManager.pluginController; import java.util.ArrayList; import java.util.Arrays; @@ -29,6 +30,8 @@ import java.util.Date; import java.util.List; import static android.content.Context.LAYOUT_INFLATER_SERVICE; +import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_COPY; +import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_RESET; @SuppressLint("NotifyDataSetChanged") public class bookmarkAdapter extends RecyclerView.Adapter { @@ -327,7 +330,7 @@ public class bookmarkAdapter extends RecyclerView.Adapter { @@ -401,7 +404,7 @@ public class historyAdapter extends RecyclerView.Adapter { try { - mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, this), homeEnums.eGeckoCallback.M_OPEN_SESSION); + mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, this), homeEnums.eGeckoCallback.M_OPEN_SESSION); } catch (Exception ignored) { } }, mCrashCount * 500L); @@ -159,7 +158,7 @@ public class contentDelegate implements GeckoSession.ContentDelegate { @UiThread public void onKill(@NonNull GeckoSession session) { - mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoSession), homeEnums.eGeckoCallback.ON_DESTROY_MEDIA); + mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, mGeckoSession), homeEnums.eGeckoCallback.ON_DESTROY_MEDIA); if (!mClosed && status.sSettingIsAppStarted) { if (mEvent == null) { @@ -178,7 +177,7 @@ public class contentDelegate implements GeckoSession.ContentDelegate { handler.postDelayed(() -> { if (status.sSettingIsAppStarted && !session.isOpen()) { try { - mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, this), homeEnums.eGeckoCallback.M_OPEN_SESSION); + mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, this), homeEnums.eGeckoCallback.M_OPEN_SESSION); } catch (Exception ignored) { } } @@ -192,7 +191,7 @@ public class contentDelegate implements GeckoSession.ContentDelegate { @UiThread public void onCloseRequest(@NonNull final GeckoSession session) { mClosed = true; - mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, this), homeEnums.eGeckoCallback.ON_DESTROY_MEDIA); + mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, this), homeEnums.eGeckoCallback.ON_DESTROY_MEDIA); mGeckoDataModel.mSessionID = "-1"; } diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/historyDelegate.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/historyDelegate.java index bfdc7bbe..1be19a2f 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/historyDelegate.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/historyDelegate.java @@ -36,6 +36,9 @@ public class historyDelegate implements GeckoSession.HistoryDelegate { @UiThread public void onHistoryStateChange(@NonNull GeckoSession var1, @NonNull GeckoSession.HistoryDelegate.HistoryList var2) { + if(mHistory==null || mHistory.size()!=var2.size()){ + mGeckoDataModel.mTheme = null; + } mHistory = var2; if(mHistory !=null){ setURL(mHistory.get(mHistory.getCurrentIndex()).getUri()); @@ -43,7 +46,6 @@ public class historyDelegate implements GeckoSession.HistoryDelegate { if(mCurrentIndex != var2.getCurrentIndex()){ mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mHistory.get(mHistory.getCurrentIndex()).getTitle(), mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, mGeckoSession), homeEnums.eGeckoCallback.ON_UPDATE_SEARCH_BAR); } - Object mID = mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mHistory.get(mHistory.getCurrentIndex()).getTitle(), -1, mGeckoDataModel.mTheme, mGeckoSession, false), homeEnums.eGeckoCallback.ON_UPDATE_HISTORY); if (mID != null) { mGeckoDataModel.mCurrentURL_ID = (int) mID; diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/mediaSessionDelegate.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/mediaSessionDelegate.java index c819b353..febcf946 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/mediaSessionDelegate.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/mediaSessionDelegate.java @@ -21,6 +21,7 @@ public class mediaSessionDelegate implements MediaSession.Delegate{ private mediaDelegate mMediaDelegate; private WeakReference mContext; private geckoDataModel mGeckoDataModel; + private boolean mIsRunning = false; private Bitmap mMediaImage; private String mMediaTitle = GENERIC_EMPTY_STR; @@ -38,6 +39,7 @@ public class mediaSessionDelegate implements MediaSession.Delegate{ @Override public void onActivated(@NonNull GeckoSession session, @NonNull MediaSession mediaSession) { MediaSession.Delegate.super.onActivated(session, mediaSession); + mIsRunning = true; mMediaSession = mediaSession; } @@ -49,7 +51,6 @@ public class mediaSessionDelegate implements MediaSession.Delegate{ @Override public void onMetadata(@NonNull GeckoSession session, @NonNull MediaSession mediaSession, @NonNull MediaSession.Metadata meta) { - try { mMediaTitle = meta.title; mMediaImage = meta.artwork.getBitmap(250).poll(2500); @@ -103,8 +104,10 @@ public class mediaSessionDelegate implements MediaSession.Delegate{ mMediaSession.play(); } else if(pCommands.equals(enums.MediaController.PAUSE)){ - mMediaDelegate.showNotification(this.mContext.get(), mMediaTitle, helperMethod.getHost(mGeckoDataModel.mCurrentURL), mMediaImage, false); mMediaSession.pause(); + if(mIsRunning){ + mMediaDelegate.showNotification(this.mContext.get(), mMediaTitle, helperMethod.getHost(mGeckoDataModel.mCurrentURL), mMediaImage, false); + } } else if(pCommands.equals(enums.MediaController.STOP)){ mMediaSession.stop(); @@ -112,6 +115,7 @@ public class mediaSessionDelegate implements MediaSession.Delegate{ else if(pCommands.equals(enums.MediaController.DESTROY)){ mMediaSession.stop(); mMediaDelegate.onHideDefaultNotification(); + mIsRunning = false; } else if(pCommands.equals(enums.MediaController.SKIP_BACKWARD)){ mMediaSession.previousTrack(); diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/navigationDelegate.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/navigationDelegate.java index 09ab8a1f..330dfcbf 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/navigationDelegate.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/navigationDelegate.java @@ -112,7 +112,7 @@ public class navigationDelegate implements GeckoSession.NavigationDelegate { mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, false), homeEnums.eGeckoCallback.M_LOAD_HOMEPAGE_GENESIS); return GeckoResult.fromValue(AllowOrDeny.DENY); } else if (var1.target == 2) { - mEvent.invokeObserver(Arrays.asList(m_url, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.open_new_tab); + mEvent.invokeObserver(Arrays.asList(m_url, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.OPEN_NEW_TAB); mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mTheme), homeEnums.eGeckoCallback.ON_EXPAND_TOP_BAR); return GeckoResult.fromValue(AllowOrDeny.DENY); } else if (!m_url.equals("about:blank")) { @@ -154,6 +154,7 @@ public class navigationDelegate implements GeckoSession.NavigationDelegate { if (status.sSettingIsAppStarted && orbotLocalConstants.mIsTorInitialized) { errorHandler handler = new errorHandler(); mEvent.invokeObserver(Arrays.asList(var2, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.ON_LOAD_ERROR); + mGeckoDataModel.mTheme = null; mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mTheme), homeEnums.eGeckoCallback.ON_UPDATE_THEME); InputStream mResourceURL = null; diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/progressDelegate.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/progressDelegate.java index 65a9c2db..c931488f 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/progressDelegate.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/progressDelegate.java @@ -2,7 +2,6 @@ package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.del import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION; -import android.os.Handler; import androidx.annotation.NonNull; import androidx.annotation.UiThread; import androidx.appcompat.app.AppCompatActivity; @@ -69,7 +68,8 @@ public class progressDelegate implements GeckoSession.ProgressDelegate { @Override public void onPageStart(@NonNull GeckoSession var1, @NonNull String var2) { - + mEvent.invokeObserver(Arrays.asList(5, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.PROGRESS_UPDATE_FORCED); + mEvent.invokeObserver(Arrays.asList(var2, mGeckoDataModel.mSessionID, var2, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, null), homeEnums.eGeckoCallback.ON_UPDATE_SEARCH_BAR); if (mIsLoaded) { if (!mGeckoDataModel.mCurrentURL.equals("about:config") && !var2.equals("about:blank") && helperMethod.getHost(var2).endsWith(".onion")) { var2 = var2.replace("www.", ""); @@ -85,7 +85,6 @@ public class progressDelegate implements GeckoSession.ProgressDelegate { if (!mGeckoDataModel.mCurrentURL.equals("about:config") && !mGeckoDataModel.mCurrentURL.equals("about:blank") && !mGeckoDataModel.mCurrentTitle.equals("loading")) { mProgress = 5; mContext.get().runOnUiThread(() -> mEvent.invokeObserver(Arrays.asList(5, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.PROGRESS_UPDATE)); - mGeckoDataModel.mThemeChanged = false; if(!var2.equals("about:blank")){ mEvent.invokeObserver(Arrays.asList(var2, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.SEARCH_UPDATE); } @@ -98,18 +97,6 @@ public class progressDelegate implements GeckoSession.ProgressDelegate { if (var2) { if (mProgress >= 100) { mEvent.invokeObserver(Arrays.asList(null, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.ON_PAGE_LOADED); - - if (!mGeckoDataModel.mThemeChanged) { - new Handler().postDelayed(() -> - { - if (!mGeckoDataModel.mThemeChanged) { - mGeckoDataModel.mTheme = null; - if (mEvent != null) { - mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mTheme), homeEnums.eGeckoCallback.ON_UPDATE_THEME); - } - } - }, 500); - } } } } 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 d2fb5fc9..1481ee46 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 @@ -59,7 +59,10 @@ public class geckoClients { if (pGeckoView.getSession() != null) { pGeckoView.releaseSession(); } - mSession = initSettings(pGeckoView, pEvent, pContext); + + this.mEvent = pEvent; + mSessionID = helperMethod.createRandomID(); + mSession = initSettings(pGeckoView, pEvent, pContext, mSessionID); initRuntimeSettings(pContext); mSession.open(mRuntime); pGeckoView.setSession(mSession); @@ -67,7 +70,8 @@ public class geckoClients { } public geckoSession initializeSessionInBackground(GeckoView pGeckoView, eventObserver.eventListener pEvent, AppCompatActivity pContext, String pURL) { - geckoSession mSessionHidden = initSettings(pGeckoView, pEvent, pContext); + geckoSession mSessionHidden = initSettings(pGeckoView, pEvent, pContext, helperMethod.createRandomID()); + mSessionHidden.open(mRuntime); mSessionHidden.loadUri(pURL); pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(pContext), M_LOAD_NEW_TAB); @@ -75,16 +79,13 @@ public class geckoClients { return mSessionHidden; } - private geckoSession initSettings(GeckoView pGeckoView, eventObserver.eventListener pEvent, AppCompatActivity pContext){ - this.mEvent = pEvent; - mSessionID = helperMethod.createRandomID(); - mSession = new geckoSession(new geckoViewClientCallback(), mSessionID, pContext, pGeckoView); - - mSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack); - mSession.getSettings().setFullAccessibilityTree(true); - mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE); - mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus); - return mSession; + private geckoSession initSettings(GeckoView pGeckoView, eventObserver.eventListener pEvent, AppCompatActivity pContext, String pSessionID){ + geckoSession mSessionIbitializer = new geckoSession(new geckoViewClientCallback(), pSessionID, pContext, pGeckoView); + mSessionIbitializer.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack); + mSessionIbitializer.getSettings().setFullAccessibilityTree(true); + mSessionIbitializer.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE); + mSessionIbitializer.getSettings().setAllowJavascript(status.sSettingJavaStatus); + return mSessionIbitializer; } public void initializeIcon(Context pcontext) { @@ -132,7 +133,6 @@ public class geckoClients { mSettings.configFilePath(helperMethod.getAssetsCacheFile(context, "geckoview-config.yaml")); } mSettings.build(); - onClearAll(); mRuntime = GeckoRuntime.create(context, mSettings.build()); mRuntime.getSettings().setAboutConfigEnabled(true); @@ -149,6 +149,7 @@ public class geckoClients { } dataController.getInstance().initializeListData(); + onClearAll(); } initializeIcon(context); } @@ -327,7 +328,6 @@ public class geckoClients { mRuntime.getStorageController().clearData(SITE_DATA); } } - public void onClearSession() { if (mRuntime != null) { mRuntime.getStorageController().clearData(AUTH_SESSIONS); @@ -385,7 +385,9 @@ public class geckoClients { } public void onExitFullScreen() { - //mSession.exitScreen(); + if(mSession!=null){ + mSession.exitScreen(); + } } public void onForwardPressed() { diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoSession.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoSession.java index e32f09bb..535372fe 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoSession.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoSession.java @@ -123,7 +123,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Progress public void onClose() { stop(); - mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, this), homeEnums.eGeckoCallback.ON_DESTROY_MEDIA); + mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, this), homeEnums.eGeckoCallback.ON_DESTROY_MEDIA); } public boolean onRestoreState() { @@ -178,17 +178,16 @@ public class geckoSession extends GeckoSession implements GeckoSession.Progress } public void goBackSession() { - mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, this), homeEnums.eGeckoCallback.ON_DESTROY_MEDIA); + mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, this), homeEnums.eGeckoCallback.ON_DESTROY_MEDIA); goBack(); } public void goForwardSession() { - mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, this), homeEnums.eGeckoCallback.ON_DESTROY_MEDIA); + mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, this), homeEnums.eGeckoCallback.ON_DESTROY_MEDIA); goForward(); } /*Properties Getter Setter*/ - public void setTheme(String pTheme) { mGeckoDataModel.mTheme = pTheme; } 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 9748b671..f7e053a6 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 @@ -265,6 +265,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba public void initTor() { + mHandler = new Handler(); try { if(!status.mThemeApplying) { Intent intent = new Intent(this, OrbotService.class); @@ -288,7 +289,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba }, 500); }else { onHideDefaultNotification(); - int notificationStatus = status.sBridgeNotificationManual; + int notificationStatus = status.sNotificaionStatus; if (notificationStatus == 0) { pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION); activityContextManager.getInstance().getHomeController().onShowDefaultNotification(); @@ -769,7 +770,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } public void onLoadTabHidden(boolean isSessionClosed, boolean pExpandAppBar, boolean pForced, boolean pGeneratePixel) { - mHomeViewController.onNewTabAnimation(null, M_NEW_LINK_ANIMATION, 5000); + mHomeViewController.onNewTabAnimation(null, M_NEW_LINK_ANIMATION, 1000); onLoadTab(mSessionNewTab, isSessionClosed, pExpandAppBar, pForced, pGeneratePixel); } @@ -925,7 +926,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba NotificationManager manager = null; public void showDefaultNotification(Context context, String title) { - if(!status.mThemeApplying && status.sTorBrowsing && status.sBridgeNotificationManual != 0 || !orbotLocalConstants.mAppStarted){ + if(!status.mThemeApplying && status.sTorBrowsing && status.sNotificaionStatus != 0 || !orbotLocalConstants.mAppStarted || status.sNotificaionStatus == 0){ return; } @@ -1458,17 +1459,19 @@ public class homeController extends AppCompatActivity implements ComponentCallba } public void onHomeButton(View view) { - mGeckoClient.getSession().setTheme(null); - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), true); - if(!status.sRestoreTabs){ - int mCount = (int) dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null); + if(mGeckoClient.getSession()!=null){ + mGeckoClient.getSession().setTheme(null); + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), true); + if(!status.sRestoreTabs){ + int mCount = (int) dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null); + } + if (status.sSettingDefaultSearchEngine.equals(constants.CONST_BACKEND_GENESIS_URL)) { + mHomeViewController.onNewTabAnimation(Collections.singletonList(helperMethod.getDomainName(mHomeModel.getSearchEngine())), homeEnums.eHomeViewCallback.M_HOME_BUTTON_PRESSED, 1000); + } else { + onLoadURL(helperMethod.getHost(status.sSettingDefaultSearchEngine)); + } + mHomeViewController.onUpdateSearchBar(status.sSettingDefaultSearchEngine, false, false, false); } - if (status.sSettingDefaultSearchEngine.equals(constants.CONST_BACKEND_GENESIS_URL)) { - mHomeViewController.onNewTabAnimation(Collections.singletonList(helperMethod.getDomainName(mHomeModel.getSearchEngine())), homeEnums.eHomeViewCallback.M_HOME_BUTTON_PRESSED, 5000); - } else { - onLoadURL(helperMethod.getHost(status.sSettingDefaultSearchEngine)); - } - mHomeViewController.onUpdateSearchBar(status.sSettingDefaultSearchEngine, false, false, false); } /*TAB CONTROLLER EVENTS*/ @@ -1525,15 +1528,16 @@ public class homeController extends AppCompatActivity implements ComponentCallba } public void postNewLinkTabAnimation(String url, boolean isRemovable) { + mHomeViewController.onNewTabAnimation(Collections.singletonList(helperMethod.getDomainName(mHomeModel.getSearchEngine())), null, 1000); + mGeckoView.releaseSession(); mHomeViewController.onProgressBarUpdate(5, true); dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_PIXEL, Arrays.asList(mGeckoClient.getSession().getSessionID(), mRenderedBitmap, null, mGeckoView, false)); - mGeckoClient.initializeSession(mGeckoView, new geckoViewCallback(), this); - mGeckoClient.onSaveCurrentTab(true); - dataController.getInstance().invokeTab(dataEnums.eTabCommands.MOVE_TAB_TO_TOP, Collections.singletonList(mGeckoClient.getSession())); - initTabCountForced(); + initializeGeckoView(true, true); mHomeViewController.progressBarReset(); mHomeViewController.onUpdateSearchBar(url, false, true, false); mGeckoClient.loadURL(url, mGeckoView, homeController.this); + mGeckoView.releaseSession(); + mGeckoView.setSession(mGeckoClient.getSession()); if (isRemovable) { mGeckoClient.setRemovableFromBackPressed(true); } @@ -1564,8 +1568,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba initTabCount(homeEnums.eHomeViewCallback.M_NEW_LINK_IN_NEW_TAB, Collections.singletonList(url)); } else { mHomeViewController.initTab((int) dataController.getInstance().invokeTab(dataEnums.eTabCommands.GET_TOTAL_TAB, null), false, null, null); - mHomeViewController.onNewTabAnimation(Collections.singletonList(url), homeEnums.eHomeViewCallback.M_NEW_LINK_IN_NEW_TAB_LOAD, 5000); + mHomeViewController.onNewTabAnimation(Collections.singletonList(url), homeEnums.eHomeViewCallback.M_NEW_LINK_IN_NEW_TAB_LOAD, 1000); } + mGeckoView.destroyDrawingCache(); } geckoSession mSessionNewTab = null; @@ -1578,6 +1583,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.progressBarReset(); initTabCountForced(); + + mSessionNewTab.loadUri(url); mAppBar.setTag(R.id.expandableBar, true); } @@ -1608,14 +1615,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba } mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); } - mHomeViewController.onNewTabAnimation(Arrays.asList(isKeyboardOpenedTemp, isKeyboardOpened), homeEnums.eHomeViewCallback.M_INITIALIZE_TAB_SINGLE, 5000); + mHomeViewController.onNewTabAnimation(Arrays.asList(isKeyboardOpenedTemp, isKeyboardOpened), homeEnums.eHomeViewCallback.M_INITIALIZE_TAB_SINGLE, 1000); }, 100); } - public void onUpdateScreenPixel() { - - } - public void onNewTabBackground(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened) { if (status.sSettingDefaultSearchEngine.startsWith("http://167.86.99.31") || !status.sOpenURLInNewTab || mGeckoClient.getSession().getCurrentURL().equals("about:blank") || mGeckoClient.getSession().getCurrentURL().contains("167.86.99.31") || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)) { mHomeViewController.updateBannerAdvertStatus(false, (boolean) pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); @@ -1633,7 +1636,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), true); } - mHomeViewController.onNewTabAnimation(Arrays.asList(isKeyboardOpenedTemp, isKeyboardOpened), homeEnums.eHomeViewCallback.M_INITIALIZE_TAB_SINGLE, 5000); + mHomeViewController.onNewTabAnimation(Arrays.asList(isKeyboardOpenedTemp, isKeyboardOpened), homeEnums.eHomeViewCallback.M_INITIALIZE_TAB_SINGLE, 1000); } public String completeURL(String pURL) { @@ -1649,12 +1652,13 @@ public class homeController extends AppCompatActivity implements ComponentCallba if (status.sSettingDefaultSearchEngine.startsWith("http://167.86.99.31") || !status.sOpenURLInNewTab || mGeckoClient.getSession().getCurrentURL().equals("about:blank") || mGeckoClient.getSession().getCurrentURL().contains("167.86.99.31") || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoClient.getSession().getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)) { mHomeViewController.updateBannerAdvertStatus(false, (boolean) pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); } - mHomeViewController.onNewTabAnimation(Collections.singletonList(url), homeEnums.eHomeViewCallback.M_INITIALIZE_TAB_LINK, 5000); + mHomeViewController.onNewTabAnimation(Collections.singletonList(url), homeEnums.eHomeViewCallback.M_INITIALIZE_TAB_LINK, 1000); }, 100); } public void onOpenLinkNewTabLoaded(String url) { mNewTab.setPressed(true); + mHomeViewController.onNewTabAnimation(Collections.singletonList(helperMethod.getDomainName(mHomeModel.getSearchEngine())), null, 1000); final Handler handler = new Handler(); handler.postDelayed(() -> { onGetThumbnail(null, false); @@ -1724,7 +1728,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } boolean mBookmarked = (boolean) dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_BOOKMARK_AVAILABLE, Collections.singletonList(url)); - mHomeViewController.onOpenMenu(view, mGeckoClient.canGoForward(), !(mProgressBar.getAlpha() <= 0 || mProgressBar.getVisibility() == View.INVISIBLE), mGeckoClient.getUserAgent(), mGeckoClient.getSession().getCurrentURL(), mBookmarked); + mHomeViewController.onOpenMenu(view, mGeckoClient.canGoForward(), !(mProgressBar.getAlpha() <= 0 || mProgressBar.getVisibility() == View.INVISIBLE || mProgressBar.getVisibility() == View.GONE), mGeckoClient.getUserAgent(), mGeckoClient.getSession().getCurrentURL(), mBookmarked); view.setClickable(false); new Handler().postDelayed(() -> @@ -1747,8 +1751,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba @Override public void onBackPressed() { - mSearchEngineBar.findViewById(R.id.pSearchEngineHintInvoke).setVisibility(View.GONE); - if (mTabFragment.getVisibility() == View.VISIBLE) { if (activityContextManager.getInstance().getTabController().isSelectionOpened()) { activityContextManager.getInstance().getTabController().onClearSelection(null); @@ -1896,6 +1898,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba @Override public void onResume() { + if(status.sNotificaionStatus == 1){ + onShowDefaultNotification(); + } orbotLocalConstants.mAppForceExit = false; pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); @@ -2174,21 +2179,23 @@ public class homeController extends AppCompatActivity implements ComponentCallba } public void onStartApplication(View view) { - //status.sSettingDefaultSearchEngine = constants.CONST_BACKEND_DUCK_DUCK_GO_URL; onStartBrowser(); - //status.sSettingDefaultSearchEngine = constants.CONST_BACKEND_DUCK_DUCK_GO_URL; - int notificationStatus = status.sBridgeNotificationManual; + int notificationStatus = status.sNotificaionStatus; if (notificationStatus == 0) { pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION); activityContextManager.getInstance().getHomeController().onShowDefaultNotification(); } else { new Handler().postDelayed(() -> { - pluginController.getInstance().onOrbotInvoke(Arrays.asList(status.sBridgeCustomBridge, status.sBridgeGatewayManual, status.sBridgeCustomType, status.sBridgeStatus, status.sShowImages, status.sClearOnExit, dataController.getInstance().invokeBridges(dataEnums.eBridgeWebsiteCommands.M_FETCH, null)), pluginEnums.eOrbotManager.M_START_ORBOT); pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_ENABLE_NOTIFICATION); }, 2000); } + new Handler().postDelayed(() -> + { + pluginController.getInstance().onOrbotInvoke(Arrays.asList(status.sBridgeCustomBridge, status.sBridgeGatewayManual, status.sBridgeCustomType, status.sBridgeStatus, status.sShowImages, status.sClearOnExit, dataController.getInstance().invokeBridges(dataEnums.eBridgeWebsiteCommands.M_FETCH, null)), pluginEnums.eOrbotManager.M_START_ORBOT); + }, 2000); + } public void onStartApplicationNoTor(View view) { @@ -2226,6 +2233,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba return mBannerAds; } + + public void onInvokeProxyLoading() { Callable callable = () -> { @@ -2593,7 +2602,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba activityContextManager.getInstance().getHomeController().onClearSession(); activityContextManager.getInstance().getHomeController().onClearCookies(); - onClearSettings(); + if(mGeckoClient.getSession()!=null){ + onClearSettings(); + } status.initStatus(activityContextManager.getInstance().getHomeController(), false); dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_DATA_CLEARED); @@ -2666,6 +2677,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba if(e_type==null){ return null; } + if (e_type.equals(homeEnums.eHomeViewCallback.M_INIT_TAB_COUNT_FORCED)) { initTabCountForced(); } @@ -2711,6 +2723,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), true); } } else if (e_type.equals(homeEnums.eHomeViewCallback.ON_UPDATE_THEME)) { + mHomeViewController.onResetTabAnimation(); mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); } else if (e_type.equals(homeEnums.eHomeViewCallback.M_INITIALIZE_TAB_SINGLE)) { initTabCount(homeEnums.eHomeViewCallback.ON_NEW_TAB_ANIMATION, data); @@ -2724,7 +2737,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } else if (e_type.equals(homeEnums.eHomeViewCallback.ON_INIT_ADS)) { mHomeViewController.onSetBannerAdMargin((boolean) data.get(0), (boolean) pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); - } else if (e_type.equals(homeEnums.eHomeViewCallback.on_full_screen_ads)) { + } else if (e_type.equals(homeEnums.eHomeViewCallback.ON_FULL_SCREEN_ADS)) { if((boolean)data.get(0)){ pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_HIDE_BANNER); }else { @@ -2768,7 +2781,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba }; handler.postDelayed(runnable, 2500); } - } else if (e_type.equals(homeEnums.eHomeViewCallback.on_url_load)) { + } else if (e_type.equals(homeEnums.eHomeViewCallback.ON_URL_LOAD)) { if (status.sSettingIsAppRedirected) { mHomeViewController.onPageFinished(); //mGeckoClient.onRedrawPixel(homeController.this); @@ -2948,6 +2961,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba mScrollHandler.postDelayed(mScrollRunnable, 450); } + Handler mHandler = null; + public class geckoViewCallback implements eventObserver.eventListener { @Override @@ -2974,8 +2989,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba } else if (e_type.equals(homeEnums.eGeckoCallback.M_LOAD_HOMEPAGE_GENESIS)) { onLoadURL(helperMethod.getDomainName(constants.CONST_BACKEND_GENESIS_URL)); } else if (e_type.equals(homeEnums.eGeckoCallback.PROGRESS_UPDATE_FORCED)) { - Log.i("SUPPPP7:", (String) data.get(2)); - mHomeViewController.onUpdateSearchBar((String) data.get(2), false, true, false); mHomeViewController.onProgressBarUpdate((int) data.get(0), true); } else if (e_type.equals(homeEnums.eGeckoCallback.ON_UPDATE_SEARCH_BAR)) { mHomeViewController.onUpdateSearchBar((String) data.get(0), false, false, false); @@ -2990,9 +3003,13 @@ public class homeController extends AppCompatActivity implements ComponentCallba } else if (e_type.equals(homeEnums.eGeckoCallback.M_CLOSE_TAB)) { onCloseCurrentTab(mGeckoClient.getSession()); } else if (e_type.equals(homeEnums.eGeckoCallback.M_CLOSE_TAB_BACK)) { - mHomeViewController.onNewTabAnimation(Collections.singletonList(mGeckoClient.getSession()), homeEnums.eGeckoCallback.M_CLOSE_TAB_BACK, 250); + mHomeViewController.onNewTabAnimation(Collections.singletonList(mGeckoClient.getSession()), homeEnums.eGeckoCallback.M_CLOSE_TAB_BACK, 500); } else if (e_type.equals(homeEnums.eGeckoCallback.ON_UPDATE_THEME)) { - mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); + mHomeViewController.onResetTabAnimation(); + new Handler().postDelayed(() -> + { + mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); + }, 500); } else if (e_type.equals(homeEnums.eGeckoCallback.START_PROXY)) { pluginController.getInstance().onOrbotInvoke(data, pluginEnums.eOrbotManager.M_SET_PROXY); } else if (e_type.equals(homeEnums.eGeckoCallback.ON_UPDATE_HISTORY)) { @@ -3037,7 +3054,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba pluginController.getInstance().onMessageManagerInvoke(data, M_LONG_PRESS_DOWNLOAD); } else if (e_type.equals(M_LONG_PRESS_URL)) { pluginController.getInstance().onMessageManagerInvoke(data, M_LONG_PRESS_URL); - } else if (e_type.equals(homeEnums.eGeckoCallback.open_new_tab)) { + } else if (e_type.equals(homeEnums.eGeckoCallback.OPEN_NEW_TAB)) { initTabCount(OPEN_NEW_TAB, data); } else if (e_type.equals(homeEnums.eGeckoCallback.ON_CLOSE_SESSION)) { if (!onCloseCurrentTab(mGeckoClient.getSession())) { @@ -3078,12 +3095,11 @@ public class homeController extends AppCompatActivity implements ComponentCallba dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_RATE_COUNT, status.sGlobalURLCount)); } else if (e_type.equals(homeEnums.eGeckoCallback.M_ORBOT_LOADING)) { pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(homeController.this), M_ORBOT_LOADING); - } else if (e_type.equals(homeEnums.eGeckoCallback.M_DEFAULT_BROWSER)) { - //if (helperMethod.isDefaultBrowserSet(homeController.this)) { + } + else if (e_type.equals(homeEnums.eGeckoCallback.M_DEFAULT_BROWSER)) { runOnUiThread(() -> { pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(homeController.this), M_DEFAULT_BROWSER); }); - //} } else if (e_type.equals(homeEnums.eGeckoCallback.M_NEW_IDENTITY)) { pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_NEW_CIRCUIT); } else if (e_type.equals(homeEnums.eGeckoCallback.M_NEW_IDENTITY_MESSAGED)) { diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeEnums.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeEnums.java index ba002922..e1526f42 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeEnums.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeEnums.java @@ -4,11 +4,11 @@ package com.hiddenservices.onionservices.appManager.homeManager.homeController; public class homeEnums { public enum eHomeViewCallback { - M_HOME_PAGE, M_INITIALIZE_TAB_LINK_OPEN, OPEN_NEW_TAB_INSTANT, ON_LOAD_TAB_ON_RESUME, ON_LOAD_ADVERT, on_url_load, M_WELCOME_MESSAGE, M_SPLASH_DISABLE, M_GET_CURRENT_URL, M_ON_BANNER_UPDATE, on_full_screen_ads, M_INITIALIZE_TAB_LINK, M_HOME_BUTTON_PRESSED, M_INITIALIZE_TAB_SINGLE, ON_UPDATE_THEME, M_UPDATE_THEME, OPEN_DOWNLOAD_FOLDER, ON_OPEN_TAB_VIEW, ON_NEW_TAB_ANIMATION, M_UPDATE_PIXEL_BACKGROUND, M_CACHE_UPDATE_TAB, OPEN_NEW_TAB, M_RESET_SUGGESTION, M_NEW_LINK_IN_NEW_TAB_LOAD, M_NEW_LINK_IN_NEW_TAB, M_NEW_LINK_ANIMATION, M_ADVERT_LOADED, M_CLOSE_TAB_BACK, M_INIT_TOR, M_GET_SSL_STATUS, M_INIT_TAB_COUNT_FORCED, PROGRESS_UPDATE, ON_INIT_ADS, M_PRELOAD_URL + M_HOME_PAGE, M_INITIALIZE_TAB_LINK_OPEN, OPEN_NEW_TAB_INSTANT, ON_LOAD_TAB_ON_RESUME, ON_LOAD_ADVERT, ON_URL_LOAD, M_WELCOME_MESSAGE, M_SPLASH_DISABLE, M_GET_CURRENT_URL, M_ON_BANNER_UPDATE, ON_FULL_SCREEN_ADS, M_INITIALIZE_TAB_LINK, M_HOME_BUTTON_PRESSED, M_INITIALIZE_TAB_SINGLE, ON_UPDATE_THEME, M_UPDATE_THEME, OPEN_DOWNLOAD_FOLDER, ON_OPEN_TAB_VIEW, ON_NEW_TAB_ANIMATION, M_UPDATE_PIXEL_BACKGROUND, M_CACHE_UPDATE_TAB, OPEN_NEW_TAB, M_RESET_SUGGESTION, M_NEW_LINK_IN_NEW_TAB_LOAD, M_NEW_LINK_IN_NEW_TAB, M_NEW_LINK_ANIMATION, M_ADVERT_LOADED, M_CLOSE_TAB_BACK, M_INIT_TOR, M_GET_SSL_STATUS, M_INIT_TAB_COUNT_FORCED, M_FLUSH_DRAWABLE, PROGRESS_UPDATE, ON_INIT_ADS, M_PRELOAD_URL } public enum eGeckoCallback { - ON_FETCH_FAVICON, M_RELOAD,open_new_tab, M_DEFAULT_BROWSER, M_RATE_COUNT, M_INDEX_WEBSITE, ON_DESTROY_MEDIA, ON_HANDLE_EXTERNAL_INTENT, SESSION_ID, ON_LOAD_REQUEST, M_NEW_IDENTITY_MESSAGED, ON_UPDATE_SUGGESTION, M_NEW_IDENTITY, M_ORBOT_LOADING, M_UPDATE_PIXEL_BACKGROUND, M_OPEN_SESSION, M_ON_MAIL, FINDER_RESULT_CALLBACK, M_UPDATE_SESSION_STATE, ON_UPDATE_TAB_TITLE, ON_PLAYSTORE_LOAD, ON_CLOSE_SESSION, ON_LONG_PRESS, ON_UPDATE_FAVICON, ON_FULL_SCREEN, DOWNLOAD_FILE_POPUP, SEARCH_UPDATE, ON_LOAD_ERROR, ON_PAGE_LOADED, ON_UPDATE_HISTORY, START_PROXY, ON_UPDATE_THEME, M_CLOSE_TAB, BACK_LIST_EMPTY, ON_URL_LOAD, ON_SESSION_REINIT, ON_INVOKE_PARSER, ON_FIRST_PAINT, ON_UPDATE_SEARCH_BAR, PROGRESS_UPDATE_FORCED, M_LOAD_HOMEPAGE_GENESIS, PROGRESS_UPDATE, M_ON_BANNER_UPDATE, ON_EXPAND_TOP_BAR, M_ON_SCROLL_NO_BOUNDARIES, M_ON_SCROLL_TOP_BOUNDARIES, M_ON_SCROLL_BOUNDARIES, M_CLOSE_TAB_BACK, M_CHANGE_HOME_THEME, ON_UPDATE_SUGGESTION_URL, ON_REQUEST_COMPLETED, GECKO_SCROLL_DOWN, GECKO_SCROLL_UP_MOVE, WAS_SCROLL_CHANGED, GECKO_SCROLL_DOWN_MOVE, GECKO_SCROLL_UP_ALWAYS + ON_FETCH_FAVICON, M_RELOAD, OPEN_NEW_TAB, M_DEFAULT_BROWSER, M_RATE_COUNT, M_INDEX_WEBSITE, ON_DESTROY_MEDIA, ON_HANDLE_EXTERNAL_INTENT, SESSION_ID, ON_LOAD_REQUEST, M_NEW_IDENTITY_MESSAGED, ON_UPDATE_SUGGESTION, M_NEW_IDENTITY, M_ORBOT_LOADING, M_UPDATE_PIXEL_BACKGROUND, M_OPEN_SESSION, M_ON_MAIL, FINDER_RESULT_CALLBACK, M_UPDATE_SESSION_STATE, ON_UPDATE_TAB_TITLE, ON_PLAYSTORE_LOAD, ON_CLOSE_SESSION, ON_LONG_PRESS, ON_UPDATE_FAVICON, ON_FULL_SCREEN, DOWNLOAD_FILE_POPUP, SEARCH_UPDATE, ON_LOAD_ERROR, ON_PAGE_LOADED, ON_UPDATE_HISTORY, START_PROXY, ON_UPDATE_THEME, M_CLOSE_TAB, BACK_LIST_EMPTY, ON_URL_LOAD, ON_SESSION_REINIT, ON_INVOKE_PARSER, ON_FIRST_PAINT, ON_UPDATE_SEARCH_BAR, PROGRESS_UPDATE_FORCED, M_LOAD_HOMEPAGE_GENESIS, PROGRESS_UPDATE, M_ON_BANNER_UPDATE, ON_EXPAND_TOP_BAR, M_ON_SCROLL_NO_BOUNDARIES, M_ON_SCROLL_TOP_BOUNDARIES, M_ON_SCROLL_BOUNDARIES, M_CLOSE_TAB_BACK, M_CHANGE_HOME_THEME, ON_UPDATE_SUGGESTION_URL, ON_REQUEST_COMPLETED, GECKO_SCROLL_DOWN, GECKO_SCROLL_UP_MOVE, WAS_SCROLL_CHANGED, GECKO_SCROLL_DOWN_MOVE, GECKO_SCROLL_UP_ALWAYS } public enum eHintCallback { diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeModel.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeModel.java index 54532154..f7576215 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeModel.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeModel.java @@ -1,9 +1,11 @@ package com.hiddenservices.onionservices.appManager.homeManager.homeController; import static com.hiddenservices.onionservices.constants.constants.CONST_PRIVACY_POLICY_URL_NON_TOR; +import static com.hiddenservices.onionservices.constants.constants.CONST_REPORT_URL; import android.util.Patterns; +import com.hiddenservices.onionservices.constants.constants; import com.hiddenservices.onionservices.constants.status; import com.hiddenservices.onionservices.helperManager.helperMethod; @@ -16,6 +18,9 @@ public class homeModel { } public String urlComplete(String pURL, String pSearchEngine) { + if (!pURL.startsWith(CONST_REPORT_URL) && (pURL.startsWith("resource://android/assets/homepage/") || pURL.startsWith("http://167.86.99.31/?pG") || pURL.startsWith("https://167.86.99.31?pG") || pURL.endsWith("167.86.99.31") || pURL.endsWith(constants.CONST_GENESIS_DOMAIN_URL_SLASHED))) { + return pURL; + } if (pURL.startsWith(CONST_PRIVACY_POLICY_URL_NON_TOR)) { return CONST_PRIVACY_POLICY_URL_NON_TOR; } 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 b5ae47de..a3559923 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 @@ -29,6 +29,8 @@ import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.view.animation.AccelerateInterpolator; +import android.view.animation.Animation; +import android.view.animation.Transformation; import android.view.inputmethod.InputMethodManager; import android.widget.*; import androidx.annotation.NonNull; @@ -41,6 +43,8 @@ import androidx.core.graphics.ColorUtils; import androidx.core.widget.NestedScrollView; import androidx.fragment.app.FragmentContainerView; import androidx.recyclerview.widget.RecyclerView; + +import com.hiddenservices.onionservices.BuildConfig; import com.hiddenservices.onionservices.appManager.activityContextManager; import com.hiddenservices.onionservices.appManager.editTextManager; import com.hiddenservices.onionservices.constants.*; @@ -242,6 +246,8 @@ public class homeViewController { mFindText.setLongClickable(false); mFindText.setOnLongClickListener(v -> false); + String mText = "Copyright © by Orion Technologies | Build "+BuildConfig.VERSION_NAME.substring(20); + mCopyright.setText(mText); } @@ -275,6 +281,7 @@ public class homeViewController { String mText = getLocaleStringResource(new Locale(sSettingLanguage), R.string.GENERAL_SEARCH_ENGINE, mContext); ((TextView)mSearchEngineBar.findViewById(R.id.pSearchEngineHintInvoke)).setText(mText); + int e=0; } } @@ -624,12 +631,34 @@ public class homeViewController { mOrbotLogManager.setEnabled(true); }, 700); - mConnectButton.animate().setDuration(350).alpha(0.4f).withEndAction(() -> { - mCopyright.setVisibility(View.GONE); - initSplashLoading(); - }); - mConnectNoTorButton.animate().setDuration(350).alpha(0f).withEndAction(() -> { - }); + if(status.sTorBrowsing){ + mConnectButton.animate().setDuration(350).alpha(0.4f).withEndAction(() -> { + mCopyright.setVisibility(View.GONE); + initSplashLoading(); + }); + + ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mConnectButton.getLayoutParams(); + final int bottomMarginStart = params.bottomMargin; + final int bottomMarginEnd = 0; + Animation a = new Animation() { + @Override + protected void applyTransformation(float interpolatedTime, Transformation t) { + ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mConnectButton.getLayoutParams(); + params.bottomMargin = bottomMarginStart + (int) ((bottomMarginEnd - bottomMarginStart) * interpolatedTime); + mConnectButton.setLayoutParams(params); + } + }; + a.setDuration(400); + mConnectButton.startAnimation(a); + mConnectNoTorButton.animate().setDuration(150).alpha(0f).withEndAction(() -> {}); + }else { + mConnectButton.animate().setDuration(350).alpha(0f).withEndAction(() -> { + mCopyright.setVisibility(View.GONE); + initSplashLoading(); + }); + mConnectNoTorButton.animate().setDuration(350).alpha(0.4f).withEndAction(() -> {}); + } + mGatewaySplash.animate().setDuration(350).alpha(0.4f); mPanicButtonLandscape.animate().setInterpolator(new AccelerateInterpolator()).setDuration(170).translationXBy(helperMethod.pxFromDp(55)); mPanicButton.animate().setDuration(170).setInterpolator(new AccelerateInterpolator()).translationXBy(helperMethod.pxFromDp(55)); @@ -846,9 +875,11 @@ public class homeViewController { @SuppressLint("InflateParams") View popupView = null; + boolean mIsBookmarked = false; void onOpenMenu(View view, boolean canGoForward, boolean isLoading, int userAgent, String mURL, boolean pIsBookmarked) { + mIsBookmarked = pIsBookmarked; if (popupWindow != null) { popupWindow.dismiss(); } @@ -964,14 +995,21 @@ public class homeViewController { if (popupView != null) { ImageButton mRefresh = popupView.findViewById(R.id.menu21); ImageButton close = popupView.findViewById(R.id.menu20); + ImageButton bookmark = popupView.findViewById(R.id.menu23); + close.setVisibility(View.GONE); mRefresh.setVisibility(View.VISIBLE); - mRefresh.animate().alpha(0.1f); + mRefresh.setAlpha(0.1f); close.animate().alpha(0); - new Handler().postDelayed(() -> - { - mRefresh.animate().setDuration(250).alpha(1f); - }, 300); + + if(!mIsBookmarked){ + bookmark.setImageDrawable(helperMethod.getDrawableXML(mContext, R.xml.ic_baseline_bookmark)); + bookmark.setColorFilter(ContextCompat.getColor(mContext, R.color.c_navigation_tint), android.graphics.PorterDuff.Mode.MULTIPLY); + bookmark.animate().alpha(1); + bookmark.setClickable(true); + } + + mRefresh.animate().setDuration(250).alpha(1f); } } @@ -1419,7 +1457,7 @@ public class homeViewController { return; } - if (mSearchbar.getText().toString().equals("orion.onion")) { + if (mSearchbar.getText().toString().equals("orion.onion") && !mForced) { return; } @@ -1460,7 +1498,9 @@ public class homeViewController { new Handler().postDelayed(() -> { - onResetTabAnimation(); + if(e_type!=null && e_type.equals(homeEnums.eGeckoCallback.M_CLOSE_TAB_BACK)){ + onResetTabAnimation(); + } }, pDelay); mGeckoView.setPivotX(0); @@ -1480,7 +1520,7 @@ public class homeViewController { final Handler handler = new Handler(); handler.postDelayed(() -> { mEvent.invokeObserver(data, e_type); - }, 450); + }, 300); scaleDown.addListener(new Animator.AnimatorListener() { @Override @@ -1500,18 +1540,14 @@ public class homeViewController { @Override public void onAnimationEnd(Animator animation) { - //scaleDown.removeAllListeners(); - //mEvent.invokeObserver(data, e_type); } @Override public void onAnimationCancel(Animator animation) { - Log.i("",""); } @Override public void onAnimationRepeat(Animator animation) { - Log.i("",""); } }); }else { @@ -1620,7 +1656,7 @@ public class homeViewController { mDefaultColor = mContext.getWindow().getNavigationBarColor(); mContext.getWindow().setNavigationBarColor(Color.BLACK); - mEvent.invokeObserver(Collections.singletonList(true), homeEnums.eHomeViewCallback.on_full_screen_ads); + mEvent.invokeObserver(Collections.singletonList(true), homeEnums.eHomeViewCallback.ON_FULL_SCREEN_ADS); new Handler().postDelayed(() -> { @@ -1718,7 +1754,7 @@ public class homeViewController { mProgressBar.setVisibility(View.VISIBLE); mTopBar.setVisibility(View.VISIBLE); mEvent.invokeObserver(Collections.singletonList(!isLandscape), homeEnums.eHomeViewCallback.ON_INIT_ADS); - mEvent.invokeObserver(Collections.singletonList(isLandscape), homeEnums.eHomeViewCallback.on_full_screen_ads); + mEvent.invokeObserver(Collections.singletonList(isLandscape), homeEnums.eHomeViewCallback.ON_FULL_SCREEN_ADS); status.sFullScreenBrowsing = (boolean) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING, false)); @@ -1814,9 +1850,9 @@ public class homeViewController { if (mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_HOME_PAGE) == null) { mEvent.invokeObserver(null, homeEnums.eHomeViewCallback.M_PRELOAD_URL); if (status.sSettingRedirectStatus.equals(strings.GENERIC_EMPTY_STR)) { - mEvent.invokeObserver(Collections.singletonList(helperMethod.getDomainName(status.sSettingDefaultSearchEngine)), homeEnums.eHomeViewCallback.on_url_load); + mEvent.invokeObserver(Collections.singletonList(helperMethod.getDomainName(status.sSettingDefaultSearchEngine)), homeEnums.eHomeViewCallback.ON_URL_LOAD); } else { - mEvent.invokeObserver(Collections.singletonList(helperMethod.getDomainName(status.sSettingRedirectStatus)), homeEnums.eHomeViewCallback.on_url_load); + mEvent.invokeObserver(Collections.singletonList(helperMethod.getDomainName(status.sSettingRedirectStatus)), homeEnums.eHomeViewCallback.ON_URL_LOAD); } } if (!status.sExternalWebsite.equals(strings.GENERIC_EMPTY_STR)) { diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/languageManager/languageController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/languageManager/languageController.java index 4b7399af..e469447f 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/languageManager/languageController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/languageManager/languageController.java @@ -138,7 +138,6 @@ public class languageController extends AppCompatActivity { String mSystemLangugage = mSystemLocale.toString(); status.sSettingLanguage = CONST_LANGUAGE_DEFAULT_LANG; status.sSettingLanguageRegion = CONST_LANGUAGE_DEFAULT_LANG; - Log.i("MFUCKER", mSystemLangugage); if (!mSystemLangugage.equals("en_GB") && !mSystemLangugage.equals("cs_CZ") && !mSystemLangugage.equals("en_US") && !mSystemLangugage.equals("ur_PK") && !mSystemLangugage.equals("de_DE") && !mSystemLangugage.equals("ca_ES") && !mSystemLangugage.equals("zh_CN") && !mSystemLangugage.equals("ch_CZ") && !mSystemLangugage.equals("nl_NL") && !mSystemLangugage.equals("fr_FR") && !mSystemLangugage.equals("el_GR") && !mSystemLangugage.equals("hu_HU") && !mSystemLangugage.equals("in_ID") && !mSystemLangugage.equals("it_IT") && !mSystemLangugage.equals("ja_JP") && !mSystemLangugage.equals("ko_KR") && !mSystemLangugage.equals("pt_PT") && !mSystemLangugage.equals("ro_RO") && !mSystemLangugage.equals("ru_RU") && !mSystemLangugage.equals("th_TH") && !mSystemLangugage.equals("tr_TR") && !mSystemLangugage.equals("uk_UA") && !mSystemLangugage.equals("vi_VN")) { mDefaultLanguageNotSupported = true; } diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/languageManager/languageModel.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/languageManager/languageModel.java index a35470da..4306f6f4 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/languageManager/languageModel.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/languageManager/languageModel.java @@ -30,7 +30,7 @@ class languageModel { mSupportedLanaguage.add(new languageDataModel("韓国語", "Korean", "ko", "Kr")); mSupportedLanaguage.add(new languageDataModel("Português", "Portuguese (Portugal)", "pt", "Pt")); mSupportedLanaguage.add(new languageDataModel("Română", "Romanian", "ro", "Ro")); - // mSupportedLanaguage.add(new languageDataModel("Urdu (اردو)", "Urdu", "ur", "Ur")); + //mSupportedLanaguage.add(new languageDataModel("Urdu (اردو)", "Urdu", "ur", "Ur")); mSupportedLanaguage.add(new languageDataModel("русский", "Russian", "ru", "Ru")); mSupportedLanaguage.add(new languageDataModel("ไทย", "Thai", "th", "Th")); mSupportedLanaguage.add(new languageDataModel("Türk", "Turkish", "tr", "Tr")); 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 b5cb16d8..fe6816f9 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 @@ -216,7 +216,7 @@ public class settingGeneralController extends AppCompatActivity { } public void onSelectTheme(View view) { - if(status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY){ + if(status.sLowMemory == enums.MemoryStatus.CRITICAL_MEMORY){ pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_LOW_MEMORY); return; } diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/notificationManager/settingNotificationController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/notificationManager/settingNotificationController.java index 7d0832de..5fd6e20a 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/notificationManager/settingNotificationController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/notificationManager/settingNotificationController.java @@ -91,12 +91,13 @@ public class settingNotificationController extends AppCompatActivity { activityContextManager.getInstance().setCurrentActivity(this); super.onResume(); - int notificationStatus = status.sBridgeNotificationManual; + int notificationStatus = status.sNotificaionStatus; if (notificationStatus == 0) { pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION); - activityContextManager.getInstance().getHomeController().onShowDefaultNotification(); + activityContextManager.getInstance().getHomeController().onHideDefaultNotification(); } else { pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_ENABLE_NOTIFICATION); + activityContextManager.getInstance().getHomeController().onShowDefaultNotification(); } } @@ -133,6 +134,6 @@ public class settingNotificationController extends AppCompatActivity { public void onSaveLocalNotificationSettings(View view) { mSettingNotificationModel.onTrigger(settingNotificationEnums.eNotificationModel.M_UPDATE_LOCAL_NOTIFICATION, Collections.singletonList(!mNotificationManual.isChecked())); mNotificationManual.toggle(); - dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS, status.sBridgeNotificationManual)); + dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS, status.sNotificaionStatus)); } } \ No newline at end of file diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/notificationManager/settingNotificationModel.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/notificationManager/settingNotificationModel.java index a5d4a9d1..350632d2 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/notificationManager/settingNotificationModel.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/notificationManager/settingNotificationModel.java @@ -25,15 +25,16 @@ class settingNotificationModel { private void updateLocalNotification(boolean pStatus) { int mStatus = pStatus ? 1 : 0; - status.sBridgeNotificationManual = mStatus; + status.sNotificaionStatus = mStatus; if (!pStatus) { - activityContextManager.getInstance().getHomeController().onShowDefaultNotification(); + activityContextManager.getInstance().getHomeController().onHideDefaultNotification(); pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_DISABLE_NOTIFICATION); } else { if(status.sTorBrowsing){ - activityContextManager.getInstance().getHomeController().onHideDefaultNotification(); + pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_ENABLE_NOTIFICATION); + }else { + activityContextManager.getInstance().getHomeController().onShowDefaultNotification(); } - pluginController.getInstance().onOrbotInvoke(null, pluginEnums.eOrbotManager.M_ENABLE_NOTIFICATION); } } diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/notificationManager/settingNotificationViewController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/notificationManager/settingNotificationViewController.java index 4ae90406..5a3902c6 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/notificationManager/settingNotificationViewController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/notificationManager/settingNotificationViewController.java @@ -34,7 +34,7 @@ class settingNotificationViewController { } private void initViews() { - if (status.sBridgeNotificationManual == 1) { + if (status.sNotificaionStatus == 1) { mNotificationManual.setChecked(true); } else { mNotificationManual.setChecked(false); 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 d240d7ab..57316f38 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/constants/status.java +++ b/app/src/main/java/com/hiddenservices/onionservices/constants/status.java @@ -75,12 +75,13 @@ public class status { public static boolean sVPNStatus = false; public static boolean sBridgeStatus = false; public static boolean sAppInstalled = false; + public static boolean sDefaultLanguageSet = false; public static int sTheme = enums.Theme.THEME_DEFAULT; public static int sSettingCookieStatus = ContentBlocking.AntiTracking.DEFAULT; public static int sShowImages = -1; public static int sWidgetResponse = enums.WidgetResponse.NONE; - public static int sBridgeNotificationManual = 0; + public static int sNotificaionStatus = 0; public static int sSettingTrackingProtection = 0; public static int sGlobalURLCount = 0; @@ -127,7 +128,7 @@ public class status { status.sBridgeCustomBridge = (String) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1, strings.BRIDGE_CUSTOM_BRIDGE_OBFS4)); status.sBridgeCustomType = (String) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE, strings.GENERIC_EMPTY_SPACE)); status.sBridgesDefault = (String) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.BRIDGE_DEFAULT, strings.BRIDGES_DEFAULT)); - status.sBridgeNotificationManual = (int) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS, 1)); + status.sNotificaionStatus = (int) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS, 1)); status.sRestoreTabs = (boolean) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB, false)); status.sCharacterEncoding = (boolean) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_CHARACTER_ENCODING, false)); status.sShowImages = (int) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES, 0)); diff --git a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/langPluginManager/langManager.java b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/langPluginManager/langManager.java index 55cab6d4..6f037cc5 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/langPluginManager/langManager.java +++ b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/langPluginManager/langManager.java @@ -67,7 +67,7 @@ public class langManager { } else if (mSystemLangugage.equals("vi_VN") || mSystemLangugage.equals("cs_CZ")) { mLanguage = new Locale("ch", "Cz"); } else { - mLanguage = new Locale(mSystemLocale.getLanguage(), mSystemLocale.getCountry()); + mLanguage = new Locale(mSystemLocale.getCountry(), mSystemLocale.getCountry()); } } else { mLanguage = new Locale("en", "Us"); diff --git a/app/src/main/res/layouts/home/layout/home_view.xml b/app/src/main/res/layouts/home/layout/home_view.xml index 3c9deef7..ad21dc25 100644 --- a/app/src/main/res/layouts/home/layout/home_view.xml +++ b/app/src/main/res/layouts/home/layout/home_view.xml @@ -319,7 +319,7 @@ android:id="@+id/pInfoPortrait" android:layout_width="match_parent" android:layout_height="match_parent" - android:visibility="visible" + android:visibility="gone" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent"> @@ -581,7 +581,7 @@ android:id="@+id/pInfoLandscape" android:layout_width="match_parent" android:layout_height="match_parent" - android:visibility="gone" + android:visibility="visible" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> @@ -592,6 +592,7 @@ android:layout_height="40dp" android:layout_marginTop="20dp" android:adjustViewBounds="true" + android:layoutDirection="ltr" android:alpha="0.95" android:background="@xml/hox_rounded_corner_splash_right" android:contentDescription="@string/GENERAL_TODO" @@ -608,6 +609,7 @@ android:layout_height="40dp" android:layout_marginTop="80dp" android:adjustViewBounds="true" + android:layoutDirection="ltr" android:alpha="0.95" android:background="@xml/hox_rounded_corner_splash_right" android:contentDescription="@string/GENERAL_TODO" @@ -624,6 +626,7 @@ android:layout_width="90dp" android:layout_height="90dp" android:layout_marginStart="7dp" + android:layoutDirection="ltr" android:layout_marginTop="15dp" android:contentDescription="@string/GENERAL_TODO" android:rotationY="@integer/angle_rtl_180" @@ -642,6 +645,7 @@ android:gravity="start" android:maxHeight="20dp" android:paddingStart="5dp" + android:layoutDirection="ltr" android:paddingEnd="15dp" android:text="@string/HOME_DESCRIPTION_TEXT_7" android:textAlignment="textStart" @@ -664,6 +668,7 @@ android:ellipsize="end" android:gravity="start" android:maxHeight="20dp" + android:layoutDirection="ltr" android:paddingStart="5dp" android:paddingEnd="15dp" android:text="@string/HOME_DESCRIPTION_TEXT_8" @@ -686,6 +691,7 @@ android:layout_marginTop="5dp" android:ellipsize="end" android:gravity="start" + android:layoutDirection="ltr" android:maxHeight="20dp" android:paddingStart="5dp" android:paddingEnd="15dp" @@ -703,28 +709,28 @@