diff --git a/app/aarch64/release/app-aarch64-arm64-v8a-release.apk b/app/aarch64/release/app-aarch64-arm64-v8a-release.apk new file mode 100644 index 00000000..31e24494 Binary files /dev/null and b/app/aarch64/release/app-aarch64-arm64-v8a-release.apk differ diff --git a/app/aarch64/release/app-aarch64-release.apk b/app/aarch64/release/app-aarch64-armeabi-v7a-release.apk similarity index 87% rename from app/aarch64/release/app-aarch64-release.apk rename to app/aarch64/release/app-aarch64-armeabi-v7a-release.apk index 52604b27..bbc866c4 100644 Binary files a/app/aarch64/release/app-aarch64-release.apk and b/app/aarch64/release/app-aarch64-armeabi-v7a-release.apk differ diff --git a/app/aarch64/release/app-aarch64-x86-release.apk b/app/aarch64/release/app-aarch64-x86-release.apk new file mode 100644 index 00000000..b32a98bb Binary files /dev/null and b/app/aarch64/release/app-aarch64-x86-release.apk differ diff --git a/app/aarch64/release/app-aarch64-x86_64-release.apk b/app/aarch64/release/app-aarch64-x86_64-release.apk new file mode 100644 index 00000000..b6dee8c8 Binary files /dev/null and b/app/aarch64/release/app-aarch64-x86_64-release.apk differ diff --git a/app/aarch64/release/output-metadata.json b/app/aarch64/release/output-metadata.json index 162f295b..43490854 100644 --- a/app/aarch64/release/output-metadata.json +++ b/app/aarch64/release/output-metadata.json @@ -8,11 +8,52 @@ "variantName": "processAarch64ReleaseResources", "elements": [ { - "type": "SINGLE", - "filters": [], - "versionCode": 600, - "versionName": "600.0", - "outputFile": "app-aarch64-release.apk" + "type": "ONE_OF_MANY", + "filters": [ + { + "filterType": "ABI", + "value": "x86_64" + } + ], + "versionCode": 1001, + "versionName": "Build | Dark-Origin 1.1", + "outputFile": "app-aarch64-x86_64-release.apk" + }, + { + "type": "ONE_OF_MANY", + "filters": [ + { + "filterType": "ABI", + "value": "x86" + } + ], + "versionCode": 1001, + "versionName": "Build | Dark-Origin 1.1", + "outputFile": "app-aarch64-x86-release.apk" + }, + { + "type": "ONE_OF_MANY", + "filters": [ + { + "filterType": "ABI", + "value": "arm64-v8a" + } + ], + "versionCode": 1001, + "versionName": "Build | Dark-Origin 1.1", + "outputFile": "app-aarch64-arm64-v8a-release.apk" + }, + { + "type": "ONE_OF_MANY", + "filters": [ + { + "filterType": "ABI", + "value": "armeabi-v7a" + } + ], + "versionCode": 1001, + "versionName": "Build | Dark-Origin 1.1", + "outputFile": "app-aarch64-armeabi-v7a-release.apk" } ] } \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index e3ad6901..053a4561 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -74,11 +74,22 @@ android { buildTypes { release { - minifyEnabled project.ext.minifyEnabled - proguardFiles getDefaultProguardFile(project.ext.proguard_file), project.ext.proguard_rule - + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + splits { + abi { + enable true + reset() + include 'arm64-v8a' + include 'x86' + include 'armeabi-v7a' + include 'x86_64' + universalApk false + } } } + lintOptions { checkReleaseBuilds project.ext.checkReleaseBuilds abortOnError project.ext.abortOnError diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/NestedGeckoView.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/NestedGeckoView.java index a0afe01b..e5b5f38b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/NestedGeckoView.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/NestedGeckoView.java @@ -14,7 +14,8 @@ import java.util.Collections; import static com.darkweb.genesissearchengine.constants.enums.etype.GECKO_SCROLL_CHANGED; public class NestedGeckoView extends GeckoView { - private int mLastY; + private int mLastY = 0; + private int deltaY = 0; private final int[] mScrollOffset = new int[2]; private final int[] mScrollConsumed = new int[2]; private int mNestedOffsetY; @@ -43,55 +44,63 @@ public class NestedGeckoView extends GeckoView { @Override public boolean onTouchEvent(MotionEvent ev) { - boolean eventHandled = false; - - final MotionEvent event = MotionEvent.obtain(ev); + MotionEvent event = MotionEvent.obtain(ev); final int action = event.getActionMasked(); - if (action == MotionEvent.ACTION_DOWN) { - mNestedOffsetY = 0; - } - final int eventY = (int) event.getY(); - event.offsetLocation(0, mNestedOffsetY); + int eventY = (int) event.getY(); switch (action) { case MotionEvent.ACTION_MOVE: - final boolean allowScroll = status.sFullScreenBrowsing; + final boolean allowScroll = !shouldPinOnScreen() && + mInputResult == PanZoomController.INPUT_RESULT_HANDLED; + + if(!status.sSettingEnableZoom){ + mInputResult = PanZoomController.INPUT_RESULT_UNHANDLED; + } int deltaY = mLastY - eventY; if (allowScroll && dispatchNestedPreScroll(0, deltaY, mScrollConsumed, mScrollOffset)) { deltaY -= mScrollConsumed[1]; - mLastY = eventY - mScrollOffset[1]; - event.offsetLocation(0, -mScrollOffset[1]); + event.offsetLocation(0f, -mScrollOffset[1]); mNestedOffsetY += mScrollOffset[1]; } - eventHandled = super.onTouchEvent(event); - mEvent.invokeObserver(Collections.singletonList(deltaY), GECKO_SCROLL_CHANGED); + mLastY = eventY - mScrollOffset[1]; if (allowScroll && dispatchNestedScroll(0, mScrollOffset[1], 0, deltaY, mScrollOffset)) { - event.offsetLocation(0, mScrollOffset[1]); - mNestedOffsetY += mScrollOffset[1]; mLastY -= mScrollOffset[1]; + event.offsetLocation(0f, mScrollOffset[1]); + mNestedOffsetY += mScrollOffset[1]; } break; case MotionEvent.ACTION_DOWN: - eventHandled = super.onTouchEvent(event); + // A new gesture started. Reset handled status and ask GV if it can handle this. + mInputResult = PanZoomController.INPUT_RESULT_UNHANDLED; + + updateInputResult(event); + + mNestedOffsetY = 0; mLastY = eventY; - startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL); - break; + // The event should be handled either by onTouchEvent, + // either by onTouchEventForResult, never by both. + // Early return if we sent it to updateInputResult(..) which calls onTouchEventForResult. + event.recycle(); + return true; + // We don't care about other touch events case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: - eventHandled = super.onTouchEvent(event); stopNestedScroll(); break; - - default: - // We don't care about other touch events } + // Execute event handler from parent class in all cases + final boolean eventHandled = callSuperOnTouchEvent(event); + + // Recycle previously obtained event + event.recycle(); + return eventHandled; } @@ -100,10 +109,14 @@ public class NestedGeckoView extends GeckoView { } private void updateInputResult(MotionEvent event) { - super.onTouchEventForResult(event).accept(inputResult -> { - mInputResult = inputResult; - startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL); - }); + if(status.sSettingEnableZoom){ + super.onTouchEventForResult(event).accept(inputResult -> { + mInputResult = inputResult; + mInputResult = PanZoomController.INPUT_RESULT_UNHANDLED; + + startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL); + }); + } } public int getInputResult() { diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java index bfdea361..f368eb99 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoClients.java @@ -6,7 +6,6 @@ import android.net.Uri; import android.util.Log; import android.widget.ImageView; import androidx.appcompat.app.AppCompatActivity; - import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.kotlinHelperLibraries.BrowserIconManager; import com.darkweb.genesissearchengine.constants.*; @@ -14,10 +13,8 @@ import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.helperManager.eventObserver; import com.darkweb.genesissearchengine.helperManager.helperMethod; - import java.io.File; import java.util.List; - import static com.darkweb.genesissearchengine.constants.constants.CONST_REPORT_URL; import static com.darkweb.genesissearchengine.constants.enums.etype.on_handle_external_intent; import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE; @@ -29,10 +26,8 @@ import static org.mozilla.geckoview.StorageController.ClearFlags.NETWORK_CACHE; 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.mozilla.geckoview.ContentBlocking; import org.mozilla.geckoview.GeckoRuntime; -import org.mozilla.geckoview.GeckoSession; import org.mozilla.geckoview.GeckoView; import org.mozilla.geckoview.WebResponse; @@ -76,7 +71,9 @@ public class geckoClients public void onValidateInitializeFromStartup(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){ boolean mStatus = mSession.onValidateInitializeFromStartup(); if(mStatus){ - loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext); + // loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext); + mSession.onRestoreState(); + mSession.reload(); } } @@ -334,8 +331,9 @@ public class geckoClients } public void onReload(NestedGeckoView mNestedGeckoView, AppCompatActivity pcontext){ - mSession.stop(); - loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext); + ///mSession.stop(); + mSession.reload(); + //loadURL(mSession.getCurrentURL(), mNestedGeckoView, pcontext); } public void manual_download(String url, AppCompatActivity context){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java index 01850313..588e5dfd 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/geckoManager/geckoSession.java @@ -10,7 +10,6 @@ import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.graphics.Bitmap; -import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.graphics.Rect; import android.graphics.RectF; @@ -23,17 +22,12 @@ import android.util.Base64; import android.util.Log; import android.view.autofill.AutofillManager; import android.view.autofill.AutofillValue; -import android.view.inputmethod.InputMethodManager; -import android.widget.Toast; - -import androidx.annotation.AnyThread; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.UiThread; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.NotificationCompat; import androidx.core.content.FileProvider; - import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.status; @@ -53,14 +47,11 @@ import org.mozilla.geckoview.Autofill; import org.mozilla.geckoview.GeckoResult; import org.mozilla.geckoview.GeckoSession; import org.mozilla.geckoview.GeckoView; -import org.mozilla.geckoview.SessionFinder; import org.mozilla.geckoview.SlowScriptResponse; import org.mozilla.geckoview.WebRequestError; import org.mozilla.geckoview.WebResponse; - import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.OutputStream; import java.lang.ref.WeakReference; import java.net.URLEncoder; @@ -69,11 +60,7 @@ import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.Objects; - import javax.crypto.spec.SecretKeySpec; - -import mozilla.components.support.utils.DownloadUtils; - import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE; import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_HELP_URL_CACHE_DARK; import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED; @@ -114,7 +101,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele private boolean mIsProgressBarChanging = false; private Handler mFindHandler; private boolean mClosed = false; - private SessionState mSessionState; + public SessionState mSessionState; geckoSession(eventObserver.eventListener event,String mSessionID,AppCompatActivity mContext, GeckoView pGeckoView){ @@ -373,6 +360,17 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele @UiThread public void onSessionStateChange(@NonNull GeckoSession session, @NonNull SessionState sessionState) { mSessionState = sessionState; + if(!status.sRestoreTabs){ + mSessionState = null; + } + if(mSessionState!=null) + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, mSessionState.toString()), enums.etype.M_UPDATE_SESSION_STATE); + } + + public void onRestoreState(){ + if(mSessionState!=null){ + restoreState(mSessionState); + } } /*Navigation Delegate*/ @@ -489,12 +487,15 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele public GeckoResult onLoadError(@NonNull GeckoSession var1, @Nullable String var2, WebRequestError var3) { - errorHandler handler = new errorHandler(); - mProgress = 0; - mPreviousErrorPage = true; - event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_load_error); - event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_UPDATE_THEME); - return GeckoResult.fromValue("data:text/html," + handler.createErrorPage(var3.category, var3.code,mContext.get(),var2)); + if(status.sSettingIsAppStarted){ + errorHandler handler = new errorHandler(); + mProgress = 0; + mPreviousErrorPage = true; + event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_load_error); + event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_UPDATE_THEME); + return GeckoResult.fromValue("data:text/html," + handler.createErrorPage(var3.category, var3.code,mContext.get(),var2)); + } + return null; } /*Content Delegate*/ @@ -940,6 +941,8 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele void goBackSession(){ + goBack(); + /* if(mHistoryList!=null){ stop(); int index = mHistoryList.getCurrentIndex()-1; @@ -960,7 +963,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele mProgress = 5; event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.progress_update_forced); event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.M_ADMOB_BANNER_RECHECK); - } + }*/ } void goForwardSession(){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java index f2ce97d1..9524649a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeController.java @@ -132,6 +132,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba private AdView mBannerAds = null; private ImageButton mGatewaySplash; private ImageButton mPanicButton; + private ImageButton mPanicButtonLandscape; private LinearLayout mTopBar; private ImageView mBackSplash; private Button mConnectButton; @@ -326,7 +327,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba mHomeViewController.onUpdateSearchBar(model.getSession().getCurrentURL(), false, false, false); } onLoadTab(model.getSession(),false,true); - onLoadURL(model.getSession().getCurrentURL()); + //onLoadURL(model.getSession().getCurrentURL()); + mGeckoClient.onReload(mGeckoView, this); }else { onNewIntent(getIntent()); onOpenLinkNewTab(helperMethod.getDomainName(mHomeModel.getSearchEngine())); @@ -440,6 +442,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba mCoordinatorLayout = findViewById(R.id.pCoordinatorLayout); mImageDivider = findViewById(R.id.pImageDivider); mPanicButton = findViewById(R.id.pPanicButton); + mPanicButtonLandscape = findViewById(R.id.pPanicButtonLandscape); mGenesisLogo = findViewById(R.id.pGenesisLogo); mGeckoView.setSaveEnabled(false); @@ -447,7 +450,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, mFindBar, mFindText, mFindCount, mTopLayout, mVoiceInput, mMenu, mNestedScroll, mBlocker, mBlockerFullSceen, mSearchEngineBar, mCopyright, mHintListView, mAppBar, mOrbotLogManager, mInfoLandscape, mInfoPortrait, mProgressBarIndeterminate, mTabFragment, mTopBarContainer, mSearchLock, mPopupLoadNewTab, mTopBarHider, mNewTabBlocker, mCoordinatorLayout, mImageDivider, mPanicButton, mGenesisLogo); + mHomeViewController.initialization(new homeViewCallback(),this,mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds, mGatewaySplash, mTopBar, mGeckoView, mBackSplash, mConnectButton, mFindBar, mFindText, mFindCount, mTopLayout, mVoiceInput, mMenu, mNestedScroll, mBlocker, mBlockerFullSceen, mSearchEngineBar, mCopyright, mHintListView, mAppBar, mOrbotLogManager, mInfoLandscape, mInfoPortrait, mProgressBarIndeterminate, mTabFragment, mTopBarContainer, mSearchLock, mPopupLoadNewTab, mTopBarHider, mNewTabBlocker, mCoordinatorLayout, mImageDivider, mPanicButton, mGenesisLogo, mPanicButtonLandscape); mGeckoView.onSetHomeEvent(new nestedGeckoViewCallback()); mGeckoClient.initialize(mGeckoView, new geckoViewCallback(), this,false); mGeckoClient.onValidateInitializeFromStartup(mGeckoView, homeController.this); @@ -2198,7 +2201,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba } else if(e_type.equals(enums.etype.ON_UPDATE_TAB_TITLE)){ if(activityContextManager.getInstance().getTabController()!=null && mTabFragment.getVisibility()==View.VISIBLE) - activityContextManager.getInstance().getTabController().onTabRowChanged((String) data.get(1)); + activityContextManager.getInstance().getTabController().onTabRowChanged((String) data.get(1)); + } + else if(e_type.equals(enums.etype.M_UPDATE_SESSION_STATE)){ + dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_UPDATE_SESSION_STATE, data); } else if(e_type.equals(enums.etype.FINDER_RESULT_CALLBACK)){ mHomeViewController.onUpdateFindBarCount((int)data.get(0),(int)data.get(1)); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java index 40ca805d..317e9117 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/homeManager/homeController/homeViewController.java @@ -108,6 +108,7 @@ class homeViewController private CoordinatorLayout mCoordinatorLayout; private ImageView mImageDivider; private ImageButton mPanicButton; + private ImageButton mPanicButtonLandscape; private ImageView mGenesisLogo; /*Local Variables*/ @@ -118,7 +119,7 @@ class homeViewController private Handler mTabDialogHandler = null; private Runnable mTabDialogRunnable = null; - void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, ConstraintLayout webviewContainer, TextView loadingText, AnimatedProgressBar progressBar, editTextManager searchbar, ConstraintLayout splashScreen, ImageView loading, AdView banner_ads, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_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, View pPopupLoadNewTab, ImageView pTopBarHider, ImageView pNewTabBlocker, CoordinatorLayout mCoordinatorLayout, ImageView pImageDivider, ImageButton pPanicButton, ImageView pGenesisLogo){ + void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, ConstraintLayout webviewContainer, TextView loadingText, AnimatedProgressBar progressBar, editTextManager searchbar, ConstraintLayout splashScreen, ImageView loading, AdView banner_ads, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, Button connect_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, View pPopupLoadNewTab, ImageView pTopBarHider, ImageView pNewTabBlocker, CoordinatorLayout mCoordinatorLayout, ImageView pImageDivider, ImageButton pPanicButton, ImageView pGenesisLogo,ImageButton pPanicButtonLandscape){ this.mContext = context; this.mProgressBar = progressBar; this.mSearchbar = searchbar; @@ -159,6 +160,7 @@ class homeViewController this.mImageDivider = pImageDivider; this.mPanicButton = pPanicButton; this.mGenesisLogo = pGenesisLogo; + this.mPanicButtonLandscape = pPanicButtonLandscape; initSplashScreen(); createUpdateUiHandler(); @@ -553,6 +555,7 @@ class homeViewController mSplashScreen.setEnabled(false); mOrbotLogManager.setEnabled(false); mPanicButton.setEnabled(false); + mPanicButtonLandscape.setEnabled(false); final Handler handler = new Handler(); handler.postDelayed(() -> @@ -566,6 +569,7 @@ class homeViewController }); mGatewaySplash.animate().setDuration(350).alpha(0.4f); mPanicButton.animate().setDuration(250).alpha(0f); + mPanicButtonLandscape.animate().setDuration(250).alpha(0f); } private void initSplashScreen(){ @@ -661,6 +665,7 @@ class homeViewController mGatewaySplash.setVisibility(View.GONE); mConnectButton.setVisibility(View.GONE); mPanicButton.setVisibility(View.GONE); + mPanicButtonLandscape.setVisibility(View.GONE); mEvent.invokeObserver(null, enums.etype.M_CACHE_UPDATE_TAB); mEvent.invokeObserver(null, enums.etype.M_SPLASH_DISABLE); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabRowModel.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabRowModel.java index 63a2d3fb..6ebbb080 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabRowModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/tabManager/tabRowModel.java @@ -7,6 +7,8 @@ import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.gecko import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.helperManager.helperMethod; +import org.mozilla.geckoview.GeckoSession; + public class tabRowModel { /*Private Variables*/ @@ -39,13 +41,18 @@ public class tabRowModel return mSession; } - public void setSession(geckoSession pSession, String pURL, String pTitle, String pTheme) + public void setSession(geckoSession pSession, String pURL, String pTitle, String pTheme, GeckoSession.SessionState pSessionState) { mSession = pSession; mSession.setTitle(pTitle); mSession.setURL(pURL); mSession.setTheme(pTheme); + if(pSessionState != null){ + mSession.mSessionState = pSessionState; + mSession.restoreState(pSessionState); + } + 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"); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java index d594db02..d5182275 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/enums.java @@ -4,7 +4,7 @@ public class enums { /*Settings Manager*/ public enum etype{ - on_update_favicon,ON_UPDATE_TAB_TITLE, ON_OPEN_TAB_VIEW,ON_NEW_TAB_ANIMATION, ON_LOAD_REQUEST,GECKO_SCROLL_CHANGED,ON_UPDATE_SEARCH_BAR,M_ON_MAIL,SESSION_ID,M_UPDATE_PIXEL_BACKGROUND,M_CACHE_UPDATE_TAB, + on_update_favicon,ON_UPDATE_TAB_TITLE, ON_OPEN_TAB_VIEW,ON_NEW_TAB_ANIMATION, M_UPDATE_SESSION_STATE,ON_LOAD_REQUEST,GECKO_SCROLL_CHANGED,ON_UPDATE_SEARCH_BAR,M_ON_MAIL,SESSION_ID,M_UPDATE_PIXEL_BACKGROUND,M_CACHE_UPDATE_TAB, on_verify_selected_url_menu,FINDER_RESULT_CALLBACK,M_ADMOB_BANNER_RECHECK,M_OPEN_SESSION,M_DOWNLOAD_FAILURE, welcome, reload,download_folder, M_UPDATE_THEME,M_ON_BANNER_UPDATE, M_LOAD_HOMEPAGE_GENESIS,M_INIT_TAB_COUNT_FORCED,M_SPLASH_DISABLE,M_NEW_LINK_IN_NEW_TAB,M_RESET_SUGGESTION, url_triggered, url_triggered_new_tab,url_clear,fetch_favicon,url_clear_at,remove_from_database,is_empty,M_HOME_PAGE,M_PRELOAD_URL,ON_KEYBOARD_CLOSE,M_CLOSE_TAB, diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataEnums.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataEnums.java index 63bcd182..6c8b629b 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataEnums.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/dataEnums.java @@ -28,7 +28,7 @@ public class dataEnums } public enum eTabCommands{ - M_UPDATE_TAB, M_ADD_TAB, M_CLEAR_TAB,M_GET_SUGGESTIONS, CLOSE_TAB, GET_TAB, GET_CURRENT_TAB,GET_RECENT_TAB, GET_LAST_TAB, GET_TOTAL_TAB, MOVE_TAB_TO_TOP, M_UPDATE_PIXEL, M_HOME_PAGE + M_UPDATE_TAB, M_UPDATE_SESSION_STATE,M_ADD_TAB, M_CLEAR_TAB,M_GET_SUGGESTIONS, CLOSE_TAB, GET_TAB, GET_CURRENT_TAB,GET_RECENT_TAB, GET_LAST_TAB, GET_TOTAL_TAB, MOVE_TAB_TO_TOP, M_UPDATE_PIXEL, M_HOME_PAGE } public enum eImageCommands{ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java index 2a06442e..5c993740 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/suggestionDataModel.java @@ -10,6 +10,9 @@ import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.helperManager.helperMethod; + +import org.mozilla.gecko.util.StringUtils; + import java.util.ArrayList; import java.util.List; @@ -37,7 +40,7 @@ public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSess private ArrayList getDefaultSuggestionsOnStart(String pQuery, int mSize, ArrayList mDuplicationHandler, boolean pDefaultHostChaned){ - if(pQuery.equals(strings.GENERIC_EMPTY_STR)){ + if(pQuery.equals(strings.GENERIC_EMPTY_STR) || pQuery.trim().isEmpty()) { pQuery = "hidden web"; } mCurrentList.clear(); @@ -64,6 +67,10 @@ public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSess private ArrayList getDefaultSuggestions(String pQuery, int mSize, ArrayList mDuplicationHandler, boolean pDefaultHostChaned){ + if(pQuery.trim().isEmpty()) { + pQuery = ""; + } + for(int count = 0; count<= mHintListLocalCache.size()-1 && mHintListLocalCache.size()<500; count++){ if(mHintListLocalCache.get(count).getHeader().toLowerCase().contains(pQuery)){ if(mHintListLocalCache.get(count).getHeader().toLowerCase().startsWith(pQuery)){ @@ -107,6 +114,10 @@ public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSess private ArrayList getSuggestions(String pQuery, ArrayList pHistory, ArrayList pBookmarks){ + if(pQuery.trim().isEmpty()) { + pQuery = ""; + } + mCurrentList = new ArrayList<>(); mCurrentList.clear(); String mQueryOriginal = pQuery; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java index b027ce1c..bb818db2 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/tabDataModel.java @@ -11,17 +11,19 @@ import android.widget.ImageView; import androidx.annotation.NonNull; import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.databaseManager.databaseController; -import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.NestedGeckoView; import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel; import com.darkweb.genesissearchengine.constants.enums; -import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.strings; +import com.darkweb.genesissearchengine.helperManager.helperMethod; + import org.mozilla.geckoview.GeckoResult; +import org.mozilla.geckoview.GeckoSession; import org.mozilla.geckoview.GeckoView; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; +import java.sql.PreparedStatement; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; @@ -145,6 +147,23 @@ class tabDataModel } } + void updateSession(String mSessionState, String mSessionID) { + for(int counter = 0; counter< mTabs.size(); counter++){ + + try{ + if(mTabs.get(counter).getSession().getSessionID().equals(mSessionID)) + { + + databaseController.getInstance().execSQL("UPDATE tab SET session = '" + mSessionState + "' WHERE mid='"+mTabs.get(counter).getmId() + "'",null); + mTabs.add(0,mTabs.remove(counter)); + break; + } + }catch (Exception ex){ + Log.i(ex.getMessage(), ex.getMessage()); + } + } + } + boolean updateTab(String mSessionID, geckoSession pSession) { for(int counter = 0; counter< mTabs.size(); counter++){ @@ -327,6 +346,9 @@ class tabDataModel return mTabs; } + else if(pCommands == dataEnums.eTabCommands.M_UPDATE_SESSION_STATE){ + updateSession((String) pData.get(5), (String) pData.get(1)); + } else if(pCommands == dataEnums.eTabCommands.M_UPDATE_TAB){ updateTab((String) pData.get(1), (geckoSession) pData.get(5)); activityContextManager.getInstance().getHomeController().initTabCountForced(); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/databaseManager/databaseController.java b/app/src/main/java/com/darkweb/genesissearchengine/databaseManager/databaseController.java index f619851d..d0fc9b94 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/databaseManager/databaseController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/databaseManager/databaseController.java @@ -9,9 +9,18 @@ import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel; import com.darkweb.genesissearchengine.constants.constants; +import com.darkweb.genesissearchengine.constants.status; +import com.darkweb.genesissearchengine.dataManager.dataController; +import com.darkweb.genesissearchengine.dataManager.dataEnums; +import com.darkweb.genesissearchengine.helperManager.helperMethod; + import net.sqlcipher.database.SQLiteDatabaseHook; import net.sqlcipher.database.SQLiteDatabase; + +import org.mozilla.geckoview.GeckoSession; + import java.io.File; +import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; @@ -58,7 +67,7 @@ public class databaseController mDatabaseInstance.execSQL("CREATE TABLE IF NOT EXISTS " + "history" + " (id INT(4) PRIMARY KEY,date DATETIME,url VARCHAR,title VARCHAR);"); mDatabaseInstance.execSQL("CREATE TABLE IF NOT EXISTS " + "bookmark" + " (id INT(4) PRIMARY KEY,title VARCHAR,url VARCHAR);"); - mDatabaseInstance.execSQL("CREATE TABLE IF NOT EXISTS " + "tab" + " (mid INT(4) PRIMARY KEY,date,title VARCHAR,url VARCHAR,mThumbnail BLOB, theme VARCHAR);"); + mDatabaseInstance.execSQL("CREATE TABLE IF NOT EXISTS " + "tab" + " (mid INT(4) PRIMARY KEY,date,title VARCHAR,url VARCHAR,mThumbnail BLOB, theme VARCHAR, session VARCHAR);"); } catch (Exception ex) @@ -155,7 +164,15 @@ public class databaseController do { geckoSession mSession = activityContextManager.getInstance().getHomeController().onNewTabInit(); tabRowModel model = new tabRowModel(c.getString(0), c.getString(1),c.getBlob(4)); - model.setSession(mSession, c.getString(3),c.getString(2), c.getString(5)); + GeckoSession.SessionState session = null; + try { + if(status.sRestoreTabs){ + session = GeckoSession.SessionState.fromString(c.getString(6)); + } + } catch (Exception ex) { + ex.printStackTrace(); + } + model.setSession(mSession, c.getString(3),c.getString(2), c.getString(5), session); model.getSession().setSessionID(model.getmId()); mTempListModel.add(model); } while(c.moveToNext()); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java index 48a32942..208a2643 100755 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperManager/helperMethod.java @@ -60,8 +60,12 @@ import com.example.myapplication.R; import org.xmlpull.v1.XmlPullParserException; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.lang.reflect.Field; import java.net.MalformedURLException; import java.net.URI; @@ -101,6 +105,23 @@ public class helperMethod } } + public static byte[] convertToBytes(Object object) throws IOException { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos); + oos.writeObject(object); + oos.flush(); + oos.close(); + bos.close(); + byte[] data = bos.toByteArray(); + return data; + } + + public static Object deserialize(byte[] data) throws IOException, ClassNotFoundException { + ByteArrayInputStream in = new ByteArrayInputStream(data); + ObjectInputStream is = new ObjectInputStream(in); + return is.readObject(); + } + public static String caesarCipherEncrypt(String pMessage, Key pSecretKey) { try{ Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); diff --git a/app/src/main/res/layouts/bridge/layout/bridge_settings_view.xml b/app/src/main/res/layouts/bridge/layout/bridge_settings_view.xml index 90c0ed8a..b5fcc9f5 100644 --- a/app/src/main/res/layouts/bridge/layout/bridge_settings_view.xml +++ b/app/src/main/res/layouts/bridge/layout/bridge_settings_view.xml @@ -31,7 +31,7 @@ android:layout_height="52dp"> + + diff --git a/app/src/main/res/layouts/setting/layout/setting_notification_view.xml b/app/src/main/res/layouts/setting/layout/setting_notification_view.xml index 0485f763..1000c17d 100644 --- a/app/src/main/res/layouts/setting/layout/setting_notification_view.xml +++ b/app/src/main/res/layouts/setting/layout/setting_notification_view.xml @@ -79,6 +79,7 @@ android:layout_width="match_parent" android:layout_marginTop="15dp" android:layout_marginBottom="15dp" + android:layout_marginStart="5dp" android:orientation="vertical" android:layout_height="wrap_content"> + android:orientation="horizontal"> @@ -228,9 +230,8 @@ - - diff --git a/orbotservicemanager/src/main/java/org/torproject/android/proxy/OrbotService.java b/orbotservicemanager/src/main/java/org/torproject/android/proxy/OrbotService.java index 73dce933..0c286eea 100644 --- a/orbotservicemanager/src/main/java/org/torproject/android/proxy/OrbotService.java +++ b/orbotservicemanager/src/main/java/org/torproject/android/proxy/OrbotService.java @@ -308,6 +308,7 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb public int onStartCommand(Intent intent, int flags, int startId) { self = this; + showToolbarNotification("", NOTIFY_ID, R.drawable.ic_stat_starting_tor_logo); if (intent != null) @@ -1737,7 +1738,8 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb if (action.equals(ACTION_START) || action.equals(ACTION_START_ON_BOOT)) { if (useIPtObfsMeekProxy()) - IPtProxy.startObfs4Proxy("DEBUG", false, false); + IPtProxy.stopObfs4Proxy(); + IPtProxy.startObfs4Proxy("DEBUG", true, true); if (useIPtSnowflakeProxy()) startSnowflakeClient();