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Ax5~9;t15p2_2e|D+XmcInTU9Y#ihg#EPUcWn`%cA65d83+x~Uu1^`{
z1kcSppoiG&NHQw6c+}zp);cjAQ^})doYbi_PH81>MyV7ZxlNYa7m6}-PH;?%EQ-^Y
zR1xmtxS5*GTIt61vm<%}r*T<4b0C?{?mVu?6TJ6OWjwQ(C?XemS3>?$AumsCTN#T(
zCmB+Y8T0t$NK5mgxZ=i
z1<|2ueBkcF9`dTvTEt}rgVd;o%TXPBjD5w)UwF_(%`CNnT6<;8y8qaz63=KjyOBS$
zW~|3vuG`6p+B`o67S%`vlVR~RGLf3nMk=945qeEGHDfNG$uf^R`EC`Z+311fiFQ)b
zvnF{m(X>8|iOkH#vm%PFjKP-}zD-aO_?vauH>m*Ztvo9pFw1k#nK5um8dQ?WU4?`p
z&tfq*8xE{A%x;+=`xhsRN`+uC>{PM5e1NBqT$V5yJ(l4H$yAS}DX5O<8GrPMf#}RmXM8=`^sLe5n~s})Jr(!$
zw1?V!e3L;#wCUK~v3XmE?>+QY_0*|T_xP5sq&K|(qE%OCbX#b$y$hY)sKMeCtXMg{
zXx<);ZfWm`OFSm~7)(wU2Pj-bS+PlP<
z?e0Z3vi)c@IN1^H+>&SC?s;o_w=vnV%xP%&7J+74C%1HVc88X?8n*AR(6<|*Xm>E0
z*Cn?K#dO2yigwz~a%Xq`y_VbRTZ7%*!JP42EjG~I6`R}=+Y+=5Sod8v9BS_l#U{Fu
zOmeaGchXw9N~x0NLamhkT+M>#a*ZQQCAidXsLTde{5I{tH@D1|b#_zOaRzFwBURj;^yQx~E)>SX%5
zCefpfk|L?@ni8+%mE~&bm0!jSYe`w{-3Qq-!2y;@
z3qh&;N
-
+
@@ -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