Bug Fixes

master
msmannan00 2020-10-22 15:54:13 +05:00
parent 363dc9fa5a
commit 4733f08dc6
13 changed files with 200 additions and 68 deletions

View File

@ -441,45 +441,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}
}
public void onSwitchSearch(View view){
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ENGINE_SWITCHED,true));
pluginController.getInstance().logEvent(strings.EVENT_SEARCH_SWITCH);
if(status.sSettingSearchStatus.equals(constants.CONST_BACKEND_GOOGLE_URL))
{
status.sSettingSearchStatus = constants.CONST_BACKEND_GENESIS_URL;
mHomeViewController.onUpdateLogo();
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_GENESIS_URL));
onHomeButton(null);
}
else if(status.sSettingSearchStatus.equals(constants.CONST_BACKEND_GENESIS_URL))
{
status.sSettingSearchStatus = constants.CONST_BACKEND_DUCK_DUCK_GO_URL;
if(pluginController.getInstance().isOrbotRunning())
{
mHomeViewController.onUpdateLogo();
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_DUCK_DUCK_GO_URL));
onHomeButton(null);
}
else {
pluginController.getInstance().MessageManagerHandler(homeController.this, Collections.singletonList(constants.CONST_BACKEND_DUCK_DUCK_GO_URL),enums.etype.start_orbot);
}
}
else
{
status.sSettingSearchStatus = constants.CONST_BACKEND_GOOGLE_URL;
if(pluginController.getInstance().isOrbotRunning())
{
mHomeViewController.onUpdateLogo();
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_GOOGLE_URL));
onHomeButton(null);
}
else {
pluginController.getInstance().MessageManagerHandler(homeController.this,Collections.singletonList(constants.CONST_BACKEND_GOOGLE_URL),enums.etype.start_orbot);
}
}
}
/*Activity States*/
public void onReload(View view){

View File

@ -31,15 +31,7 @@ class homeModel
ex.printStackTrace();
}
if(status.sSettingSearchStatus.equals(constants.CONST_BACKEND_GOOGLE_URL)){
return getSearchEngine()+"search?q="+url.replaceAll(" ","+");
}
else if(status.sSettingSearchStatus.equals(constants.CONST_BACKEND_GENESIS_URL)){
return getSearchEngine()+"/search?s_type=all&p_num=1&q="+url.replaceAll(" ","+");
}
else{
return getSearchEngine()+"?q="+url.replaceAll(" ","+");
}
return constants.CONST_BACKEND_GOOGLE_URL.replace("$s",url.replaceAll(" ","+"));
}

View File

@ -662,9 +662,9 @@ class homeViewController
if(msg.what == messages.MESSAGE_ON_URL_LOAD)
{
if(status.sSettingRedirectStatus.equals(strings.GENERIC_EMPTY_STR)){
mEvent.invokeObserver(Collections.singletonList(status.sSettingSearchStatus), enums.etype.on_url_load);
mEvent.invokeObserver(Collections.singletonList(helperMethod.getDomainName(status.sSettingSearchStatus)), enums.etype.on_url_load);
}else {
mEvent.invokeObserver(Collections.singletonList(status.sSettingRedirectStatus), enums.etype.on_url_load);
mEvent.invokeObserver(Collections.singletonList(helperMethod.getDomainName(status.sSettingRedirectStatus)), enums.etype.on_url_load);
}
}
if(msg.what == messages.MESSAGE_UPDATE_LOADING_TEXT)

View File

@ -3,20 +3,28 @@ package com.darkweb.genesissearchengine.appManager.settingManager.searchEngineMa
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RadioButton;
import android.widget.Spinner;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList;
import java.util.List;
public class settingSearchController extends AppCompatActivity {
/* PRIVATE VARIABLES */
private ArrayList<RadioButton> mSearchEngines = new ArrayList<>();
private SwitchMaterial mSearchHistory;
private SwitchMaterial mSearchSuggestions;
private settingSearchModel mSettingSearchModel;
private settingSearchViewController mSettingSearchViewController;
@ -30,11 +38,49 @@ public class settingSearchController extends AppCompatActivity {
}
public void viewsInitializations() {
mSettingSearchViewController = new settingSearchViewController(this, new settingSearchViewCallback());
mSearchEngines.add(findViewById(R.id.mRadioSearch_1));
mSearchEngines.add(findViewById(R.id.mRadioSearch_2));
mSearchEngines.add(findViewById(R.id.mRadioSearch_3));
mSearchEngines.add(findViewById(R.id.mRadioSearch_4));
mSearchEngines.add(findViewById(R.id.mRadioSearch_5));
mSearchHistory = findViewById(R.id.pSearchHistory);
mSearchSuggestions = findViewById(R.id.pSearchSuggestions);
mSettingSearchViewController = new settingSearchViewController(this, new settingSearchViewCallback(), mSearchEngines, mSearchHistory, mSearchSuggestions);
mSettingSearchModel = new settingSearchModel(new settingSearchModelCallback());
}
public void onSelectSearchEngine(View view) {
if(view.getId() == R.id.pOption1){
mSettingSearchModel.onSetSearchEngine(constants.CONST_BACKEND_GENESIS_URL);
}
else if(view.getId() == R.id.pOption2){
mSettingSearchModel.onSetSearchEngine(constants.CONST_BACKEND_DUCK_DUCK_GO_URL);
}
else if(view.getId() == R.id.pOption3){
mSettingSearchModel.onSetSearchEngine(constants.CONST_BACKEND_GOOGLE_URL);
}
else if(view.getId() == R.id.pOption4){
mSettingSearchModel.onSetSearchEngine(constants.CONST_BACKEND_BING_URL);
}
else if(view.getId() == R.id.pOption5){
mSettingSearchModel.onSetSearchEngine(constants.CONST_BACKEND_WIKI_URL);
}
mSettingSearchViewController.resetSearchEngine();
mSettingSearchViewController.initSearchEngine();
}
public void setSearchHistory(View view){
mSettingSearchModel.setSearchHistory(!mSearchHistory.isChecked());
mSearchHistory.toggle();
}
public void setSearchStatus(View view){
mSettingSearchModel.setSearchStatus(!mSearchSuggestions.isChecked());
mSearchSuggestions.toggle();
}
/* LISTENERS */
public class settingSearchViewCallback implements eventObserver.eventListener{

View File

@ -5,10 +5,10 @@ import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import java.util.Arrays;
class settingSearchModel
{
/*Variable Declaration*/
@ -24,5 +24,18 @@ class settingSearchModel
/*Helper Methods*/
public void onSetSearchEngine(String pUrl){
status.sSettingSearchStatus = pUrl;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, pUrl));
}
public void setSearchHistory(boolean pStatus){
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY, pStatus));
status.sSettingSearchHistory = pStatus;
}
public void setSearchStatus(boolean pStatus){
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION, pStatus));
status.getsSettingSearchSuggestion = pStatus;
}
}

View File

@ -4,28 +4,39 @@ import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.RadioButton;
import android.widget.Spinner;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.ArrayList;
class settingSearchViewController
{
/*Private Variables*/
private eventObserver.eventListener mEvent;
private AppCompatActivity mContext;
private ArrayList<RadioButton> mSearchEngines;
private SwitchMaterial mSearchHistory;
private SwitchMaterial mSearchSuggestions;
/*Initializations*/
settingSearchViewController(settingSearchController pContext, eventObserver.eventListener pEvent)
settingSearchViewController(settingSearchController pContext, eventObserver.eventListener pEvent, ArrayList<RadioButton> pSearchEngines, SwitchMaterial pSearchHistory, SwitchMaterial pSearchSuggestions)
{
this.mEvent = pEvent;
this.mContext = pContext;
this.mSearchEngines = pSearchEngines;
this.mSearchHistory = pSearchHistory;
this.mSearchSuggestions = pSearchSuggestions;
initViews();
initPostUI();
@ -33,6 +44,43 @@ class settingSearchViewController
private void initViews()
{
initSearchEngine();
initSearchViews();
}
public void initSearchViews(){
if(status.sSettingSearchHistory){
mSearchHistory.setChecked(true);
}
if(status.getsSettingSearchSuggestion){
mSearchSuggestions.setChecked(true);
}
}
public void initSearchEngine(){
switch (status.sSettingSearchStatus) {
case constants.CONST_BACKEND_GOOGLE_URL:
mSearchEngines.get(2).setChecked(true);
break;
case constants.CONST_BACKEND_GENESIS_URL:
mSearchEngines.get(0).setChecked(true);
break;
case constants.CONST_BACKEND_DUCK_DUCK_GO_URL:
mSearchEngines.get(1).setChecked(true);
break;
case constants.CONST_BACKEND_BING_URL:
mSearchEngines.get(3).setChecked(true);
break;
case constants.CONST_BACKEND_WIKI_URL:
mSearchEngines.get(4).setChecked(true);
break;
}
}
public void resetSearchEngine(){
for(int mCounter=0;mCounter<mSearchEngines.size();mCounter++){
mSearchEngines.get(mCounter).setChecked(false);
}
}
private void initPostUI(){

View File

@ -13,12 +13,15 @@ public class constants
/*URL CONSTANTS*/
public static final String CONST_BACKEND_GENESIS_URL = "http://boogle.store";
public static final String CONST_GENESIS_UPDATE_URL = "https://boogle.store/manual?abi=";
public static final String CONST_BACKEND_GOOGLE_URL = "https://www.google.com/";
public static final String CONST_BACKEND_DUCK_DUCK_GO_URL = "https://duckduckgo.com/";
public static final String CONST_PLAYSTORE_URL = "https://play.google.com/store/apps/details?id=com.darkweb.genesissearchengine";
public static final String CONST_BACKEND_GENESIS_URL = "http://boogle.store/q=$s";
public static final String CONST_BACKEND_GOOGLE_URL = "https://www.google.com/q=$s";
public static final String CONST_BACKEND_DUCK_DUCK_GO_URL = "https://duckduckgo.com/q=$s";
public static final String CONST_BACKEND_BING_URL = "https://bing.com/q=$s";
public static final String CONST_BACKEND_WIKI_URL = "https://en.wikipedia.org/wiki/$s";
/*PROXY CONSTANTS*/
public static final String CONST_PROXY_SOCKS = "127.0.0.1";

View File

@ -36,6 +36,8 @@ public class keys
public static final String SETTING_FONT_ADJUSTABLE = "FONT_ADJUSTABLE";
public static final String SETTING_COOKIE_ADJUSTABLE = "COOKIE_ADJUSTABLE_NEW";
public static final String SETTING_NOTIFICATION_STATUS = "NOTIFICATION_STATUS";
public static final String SETTING_SEARCH_HISTORY = "SETTING_SEARCH_HISTORY";
public static final String SETTING_SEARCH_SUGGESTION = "SETTING_SEARCH_STATUS";
/*Bridge Settings*/

View File

@ -2,7 +2,6 @@ package com.darkweb.genesissearchengine.constants;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import java.util.Arrays;
@ -19,6 +18,10 @@ public class status
public static String sSettingSearchStatus = constants.CONST_BACKEND_GENESIS_URL;
public static String sSettingRedirectStatus = strings.GENERIC_EMPTY_STR;
public static boolean sSettingSearchHistory = false;
public static boolean getsSettingSearchSuggestion = false;
public static boolean sSettingJavaStatus = true;
public static boolean sSettingHistoryStatus = true;
public static boolean sSettingIsAppPaused = false;
@ -43,6 +46,8 @@ public class status
public static void initStatus()
{
status.sSettingSearchHistory = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true));
status.getsSettingSearchSuggestion = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION,true));
status.sSettingJavaStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true));
status.sSettingHistoryStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,true));
status.sBridgeGatewayAuto = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_AUTO,true));

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -92,6 +92,8 @@
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@xml/gx_ripple_gray"
android:clickable="true"
android:onClick="onSelectSearchEngine"
android:orientation="horizontal"
android:weightSum="8">
@ -99,13 +101,13 @@
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:src="@drawable/genesis"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="6"
android:layout_height="55dp"
android:background="@xml/gx_ripple_gray"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
@ -141,8 +143,10 @@
</LinearLayout>
<RadioButton
android:id="@+id/mRadioSearch_1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:clickable="false"
android:layout_weight="1"
android:background="@android:color/transparent"
android:src="@xml/ic_arrow_right"
@ -160,6 +164,8 @@
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@xml/gx_ripple_gray"
android:clickable="true"
android:onClick="onSelectSearchEngine"
android:orientation="horizontal"
android:weightSum="8">
@ -167,14 +173,15 @@
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:clickable="false"
android:padding="6dp"
android:src="@drawable/duckduckgo"/>
android:layout_marginStart="5dp"
android:src="@drawable/duckduckgologo"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="6"
android:layout_height="55dp"
android:background="@xml/gx_ripple_gray"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
@ -212,9 +219,11 @@
<RadioButton
android:layout_width="0dp"
android:layout_height="match_parent"
android:id="@+id/mRadioSearch_2"
android:layout_weight="1"
android:background="@android:color/transparent"
android:src="@xml/ic_arrow_right"
android:clickable="false"
android:contentDescription="@string/GENERAL_TODO" />
</LinearLayout>
@ -229,6 +238,8 @@
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@xml/gx_ripple_gray"
android:clickable="true"
android:onClick="onSelectSearchEngine"
android:orientation="horizontal"
android:weightSum="8">
@ -237,13 +248,13 @@
android:layout_weight="1"
android:layout_height="wrap_content"
android:padding="3dp"
android:layout_marginStart="5dp"
android:src="@drawable/google"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="6"
android:layout_height="55dp"
android:background="@xml/gx_ripple_gray"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
@ -281,6 +292,8 @@
<RadioButton
android:layout_width="0dp"
android:layout_height="match_parent"
android:id="@+id/mRadioSearch_3"
android:clickable="false"
android:layout_weight="1"
android:background="@android:color/transparent"
android:src="@xml/ic_arrow_right"
@ -298,6 +311,8 @@
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@xml/gx_ripple_gray"
android:clickable="true"
android:onClick="onSelectSearchEngine"
android:orientation="horizontal"
android:weightSum="8">
@ -305,13 +320,13 @@
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:src="@drawable/bing"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="6"
android:layout_height="55dp"
android:background="@xml/gx_ripple_gray"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
@ -349,9 +364,11 @@
<RadioButton
android:layout_width="0dp"
android:layout_height="match_parent"
android:id="@+id/mRadioSearch_4"
android:layout_weight="1"
android:background="@android:color/transparent"
android:src="@xml/ic_arrow_right"
android:clickable="false"
android:contentDescription="@string/GENERAL_TODO" />
</LinearLayout>
@ -366,6 +383,8 @@
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@xml/gx_ripple_gray"
android:clickable="true"
android:onClick="onSelectSearchEngine"
android:orientation="horizontal"
android:weightSum="8">
@ -374,13 +393,13 @@
android:layout_weight="1"
android:layout_height="wrap_content"
android:padding="4dp"
android:layout_marginStart="5dp"
android:src="@drawable/wikipedia"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="6"
android:layout_height="55dp"
android:background="@xml/gx_ripple_gray"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
@ -418,7 +437,9 @@
<RadioButton
android:layout_width="0dp"
android:layout_height="match_parent"
android:id="@+id/mRadioSearch_5"
android:layout_weight="1"
android:clickable="false"
android:background="@android:color/transparent"
android:src="@xml/ic_arrow_right"
android:contentDescription="@string/GENERAL_TODO" />
@ -460,6 +481,8 @@
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@xml/gx_ripple_gray"
android:clickable="true"
android:onClick="setSearchHistory"
android:orientation="horizontal"
android:weightSum="7">
@ -467,12 +490,11 @@
android:layout_width="0dp"
android:layout_weight="6"
android:layout_height="55dp"
android:background="@xml/gx_ripple_gray"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginTop="15dp"
android:layout_marginTop="6dp"
android:alpha="0.7"
android:background="@android:color/transparent"
android:clickable="false"
@ -484,6 +506,23 @@
android:textColor="@color/blue_dark"
android:textSize="15sp"
tools:ignore="RtlSymmetry" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:alpha="0.7"
android:background="@android:color/transparent"
android:clickable="false"
android:padding="0dp"
android:paddingStart="15dp"
android:text="@string/SETTING_SEARCH_HISTORY_INFO"
android:textAlignment="textStart"
android:textAllCaps="false"
android:textColor="@color/text_color_v3"
android:textSize="12sp"
tools:ignore="RtlSymmetry" />
</LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
@ -492,6 +531,8 @@
android:layout_weight="1"
android:background="@android:color/transparent"
android:src="@xml/ic_arrow_right"
android:clickable="false"
android:id="@+id/pSearchHistory"
android:contentDescription="@string/GENERAL_TODO" />
</LinearLayout>
@ -506,6 +547,8 @@
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@xml/gx_ripple_gray"
android:clickable="true"
android:onClick="setSearchStatus"
android:orientation="horizontal"
android:weightSum="7">
@ -513,12 +556,11 @@
android:layout_width="0dp"
android:layout_weight="6"
android:layout_height="55dp"
android:background="@xml/gx_ripple_gray"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginTop="15dp"
android:layout_marginTop="6dp"
android:alpha="0.7"
android:background="@android:color/transparent"
android:clickable="false"
@ -530,14 +572,32 @@
android:textColor="@color/blue_dark"
android:textSize="15sp"
tools:ignore="RtlSymmetry" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:alpha="0.7"
android:background="@android:color/transparent"
android:clickable="false"
android:padding="0dp"
android:paddingStart="15dp"
android:text="@string/SETTING_SEARCH_SUGGESTION_INFO"
android:textAlignment="textStart"
android:textAllCaps="false"
android:textColor="@color/text_color_v3"
android:textSize="12sp"
tools:ignore="RtlSymmetry" />
</LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/pSearchSuggestions"
android:background="@android:color/transparent"
android:src="@xml/ic_arrow_right"
android:clickable="false"
android:contentDescription="@string/GENERAL_TODO" />
</LinearLayout>

View File

@ -44,6 +44,8 @@
<string name="SETTING_SEARCH_BING" translatable="false">Wikipedia</string>
<string name="SETTING_SEARCH_HISTORY" translatable="false">Show search history</string>
<string name="SETTING_SEARCH_SUGGESTIONS" translatable="false">Show search suggestions</string>
<string name="SETTING_SEARCH_HISTORY_INFO" translatable="false">Search websites appears when you type in searchbar</string>
<string name="SETTING_SEARCH_SUGGESTION_INFO" translatable="false">Focused suggestions appears when you type in searchbar</string>
<!-- Alerts -->
<string name="ALERT_CREATE_BOOKMARK" translatable="false">Bookmark Website</string>