diff --git a/.safedk/hashes.safedk b/.safedk/hashes.safedk index 93704cc4..b5af034b 100644 --- a/.safedk/hashes.safedk +++ b/.safedk/hashes.safedk @@ -1,3 +1,3 @@ -#Sat Jan 28 15:55:26 PKT 2023 +#Sat Feb 04 14:33:30 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=-1628746731 +json=2027486056 diff --git a/.safedk/plugin.properties b/.safedk/plugin.properties index d9aefdaf..e48dbea2 100644 --- a/.safedk/plugin.properties +++ b/.safedk/plugin.properties @@ -1,5 +1,5 @@ # -#Sat Jan 28 16:12:03 PKT 2023 +#Sat Feb 04 14:33:30 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.3 set_multidex=true diff --git a/OrbotLib/build/.transforms/1db88afc1664186024331f5c1b7f6d1e/results.bin b/OrbotLib/build/.transforms/1db88afc1664186024331f5c1b7f6d1e/results.bin new file mode 100644 index 00000000..2de4c85c --- /dev/null +++ b/OrbotLib/build/.transforms/1db88afc1664186024331f5c1b7f6d1e/results.bin @@ -0,0 +1 @@ +o/jetified-OrbotLib-runtime diff --git a/OrbotLib/build/.transforms/1db88afc1664186024331f5c1b7f6d1e/transformed/jetified-OrbotLib-runtime/classes.dex b/OrbotLib/build/.transforms/1db88afc1664186024331f5c1b7f6d1e/transformed/jetified-OrbotLib-runtime/classes.dex new file mode 100644 index 00000000..74cc7b41 Binary files /dev/null and b/OrbotLib/build/.transforms/1db88afc1664186024331f5c1b7f6d1e/transformed/jetified-OrbotLib-runtime/classes.dex differ diff --git a/app/build.gradle b/app/build.gradle index 7deb2434..2ca55109 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -87,7 +87,7 @@ dependencies { /* Android Support Repository Dependencies */ - implementation 'com.google.android.material:material:1.7.0' + implementation 'com.google.android.material:material:1.8.0' implementation 'org.apache.commons:commons-text:1.3' /* Firefox ABI Splits */ @@ -104,7 +104,7 @@ dependencies { /* Ads Manager */ - implementation 'com.applovin:applovin-sdk:11.5.5' + implementation 'com.applovin:applovin-sdk:11.7.0' implementation 'com.facebook.android:audience-network-sdk:6.10.0' implementation 'com.applovin.mediation:facebook-adapter:6.12.0.1' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a749e427..b3ac0bfd 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -150,7 +150,7 @@ android:exported="true" android:launchMode="singleTask" android:screenOrientation="fullSensor" - android:windowSoftInputMode="adjustPan"> + android:windowSoftInputMode="adjustNothing"> 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 34d45901..c00cc1a7 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 @@ -523,9 +523,7 @@ public class geckoClients { public void onRedrawPixel(AppCompatActivity pcontext) { if(status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY){ mSession.onRedrawPixel(); - Log.i("FUCKSSS1111","333"); onLoadFavIcon(pcontext); - Log.i("FUCKSSS1111","444"); } } @@ -535,12 +533,14 @@ public class geckoClients { public void onClearAll() { if (mRuntime != null) { - mRuntime.getStorageController().clearData(NETWORK_CACHE); - mRuntime.getStorageController().clearData(IMAGE_CACHE); - mRuntime.getStorageController().clearData(DOM_STORAGES); - mRuntime.getStorageController().clearData(COOKIES); - mRuntime.getStorageController().clearData(SITE_SETTINGS); - mRuntime.getStorageController().clearData(SITE_DATA); + if(status.sClearOnExit){ + mRuntime.getStorageController().clearData(NETWORK_CACHE); + mRuntime.getStorageController().clearData(IMAGE_CACHE); + mRuntime.getStorageController().clearData(DOM_STORAGES); + mRuntime.getStorageController().clearData(COOKIES); + mRuntime.getStorageController().clearData(SITE_SETTINGS); + mRuntime.getStorageController().clearData(SITE_DATA); + } } } @@ -697,7 +697,7 @@ public class geckoClients { public void onUpdateFont() { float font = (status.sSettingFontSize - 100) / 3 + 100; - mRuntime.getSettings().setFontSizeFactor(font / 100); + mRuntime.getSettings().setFontSizeFactor(font / 117); } public void reinitHomeTheme() { diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoPromptView.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoPromptView.java index 1b210ca2..d743724a 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoPromptView.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoPromptView.java @@ -210,7 +210,7 @@ final class geckoPromptView implements GeckoSession.PromptDelegate { builder.setNegativeButton("Cancel", listener); try { - if(!((Activity) builder.getContext()).isFinishing()) + if(mActivity!=null && !mActivity.isFinishing()) { createStandardDialog(builder, prompt, res).show(); } @@ -596,7 +596,7 @@ final class geckoPromptView implements GeckoSession.PromptDelegate { throw new UnsupportedOperationException(); } try { - if(!((Activity) builder.getContext()).isFinishing()) + if(mActivity!=null && !mActivity.isFinishing()) { dialog.show(); } 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 02737555..3bada960 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 @@ -21,15 +21,12 @@ import android.os.Handler; import android.util.Base64; import android.util.Log; import android.view.autofill.AutofillManager; -import android.view.autofill.AutofillValue; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.UiThread; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.NotificationCompat; import androidx.core.content.FileProvider; - import com.hiddenservices.onionservices.constants.constants; import com.hiddenservices.onionservices.constants.enums; import com.hiddenservices.onionservices.constants.status; @@ -41,37 +38,30 @@ import com.hiddenservices.onionservices.libs.trueTime.trueTimeEncryption; import com.hiddenservices.onionservices.pluginManager.pluginController; import com.hiddenservices.onionservices.pluginManager.pluginEnums; import com.example.myapplication.R; - import org.json.JSONException; import org.json.JSONObject; import org.mozilla.gecko.EventDispatcher; import org.mozilla.gecko.util.GeckoBundle; -import org.mozilla.gecko.util.ThreadUtils; import org.mozilla.geckoview.AllowOrDeny; import org.mozilla.geckoview.Autofill; import org.mozilla.geckoview.GeckoResult; import org.mozilla.geckoview.GeckoSession; import org.mozilla.geckoview.GeckoView; -import org.mozilla.geckoview.Image; import org.mozilla.geckoview.MediaSession; import org.mozilla.geckoview.SlowScriptResponse; import org.mozilla.geckoview.WebExtension; import org.mozilla.geckoview.WebRequestError; import org.mozilla.geckoview.WebResponse; import org.torproject.android.service.wrapper.orbotLocalConstants; - import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.lang.ref.WeakReference; -import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Collections; -import java.util.Date; import java.util.List; import java.util.Objects; - import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_BADCERT_CACHED; import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_BADCERT_CACHED_DARK; import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_ERROR_CACHED; @@ -84,12 +74,10 @@ import static com.hiddenservices.onionservices.constants.enums.etype.M_DEFAULT_B import static com.hiddenservices.onionservices.constants.enums.etype.M_RATE_COUNT; import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_URL; import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_WITH_LINK; -import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION; import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP; import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE; -public class -geckoSession extends GeckoSession implements MediaSession.Delegate, GeckoSession.MediaDelegate, GeckoSession.ScrollDelegate, GeckoSession.PermissionDelegate, GeckoSession.ProgressDelegate, GeckoSession.HistoryDelegate, GeckoSession.NavigationDelegate, GeckoSession.ContentDelegate { +public class geckoSession extends GeckoSession implements MediaSession.Delegate, GeckoSession.MediaDelegate, GeckoSession.ScrollDelegate, GeckoSession.PermissionDelegate, GeckoSession.ProgressDelegate, GeckoSession.HistoryDelegate, GeckoSession.NavigationDelegate, GeckoSession.ContentDelegate { private eventObserver.eventListener event; private boolean wasBackPressed = false; @@ -118,7 +106,6 @@ geckoSession extends GeckoSession implements MediaSession.Delegate, GeckoSession /*Temp Variables*/ private GeckoSession.HistoryDelegate.HistoryList mHistoryList = null; - private int rateCount = 0; private int m_current_url_id = -1; private GeckoView mGeckoView; private boolean mIsLoaded = false; @@ -177,6 +164,7 @@ geckoSession extends GeckoSession implements MediaSession.Delegate, GeckoSession @Override public void onMetadata(@NonNull GeckoSession session, @NonNull MediaSession mediaSession, @NonNull MediaSession.Metadata meta) { mMediaTitle = meta.title; + isPageLoading = false; if(mediaDelegateItem == null){ return; @@ -454,6 +442,28 @@ geckoSession extends GeckoSession implements MediaSession.Delegate, GeckoSession this.securityInfo = securityInfo; } + + + + + + + + + + + + + + + + + + + + + + @Override public void onPageStart(@NonNull GeckoSession var1, @NonNull String var2) { mCloseRequested = false; @@ -469,7 +479,7 @@ geckoSession extends GeckoSession implements MediaSession.Delegate, GeckoSession } if (!mCurrentURL.equals("about:config") && !mCurrentURL.equals("about:blank")) { - event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR); + //event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR); mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(5, mSessionID), enums.etype.progress_update)); } if (!isPageLoading) { @@ -594,33 +604,43 @@ geckoSession extends GeckoSession implements MediaSession.Delegate, GeckoSession /*History Delegate*/ @Override public GeckoResult onVisited(@NonNull GeckoSession var1, @NonNull String var2, @Nullable String var3, int var4) { - if (var4 == 3 || var4 == 5 || var4 == 1) { - if(var4==1){ - m_current_url_id = -1; - setURL(var2); - } - event.invokeObserver(Arrays.asList(var2, mSessionID), enums.etype.on_url_load); - Object mID = event.invokeObserver(Arrays.asList(var2, mSessionID, mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.on_update_history); - if (mID != null) { - m_current_url_id = (int) mID; - } - isPageLoading = false; - } + return null; } + int mHistoryListSize = 0; @UiThread public void onHistoryStateChange(@NonNull GeckoSession var1, @NonNull GeckoSession.HistoryDelegate.HistoryList var2) { mHistoryList = var2; + + + if(mHistoryList!=null){ + setURL(mHistoryList.get(mHistoryList.getCurrentIndex()).getUri()); + event.invokeObserver(Arrays.asList(mHistoryList, mSessionID), enums.etype.on_url_load); + if(mHistoryListSize == var2.size()){ + event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mHistoryList.get(mHistoryList.getCurrentIndex()).getTitle(), m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR); + Object mID = event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mHistoryList.get(mHistoryList.getCurrentIndex()).getTitle(), m_current_url_id, mTheme, this, wasBackPressed), enums.etype.on_update_history); + if (mID != null) { + m_current_url_id = (int) mID; + } + }else { + event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mHistoryList.get(mHistoryList.getCurrentIndex()).getTitle(), m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR); + Object mID = event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mHistoryList.get(mHistoryList.getCurrentIndex()).getTitle(), -1, mTheme, this, wasBackPressed), enums.etype.on_update_history); + if (mID != null) { + m_current_url_id = (int) mID; + } + } + mHistoryListSize = var2.size(); + onDestroyMedia(); + } } @UiThread public void onSessionStateChange(@NonNull GeckoSession session, @NonNull SessionState sessionState) { - try { - event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mCurrentTitle, m_current_url_id, mTheme, sessionState.toString()), enums.etype.M_UPDATE_SESSION_STATE); - mSessionState = sessionState; - } catch (Exception ignored) { - } + mSessionState = sessionState; + event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mCurrentTitle, m_current_url_id, mTheme, sessionState.toString()), enums.etype.M_UPDATE_SESSION_STATE); + + } public boolean onRestoreState() { @@ -658,14 +678,15 @@ geckoSession extends GeckoSession implements MediaSession.Delegate, GeckoSession } } } + wasBackPressed = false; String newUrl = Objects.requireNonNull(var2).split("#")[0]; if (!mCurrentTitle.equals("loading")) { - Object mURL = event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.on_update_history); - if (mURL != null) { - m_current_url_id = (int) mURL; - } + //Object mURL = event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mCurrentTitle, m_current_url_id, mTheme, this, false), enums.etype.on_update_history); + //if (mURL != null) { + // m_current_url_id = (int) mURL; + //} } if (newUrl.startsWith(CONST_GENESIS_URL_CACHED) || newUrl.startsWith(CONST_GENESIS_URL_CACHED_DARK)) { setURL(constants.CONST_GENESIS_DOMAIN_URL); @@ -679,7 +700,7 @@ geckoSession extends GeckoSession implements MediaSession.Delegate, GeckoSession setURL(newUrl); } if (!mCurrentURL.equals("about:blank")) { - event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR); + //event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR); } } @@ -798,7 +819,7 @@ geckoSession extends GeckoSession implements MediaSession.Delegate, GeckoSession /* Its Absence causes delay on first launch*/ - event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR); + //event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR); if (!m_url.equals("about:config") && !mCurrentURL.contains("167.86.99.31")) { mProgress = 5; @@ -887,7 +908,7 @@ geckoSession extends GeckoSession implements MediaSession.Delegate, GeckoSession } else { event.invokeObserver(Arrays.asList(var2, mSessionID), enums.etype.M_ORBOT_LOADING); mCurrentURL = mPrevURL; - event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR); + //event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR); } return null; } catch (Exception ex) { @@ -915,6 +936,8 @@ geckoSession extends GeckoSession implements MediaSession.Delegate, GeckoSession public void onFirstContentfulPaint(@NonNull GeckoSession var1) { isFirstPaintExecuted = true; + + if (mPreviousErrorPage || mCurrentURL.contains("167.86.99.31") || mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED) || mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED_DARK) || mCurrentURL.startsWith(CONST_GENESIS_HELP_URL_CACHE) || mCurrentURL.startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)) { event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mCurrentTitle, false), enums.etype.M_ON_BANNER_UPDATE); } else { @@ -967,12 +990,6 @@ geckoSession extends GeckoSession implements MediaSession.Delegate, GeckoSession public void onTitleChange(@NonNull GeckoSession var1, @Nullable String var2) { if (var2 != null && !var2.equals(strings.GENERIC_EMPTY_STR) && var2.length() > 2 && !var2.equals("about:blank") && mIsLoaded) { mCurrentTitle = var2; - Object mID = event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.on_update_history); - if (mID != null) { - m_current_url_id = (int) mID; - } - - event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mCurrentTitle, mTheme), enums.etype.ON_UPDATE_TAB_TITLE); } } @@ -1250,6 +1267,11 @@ geckoSession extends GeckoSession implements MediaSession.Delegate, GeckoSession pURL = pURL.replace("www.", ""); } mCurrentURL = pURL; + if(pURL.startsWith("tel:")){ + Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(pURL)); + mContext.get().startActivity(intent); + } + //event.invokeObserver(Arrays.asList(mCurrentURL, mSessionID, mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR); } public void setRemovableFromBackPressed(boolean pStatus) { @@ -1363,6 +1385,8 @@ geckoSession extends GeckoSession implements MediaSession.Delegate, GeckoSession } wasBackPressed = true; m_current_url_id = -1; + + mCurrentTitle = mHistoryList.get(mHistoryList.getCurrentIndex()).getTitle(); goBack(); try { 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 f6c7c657..19110ee6 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 @@ -32,7 +32,6 @@ import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.preference.PreferenceManager; -import android.provider.Settings; import android.speech.RecognizerIntent; import android.text.Editable; import android.text.TextWatcher; @@ -50,7 +49,6 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.coordinatorlayout.widget.CoordinatorLayout; -import androidx.core.app.ActivityCompat; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; import androidx.core.content.ContextCompat; @@ -60,7 +58,7 @@ import androidx.lifecycle.Lifecycle; import androidx.lifecycle.OnLifecycleEvent; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import com.applovin.mediation.ads.MaxAdView; + import com.hiddenservices.onionservices.appManager.activityContextManager; import com.hiddenservices.onionservices.appManager.advertManager.advertController; import com.hiddenservices.onionservices.appManager.bookmarkManager.bookmarkSettings.bookmarkSettingController; @@ -99,6 +97,7 @@ import org.mozilla.geckoview.GeckoResult; import org.mozilla.geckoview.GeckoSession; import org.torproject.android.service.OrbotService; import org.torproject.android.service.wrapper.orbotLocalConstants; + import java.lang.ref.WeakReference; import java.lang.reflect.Method; import java.util.ArrayList; @@ -108,6 +107,7 @@ import java.util.List; import java.util.Locale; import java.util.Objects; import java.util.concurrent.Callable; + import mozilla.components.support.utils.DownloadUtils; import xcrash.ICrashCallback; import xcrash.XCrash; @@ -668,7 +668,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba Context mContext = activityThemeManager.getInstance().initTheme(base); activityContextManager.getInstance().setApplicationContext(mContext); try { - onCrashInit(mContext); + //onCrashInit(mContext); }catch (Exception ex){} super.attachBaseContext(mContext); } @@ -771,6 +771,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba mGeckoView.getSession().stop(); } mGeckoClient.loadURL(url.replace("orion.onion", "167.86.99.31"), mGeckoView, homeController.this); + + if(!mHomeViewController.isOrientationLandscapce()){ + pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER); + } } public String getSecurityInfo() { @@ -954,7 +958,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba if (SDK_INT >= Build.VERSION_CODES.O) { String channelId = "default_home_notification"; - NotificationChannel channel = new NotificationChannel(channelId, "default_home_notification", NotificationManager.IMPORTANCE_DEFAULT); + NotificationChannel channel = new NotificationChannel(channelId, "default_home_notification", NotificationManager.IMPORTANCE_LOW); channel.setSound(null, null); manager.createNotificationChannel(channel); builder.setChannelId(channelId); @@ -1014,14 +1018,16 @@ public class homeController extends AppCompatActivity implements ComponentCallba public void onMemoryCalculate() { if(!status.mThemeApplying){ + ActivityManager actManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo(); actManager.getMemoryInfo(memInfo); long totalMemory = memInfo.totalMem/(1024 * 1024); - if(totalMemory<2000){ + if(totalMemory<1070){ dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLOSE_TAB_LOW_MEMORY, null); Log.i("wow : ", "trim memory requested: memory on device is running low"); onLowMemoryInvoked(enums.MemoryStatus.LOW_MEMORY); + pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_LOW_MEMORY_DESTROY); } } } @@ -1100,7 +1106,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba mGeckoClient.getSession().onDestroyMedia(); onHideDefaultNotification(); } - pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_DESTROY); if (!status.sSettingIsAppStarted) { mGeckoClient.onClearAll(); } @@ -1149,6 +1154,16 @@ public class homeController extends AppCompatActivity implements ComponentCallba return false; } + public void onSupport(View view) { + pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_INTERSTITIAL); + } + + public void onSupportSplash(View view) { + if(!status.sSettingIsAppStarted){ + pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_INTERSTITIAL); + } + } + @RequiresApi(api = Build.VERSION_CODES.M) @SuppressLint("ClickableViewAccessibility") private void initializeLocalEventHandlers() { @@ -1720,7 +1735,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba ((hintAdapter) Objects.requireNonNull(mHintListView.getAdapter())).onClearAdapter(); } else if (!mGeckoClient.getFullScreenStatus()) { mGeckoClient.onExitFullScreen(); - pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW); + pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER); mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); mHomeViewController.updateBannerAdvertStatus(false, (boolean) pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); } else if (mSearchbar.isFocused() || isKeyboardOpened) { @@ -1768,15 +1783,15 @@ public class homeController extends AppCompatActivity implements ComponentCallba final Handler handler = new Handler(); handler.postDelayed(() -> mGeckoClient.onRedrawPixel(homeController.this), 300); if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { - pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_HIDE); + pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_HIDE_BANNER); mHomeViewController.setOrientation(true); mHomeViewController.removeBanner(); } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { if(mGeckoClient.getFullScreenStatus()){ - pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW); + pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER); }else { - pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_HIDE); + pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_HIDE_BANNER); } mHomeViewController.setOrientation(false); @@ -1822,7 +1837,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba if(!mGeckoClient.getFullScreenStatus()){ mGeckoClient.onExitFullScreen(); } - pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW); + pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER); mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); pluginController.getInstance().onNotificationInvoke(Collections.singletonList(172800000), pluginEnums.eNotificationManager.M_CREATE_NOTIFICATION); @@ -1862,7 +1877,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba isFocusChanging = false; isSuggestionSearchOpened = false; mSearchbar.requestFocus(); - mSearchbar.setText(helperMethod.urlDesigner(mSearchBarPreviousText, this, mSearchbar.getCurrentTextColor(), status.sTheme, status.sTorBrowsing)); + mSearchbar.setText(helperMethod.urlDesigner(false, mSearchBarPreviousText, this, mSearchbar.getCurrentTextColor(), status.sTheme, status.sTorBrowsing)); mSearchbar.selectAll(); mHomeViewController.initSearchBarFocus(true, isKeyboardOpened); } @@ -1931,7 +1946,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba isFocusChanging = false; isSuggestionSearchOpened = false; mSearchbar.requestFocus(); - mSearchbar.setText(helperMethod.urlDesigner(mSearchBarPreviousText, this, mSearchbar.getCurrentTextColor(), status.sTheme, status.sTorBrowsing)); + mSearchbar.setText(helperMethod.urlDesigner(false, mSearchBarPreviousText, this, mSearchbar.getCurrentTextColor(), status.sTheme, status.sTorBrowsing)); mSearchbar.selectAll(); mHomeViewController.initSearchBarFocus(true, isKeyboardOpened); } @@ -2693,9 +2708,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.onSetBannerAdMargin((boolean) data.get(0), (boolean) pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED)); } else if (e_type.equals(enums.etype.on_full_screen_ads)) { if((boolean)data.get(0)){ - pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_HIDE); + pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_HIDE_BANNER); }else { - pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW); + pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER); } } else if (e_type.equals(enums.etype.M_ON_BANNER_UPDATE)) { Object mStatus = pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED); @@ -2978,7 +2993,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_BOOTSTRAPPED, true)); mHomeViewController.onPageFinished(); mGeckoClient.onRedrawPixel(homeController.this); - pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS); } else if (e_type.equals(M_RATE_APPLICATION)) { if (!status.sSettingIsAppRated) { runOnUiThread(() -> { @@ -3007,7 +3021,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba } mHomeViewController.onFullScreenUpdate(status); mHomeViewController.onUpdateSearchEngineBar(false, 0); - pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_HIDE); + pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_HIDE_BANNER); } else if (e_type.equals(enums.etype.on_update_favicon)) { //dataController.getInstance().invokeImage(dataEnums.eImageCommands.M_REQUEST_IMAGE_URL, Collections.singletonList(data.get(0))); } else if (e_type.equals(M_LONG_PRESS_WITH_LINK)) { 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 88e3b36c..e5a82b50 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 @@ -253,6 +253,10 @@ class homeViewController { } + public boolean isOrientationLandscapce(){ + return isLandscape; + } + public void initSearchEngineView() { if (!isFullScreen) { ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) mSearchEngineBar.getLayoutParams(); @@ -1317,9 +1321,9 @@ class homeViewController { if (url.length() <= 300) { url = removeEndingSlash(url); if(status.sTorBrowsing){ - mSearchbar.setText(helperMethod.urlDesigner(url, mContext, mSearchbar.getCurrentTextColor(), status.sTheme, true)); + mSearchbar.setText(helperMethod.urlDesigner(showProtocol, url, mContext, mSearchbar.getCurrentTextColor(), status.sTheme, true)); }else { - mSearchbar.setText(helperMethod.urlDesigner(url, mContext, mSearchbar.getCurrentTextColor(), status.sTheme, !ssl_status || url.contains("orion.onion"))); + mSearchbar.setText(helperMethod.urlDesigner(showProtocol, url, mContext, mSearchbar.getCurrentTextColor(), status.sTheme, !ssl_status || url.contains("orion.onion"))); } mSearchbar.selectAll(); @@ -1377,9 +1381,31 @@ class homeViewController { void onProgressBarUpdate(int value, boolean mForced) { + if (value == 105) { + progressAnimator.cancel(); + mProgressBar.setAlpha(1); + mProgressBar.animate().cancel(); + mProgressBar.animate().alpha(0); + value = 100; + mProgressBar.animate().alpha(0).withEndAction(() -> mProgressBar.setProgress(0)); + return; + } + if (value == 100) { changeRefreshMenu(); + new Handler().postDelayed(() -> + { + if(mProgressBar.getProgress()==100){ + progressAnimator.cancel(); + mProgressBar.setAlpha(1); + mProgressBar.animate().cancel(); + mProgressBar.animate().alpha(0).withEndAction(() -> mProgressBar.setProgress(0)); + } + onResetTabAnimation(); + }, 2000); + } + mProgressBar = activityContextManager.getInstance().getHomeController().mProgressBar; if (value != 0 && value != 100) { mAppBar.setExpanded(true, true); 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 006d0a42..72080585 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 @@ -109,6 +109,9 @@ public class settingSearchController extends AppCompatActivity { @Override public void onPause() { + if(!status.sTorBrowsing && status.sSettingDefaultSearchEngine.equals(constants.CONST_BACKEND_GENESIS_URL)){ + status.sSettingDefaultSearchEngine = constants.CONST_BACKEND_DUCK_DUCK_GO_URL; + } super.onPause(); } diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/settingHomeManager/settingHomeController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/settingHomeManager/settingHomeController.java index 0c99438e..55531bf0 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/settingHomeManager/settingHomeController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/settingHomeManager/settingHomeController.java @@ -120,6 +120,10 @@ public class settingHomeController extends AppCompatActivity { pluginController.getInstance().onMessageManagerInvoke(Collections.singletonList(this), M_OPEN_CICADA); } + public void onSupport(View view) { + pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_INTERSTITIAL); + } + /*View Callbacks*/ private class settingViewCallback implements eventObserver.eventListener { diff --git a/app/src/main/java/com/hiddenservices/onionservices/dataManager/historyDataModel.java b/app/src/main/java/com/hiddenservices/onionservices/dataManager/historyDataModel.java index 75147e6d..005ce9d2 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/dataManager/historyDataModel.java +++ b/app/src/main/java/com/hiddenservices/onionservices/dataManager/historyDataModel.java @@ -90,7 +90,7 @@ public class historyDataModel { } } - private int addHistory(String pUrl, String pHeader, int pID) { + private int addHistory(String pUrl, String pHeader, int pID, boolean pWasBackPressed) { if (pUrl.startsWith(constants.CONST_GENESIS_URL_CACHED) || pUrl.startsWith(constants.CONST_GENESIS_URL_CACHED_DARK)) { pUrl = "https://orion.onion"; @@ -103,6 +103,15 @@ public class historyDataModel { pUrl = helperMethod.removeLastSlash(pUrl); pUrl = helperMethod.urlWithoutPrefix(pUrl); + if(pWasBackPressed){ + for(int e=0;e mBannerAds; + private applovinSupportManager mSupportManager; + private applovinBannerManager mBannerManager; - private int mRequestCount = 0; - private boolean bannerAdRequested = false; - private boolean bannerAdsLoaded = true; - private boolean bannerAdsLoadedRepeat = false; - private boolean lowmemory = false; - private AppCompatActivity mContext = null; - private MaxAdView adView; + private boolean mLowMemoryReached = false; /*Initializations*/ public appLovinManager(eventObserver.eventListener pEvent, View pBannerAds, AppCompatActivity pContext) { this.mEvent = pEvent; - //this.mBannerAds = new WeakReference(pBannerAds); - mContext = pContext; - - try { - if(!lowmemory){ - initializeBannerAds(pContext); - } - }catch (OutOfMemoryError | Exception ex){ - Log.i("",""); - } - - mContext = pContext; - } - public void onInitAdvert(){ - + onInitializeAdvertisement(pContext); } - private void initializeBannerAds(AppCompatActivity pContext) { + private void onInitializeAdvertisement(AppCompatActivity pContext) { AppLovinSdk.getInstance(pContext).getSettings().setVerboseLogging(true); AppLovinSdk.getInstance(pContext).setMediationProvider("max"); AppLovinSdk.initializeSdk(pContext, configuration -> { - bannerAdRequested = true; - showAd(); + if(!mLowMemoryReached){ + this.mSupportManager = new applovinSupportManager(pContext); + this.mBannerManager = new applovinBannerManager(pContext, mEvent); + } }); } /*Local Helper Methods*/ - private void loadAds() { - //onAdvertStatus(true); + private void onShowInterstitial() { + this.mSupportManager.onShow(); } - private void showAd(){ - if(!lowmemory){ - try { - adView = new MaxAdView( "642ec6302c7cecd2",mContext); - onAdvertStatus(false); - adView.setListener(this); - int width = ViewGroup.LayoutParams.MATCH_PARENT; - int heightPx = helperMethod.pxFromDp(50); - adView.setLayoutParams( new FrameLayout.LayoutParams( width, heightPx ) ); - adView.setVisibility(View.GONE); - adView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); - adView.animate().alpha(1).setDuration(400); - adView.setBackgroundColor(mContext.getResources().getColor(R.color.c_background)); - adView.setExtraParameter( "disable_precache", "true" ); - ViewGroup rootView = mContext.findViewById(android.R.id.content); - rootView.addView( adView ); - adView.loadAd(); - }catch (Exception ex){} - } + private void onToggleBannerShow(boolean pStatus) { + this.mBannerManager.onShow(pStatus); } - private boolean isAdvertLoaded() { - return true; - } + /*Helper Methods*/ - private void onLowMemoryDestroy() { - lowmemory = true; - if(adView!=null){ - adView.destroy(); - adView = null; - } - } - - private void onAdvertStatus(boolean pStatus) { - if(adView!=null && bannerAdRequested){ - if(pStatus){ - new Handler().postDelayed(() -> - { - adView.setVisibility(View.VISIBLE); - }, 4000); - }else { - adView.setVisibility(View.GONE); - } - } - } - - /* Overriden Methods */ - - @Override - public void onAdExpanded(MaxAd ad) { - } - - @Override - public void onAdCollapsed(MaxAd ad) { - } - - @Override - public void onAdLoaded(MaxAd ad) { - bannerAdsLoaded = true; - bannerAdsLoadedRepeat = true; - mEvent.invokeObserver(null, M_ON_AD_LOAD); - orbotLocalConstants.sAdLoaded = true; - } - - @Override - public void onAdDisplayed(MaxAd ad) { - status.sAdLoaded = true; - bannerAdsLoadedRepeat = true; - orbotLocalConstants.sAdLoaded = true; - } - - @Override - public void onAdHidden(MaxAd ad) { - orbotLocalConstants.sAdLoaded = true; - } - - @Override - public void onAdClicked(MaxAd ad) { - status.sIsBackgroundAdvertCheck = true; - new Handler().postDelayed(() -> - { - status.sIsBackgroundAdvertCheck = false; - }, 5000); - } - - @Override - public void onAdLoadFailed(String adUnitId, MaxError error) { - status.sAdLoaded = true; - orbotLocalConstants.sAdLoaded = true; - if(!bannerAdsLoadedRepeat){ - showAd(); - } - } - - @Override - public void onAdDisplayFailed(MaxAd ad, MaxError error) { - status.sAdLoaded = true; - orbotLocalConstants.sAdLoaded = true; + private void onDestroy() { + mLowMemoryReached = true; + mBannerManager.onDestroy(); } /*External Triggers*/ public Object onTrigger(pluginEnums.eAdManager pEventType) { if (pEventType.equals(pluginEnums.eAdManager.M_LOW_MEMORY_DESTROY)) { - onLowMemoryDestroy(); + onDestroy(); } else if (pEventType.equals(pluginEnums.eAdManager.M_IS_ADVERT_LOADED)) { - return isAdvertLoaded(); - } else if (pEventType.equals(pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS)) { - loadAds(); - } else if (pEventType.equals(pluginEnums.eAdManager.M_SHOW)) { - onAdvertStatus(true); - } else if (pEventType.equals(pluginEnums.eAdManager.M_HIDE)) { - onAdvertStatus(false); + return true; + } else if (pEventType.equals(pluginEnums.eAdManager.M_SHOW_BANNER)) { + onToggleBannerShow(true); + } else if (pEventType.equals(pluginEnums.eAdManager.M_HIDE_BANNER)) { + onToggleBannerShow(false); + } else if (pEventType.equals(pluginEnums.eAdManager.M_SHOW_INTERSTITIAL)) { + onShowInterstitial(); } return null; } diff --git a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/applovinBannerManager.java b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/applovinBannerManager.java new file mode 100644 index 00000000..81fc1ebf --- /dev/null +++ b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/applovinBannerManager.java @@ -0,0 +1,112 @@ +package com.hiddenservices.onionservices.pluginManager.adPluginManager; + +import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_CLICKED; +import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_LOAD; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; +import androidx.appcompat.app.AppCompatActivity; +import com.applovin.mediation.MaxAd; +import com.applovin.mediation.MaxAdViewAdListener; +import com.applovin.mediation.MaxError; +import com.applovin.mediation.ads.MaxAdView; +import com.hiddenservices.onionservices.eventObserver; +import com.hiddenservices.onionservices.helperManager.helperMethod; + + +public class applovinBannerManager implements MaxAdViewAdListener{ + + /* Private Variabes */ + + private static final String S_UNIT_ID = "642ec6302c7cecd2"; + private MaxAdView mBanner; + eventObserver.eventListener mEvent; + + /* Initializations */ + + public applovinBannerManager(AppCompatActivity pContext, eventObserver.eventListener pEvent){ + mEvent = pEvent; + mBanner = new MaxAdView( S_UNIT_ID,pContext); + mBanner.setListener(this); + + int width = ViewGroup.LayoutParams.MATCH_PARENT; + int heightPx = helperMethod.pxFromDp(50); + + mBanner.setLayoutParams( new FrameLayout.LayoutParams( width, heightPx ) ); + mBanner.setVisibility(View.GONE); + mBanner.setLayerType(View.LAYER_TYPE_SOFTWARE, null); + mBanner.setExtraParameter( "disable_precache", "true" ); + + ViewGroup rootView = pContext.findViewById(android.R.id.content); + rootView.addView(mBanner); + + mBanner.setExtraParameter( "allow_pause_auto_refresh_immediately", "true" ); + mBanner.loadAd(); + } + + /* Helper Methods */ + + public void onShow(boolean pStatus) { + if(mBanner!=null){ + if(pStatus){ + mBanner.startAutoRefresh(); + mBanner.clearAnimation(); + mBanner.setAlpha(0); + mBanner.setVisibility(View.VISIBLE); + mBanner.animate().setDuration(250).alpha(1).setStartDelay(500); + }else { + mBanner.stopAutoRefresh(); + mBanner.clearAnimation(); + mBanner.setAlpha(1); + mBanner.setVisibility(View.VISIBLE); + mBanner.animate().setDuration(250).alpha(0).setStartDelay(0).withEndAction(() -> { + mBanner.setVisibility(View.GONE); + }); + } + } + } + + public void onDestroy() { + if(mBanner !=null){ + mBanner.destroy(); + mBanner = null; + } + } + + /* Local Listeners */ + + @Override + public void onAdExpanded(MaxAd ad) { + } + + @Override + public void onAdCollapsed(MaxAd ad) { + } + + @Override + public void onAdLoaded(MaxAd ad) { + mEvent.invokeObserver(null, M_ON_AD_LOAD); + } + + @Override + public void onAdDisplayed(MaxAd ad) { + } + + @Override + public void onAdHidden(MaxAd ad) { + } + + @Override + public void onAdClicked(MaxAd ad) { + mEvent.invokeObserver(null, M_ON_AD_CLICKED); + } + + @Override + public void onAdLoadFailed(String adUnitId, MaxError error) { + } + + @Override + public void onAdDisplayFailed(MaxAd ad, MaxError error) { + } + +} diff --git a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/applovinSupportManager.java b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/applovinSupportManager.java new file mode 100644 index 00000000..55871c42 --- /dev/null +++ b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/applovinSupportManager.java @@ -0,0 +1,79 @@ +package com.hiddenservices.onionservices.pluginManager.adPluginManager; + +import android.os.Handler; +import androidx.appcompat.app.AppCompatActivity; +import com.applovin.mediation.MaxAd; +import com.applovin.mediation.MaxAdViewAdListener; +import com.applovin.mediation.MaxError; +import com.applovin.mediation.ads.MaxInterstitialAd; +import java.util.concurrent.TimeUnit; + +public class applovinSupportManager implements MaxAdViewAdListener { + + /* Private Variabes */ + + private static final String S_UNIT_ID = "20c7df09f494b00d"; + private MaxInterstitialAd mInterstitialAd; + private int mRetryAttemt; + + + /* Initializations */ + + public applovinSupportManager(AppCompatActivity pContext){ + mInterstitialAd = new MaxInterstitialAd( S_UNIT_ID, pContext); + mInterstitialAd.setListener(this); + mInterstitialAd.loadAd(); + } + + /* Helper Methods */ + + public void onShow() { + if(mInterstitialAd!=null){ + if(mInterstitialAd.isReady()){ + mInterstitialAd.showAd(); + } + } + } + + /* Local Listeners */ + + @Override + public void onAdExpanded(MaxAd ad) { + } + + @Override + public void onAdCollapsed(MaxAd ad) { + } + + @Override + public void onAdLoaded(final MaxAd maxAd) + { + mRetryAttemt = 0; + } + + @Override + public void onAdLoadFailed(final String adUnitId, final MaxError error) + { + mRetryAttemt++; + long delayMillis = TimeUnit.SECONDS.toMillis( (long) Math.pow( 2, Math.min( 6, mRetryAttemt) ) ); + new Handler().postDelayed(() -> mInterstitialAd.loadAd(), delayMillis ); + } + + @Override + public void onAdDisplayFailed(final MaxAd maxAd, final MaxError error) + { + mInterstitialAd.loadAd(); + } + + @Override + public void onAdDisplayed(final MaxAd maxAd) {} + + @Override + public void onAdClicked(final MaxAd maxAd) {} + + @Override + public void onAdHidden(final MaxAd maxAd) + { + mInterstitialAd.loadAd(); + } +} diff --git a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/orbotPluginManager/orbotLogManager.java b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/orbotPluginManager/orbotLogManager.java index e96855e9..37b27ff0 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/orbotPluginManager/orbotLogManager.java +++ b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/orbotPluginManager/orbotLogManager.java @@ -12,9 +12,6 @@ public class orbotLogManager { private String onGetCleanedLogs(String pLogs) { String logs = pLogs; - if(!status.sAdLoaded){ - return "Initializing extentions"; - } if (logs.equals("Starting Orion | Please Wait ...")) { return logs; } 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 147ed5ac..cf198587 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/pluginController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/pluginController.java @@ -1,5 +1,6 @@ package com.hiddenservices.onionservices.pluginManager; +import android.os.Handler; import android.view.WindowManager; import android.widget.ImageView; @@ -33,8 +34,7 @@ import java.util.List; import java.util.Locale; import static com.hiddenservices.onionservices.constants.enums.etype.fetch_favicon; -import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_CLICK; -import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_HIDE; +import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_CLICKED; import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_LOAD; import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eLangManager.M_ACTIVITY_CREATED; import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eLangManager.M_RESUME; @@ -110,13 +110,14 @@ public class pluginController { private class admobCallback implements eventObserver.eventListener { @Override public Object invokeObserver(List data, Object event_type) { - if (event_type.equals(M_ON_AD_CLICK)) { - helperMethod.onMinimizeApp(mHomeController.get()); - activityContextManager.getInstance().getHomeController().onAdClicked(); - } else if (event_type.equals(M_ON_AD_LOAD)) { + if (event_type.equals(M_ON_AD_LOAD)) { activityContextManager.getInstance().getHomeController().onUpdateBannerAdvert(); - } else if (event_type.equals(M_ON_AD_HIDE)) { - activityContextManager.getInstance().getHomeController().onAdClicked(); + } else if (event_type.equals(M_ON_AD_CLICKED)) { + status.sIsBackgroundAdvertCheck = true; + new Handler().postDelayed(() -> + { + status.sIsBackgroundAdvertCheck = false; + }, 5000); } return null; } diff --git a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/pluginEnums.java b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/pluginEnums.java index a244873a..773f199b 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/pluginEnums.java +++ b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/pluginEnums.java @@ -1,13 +1,14 @@ package com.hiddenservices.onionservices.pluginManager; public class pluginEnums { + /*Advert Manager*/ public enum eAdManager { - M_INITIALIZE_BANNER_ADS, M_IS_ADVERT_LOADED, M_LOW_MEMORY_DESTROY, M_DESTROY, M_HIDE, M_SHOW + M_IS_ADVERT_LOADED, M_LOW_MEMORY_DESTROY, M_HIDE_BANNER, M_SHOW_BANNER, M_SHOW_INTERSTITIAL } public enum eAdManagerCallbacks { - M_ON_AD_CLICK, M_ON_AD_LOAD, M_ON_AD_HIDE + M_ON_AD_LOAD, M_ON_AD_CLICKED } /*Analytics Manager*/ diff --git a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/pluginReciever/defaultNotificationReciever.java b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/pluginReciever/defaultNotificationReciever.java index b5fb7136..0aea4a2b 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/pluginReciever/defaultNotificationReciever.java +++ b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/pluginReciever/defaultNotificationReciever.java @@ -35,7 +35,6 @@ public class defaultNotificationReciever extends BroadcastReceiver { protected void onDestroy(Context context) { orbotLocalConstants.mAppForceExit = true; - pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_DESTROY); if (!status.mThemeApplying) { if (!status.sSettingIsAppStarted) { diff --git a/app/src/main/res/custom-xml/images/xml/ic_baseline_support.xml b/app/src/main/res/custom-xml/images/xml/ic_baseline_support.xml new file mode 100644 index 00000000..4d35dc5a --- /dev/null +++ b/app/src/main/res/custom-xml/images/xml/ic_baseline_support.xml @@ -0,0 +1,7 @@ + + + + + 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 3dbefd64..8c6f20c9 100644 --- a/app/src/main/res/layouts/home/layout/home_view.xml +++ b/app/src/main/res/layouts/home/layout/home_view.xml @@ -463,6 +463,23 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> + + + + + app:tint="@color/c_navigation_tint" /> + app:tint="@color/c_navigation_tint" /> + app:tint="@color/c_navigation_tint" /> + app:tint="@color/c_navigation_tint" /> + app:tint="@color/c_navigation_tint" /> + app:tint="@color/c_navigation_tint" /> + + + + + + + + + + + + + + + + + + + + + + + +