diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
deleted file mode 100644
index 22be7647..00000000
--- a/.idea/deploymentTargetDropDown.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 9aa8b970..552eeb42 100755
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -2,9 +2,7 @@ plugins {
id "com.jetbrains.python.envs" version "0.0.26"
}
-ext.gleanExpireByVersion = 1
apply plugin: 'com.android.application'
-apply plugin: "org.mozilla.telemetry.glean-gradle-plugin"
apply from: 'variables.gradle'
apply plugin: 'kotlin-android'
@@ -30,10 +28,6 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
- dexOptions {
- preDexLibraries project.ext.preDexLibraries
- }
-
buildTypes {
release {
minifyEnabled project.ext.minifyEnabled
@@ -74,79 +68,60 @@ android {
}
}
dependencies {
- /* Android Support Repository dependencies */
+
+ /* File Support Dependencies */
+
implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation files('libs/httpclientandroidlib-1.2.1.jar')
+ /* Android Support Repository Dependencies */
- /* Default Libraries */
-
+ implementation 'androidx.recyclerview:recyclerview:1.2.1'
+ implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
+ implementation 'com.google.android.material:material:1.5.0'
+ implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.6.10'
+ implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10'
+ implementation 'org.apache.commons:commons-text:1.3'
+ implementation 'androidx.work:work-runtime-ktx:2.8.0-alpha01'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
+ implementation 'com.android.support.constraint:constraint-layout:2.0.4'
+ implementation 'androidx.preference:preference-ktx:1.2.0'
+ implementation 'com.android.support:support-annotations:29.0.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
/* Firefox ABI Splits */
- // implementation "androidx.compose.foundation:foundation:1.0.4"
- // implementation "org.mozilla.components:browser-engine-gecko:100.0.20220327143103"
- implementation "androidx.compose.foundation:foundation:1.0.4"
+ implementation "androidx.compose.foundation:foundation:1.1.1"
implementation "org.mozilla.components:browser-engine-gecko:100.0.20220327143103"
- implementation "org.mozilla.components:service-glean:100.0.20220327143103"
implementation "org.mozilla.components:support-rusthttp:100.0.20220327143103"
implementation "org.mozilla.components:support-rustlog:100.0.20220327143103"
-
implementation "org.mozilla.components:browser-icons:100.0.20220327143103"
implementation "org.mozilla.components:concept-fetch:100.0.20220327143103"
implementation "org.mozilla.components:concept-base:100.0.20220327143103"
implementation "org.mozilla.components:support-utils:100.0.20220327143103"
-
-
- /* Android Support Repository dependencies */
- implementation fileTree(dir: 'libs', include: ['*.jar'])
-
-
- /* Default Libraries */
-
- implementation 'androidx.appcompat:appcompat:1.4.1'
-
- /* Firefox ABI Splits */
-
- implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
- implementation 'com.android.support.constraint:constraint-layout:2.0.4'
- implementation 'com.google.android.material:material:1.5.0'
- implementation 'androidx.preference:preference-ktx:1.2.0'
- implementation 'com.google.android.material:material:1.5.0'
- implementation 'androidx.appcompat:appcompat:1.4.1'
-
+ /* Analytics */
implementation 'com.flurry.android:analytics:13.1.0@aar'
/* Ads Manager */
- implementation 'com.android.support:support-annotations:29.0.0'
- implementation 'com.facebook.android:audience-network-sdk:6.6.0'
- implementation 'com.mopub.mediation:facebookaudiencenetwork:6.6.0.0'
- implementation 'com.applovin:applovin-sdk:+'
- implementation 'com.applovin.mediation:facebook-adapter:+'
- /* Crawler Service */
-
- implementation 'org.jsoup:jsoup:1.13.1'
+ implementation 'com.facebook.android:audience-network-sdk:6.8.0'
+ implementation 'com.applovin:applovin-sdk:11.3.1'
+ implementation 'com.applovin.mediation:facebook-adapter:6.8.0.12'
/* Orbot Service */
implementation project(path: ':orbotmanager')
/* Helper Libraries */
- implementation 'androidx.work:work-runtime-ktx:2.7.0-alpha05'
- implementation files('libs/httpclientandroidlib-1.2.1.jar')
+
implementation 'com.coolerfall:android-http-download-manager:1.6.3'
implementation 'com.android.volley:volley:1.2.1'
implementation "net.zetetic:android-database-sqlcipher:4.4.3"
implementation "androidx.sqlite:sqlite-ktx:2.2.0"
implementation 'androidx.palette:palette-ktx:1.0.0'
- implementation 'androidx.recyclerview:recyclerview:1.2.1'
- implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
- implementation 'com.google.android.material:material:1.5.0'
- implementation "org.jetbrains.kotlin:kotlin-stdlib:1.5.31"
- implementation 'org.apache.commons:commons-text:1.3'
+ implementation 'org.jsoup:jsoup:1.13.1'
}
diff --git a/app/google-services.json b/app/google-services.json
deleted file mode 100755
index 71935c15..00000000
--- a/app/google-services.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
- "project_info": {
- "project_number": "1026582312920",
- "firebase_url": "https://genesis-5cc48.firebaseio.com",
- "project_id": "genesis-5cc48",
- "storage_bucket": "genesis-5cc48.appspot.com"
- },
- "client": [
- {
- "client_info": {
- "mobilesdk_app_id": "1:1026582312920:android:056aacc3b6f0c3b3f164ad",
- "android_client_info": {
- "package_name": "com.darkweb.genesissearchengine.production"
- }
- },
- "oauth_client": [
- {
- "client_id": "1026582312920-ciidt1n08e3fh9akdrn38ph6on2c7d95.apps.googleusercontent.com",
- "client_type": 3
- }
- ],
- "api_key": [
- {
- "current_key": "AIza SyBMzD4SV_-2_2tG9E5a475k5OkwP9V-Naw"
- }
- ],
- "services": {
- "appinvite_service": {
- "other_platform_oauth_client": [
- {
- "client_id": "1026582312920-ciidt1n08e3fh9akdrn38ph6on2c7d95.apps.googleusercontent.com",
- "client_type": 3
- }
- ]
- }
- }
- }
- ],
- "configuration_version": "1"
-}
\ No newline at end of file
diff --git a/app/libs/mopub-sdk-5.17.0.aar b/app/libs/mopub-sdk-5.17.0.aar
deleted file mode 100644
index 32d6a201..00000000
Binary files a/app/libs/mopub-sdk-5.17.0.aar and /dev/null differ
diff --git a/app/src/androidTest/java/com/example/genesissearchwidget/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/example/genesissearchwidget/ExampleInstrumentedTest.kt
deleted file mode 100644
index e26d7410..00000000
--- a/app/src/androidTest/java/com/example/genesissearchwidget/ExampleInstrumentedTest.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.example.myapplication
-
-import android.support.test.InstrumentationRegistry
-import android.support.test.runner.AndroidJUnit4
-
-import org.junit.Test
-import org.junit.runner.RunWith
-
-import org.junit.Assert.*
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * See [testing documentation](http://d.android.com/tools/testing).
- */
-@RunWith(AndroidJUnit4::class)
-class ExampleInstrumentedTest {
- @Test
- fun useAppContext() {
- // Context of the app under test.
- val appContext = InstrumentationRegistry.getTargetContext()
- assertEquals("com.example.myapplication", appContext.packageName)
- }
-}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 2b8e2cef..6f23a95e 100755
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -27,42 +27,25 @@
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:targetApi="n">
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -185,44 +186,61 @@
-
+
+
+
+
-
+ android:value="be76c64dae2519d4ab8daaed88298da14c7c294f" />
+
-
+ android:name="applovin.sdk.key"
+ android:value="hGlhanpemGqPOKKAgaXvhyxwZaG9uD68csy1OadWTNhEgKvBWR7-7KSpyFr6nfZ4KMOuBBV5J49s2LLSg-SVxg" />
+
+
+
+
+
+
+
+
+
+
+
+
+ android:exported="false">
+
+
+
+
+
+
+
+
+
+
+
+ android:grantUriPermissions="true"
+ tools:ignore="ExportedContentProvider">
+
+ android:exported="false" />
+
+ android:exported="false" />
+
+ android:exported="false" />
+
+ android:exported="false" />
+
-
\ No newline at end of file
diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/config.yaml b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/config.yaml
new file mode 100644
index 00000000..354e4582
--- /dev/null
+++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/config.yaml
@@ -0,0 +1,56 @@
+# Contents of /data/local/tmp/com.yourcompany.yourapp-geckoview-config.yaml
+
+env:
+ MOZ_LOG: nsHttp:5
+
+
+prefs:
+ network.proxy.type: 1
+ # network.proxy.socks: "127.0.0.1"
+ # network.proxy.socks_port: 9050
+ network.proxy.socks_version: 5
+ network.proxy.socks_remote_dns: true
+ permissions.default.image: 1
+ browser.display.show_image_placeholders: true
+ browser.cache.disk.enable: false
+ browser.cache.memory.enable: true
+ browser.cache.disk.capacity: 0
+ privacy.resistFingerprinting: true
+ privacy.donottrackheader.enabled: false
+ privacy.donottrackheader.value: 1
+ network.http.sendRefererHeader: 0
+ security.checkloaduri: false
+ security.mixed_content.block_active_content: false
+ security.mixed_content.block_display_content: false
+ media.peerconnection.enabled: false //webrtc disabled
+ browser.cache.disk_cache_ssl: true
+ signon.formlessCapture.enabled: true
+ signon.storeWhenAutocompleteOff: true
+ dom.event.contextmenu.enabled: true
+ layout.css.visited_links_enabled: true
+ security.ssl3.ecdhe_rsa_aes_128_sha: true
+ security.ssl3.ecdhe_ecdsa_aes_128_sha: true
+ security.ssl3.dhe_rsa_aes_128_sha: true
+ security.ssl3.rsa_des_ede3_sha: true
+ security.ssl3.dhe_rsa_aes_256_sha: true
+ browser.safebrowsing.blockedURIs.enabled: false
+ media.gmp-provider.enabled: false
+ browser.send_pings.require_same_host: false
+ webgl.disabled: false
+ pdfjs.enableWebGL: false
+ browser.safebrowsing.malware.enabled: false
+ security.csp.experimentalEnabled: false
+ network.http.referer.spoofSource: false
+ security.OCSP.require: false
+ security.ssl.require_safe_negotiation: false
+ privacy.clearOnShutdown.cache: true
+ privacy.clearOnShutdown.downloads: true
+ privacy.clearOnShutdown.formdata: true
+ privacy.clearOnShutdown.history: true
+ privacy.clearOnShutdown.offlineApps: true
+ privacy.clearOnShutdown.passwords: true
+ privacy.clearOnShutdown.sessions: true
+ privacy.clearOnShutdown.siteSettings: true
+
+
+
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 be05039e..edc54a59 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
@@ -37,7 +37,6 @@ import static org.mozilla.geckoview.StorageController.ClearFlags.PERMISSIONS;
import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_DATA;
import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_SETTINGS;
import org.json.JSONObject;
-//import org.mozilla.gecko.PrefsHelper;
import org.mozilla.geckoview.ContentBlocking;
import org.mozilla.geckoview.GeckoRuntime;
import org.mozilla.geckoview.GeckoRuntimeSettings;
@@ -64,25 +63,32 @@ public class geckoClients
{
this.event = event;
mSessionID = helperMethod.createRandomID();
- initRuntimeSettings(context);
+ //initRuntimeSettings(context);
if(!isForced && geckoView.getSession()!=null && geckoView.getSession().isOpen()){
mSession = (geckoSession) geckoView.getSession();
}
else {
if(geckoView.getSession()!=null){
- geckoView.releaseSession();
+ //geckoView.releaseSession();
}
mSession = new geckoSession(new geckoViewClientCallback(),mSessionID,context, geckoView);
- mSession.open(mRuntime);
+ //mSession.open(mRuntime);
mSession.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack);
mSession.getSettings().setFullAccessibilityTree(true);
mSession.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE);
mSession.getSettings().setAllowJavascript(status.sSettingJavaStatus);
- geckoView.setSession(mSession);
+ //geckoView.setSession(mSession);
}
mSession.onSetInitializeFromStartup();
+ //onUpdateFont();
+ }
+
+ public void postInitRuntime(GeckoView geckoView, AppCompatActivity context){
+ initRuntimeSettings(context);
+ mSession.open(mRuntime);
+ geckoView.setSession(mSession);
onUpdateFont();
}
@@ -174,6 +180,19 @@ public class geckoClients
} catch (IOException e) {
e.printStackTrace();
}
+
+ String mYAML = helperMethod.readFromFile(cacheFile.getPath());
+ mYAML = mYAML.replace("# network.proxy.socks: \"127.0.0.1\"","network.proxy.socks: \"127.0.0.1\"");
+ mYAML = mYAML.replace("# network.proxy.socks_port: 9050","network.proxy.socks_port: 9050");
+ mYAML = mYAML.replace("network.proxy.socks: \"127.0.0.1\"","network.proxy.socks: \"127.0.0.1\"");
+
+ StringBuilder buf = new StringBuilder(mYAML);
+ int portIndex = mYAML.indexOf("network.proxy.socks_port");
+ int breakIndex = mYAML.indexOf("\n",portIndex);
+ mYAML = buf.replace(portIndex, breakIndex,"network.proxy.socks_port: "+ orbotLocalConstants.mSOCKSPort).toString();
+ helperMethod.writeToFile(cacheFile.getPath(), mYAML);
+
+
return cacheFile.getAbsolutePath();
}
@@ -262,15 +281,6 @@ public class geckoClients
}
mSettings.build();
- /*PrefsHelper.setPref("browser.cache.disk.enable",true);
- PrefsHelper.setPref("browser.cache.memory.enable",true);
- PrefsHelper.setPref("browser.cache.disk.capacity",1000);
- PrefsHelper.setPref(keys.PROXY_TYPE, 1);
- PrefsHelper.setPref(keys.PROXY_SOCKS,"127.0.0.1");
- PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, orbotLocalConstants.mSOCKSPort);
- PrefsHelper.setPref(keys.PROXY_SOCKS_VERSION,5);
- PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,true);*/
-
mRuntime = GeckoRuntime.create(context, mSettings.build());
mRuntime.getSettings().setRemoteDebuggingEnabled(true);
installExtension();
@@ -312,7 +322,7 @@ public class geckoClients
}
@SuppressLint("WrongConstant")
- public void updateSetting(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){
+ public void updateSetting(NestedGeckoView mNestedGeckoView,AppCompatActivity pcontext){
GeckoRuntimeSettings.Builder mSettings = new GeckoRuntimeSettings.Builder();
if(status.sShowImages == 2){
mSettings.configFilePath(getAssetsCacheFile(pcontext, "geckoview-config-noimage.yaml"));
@@ -320,7 +330,7 @@ public class geckoClients
mSettings.configFilePath(getAssetsCacheFile(pcontext, "geckoview-config.yaml"));
}
mSettings.build();
-
+ mRuntime.getSettings().setRemoteDebuggingEnabled(true);
mRuntime.getSettings().setRemoteDebuggingEnabled(true);
mRuntime.getSettings().setWebFontsEnabled(status.sShowWebFonts);
diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoDownloadManager.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoDownloadManager.java
index ada4701a..20482696 100644
--- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoDownloadManager.java
+++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoDownloadManager.java
@@ -28,9 +28,7 @@ class geckoDownloadManager
}
void downloadFile(WebResponse response, geckoSession session, AppCompatActivity context, eventObserver.eventListener event) {
- session
- .getUserAgent()
- .accept(userAgent -> downloadFile(response, userAgent,context,session,event),
+ session.getUserAgent().accept(userAgent -> downloadFile(response, userAgent,context,session,event),
exception -> {
throw new IllegalStateException("Could not get UserAgent string.");
});
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 0bc60b35..467d55ab 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
@@ -30,7 +30,6 @@ 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.keys;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.dataManager.dataEnums;
@@ -388,13 +387,12 @@ geckoSession extends GeckoSession implements MediaSession.Delegate,GeckoSession.
PrefsHelper.setPref(keys.PROXY_SOCKS_REMOTE_DNS,true);*/
if(mIsLoaded){
- if(!var2.equals("about:blank") && helperMethod.getHost(var2).endsWith(".onion")){
+ if(!mCurrentURL.equals("about:config") && !var2.equals("about:blank") && helperMethod.getHost(var2).endsWith(".onion")){
var2 = var2.replace("www.","");
}
mCurrentURL = var2;
-
- if(!mCurrentURL.equals("about:blank")){
+ 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);
mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(5,mSessionID), enums.etype.progress_update));
}
@@ -404,7 +402,7 @@ geckoSession extends GeckoSession implements MediaSession.Delegate,GeckoSession.
mThemeChanged = false;
}
isPageLoading = true;
- if(!mCurrentURL.equals("about:blank") && !mCurrentTitle.equals("loading")){
+ if(!mCurrentURL.equals("about:config") && !mCurrentURL.equals("about:blank") && !mCurrentTitle.equals("loading")){
mProgress = 5;
mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(5,mSessionID), enums.etype.progress_update));
mThemeChanged = false;
@@ -500,7 +498,7 @@ geckoSession extends GeckoSession implements MediaSession.Delegate,GeckoSession.
}
public void onProgressStart(){
- if(!getCurrentURL().equals("about:blank") && !getCurrentURL().contains("trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion") && !wasPreviousErrorPage() && !getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) && !getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) && !getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) && !getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){
+ if(!getCurrentURL().equals("about:config") && !getCurrentURL().equals("about:blank") && !getCurrentURL().contains("trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion") && !wasPreviousErrorPage() && !getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) && !getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) && !getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) && !getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){
mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(5,mSessionID), enums.etype.progress_update));
}
}
@@ -682,7 +680,7 @@ geckoSession extends GeckoSession implements MediaSession.Delegate,GeckoSession.
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR);
- if(!mCurrentURL.contains("trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion")){
+ if(!m_url.equals("about:config") && !mCurrentURL.contains("trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion")){
mProgress = 5;
onProgressStart();
}
@@ -786,11 +784,6 @@ geckoSession extends GeckoSession implements MediaSession.Delegate,GeckoSession.
}
}
- @UiThread
- public void onExternalResponse(@NonNull GeckoSession session, @NonNull GeckoSession.WebResponseInfo response){
-
- }
-
@UiThread
public void onFirstContentfulPaint(@NonNull GeckoSession var1) {
@@ -981,7 +974,7 @@ geckoSession extends GeckoSession implements MediaSession.Delegate,GeckoSession.
{
if(mDownloadManager.getDownloadURL()!=null && mDownloadManager.getDownloadFile()!=null){
if(!createAndSaveFileFromBase64Url(mDownloadManager.getDownloadURL().toString())){
- pluginController.getInstance().onDownloadInvoke(Arrays.asList(mDownloadManager.getDownloadURL()+"__"+mDownloadManager.getDownloadFile(), Environment.DIRECTORY_DOWNLOADS), pluginEnums.eDownloadManager.M_START_SERVICE);
+ pluginController.getInstance().onDownloadInvoke(Arrays.asList(mDownloadManager.getDownloadURL(), mDownloadManager.getDownloadFile()), pluginEnums.eDownloadManager.M_WEB_DOWNLOAD_REQUEST);
}
}
}
@@ -990,7 +983,7 @@ geckoSession extends GeckoSession implements MediaSession.Delegate,GeckoSession.
{
if(downloadURL!=null && downloadFile!=null){
if(!createAndSaveFileFromBase64Url(downloadURL.toString())){
- pluginController.getInstance().onDownloadInvoke(Arrays.asList(downloadURL + "__" + downloadFile, Environment.DIRECTORY_DOWNLOADS), pluginEnums.eDownloadManager.M_START_SERVICE);
+ pluginController.getInstance().onDownloadInvoke(Arrays.asList(downloadURL, downloadFile), pluginEnums.eDownloadManager.M_WEB_DOWNLOAD_REQUEST);
}
}
}
@@ -1038,7 +1031,7 @@ geckoSession extends GeckoSession implements MediaSession.Delegate,GeckoSession.
String filename;
if(url.startsWith("blob")){
- loadUri((String) pluginController.getInstance().onDownloadInvoke(Collections.singletonList(url), pluginEnums.eDownloadManager.M_DOWNLOAD_BLOB));
+ loadUri((String) pluginController.getInstance().onDownloadInvoke(Collections.singletonList(url), pluginEnums.eDownloadManager.M_BLOB_DOWNLOAD_REQUEST));
return true;
}
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 36ced509..13e460d9 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
@@ -619,7 +619,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
public void initRuntimeSettings()
{
- mGeckoClient.updateSetting(mGeckoView, homeController.this);
+ mGeckoClient.updateSetting(mGeckoView, this);
}
public void onReDrawGeckoview(){
@@ -1894,7 +1894,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
{
pluginController.getInstance().onOrbotInvoke(Collections.singletonList(status.mThemeApplying), pluginEnums.eOrbotManager.M_DESTROY);
- finishAffinity();
+ finishAndRemoveTask();
overridePendingTransition(R.anim.popup_scale_in, R.anim.popup_scale_out);
activityContextManager.getInstance().getHomeController().onResetData();
mGeckoClient.onClearAll();
@@ -2127,6 +2127,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba
{
initTabCountForced();
}
+ else if(e_type.equals(enums.etype.M_INIT_RUNTIME_SETTINGS)){
+ mGeckoClient.postInitRuntime(mGeckoView, homeController.this);
+ }
else if(e_type.equals(enums.etype.M_IS_ERROR_PAGE))
{
if(mGeckoClient==null || mGeckoClient.getSession()==null){
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 59b3270a..dac01284 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
@@ -43,6 +43,7 @@ import androidx.fragment.app.FragmentContainerView;
import androidx.recyclerview.widget.RecyclerView;
import com.applovin.mediation.ads.MaxAdView;
+import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.constants.*;
import com.hiddenservices.onionservices.dataManager.dataController;
import com.hiddenservices.onionservices.dataManager.dataEnums;
@@ -610,7 +611,7 @@ class homeViewController
protected Void doInBackground(Void...arg0) {
AppCompatActivity temp_context = mContext;
int mCounter = 0;
- while (!orbotLocalConstants.mIsTorInitialized || !orbotLocalConstants.mNetworkState){
+ while (orbotLocalConstants.mSOCKSPort==-1 && (!orbotLocalConstants.mIsTorInitialized || !orbotLocalConstants.mNetworkState)){
try
{
boolean mFastConnect = status.sSettingIsAppStarted || !status.sRestoreTabs && status.sAppInstalled && status.sSettingDefaultSearchEngine.equals(constants.CONST_BACKEND_GENESIS_URL) && !status.sBridgeStatus && status.sExternalWebsite.equals(strings.GENERIC_EMPTY_STR);
@@ -620,7 +621,9 @@ class homeViewController
orbotLocalConstants.mTorLogsStatus = "Starting Genesis | Please Wait ...";
mEvent.invokeObserver(Collections.singletonList(status.sSettingDefaultSearchEngine), enums.etype.recheck_orbot);
startPostTask(messages.MESSAGE_UPDATE_LOADING_TEXT);
- break;
+ if (orbotLocalConstants.mSOCKSPort!=-1){
+ break;
+ }
}else{
orbotLocalConstants.mTorLogsStatus = "No internet connection";
startPostTask(messages.MESSAGE_UPDATE_LOADING_TEXT);
@@ -628,7 +631,7 @@ class homeViewController
}
sleep(500);
- if(mCounter>20){
+ if(mCounter>20 && orbotLocalConstants.mSOCKSPort!=-1){
break;
}else {
mCounter+=1;
@@ -648,6 +651,10 @@ class homeViewController
e.printStackTrace();
}
}
+ mContext.runOnUiThread(() -> {
+ mEvent.invokeObserver(null, enums.etype.M_INIT_RUNTIME_SETTINGS);
+ });
+
if(!status.sSettingIsAppStarted){
mContext.runOnUiThread(() -> {
onDisableSplashScreen();
@@ -1637,6 +1644,12 @@ class homeViewController
}
if(status.sFullScreenBrowsing){
+ int orientation = mContext.getResources().getConfiguration().orientation;
+ if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
+ mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(60 + 60));
+ } else {
+ mWebviewContainer.setPadding(0,0,0,helperMethod.pxFromDp(110));
+ }
}
else {
if(mAdvertLoaded!=null && (boolean)mAdvertLoaded){
diff --git a/app/src/main/java/com/hiddenservices/onionservices/constants/constants.java b/app/src/main/java/com/hiddenservices/onionservices/constants/constants.java
index 1199c161..6e15a6de 100644
--- a/app/src/main/java/com/hiddenservices/onionservices/constants/constants.java
+++ b/app/src/main/java/com/hiddenservices/onionservices/constants/constants.java
@@ -12,7 +12,7 @@ public class constants
public static final String CONST_PRIVACY_POLICY_URL = "http://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion/privacy";
public static final String CONST_REPORT_URL = "http://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion/report?url=";
public static final String CONST_SITEMAP = "http://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion/create";
- public static final String CONST_PACKAGE_NAME = "com.darkweb.genesissearchengine.production";
+ public static final String CONST_PACKAGE_NAME = "com.hiddenservices.onionservices";
public static final String CONST_GENESIS_ONION = "genesis.onion";
public static final String CONST_GENESIS_ONION_V2 = "trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion";
diff --git a/app/src/main/java/com/hiddenservices/onionservices/constants/enums.java b/app/src/main/java/com/hiddenservices/onionservices/constants/enums.java
index 8ee7f686..f0fcfe26 100644
--- a/app/src/main/java/com/hiddenservices/onionservices/constants/enums.java
+++ b/app/src/main/java/com/hiddenservices/onionservices/constants/enums.java
@@ -8,7 +8,7 @@ public class enums
on_verify_selected_url_menu,FINDER_RESULT_CALLBACK,M_ADMOB_BANNER_RECHECK,M_OPEN_SESSION,M_DOWNLOAD_FAILURE, M_ADVERT_LOADED,
welcome, reload,download_folder, M_UPDATE_THEME,M_ON_BANNER_UPDATE, M_LOAD_HOMEPAGE_GENESIS,M_INIT_TAB_COUNT_FORCED,M_SPLASH_DISABLE,M_NEW_LINK_IN_NEW_TAB, M_NEW_LINK_IN_NEW_TAB_LOAD,M_RESET_SUGGESTION,
url_triggered, url_triggered_new_tab,url_clear,fetch_favicon,M_OPEN_BOOKMARK_SETTING, M_COPY_URL,url_clear_at,remove_from_database,is_empty,M_HOME_PAGE,M_PRELOAD_URL,ON_KEYBOARD_CLOSE,M_CLOSE_TAB, M_CLOSE_TAB_BACK,
- on_close_sesson,on_long_press, on_full_screen,on_handle_external_intent,on_update_suggestion_url,progress_update,progress_update_forced, ON_EXPAND_TOP_BAR,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,start_proxy, ON_UPDATE_THEME, M_NEW_IDENTITY,M_INDEX_WEBSITE, M_NEW_IDENTITY_MESSAGED, M_INITIALIZE_TAB_SINGLE, M_HOME_BUTTON_PRESSED, M_INITIALIZE_TAB_LINK,on_request_completed, on_update_history,on_update_suggestion,M_WELCOME_MESSAGE,ON_FIRST_PAINT, ON_INVOKE_PARSER, ON_LOAD_TAB_ON_RESUME, ON_SESSION_REINIT,on_page_loaded,on_load_error, M_ORBOT_LOADING,download_file_popup,on_init_ads, M_GET_CURRENT_URL,search_update, open_new_tab,open_new_tab_instant
+ on_close_sesson,on_long_press, on_full_screen,on_handle_external_intent,on_update_suggestion_url,progress_update,progress_update_forced, ON_EXPAND_TOP_BAR,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,start_proxy, ON_UPDATE_THEME, M_NEW_IDENTITY,M_INDEX_WEBSITE, M_INIT_RUNTIME_SETTINGS, M_NEW_IDENTITY_MESSAGED, M_INITIALIZE_TAB_SINGLE, M_HOME_BUTTON_PRESSED, M_INITIALIZE_TAB_LINK,on_request_completed, on_update_history,on_update_suggestion,M_WELCOME_MESSAGE,ON_FIRST_PAINT, ON_INVOKE_PARSER, ON_LOAD_TAB_ON_RESUME, ON_SESSION_REINIT,on_page_loaded,on_load_error, M_ORBOT_LOADING,download_file_popup,on_init_ads, M_GET_CURRENT_URL,search_update, open_new_tab,open_new_tab_instant
}
/*General Enums*/
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 a87d6473..9622ffd1 100644
--- a/app/src/main/java/com/hiddenservices/onionservices/helperManager/helperMethod.java
+++ b/app/src/main/java/com/hiddenservices/onionservices/helperManager/helperMethod.java
@@ -6,6 +6,7 @@ import android.animation.AnimatorListenerAdapter;
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.app.DownloadManager;
+import android.app.PendingIntent;
import android.content.ActivityNotFoundException;
import android.content.ClipData;
import android.content.ClipboardManager;
@@ -60,18 +61,27 @@ import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.example.myapplication.R;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
+import java.nio.charset.StandardCharsets;
import java.security.Key;
+import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
@@ -98,6 +108,33 @@ public class helperMethod
{
/*Helper Methods General*/
+ public static String getFileSizeBadge(long size) {
+ if (size <= 0)
+ return "0";
+
+ final String[] units = new String[] { "B Downloaded", "KB ⇣", "MB ⇣", "GB ⇣", "TB ⇣" };
+ int digitGroups = (int) (Math.log10(size) / Math.log10(1024));
+
+ return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups];
+ }
+
+ @SuppressLint({"UnspecifiedImmutableFlag", "LaunchActivityFromNotification"})
+ public static PendingIntent onCreateActionIntent(Context pContext, Class> pBroadcastReciever, int pNotificationID, String pTitle, int pCommandID){
+ PendingIntent pendingIntent;
+ Intent pendingIntentTrigger = new Intent(pContext, pBroadcastReciever);
+ pendingIntentTrigger.setAction(pTitle);
+ pendingIntentTrigger.putExtra("N_ID", pNotificationID);
+ pendingIntentTrigger.putExtra("N_COMMAND", pCommandID);
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ pendingIntent = PendingIntent.getBroadcast(pContext, pNotificationID, pendingIntentTrigger, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
+ }else{
+ pendingIntent = PendingIntent.getBroadcast(pContext, pNotificationID, pendingIntentTrigger, PendingIntent.FLAG_UPDATE_CURRENT);
+ }
+
+ return pendingIntent;
+ }
+
public static int getResId(String resName, Class> c) {
try {
@@ -129,6 +166,8 @@ public class helperMethod
return data;
}
+
+
public static Object deserialize(byte[] data) throws IOException, ClassNotFoundException {
ByteArrayInputStream in = new ByteArrayInputStream(data);
ObjectInputStream is = new ObjectInputStream(in);
@@ -192,8 +231,36 @@ public class helperMethod
}
}
+ public static void writeToFile(String pFilePath, String content){
+ Writer writer;
+ try {
+ writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(pFilePath), StandardCharsets.UTF_8));
+ writer.write(content);
+ writer.close();
+ } catch (Exception ex) {
+ }
+ }
+
+ public static String readFromFile(String pFilePath){
+ File file = new File(pFilePath);
+ StringBuilder text = new StringBuilder();
+ try {
+ BufferedReader br = new BufferedReader(new FileReader(file));
+ String line;
+ while ((line = br.readLine()) != null) {
+ text.append(line);
+ text.append('\n');
+ }
+ br.close();
+ return text.toString();
+ }
+ catch (IOException e) {
+ return "";
+ }
+ }
+
public static String completeURL(String pURL){
- if(pURL.equals("about:blank")){
+ if(pURL.equals("about:blank") || pURL.equals("about:config")){
return pURL;
}
URL weburl;
@@ -237,7 +304,7 @@ public class helperMethod
return UUID.randomUUID().toString();
}
- public static int createNotificationID(){
+ public static int createUniqueNotificationID(){
Date now = new Date();
int id = Integer.parseInt(new SimpleDateFormat("ddHHmmss", Locale.US).format(now));
return id;
@@ -835,7 +902,7 @@ public class helperMethod
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){
try {
- Uri uri = FileProvider.getUriForFile(context, "com.hiddenservices.genesissearchengine.production.provider", url);
+ Uri uri = FileProvider.getUriForFile(context, "com.hiddenservices.onionservices.provider", url);
Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(url.toString()));
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -846,7 +913,7 @@ public class helperMethod
}
} else{
try {
- Uri uri = FileProvider.getUriForFile(context, "com.hiddenservices.genesissearchengine.production.provider", url);
+ Uri uri = FileProvider.getUriForFile(context, "com.hiddenservices.onionservices.provider", url);
Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(url.toString()));
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
diff --git a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/admobManager.java b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/admobManager.java
deleted file mode 100644
index e69de29b..00000000
diff --git a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/mopubManager.java b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/appLovinManager.java
similarity index 86%
rename from app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/mopubManager.java
rename to app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/appLovinManager.java
index 04da10bf..4c2fc883 100644
--- a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/mopubManager.java
+++ b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/appLovinManager.java
@@ -12,20 +12,20 @@ import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import java.lang.ref.WeakReference;
import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_LOAD;
-public class mopubManager implements MaxAdViewAdListener
+public class appLovinManager implements MaxAdViewAdListener
{
/*Private Variables */
private eventObserver.eventListener mEvent;
private WeakReference mBannerAds;
- private int mRequestCount = 0;
+ private int mRequestCount = 0;
private boolean bannerAdsLoaded = false;
private boolean bannerAdRequested = false;
/*Initializations*/
- public mopubManager(eventObserver.eventListener pEvent, MaxAdView pBannerAds, Context pContext) {
+ public appLovinManager(eventObserver.eventListener pEvent, MaxAdView pBannerAds, Context pContext) {
this.mEvent = pEvent;
this.mBannerAds = new WeakReference(pBannerAds);
initializeBannerAds(pContext);
@@ -33,10 +33,8 @@ public class mopubManager implements MaxAdViewAdListener
private void initializeBannerAds(Context pContext){
AdSettings.setDataProcessingOptions( new String[] {} );
-
AppLovinSdk.getInstance( pContext ).setMediationProvider( "max" );
- AppLovinSdk.initializeSdk( pContext, configuration -> {
- });
+ AppLovinSdk.initializeSdk( pContext, configuration -> {});
}
/*Local Helper Methods*/
@@ -53,19 +51,7 @@ public class mopubManager implements MaxAdViewAdListener
return bannerAdsLoaded;
}
- /*External Triggers*/
-
- public Object onTrigger(pluginEnums.eAdManager pEventType) {
- if(pEventType.equals(pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS))
- {
- // loadAds();
- }
- else if(pEventType.equals(pluginEnums.eAdManager.M_IS_ADVERT_LOADED))
- {
- return isAdvertLoaded();
- }
- return null;
- }
+ /* Overriden Methods */
@Override
public void onAdExpanded(MaxAd ad) {
@@ -115,5 +101,20 @@ public class mopubManager implements MaxAdViewAdListener
public void onAdDisplayFailed(MaxAd ad, MaxError error) {
}
+
+ /*External Triggers*/
+
+ public Object onTrigger(pluginEnums.eAdManager pEventType) {
+ if(pEventType.equals(pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS))
+ {
+ loadAds();
+ }
+ else if(pEventType.equals(pluginEnums.eAdManager.M_IS_ADVERT_LOADED))
+ {
+ return isAdvertLoaded();
+ }
+ return null;
+ }
+
}
diff --git a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/facebookAdsManager.java b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/facebookAdsManager.java
deleted file mode 100644
index 1a9d1570..00000000
--- a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/facebookAdsManager.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.hiddenservices.onionservices.pluginManager.adPluginManager;
-
-import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_CLICK;
-import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_LOAD;
-import android.widget.LinearLayout;
-import androidx.appcompat.app.AppCompatActivity;
-import com.hiddenservices.onionservices.eventObserver;
-import com.hiddenservices.onionservices.pluginManager.pluginEnums;
-import com.facebook.ads.*;
-import java.lang.ref.WeakReference;
-
-public class facebookAdsManager implements AdListener {
-
- /*Private Variables */
-
- private eventObserver.eventListener mEvent;
- private WeakReference mBannerAds;
- private AdView adView;
-
- private boolean bannerAdsLoaded = false;
-
- /*Initializations*/
-
- public facebookAdsManager(eventObserver.eventListener pEvent, LinearLayout pBannerAds, AppCompatActivity pContext) {
- this.mEvent = pEvent;
- this.mBannerAds = new WeakReference(pBannerAds);
- loadAds(pContext, pBannerAds);
- }
-
- /*Local Overrides*/
- @Override
- public void onError(Ad ad, AdError adError) {
- }
-
- @Override
- public void onAdLoaded(Ad ad) {
- bannerAdsLoaded = true;
- mEvent.invokeObserver(null, M_ON_AD_LOAD);
- }
-
- @Override
- public void onAdClicked(Ad ad) {
- mEvent.invokeObserver(null, M_ON_AD_CLICK);
- }
-
- @Override
- public void onLoggingImpression(Ad ad) {
- }
-
-
- /*Local Helper Methods*/
-
- private void loadAds(AppCompatActivity pContext, LinearLayout pLinearLayout){
- AudienceNetworkAds.initialize(pContext);
- adView = new AdView(pContext, "IMG_16_9_APP_INSTALL#YOUR_PLACEMENT_ID", AdSize.BANNER_HEIGHT_50);
- pLinearLayout.addView(adView);
- adView.loadAd(adView.buildLoadAdConfig().withAdListener(this).build());
- }
-
-
- private boolean isAdvertLoaded(){
- return bannerAdsLoaded;
- }
-
- private void onDestroy(){
- adView.destroy();
- }
-
- /*External Triggers*/
-
- public Object onTrigger(pluginEnums.eAdManager pEventType) {
- if(pEventType.equals(pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS))
- {
- }
- else if(pEventType.equals(pluginEnums.eAdManager.M_IS_ADVERT_LOADED))
- {
- return isAdvertLoaded();
- }
- else if(pEventType.equals(pluginEnums.eAdManager.M_DESTROY))
- {
- onDestroy();
- }
- return null;
- }
-}
diff --git a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/downloadPluginManager/blobDownloader.java b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/downloadPluginManager/blobDownloader.java
index 9d5b267f..adf5898a 100644
--- a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/downloadPluginManager/blobDownloader.java
+++ b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/downloadPluginManager/blobDownloader.java
@@ -16,16 +16,17 @@ import java.util.Date;
public class blobDownloader {
- private Context context;
- private NotificationManager nm;
+ private Context mContext;
+ private NotificationManager mNotificationManager;
public blobDownloader(Context context) {
- this.context = context;
+ this.mContext = context;
}
@JavascriptInterface
public void getBase64FromBlobData(String base64Data) throws IOException {
convertBase64StringToPdfAndStoreIt(base64Data);
}
+
public static String getBase64StringFromBlobUrl(String blobUrl){
if(blobUrl.startsWith("blob")){
return "javascript: var xhr = new XMLHttpRequest();" +
@@ -60,18 +61,18 @@ public class blobDownloader {
os.flush();
if(dwldsPath.exists()) {
- NotificationCompat.Builder b = new NotificationCompat.Builder(context, "MY_DL")
+ NotificationCompat.Builder b = new NotificationCompat.Builder(mContext, "MY_DL")
.setDefaults(NotificationCompat.DEFAULT_ALL)
.setWhen(System.currentTimeMillis())
.setSmallIcon(R.xml.ic_download)
- .setContentTitle("MY TITLE")
- .setContentText("MY TEXT CONTENT");
- nm = (NotificationManager) this.context.getSystemService(Context.NOTIFICATION_SERVICE);
- if(nm != null) {
- nm.notify(notificationId, b.build());
+ .setContentTitle("IMAGE_TITLE")
+ .setContentText("IMAGE_CONTENT");
+ mNotificationManager = (NotificationManager) this.mContext.getSystemService(Context.NOTIFICATION_SERVICE);
+ if(mNotificationManager != null) {
+ mNotificationManager.notify(notificationId, b.build());
Handler h = new Handler();
long delayInMilliseconds = 5000;
- h.postDelayed(() -> nm.cancel(notificationId), delayInMilliseconds);
+ h.postDelayed(() -> mNotificationManager.cancel(notificationId), delayInMilliseconds);
}
}
}
diff --git a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/downloadPluginManager/downloadManager.java b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/downloadPluginManager/downloadManager.java
index f64f1137..39e04ea1 100644
--- a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/downloadPluginManager/downloadManager.java
+++ b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/downloadPluginManager/downloadManager.java
@@ -3,15 +3,11 @@ package com.hiddenservices.onionservices.pluginManager.downloadPluginManager;
import android.app.NotificationManager;
import android.content.Context;
import android.os.Environment;
-
import androidx.appcompat.app.AppCompatActivity;
-
-import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.hiddenservices.onionservices.pluginManager.pluginReciever.downloadNotificationReciever;
-
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.List;
@@ -32,82 +28,62 @@ public class downloadManager
public downloadManager(WeakReference pAppContext, eventObserver.eventListener pEvent){
this.mAppContext = pAppContext;
this.mEvent = pEvent;
-
- initialize();
}
- private void initialize()
- {
+ private void onStartDownload(String pPath, String pFile) {
+ int mNotificationID = helperMethod.createUniqueNotificationID();
+ downloadReciever mFileDownloader = (downloadReciever)new downloadReciever(mAppContext.get(),pPath, pFile, mNotificationID, mEvent, downloadNotificationReciever.class).execute(pPath);
+ mDownloads.put(mNotificationID,mFileDownloader);
}
- private void startDownload(String pPath,String pFile) {
- int mID = helperMethod.createNotificationID();
- downloadReciever mFileDownloader = (downloadReciever)new downloadReciever(mAppContext.get().getApplicationContext(),pPath, pFile, mID, mEvent, downloadNotificationReciever.class).execute(pPath);
- mDownloads.put(mID,mFileDownloader);
- }
-
- private void cancelDownload(int pID) {
+ private void onCancelDownload(int pID) {
if(mDownloads!=null && mDownloads.containsKey(pID)){
downloadReciever mReciever = mDownloads.get(pID);
if(mReciever!=null){
mDownloads.get(pID).onCancel();
}else {
- try {
- if(!status.sSettingIsAppRunning){
- NotificationManager notificationManager = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
- notificationManager.cancelAll();
- }
- }catch (Exception ignored){}
+ NotificationManager notificationManager = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
+ notificationManager.cancelAll();
}
}
}
- private void onSwipeDownload(int pID) {
- if(mDownloads!=null && mDownloads.get(pID)!=null){
- mDownloads.get(pID).onCancel();
- }
- }
-
- private void onTriggerDownload(int pID) {
+ private void onDownloadURLRequest(int pID) {
if(mDownloads!=null && mDownloads.get(pID)!=null){
mDownloads.get(pID).onTrigger();
}
}
- private void onStartSercvice(String mURL, String mPath){
- mAppContext.get().startService(downloadService.getDownloadService(mAppContext.get().getApplicationContext(), mURL + "__" + mPath, Environment.DIRECTORY_DOWNLOADS));
+ private void onDownloadWebRequest(String mURL, String mPath){
+ mAppContext.get().startService(downloadService.getDownloadService(mAppContext.get().getApplicationContext(), mURL, mPath));
}
- private String downloadBlob(String pURL){
+ private String onDownloadBlobFile(String pURL){
return blobDownloader.getBase64StringFromBlobUrl(pURL);
}
/* External Triggers */
public Object onTrigger(List