diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 7d7ec2ea..3e3a51b0 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
new file mode 100644
index 00000000..131ce921
--- /dev/null
+++ b/.idea/deploymentTargetDropDown.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 88249687..3121f48a 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -7,6 +7,7 @@
+
-
+
\ No newline at end of file
diff --git a/.safedk/app_sdks.lst b/.safedk/app_sdks.lst
index fa13df4a..4190b730 100644
--- a/.safedk/app_sdks.lst
+++ b/.safedk/app_sdks.lst
@@ -1,5 +1,6 @@
25a8c13da7993b03825942fe7b22a98f
fd38d80abf402c0cce74ac84b578f259
+290c7ef397aa241b98bf9cf07be6584f
4df96d3bc9afd17b812e65e6c6add1ef
974322f19d813702ea048d95288d2b8c
29015bbfcc182d80e7f75bd2c38e4521
diff --git a/.safedk/hashes.safedk b/.safedk/hashes.safedk
index 9044fa7f..b67c308b 100644
--- a/.safedk/hashes.safedk
+++ b/.safedk/hashes.safedk
@@ -1,3 +1,3 @@
-#Wed Feb 15 00:42:23 PKT 2023
+#Sat Feb 25 16:05:10 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=337604914
+json=2083951825
diff --git a/.safedk/plugin.properties b/.safedk/plugin.properties
index 793f0798..3bf4d037 100644
--- a/.safedk/plugin.properties
+++ b/.safedk/plugin.properties
@@ -1,6 +1,6 @@
#
-#Wed Feb 15 01:32:40 PKT 2023
+#Sat Feb 25 16:05:10 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=
+pCPe4EeU2ZQVwQPeHLgseRqHBX1V5pvo9Piuu4J809dRhadEgukXa1A8po_UeXu5hmPOTaP1v4QPaMKIEOhh50=hGlhanpemGqPOKKAgaXvhyxwZaG9uD68csy1OadWTNhEgKvBWR7-7KSpyFr6nfZ4KMOuBBV5J49s2LLSg-SVxg
sdk_analysis_plugin_version=4.8.5
set_multidex=true
-pCPe4EeU2ZQVwQPeHLgseRqHBX1V5pvo9Piuu4J809dRhadEgukXa1A8po_UeXu5hmPOTaP1v4QPaMKIEOhh50=hGlhanpemGqPOKKAgaXvhyxwZaG9uD68csy1OadWTNhEgKvBWR7-7KSpyFr6nfZ4KMOuBBV5J49s2LLSg-SVxg
diff --git a/OrbotLib/build/.transforms/5bcfbaece43949bb105e0266ed7ac793/results.bin b/OrbotLib/build/.transforms/5bcfbaece43949bb105e0266ed7ac793/results.bin
new file mode 100644
index 00000000..2de4c85c
--- /dev/null
+++ b/OrbotLib/build/.transforms/5bcfbaece43949bb105e0266ed7ac793/results.bin
@@ -0,0 +1 @@
+o/jetified-OrbotLib-runtime
diff --git a/OrbotLib/build/.transforms/5bcfbaece43949bb105e0266ed7ac793/transformed/jetified-OrbotLib-runtime/classes.dex b/OrbotLib/build/.transforms/5bcfbaece43949bb105e0266ed7ac793/transformed/jetified-OrbotLib-runtime/classes.dex
new file mode 100644
index 00000000..74cc7b41
Binary files /dev/null and b/OrbotLib/build/.transforms/5bcfbaece43949bb105e0266ed7ac793/transformed/jetified-OrbotLib-runtime/classes.dex differ
diff --git a/app/build.gradle b/app/build.gradle
index 4cef8cad..f10cb4da 100755
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -121,6 +121,7 @@ dependencies {
implementation "net.zetetic:android-database-sqlcipher:4.4.3"
implementation project(':xcrash_lib')
+ implementation 'com.karumi:dexter:6.2.3'
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 48e4f459..576abcb1 100755
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -4,7 +4,7 @@
-
+
@@ -30,7 +30,7 @@
data, Object event_type) {
- if (event_type.equals(advertEnums.eAdvertClientCallback.M_UPDATE_PROGRESSBAR)) {
- mAdvertViewController.onTrigger(advertEnums.eAdvertViewController.M_UPDATE_PROGRESSBAR, Collections.singletonList(data.get(0)));
- }
- return null;
- }
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/advertManager/advertEnums.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/advertManager/advertEnums.java
deleted file mode 100644
index 566c3ac2..00000000
--- a/app/src/main/java/com/hiddenservices/onionservices/appManager/advertManager/advertEnums.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.hiddenservices.onionservices.appManager.advertManager;
-
-class advertEnums {
- /*History Manager*/
- public enum eAdvertClientCallback {
- M_UPDATE_PROGRESSBAR
- }
-
- public enum eAdvertViewController {
- M_UPDATE_PROGRESSBAR
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/bridgeManager/bridgeModel.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/bridgeManager/bridgeModel.java
index ea046ffb..8108080e 100644
--- a/app/src/main/java/com/hiddenservices/onionservices/appManager/bridgeManager/bridgeModel.java
+++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/bridgeManager/bridgeModel.java
@@ -48,7 +48,6 @@ class bridgeModel {
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1, status.sBridgeCustomBridge));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE, status.sBridgeCustomType));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL, status.sBridgeGatewayManual));
-
pluginController.getInstance().onOrbotInvoke(Collections.singletonList("custom"), pluginEnums.eOrbotManager.M_UPDATE_BRIDGE_LIST);
}
@@ -60,7 +59,6 @@ class bridgeModel {
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1, status.sBridgeCustomBridge));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE, status.sBridgeCustomType));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL, status.sBridgeGatewayManual));
-
pluginController.getInstance().onOrbotInvoke(Collections.singletonList("meek"), pluginEnums.eOrbotManager.M_UPDATE_BRIDGE_LIST);
}
diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/externalCommandManager/externalURLNavigationContoller.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/externalCommandManager/externalURLNavigationContoller.java
index 7900eb02..78781bb2 100644
--- a/app/src/main/java/com/hiddenservices/onionservices/appManager/externalCommandManager/externalURLNavigationContoller.java
+++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/externalCommandManager/externalURLNavigationContoller.java
@@ -12,7 +12,7 @@ import androidx.appcompat.app.AppCompatActivity;
import com.hiddenservices.onionservices.R;
import com.hiddenservices.onionservices.appManager.activityContextManager;
-import com.hiddenservices.onionservices.appManager.advertManager.advertController;
+import com.hiddenservices.onionservices.appManager.unproxiedConnectionManager.unproxiedConnectionController;
import com.hiddenservices.onionservices.appManager.homeManager.homeController.homeController;
import com.hiddenservices.onionservices.constants.constants;
import com.hiddenservices.onionservices.constants.keys;
@@ -35,11 +35,13 @@ public class externalURLNavigationContoller extends AppCompatActivity {
{
if (mData[0] !=null && status.sIsBackgroundAdvertCheck) {
status.sIsBackgroundAdvertCheck = false;
- Intent myIntent = new Intent(activityContextManager.getInstance().getHomeController(), advertController.class);
+ Intent myIntent = new Intent(activityContextManager.getInstance().getHomeController(), unproxiedConnectionController.class);
myIntent.putExtra(keys.ADVERT_URL, mData[0].toString());
myIntent.addFlags(FLAG_ACTIVITY_NO_ANIMATION);
myIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
+ activityContextManager.getInstance().getHomeController().onAdvertClickPauseSession();
activityContextManager.getInstance().getHomeController().startActivity(myIntent);
+
} else {
if (mData[0] == null) {
mData[0] = Uri.parse(constants.CONST_BACKEND_GENESIS_URL);
diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/historyDelegate.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/historyDelegate.java
index c62ead23..84055b7a 100644
--- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/historyDelegate.java
+++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/historyDelegate.java
@@ -4,13 +4,16 @@ package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.del
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.appManager.homeManager.homeController.homeEnums;
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;
@@ -19,7 +22,7 @@ public class historyDelegate implements GeckoSession.HistoryDelegate {
/*Private Variables*/
private WeakReference mContext;
- private GeckoSession.HistoryDelegate.HistoryList mHistory = null;
+ private HistoryList mHistory = null;
private eventObserver.eventListener mEvent;
private geckoDataModel mGeckoDataModel;
private geckoSession mGeckoSession;
@@ -35,20 +38,29 @@ public class historyDelegate implements GeckoSession.HistoryDelegate {
}
@UiThread
- public void onHistoryStateChange(@NonNull GeckoSession var1, @NonNull GeckoSession.HistoryDelegate.HistoryList var2) {
- if(mHistory !=null && mHistory.size()!=var2.size()){
- mHistory = var2;
- setURL(mHistory.get(mHistory.getCurrentIndex()).getUri());
+ public void onHistoryStateChange(@NonNull GeckoSession var1, @NonNull HistoryList var2) {
+ boolean mHistoryChanged = false;
+ if(mHistory!=null){
+ mHistoryChanged = mHistory.size()!=var2.size() || mHistory.size()!=var2.getCurrentIndex();
+ }
+ if(mHistory==null || mHistory.size()!=var2.size()){
+ //mGeckoDataModel.mTheme = null;
+ }
+ mHistory = var2;
+ if(mHistory !=null){
+ if(mHistoryChanged){
+ if(!mHistory.get(mHistory.getCurrentIndex()).getUri().equals("about:blank")){
+ setURL(mHistory.get(mHistory.getCurrentIndex()).getUri());
+ }
+ }
mEvent.invokeObserver(Arrays.asList(mHistory, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.ON_URL_LOAD);
- if(mCurrentIndex != var2.getCurrentIndex()){
+ if(mCurrentIndex != var2.getCurrentIndex() && mHistoryChanged){
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mHistory.get(mHistory.getCurrentIndex()).getTitle(), mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, mGeckoSession), homeEnums.eGeckoCallback.ON_UPDATE_SEARCH_BAR);
}
Object mID = mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mHistory.get(mHistory.getCurrentIndex()).getTitle(), -1, mGeckoDataModel.mTheme, mGeckoSession, false), homeEnums.eGeckoCallback.ON_UPDATE_HISTORY);
if (mID != null) {
mGeckoDataModel.mCurrentURL_ID = (int) mID;
}
- }else {
- mHistory = var2;
}
mCurrentIndex = var2.getCurrentIndex();
}
diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/mediaSessionDelegate.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/mediaSessionDelegate.java
index febcf946..e5721e17 100644
--- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/mediaSessionDelegate.java
+++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/mediaSessionDelegate.java
@@ -123,6 +123,8 @@ public class mediaSessionDelegate implements MediaSession.Delegate{
else if(pCommands.equals(enums.MediaController.SKIP_FORWARD)){
mMediaSession.nextTrack();
}
+ }else {
+ mMediaDelegate.onHideDefaultNotification();
}
}
}
diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/navigationDelegate.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/navigationDelegate.java
index 330dfcbf..1fc23353 100644
--- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/navigationDelegate.java
+++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/navigationDelegate.java
@@ -139,6 +139,9 @@ public class navigationDelegate implements GeckoSession.NavigationDelegate {
public GeckoResult onLoadError(@NonNull GeckoSession var1, @Nullable String var2, @NonNull WebRequestError var3) {
try {
+ if(var2==null){
+ var2 = this.mGeckoDataModel.mCurrentURL;
+ }
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, mGeckoSession), homeEnums.eGeckoCallback.ON_DESTROY_MEDIA);
if (helperMethod.getHost(var2).endsWith(".onion")) {
var2 = var2.replace("www.", "");
@@ -154,7 +157,7 @@ public class navigationDelegate implements GeckoSession.NavigationDelegate {
if (status.sSettingIsAppStarted && orbotLocalConstants.mIsTorInitialized) {
errorHandler handler = new errorHandler();
mEvent.invokeObserver(Arrays.asList(var2, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.ON_LOAD_ERROR);
- mGeckoDataModel.mTheme = null;
+ //mGeckoDataModel.mTheme = null;
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mCurrentURL, mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mTheme), homeEnums.eGeckoCallback.ON_UPDATE_THEME);
InputStream mResourceURL = null;
diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/permissionDelegate.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/permissionDelegate.java
new file mode 100644
index 00000000..3bb3ae69
--- /dev/null
+++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/permissionDelegate.java
@@ -0,0 +1,105 @@
+package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel;
+
+import android.Manifest;
+import android.content.pm.PackageManager;
+import android.net.Uri;
+import android.os.Build;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.core.content.ContextCompat;
+import com.hiddenservices.onionservices.R;
+import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.geckoSession;
+import java.lang.ref.WeakReference;
+import java.util.Locale;
+import org.mozilla.geckoview.GeckoSession;
+import org.mozilla.geckoview.GeckoSession.PermissionDelegate;
+
+public class permissionDelegate implements PermissionDelegate {
+
+ public int androidPermissionRequestCode = 1;
+ private WeakReference mContext;
+ private geckoSession mGeckoSession;
+
+ public permissionDelegate(WeakReference pContext, geckoSession pGeckoSession){
+ this.mContext = pContext;
+ this.mGeckoSession = pGeckoSession;
+ }
+
+ @Override
+ public void onAndroidPermissionsRequest(final GeckoSession session, final String[] permissions, final Callback callback) {
+ if (Build.VERSION.SDK_INT >= 23) {
+ // requestPermissions was introduced in API 23.
+ mContext.get().requestPermissions(permissions, androidPermissionRequestCode);
+ } else {
+ callback.grant();
+ }
+ }
+
+
+ private String[] normalizeMediaName(final MediaSource[] sources) {
+ if (sources == null) {
+ return null;
+ }
+
+ String[] res = new String[sources.length];
+ for (int i = 0; i < sources.length; i++) {
+ final int mediaSource = sources[i].source;
+ final String name = sources[i].name;
+ if (MediaSource.SOURCE_CAMERA == mediaSource) {
+ if (name.toLowerCase(Locale.ROOT).contains("front")) {
+ res[i] = "Front Camera";
+ } else {
+ res[i] = "Back Camera";
+ }
+ } else if (!name.isEmpty()) {
+ res[i] = name;
+ } else if (MediaSource.SOURCE_MICROPHONE == mediaSource) {
+ res[i] = "Microphone";
+ } else {
+ res[i] = "Other";
+ }
+ }
+
+ return res;
+ }
+
+ @Override
+ public void onMediaPermissionRequest(
+ final GeckoSession session,
+ final String uri,
+ final MediaSource[] video,
+ final MediaSource[] audio,
+ final MediaCallback callback) {
+ // If we don't have device permissions at this point, just automatically reject the request
+ // as we will have already have requested device permissions before getting to this point
+ // and if we've reached here and we don't have permissions then that means that the user
+ // denied them.
+ if ((audio != null
+ && ContextCompat.checkSelfPermission(
+ mContext.get(), Manifest.permission.RECORD_AUDIO)
+ != PackageManager.PERMISSION_GRANTED)
+ || (video != null
+ && ContextCompat.checkSelfPermission(
+ mContext.get(), Manifest.permission.CAMERA)
+ != PackageManager.PERMISSION_GRANTED)) {
+ callback.reject();
+ return;
+ }
+
+ final String host = Uri.parse(uri).getAuthority();
+ final String title;
+ if (audio == null) {
+ title = "Request Video";
+ } else if (video == null) {
+ title = "Request Audio";
+ } else {
+ title = "Request Media";
+ }
+
+ String[] videoNames = normalizeMediaName(video);
+ String[] audioNames = normalizeMediaName(audio);
+
+ final promptDelegate prompt =
+ (promptDelegate) mGeckoSession.getPromptDelegate();
+ prompt.onMediaPrompt(session, title, video, audio, videoNames, audioNames, callback);
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/progressDelegate.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/progressDelegate.java
index ab1cbcf4..290a7243 100644
--- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/progressDelegate.java
+++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/progressDelegate.java
@@ -26,7 +26,7 @@ public class progressDelegate implements GeckoSession.ProgressDelegate {
private SecurityInformation securityInfo = null;
private GeckoSession.SessionState mSessionState;
private boolean mIsLoaded = false;
- private int mProgress = 0;
+ private int mProgress = 5;
/*Initializations*/
@@ -34,11 +34,13 @@ public class progressDelegate implements GeckoSession.ProgressDelegate {
this.mContext = pContext;
this.mEvent = pEvent;
this.mGeckoDataModel = pGeckoDataModel;
+
}
@UiThread
public void onSecurityChange(@NonNull final GeckoSession session, @NonNull final SecurityInformation securityInfo) {
this.securityInfo = securityInfo;
+ mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, securityInfo.isSecure, this), homeEnums.eGeckoCallback.M_UPDATE_SSL);
}
@Override
@@ -47,7 +49,9 @@ public class progressDelegate implements GeckoSession.ProgressDelegate {
mProgress = progress;
if (progress <= 20) {
- mContext.get().runOnUiThread(() -> mEvent.invokeObserver(Arrays.asList(5, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.PROGRESS_UPDATE));
+ mContext.get().runOnUiThread(() -> {
+ mEvent.invokeObserver(Arrays.asList(5, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.PROGRESS_UPDATE);
+ });
} else {
if (progress == 100) {
mEvent.invokeObserver(Arrays.asList(mGeckoDataModel.mSessionID, mGeckoDataModel.mCurrentTitle, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, this), homeEnums.eGeckoCallback.ON_INVOKE_PARSER);
@@ -55,7 +59,9 @@ public class progressDelegate implements GeckoSession.ProgressDelegate {
checkApplicationRate();
}
}
- mContext.get().runOnUiThread(() -> mEvent.invokeObserver(Arrays.asList(mProgress, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.PROGRESS_UPDATE));
+ mContext.get().runOnUiThread(() -> {
+ mEvent.invokeObserver(Arrays.asList(mProgress, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.PROGRESS_UPDATE);
+ });
}
}
}
@@ -68,12 +74,21 @@ public class progressDelegate implements GeckoSession.ProgressDelegate {
@Override
public void onPageStart(@NonNull GeckoSession var1, @NonNull String var2) {
+ securityInfo = null;
mGeckoDataModel.mTheme = null;
- mEvent.invokeObserver(Arrays.asList(5, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.PROGRESS_UPDATE_FORCED);
+ mProgress = 5;
+ mEvent.invokeObserver(Arrays.asList(5, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.PROGRESS_UPDATE);
+ if(var2.startsWith("jar:file")){
+ return;
+ }
mEvent.invokeObserver(Arrays.asList(var2, mGeckoDataModel.mSessionID, var2, mGeckoDataModel.mCurrentURL_ID, mGeckoDataModel.mTheme, null), homeEnums.eGeckoCallback.ON_UPDATE_SEARCH_BAR);
- if (mIsLoaded) {
- if (!mGeckoDataModel.mCurrentURL.equals("about:config") && !var2.equals("about:blank") && helperMethod.getHost(var2).endsWith(".onion")) {
- var2 = var2.replace("www.", "");
+
+ //if (mIsLoaded) {
+ if (!mGeckoDataModel.mCurrentURL.equals("about:config") && !var2.equals("about:blank") && !var2.startsWith("jar:file")) {
+ if(helperMethod.getHost(var2).endsWith(".onion")){
+ var2 = var2.replace("www.", "");
+ }
+ this.mGeckoDataModel.mCurrentURL = var2;
}
if(mGeckoDataModel.mCurrentURL.replace("http","https://").equals(var2)){
@@ -90,7 +105,7 @@ public class progressDelegate implements GeckoSession.ProgressDelegate {
mEvent.invokeObserver(Arrays.asList(var2, mGeckoDataModel.mSessionID), homeEnums.eGeckoCallback.SEARCH_UPDATE);
}
}
- }
+ //}
}
@UiThread
@@ -132,8 +147,16 @@ public class progressDelegate implements GeckoSession.ProgressDelegate {
return mProgress;
}
- public void getProgress(int pProgress){
- mProgress = pProgress;
+ public void resetProgress() {
+ mProgress = 5;
+ }
+
+ public boolean getSecurtityState(){
+ if(securityInfo==null){
+ return false;
+ }else {
+ return securityInfo.isSecure;
+ }
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/promptDelegate.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/promptDelegate.java
index 59ce4f2a..754740bf 100644
--- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/promptDelegate.java
+++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/delegateModel/promptDelegate.java
@@ -1,5 +1,7 @@
package com.hiddenservices.onionservices.appManager.homeManager.geckoManager.delegateModel;
+import static android.provider.OpenableColumns.DISPLAY_NAME;
+
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
@@ -10,6 +12,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.TypedArray;
+import android.database.Cursor;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.net.Uri;
@@ -37,8 +40,12 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ShareCompat;
+
import com.hiddenservices.onionservices.appManager.activityContextManager;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.nio.channels.FileChannel;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -48,6 +55,7 @@ import java.util.Locale;
import org.mozilla.geckoview.AllowOrDeny;
import org.mozilla.geckoview.GeckoResult;
import org.mozilla.geckoview.GeckoSession;
+import org.mozilla.geckoview.GeckoSession.PermissionDelegate.MediaSource;
import org.mozilla.geckoview.SlowScriptResponse;
public final class promptDelegate implements GeckoSession.PromptDelegate {
@@ -57,7 +65,7 @@ public final class promptDelegate implements GeckoSession.PromptDelegate {
private FilePrompt mFilePrompt;
static final String LOGTAG = "BasicGeckoViewPrompt";
- public int filePickerRequestCode = 1;
+ public int filePickerRequestCode = 115;
public promptDelegate(final AppCompatActivity activity) {
mActivity = activity;
@@ -244,11 +252,14 @@ public final class promptDelegate implements GeckoSession.PromptDelegate {
private int getViewPadding(final AlertDialog.Builder builder) {
stopMedia();
- final TypedArray attr = builder.getContext().obtainStyledAttributes(
- new int[]{android.R.attr.listPreferredItemPaddingLeft});
- final int padding = attr.getDimensionPixelSize(0, 1);
- attr.recycle();
- return padding;
+ try {
+ final TypedArray attr = builder.getContext().obtainStyledAttributes(
+ new int[]{android.R.attr.listPreferredItemPaddingLeft});
+ final int padding = attr.getDimensionPixelSize(0, 1);
+ attr.recycle();
+ return padding;
+ }catch (Exception ex){}
+ return 0;
}
private LinearLayout addStandardLayout(final AlertDialog.Builder builder,
@@ -874,8 +885,9 @@ public final class promptDelegate implements GeckoSession.PromptDelegate {
return res;
}
+ @SuppressLint("Range")
public void onFileCallbackResult(final int resultCode, final Intent data) {
- stopMedia();
+
if (mFileResponse == null) {
return;
}
@@ -891,24 +903,66 @@ public final class promptDelegate implements GeckoSession.PromptDelegate {
return;
}
- final Uri uri = data.getData();
+
+
+
+
+ Uri mURI = data.getData();
+ String result = null;
+ if (mURI.getScheme().equals("content")) {
+ Cursor cursor = mActivity.getContentResolver().query(mURI, null, null, null, null);
+ try {
+ if (cursor != null && cursor.moveToFirst()) {
+ result = cursor.getString(cursor.getColumnIndex(DISPLAY_NAME));
+ }
+ } finally {
+ cursor.close();
+ }
+ }
+ if (result == null) {
+ result = mURI.getPath();
+ int cut = result.lastIndexOf('/');
+ if (cut != -1) {
+ result = result.substring(cut + 1);
+ }
+ }
+
+
+ File myFile = new File(mActivity.getFilesDir(),result);
final ClipData clip = data.getClipData();
- if (prompt.type == FilePrompt.Type.SINGLE ||
- (prompt.type == FilePrompt.Type.MULTIPLE && clip == null)) {
- res.complete(prompt.confirm(mActivity, uri));
- } else if (prompt.type == FilePrompt.Type.MULTIPLE) {
- if (clip == null) {
- Log.w(LOGTAG, "No selected file");
- res.complete(prompt.dismiss());
- return;
+ try {
+ FileInputStream in = (FileInputStream) mActivity.getContentResolver().openInputStream(data.getData());
+ FileOutputStream out = new FileOutputStream(myFile);
+ FileChannel inChannel = in.getChannel();
+ FileChannel outChannel = out.getChannel();
+ inChannel.transferTo(0, inChannel.size(), outChannel);
+ in.close();
+ out.close();
+ } catch (Exception e) {}
+
+ final Uri uri = Uri.parse("file:///"+myFile.getAbsolutePath());
+
+ try {
+ if (prompt.type == FilePrompt.Type.SINGLE
+ || (prompt.type == FilePrompt.Type.MULTIPLE && clip == null)) {
+ res.complete(prompt.confirm(mActivity, uri));
+ } else if (prompt.type == FilePrompt.Type.MULTIPLE) {
+ if (clip == null) {
+ Log.w(LOGTAG, "No selected file");
+ res.complete(prompt.dismiss());
+ return;
+ }
+ final int count = clip.getItemCount();
+ final ArrayList uris = new ArrayList<>(count);
+ for (int i = 0; i < count; i++) {
+ uris.add(clip.getItemAt(i).getUri());
+ }
+ res.complete(prompt.confirm(mActivity, uris.toArray(new Uri[uris.size()])));
}
- final int count = clip.getItemCount();
- final ArrayList uris = new ArrayList<>(count);
- for (int i = 0; i < count; i++) {
- uris.add(clip.getItemAt(i).getUri());
- }
- res.complete(prompt.confirm(mActivity, uris.toArray(new Uri[0])));
+ }catch (Exception ex){
+ int e=0;
+ e=1;
}
}
@@ -944,29 +998,31 @@ public final class promptDelegate implements GeckoSession.PromptDelegate {
dialog.show();
}
- private Spinner addMediaSpinner(final Context context, final ViewGroup container,
- final GeckoSession.PermissionDelegate.MediaSource[] sources, final String[] sourceNames) {
- final ArrayAdapter adapter = new ArrayAdapter(
- context, android.R.layout.simple_spinner_item) {
- private View convertView(final int position, final View view) {
- if (view != null) {
- ((TextView) view).setText(sourceNames != null ? sourceNames[position] : "media");
- }
- return view;
- }
+ private Spinner addMediaSpinner(
+ final Context context,
+ final ViewGroup container,
+ final MediaSource[] sources,
+ final String[] sourceNames) {
+ final ArrayAdapter adapter =
+ new ArrayAdapter(context, android.R.layout.simple_spinner_item) {
+ private View convertView(final int position, final View view) {
+ if (view != null) {
+ final MediaSource item = getItem(position);
+ ((TextView) view).setText(sourceNames != null ? sourceNames[position] : item.name);
+ }
+ return view;
+ }
- @Override
- public View getView(final int position, View view,
- final ViewGroup parent) {
- return convertView(position, super.getView(position, view, parent));
- }
+ @Override
+ public View getView(final int position, View view, final ViewGroup parent) {
+ return convertView(position, super.getView(position, view, parent));
+ }
- @Override
- public View getDropDownView(final int position, final View view,
- @NonNull final ViewGroup parent) {
- return convertView(position, super.getDropDownView(position, view, parent));
- }
- };
+ @Override
+ public View getDropDownView(final int position, final View view, final ViewGroup parent) {
+ return convertView(position, super.getDropDownView(position, view, parent));
+ }
+ };
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
adapter.addAll(sources);
@@ -977,18 +1033,21 @@ public final class promptDelegate implements GeckoSession.PromptDelegate {
return spinner;
}
- public void onMediaPrompt(final String title,
- final GeckoSession.PermissionDelegate.MediaSource[] video, final GeckoSession.PermissionDelegate.MediaSource[] audio,
- final String[] videoNames, final String[] audioNames,
- final GeckoSession.PermissionDelegate.MediaCallback callback) {
+ public void onMediaPrompt(
+ final GeckoSession session,
+ final String title,
+ final MediaSource[] video,
+ final MediaSource[] audio,
+ final String[] videoNames,
+ final String[] audioNames,
+ final GeckoSession.PermissionDelegate.MediaCallback callback) {
final Activity activity = mActivity;
- stopMedia();
if (activity == null || (video == null && audio == null)) {
callback.reject();
return;
}
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
- final LinearLayout container = addStandardLayout(builder, title, null);
+ final LinearLayout container = addStandardLayout(builder, title, /* msg */ null);
final Spinner videoSpinner;
if (video != null) {
@@ -1004,32 +1063,44 @@ public final class promptDelegate implements GeckoSession.PromptDelegate {
audioSpinner = null;
}
- builder.setNegativeButton(android.R.string.cancel, null)
- .setPositiveButton(android.R.string.ok,
- (dialog, which) -> {
- final GeckoSession.PermissionDelegate.MediaSource video1 = (videoSpinner != null)
- ? (GeckoSession.PermissionDelegate.MediaSource) videoSpinner.getSelectedItem() : null;
- final GeckoSession.PermissionDelegate.MediaSource audio1 = (audioSpinner != null)
- ? (GeckoSession.PermissionDelegate.MediaSource) audioSpinner.getSelectedItem() : null;
- callback.grant(video1, audio1);
+ builder
+ .setNegativeButton(android.R.string.cancel, /* listener */ null)
+ .setPositiveButton(
+ android.R.string.ok,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(final DialogInterface dialog, final int which) {
+ final MediaSource video =
+ (videoSpinner != null) ? (MediaSource) videoSpinner.getSelectedItem() : null;
+ final MediaSource audio =
+ (audioSpinner != null) ? (MediaSource) audioSpinner.getSelectedItem() : null;
+ callback.grant(video, audio);
+ }
});
final AlertDialog dialog = builder.create();
- dialog.setOnDismissListener(dialog1 -> callback.reject());
+ dialog.setOnDismissListener(
+ new DialogInterface.OnDismissListener() {
+ @Override
+ public void onDismiss(final DialogInterface dialog) {
+ callback.reject();
+ }
+ });
dialog.show();
}
- public void onMediaPrompt(final String title,
- final GeckoSession.PermissionDelegate.MediaSource[] video, final GeckoSession.PermissionDelegate.MediaSource[] audio,
- final GeckoSession.PermissionDelegate.MediaCallback callback) {
- stopMedia();
- onMediaPrompt(title, video, audio, null, null, callback);
+ public void onMediaPrompt(
+ final GeckoSession session,
+ final String title,
+ final MediaSource[] video,
+ final MediaSource[] audio,
+ final GeckoSession.PermissionDelegate.MediaCallback callback) {
+ onMediaPrompt(session, title, video, audio, null, null, callback);
}
@Override
- public GeckoResult onPopupPrompt(@NonNull final GeckoSession session,
- final PopupPrompt prompt) {
- stopMedia();
+ public GeckoResult onPopupPrompt(
+ final GeckoSession session, final PopupPrompt prompt) {
return GeckoResult.fromValue(prompt.confirm(AllowOrDeny.ALLOW));
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoClients.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoClients.java
index 11931e6c..4f8a7e11 100644
--- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoClients.java
+++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoClients.java
@@ -80,12 +80,12 @@ public class geckoClients {
}
private geckoSession initSettings(GeckoView pGeckoView, eventObserver.eventListener pEvent, AppCompatActivity pContext, String pSessionID){
- geckoSession mSessionIbitializer = new geckoSession(new geckoViewClientCallback(), pSessionID, pContext, pGeckoView);
- mSessionIbitializer.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack);
- mSessionIbitializer.getSettings().setFullAccessibilityTree(true);
- mSessionIbitializer.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE);
- mSessionIbitializer.getSettings().setAllowJavascript(status.sSettingJavaStatus);
- return mSessionIbitializer;
+ geckoSession mSessionInitializer = new geckoSession(new geckoViewClientCallback(), pSessionID, pContext, pGeckoView);
+ mSessionInitializer.getSettings().setUseTrackingProtection(status.sStatusDoNotTrack);
+ mSessionInitializer.getSettings().setFullAccessibilityTree(true);
+ mSessionInitializer.getSettings().setUserAgentMode(USER_AGENT_MODE_MOBILE);
+ mSessionInitializer.getSettings().setAllowJavascript(status.sSettingJavaStatus);
+ return mSessionInitializer;
}
public void initializeIcon(Context pcontext) {
@@ -151,7 +151,7 @@ public class geckoClients {
dataController.getInstance().initializeListData();
onClearAll();
}
- initializeIcon(context);
+ //initializeIcon(context);
}
public void onReload(geckoView mNestedGeckoView, AppCompatActivity pcontext, boolean isThemeCall, boolean isDelayed) {
@@ -176,7 +176,8 @@ public class geckoClients {
mSession = pSession;
geckoView.releaseSession();
geckoView.setSession(pSession);
- mSessionID = pSession.getSessionID();
+ mSession.initCallback(new geckoViewClientCallback());
+ this.mSessionID = mSession.getSessionID();
}
public void loadURL(String url, geckoView mNestedGeckoView, AppCompatActivity pcontext) {
@@ -355,6 +356,7 @@ public class geckoClients {
mSession.goBackSession();
} else if (isFinishAllowed) {
if (mSession.isRemovableFromBackPressed() && mTabSize > 1) {
+ mSession.stop();
mEvent.invokeObserver(null, homeEnums.eGeckoCallback.M_CLOSE_TAB_BACK);
} else {
mEvent.invokeObserver(null, homeEnums.eGeckoCallback.BACK_LIST_EMPTY);
@@ -462,6 +464,7 @@ public class geckoClients {
public class geckoViewClientCallback implements eventObserver.eventListener {
@Override
public Object invokeObserver(List