Bug Fixes

Bug Fixes
master
Abdul Mannan Saeed 2023-02-09 12:55:22 +05:00
parent 617083f48f
commit faac9cd676
105 changed files with 2873 additions and 2983 deletions

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\msman\.android\avd\Nexus_6P_API_33.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-02-07T21:45:12.561778Z" />
</component>
</project>

View File

@ -1,3 +1,3 @@
#Sat Feb 04 14:33:30 PKT 2023
#Thu Feb 09 03:08:42 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=2027486056
json=-1378969876

View File

@ -1,5 +1,5 @@
#
#Sat Feb 04 14:33:30 PKT 2023
#Thu Feb 09 03:08:42 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

View File

@ -3,15 +3,14 @@ import com.android.build.OutputFile
plugins {
id "com.jetbrains.python.envs" version "0.0.26"
}
apply plugin: 'com.android.application'
apply from: 'variables.gradle'
apply plugin: 'kotlin-android'
apply plugin: 'applovin-quality-service'
applovin {
apiKey "pCPe4EeU2ZQVwQPeHLgseRqHBX1V5pvo9Piuu4J809dRhadEgukXa1A8po_UeXu5hmPOTaP1v4QPaMKIEOhh50"
}
applovin {
apiKey project.ext.applovin_key
}
android {
@ -30,7 +29,7 @@ android {
}
}
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = project.ext.jvmTarget
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
@ -76,7 +75,7 @@ android {
orionRelease.root = project.ext.releaseRoot
}
namespace 'com.example.myapplication'
namespace project.ext.application_id
}
dependencies {
@ -105,7 +104,7 @@ dependencies {
/* Ads Manager */
implementation 'com.applovin:applovin-sdk:11.7.0'
implementation 'com.facebook.android:audience-network-sdk:6.10.0'
implementation 'com.facebook.android:audience-network-sdk:6.12.0'
implementation 'com.applovin.mediation:facebook-adapter:6.12.0.1'
/* Orbot Service */

View File

@ -1,3 +1 @@
#Contains API Secret used to validate your application. Commit to internal source control; avoid making secret public.
#Wed May 01 00:42:45 PKT 2019
apiSecret=042501af0b2390b9f064ff9a0823e52a2dd04b2280c9b675925cebbb9620ecbf

View File

@ -1,35 +1,32 @@
-keep,includedescriptorclasses class net.sqlcipher.** { *; }
-keep,includedescriptorclasses interface net.sqlcipher.** { *; }
-keep class org.mozilla.** {*;}
-keep class com.flurry.** { *; }
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-keepattributes Signature
-keepattributes Annotation
-keepattributes *Annotation*,EnclosingMethod,Signature
-keepclasseswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet, int); }
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
-dontwarn javax.annotation.**
-dontwarn org.codehaus.mojo.animal_sniffer.*
-dontwarn okhttp3.internal.platform.ConscryptPlatform
-dontwarn org.conscrypt.ConscryptHostnameVerifier
-dontwarn okhttp3.*
-dontwarn org.chromium.net.*
-keep class org.mozilla.** {*;}
-keep class com.flurry.** { *; }
-dontwarn com.flurry.**
-keepattributes *Annotation*,EnclosingMethod,Signature
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-dontobfuscate
# https://stackoverflow.com/questions/9651703/using-proguard-with-android-without-obfuscation
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
-keep class org.orbotproject.android.service.vpn.Tun2Socks {
void logTun2Socks(java.lang.String, java.lang.String, java.lang.String);
}
-keepattributes Signature
-keepattributes Annotation
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
-dontwarn okio.**
-dontobfuscate
-dontoptimize
-dontpreverify
# -dontwarn okhttp3.internal.platform.ConscryptPlatform
# -dontwarn org.conscrypt.ConscryptHostnameVerifier
# -keep class org.orbotproject.android.service.vpn.Tun2Socks {
# void logTun2Socks(java.lang.String, java.lang.String, java.lang.String);
# }

View File

@ -4,7 +4,7 @@ import static com.hiddenservices.onionservices.constants.constants.CONST_PACKAGE
import android.content.Context;
import androidx.appcompat.app.AppCompatActivity;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.appManager.bookmarkManager.bookmarkHome.bookmarkController;
import com.hiddenservices.onionservices.appManager.bridgeManager.bridgeController;
import com.hiddenservices.onionservices.appManager.historyManager.historyController;

View File

@ -8,7 +8,7 @@ import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.widget.ProgressBar;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.eventObserver;
import java.util.Collections;

View File

@ -6,7 +6,7 @@ import android.widget.ProgressBar;
import androidx.appcompat.app.AppCompatActivity;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.sharedUIMethod;

View File

@ -15,11 +15,12 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.dataManager.models.bookmarkRowModel;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.ArrayList;
import java.util.Arrays;
@ -446,10 +447,12 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
mDescription.setText("https://" + mDescription.getText().toString());
}
if (model.getDescription().contains("167.86.99.31") || model.getDescription().contains("orion.onion")) {
mFaviconLogo.setImageDrawable(itemView.getResources().getDrawable(R.drawable.genesis));
} else {
mEvent.invokeObserver(Arrays.asList(mFaviconLogo, "http://" + helperMethod.getDomainName(model.getDescription())), enums.etype.fetch_favicon);
if(status.sLowMemory != enums.MemoryStatus.LOW_MEMORY && status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY){
if (model.getDescription().contains("167.86.99.31") || model.getDescription().contains("orion.onion")) {
mFaviconLogo.setImageDrawable(itemView.getResources().getDrawable(R.drawable.genesis));
} else {
mEvent.invokeObserver(Arrays.asList(mFaviconLogo, "https://" + helperMethod.getDomainName(model.getDescription())), enums.etype.fetch_favicon);
}
}
mRowMenu.setOnClickListener(this::onClick);

View File

@ -12,7 +12,7 @@ import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.List;

View File

@ -43,7 +43,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.ArrayList;
import java.util.Arrays;

View File

@ -30,7 +30,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.List;
import java.util.Objects;

View File

@ -20,7 +20,7 @@ import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.sharedUIMethod;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.Arrays;
import java.util.Collections;

View File

@ -8,7 +8,7 @@ import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.helperManager.sharedUIMethod;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.List;

View File

@ -25,7 +25,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.Arrays;
import java.util.Collections;

View File

@ -17,7 +17,7 @@ import androidx.core.content.ContextCompat;
import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.helperManager.sharedUIMethod;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.List;

View File

@ -13,7 +13,7 @@ import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.dataManager.dataController;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;

View File

@ -10,7 +10,7 @@ import android.os.Handler;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.appManager.advertManager.advertController;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeController;

View File

@ -16,7 +16,7 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.ArrayList;
import java.util.List;

View File

@ -25,7 +25,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.ArrayList;
import java.util.Collections;

View File

@ -14,7 +14,7 @@ import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.List;

View File

@ -21,7 +21,7 @@ import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.dataManager.models.historyRowModel;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import java.util.ArrayList;
@ -517,7 +517,7 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
mWebLogo.setText((helperMethod.getDomainName(model.getHeader()).toUpperCase().charAt(0) + ""));
String header = model.getHeader();
if(status.sLowMemory == enums.MemoryStatus.STABLE){
if(status.sLowMemory != enums.MemoryStatus.LOW_MEMORY && status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY){
if (model.getDescription().contains("167.86.99.31") || model.getDescription().contains("orion.onion")) {
mFaviconLogo.setImageDrawable(itemView.getResources().getDrawable(R.drawable.genesis));
} else {

View File

@ -12,7 +12,7 @@ import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.List;

View File

@ -41,7 +41,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.ArrayList;
import java.util.Arrays;

View File

@ -30,7 +30,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.List;
import java.util.Objects;

View File

@ -1,56 +0,0 @@
# 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

View File

@ -0,0 +1,13 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.dataModel;
public class geckoDataModel {
public int mCurrentURL_ID = -1;
public boolean mFullScreenStatus = false;
public boolean mThemeChanged = false;
public String mCurrentURL = "about:blank";
public String mTheme = null;
public String mSessionID;
public String mCurrentTitle = "loading";
}

View File

@ -0,0 +1,57 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.RectF;
import android.view.autofill.AutofillManager;
import androidx.annotation.NonNull;
import org.mozilla.geckoview.Autofill;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.GeckoView;
public class autofillDelegate implements Autofill.Delegate {
private GeckoView mGeckoView;
public autofillDelegate(GeckoView pGeckoView){
mGeckoView = pGeckoView;
}
private Rect displayRectForId(@NonNull final GeckoSession session, @NonNull final Autofill.Node node) {
final Matrix matrix = new Matrix();
final RectF rectF = new RectF(node.getDimensions());
session.getPageToScreenMatrix(matrix);
matrix.mapRect(rectF);
final Rect screenRect = new Rect();
rectF.roundOut(screenRect);
return screenRect;
}
@Override
public void onNodeUpdate(@NonNull final GeckoSession session, @NonNull final Autofill.Node node, @NonNull final Autofill.NodeData data) {
final AutofillManager manager;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
manager = mGeckoView.getContext().getSystemService(AutofillManager.class);
if (manager == null) {
return;
}
manager.notifyViewEntered(mGeckoView, data.getId(),displayRectForId(session, node));
}
}
@Override
public void onNodeFocus(@NonNull final GeckoSession session, @NonNull final Autofill.Node node, @NonNull final Autofill.NodeData data) {
final AutofillManager manager;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
manager = mGeckoView.getContext().getSystemService(AutofillManager.class);
if (manager == null) {
return;
}
manager.notifyViewEntered(mGeckoView, data.getId(),displayRectForId(session, node));
}
}
}

View File

@ -0,0 +1,218 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_HELP_URL_CACHE;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_HELP_URL_CACHE_DARK;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_URL_CACHED;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_URL_CACHED_DARK;
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 android.content.ActivityNotFoundException;
import android.os.Handler;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.dataModel.geckoDataModel;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoDownloadManager;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession;
import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import org.json.JSONObject;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.WebResponse;
import java.lang.ref.WeakReference;
import java.util.Arrays;
public class contentDelegate implements GeckoSession.ContentDelegate {
/*Private Variables*/
private WeakReference<AppCompatActivity> mContext;
private eventObserver.eventListener mEvent;
private geckoDataModel mGeckoDataModel;
private geckoSession mGeckoSession;
private geckoDownloadManager mDownloadManager;
private int mCrashCount = 0;
/*Initializations*/
public contentDelegate(WeakReference<AppCompatActivity> pContext, eventObserver.eventListener pEvent, geckoDataModel pGeckoDataModel, geckoSession pGeckoSession) {
this.mContext = pContext;
this.mEvent = pEvent;
this.mGeckoDataModel = pGeckoDataModel;
this.mGeckoSession = pGeckoSession;
mDownloadManager = new geckoDownloadManager();
}
/*Local Listeners*/
@UiThread
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")) {
mGeckoDataModel.mCurrentTitle = var2;
}
}
@Override
public void onFullScreen(@NonNull GeckoSession var1, boolean var2) {
mGeckoDataModel.mFullScreenStatus = var2;
mEvent.invokeObserver(Arrays.asList(var2, mGeckoDataModel.mSessionID), enums.etype.ON_FULL_SCREEN);
}
@UiThread
@Override
public void onContextMenu(@NonNull GeckoSession var1, int var2, int var3, @NonNull GeckoSession.ContentDelegate.ContextElement var4) {
String title = strings.GENERIC_EMPTY_STR;
if (var4.title != null) {
title = var4.title;
}
if (var4.type != 0 && var4.srcUri != null) {
if (var4.linkUri != null) {
mEvent.invokeObserver(Arrays.asList(var4.linkUri, mGeckoDataModel.mSessionID, var4.srcUri, title, mGeckoDataModel.mTheme, var4.altText, mGeckoSession, mContext.get()), M_LONG_PRESS_WITH_LINK);
} else {
try {
String mTitle = var4.title;
if (mTitle == null || mTitle.length() <= 0) {
mTitle = helperMethod.getDomainName(mGeckoDataModel.mCurrentURL) + "\n" + var4.srcUri;
}
mEvent.invokeObserver(Arrays.asList(var4.srcUri, mGeckoDataModel.mSessionID, mTitle, mGeckoDataModel.mTheme, mGeckoSession, mContext.get()), enums.etype.on_long_press);
} catch (Exception ex) {
ex.printStackTrace();
Log.i("", "");
}
}
} else if (var4.linkUri != null) {
mEvent.invokeObserver(Arrays.asList(var4.linkUri, mGeckoDataModel.mSessionID, title, mGeckoDataModel.mTheme, mGeckoSession, mContext.get()), M_LONG_PRESS_URL);
}
}
@UiThread
@Override
public void onExternalResponse(@NonNull GeckoSession session, @NonNull WebResponse response) {
try {
if (response.headers.containsKey("Content-Disposition")) {
mDownloadManager.downloadFile(response, mGeckoSession, mContext.get(), mEvent);
} else if (response.headers.containsKey("Content-Type")) {
mDownloadManager.downloadFile(response, mGeckoSession, mContext.get(), mEvent);
}
} catch (ActivityNotFoundException e) {
mEvent.invokeObserver(Arrays.asList(response, mGeckoDataModel.mSessionID), enums.etype.on_handle_external_intent);
mGeckoSession.stop();
}
}
@UiThread
public void onFirstContentfulPaint(@NonNull GeckoSession var1) {
if (mGeckoDataModel.mCurrentURL.contains("167.86.99.31") || mGeckoDataModel.mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED) || mGeckoDataModel.mCurrentURL.startsWith(CONST_GENESIS_URL_CACHED_DARK) || mGeckoDataModel.mCurrentURL.startsWith(CONST_GENESIS_HELP_URL_CACHE) || mGeckoDataModel.mCurrentURL.startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, false), enums.etype.M_ON_BANNER_UPDATE);
} else {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, true), enums.etype.M_ON_BANNER_UPDATE);
}
if (!mGeckoDataModel.mCurrentURL.equals("about:blank")) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), enums.etype.ON_FIRST_PAINT);
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), enums.etype.ON_LOAD_REQUEST);
}
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mTheme), enums.etype.ON_EXPAND_TOP_BAR);
}
@UiThread
public void onWebAppManifest(@NonNull GeckoSession var1, @NonNull JSONObject var2) {
try {
mGeckoDataModel.mThemeChanged = true;
mGeckoDataModel.mTheme = var2.getString("theme_color");
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mTheme), enums.etype.ON_UPDATE_THEME);
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL,mGeckoDataModel.mSessionID,mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), enums.etype.M_INDEX_WEBSITE);
} catch (Exception ex) {
mGeckoDataModel.mTheme = null;
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mTheme), enums.etype.ON_UPDATE_THEME);
ex.printStackTrace();
}
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), enums.etype.ON_UPDATE_TAB_TITLE);
}
@UiThread
public void onCrash(@NonNull GeckoSession session) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, mGeckoSession), enums.etype.ON_DESTROY_MEDIA);
if (!mGeckoSession.isClosed() && status.sSettingIsAppStarted) {
if (mEvent == null) {
return;
}
Object mSessionObject = mEvent.invokeObserver(null, enums.etype.SESSION_ID);
if (mSessionObject == null || mGeckoDataModel.mSessionID == null) {
return;
}
String mSessionID = (String) mSessionObject;
if (mSessionID.equals(mGeckoDataModel.mSessionID)) {
if (mCrashCount <= 5) {
final Handler handler = new Handler();
handler.postDelayed(() -> {
try {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, this), enums.etype.M_OPEN_SESSION);
} catch (Exception ignored) {
}
}, mCrashCount * 500L);
}
mCrashCount += 1;
}
}
}
@UiThread
public void onKill(@NonNull GeckoSession session) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, mGeckoSession), enums.etype.ON_DESTROY_MEDIA);
if (!mGeckoSession.isClosed() && status.sSettingIsAppStarted) {
if (mEvent == null) {
return;
}
Object mSessionObject = mEvent.invokeObserver(null, enums.etype.SESSION_ID);
if (mSessionObject == null || mGeckoDataModel.mSessionID == null) {
return;
}
String mSessionID = (String) mSessionObject;
if (mSessionID.equals(mGeckoDataModel.mSessionID)) {
if (mCrashCount <= 5) {
final Handler handler = new Handler();
handler.postDelayed(() -> {
if (status.sSettingIsAppStarted && !session.isOpen()) {
try {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, this), enums.etype.M_OPEN_SESSION);
} catch (Exception ignored) {
}
}
}, mCrashCount * 500L);
}
mCrashCount += 1;
}
}
}
/*Local Triggers*/
public boolean getFullScreenStatus() {
return !mGeckoDataModel.mFullScreenStatus;
}
public void resetCrash() {
mCrashCount = 0;
}
public geckoDownloadManager getDownloadManager(){
return this.mDownloadManager;
}
}

View File

@ -0,0 +1,76 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel;
import androidx.annotation.NonNull;
import androidx.annotation.UiThread;
import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.dataModel.geckoDataModel;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.helperClasses.intentHandler;
import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import org.mozilla.geckoview.GeckoSession;
import java.lang.ref.WeakReference;
import java.util.Arrays;
public class historyDelegate implements GeckoSession.HistoryDelegate {
/*Private Variables*/
private WeakReference<AppCompatActivity> mContext;
private GeckoSession.HistoryDelegate.HistoryList mHistory = null;
private eventObserver.eventListener mEvent;
private geckoDataModel mGeckoDataModel;
private geckoSession mGeckoSession;
private int mCurrentIndex = 0;
/*Initializations*/
public historyDelegate(WeakReference<AppCompatActivity> pContext, eventObserver.eventListener pEvent, geckoDataModel pGeckoDataModel, geckoSession pGeckoSession) {
this.mContext = pContext;
this.mEvent = pEvent;
this.mGeckoDataModel = pGeckoDataModel;
this.mGeckoSession = pGeckoSession;
}
@UiThread
public void onHistoryStateChange(@NonNull GeckoSession var1, @NonNull GeckoSession.HistoryDelegate.HistoryList var2) {
mHistory = var2;
if(mHistory !=null){
setURL(mHistory.get(mHistory.getCurrentIndex()).getUri());
mEvent.invokeObserver(Arrays.asList(mHistory, mGeckoDataModel.mSessionID), enums.etype.on_url_load);
if(mCurrentIndex != var2.getCurrentIndex()){
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mHistory.get(mHistory.getCurrentIndex()).getTitle(), mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, mGeckoSession), enums.etype.ON_UPDATE_SEARCH_BAR);
}
Object mID = mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mHistory.get(mHistory.getCurrentIndex()).getTitle(), -1, mGeckoDataModel.mTheme, mGeckoSession, false), enums.etype.ON_UPDATE_HISTORY);
if (mID != null) {
mGeckoDataModel.mCurrentURL_ID = (int) mID;
}
}
mCurrentIndex = var2.getCurrentIndex();
}
/*Local Triggers*/
public void setURL(String pURL) {
if (helperMethod.getHost(pURL).endsWith(".onion")) {
pURL = pURL.replace("www.", "");
}
this.mGeckoDataModel.mCurrentURL = pURL;
if(pURL.startsWith("tel:")){
intentHandler.actionDial(pURL, mContext);
}
}
public boolean isHistoryEmpty(){
if(mHistory!=null && mHistory.size()>0){
return false;
}else {
return true;
}
}
}

View File

@ -1,126 +1,136 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager;
import static android.content.Context.NOTIFICATION_SERVICE;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Build;
import android.widget.RemoteViews;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.pluginManager.pluginReciever.mediaNotificationReciever;
import org.mozilla.geckoview.GeckoSession;
public class mediaDelegate implements GeckoSession.MediaDelegate {
private Context mContext;
public mediaDelegate(Activity activity, Context pContext) {
mContext = pContext;
}
public void onHideDefaultNotification(){
NotificationManagerCompat.from(mContext).cancel(1030);
}
public void showNotification(Context context, String title, String url, Bitmap mediaImage, boolean not_status) {
NotificationManager mNotificationManager = (NotificationManager) mContext.getSystemService( NOTIFICATION_SERVICE ) ;
if(title.length()<=0 || !status.sBackgroundMusic){
return;
}
RemoteViews contentView;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ) {
contentView = new RemoteViews(context.getPackageName() , R.layout. media_notification_no_background ) ;
}else if (android.os.Build.VERSION. SDK_INT > Build.VERSION_CODES.N_MR1){
contentView = new RemoteViews(context.getPackageName() , R.layout. media_notification_layout ) ;
}else {
contentView = new RemoteViews(context.getPackageName() , R.layout. media_notification_layout_small ) ;
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S ) {
contentView.setInt(R.id.layout,"setBackgroundResource", R.color.c_tab_background);
}
contentView.setTextViewText(R.id.header, title);
contentView.setTextViewText(R.id.body, "☍ " + url);
try {
contentView.setImageViewBitmap(R.id.logo, mediaImage);
} catch (Throwable e) {
e.printStackTrace();
}
if (not_status){
PendingIntent pIntent = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, 1030, "media_play", 0);
contentView.setOnClickPendingIntent(R.id.trigger, pIntent);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ) {
contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_play_arrow_no_tint);
}else {
contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_play_arrow);
}
}else {
PendingIntent pIntent = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, 1030, "media_pause", 1);
contentView.setOnClickPendingIntent(R.id.trigger, pIntent);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ) {
contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_pause_no_tint);
}else {
contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_pause);
}
}
PendingIntent pIntentPrev = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, 1030, "media_next", 2);
contentView.setOnClickPendingIntent(R.id.next, pIntentPrev);
if(android.os.Build.VERSION. SDK_INT > Build.VERSION_CODES.N){
PendingIntent pIntentNext = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, 1030, "media_back", 3);
contentView.setOnClickPendingIntent(R.id.back, pIntentNext);
}
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mContext, "1030" ) ;
mBuilder.setPriority(Notification.PRIORITY_LOW);
mBuilder.setAutoCancel(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S){
mBuilder.setCustomBigContentView(contentView);
mBuilder.setStyle(new NotificationCompat.DecoratedCustomViewStyle());
}else {
mBuilder.setContent(contentView);
}
mBuilder.setSmallIcon(R.drawable.ic_baseline_media) ;
mBuilder.setAutoCancel( true ) ;
if (android.os.Build.VERSION. SDK_INT >= android.os.Build.VERSION_CODES. O ) {
int importance = NotificationManager.IMPORTANCE_LOW ;
NotificationChannel notificationChannel = new NotificationChannel( "1030" , "NOTIFICATION_CHANNEL_NAME" , importance) ;
notificationChannel.setSound(null, null);
mBuilder.setChannelId("1030") ;
assert mNotificationManager != null;
mNotificationManager.createNotificationChannel(notificationChannel) ;
}
Notification notification = mBuilder.build();
mBuilder.setContentIntent(PendingIntent.getActivity(context, 1030, new Intent(context, mediaDelegate.class), PendingIntent.FLAG_IMMUTABLE));
PendingIntent dummyIntent = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
PendingIntent.getActivity(context, 1030, new Intent(), PendingIntent.FLAG_IMMUTABLE);
}else {
PendingIntent.getActivity(context, 1030, new Intent(), 0);
}
notification.fullScreenIntent = dummyIntent;
if(!not_status){
notification.flags |= Notification.FLAG_NO_CLEAR;
}
notification.defaults = 0;
mNotificationManager.notify(1030 , notification) ;
}
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel;
import static android.content.Context.NOTIFICATION_SERVICE;
import android.annotation.SuppressLint;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Build;
import android.widget.RemoteViews;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.pluginManager.pluginReciever.mediaNotificationReciever;
import org.mozilla.geckoview.GeckoSession;
import java.lang.ref.WeakReference;
public class mediaDelegate implements GeckoSession.MediaDelegate {
/*Private Variables*/
private WeakReference<AppCompatActivity> mContext;
private static int S_NOTIFICATION_ID = 1030;
private static String S_NOTIFICATION_CHANNEL_ID = "1030";
private static String S_NOTIFICATION_CHANNEL_NAME = "MEDIA_NOTIFICATION";
/*Initializations*/
public mediaDelegate(WeakReference<AppCompatActivity> pContext) {
mContext = pContext;
}
public void onHideDefaultNotification(){
NotificationManagerCompat.from(mContext.get()).cancel(S_NOTIFICATION_ID);
}
/*Triggers*/
@SuppressLint("InlinedApi")
public void showNotification(Context context, String title, String url, Bitmap mediaImage, boolean media_status) {
NotificationManager mNotificationManager = (NotificationManager) mContext.get().getSystemService( NOTIFICATION_SERVICE ) ;
if(title.length()<=0 || !status.sBackgroundMusic){
return;
}
RemoteViews contentView;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ) {
contentView = new RemoteViews(context.getPackageName() , R.layout. media_notification_no_background ) ;
}else if (android.os.Build.VERSION. SDK_INT > Build.VERSION_CODES.N_MR1){
contentView = new RemoteViews(context.getPackageName() , R.layout. media_notification_layout ) ;
}else {
contentView = new RemoteViews(context.getPackageName() , R.layout. media_notification_layout_small ) ;
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S ) {
contentView.setInt(R.id.layout,"setBackgroundResource", R.color.c_tab_background);
}
contentView.setTextViewText(R.id.header, title);
contentView.setTextViewText(R.id.body, "☍ " + url);
try {
contentView.setImageViewBitmap(R.id.logo, mediaImage);
} catch (Throwable e) {
e.printStackTrace();
}
if (!media_status){
PendingIntent pIntent = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, S_NOTIFICATION_ID, "media_play", 0);
contentView.setOnClickPendingIntent(R.id.trigger, pIntent);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ) {
contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_play_arrow_no_tint);
}else {
contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_play_arrow);
}
}else {
PendingIntent pIntent = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, S_NOTIFICATION_ID, "media_pause", 1);
contentView.setOnClickPendingIntent(R.id.trigger, pIntent);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ) {
contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_pause_no_tint);
}else {
contentView.setImageViewResource(R.id.trigger, R.drawable.ic_baseline_pause);
}
}
PendingIntent pIntentPrev = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, S_NOTIFICATION_ID, "media_next", 2);
contentView.setOnClickPendingIntent(R.id.next, pIntentPrev);
if(android.os.Build.VERSION. SDK_INT > Build.VERSION_CODES.N){
PendingIntent pIntentNext = helperMethod.onCreateActionIntent(context, mediaNotificationReciever.class, S_NOTIFICATION_ID, "media_back", 3);
contentView.setOnClickPendingIntent(R.id.back, pIntentNext);
}
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mContext.get(), S_NOTIFICATION_CHANNEL_ID ) ;
mBuilder.setPriority(Notification.PRIORITY_LOW);
mBuilder.setAutoCancel(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S){
mBuilder.setCustomBigContentView(contentView);
mBuilder.setStyle(new NotificationCompat.DecoratedCustomViewStyle());
}else {
mBuilder.setContent(contentView);
}
mBuilder.setSmallIcon(R.drawable.ic_baseline_media) ;
mBuilder.setAutoCancel( true ) ;
if (android.os.Build.VERSION. SDK_INT >= android.os.Build.VERSION_CODES. O ) {
int importance = NotificationManager.IMPORTANCE_LOW ;
NotificationChannel notificationChannel = new NotificationChannel( S_NOTIFICATION_CHANNEL_ID , S_NOTIFICATION_CHANNEL_NAME , importance) ;
notificationChannel.setSound(null, null);
mBuilder.setChannelId(S_NOTIFICATION_CHANNEL_ID) ;
assert mNotificationManager != null;
mNotificationManager.createNotificationChannel(notificationChannel) ;
}
Notification notification = mBuilder.build();
mBuilder.setContentIntent(PendingIntent.getActivity(context, S_NOTIFICATION_ID, new Intent(context, mediaDelegate.class), PendingIntent.FLAG_IMMUTABLE));
notification.fullScreenIntent = null;
if(media_status){
notification.flags |= Notification.FLAG_NO_CLEAR;
}
notification.defaults = 0;
mNotificationManager.notify(S_NOTIFICATION_ID , notification) ;
}
}

View File

@ -0,0 +1,124 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel;
import static com.hiddenservices.onionservices.constants.strings.GENERIC_EMPTY_STR;
import android.graphics.Bitmap;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.dataModel.geckoDataModel;
import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.MediaSession;
import java.lang.ref.WeakReference;
public class mediaSessionDelegate implements MediaSession.Delegate{
/*Private Variables*/
private MediaSession mMediaSession = null;
private mediaDelegate mMediaDelegate;
private WeakReference<AppCompatActivity> mContext;
private geckoDataModel mGeckoDataModel;
private Bitmap mMediaImage;
private String mMediaTitle = GENERIC_EMPTY_STR;
/*Initializations*/
public mediaSessionDelegate(WeakReference<AppCompatActivity> pContext, geckoDataModel pGeckoDataModel, mediaDelegate pMediaDelegate){
this.mContext = pContext;
this.mMediaDelegate = pMediaDelegate;
this.mGeckoDataModel = pGeckoDataModel;
}
/*Local Listeners*/
@Override
public void onActivated(@NonNull GeckoSession session, @NonNull MediaSession mediaSession) {
MediaSession.Delegate.super.onActivated(session, mediaSession);
mMediaSession = mediaSession;
}
@Override
public void onDeactivated(@NonNull GeckoSession session, @NonNull MediaSession mediaSession) {
MediaSession.Delegate.super.onPause(session, mediaSession);
mMediaDelegate.onHideDefaultNotification();
}
@Override
public void onMetadata(@NonNull GeckoSession session, @NonNull MediaSession mediaSession, @NonNull MediaSession.Metadata meta) {
try {
mMediaTitle = meta.title;
mMediaImage = meta.artwork.getBitmap(250).poll(2500);
mMediaDelegate.showNotification(mContext.get(), mMediaTitle, helperMethod.getHost(mGeckoDataModel.mCurrentURL), mMediaImage, true);
} catch (Throwable e) {
e.printStackTrace();
}
MediaSession.Delegate.super.onMetadata(session, mediaSession, meta);
}
@Override
public void onFeatures(@NonNull GeckoSession session, @NonNull MediaSession mediaSession, long features) {
MediaSession.Delegate.super.onFeatures(session, mediaSession, features);
}
@Override
public void onPlay(@NonNull GeckoSession session, @NonNull MediaSession mediaSession) {
MediaSession.Delegate.super.onPlay(session, mediaSession);
mMediaDelegate.showNotification(this.mContext.get(), mMediaTitle, helperMethod.getHost(mGeckoDataModel.mCurrentURL), mMediaImage, true);
}
@Override
public void onPause(@NonNull GeckoSession session, @NonNull MediaSession mediaSession) {
MediaSession.Delegate.super.onPause(session, mediaSession);
mMediaDelegate.showNotification(this.mContext.get(), mMediaTitle, helperMethod.getHost(mGeckoDataModel.mCurrentURL), mMediaImage, false);
}
@Override
public void onStop(@NonNull GeckoSession session, @NonNull MediaSession mediaSession) {
MediaSession.Delegate.super.onStop(session, mediaSession);
mMediaDelegate.showNotification(this.mContext.get(), mMediaTitle, helperMethod.getHost(mGeckoDataModel.mCurrentURL), mMediaImage, false);
}
@Override
public void onPositionState(@NonNull GeckoSession session, @NonNull MediaSession mediaSession, @NonNull MediaSession.PositionState state) {
MediaSession.Delegate.super.onPositionState(session, mediaSession, state);
}
@Override
public void onFullscreen(@NonNull GeckoSession session, @NonNull MediaSession mediaSession, boolean enabled, @Nullable @org.jetbrains.annotations.Nullable MediaSession.ElementMetadata meta) {
MediaSession.Delegate.super.onFullscreen(session, mediaSession, enabled, meta);
}
/*Triggers*/
public void onTrigger(enums.MediaController pCommands){
if(mMediaSession!=null){
if(pCommands.equals(enums.MediaController.PLAY)){
mMediaDelegate.showNotification(this.mContext.get(), mMediaTitle, helperMethod.getHost(mGeckoDataModel.mCurrentURL), mMediaImage, true);
mMediaSession.play();
}
else if(pCommands.equals(enums.MediaController.PAUSE)){
mMediaDelegate.showNotification(this.mContext.get(), mMediaTitle, helperMethod.getHost(mGeckoDataModel.mCurrentURL), mMediaImage, false);
mMediaSession.pause();
}
else if(pCommands.equals(enums.MediaController.STOP)){
mMediaSession.stop();
}
else if(pCommands.equals(enums.MediaController.DESTROY)){
mMediaSession.stop();
mMediaDelegate.onHideDefaultNotification();
}
else if(pCommands.equals(enums.MediaController.SKIP_BACKWARD)){
mMediaSession.previousTrack();
}
else if(pCommands.equals(enums.MediaController.SKIP_FORWARD)){
mMediaSession.nextTrack();
}
}
}
}

View File

@ -0,0 +1,51 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.UiThread;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.dataModel.geckoDataModel;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession;
import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import org.mozilla.geckoview.GeckoSession;
import java.util.Arrays;
public class scrollDelegate implements GeckoSession.ScrollDelegate {
/*Private Variables*/
private eventObserver.eventListener mEvent;
private geckoDataModel mGeckoDataModel;
private int mScollOffset = 0;
/*Initializations*/
public scrollDelegate(eventObserver.eventListener pEvent, geckoDataModel pGeckoDataModel) {
this.mEvent = pEvent;
this.mGeckoDataModel = pGeckoDataModel;
}
/*Scroll Delegate*/
@UiThread
public void onScrollChanged(@NonNull GeckoSession session, int scrollX, int scrollY) {
Log.i("fucker111 : ", scrollY + "");
mScollOffset = scrollY;
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), enums.etype.M_UPDATE_PIXEL_BACKGROUND);
if (scrollY <= 3) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), enums.etype.M_ON_SCROLL_TOP_BOUNDARIES);
} else if (scrollY <= helperMethod.pxFromDp(30)) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), enums.etype.M_ON_SCROLL_BOUNDARIES);
} else {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme), enums.etype.M_ON_SCROLL_NO_BOUNDARIES);
}
}
public int getScrollOffset() {
return mScollOffset;
}
}

View File

@ -1,473 +1,478 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import android.util.Log;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import com.hiddenservices.onionservices.appManager.activityContextManager;
import org.mozilla.gecko.util.ThreadUtils;
import org.mozilla.geckoview.GeckoSession;
/**
* Class that implements a basic SelectionActionDelegate. This class is used by GeckoView by
* default if the consumer does not explicitly set a SelectionActionDelegate.
* <p>
* To provide custom actions, extend this class and override the following methods,
* <p>
* 1) Override {@link #getAllActions} to include custom action IDs in the returned array. This
* array must include all actions, available or not, and must not change over the class lifetime.
* <p>
* 2) Override {@link #isActionAvailable} to return whether a custom action is currently available.
* <p>
* 3) Override {@link #prepareAction} to set custom title and/or icon for a custom action.
* <p>
* 4) Override {@link #performAction} to perform a custom action when used.
*/
@UiThread
public class selectionActionDelegate implements ActionMode.Callback,
GeckoSession.SelectionActionDelegate {
private static final String LOGTAG = "BasicSelectionAction";
protected static final String ACTION_PROCESS_TEXT = Intent.ACTION_PROCESS_TEXT;
private static final String[] FLOATING_TOOLBAR_ACTIONS = new String[]{
ACTION_CUT, ACTION_COPY, ACTION_PASTE, ACTION_SELECT_ALL, "SEARCH"
};
private static final String[] FIXED_TOOLBAR_ACTIONS = new String[]{
ACTION_SELECT_ALL, ACTION_CUT, ACTION_COPY, ACTION_PASTE, "SEARCH"
};
protected final @NonNull
Activity mActivity;
protected final boolean mUseFloatingToolbar;
protected final @NonNull
Matrix mTempMatrix = new Matrix();
protected final @NonNull
RectF mTempRect = new RectF();
private boolean mFullScreen = false;
private boolean mExternalActionsEnabled;
protected @Nullable
ActionMode mActionMode;
protected @Nullable
GeckoSession mSession;
protected @Nullable
Selection mSelection;
protected boolean mRepopulatedMenu;
public void setFullScreen(boolean pFullScreen) {
mFullScreen = pFullScreen;
}
@TargetApi(Build.VERSION_CODES.M)
private class Callback2Wrapper extends ActionMode.Callback2 {
@Override
public boolean onCreateActionMode(final ActionMode actionMode, final Menu menu) {
return selectionActionDelegate.this.onCreateActionMode(actionMode, menu);
}
@Override
public boolean onPrepareActionMode(final ActionMode actionMode, final Menu menu) {
return selectionActionDelegate.this.onPrepareActionMode(actionMode, menu);
}
@Override
public boolean onActionItemClicked(final ActionMode actionMode, final MenuItem menuItem) {
return selectionActionDelegate.this.onActionItemClicked(actionMode, menuItem);
}
@Override
public void onDestroyActionMode(final ActionMode actionMode) {
selectionActionDelegate.this.onDestroyActionMode(actionMode);
}
@Override
public void onGetContentRect(final ActionMode mode, final View view, final Rect outRect) {
super.onGetContentRect(mode, view, outRect);
selectionActionDelegate.this.onGetContentRect(mode, view, outRect);
}
}
@SuppressWarnings("checkstyle:javadocmethod")
public selectionActionDelegate(final @NonNull Activity activity) {
this(activity, Build.VERSION.SDK_INT >= 23);
}
@SuppressWarnings("checkstyle:javadocmethod")
public selectionActionDelegate(final @NonNull Activity activity,
final boolean useFloatingToolbar) {
mActivity = activity;
mUseFloatingToolbar = useFloatingToolbar;
mExternalActionsEnabled = true;
}
/**
* Set whether to include text actions from other apps in the floating toolbar.
*
* @param enable True if external actions should be enabled.
*/
public void enableExternalActions(final boolean enable) {
ThreadUtils.assertOnUiThread();
mExternalActionsEnabled = enable;
if (mActionMode != null) {
mActionMode.invalidate();
}
}
/**
* Get whether text actions from other apps are enabled.
*
* @return True if external actions are enabled.
*/
public boolean areExternalActionsEnabled() {
return mExternalActionsEnabled;
}
/**
* Return list of all actions in proper order, regardless of their availability at present.
* Override to add to or remove from the default set.
*
* @return Array of action IDs in proper order.
*/
protected @NonNull
String[] getAllActions() {
return mUseFloatingToolbar ? FLOATING_TOOLBAR_ACTIONS
: FIXED_TOOLBAR_ACTIONS;
}
/**
* Return whether an action is presently available. Override to indicate
* availability for custom actions.
*
* @param id Action ID.
* @return True if the action is presently available.
*/
protected boolean isActionAvailable(final @NonNull String id) {
if (mSelection == null || mSelection.text.length() < 1 || mSelection.text.getBytes().length >= 500000) {
return false;
}
if (mExternalActionsEnabled && !mSelection.text.isEmpty() &&
ACTION_PROCESS_TEXT.equals(id)) {
final PackageManager pm = mActivity.getPackageManager();
return pm.resolveActivity(getProcessTextIntent(), PackageManager.MATCH_DEFAULT_ONLY) != null;
}
if (id.equals("SEARCH") && !mSelection.text.isEmpty() && mExternalActionsEnabled) {
return true;
}
return mSelection.isActionAvailable(id);
}
/**
* Provides access to whether there are text selection actions available. Override to indicate
* availability for custom actions.
*
* @return True if there are text selection actions available.
*/
public boolean isActionAvailable() {
if (mSelection == null) {
return false;
}
return isActionAvailable(ACTION_PROCESS_TEXT) ||
!mSelection.availableActions.isEmpty();
}
/**
* Prepare a menu item corresponding to a certain action. Override to prepare
* menu item for custom action.
*
* @param id Action ID.
* @param item New menu item to prepare.
*/
protected void prepareAction(final @NonNull String id, final @NonNull MenuItem item) {
if (mFullScreen) {
return;
}
switch (id) {
case ACTION_CUT:
item.setTitle(android.R.string.cut);
break;
case ACTION_COPY:
item.setTitle(android.R.string.copy);
break;
case "SEARCH":
item.setTitle("Search");
break;
case ACTION_PASTE:
item.setTitle(android.R.string.paste);
break;
case ACTION_SELECT_ALL:
item.setTitle(android.R.string.selectAll);
break;
case ACTION_PROCESS_TEXT:
throw new IllegalStateException("Unexpected action");
}
}
/**
* Perform the specified action. Override to perform custom actions.
*
* @param id Action ID.
* @param item Nenu item for the action.
* @return True if the action was performed.
*/
protected boolean performAction(final @NonNull String id, final @NonNull MenuItem item) {
if (ACTION_PROCESS_TEXT.equals(id)) {
try {
mActivity.startActivity(item.getIntent());
} catch (final ActivityNotFoundException e) {
Log.e(LOGTAG, "Cannot perform action", e);
return false;
}
return true;
}
if (mSelection == null) {
return false;
}
if (id.equals("SEARCH")) {
if (activityContextManager.getInstance() != null && activityContextManager.getInstance().getHomeController() != null) {
activityContextManager.getInstance().getHomeController().onSearchString(mSelection.text);
}
clearSelection();
mActionMode.finish();
return false;
}
mSelection.execute(id);
if (ACTION_COPY.equals(id)) {
if (mUseFloatingToolbar) {
clearSelection();
} else {
mActionMode.finish();
}
}
return true;
}
/**
* Get the current selection object. This object should not be stored as it does not update
* when the selection becomes invalid. Stale actions are ignored.
*
* @return The {@link GeckoSession.SelectionActionDelegate.Selection} attached to the current
* action menu. <code>null</code> if no action menu is active.
*/
public @Nullable
Selection getSelection() {
return mSelection;
}
/**
* Clear the current selection, if possible.
*/
public void clearSelection() {
if (mSelection == null) {
return;
}
if (isActionAvailable(ACTION_COLLAPSE_TO_END)) {
mSelection.collapseToEnd();
} else if (isActionAvailable(ACTION_UNSELECT)) {
mSelection.unselect();
} else {
mSelection.hide();
}
}
private Intent getProcessTextIntent() {
final Intent intent = new Intent(Intent.ACTION_PROCESS_TEXT);
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_PROCESS_TEXT, mSelection.text);
// TODO: implement ability to replace text in Gecko for editable selection (bug 1453137).
intent.putExtra(Intent.EXTRA_PROCESS_TEXT_READONLY, true);
return intent;
}
@Override
public boolean onCreateActionMode(final ActionMode actionMode, final Menu menu) {
ThreadUtils.assertOnUiThread();
final String[] allActions = getAllActions();
for (final String actionId : allActions) {
if (isActionAvailable(actionId)) {
if (!mUseFloatingToolbar && (
Build.VERSION.SDK_INT == 22 || Build.VERSION.SDK_INT == 23)) {
// Android bug where onPrepareActionMode is not called initially.
onPrepareActionMode(actionMode, menu);
}
return true;
}
}
return false;
}
@Override
public boolean onPrepareActionMode(final ActionMode actionMode, final Menu menu) {
ThreadUtils.assertOnUiThread();
final String[] allActions = getAllActions();
boolean changed = false;
// Whether we are repopulating an existing menu.
mRepopulatedMenu = menu.size() != 0;
// For each action, see if it's available at present, and if necessary,
// add to or remove from menu.
for (int i = 0; i < allActions.length; i++) {
final String actionId = allActions[i];
final int menuId = i + Menu.FIRST;
if (ACTION_PROCESS_TEXT.equals(actionId)) {
if (mExternalActionsEnabled && !mSelection.text.isEmpty()) {
menu.addIntentOptions(menuId, menuId, menuId,
mActivity.getComponentName(),
/* specifiec */ null, getProcessTextIntent(),
/* flags */ 0, /* items */ null);
changed = true;
} else if (menu.findItem(menuId) != null) {
menu.removeGroup(menuId);
changed = true;
}
continue;
}
if (isActionAvailable(actionId)) {
if (menu.findItem(menuId) == null) {
prepareAction(actionId, menu.add(/* group */ Menu.NONE, menuId,
menuId, /* title */ ""));
changed = true;
}
} else if (menu.findItem(menuId) != null) {
menu.removeItem(menuId);
changed = true;
}
}
return changed;
}
@Override
public boolean onActionItemClicked(final ActionMode actionMode, final MenuItem menuItem) {
ThreadUtils.assertOnUiThread();
MenuItem realMenuItem = null;
if (mRepopulatedMenu) {
// When we repopulate an existing menu, Android can sometimes give us an old,
// deleted MenuItem. Find the current MenuItem that corresponds to the old one.
final Menu menu = actionMode.getMenu();
final int size = menu.size();
for (int i = 0; i < size; i++) {
final MenuItem item = menu.getItem(i);
if (item == menuItem || (item.getItemId() == menuItem.getItemId() &&
item.getTitle().equals(menuItem.getTitle()))) {
realMenuItem = item;
break;
}
}
} else {
realMenuItem = menuItem;
}
if (realMenuItem == null) {
return false;
}
final String[] allActions = getAllActions();
return performAction(allActions[realMenuItem.getItemId() - Menu.FIRST], realMenuItem);
}
@Override
public void onDestroyActionMode(final ActionMode actionMode) {
ThreadUtils.assertOnUiThread();
if (!mUseFloatingToolbar) {
clearSelection();
}
mSession = null;
mSelection = null;
mActionMode = null;
}
@SuppressWarnings("checkstyle:javadocmethod")
public void onGetContentRect(final @Nullable ActionMode mode, final @Nullable View view,
final @NonNull Rect outRect) {
ThreadUtils.assertOnUiThread();
if (mSelection == null || mSelection.clientRect == null) {
return;
}
mSession.getClientToScreenMatrix(mTempMatrix);
mTempMatrix.mapRect(mTempRect, mSelection.clientRect);
mTempRect.roundOut(outRect);
}
@TargetApi(Build.VERSION_CODES.M)
@Override
public void onShowActionRequest(final GeckoSession session, final Selection selection) {
ThreadUtils.assertOnUiThread();
mSession = session;
mSelection = selection;
try {
if (mActionMode != null) {
if (isActionAvailable()) {
mActionMode.invalidate();
} else {
mActionMode.finish();
}
return;
}
if (mUseFloatingToolbar) {
String strManufacturer = android.os.Build.MANUFACTURER;
if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1 || (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.N_MR1 && (strManufacturer.toLowerCase().contains("samsung") || android.os.Build.MODEL.toLowerCase().contains("samsung") || Build.PRODUCT.toLowerCase().contains("samsung")))) {
mActionMode = mActivity.startActionMode(this);
} else {
mActionMode = mActivity.startActionMode(new Callback2Wrapper(), ActionMode.TYPE_FLOATING);
}
} else {
mActionMode = mActivity.startActionMode(this);
}
} catch (Exception ignored) {
}
}
@Override
public void onHideAction(final GeckoSession session, final int reason) {
ThreadUtils.assertOnUiThread();
if (mActionMode == null) {
return;
}
switch (reason) {
case HIDE_REASON_ACTIVE_SCROLL:
case HIDE_REASON_ACTIVE_SELECTION:
case HIDE_REASON_INVISIBLE_SELECTION:
if (mUseFloatingToolbar) {
// Hide the floating toolbar when scrolling/selecting.
mActionMode.finish();
}
break;
case HIDE_REASON_NO_SELECTION:
mActionMode.finish();
break;
}
}
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.UiThread;
import android.util.Log;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import com.hiddenservices.onionservices.appManager.activityContextManager;
import org.mozilla.gecko.util.ThreadUtils;
import org.mozilla.geckoview.GeckoSession;
/**
* Class that implements a basic SelectionActionDelegate. This class is used by GeckoView by
* default if the consumer does not explicitly set a SelectionActionDelegate.
* <p>
* To provide custom actions, extend this class and override the following methods,
* <p>
* 1) Override {@link #getAllActions} to include custom action IDs in the returned array. This
* array must include all actions, available or not, and must not change over the class lifetime.
* <p>
* 2) Override {@link #isActionAvailable} to return whether a custom action is currently available.
* <p>
* 3) Override {@link #prepareAction} to set custom title and/or icon for a custom action.
* <p>
* 4) Override {@link #performAction} to perform a custom action when used.
*/
@UiThread
public class selectionDelegate implements ActionMode.Callback,
GeckoSession.SelectionActionDelegate {
private static final String LOGTAG = "BasicSelectionAction";
protected static final String ACTION_PROCESS_TEXT = "android.intent.action.PROCESS_TEXT";
private static final String[] FLOATING_TOOLBAR_ACTIONS = new String[]{
ACTION_CUT, ACTION_COPY, ACTION_PASTE, ACTION_SELECT_ALL, "SEARCH"
};
private static final String[] FIXED_TOOLBAR_ACTIONS = new String[]{
ACTION_SELECT_ALL, ACTION_CUT, ACTION_COPY, ACTION_PASTE, "SEARCH"
};
protected final @NonNull
Activity mActivity;
protected final boolean mUseFloatingToolbar;
protected final @NonNull
Matrix mTempMatrix = new Matrix();
protected final @NonNull
RectF mTempRect = new RectF();
private boolean mFullScreen = false;
private boolean mExternalActionsEnabled;
protected @Nullable
ActionMode mActionMode;
protected @Nullable
GeckoSession mSession;
protected @Nullable
Selection mSelection;
protected boolean mRepopulatedMenu;
public void setFullScreen(boolean pFullScreen) {
mFullScreen = pFullScreen;
}
@TargetApi(Build.VERSION_CODES.M)
private class Callback2Wrapper extends ActionMode.Callback2 {
@Override
public boolean onCreateActionMode(final ActionMode actionMode, final Menu menu) {
return selectionDelegate.this.onCreateActionMode(actionMode, menu);
}
@Override
public boolean onPrepareActionMode(final ActionMode actionMode, final Menu menu) {
return selectionDelegate.this.onPrepareActionMode(actionMode, menu);
}
@Override
public boolean onActionItemClicked(final ActionMode actionMode, final MenuItem menuItem) {
return selectionDelegate.this.onActionItemClicked(actionMode, menuItem);
}
@Override
public void onDestroyActionMode(final ActionMode actionMode) {
selectionDelegate.this.onDestroyActionMode(actionMode);
}
@Override
public void onGetContentRect(final ActionMode mode, final View view, final Rect outRect) {
super.onGetContentRect(mode, view, outRect);
selectionDelegate.this.onGetContentRect(mode, view, outRect);
}
}
@SuppressWarnings("checkstyle:javadocmethod")
public selectionDelegate(final @NonNull Activity activity) {
this(activity, Build.VERSION.SDK_INT >= 23);
}
@SuppressWarnings("checkstyle:javadocmethod")
public selectionDelegate(final @NonNull Activity activity,
final boolean useFloatingToolbar) {
mActivity = activity;
mUseFloatingToolbar = useFloatingToolbar;
mExternalActionsEnabled = true;
}
/**
* Set whether to include text actions from other apps in the floating toolbar.
*
* @param enable True if external actions should be enabled.
*/
public void enableExternalActions(final boolean enable) {
ThreadUtils.assertOnUiThread();
mExternalActionsEnabled = enable;
if (mActionMode != null) {
mActionMode.invalidate();
}
}
/**
* Get whether text actions from other apps are enabled.
*
* @return True if external actions are enabled.
*/
public boolean areExternalActionsEnabled() {
return mExternalActionsEnabled;
}
/**
* Return list of all actions in proper order, regardless of their availability at present.
* Override to add to or remove from the default set.
*
* @return Array of action IDs in proper order.
*/
protected @NonNull
String[] getAllActions() {
return mUseFloatingToolbar ? FLOATING_TOOLBAR_ACTIONS
: FIXED_TOOLBAR_ACTIONS;
}
/**
* Return whether an action is presently available. Override to indicate
* availability for custom actions.
*
* @param id Action ID.
* @return True if the action is presently available.
*/
protected boolean isActionAvailable(final @NonNull String id) {
if (mSelection == null || mSelection.text.length() < 1 || mSelection.text.getBytes().length >= 500000) {
return false;
}
if (mExternalActionsEnabled && !mSelection.text.isEmpty() &&
ACTION_PROCESS_TEXT.equals(id)) {
final PackageManager pm = mActivity.getPackageManager();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return pm.resolveActivity(getProcessTextIntent(), PackageManager.MATCH_DEFAULT_ONLY) != null;
}
}
if (id.equals("SEARCH") && !mSelection.text.isEmpty() && mExternalActionsEnabled) {
return true;
}
return mSelection.isActionAvailable(id);
}
/**
* Provides access to whether there are text selection actions available. Override to indicate
* availability for custom actions.
*
* @return True if there are text selection actions available.
*/
public boolean isActionAvailable() {
if (mSelection == null) {
return false;
}
return isActionAvailable(ACTION_PROCESS_TEXT) ||
!mSelection.availableActions.isEmpty();
}
/**
* Prepare a menu item corresponding to a certain action. Override to prepare
* menu item for custom action.
*
* @param id Action ID.
* @param item New menu item to prepare.
*/
protected void prepareAction(final @NonNull String id, final @NonNull MenuItem item) {
if (mFullScreen) {
return;
}
switch (id) {
case ACTION_CUT:
item.setTitle(android.R.string.cut);
break;
case ACTION_COPY:
item.setTitle(android.R.string.copy);
break;
case "SEARCH":
item.setTitle("Search");
break;
case ACTION_PASTE:
item.setTitle(android.R.string.paste);
break;
case ACTION_SELECT_ALL:
item.setTitle(android.R.string.selectAll);
break;
case ACTION_PROCESS_TEXT:
throw new IllegalStateException("Unexpected action");
}
}
/**
* Perform the specified action. Override to perform custom actions.
*
* @param id Action ID.
* @param item Nenu item for the action.
* @return True if the action was performed.
*/
protected boolean performAction(final @NonNull String id, final @NonNull MenuItem item) {
if (ACTION_PROCESS_TEXT.equals(id)) {
try {
mActivity.startActivity(item.getIntent());
} catch (final ActivityNotFoundException e) {
Log.e(LOGTAG, "Cannot perform action", e);
return false;
}
return true;
}
if (mSelection == null) {
return false;
}
if (id.equals("SEARCH")) {
if (activityContextManager.getInstance() != null && activityContextManager.getInstance().getHomeController() != null) {
activityContextManager.getInstance().getHomeController().onSearchString(mSelection.text);
}
clearSelection();
mActionMode.finish();
return false;
}
mSelection.execute(id);
if (ACTION_COPY.equals(id)) {
if (mUseFloatingToolbar) {
clearSelection();
} else {
mActionMode.finish();
}
}
return true;
}
/**
* Get the current selection object. This object should not be stored as it does not update
* when the selection becomes invalid. Stale actions are ignored.
*
* @return The {@link GeckoSession.SelectionActionDelegate.Selection} attached to the current
* action menu. <code>null</code> if no action menu is active.
*/
public @Nullable
Selection getSelection() {
return mSelection;
}
/**
* Clear the current selection, if possible.
*/
public void clearSelection() {
if (mSelection == null) {
return;
}
if (isActionAvailable(ACTION_COLLAPSE_TO_END)) {
mSelection.collapseToEnd();
} else if (isActionAvailable(ACTION_UNSELECT)) {
mSelection.unselect();
} else {
mSelection.hide();
}
}
@RequiresApi(api = Build.VERSION_CODES.M)
private Intent getProcessTextIntent() {
final Intent intent = new Intent(Intent.ACTION_PROCESS_TEXT);
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_PROCESS_TEXT, mSelection.text);
intent.putExtra(Intent.EXTRA_PROCESS_TEXT_READONLY, true);
return intent;
}
@Override
public boolean onCreateActionMode(final ActionMode actionMode, final Menu menu) {
ThreadUtils.assertOnUiThread();
final String[] allActions = getAllActions();
for (final String actionId : allActions) {
if (isActionAvailable(actionId)) {
if (!mUseFloatingToolbar && (
Build.VERSION.SDK_INT == 22 || Build.VERSION.SDK_INT == 23)) {
// Android bug where onPrepareActionMode is not called initially.
onPrepareActionMode(actionMode, menu);
}
return true;
}
}
return false;
}
@Override
public boolean onPrepareActionMode(final ActionMode actionMode, final Menu menu) {
ThreadUtils.assertOnUiThread();
final String[] allActions = getAllActions();
boolean changed = false;
// Whether we are repopulating an existing menu.
mRepopulatedMenu = menu.size() != 0;
// For each action, see if it's available at present, and if necessary,
// add to or remove from menu.
for (int i = 0; i < allActions.length; i++) {
final String actionId = allActions[i];
final int menuId = i + Menu.FIRST;
if (ACTION_PROCESS_TEXT.equals(actionId)) {
if (mExternalActionsEnabled && !mSelection.text.isEmpty()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
menu.addIntentOptions(menuId, menuId, menuId,
mActivity.getComponentName(),
/* specifiec */ null, getProcessTextIntent(),
/* flags */ 0, /* items */ null);
}
changed = true;
} else if (menu.findItem(menuId) != null) {
menu.removeGroup(menuId);
changed = true;
}
continue;
}
if (isActionAvailable(actionId)) {
if (menu.findItem(menuId) == null) {
prepareAction(actionId, menu.add(/* group */ Menu.NONE, menuId,
menuId, /* title */ ""));
changed = true;
}
} else if (menu.findItem(menuId) != null) {
menu.removeItem(menuId);
changed = true;
}
}
return changed;
}
@Override
public boolean onActionItemClicked(final ActionMode actionMode, final MenuItem menuItem) {
ThreadUtils.assertOnUiThread();
MenuItem realMenuItem = null;
if (mRepopulatedMenu) {
// When we repopulate an existing menu, Android can sometimes give us an old,
// deleted MenuItem. Find the current MenuItem that corresponds to the old one.
final Menu menu = actionMode.getMenu();
final int size = menu.size();
for (int i = 0; i < size; i++) {
final MenuItem item = menu.getItem(i);
if (item == menuItem || (item.getItemId() == menuItem.getItemId() &&
item.getTitle().equals(menuItem.getTitle()))) {
realMenuItem = item;
break;
}
}
} else {
realMenuItem = menuItem;
}
if (realMenuItem == null) {
return false;
}
final String[] allActions = getAllActions();
return performAction(allActions[realMenuItem.getItemId() - Menu.FIRST], realMenuItem);
}
@Override
public void onDestroyActionMode(final ActionMode actionMode) {
ThreadUtils.assertOnUiThread();
if (!mUseFloatingToolbar) {
clearSelection();
}
mSession = null;
mSelection = null;
mActionMode = null;
}
@SuppressWarnings("checkstyle:javadocmethod")
public void onGetContentRect(final @Nullable ActionMode mode, final @Nullable View view,
final @NonNull Rect outRect) {
ThreadUtils.assertOnUiThread();
if (mSelection == null || mSelection.clientRect == null) {
return;
}
mSession.getClientToScreenMatrix(mTempMatrix);
mTempMatrix.mapRect(mTempRect, mSelection.clientRect);
mTempRect.roundOut(outRect);
}
@TargetApi(Build.VERSION_CODES.M)
@Override
public void onShowActionRequest(@NonNull final GeckoSession session, @NonNull final Selection selection) {
ThreadUtils.assertOnUiThread();
mSession = session;
mSelection = selection;
try {
if (mActionMode != null) {
if (isActionAvailable()) {
mActionMode.invalidate();
} else {
mActionMode.finish();
}
return;
}
if (mUseFloatingToolbar) {
String strManufacturer = android.os.Build.MANUFACTURER;
if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1 || (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.N_MR1 && (strManufacturer.toLowerCase().contains("samsung") || android.os.Build.MODEL.toLowerCase().contains("samsung") || Build.PRODUCT.toLowerCase().contains("samsung")))) {
mActionMode = mActivity.startActionMode(this);
} else {
mActionMode = mActivity.startActionMode(new Callback2Wrapper(), ActionMode.TYPE_FLOATING);
}
} else {
mActionMode = mActivity.startActionMode(this);
}
} catch (Exception ignored) {
}
}
@Override
public void onHideAction(@NonNull final GeckoSession session, final int reason) {
ThreadUtils.assertOnUiThread();
if (mActionMode == null) {
return;
}
switch (reason) {
case HIDE_REASON_ACTIVE_SCROLL:
case HIDE_REASON_ACTIVE_SELECTION:
case HIDE_REASON_INVISIBLE_SELECTION:
if (mUseFloatingToolbar) {
// Hide the floating toolbar when scrolling/selecting.
mActionMode.finish();
}
break;
case HIDE_REASON_NO_SELECTION:
mActionMode.finish();
break;
}
}
}

View File

@ -7,13 +7,8 @@ import android.net.Uri;
import android.os.Handler;
import android.util.Log;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeController;
import com.hiddenservices.onionservices.appManager.kotlinHelperLibraries.BrowserIconManager;
import com.hiddenservices.onionservices.constants.*;
import com.hiddenservices.onionservices.dataManager.dataController;
@ -25,14 +20,12 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_URL_CACHED;
import static com.hiddenservices.onionservices.constants.constants.CONST_GENESIS_URL_CACHED_DARK;
import static com.hiddenservices.onionservices.constants.constants.CONST_PRIVACY_POLICY_URL_NON_TOR;
import static com.hiddenservices.onionservices.constants.constants.CONST_REPORT_URL;
import static com.hiddenservices.onionservices.constants.enums.etype.M_INDEX_WEBSITE;
import static com.hiddenservices.onionservices.constants.enums.etype.on_handle_external_intent;
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE;
import static org.mozilla.geckoview.StorageController.ClearFlags.AUTH_SESSIONS;
@ -44,15 +37,10 @@ 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.EventDispatcher;
import org.mozilla.gecko.util.GeckoBundle;
import org.mozilla.geckoview.ContentBlocking;
import org.mozilla.geckoview.GeckoResult;
import org.mozilla.geckoview.GeckoRuntime;
import org.mozilla.geckoview.GeckoRuntimeSettings;
import org.mozilla.geckoview.GeckoView;
import org.mozilla.geckoview.WebExtension;
import org.mozilla.geckoview.WebResponse;
import org.torproject.android.service.wrapper.orbotLocalConstants;
@ -211,126 +199,6 @@ public class geckoClients {
return cacheFile.getAbsolutePath();
}
/*
@SuppressLint("WrongThread")
public void installExtension() {
mRuntime.getWebExtensionController()
.ensureBuiltIn("resource://android/assets/parser/", "messaging@example.com")
.accept(
extension -> {
Log.i("MessageDelegate", "Extension installed: " + extension);
extension.setMessageDelegate(mMessagingDelegate, "browser");
},
e -> {
Log.e("MessageDelegate", "Error registering WebExtension", e);
}
);
mRuntime.getWebExtensionController()
.ensureBuiltIn("resource://android/assets/adblock/", "messaging@example.com")
.accept(
extension -> {
Log.i("MessageDelegate", "Extension installed: " + extension);
extension.setMessageDelegate(mMessagingDelegate, "browser");
},
e -> {
Log.e("MessageDelegate", "Error registering WebExtension", e);
}
);
}
private final WebExtension.MessageDelegate mMessagingDelegate = new WebExtension.MessageDelegate() {
@Override
public void onConnect(@NonNull WebExtension.Port port) {
Log.e("MessageDelegate", "onConnect");
mPort = port;
mPort.setDelegate(mPortDelegate);
}
@Override
public GeckoResult<Object> onMessage(final @NonNull String nativeApp, final @NonNull Object message, final @NonNull WebExtension.MessageSender sender) {
Log.e("MessageDelegate", "onConnect");
return null;
}
};
private final WebExtension.PortDelegate mPortDelegate = new WebExtension.PortDelegate() {
@Override
public void onPortMessage(final @NonNull Object message, final @NonNull WebExtension.Port port) {
if(mSession!=null){
if (message != null && mSession.getProgress() == 100 && !mSession.mCloseRequested && mSession.isFirstPaintExecuted && !mSession.mOnBackPressed) {
//event.invokeObserver(Arrays.asList(message, mSession.getCurrentURL()), M_INDEX_WEBSITE);
}
mSession.mOnBackPressed = false;
}
}
@Override
public void onDisconnect(final @NonNull WebExtension.Port port) {
Log.e("MessageDelegate:", "onDisconnect");
if (port == mPort) {
mPort = null;
}
}
};
private WebExtension.Port mPort;
public void onExtentionClicked() {
try {
if (mPort == null) {
return;
}
long id = System.currentTimeMillis();
Log.e("evalJavascript:id:", id + "");
JSONObject jsonObject = new JSONObject();
jsonObject.put("action", "evalJavascript");
jsonObject.put("data", "evalJavascript");
jsonObject.put("id", id);
Log.e("evalJavascript:", jsonObject.toString());
mPort.postMessage(jsonObject);
} catch (Exception e) {
e.printStackTrace();
}
}
static boolean mCreated = false;*/
/* package *//* class Pref<T> {
public final String name;
public final T defaultValue;
private T mValue;
private boolean mIsSet;
public Pref(@NonNull final String name, final T defaultValue) {
this.name = name;
this.defaultValue = defaultValue;
mValue = defaultValue;
}
public void add() {
final GeckoBundle prefs = new GeckoBundle(1);
prefs.putInt(this.name, (Integer)this.defaultValue);
EventDispatcher.getInstance().dispatch("GeckoView:SetDefaultPrefs", prefs);
addToBundle(prefs);
}
private void addToBundle(final GeckoBundle bundle) {
final T value = mIsSet ? mValue : defaultValue;
if (value instanceof String) {
bundle.putString(name, (String) value);
} else if (value instanceof Integer) {
bundle.putInt(name, (Integer) value);
} else if (value instanceof Boolean) {
bundle.putBoolean(name, (Boolean) value);
} else {
throw new UnsupportedOperationException("Unhandled pref type for " + name);
}
}
}*/
@SuppressLint("WrongConstant")
public void initRuntimeSettings(AppCompatActivity context) {
@ -375,7 +243,7 @@ public class geckoClients {
public void onGetFavIcon(ImageView pImageView, String pURL, AppCompatActivity pcontext) {
if(status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY){
if(status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY && status.sLowMemory != enums.MemoryStatus.LOW_MEMORY){
initBrowserManager(pcontext);
pURL = helperMethod.completeURL(helperMethod.getDomainName(pURL));
Log.i("FUCKSSS1111","111");
@ -407,22 +275,22 @@ public class geckoClients {
}
public void onKillMedia(){
mSession.onKillMedia();
mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.DESTROY);
}
public void onPlayMedia(){
mSession.onPlayMedia();
mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.PLAY);
}
public void onPauseMedia(){
mSession.onPauseMedia();
mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.PAUSE);
}
public void onSkipForwardMedia(){
mSession.onSkipForwardMedia();
mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.SKIP_FORWARD);
}
public void onSkipBackwardMedia(){
mSession.onSkipBackwardMedia();
mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.SKIP_BACKWARD);
}
@ -446,7 +314,7 @@ public class geckoClients {
}
public void onStopMedia() {
mSession.onStopMedia();
mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.STOP);
}
public void onUploadRequest(int resultCode, Intent data) {
@ -521,7 +389,7 @@ public class geckoClients {
}
public void onRedrawPixel(AppCompatActivity pcontext) {
if(status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY){
if(status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY && status.sLowMemory != enums.MemoryStatus.LOW_MEMORY){
mSession.onRedrawPixel();
onLoadFavIcon(pcontext);
}
@ -605,7 +473,7 @@ public class geckoClients {
}
public boolean getFullScreenStatus() {
return mSession.getFullScreenStatus();
return mSession.getContentDelegate().getFullScreenStatus();
}
public void onExitFullScreen() {
@ -740,18 +608,25 @@ public class geckoClients {
}
public int getScrollOffset() {
return mSession.getScrollOffset();
return mSession.getmScrollDelegate().getScrollOffset();
}
public class geckoViewClientCallback implements eventObserver.eventListener {
@Override
public Object invokeObserver(List<Object> data, Object e_type) {
if (e_type.equals(enums.etype.ON_FULL_SCREEN)) {
mSession.onFullScreenInvoke((boolean)data.get(0));
}
if (e_type.equals(enums.etype.ON_DESTROY_MEDIA)) {
mSession.getMediaSessionDelegate().onTrigger(enums.MediaController.DESTROY);
}
if (e_type.equals(enums.etype.M_CHANGE_HOME_THEME)) {
reinitHomeTheme();
} else if (mSession != null) {
}
else if (mSession != null) {
if (e_type.equals(enums.etype.SESSION_ID)) {
return mSession.getSessionID();
} else if (mSessionID != null && mSessionID.equals(data.get(1)) || e_type.equals(enums.etype.ON_INVOKE_PARSER) || e_type.equals(enums.etype.M_RATE_COUNT) || e_type.equals(enums.etype.FINDER_RESULT_CALLBACK) || e_type.equals(enums.etype.ON_UPDATE_TAB_TITLE) || e_type.equals(enums.etype.on_update_favicon) || e_type.equals(enums.etype.on_update_history) || e_type.equals(enums.etype.on_request_completed) || e_type.equals(enums.etype.on_update_suggestion) || e_type.equals(enums.etype.on_update_suggestion_url)) {
} else if (mSessionID != null && mSessionID.equals(data.get(1)) || e_type.equals(enums.etype.ON_INVOKE_PARSER) || e_type.equals(enums.etype.M_RATE_COUNT) || e_type.equals(enums.etype.FINDER_RESULT_CALLBACK) || e_type.equals(enums.etype.ON_UPDATE_TAB_TITLE) || e_type.equals(enums.etype.on_update_favicon) || e_type.equals(enums.etype.ON_UPDATE_HISTORY) || e_type.equals(enums.etype.on_request_completed) || e_type.equals(enums.etype.on_update_suggestion) || e_type.equals(enums.etype.on_update_suggestion_url)) {
if (mSession != null && mSession.isClosed()) {
return null;
}

View File

@ -20,15 +20,15 @@ import java.util.Arrays;
import mozilla.components.support.utils.DownloadUtils;
class geckoDownloadManager {
public class geckoDownloadManager {
private Uri downloadURL;
private String downloadFile = strings.GENERIC_EMPTY_STR;
geckoDownloadManager() {
public geckoDownloadManager() {
}
void downloadFile(WebResponse response, geckoSession session, AppCompatActivity context, eventObserver.eventListener event) {
public void downloadFile(WebResponse response, geckoSession session, AppCompatActivity context, eventObserver.eventListener event) {
session.getUserAgent().accept(userAgent -> downloadFile(response, userAgent, context, session, event),
exception -> {
throw new IllegalStateException("Could not get UserAgent string.");
@ -62,11 +62,11 @@ class geckoDownloadManager {
event.invokeObserver(Arrays.asList(downloadFile, session.getSessionID(), downloadURL), enums.etype.download_file_popup);
}
Uri getDownloadURL() {
public Uri getDownloadURL() {
return downloadURL;
}
String getDownloadFile() {
public String getDownloadFile() {
return downloadFile;
}

View File

@ -1,179 +1,179 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager;
import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R;
import org.mozilla.geckoview.WebRequestError;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class errorHandler {
private AppCompatActivity mContext;
private String mErrorTemplate;
public String createErrorPage(final int category, final int error, AppCompatActivity mContext, String url, InputStream mResourceURL) {
this.mContext = mContext;
if (mErrorTemplate == null) {
StringBuilder builder = new StringBuilder();
try {
InputStream stream = mResourceURL;
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
builder.append("\n");
}
mErrorTemplate = builder.toString();
} catch (Exception ex) {
return null;
}
}
String title = helperMethod.getHost(url);
if (url == null) {
url = "Hidden Error";
}
if (title == null) {
title = "Hidden Error";
}
String replaceUrl = errorToString(error).replace("$URL", url);
String errorPage = createErrorPage("CODE : " + categoryToString(category) + " <br>TYPE : " + replaceUrl.replace("$TITLE", title), url, mResourceURL);
errorPage = translateMessage(errorPage, "CODE : " + categoryToString(category));
return errorPage;
}
private String translateMessage(String message, String error) {
message = message.replace("$ERROR_M1", mContext.getString(R.string.ERROR_M1));
message = message.replace("$ERROR_M2", mContext.getString(R.string.ERROR_M2));
message = message.replace("$ERROR_M3", mContext.getString(R.string.ERROR_M3));
message = message.replace("$ERROR_M4", mContext.getString(R.string.ERROR_M4));
message = message.replace("$ERROR_M5", mContext.getString(R.string.ERROR_M5));
message = message.replace("$ERROR_M6", mContext.getString(R.string.ERROR_M6));
if (status.sTorBrowsing) {
message = message.replace("$ERROR_M7", "block");
} else {
message = message.replace("$ERROR_M7", "none");
}
message = message.replace("$ERROR", error);
return message;
}
private String errorToString(final int error) {
switch (error) {
case WebRequestError.ERROR_UNKNOWN:
return "ERROR_UNKNOWN | The network request tried to use an unknown socket type";
case WebRequestError.ERROR_SECURITY_SSL:
return "ERROR_SECURITY_SSL | SSL negotiation problems has occured";
case WebRequestError.ERROR_SECURITY_BAD_CERT:
return "ERROR_SECURITY_BAD_CERT | SSL certificate validation error has occured";
case WebRequestError.ERROR_NET_RESET:
return "ERROR_NET_RESET | The connection was reset";
case WebRequestError.ERROR_NET_INTERRUPT:
return "ERROR_NET_INTERRUPT | The network connection was interrupted";
case WebRequestError.ERROR_NET_TIMEOUT:
return "ERROR_NET_TIMEOUT | The network request timed out";
case WebRequestError.ERROR_CONNECTION_REFUSED:
return "ERROR_CONNECTION_REFUSED | The network request was refused by the server";
case WebRequestError.ERROR_UNKNOWN_PROTOCOL:
return "ERROR_UNKNOWN_PROTOCOL | An unknown protocol was specified";
case WebRequestError.ERROR_UNKNOWN_HOST:
return "ERROR_UNKNOWN_HOST | The host could not be resolved";
case WebRequestError.ERROR_UNKNOWN_SOCKET_TYPE:
return "ERROR_UNKNOWN_SOCKET_TYPE | The network request tried to use an unknown socket type";
case WebRequestError.ERROR_UNKNOWN_PROXY_HOST:
return "ERROR_UNKNOWN_PROXY_HOST | The host name of the proxy server could not be resolved";
case WebRequestError.ERROR_MALFORMED_URI:
return "ERROR_MALFORMED_URI | An invalid URL was specified";
case WebRequestError.ERROR_REDIRECT_LOOP:
return "ERROR_REDIRECT_LOOP | A redirect loop was detected";
case WebRequestError.ERROR_SAFEBROWSING_PHISHING_URI:
return "ERROR_SAFEBROWSING_PHISHING_URI | The requested URI was present in the \"phishing\" blocklist";
case WebRequestError.ERROR_SAFEBROWSING_MALWARE_URI:
return "ERROR_SAFEBROWSING_MALWARE_URI | The requested URI was present in the \"malware\" blocklist";
case WebRequestError.ERROR_SAFEBROWSING_UNWANTED_URI:
return "ERROR_SAFEBROWSING_UNWANTED_URI | The requested URI was present in the \"unwanted\" blocklist";
case WebRequestError.ERROR_SAFEBROWSING_HARMFUL_URI:
return "ERROR_SAFEBROWSING_HARMFUL_URI | The requested URI was present in the \"harmful\" blocklist";
case WebRequestError.ERROR_CONTENT_CRASHED:
return "ERROR_CONTENT_CRASHED | The content process crashed";
case WebRequestError.ERROR_OFFLINE:
return "ERROR_OFFLINE | This device does not have a network connection";
case WebRequestError.ERROR_PORT_BLOCKED:
return "ERROR_PORT_BLOCKED | The request tried to use a port that is blocked by either the OS or Gecko";
case WebRequestError.ERROR_PROXY_CONNECTION_REFUSED:
return "ERROR_PROXY_CONNECTION_REFUSED | The proxy server refused the connection";
case WebRequestError.ERROR_FILE_NOT_FOUND:
return "ERROR_FILE_NOT_FOUND | A file was not found";
case WebRequestError.ERROR_FILE_ACCESS_DENIED:
return "ERROR_FILE_ACCESS_DENIED | The OS blocked access to a file";
case WebRequestError.ERROR_INVALID_CONTENT_ENCODING:
return "ERROR_INVALID_CONTENT_ENCODING | The content has an invalid encoding";
case WebRequestError.ERROR_UNSAFE_CONTENT_TYPE:
return "ERROR_UNSAFE_CONTENT_TYPE | A content type was returned which was deemed unsafe";
case WebRequestError.ERROR_CORRUPTED_CONTENT:
return "ERROR_CORRUPTED_CONTENT | The content returned was corrupted";
default:
return "UNKNOWN";
}
}
private String categoryToString(final int category) {
switch (category) {
case WebRequestError.ERROR_CATEGORY_UNKNOWN:
return "ERROR_CATEGORY_UNKNOWN | " + "Unknown error occured from the server side";
case WebRequestError.ERROR_CATEGORY_SECURITY:
return "ERROR_CATEGORY_SECURITY | SSL certificate validation error has occured";
case WebRequestError.ERROR_CATEGORY_NETWORK:
return "ERROR_CATEGORY_NETWORK | A network related problem has occured";
case WebRequestError.ERROR_CATEGORY_CONTENT:
return "ERROR_CATEGORY_CONTENT | Invalid or corrupt webpage";
case WebRequestError.ERROR_CATEGORY_URI:
return "ERROR_CATEGORY_URI";
case WebRequestError.ERROR_CATEGORY_PROXY:
return "ERROR_CATEGORY_PROXY";
case WebRequestError.ERROR_CATEGORY_SAFEBROWSING:
return "ERROR_CATEGORY_SAFEBROWSING";
default:
return "UNKNOWN";
}
}
private String createErrorPage(final String error, String url, InputStream mResourceURL) {
if (error == null) {
return strings.GENERIC_EMPTY_STR;
}
if (mErrorTemplate == null) {
StringBuilder builder = new StringBuilder();
try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
builder.append("\n");
}
mErrorTemplate = builder.toString();
} catch (IOException e) {
return null;
}
}
String replaceUrl = mErrorTemplate.replace("$URL", url);
return replaceUrl;
}
}
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.helperClasses;
import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.R;
import org.mozilla.geckoview.WebRequestError;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class errorHandler {
private AppCompatActivity mContext;
private String mErrorTemplate;
public String createErrorPage(final int category, final int error, AppCompatActivity mContext, String url, InputStream mResourceURL) {
this.mContext = mContext;
if (mErrorTemplate == null) {
StringBuilder builder = new StringBuilder();
try {
InputStream stream = mResourceURL;
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
builder.append("\n");
}
mErrorTemplate = builder.toString();
} catch (Exception ex) {
return null;
}
}
String title = helperMethod.getHost(url);
if (url == null) {
url = "Hidden Error";
}
if (title == null) {
title = "Hidden Error";
}
String replaceUrl = errorToString(error).replace("$URL", url);
String errorPage = createErrorPage("CODE : " + categoryToString(category) + " <br>TYPE : " + replaceUrl.replace("$TITLE", title), url, mResourceURL);
errorPage = translateMessage(errorPage, "CODE : " + categoryToString(category));
return errorPage;
}
private String translateMessage(String message, String error) {
message = message.replace("$ERROR_M1", mContext.getString(R.string.ERROR_M1));
message = message.replace("$ERROR_M2", mContext.getString(R.string.ERROR_M2));
message = message.replace("$ERROR_M3", mContext.getString(R.string.ERROR_M3));
message = message.replace("$ERROR_M4", mContext.getString(R.string.ERROR_M4));
message = message.replace("$ERROR_M5", mContext.getString(R.string.ERROR_M5));
message = message.replace("$ERROR_M6", mContext.getString(R.string.ERROR_M6));
if (status.sTorBrowsing) {
message = message.replace("$ERROR_M7", "block");
} else {
message = message.replace("$ERROR_M7", "none");
}
message = message.replace("$ERROR", error);
return message;
}
private String errorToString(final int error) {
switch (error) {
case WebRequestError.ERROR_UNKNOWN:
return "ERROR_UNKNOWN | The network request tried to use an unknown socket type";
case WebRequestError.ERROR_SECURITY_SSL:
return "ERROR_SECURITY_SSL | SSL negotiation problems has occured";
case WebRequestError.ERROR_SECURITY_BAD_CERT:
return "ERROR_SECURITY_BAD_CERT | SSL certificate validation error has occured";
case WebRequestError.ERROR_NET_RESET:
return "ERROR_NET_RESET | The connection was reset";
case WebRequestError.ERROR_NET_INTERRUPT:
return "ERROR_NET_INTERRUPT | The network connection was interrupted";
case WebRequestError.ERROR_NET_TIMEOUT:
return "ERROR_NET_TIMEOUT | The network request timed out";
case WebRequestError.ERROR_CONNECTION_REFUSED:
return "ERROR_CONNECTION_REFUSED | The network request was refused by the server";
case WebRequestError.ERROR_UNKNOWN_PROTOCOL:
return "ERROR_UNKNOWN_PROTOCOL | An unknown protocol was specified";
case WebRequestError.ERROR_UNKNOWN_HOST:
return "ERROR_UNKNOWN_HOST | The host could not be resolved";
case WebRequestError.ERROR_UNKNOWN_SOCKET_TYPE:
return "ERROR_UNKNOWN_SOCKET_TYPE | The network request tried to use an unknown socket type";
case WebRequestError.ERROR_UNKNOWN_PROXY_HOST:
return "ERROR_UNKNOWN_PROXY_HOST | The host name of the proxy server could not be resolved";
case WebRequestError.ERROR_MALFORMED_URI:
return "ERROR_MALFORMED_URI | An invalid URL was specified";
case WebRequestError.ERROR_REDIRECT_LOOP:
return "ERROR_REDIRECT_LOOP | A redirect loop was detected";
case WebRequestError.ERROR_SAFEBROWSING_PHISHING_URI:
return "ERROR_SAFEBROWSING_PHISHING_URI | The requested URI was present in the \"phishing\" blocklist";
case WebRequestError.ERROR_SAFEBROWSING_MALWARE_URI:
return "ERROR_SAFEBROWSING_MALWARE_URI | The requested URI was present in the \"malware\" blocklist";
case WebRequestError.ERROR_SAFEBROWSING_UNWANTED_URI:
return "ERROR_SAFEBROWSING_UNWANTED_URI | The requested URI was present in the \"unwanted\" blocklist";
case WebRequestError.ERROR_SAFEBROWSING_HARMFUL_URI:
return "ERROR_SAFEBROWSING_HARMFUL_URI | The requested URI was present in the \"harmful\" blocklist";
case WebRequestError.ERROR_CONTENT_CRASHED:
return "ERROR_CONTENT_CRASHED | The content process crashed";
case WebRequestError.ERROR_OFFLINE:
return "ERROR_OFFLINE | This device does not have a network connection";
case WebRequestError.ERROR_PORT_BLOCKED:
return "ERROR_PORT_BLOCKED | The request tried to use a port that is blocked by either the OS or Gecko";
case WebRequestError.ERROR_PROXY_CONNECTION_REFUSED:
return "ERROR_PROXY_CONNECTION_REFUSED | The proxy server refused the connection";
case WebRequestError.ERROR_FILE_NOT_FOUND:
return "ERROR_FILE_NOT_FOUND | A file was not found";
case WebRequestError.ERROR_FILE_ACCESS_DENIED:
return "ERROR_FILE_ACCESS_DENIED | The OS blocked access to a file";
case WebRequestError.ERROR_INVALID_CONTENT_ENCODING:
return "ERROR_INVALID_CONTENT_ENCODING | The content has an invalid encoding";
case WebRequestError.ERROR_UNSAFE_CONTENT_TYPE:
return "ERROR_UNSAFE_CONTENT_TYPE | A content type was returned which was deemed unsafe";
case WebRequestError.ERROR_CORRUPTED_CONTENT:
return "ERROR_CORRUPTED_CONTENT | The content returned was corrupted";
default:
return "UNKNOWN";
}
}
private String categoryToString(final int category) {
switch (category) {
case WebRequestError.ERROR_CATEGORY_UNKNOWN:
return "ERROR_CATEGORY_UNKNOWN | " + "Unknown error occured from the server side";
case WebRequestError.ERROR_CATEGORY_SECURITY:
return "ERROR_CATEGORY_SECURITY | SSL certificate validation error has occured";
case WebRequestError.ERROR_CATEGORY_NETWORK:
return "ERROR_CATEGORY_NETWORK | A network related problem has occured";
case WebRequestError.ERROR_CATEGORY_CONTENT:
return "ERROR_CATEGORY_CONTENT | Invalid or corrupt webpage";
case WebRequestError.ERROR_CATEGORY_URI:
return "ERROR_CATEGORY_URI";
case WebRequestError.ERROR_CATEGORY_PROXY:
return "ERROR_CATEGORY_PROXY";
case WebRequestError.ERROR_CATEGORY_SAFEBROWSING:
return "ERROR_CATEGORY_SAFEBROWSING";
default:
return "UNKNOWN";
}
}
private String createErrorPage(final String error, String url, InputStream mResourceURL) {
if (error == null) {
return strings.GENERIC_EMPTY_STR;
}
if (mErrorTemplate == null) {
StringBuilder builder = new StringBuilder();
try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
builder.append("\n");
}
mErrorTemplate = builder.toString();
} catch (IOException e) {
return null;
}
}
String replaceUrl = mErrorTemplate.replace("$URL", url);
return replaceUrl;
}
}

View File

@ -0,0 +1,14 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.helperClasses;
import android.content.Intent;
import android.net.Uri;
import androidx.appcompat.app.AppCompatActivity;
import java.lang.ref.WeakReference;
public class intentHandler {
public static void actionDial(String pIntentHander, WeakReference<AppCompatActivity> mContext) {
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(pIntentHander));
mContext.get().startActivity(intent);
}
}

View File

@ -0,0 +1,37 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.helperClasses;
import androidx.annotation.NonNull;
import org.mozilla.gecko.EventDispatcher;
import org.mozilla.gecko.util.GeckoBundle;
public class preferences<T> {
public final String name;
public final T defaultValue;
private T mValue;
public preferences(@NonNull final String name, final T defaultValue) {
this.name = name;
this.defaultValue = defaultValue;
mValue = defaultValue;
}
public void add() {
final GeckoBundle prefs = new GeckoBundle(1);
prefs.putInt(this.name, (Integer)this.defaultValue);
EventDispatcher.getInstance().dispatch("GeckoView:SetDefaultPrefs", prefs);
addToBundle(prefs);
}
private void addToBundle(final GeckoBundle bundle) {
final T value = mValue;
if (value instanceof String) {
bundle.putString(name, (String) value);
} else if (value instanceof Integer) {
bundle.putInt(name, (Integer) value);
} else if (value instanceof Boolean) {
bundle.putBoolean(name, (Boolean) value);
} else {
throw new UnsupportedOperationException("Unhandled pref type for " + name);
}
}
}

View File

@ -29,7 +29,7 @@ import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.io.IOException;
import java.util.ArrayList;
@ -210,7 +210,7 @@ public class hintAdapter extends RecyclerView.Adapter<hintAdapter.listViewHolder
mHindTypeIconTemp.setImageDrawable(null);
mEvent.invokeObserver(Arrays.asList(mHindTypeIconTemp, "https://" + helperMethod.getDomainName(model.getDescription())), enums.etype.fetch_favicon);
if(status.sLowMemory == enums.MemoryStatus.STABLE){
if(status.sLowMemory != enums.MemoryStatus.CRITICAL_MEMORY && status.sLowMemory != enums.MemoryStatus.LOW_MEMORY){
if (mHindTypeIconTemp.getDrawable() != null) {
pHintWebIconImage.setImageTintList(null);
pHintWebIconImage.setImageDrawable(mHindTypeIconTemp.getDrawable());

View File

@ -89,7 +89,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.pluginManager.pluginReciever.defaultNotificationReciever;
import com.widget.onionservices.widgetManager.widgetController;
import org.mozilla.geckoview.ContentBlocking;
@ -164,6 +164,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
private View mBannerAds = null;
private ImageButton mGatewaySplash;
private ImageButton mPanicButton;
private ImageButton mSupportButton;
private ImageButton mPanicButtonLandscape;
private LinearLayout mTopBar;
private ImageView mBackSplash;
@ -243,7 +244,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
super.onCreate(savedInstanceState);
setContentView(R.layout.home_view);
onMemoryCalculate();
initPreFixes();
activityContextManager.getInstance().setHomeController(this);
pluginController.getInstance().initializeAllServices(this);
@ -262,6 +262,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba
initPreFixes();
initBundle();
initTor();
onMemoryCalculate();
pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_INIT_ADS);
mHomeViewController.updateBannerAdvertStatus(true, (boolean) pluginController.getInstance().onAdsInvoke(null, pluginEnums.eAdManager.M_IS_ADVERT_LOADED));
}
@ -583,6 +585,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mCoordinatorLayout = findViewById(R.id.pCoordinatorLayout);
mImageDivider = findViewById(R.id.pImageDivider);
mPanicButton = findViewById(R.id.pPanicButton);
mSupportButton = findViewById(R.id.pSupportButton);
mPanicButtonLandscape = findViewById(R.id.pPanicButtonLandscape);
mGenesisLogo = findViewById(R.id.pGenesisLogo);
mPopoupFindCopy = findViewById(R.id.pPopoupFindCopy);
@ -594,7 +597,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mGeckoView.setAutofillEnabled(true);
mGeckoClient = new geckoClients();
mHomeViewController.initialization(new homeViewCallback(), this, mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds, mGatewaySplash, mTopBar, mGeckoView, mBackSplash, mConnectButton, mConnectNoTorButton, mFindBar, mFindText, mFindCount, mTopLayout, mVoiceInput, mMenu, mNestedScroll, mBlocker, mBlockerFullSceen, mSearchEngineBar, mCopyright, mHintListView, mAppBar, mOrbotLogManager, mInfoLandscape, mInfoPortrait, mProgressBarIndeterminate, mTabFragment, mTopBarContainer, mSearchLock, mTopBarHider, mNewTabBlocker, mCoordinatorLayout, mImageDivider, mPanicButton, mGenesisLogo, mPanicButtonLandscape, mTorDisabled);
mHomeViewController.initialization(new homeViewCallback(), this, mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds, mGatewaySplash, mTopBar, mGeckoView, mBackSplash, mConnectButton, mConnectNoTorButton, mFindBar, mFindText, mFindCount, mTopLayout, mVoiceInput, mMenu, mNestedScroll, mBlocker, mBlockerFullSceen, mSearchEngineBar, mCopyright, mHintListView, mAppBar, mOrbotLogManager, mInfoLandscape, mInfoPortrait, mProgressBarIndeterminate, mTabFragment, mTopBarContainer, mSearchLock, mTopBarHider, mNewTabBlocker, mCoordinatorLayout, mImageDivider, mPanicButton, mGenesisLogo, mPanicButtonLandscape, mTorDisabled, mSupportButton);
mGeckoView.onSetHomeEvent(new nestedGeckoViewCallback());
mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this, false);
mGeckoClient.onValidateInitializeFromStartup(mGeckoView, homeController.this);
@ -772,8 +775,13 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}
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);
if(!mHomeViewController.isOrientationLandscapce() && status.sSettingIsAppRunning){
new Handler().postDelayed(() ->
{
if(status.sSettingIsAppStarted) {
pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER);
}
}, 3000);
}
}
@ -783,7 +791,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
public void onLoadTab(geckoSession mTempSession, boolean isSessionClosed, boolean pExpandAppBar, boolean pForced, boolean pGeneratePixel) {
mGeckoClient.getSession().onKillMedia();
mGeckoClient.getSession().getMediaSessionDelegate().onTrigger(enums.MediaController.DESTROY);
if (!isSessionClosed) {
dataController.getInstance().invokeTab(dataEnums.eTabCommands.MOVE_TAB_TO_TOP, Collections.singletonList(mTempSession));
}
@ -1103,7 +1111,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}
NotificationManagerCompat.from(this).cancel(1025);
if(mGeckoClient.getSession() !=null){
mGeckoClient.getSession().onDestroyMedia();
mGeckoClient.getSession().getMediaSessionDelegate().onTrigger(enums.MediaController.DESTROY);
onHideDefaultNotification();
}
if (!status.sSettingIsAppStarted) {
@ -1563,7 +1571,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
geckoSession mNewSession = mGeckoClient.initializeBackground(mGeckoView, new geckoViewCallback(), this, true);
onSaveCurrentTab(mNewSession, false);
mNewSession.setURL(url);
mNewSession.getHistoryDelegate().setURL(url);
mHomeViewController.progressBarReset();
initTabCountForced();
mNewSession.loadUri(url);
@ -1574,7 +1582,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}
public void onNewTab(boolean isKeyboardOpenedTemp, boolean isKeyboardOpened) {
mGeckoClient.getSession().onKillMedia();
mGeckoClient.getSession().getMediaSessionDelegate().onTrigger(enums.MediaController.DESTROY);
try {
if(status.sLowMemory != enums.MemoryStatus.STABLE){
mRenderedBitmap = mGeckoView.capturePixels();
@ -1735,7 +1743,9 @@ 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_BANNER);
if(status.sSettingIsAppStarted){
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) {
@ -1789,7 +1799,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.removeBanner();
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
if(mGeckoClient.getFullScreenStatus()){
pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER);
if(status.sSettingIsAppStarted){
pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER);
}
}else {
pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_HIDE_BANNER);
}
@ -1837,7 +1849,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba
if(!mGeckoClient.getFullScreenStatus()){
mGeckoClient.onExitFullScreen();
}
pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER);
if(status.sSettingIsAppStarted){
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);
@ -1852,7 +1866,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(), false, false, true);
if (mGeckoClient.getSession() != null && mGeckoClient != null) {
mGeckoClient.onStopMedia();
mGeckoClient.onPauseMedia();
}
}
@ -2710,7 +2724,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba
if((boolean)data.get(0)){
pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_HIDE_BANNER);
}else {
pluginController.getInstance().onAdsInvoke(Collections.singletonList(this), pluginEnums.eAdManager.M_SHOW_BANNER);
if(status.sSettingIsAppStarted){
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);
@ -2986,7 +3002,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false);
} else if (e_type.equals(enums.etype.start_proxy)) {
pluginController.getInstance().onOrbotInvoke(data, pluginEnums.eOrbotManager.M_SET_PROXY);
} else if (e_type.equals(enums.etype.on_update_history)) {
} else if (e_type.equals(enums.etype.ON_UPDATE_HISTORY)) {
return dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_ADD_HISTORY, data);
} else if (e_type.equals(enums.etype.on_page_loaded)) {
onInvokePixelGenerator();
@ -3014,10 +3030,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mData.addAll(data);
mData.add(homeController.this);
pluginController.getInstance().onMessageManagerInvoke(mData, M_DOWNLOAD_SINGLE);
} else if (e_type.equals(enums.etype.on_full_screen)) {
} else if (e_type.equals(enums.etype.ON_FULL_SCREEN)) {
boolean status = (Boolean) data.get(0);
if(!status){
mGeckoClient.onStopMedia();
mGeckoClient.onPauseMedia();
}
mHomeViewController.onFullScreenUpdate(status);
mHomeViewController.onUpdateSearchEngineBar(false, 0);

View File

@ -51,7 +51,7 @@ import com.hiddenservices.onionservices.dataManager.dataEnums;
import com.hiddenservices.onionservices.libs.views.ColorAnimator;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.google.android.material.appbar.AppBarLayout;
import org.mozilla.geckoview.GeckoView;
@ -115,6 +115,7 @@ class homeViewController {
private CoordinatorLayout mCoordinatorLayout;
private ImageView mImageDivider;
private ImageButton mPanicButton;
private ImageButton mSupportButton;
private ImageButton mPanicButtonLandscape;
private ImageView mGenesisLogo;
private ImageView mTorDisabled;
@ -127,7 +128,7 @@ class homeViewController {
private boolean mIsTopBarExpanded = true;
private NestedScrollView.MarginLayoutParams mDefaultMargin = null;
void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, ConstraintLayout webviewContainer, TextView loadingText, ProgressBar progressBar, editTextManager searchbar, ConstraintLayout splashScreen, ImageView loading, View banner_ads, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_button, Button connect_no_tor_button, View pFindBar, EditText pFindText, TextView pFindCount, androidx.constraintlayout.widget.ConstraintLayout pTopLayout, ImageButton pVoiceInput, ImageButton pMenu, androidx.core.widget.NestedScrollView pNestedScroll, ImageView pBlocker, ImageView pBlockerFullSceen, View mSearchEngineBar, TextView pCopyright, RecyclerView pHistListView, com.google.android.material.appbar.AppBarLayout pAppBar, ImageButton pOrbotLogManager, ConstraintLayout pInfoLandscape, ConstraintLayout pInfoPortrait, ProgressBar pProgressBarIndeterminate, FragmentContainerView pTabFragment, LinearLayout pTopBarContainer, ImageView pSearchLock, ImageView pTopBarHider, ImageView pNewTabBlocker, CoordinatorLayout mCoordinatorLayout, ImageView pImageDivider, ImageButton pPanicButton, ImageView pGenesisLogo, ImageButton pPanicButtonLandscape, ImageView pTorDisabled) {
void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, ConstraintLayout webviewContainer, TextView loadingText, ProgressBar progressBar, editTextManager searchbar, ConstraintLayout splashScreen, ImageView loading, View banner_ads, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_button, Button connect_no_tor_button, View pFindBar, EditText pFindText, TextView pFindCount, androidx.constraintlayout.widget.ConstraintLayout pTopLayout, ImageButton pVoiceInput, ImageButton pMenu, androidx.core.widget.NestedScrollView pNestedScroll, ImageView pBlocker, ImageView pBlockerFullSceen, View mSearchEngineBar, TextView pCopyright, RecyclerView pHistListView, com.google.android.material.appbar.AppBarLayout pAppBar, ImageButton pOrbotLogManager, ConstraintLayout pInfoLandscape, ConstraintLayout pInfoPortrait, ProgressBar pProgressBarIndeterminate, FragmentContainerView pTabFragment, LinearLayout pTopBarContainer, ImageView pSearchLock, ImageView pTopBarHider, ImageView pNewTabBlocker, CoordinatorLayout mCoordinatorLayout, ImageView pImageDivider, ImageButton pPanicButton, ImageView pGenesisLogo, ImageButton pPanicButtonLandscape, ImageView pTorDisabled, ImageButton pSupportButton) {
this.mContext = context;
this.mProgressBar = progressBar;
this.mSearchbar = searchbar;
@ -171,6 +172,7 @@ class homeViewController {
this.mPanicButtonLandscape = pPanicButtonLandscape;
this.mLogHandler = new LogHandler();
this.mTorDisabled = pTorDisabled;
this.mSupportButton = pSupportButton;
initSplashScreen();
createUpdateUiHandler();
@ -530,7 +532,7 @@ class homeViewController {
public void initStatusBarColor(boolean mInstant) {
int mDelay = 1500;
if (!status.sTorBrowsing || status.mThemeApplying || mInstant || status.sSettingIsAppStarted) {
if (status.mThemeApplying || mInstant || status.sSettingIsAppStarted) {
mDelay = 0;
}
@ -566,7 +568,7 @@ class homeViewController {
});
animator.start();
} else {
mSplashScreen.animate().alpha(0).setDuration(200).setStartDelay(mDelay).withEndAction(() -> onPostScreenDisable());
mSplashScreen.animate().alpha(0).setDuration(200).setStartDelay(2000).withEndAction(() -> onPostScreenDisable());
}
}
@ -582,6 +584,7 @@ class homeViewController {
mConnectButton.setVisibility(View.GONE);
mConnectNoTorButton.setVisibility(View.GONE);
mPanicButton.setVisibility(View.GONE);
mSupportButton.setVisibility(View.GONE);
mPanicButtonLandscape.setVisibility(View.GONE);
mEvent.invokeObserver(null, enums.etype.M_CACHE_UPDATE_TAB);
@ -1386,24 +1389,12 @@ class homeViewController {
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;

View File

@ -17,7 +17,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.ArrayList;
import java.util.Arrays;

View File

@ -29,7 +29,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.ArrayList;
import java.util.Arrays;

View File

@ -11,7 +11,7 @@ import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.List;

View File

@ -15,7 +15,7 @@ import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.appManager.tabManager.tabEnums;
import com.hiddenservices.onionservices.constants.constants;
import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import org.torproject.android.service.wrapper.logRowModel;

View File

@ -27,7 +27,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import org.torproject.android.service.wrapper.logRowModel;

View File

@ -18,7 +18,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays;

View File

@ -22,7 +22,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays;

View File

@ -14,7 +14,7 @@ import androidx.core.content.ContextCompat;
import com.hiddenservices.onionservices.constants.constants;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.List;

View File

@ -22,7 +22,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList;

View File

@ -4,7 +4,7 @@ import android.view.View;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.List;

View File

@ -13,7 +13,7 @@ import androidx.core.content.ContextCompat;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList;

View File

@ -16,7 +16,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.ArrayList;
import java.util.Collections;

View File

@ -25,7 +25,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import org.mozilla.geckoview.ContentBlocking;

View File

@ -12,7 +12,7 @@ import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.ArrayList;
import java.util.List;

View File

@ -29,7 +29,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays;

View File

@ -16,7 +16,7 @@ import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Collections;

View File

@ -19,7 +19,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays;

View File

@ -19,7 +19,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays;

View File

@ -11,7 +11,7 @@ import androidx.core.content.ContextCompat;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
class settingNotificationViewController {

View File

@ -21,7 +21,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList;

View File

@ -4,7 +4,7 @@ import android.view.View;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.List;

View File

@ -13,7 +13,7 @@ import androidx.core.content.ContextCompat;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList;

View File

@ -17,7 +17,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays;

View File

@ -11,7 +11,7 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import com.hiddenservices.onionservices.constants.status;

View File

@ -23,7 +23,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList;

View File

@ -18,7 +18,7 @@ import androidx.core.content.ContextCompat;
import com.hiddenservices.onionservices.constants.constants;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import com.hiddenservices.onionservices.pluginManager.pluginController;

View File

@ -33,7 +33,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

View File

@ -14,7 +14,7 @@ import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.constants.constants;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import java.util.List;

View File

@ -20,7 +20,7 @@ import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.ArrayList;
import java.util.Arrays;

View File

@ -4,7 +4,7 @@ import android.view.View;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import org.mozilla.geckoview.ContentBlocking;

View File

@ -13,7 +13,7 @@ import androidx.core.content.ContextCompat;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import org.mozilla.geckoview.ContentBlocking;

View File

@ -29,7 +29,7 @@ import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.dataManager.models.tabRowModel;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.ArrayList;
import java.util.Arrays;

View File

@ -39,7 +39,7 @@ import com.hiddenservices.onionservices.dataManager.models.tabRowModel;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.ArrayList;
import java.util.Arrays;

View File

@ -27,7 +27,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.hiddenservices.onionservices.constants.enums;
import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.List;

View File

@ -3,11 +3,11 @@ package com.hiddenservices.onionservices.constants;
public class enums {
/*Settings Manager*/
public enum etype {
M_CHANGE_HOME_THEME, M_IS_ERROR_PAGE, on_update_favicon, M_RELOAD, ON_UPDATE_TAB_TITLE, ON_OPEN_TAB_VIEW, ON_NEW_TAB_ANIMATION, M_UPDATE_SESSION_STATE, ON_LOAD_REQUEST, GECKO_SCROLL_UP, GECKO_SCROLL_UP_ALWAYS, GECKO_SCROLL_DOWN, WAS_SCROLL_CHANGED, GECKO_SCROLL_DOWN_MOVE, GECKO_SCROLL_UP_MOVE, GECKO_SCROLL_DOWN_CALLER, ON_UPDATE_SEARCH_BAR, M_ON_MAIL, SESSION_ID, M_UPDATE_PIXEL_BACKGROUND, M_ON_SCROLL_BOUNDARIES, M_ON_SCROLL_TOP_BOUNDARIES, M_ON_SCROLL_NO_BOUNDARIES, M_ON_STOP_SCROLL, M_INIT_PADDING, M_RATE_COUNT, M_CACHE_UPDATE_TAB, M_DEFAULT_BROWSER,
M_CHANGE_HOME_THEME, M_IS_ERROR_PAGE, on_update_favicon, M_RELOAD, ON_UPDATE_TAB_TITLE, ON_OPEN_TAB_VIEW, ON_NEW_TAB_ANIMATION, M_UPDATE_SESSION_STATE, ON_LOAD_REQUEST, GECKO_SCROLL_UP, GECKO_SCROLL_UP_ALWAYS, GECKO_SCROLL_DOWN, WAS_SCROLL_CHANGED, GECKO_SCROLL_DOWN_MOVE, GECKO_SCROLL_UP_MOVE, GECKO_SCROLL_DOWN_CALLER, ON_UPDATE_SEARCH_BAR, ON_DESTROY_MEDIA, M_ON_MAIL, SESSION_ID, M_UPDATE_PIXEL_BACKGROUND, M_ON_SCROLL_BOUNDARIES, M_ON_SCROLL_TOP_BOUNDARIES, M_ON_SCROLL_NO_BOUNDARIES, M_ON_STOP_SCROLL, M_INIT_PADDING, M_RATE_COUNT, M_CACHE_UPDATE_TAB, M_DEFAULT_BROWSER,
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_GET_SSL_STATUS, 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_INIT_RUNTIME_SETTINGS, M_INIT_TOR, 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_LOAD_ADVERT, ON_SESSION_REINIT, on_page_loaded, on_load_error, M_ORBOT_LOADING, download_file_popup, on_init_ads, on_full_screen_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_INIT_TOR, 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_LOAD_ADVERT, ON_SESSION_REINIT, on_page_loaded, on_load_error, M_ORBOT_LOADING, download_file_popup, on_init_ads, on_full_screen_ads, M_GET_CURRENT_URL, search_update, open_new_tab, open_new_tab_instant
}
/*General Enums*/
@ -25,6 +25,10 @@ public class enums {
public static final int CRITICAL_MEMORY = 3;
}
public enum MediaController {
DESTROY, PLAY, PAUSE, SKIP_FORWARD, SKIP_BACKWARD, STOP;
}
public static class AddTabCallback {
public static final int TAB_ADDED = 0;
public static final int TAB_FULL = 1;
@ -42,12 +46,6 @@ public class enums {
public static final int SEARCHBAR = 2;
}
public static class ImageQueueStatus {
public static final int M_IMAGE_LOADING = 0;
public static final int M_IMAGE_LOADED_SUCCESSFULLY = 1;
public static final int M_IMAGE_LOADING_FAILED = 2;
}
public static class ScrollDirection {
public static final int HORIZONTAL = 0;
public static final int VERTICAL = 1;
@ -58,11 +56,5 @@ public class enums {
public static final String OPEN_VOICE = "mOpenVoice";
}
public static class LandingPageTypes {
public static final int M_LANDING_WELCOME = 0;
public static final int M_LANDING_INTRO = 1;
public static final int M_LANDING_START = 2;
}
}

View File

@ -31,9 +31,10 @@ public class bookmarkDataModel {
void initializebookmark(ArrayList<bookmarkRowModel> pBookmark) {
mBookmarks = pBookmark;
for (int mCounter = 0; mCounter < pBookmark.size(); mCounter++) {
for (int mCounter = pBookmark.size()-1; mCounter >= 0; mCounter--) {
if (mAvailableBookmark.containsKey(pBookmark.get(mCounter).getDescription())) {
deleteBookmark(pBookmark.get(mCounter).getID());
mCounter++;
} else {
mAvailableBookmark.put(pBookmark.get(mCounter).getDescription(), pBookmark.get(mCounter).getID());
}

View File

@ -52,7 +52,7 @@ public class tabRowModel {
public void setSession(geckoSession pSession, String pURL, String pTitle, String pTheme, GeckoSession.SessionState pSessionState) {
mSession = pSession;
mSession.setTitle(pTitle);
mSession.setURL(pURL);
mSession.getHistoryDelegate().setURL(pURL);
mSession.setTheme(pTheme);
if (pSessionState != null) {
@ -63,7 +63,7 @@ public class tabRowModel {
if (!status.sSettingIsAppStarted) {
if (pTitle.equals("$TITLE") || pTitle.startsWith("http://loading") || pTitle.startsWith("loading") || pURL.equals("$TITLE") || pURL.startsWith("http://loading") || pURL.startsWith("loading")) {
mSession.setTitle("about:blank");
mSession.setURL("about:blank");
mSession.getHistoryDelegate().setURL("about:blank");
}
}
}

View File

@ -56,7 +56,7 @@ import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import androidx.core.graphics.ColorUtils;
import com.example.myapplication.BuildConfig;
import com.hiddenservices.onionservices.BuildConfig;
import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession;
import com.hiddenservices.onionservices.appManager.kotlinHelperLibraries.defaultBrowser;
@ -66,7 +66,7 @@ import com.hiddenservices.onionservices.constants.keys;
import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.libs.trueTime.trueTimeEncryption;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.io.BufferedReader;
import java.io.BufferedWriter;
@ -387,9 +387,9 @@ public class helperMethod {
ss.setSpan(new ForegroundColorSpan(Color.GRAY), 5, 8, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
if(pTheme != enums.Theme.THEME_DARK){
ss.setSpan(new ForegroundColorSpan(Color.BLACK), getHost(url).length()+7, url.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
ss.setSpan(new ForegroundColorSpan(Color.BLACK), getHost(url).length()+8, url.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}else {
ss.setSpan(new ForegroundColorSpan(Color.WHITE), getHost(url).length()+7, url.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
ss.setSpan(new ForegroundColorSpan(Color.WHITE), getHost(url).length()+8, url.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
return ss;
}else {

View File

@ -15,7 +15,7 @@ import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.appManager.activityThemeManager;
import com.hiddenservices.onionservices.pluginManager.pluginController;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.Collections;

View File

@ -19,7 +19,7 @@ package com.hiddenservices.onionservices.libs.netcipher.client;
import android.content.Context;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.io.IOException;
import java.io.InputStream;

View File

@ -22,32 +22,32 @@ public class appLovinManager {
public appLovinManager(eventObserver.eventListener pEvent, View pBannerAds, AppCompatActivity pContext) {
this.mEvent = pEvent;
this.mContext = pContext;
onInitializeAdvertisement(pContext);
}
private void onInitializeAdvertisement(AppCompatActivity pContext) {
AppLovinSdk.getInstance(pContext).getSettings().setVerboseLogging(true);
AppLovinSdk.getInstance(pContext).setMediationProvider("max");
AppLovinSdk.initializeSdk(pContext, configuration -> {
if(!mLowMemoryReached){
this.mSupportManager = new applovinSupportManager(pContext);
this.mBannerManager = new applovinBannerManager(pContext, mEvent);
}
});
private void onInitializeAdvertisement() {
if(!mLowMemoryReached){
AppLovinSdk.getInstance(mContext).getSettings().setVerboseLogging(true);
AppLovinSdk.getInstance(mContext).setMediationProvider("max");
AppLovinSdk.initializeSdk(mContext, configuration -> {
if(!mLowMemoryReached){
this.mSupportManager = new applovinSupportManager(mContext);
this.mBannerManager = new applovinBannerManager(mContext, mEvent);
}
});
}
}
/*Local Helper Methods*/
private void onShowInterstitial() {
if(AppLovinSdk.getInstance(mContext).isInitialized()){
if(AppLovinSdk.getInstance(mContext).isInitialized() && this.mSupportManager!=null){
this.mSupportManager.onShow();
}
}
private void onToggleBannerShow(boolean pStatus) {
if(AppLovinSdk.getInstance(mContext).isInitialized()){
this.mBannerManager.onShow(pStatus);
if(AppLovinSdk.getInstance(mContext).isInitialized() && this.mBannerManager!=null){
this.mBannerManager.onShowToggle(pStatus);
}
}
@ -55,7 +55,9 @@ public class appLovinManager {
private void onDestroy() {
mLowMemoryReached = true;
mBannerManager.onDestroy();
if(mBannerManager!=null){
mBannerManager.onDestroy();
}
}
/*External Triggers*/
@ -71,6 +73,8 @@ public class appLovinManager {
onToggleBannerShow(false);
} else if (pEventType.equals(pluginEnums.eAdManager.M_SHOW_INTERSTITIAL)) {
onShowInterstitial();
} else if (pEventType.equals(pluginEnums.eAdManager.M_INIT_ADS)) {
onInitializeAdvertisement();
}
return null;
}

View File

@ -20,7 +20,7 @@ public class applovinBannerManager implements MaxAdViewAdListener{
private static final String S_UNIT_ID = "642ec6302c7cecd2";
private MaxAdView mBanner;
eventObserver.eventListener mEvent;
private eventObserver.eventListener mEvent;
/* Initializations */
@ -46,7 +46,7 @@ public class applovinBannerManager implements MaxAdViewAdListener{
/* Helper Methods */
public void onShow(boolean pStatus) {
public void onShowToggle(boolean pStatus) {
if(mBanner!=null){
if(pStatus){
mBanner.startAutoRefresh();

View File

@ -9,7 +9,7 @@ import android.webkit.JavascriptInterface;
import androidx.core.app.NotificationCompat;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.io.File;
import java.io.FileOutputStream;

View File

@ -26,7 +26,7 @@ import com.hiddenservices.onionservices.constants.status;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.libs.netcipher.client.StrongHttpsClient;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import org.torproject.android.service.wrapper.orbotLocalConstants;

View File

@ -31,7 +31,7 @@ import com.hiddenservices.onionservices.constants.strings;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.helperManager.helperMethod;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import org.mozilla.geckoview.ContentBlocking;
import java.util.Arrays;

View File

@ -15,7 +15,7 @@ import androidx.core.app.NotificationCompat;
import com.hiddenservices.onionservices.appManager.activityContextManager;
import com.hiddenservices.onionservices.constants.strings;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.Random;

View File

@ -14,7 +14,7 @@ import androidx.core.app.NotificationCompat;
import com.hiddenservices.onionservices.eventObserver;
import com.hiddenservices.onionservices.pluginManager.pluginEnums;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.lang.ref.WeakReference;
import java.util.List;

View File

@ -4,7 +4,7 @@ public class pluginEnums {
/*Advert Manager*/
public enum eAdManager {
M_IS_ADVERT_LOADED, M_LOW_MEMORY_DESTROY, M_HIDE_BANNER, M_SHOW_BANNER, M_SHOW_INTERSTITIAL
M_IS_ADVERT_LOADED, M_LOW_MEMORY_DESTROY, M_HIDE_BANNER, M_SHOW_BANNER, M_SHOW_INTERSTITIAL, M_INIT_ADS
}
public enum eAdManagerCallbacks {

View File

@ -10,7 +10,7 @@ import android.os.Bundle;
import android.util.Log;
import android.widget.RemoteViews;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import com.widget.onionservices.helperMethod.helperMethod;
import java.util.Arrays;

View File

@ -6,7 +6,7 @@ import android.view.View;
import android.widget.RemoteViews;
import com.hiddenservices.onionservices.eventObserver;
import com.example.myapplication.R;
import com.hiddenservices.onionservices.R;
import java.util.List;

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:bottom="1dp"
android:left="-2dp"
android:right="-2dp"
android:top="-2dp">
<shape android:shape="rectangle" >
<stroke
android:width="1dp"
android:color="@color/c_ripple_v2" />
<solid android:color="#00FFFFFF" />
<padding android:left="10dp"
android:right="10dp"
android:top="10dp"
android:bottom="10dp" />
</shape>
</item>
</layer-list>

View File

@ -156,7 +156,7 @@
android:layout_marginTop="0dp"
android:layout_marginEnd="0dp"
android:layout_weight="17"
android:background="@xml/gx_ripple_blue"
android:background="@xml/bx_border_recycleview"
android:textAllCaps="false"
android:paddingStart="20dp"
android:stateListAnimator="@null"
@ -179,6 +179,7 @@
android:id="@+id/pRecycleView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="100dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -180,6 +180,7 @@
android:id="@+id/pRecycleView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="100dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -70,6 +70,7 @@
android:layout_marginEnd="10dp"
android:clickable="false"
android:ellipsize="end"
android:textAlignment="viewStart"
android:maxLines="1"
android:paddingStart="10dp"
android:paddingEnd="0dp"

View File

@ -473,7 +473,7 @@
android:background="@xml/hox_rounded_corner_splash_right"
android:contentDescription="@string/GENERAL_TODO"
android:onClick="onSupportSplash"
app:tint="@color/c_setting_icon_tint"
app:tint="#425e8a"
android:padding="6dp"
android:scaleType="fitCenter"
android:src="@xml/ic_baseline_support"

Some files were not shown because too many files have changed in this diff Show More