From 5c9f119cc61e62937ba86bf08fceebe7621ceeaa Mon Sep 17 00:00:00 2001 From: Abdul Mannan Saeed <111820160@umt.edu.pk> Date: Sun, 19 Feb 2023 15:32:46 +0500 Subject: [PATCH] Bug Fixes Bug Fixes --- .../appManager/helpManager/helpController.java | 15 ++++++++++----- .../delegateModel/historyDelegate.java | 9 ++++----- .../delegateModel/progressDelegate.java | 1 + .../homeManager/geckoManager/geckoClients.java | 1 + .../homeController/homeViewController.java | 5 +++-- .../onionservices/helperManager/helperMethod.java | 2 +- 6 files changed, 20 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/helpManager/helpController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/helpManager/helpController.java index f731ebb3..15f67590 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/helpManager/helpController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/helpManager/helpController.java @@ -211,16 +211,21 @@ public class helpController extends AppCompatActivity { } public void onOpenHelpExternal(View view) { - if (!status.sSettingIsAppStarted) { - activityContextManager.getInstance().getHomeController().onStartApplication(null); - } if (status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(this)) { activityContextManager.getInstance().getHomeController().onDisableAdvert(); - activityContextManager.getInstance().getHomeController().onLoadURL(constants.CONST_GENESIS_HELP_URL_CACHE); + if(!status.sSettingIsAppStarted){ + activityContextManager.getInstance().getHomeController().onStartApplicationNoTorHelp(constants.CONST_GENESIS_HELP_URL_CACHE); + }else { + activityContextManager.getInstance().getHomeController().onLoadURL(constants.CONST_GENESIS_HELP_URL_CACHE); + } } else { activityContextManager.getInstance().getHomeController().onDisableAdvert(); - activityContextManager.getInstance().getHomeController().onLoadURL(constants.CONST_GENESIS_HELP_URL_CACHE_DARK); + if(!status.sSettingIsAppStarted){ + activityContextManager.getInstance().getHomeController().onStartApplicationNoTorHelp(constants.CONST_GENESIS_HELP_URL_CACHE_DARK); + }else { + activityContextManager.getInstance().getHomeController().onLoadURL(constants.CONST_GENESIS_HELP_URL_CACHE_DARK); + } } finish(); activityContextManager.getInstance().onGoHome(); 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 1be19a2f..c62ead23 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,11 +36,8 @@ 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){ + if(mHistory !=null && mHistory.size()!=var2.size()){ + mHistory = var2; setURL(mHistory.get(mHistory.getCurrentIndex()).getUri()); mEvent.invokeObserver(Arrays.asList(mHistory, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.ON_URL_LOAD); if(mCurrentIndex != var2.getCurrentIndex()){ @@ -50,6 +47,8 @@ public class historyDelegate implements GeckoSession.HistoryDelegate { if (mID != null) { mGeckoDataModel.mCurrentURL_ID = (int) mID; } + }else { + mHistory = var2; } mCurrentIndex = var2.getCurrentIndex(); } 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 c931488f..ab1cbcf4 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 @@ -68,6 +68,7 @@ public class progressDelegate implements GeckoSession.ProgressDelegate { @Override public void onPageStart(@NonNull GeckoSession var1, @NonNull String var2) { + mGeckoDataModel.mTheme = null; 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) { 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 1481ee46..11931e6c 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 @@ -227,6 +227,7 @@ public class geckoClients { mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus); mSession.loadUri(url); } + mSession.initURL(url); } public void initHomeTheme() { 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 a3559923..936c9943 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 @@ -1122,7 +1122,6 @@ public class homeViewController { void onUpdateSearchBar(String url, boolean showProtocol, boolean pClearText, boolean pBypassFocus) { - if (url.endsWith("genesisconfigurenewidentity.com/")) { return; } @@ -1355,8 +1354,10 @@ public class homeViewController { url = url.replace("https://", ""); url = url.replace("http://", ""); } - + resource://android/assets/help/help.html url = url.replace("167.86.99.31", "orion.onion"); + url = url.replace("resource://android/assets/help/help.html", "orion.help"); + url = url.replace("resource://android/assets/help/help-dark.html", "orion.help"); boolean isTextSelected = false; if (mSearchbar.isSelected()) { 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 a9f9cc23..8b3dc4eb 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/helperManager/helperMethod.java +++ b/app/src/main/java/com/hiddenservices/onionservices/helperManager/helperMethod.java @@ -896,7 +896,7 @@ public class helperMethod { int millis = now.get(Calendar.MILLISECOND); System.out.printf("%d-%02d-%02d %02d:%02d:%02d.%03d", year, month, day, hour, minute, second, millis); - return month + "/" + year + " | " + hour + ":" + minute + ":" + second; + return day + "/" + month + "/" + year + " | " + hour + ":" + minute + ":" + second; } public static PopupWindow onCreateMenu(View p_view, int p_layout, String pSettingLanguageRegion) {