Bug Fixes

master
Genesis 2021-06-15 16:18:26 +05:00
parent 7cf4b89e42
commit f7384e8b53
25 changed files with 253 additions and 619 deletions

View File

@ -25,6 +25,7 @@
</inspection_tool> </inspection_tool>
<inspection_tool class="InfiniteLoopStatement" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="InfiniteLoopStatement" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="InnerClassMayBeStatic" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="InnerClassMayBeStatic" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="InstantiationOfUtilityClass" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="IntegerDivisionInFloatingPointContext" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="IntegerDivisionInFloatingPointContext" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LambdaParameterTypeCanBeSpecified" enabled="false" level="INFORMATION" enabled_by_default="false" /> <inspection_tool class="LambdaParameterTypeCanBeSpecified" enabled="false" level="INFORMATION" enabled_by_default="false" />
<inspection_tool class="RawUseOfParameterizedType" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="RawUseOfParameterizedType" enabled="false" level="WARNING" enabled_by_default="false" />

View File

@ -28,7 +28,7 @@
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
android:usesCleartextTraffic="true" android:usesCleartextTraffic="true"
tools:targetApi="n"> tools:targetApi="n">
<receiver android:name="com.widget.search.searchWidgetManager"> <receiver android:name="com.widget.Genesis.widgetManager.widgetController">
<intent-filter> <intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter> </intent-filter>

View File

@ -402,7 +402,10 @@ geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSes
public GeckoResult<Boolean> onVisited(@NonNull GeckoSession var1, @NonNull String var2, @Nullable String var3, int var4) { public GeckoResult<Boolean> onVisited(@NonNull GeckoSession var1, @NonNull String var2, @Nullable String var3, int var4) {
if(var4==3 || var4==5 || var4==1){ if(var4==3 || var4==5 || var4==1){
event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_url_load); event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_url_load);
m_current_url_id = (int)event.invokeObserver(Arrays.asList(var2,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.on_update_history); Object mID = event.invokeObserver(Arrays.asList(var2,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.on_update_history);
if(mID!=null){
m_current_url_id = (int)mID;
}
isPageLoading = false; isPageLoading = false;
} }
return null; return null;
@ -438,7 +441,15 @@ geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSes
if(!mIsLoaded){ if(!mIsLoaded){
return; return;
} }
if(wasBackPressed && mHistoryList.get(mHistoryList.getCurrentIndex()-1).getUri().equals(var2)){
boolean mPastURLVerify = false;
try {
if(mHistoryList.getCurrentIndex()-1>=0 && mHistoryList.getCurrentIndex()-1<mHistoryList.size()){
mPastURLVerify = mHistoryList.get(mHistoryList.getCurrentIndex()-1).getUri().equals(var2);
}
}catch (Exception ignored){}
if(wasBackPressed && mPastURLVerify){
if(var2.equals("https://genesishiddentechnologies.com") || var2.startsWith(CONST_GENESIS_URL_CACHED) || var2.startsWith(CONST_GENESIS_URL_CACHED_DARK)){ if(var2.equals("https://genesishiddentechnologies.com") || var2.startsWith(CONST_GENESIS_URL_CACHED) || var2.startsWith(CONST_GENESIS_URL_CACHED_DARK)){
if(var2.startsWith(CONST_GENESIS_URL_CACHED_DARK) && (status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext.get()))){ if(var2.startsWith(CONST_GENESIS_URL_CACHED_DARK) && (status.sTheme == enums.Theme.THEME_LIGHT || helperMethod.isDayMode(mContext.get()))){
isPageLoading = false; isPageLoading = false;

View File

@ -190,6 +190,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
onInitBooleans(); onInitBooleans();
orbotLocalConstants.mHomeIntent = getIntent(); orbotLocalConstants.mHomeIntent = getIntent();
getWindow().getDecorView().setBackgroundColor(Color.WHITE); getWindow().getDecorView().setBackgroundColor(Color.WHITE);
pluginController.getInstance().preInitialize(this); pluginController.getInstance().preInitialize(this);
dataController.getInstance().initialize(this); dataController.getInstance().initialize(this);

View File

@ -567,7 +567,7 @@ public class tabController extends Fragment
new Handler().postDelayed(() -> new Handler().postDelayed(() ->
{ {
helperMethod.openActivity(settingAdvanceController.class, constants.CONST_LIST_HISTORY, activityContextManager.getInstance().getHomeController(),true); helperMethod.openActivity(settingAdvanceController.class, constants.CONST_LIST_HISTORY, activityContextManager.getInstance().getHomeController(),true);
}, 300); }, 250);
} }
mtabViewController.onTrigger(tabEnums.eTabViewCommands.M_DISMISS_MENU, null); mtabViewController.onTrigger(tabEnums.eTabViewCommands.M_DISMISS_MENU, null);
} }

View File

@ -145,19 +145,17 @@ public class sqlCipherDataModel
tabRowModel model = new tabRowModel(c.getString(0), c.getString(1),c.getBlob(4)); tabRowModel model = new tabRowModel(c.getString(0), c.getString(1),c.getBlob(4));
GeckoSession.SessionState session = null; GeckoSession.SessionState session = null;
try { try {
// if(status.sRestoreTabs){
session = GeckoSession.SessionState.fromString(c.getString(6)); session = GeckoSession.SessionState.fromString(c.getString(6));
// } model.setSession(mSession, c.getString(3),c.getString(2), c.getString(5), session);
model.getSession().setSessionID(model.getmId());
if(session != null){
mTempListModel.add(0, model);
}else {
mTempListModel.add(model);
}
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
model.setSession(mSession, c.getString(3),c.getString(2), c.getString(5), session);
model.getSession().setSessionID(model.getmId());
if(session != null){
mTempListModel.add(0, model);
}else {
mTempListModel.add(model);
}
} while(c.moveToNext()); } while(c.moveToNext());
} }
c.close(); c.close();

View File

@ -49,7 +49,6 @@ public class messageManager
private void onClearReference(){ private void onClearReference(){
mContext = null; mContext = null;
mData = null;
} }
private void initializeDialog(int pLayout, int pGravity){ private void initializeDialog(int pLayout, int pGravity){
@ -631,7 +630,7 @@ public class messageManager
} }
void onReset(){ void onReset(){
if(mDialog !=null){ if(mDialog !=null && !mDialog.isShowing()){
mDialog.dismiss(); mDialog.dismiss();
} }
} }
@ -642,6 +641,7 @@ public class messageManager
{ {
if(!pEventType.equals(M_RATE_FAILURE) && !pEventType.equals(M_RATE_SUCCESS) && !pEventType.equals(M_NOT_SUPPORTED)){ if(!pEventType.equals(M_RATE_FAILURE) && !pEventType.equals(M_RATE_SUCCESS) && !pEventType.equals(M_NOT_SUPPORTED)){
onClearReference(); onClearReference();
mData = null;
} }
if(pEventType.equals(pluginEnums.eMessageManager.M_RESET)){ if(pEventType.equals(pluginEnums.eMessageManager.M_RESET)){
onReset(); onReset();

View File

@ -2,6 +2,9 @@ package com.darkweb.genesissearchengine.pluginManager.orbotPluginManager;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.os.Handler;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import org.mozilla.gecko.PrefsHelper; import org.mozilla.gecko.PrefsHelper;
import org.torproject.android.service.OrbotService; import org.torproject.android.service.OrbotService;
@ -9,14 +12,20 @@ import org.torproject.android.service.util.Prefs;
import org.torproject.android.service.wrapper.orbotLocalConstants; import org.torproject.android.service.wrapper.orbotLocalConstants;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.Collections;
import java.util.List; import java.util.List;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_APPLICATION_CRASH;
import static org.torproject.android.service.TorServiceConstants.ACTION_START; import static org.torproject.android.service.TorServiceConstants.ACTION_START;

View File

@ -1,10 +1,7 @@
package com.widget.search.constants; package com.widget.Genesis.constants;
import static com.darkweb.genesissearchengine.constants.constants.CONST_WIDGET_NAME;
public class constants { public class constants {
/*LOCAL URL CONSTANTS*/ /*LOCAL URL CONSTANTS*/
public static final String SHARED_PREF_FILE = CONST_WIDGET_NAME;
public static final String COUNT_KEY = "count";
} }

View File

@ -1,4 +1,4 @@
package com.darkweb.genesissearchengine; package com.widget.Genesis;
import java.util.List; import java.util.List;

View File

@ -1,19 +1,31 @@
package com.widget.search.helperMethod; package com.widget.Genesis.helperMethod;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import com.widget.search.searchWidgetManager; import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys;
import com.widget.Genesis.widgetManager.widgetController;
import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION;
import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME;
public class helperMethod public class helperMethod
{ {
/*Helper Methods General*/ /*Helper Methods General*/
public static PendingIntent onCreatePendingIntent(Context pContext,int pFlag, int pID, String pAction){ public static PendingIntent onCreatePendingIntent(Context pContext,int pFlag, int pID, String pAction){
Intent intentUpdate = new Intent(pContext, searchWidgetManager.class); Intent intentUpdate = new Intent(pContext, widgetController.class);
intentUpdate.setAction(pAction); intentUpdate.setAction(pAction);
PendingIntent pendingUpdate = PendingIntent.getBroadcast(pContext, pID, intentUpdate, pFlag); PendingIntent pendingUpdate = PendingIntent.getBroadcast(pContext, pID, intentUpdate, pFlag);
return pendingUpdate; return pendingUpdate;
} }
public static void onStartApplication(Context pContext,String pPackageName){
Intent launchIntent = pContext.getPackageManager().getLaunchIntentForPackage(pPackageName);
pContext.startActivity(launchIntent);
}
} }

View File

@ -1,97 +1,54 @@
package com.widget.search; package com.widget.Genesis.widgetManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider; import android.appwidget.AppWidgetProvider;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.view.View;
import android.widget.RemoteViews; import android.widget.RemoteViews;
import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.constants.status;
import com.example.myapplication.R; import com.example.myapplication.R;
import com.widget.search.helperMethod.helperMethod; import com.widget.Genesis.helperMethod.helperMethod;
import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class searchWidgetManager extends AppWidgetProvider { public class widgetController extends AppWidgetProvider {
/*Model Declaration*/
private widgetViewController mWidgetViewController;
private widgetModelController mWidgetModelController;
/* Local Variables */ /* Local Variables */
int mCurrentWidth; private int mCurrentWidth;
private RemoteViews mViews;
/* Navigator Initializations */ /* Navigator Initializations */
private void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) { private void initializeAppWidget(Context pContext, AppWidgetManager pAppWidgetManager, int pAppWidgetId) {
initializeModel(pContext);
initializeLocalEventHandler(pContext, pAppWidgetId);
pAppWidgetManager.updateAppWidget(pAppWidgetId, mViews);
}
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_search_controller); private void initializeLocalEventHandler(Context pContext, int pAppWidgetId){
mViews.setOnClickPendingIntent(R.id.pTextInvoker, helperMethod.onCreatePendingIntent(pContext, pAppWidgetId, PendingIntent.FLAG_UPDATE_CURRENT, "mOpenApplication"));
mViews.setOnClickPendingIntent(R.id.pVoiceInvoker, helperMethod.onCreatePendingIntent(pContext, pAppWidgetId, PendingIntent.FLAG_UPDATE_CURRENT, "mOpenVoice"));
}
views.setOnClickPendingIntent(R.id.pTextInvoker, helperMethod.onCreatePendingIntent(context, appWidgetId, PendingIntent.FLAG_UPDATE_CURRENT, "mOpenApplication")); private void initializeModel(Context pContext){
views.setOnClickPendingIntent(R.id.pVoiceInvoker, helperMethod.onCreatePendingIntent(context, appWidgetId, PendingIntent.FLAG_UPDATE_CURRENT, "mOpenVoice")); mViews = new RemoteViews(pContext.getPackageName(), R.layout.widget_search_controller);
appWidgetManager.updateAppWidget(appWidgetId, views); mWidgetViewController = new widgetViewController(pContext, new widgetViewCallback(), mViews);
mWidgetModelController = new widgetModelController(new widgetModelCallback());
} }
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
initializeModel(context);
String action = intent.getAction(); mWidgetModelController.onTrigger(widgetEnums.eModelViewController.M_ON_RECIEVE, Arrays.asList(context, intent));
switch (action) {
case enums.WidgetCommands.OPEN_APPLICATION: {
status.sWidgetResponse = enums.WidgetResponse.SEARCHBAR;
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME);
launchIntent.putExtra(enums.WidgetCommands.OPEN_APPLICATION, true);
context.startActivity(launchIntent);
break;
}
case enums.WidgetCommands.OPEN_VOICE: {
status.sWidgetResponse = enums.WidgetResponse.VOICE;
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME);
launchIntent.putExtra(enums.WidgetCommands.OPEN_APPLICATION, true);
context.startActivity(launchIntent);
break;
}
case AppWidgetManager.ACTION_APPWIDGET_UPDATE: {
Bundle extras = intent.getExtras();
if (extras != null) {
int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);
if (appWidgetIds != null && appWidgetIds.length > 0) {
this.onUpdate(context, AppWidgetManager.getInstance(context), appWidgetIds);
}
}
break;
}
case AppWidgetManager.ACTION_APPWIDGET_DELETED: {
Bundle extras = intent.getExtras();
if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)) {
final int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID);
this.onDeleted(context, new int[]{appWidgetId});
}
break;
}
case AppWidgetManager.ACTION_APPWIDGET_OPTIONS_CHANGED: {
Bundle extras = intent.getExtras();
if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)&& extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS)) {
int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID);
Bundle widgetExtras = extras.getBundle(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS);
this.onAppWidgetOptionsChanged(context, AppWidgetManager.getInstance(context),appWidgetId, widgetExtras);
}
break;
}
case AppWidgetManager.ACTION_APPWIDGET_RESTORED: {
Bundle extras = intent.getExtras();
if (extras != null) {
int[] oldIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_OLD_IDS);
int[] newIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);
if (oldIds != null && oldIds.length > 0) {
this.onRestored(context, oldIds, newIds);
this.onUpdate(context, AppWidgetManager.getInstance(context), newIds);
}
}
break;
}
}
} }
/* Local Overrides */ /* Local Overrides */
@Override @Override
@ -102,20 +59,41 @@ public class searchWidgetManager extends AppWidgetProvider {
@Override @Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
initializeModel(context);
if(mCurrentWidth!=0){ if(mCurrentWidth!=0){
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_search_controller); int size = (int) Math.floor ((mCurrentWidth - 30) / 70);
int size = (int) Math.floor ((mCurrentWidth - 30) / 70);; mWidgetViewController.onTrigger(widgetEnums.eWidgetViewController.M_INIT, Collections.singletonList(size));
appWidgetManager.updateAppWidget(appWidgetIds, mViews);
if(size<=3){
views.setViewVisibility(R.id.pVoiceInput, View.GONE);
views.setViewVisibility(R.id.pSearchInputWidget, View.GONE);
}else {
views.setViewVisibility(R.id.pVoiceInput, View.VISIBLE);
views.setViewVisibility(R.id.pSearchInputWidget, View.VISIBLE);
}
appWidgetManager.updateAppWidget(appWidgetIds, views);
}else { }else {
updateAppWidget(context, appWidgetManager, appWidgetIds[0]); initializeAppWidget(context, appWidgetManager, appWidgetIds[0]);
}
}
/* Callbacks */
public class widgetViewCallback implements eventObserver.eventListener {
@Override
public Object invokeObserver(List<Object> data, Object e_type) {
return null;
}
}
public class widgetModelCallback implements eventObserver.eventListener {
@Override
public Object invokeObserver(List<Object> data, Object e_type) {
if(e_type.equals(widgetEnums.eWidgetControllerCallback.M_UPDATE)){
onUpdate((Context)data.get(0), (AppWidgetManager)data.get(1), (int[])data.get(2));
}
else if(e_type.equals(widgetEnums.eWidgetControllerCallback.M_OPTION_CHANGE)){
onAppWidgetOptionsChanged((Context)data.get(0), (AppWidgetManager)data.get(1), (int)data.get(2), (Bundle)data.get(3));
}
else if(e_type.equals(widgetEnums.eWidgetControllerCallback.M_RESTORE)){
onRestored((Context) data.get(0), (int[]) data.get(1), (int[]) data.get(2));
}
else if(e_type.equals(widgetEnums.eWidgetControllerCallback.M_DELETE)){
onDeleted((Context) data.get(0), (int[]) data.get(1));
}
return null;
} }
} }
} }

View File

@ -1,13 +1,21 @@
package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager; package com.widget.Genesis.widgetManager;
public class settingHomeEnums public class widgetEnums
{ {
/*History Manager*/ /*Widget Manager*/
public enum eHomeModel {
}
public enum eHomeViewController { public enum eWidgetViewController {
M_INIT M_INIT
} }
public enum eModelViewController {
M_ON_RECIEVE
}
/*Widget Manager Callback*/
public enum eWidgetControllerCallback {
M_UPDATE, M_DELETE, M_OPTION_CHANGE, M_RESTORE
}
} }

View File

@ -1,24 +1,18 @@
package com.widget.Genesis.widgetManager; package com.widget.Genesis.widgetManager;
import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.View;
import android.widget.RemoteViews;
import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.example.myapplication.R;
import com.widget.Genesis.helperMethod.helperMethod; import com.widget.Genesis.helperMethod.helperMethod;
import java.util.Arrays;
import java.util.List; import java.util.List;
import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME;
public class modelViewController extends AppWidgetProvider { public class widgetModelController {
/*Private Variables*/ /*Private Variables*/
@ -26,7 +20,7 @@ public class modelViewController extends AppWidgetProvider {
/*Initializations*/ /*Initializations*/
modelViewController(eventObserver.eventListener pEvent) widgetModelController(eventObserver.eventListener pEvent)
{ {
this.mEvent = pEvent; this.mEvent = pEvent;
} }
@ -49,7 +43,7 @@ public class modelViewController extends AppWidgetProvider {
if (extras != null) { if (extras != null) {
int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS); int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);
if (appWidgetIds != null && appWidgetIds.length > 0) { if (appWidgetIds != null && appWidgetIds.length > 0) {
this.onUpdate(context, AppWidgetManager.getInstance(context), appWidgetIds); mEvent.invokeObserver(Arrays.asList(context, AppWidgetManager.getInstance(context), appWidgetIds), widgetEnums.eWidgetControllerCallback.M_UPDATE);
} }
} }
break; break;
@ -58,7 +52,7 @@ public class modelViewController extends AppWidgetProvider {
Bundle extras = intent.getExtras(); Bundle extras = intent.getExtras();
if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)) { if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)) {
final int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID); final int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID);
this.onDeleted(context, new int[]{appWidgetId}); mEvent.invokeObserver(Arrays.asList(context, new int[]{appWidgetId}), widgetEnums.eWidgetControllerCallback.M_DELETE);
} }
break; break;
} }
@ -67,7 +61,7 @@ public class modelViewController extends AppWidgetProvider {
if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)&& extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS)) { if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)&& extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS)) {
int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID); int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID);
Bundle widgetExtras = extras.getBundle(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS); Bundle widgetExtras = extras.getBundle(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS);
this.onAppWidgetOptionsChanged(context, AppWidgetManager.getInstance(context),appWidgetId, widgetExtras); mEvent.invokeObserver(Arrays.asList(context, AppWidgetManager.getInstance(context),appWidgetId, widgetExtras), widgetEnums.eWidgetControllerCallback.M_OPTION_CHANGE);
} }
break; break;
} }
@ -78,8 +72,8 @@ public class modelViewController extends AppWidgetProvider {
int[] oldIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_OLD_IDS); int[] oldIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_OLD_IDS);
int[] newIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS); int[] newIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);
if (oldIds != null && oldIds.length > 0) { if (oldIds != null && oldIds.length > 0) {
this.onRestored(context, oldIds, newIds); mEvent.invokeObserver(Arrays.asList(context, oldIds, newIds), widgetEnums.eWidgetControllerCallback.M_RESTORE);
this.onUpdate(context, AppWidgetManager.getInstance(context), newIds); mEvent.invokeObserver(Arrays.asList(context, AppWidgetManager.getInstance(context), newIds), widgetEnums.eWidgetControllerCallback.M_UPDATE);
} }
} }
break; break;

View File

@ -1,120 +1,48 @@
package com.widget.Genesis.widgetManager; package com.widget.Genesis.widgetManager;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider; import android.appwidget.AppWidgetProvider;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.RemoteViews; import android.widget.RemoteViews;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager.settingHomeEnums;
import com.darkweb.genesissearchengine.eventObserver;
import com.example.myapplication.R; import com.example.myapplication.R;
import com.widget.Genesis.helperMethod.helperMethod;
import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME;
public class widgetController extends AppWidgetProvider { import java.util.List;
/* Local Variables */ public class widgetViewController extends AppWidgetProvider {
int mCurrentWidth; /*Private Variables*/
/* Navigator Initializations */ private eventObserver.eventListener mEvent;
private Context mContext;
private RemoteViews mViews;
private void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId) { /*Initializations*/
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_search_controller); widgetViewController(Context pContext, eventObserver.eventListener pEvent, RemoteViews pViews)
{
views.setOnClickPendingIntent(R.id.pTextInvoker, helperMethod.onCreatePendingIntent(context, appWidgetId, PendingIntent.FLAG_UPDATE_CURRENT, "mOpenApplication")); this.mEvent = pEvent;
views.setOnClickPendingIntent(R.id.pVoiceInvoker, helperMethod.onCreatePendingIntent(context, appWidgetId, PendingIntent.FLAG_UPDATE_CURRENT, "mOpenVoice")); this.mContext = pContext;
appWidgetManager.updateAppWidget(appWidgetId, views); this.mViews = pViews;
} }
public void onReceive(Context context, Intent intent) { private void initialize(int pSize){
if(pSize<=3){
String action = intent.getAction(); mViews.setViewVisibility(R.id.pVoiceInput, View.GONE);
switch (action) { mViews.setViewVisibility(R.id.pSearchInputWidget, View.GONE);
case enums.WidgetCommands.OPEN_APPLICATION: {
status.sWidgetResponse = enums.WidgetResponse.SEARCHBAR;
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME);
launchIntent.putExtra(enums.WidgetCommands.OPEN_APPLICATION, true);
context.startActivity(launchIntent);
break;
}
case enums.WidgetCommands.OPEN_VOICE: {
status.sWidgetResponse = enums.WidgetResponse.VOICE;
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME);
launchIntent.putExtra(enums.WidgetCommands.OPEN_APPLICATION, true);
context.startActivity(launchIntent);
break;
}
case AppWidgetManager.ACTION_APPWIDGET_UPDATE: {
Bundle extras = intent.getExtras();
if (extras != null) {
int[] appWidgetIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);
if (appWidgetIds != null && appWidgetIds.length > 0) {
this.onUpdate(context, AppWidgetManager.getInstance(context), appWidgetIds);
}
}
break;
}
case AppWidgetManager.ACTION_APPWIDGET_DELETED: {
Bundle extras = intent.getExtras();
if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)) {
final int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID);
this.onDeleted(context, new int[]{appWidgetId});
}
break;
}
case AppWidgetManager.ACTION_APPWIDGET_OPTIONS_CHANGED: {
Bundle extras = intent.getExtras();
if (extras != null && extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_ID)&& extras.containsKey(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS)) {
int appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID);
Bundle widgetExtras = extras.getBundle(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS);
this.onAppWidgetOptionsChanged(context, AppWidgetManager.getInstance(context),appWidgetId, widgetExtras);
}
break;
}
case AppWidgetManager.ACTION_APPWIDGET_RESTORED: {
Bundle extras = intent.getExtras();
if (extras != null) {
int[] oldIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_OLD_IDS);
int[] newIds = extras.getIntArray(AppWidgetManager.EXTRA_APPWIDGET_IDS);
if (oldIds != null && oldIds.length > 0) {
this.onRestored(context, oldIds, newIds);
this.onUpdate(context, AppWidgetManager.getInstance(context), newIds);
}
}
break;
}
}
}
/* Local Overrides */
@Override
public void onAppWidgetOptionsChanged (Context context, AppWidgetManager appWidgetManager, int appWidgetId, Bundle widgetInfo) {
mCurrentWidth = widgetInfo.getInt (AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH);
onUpdate(context, appWidgetManager, new int[]{appWidgetId});
}
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
if(mCurrentWidth!=0){
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_search_controller);
int size = (int) Math.floor ((mCurrentWidth - 30) / 70);;
if(size<=3){
views.setViewVisibility(R.id.pVoiceInput, View.GONE);
views.setViewVisibility(R.id.pSearchInputWidget, View.GONE);
}else {
views.setViewVisibility(R.id.pVoiceInput, View.VISIBLE);
views.setViewVisibility(R.id.pSearchInputWidget, View.VISIBLE);
}
appWidgetManager.updateAppWidget(appWidgetIds, views);
}else { }else {
updateAppWidget(context, appWidgetManager, appWidgetIds[0]); mViews.setViewVisibility(R.id.pVoiceInput, View.VISIBLE);
mViews.setViewVisibility(R.id.pSearchInputWidget, View.VISIBLE);
} }
} }
public Object onTrigger(widgetEnums.eWidgetViewController pCommands, List<Object> pData){
if(pCommands.equals(widgetEnums.eWidgetViewController.M_INIT)){
initialize((int)pData.get(0));
}
return null;
}
} }

View File

@ -1,49 +0,0 @@
package com.darkweb.genesissearchengine.constants;
public class enums
{
/*Settings Manager*/
public enum etype{
M_CHANGE_HOME_THEME, M_IS_ERROR_PAGE, on_update_favicon,M_RELOAD,ON_UPDATE_TAB_TITLE, ON_OPEN_TAB_VIEW,ON_NEW_TAB_ANIMATION, M_UPDATE_SESSION_STATE,ON_LOAD_REQUEST, GECKO_SCROLL_UP, GECKO_SCROLL_UP_ALWAYS, GECKO_SCROLL_DOWN, WAS_SCROLL_CHANGED, GECKO_SCROLL_DOWN_MOVE, GECKO_SCROLL_UP_MOVE, GECKO_SCROLL_DOWN_CALLER,ON_UPDATE_SEARCH_BAR,M_ON_MAIL,SESSION_ID,M_UPDATE_PIXEL_BACKGROUND, M_ON_SCROLL_BOUNDARIES, M_ON_SCROLL_TOP_BOUNDARIES, M_ON_SCROLL_NO_BOUNDARIES, M_INIT_PADDING, M_RATE_COUNT,M_CACHE_UPDATE_TAB,M_DEFAULT_BROWSER,
on_verify_selected_url_menu,FINDER_RESULT_CALLBACK,M_ADMOB_BANNER_RECHECK,M_OPEN_SESSION,M_DOWNLOAD_FAILURE, M_ADVERT_LOADED,
welcome, reload,download_folder, M_UPDATE_THEME,M_ON_BANNER_UPDATE, M_LOAD_HOMEPAGE_GENESIS,M_INIT_TAB_COUNT_FORCED,M_SPLASH_DISABLE,M_NEW_LINK_IN_NEW_TAB,M_RESET_SUGGESTION,
url_triggered, url_triggered_new_tab,url_clear,fetch_favicon, M_COPY_URL,url_clear_at,remove_from_database,is_empty,M_HOME_PAGE,M_PRELOAD_URL,ON_KEYBOARD_CLOSE,M_CLOSE_TAB,
on_close_sesson,on_long_press, on_full_screen,on_handle_external_intent,on_update_suggestion_url,progress_update,progress_update_forced, ON_EXPAND_TOP_BAR,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,start_proxy, ON_UPDATE_THEME, M_NEW_IDENTITY, M_NEW_IDENTITY_MESSAGED, M_INITIALIZE_TAB_SINGLE, M_INITIALIZE_TAB_LINK,on_request_completed, on_update_history,on_update_suggestion,M_WELCOME_MESSAGE,ON_FIRST_PAINT, ON_LOAD_TAB_ON_RESUME, ON_SESSION_REINIT,on_page_loaded,on_load_error, M_ORBOT_LOADING,download_file_popup,on_init_ads, M_GET_CURRENT_URL,search_update, open_new_tab,open_new_tab_instant
}
/*General Enums*/
public static class AddTabCallback {
public static final int TAB_ADDED = 0;
public static final int TAB_FULL = 1;
}
public static class Theme {
public static final int THEME_LIGHT = 0;
public static final int THEME_DARK = 1;
public static final int THEME_DEFAULT = 2;
}
public static class WidgetResponse {
public static final int NONE = 0;
public static final int VOICE = 1;
public static final int SEARCHBAR = 2;
}
public static class ImageQueueStatus {
public static final int M_IMAGE_LOADING = 0;
public static final int M_IMAGE_LOADED_SUCCESSFULLY = 1;
public static final int M_IMAGE_LOADING_FAILED = 2;
}
public static class ScrollDirection {
public static final int HORIZONTAL = 0;
public static final int VERTICAL = 1;
}
public static class WidgetCommands {
public static final String OPEN_APPLICATION = "mOpenApplication";
public static final String OPEN_VOICE = "mOpenVoice";
}
}

View File

@ -1,70 +0,0 @@
package com.darkweb.genesissearchengine.constants;
public class keys
{
/*Home page*/
public static String HOME_LOW_MEMORY = "LOW_MEMORY";
public static final String HOME_REFERENCE_WEBSITES = "HOME_REFERENCE_WEBSITES";
/*Proxy Manager*/
public static final String PROXY_TYPE = "network.proxy.type";
public static final String PROXY_SOCKS = "network.proxy.socks";
public static final String PROXY_SOCKS_PORT = "network.proxy.socks_port";
public static final String PROXY_SOCKS_VERSION = "network.proxy.socks_version";
public static final String PROXY_SOCKS_REMOTE_DNS = "network.proxy.socks_remote_dns";
public static final String PROXY_CACHE = "browser.cache.disk.enable";
public static final String PROXY_MEMORY = "browser.cache.memory.enable";
public static final String PROXY_DO_NOT_TRACK_HEADER_ENABLED = "privacy.donottrackheader.enabled";
public static final String PROXY_DO_NOT_TRACK_HEADER_VALUE = "privacy.donottrackheader.value";
public static final String PROXY_IS_APP_RATED = "IS_APP_RATED";
public static final String PROXY_LIST_TYPE = "list_type";
public static final String PROXY_IMAGE = "permissions.default.image";
/*Settings*/
public static final String SETTING_VERSION = "VERSION_V1";
public static final String SETTING_LANGUAGE = "LANGUAGE_V1";
public static final String SETTING_LANGUAGE_REGION = "LANGUAGE_REGION_V1";
public static final String SETTING_SEARCH_ENGINE = "SEARCH_ENGINE_V1";
public static final String SETTING_FIRST_INSTALLED = "FIRST_INSTALLED_V1";
public static final String SETTING_JAVA_SCRIPT = "JAVA_SCRIPT_V1";
public static final String SETTING_POPUP = "POPUP_V1";
public static final String SETTING_HISTORY_CLEAR = "HISTORY_CLEAR_V1";
public static final String SETTING_GATEWAY = "pref_bridges_enabled_auto_V1";
public static final String SETTING_GATEWAY_MANUAL = "pref_bridges_enabled_manual_V1";
public static final String SETTING_IS_BOOTSTRAPPED = "IS_BOOTSTRAPPED_V1";
public static final String SETTING_IS_WELCOME_ENABLED = "IS_WELCOME_ENABLED_V1";
public static final String SETTING_FONT_SIZE = "FONT_SIZE_V1";
public static final String SETTING_FONT_ADJUSTABLE = "FONT_ADJUSTABLE_V1";
public static final String SETTING_COOKIE_ADJUSTABLE = "COOKIE_ADJUSTABLE_NEW_V1";
public static final String SETTING_NOTIFICATION_STATUS = "NOTIFICATION_STATUS_V1";
public static final String SETTING_SEARCH_HISTORY = "SETTING_SEARCH_HISTORY_V1";
public static final String SETTING_SEARCH_SUGGESTION = "SETTING_SEARCH_STATUS_V1";
public static final String SETTING_ZOOM = "SETTING_ZOOM_V1";
public static final String SETTING_VOICE_INPUT = "SETTING_VOICE_INPUT_V1";
public static final String SETTING_TRACKING_PROTECTION = "SETTING_TRACKING_PROTECTION_V1";
public static final String SETTING_RATE_COUNT = "SETTING_RATE_COUNT_V1";
public static final String SETTING_DONOT_TRACK = "SETTING_DONOT_TRACK_V1";
public static final String SETTING_RESTORE_TAB = "SETTING_RESTORE_TAB_V1";
public static final String SETTING_CHARACTER_ENCODING = "SETTING_CHARACTER_ENCODING_V1";
public static final String SETTING_SHOW_IMAGES = "SETTING_SHOW_IMAGES_V1";
public static final String SETTING_SHOW_TAB_GRID = "SETTING_SHOW_TAB_GRID_V1";
public static final String SETTING_SHOW_FONTS = "SETTING_SHOW_FONTS_V1";
public static final String SETTING_TOOLBAR_THEME = "SETTING_TOOLBAR_THEME_V1";
public static final String SETTING_THEME = "SETTING_THEME_LIGHT_V1";
public static final String SETTING_FULL_SCREEN_BROWSIING = "SETTING_FULL_SCREEN_BROWSIING_V2";
public static final String SETTING_OPEN_URL_IN_NEW_TAB = "SETTING_OPEN_URL_IN_NEW_TAB_V1";
public static final String SETTING_LIST_VIEW = "SETTING_LIST_VIEW_V1";
public static final String SETTING_INSTALLED = "SETTING_INSTALLED_V1";
/*Bridge Settings*/
public static final String BRIDGE_CUSTOM_BRIDGE_1 = "CLEAR_PREFS_V1";
public static final String BRIDGE_CUSTOM_TYPE = "BRIDGE_CUSTOM_TYPE_V1";
public static final String BRIDGE_ENABLES = "pref_bridges_enabled_V1";
public static final String VPN_ENABLED = "pref_vpn_V1";
public static final String BRIDGE_DEFAULT = "BRIDGE_DEFAULT";
}

View File

@ -1,10 +0,0 @@
package com.darkweb.genesissearchengine.constants;
public class messages
{
/*POST MESSAGES KEYS*/
public final static int MESSAGE_UPDATE_LOADING_TEXT =1;
public final static int MESSAGE_ON_URL_LOAD =2;
public final static int MESSAGE_PROGRESSBAR_VALIDATE =3;
}

View File

@ -1,12 +0,0 @@
package com.darkweb.genesissearchengine.constants;
public class sql
{
/*HISTORY*/
public static final String SQL_CLEAR_HISTORY = "delete from history where 1";
public static final String SQL_CLEAR_BOOKMARK = "delete from bookmark where 1";
public static final String SQL_CLEAR_TAB = "delete from tab where 1";
}

View File

@ -1,139 +0,0 @@
package com.darkweb.genesissearchengine.constants;
import android.content.Context;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import org.mozilla.geckoview.ContentBlocking;
import java.util.Arrays;
import java.util.Locale;
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
public class status
{
/*App Status*/
public static boolean sPaidStatus = false;
public static boolean sDeveloperBuild = false;
/*Settings Status*/
public static Locale mSystemLocale = null;
public static String sSettingSearchStatus = constants.CONST_BACKEND_GENESIS_URL;
public static String sSettingRedirectStatus = strings.GENERIC_EMPTY_STR;
public static String sSettingLanguage = "en";
public static String sSettingLanguageRegion = "Us";
public static String sReferenceWebsites;
public static String sBridgeCustomBridge = strings.GENERIC_EMPTY_STR;
public static String sBridgeCustomType = strings.GENERIC_EMPTY_STR;
public static String sVersion = "";
public static String sExternalWebsite = strings.GENERIC_EMPTY_STR;
public static String sBridgesDefault = strings.BRIDGES_DEFAULT;
public static boolean sUIInteracted = false;
public static boolean sSettingEnableZoom = true;
public static boolean sSettingEnableVoiceInput = true;
public static boolean sSettingSearchHistory = false;
public static boolean sSearchSuggestionStatus = false;
public static boolean sSettingJavaStatus = true;
public static boolean sSettingPopupStatus = false;
public static boolean sClearOnExit = true;
public static boolean sSettingIsAppPaused = false;
public static boolean sSettingIsWelcomeEnabled = true;
public static boolean sSettingIsAppStarted = false;
public static boolean sSettingIsAppRunning = false;
public static boolean sSettingIsAppRedirected = false;
public static boolean sSettingIsAppRestarting = false;
public static boolean sSettingIsAppRated = false;
public static boolean sSettingFontAdjustable = true;
public static boolean sSettingFirstStart = true;
public static boolean mThemeApplying = false;
public static boolean sTabGridLayoutEnabled = true;
public static boolean sStatusDoNotTrack = true;
public static boolean sRestoreTabs = false;
public static boolean sCharacterEncoding = false;
public static boolean sShowWebFonts = true;
public static boolean sToolbarTheme = false;
public static boolean sFullScreenBrowsing = false;
public static boolean sOpenURLInNewTab = true;
public static boolean sDefaultNightMode;
public static boolean sLogThemeStyleAdvanced;
public static boolean sBridgeGatewayAuto = false;
public static boolean sBridgeGatewayManual = false;
public static boolean sVPNStatus = false;
public static boolean sVPNPermission = false;
public static boolean sBridgeStatus = false;
public static boolean sAppInstalled = false;
public static int sTheme = enums.Theme.THEME_DEFAULT;
public static int sSettingCookieStatus = ContentBlocking.AntiTracking.DEFAULT;
public static int sShowImages = -1;
public static int sWidgetResponse = enums.WidgetResponse.NONE;
public static int sBridgeNotificationManual = 0;
public static int sSettingTrackingProtection = 0;
public static int sGlobalURLCount = 0;
public static float sSettingFontSize = 1;
public static boolean sDisableExpandTemp = false;
private static void versionVerifier(Context pContext){
status.sVersion = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.SETTING_VERSION,strings.GENERIC_EMPTY_STR));
if(!status.sVersion.equals("1.0.0.1")){
pContext.deleteDatabase(constants.CONST_DATABASE_NAME);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_CLEAR_PREFS, null);
status.sVersion = "1.0.0.1";
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_VERSION,strings.SETTING_DEFAULT_VERSION));
}
}
public static void initStatus(Context pContext)
{
versionVerifier(pContext);
status.sUIInteracted = false;
status.sSettingSearchHistory = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true));
status.sSearchSuggestionStatus = (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.sSettingPopupStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_POPUP,true));
status.sClearOnExit = (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,true));
status.sBridgeGatewayManual = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false));
status.sSettingIsWelcomeEnabled = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true));
status.sSettingIsAppRated = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,false));
status.sVPNStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.VPN_ENABLED,false));
status.sBridgeStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false));
status.sSettingFontAdjustable = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true));
status.sSettingFirstStart = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FIRST_INSTALLED,true));
status.sSettingEnableZoom = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true));
status.sSettingEnableVoiceInput = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,true));
status.sSettingTrackingProtection = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_TRACKING_PROTECTION, ContentBlocking.AntiTracking.DEFAULT));
status.sStatusDoNotTrack = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_DONOT_TRACK,true));
status.sSettingCookieStatus = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY));
status.sSettingFontSize = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_FLOAT, Arrays.asList(keys.SETTING_FONT_SIZE,100));
status.sSettingLanguage = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.SETTING_LANGUAGE,strings.SETTING_DEFAULT_LANGUAGE));
status.sReferenceWebsites = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.HOME_REFERENCE_WEBSITES,strings.HOME_REFERENCE_WEBSITES_DEFAULT));
status.sSettingLanguageRegion = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.SETTING_LANGUAGE_REGION,strings.SETTING_DEFAULT_LANGUAGE_REGION));
status.sSettingSearchStatus = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE,constants.CONST_BACKEND_GENESIS_URL));
status.sBridgeCustomBridge = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4));
status.sBridgeCustomType = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,strings.GENERIC_EMPTY_SPACE));
status.sBridgesDefault = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.BRIDGE_DEFAULT,strings.BRIDGES_DEFAULT));
status.sBridgeNotificationManual = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS,1));
status.sRestoreTabs = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB,false));
status.sCharacterEncoding = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_CHARACTER_ENCODING,false));
status.sShowImages = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,0));
status.sShowWebFonts = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,true));
status.sFullScreenBrowsing = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,false));
status.sToolbarTheme = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_TOOLBAR_THEME,true));
status.sTheme = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_THEME,enums.Theme.THEME_DEFAULT));
status.sOpenURLInNewTab = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,true));
status.sLogThemeStyleAdvanced = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_LIST_VIEW,true));
status.sTabGridLayoutEnabled = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_SHOW_TAB_GRID,true));
status.sGlobalURLCount = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.SETTING_RATE_COUNT, 0));
status.sAppInstalled = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.SETTING_INSTALLED,false));
}
}

View File

@ -1,67 +0,0 @@
package com.darkweb.genesissearchengine.constants;
public class strings
{
/*Notification Manager Manager*/
public static final String NOTIFICATION_TITLE = "Genesis Browser";
public static final String[] NOTIFICATION_BODY = {"Genesis Browser updated successfully",
"Use Genesis Browser to enhance your privacy",
"Privacy and security enhanced, use Genesis Browser",
"Hidden web & Genesis Search Engine updated",
"Live websites updated on Genesis Search Engine",
"Access secure part of internet, Use Genesis Browser",
"Your privacy matters to us, Use Genesis browser",
"Stop tracking, use Genesis Browser"};
/*History Manager*/
public static final String HISTORY_TITLE = "history";
public static final String HISTORY_CLEAR_HISTORY = "Clear History";
public static final String HISTORY_NO_HISTORY_FOUND = "No History Found";
/*Bookmark Manager*/
public static final String BOOKMARK_CLEAR_BOOKMARK = "Clear Bookmark";
public static final String BOOKMARK_NO_BOOKMARK_FOUND = "No Bookmark Found";
public static final String BOOKMARK_DEFAULT_TITLE = "New Bookmark";
/*Bridge Manager*/
public static final String BRIDGE_CUSTOM_BRIDGE_OBFS4 = "obfs4";
public static final String BRIDGE_CUSTOM_BRIDGE_MEEK = "meek";
public static final String BRIDGES_DEFAULT = "obfs4 78.215.187.186:45675 AE907EE5FAA5D0D27E0C83EFA6ADF8E79FCC0FF1 cert=/TRjMo+RinKaixARMjMtZZBhystaBe+aDaapPrbiITFtWx3M/AJcvpjHjO54tJqLd1+IWQ iat-mode=0\n" +
"obfs4 107.160.7.24:443 7A0904F6D182B81BEFE0DEDAFEC974494672627B cert=a5/IlZMnDvb8d92LTHMfsBIgL7QlDLPiXiLwe85uedC80mGD0QerygzmsWnMEdwG9ER9Eg iat-mode=0\n" +
"obfs4 79.136.160.201:46501 66AC975BF7CB429D057AE07FC0312C57D61BAEC1 cert=dCtn9Ya8z+R8YQikdWgC3XTAt58z5Apnm95QHrJwnhFSdnphPPEz+NMm6OawWc2srKLjJg iat-mode=0\n" +
"obfs4 94.242.249.2:58809 6AF3024788A7EA8F84E3FA3F60018B62291803E4 cert=X0sDCJLKMM/EISdGDEfGrsks41UYmScjIIXQ9AZgWFVKNKS6klcNEpdF4tNXFz6kIyk4Ug iat-mode=0\n" +
"obfs4 35.203.134.33:2224 15524C683CC872C8C8FB5B779A8D53F54F7ADCD4 cert=bXLTv0Kwt1zgPBoeVF86vC+0tYAHepR7+QMczhhTQw9hpAIhatt/Bpe6rSGY63Zh8aZ+dQ iat-mode=0\n" +
"obfs4 188.166.252.228:9443 595770328CA95E39FF5B81013880B46CA1B29546 cert=3PjhGUq3xWDMrBAzbV1eU4zPSB3GRGBpYdXQEs9hkrwC9RSZdnEe1P+cg7VgLgYTj/2MMg iat-mode=0\n" +
"obfs4 89.163.181.169:443 6A17D1E29E2807A1A4314215553079001031A7FF cert=e8JIYivx1zbYNOqq3a3+nDf/NDHoDQ/th/RVAnlVQePUIHxllG7aOku7pSwZisZ7i6ybVw iat-mode=0\n" +
"obfs4 94.242.249.2:40190 C7BE8154678E7537CCAC60B097D51A8A7EF8BCDF cert=8jw57wlMlVXCKsCnF7gCdApx7sRZLD5zPl8qdccwp0zltYG6kMYqBNm60dP8IxRH/l8OcQ iat-mode=0\n" +
"obfs4 77.81.104.251:443 115C90EBD0EB631C177560A872535772215478D9 cert=UsuF7oN4KNKviZP54JOyTCoCphrdM5gwZK4vT8GnCAcmqLUJEJxyw1dpko9a/ii6He4iZg iat-mode=0\n" +
"obfs4 5.249.146.133:80 FAF3A0073330D6AD92F3B4874B0D945562A633EF cert=TRe8bAODtjcGij7EPQaUayWEOqR99wDh2l3B4hFtCsn1JTJCph03pRZ9tx8wynpLYKWMQg iat-mode=0\n" +
"meek_lite 0.0.2.0:2 97700DFE9F483596DDA6264C4D7DF7641E1E39CE url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com\n" +
"snowflake 192.0.2.3:1";
/*Generic*/
public static final String GENERIC_EMPTY_STR = "";
public static final String GENERIC_EMPTY_SPACE = " ";
/*Language Manager*/
public static final String LANGUAGE_NOT_SUPPORTED = "is unsupported";
/*Settings Manager*/
public static final String SETTING_DEFAULT_LANGUAGE = "en";
public static final String SETTING_DEFAULT_LANGUAGE_REGION = "Us";
public static final String SETTING_DEFAULT_VERSION = "1.0.0.1";
/*Home Manager*/
public static final String HOME_BLANK_PAGE = "about:blank";
public static final String HOME_REFERENCE_WEBSITES_DEFAULT = "[{\"mUrl\":\"https://www.wikileaks.org/wiki/Wikileaks\",\"mIcon\":\"https://www.wikileaks.org/wiki/Wikileaks/w/images/favicon.ico\",\"mHeader\":\"WikiLeaks (en)\",\"mBody\":\"WikiLeaks specializes in the publication of censored or otherwise restricted official materials involving war, and corruption\"},{\"mUrl\":\"http://p53lf57qovyuvwsc6xnrppyply3vtqm7l6pcobkmyqsiofyeznfu5uqd.onion/\",\"mIcon\":\"http://assets.p53lf57qovyuvwsc6xnrppyply3vtqm7l6pcobkmyqsiofyeznfu5uqd.onion/static/prod/v4/images/favicon-32x32.png\",\"mHeader\":\"Pro Publica\",\"mBody\":\"ProPublica is an independent, nonprofit newsroom that produces investigative journalism with moral force\"},{\"mUrl\":\"http://nzh3fv6jc6jskki3.onion/\",\"mIcon\":\"http://nzh3fv6jc6jskki3.onion/assets/images/favicon.png\",\"mHeader\":\"Rise UP | Communication Service\",\"mBody\":\"We are a project to create democratic alternatives and practiceself-determination by controlling our own secure means of communications\"},{\"mUrl\":\"http://answerszuvs3gg2l64e6hmnryudl5zgrmwm3vh65hzszdghblddvfiqd.onion/\",\"mIcon\":\"https://www.freeiconspng.com/uploads/questions-and-answers-icon-1.png\",\"mHeader\":\"Hidden Answer\",\"mBody\":\"Once you access the site, you’ll soon notice that the questions on Hidden Answers touch upon a variety of topics\"},{\"mUrl\":\"http://zerobinqmdqd236y.onion/\",\"mIcon\":\"https://icon-library.net//images/zero-icon/zero-icon-15.jpg\",\"mHeader\":\"Zero Bin\",\"mBody\":\"ZeroBin.net is a minimalist, open source online pastebin where the server has zero knowledge of pasted data\"},{\"mUrl\":\"http://kx5thpx2olielkihfyo4jgjqfb7zx7wxr3sd4xzt26ochei4m6f7tayd.onion/\",\"mIcon\":\"http://kx5thpx2olielkihfyo4jgjqfb7zx7wxr3sd4xzt26ochei4m6f7tayd.onion/img/favicon.ico\",\"mHeader\":\"Imperial Library\",\"mBody\":\"The Imperial Library of Trantor (also known as Galactic Library) is a repository of DRM-free ebooks on ePub format\"},{\"mUrl\":\"http://zqktlwiuavvvqqt4ybvgvi7tyo4hjl5xgfuvpdf6otjiycgwqbym2qad.onion/wiki/index.php/Main_Page\",\"mIcon\":\"http://zqktlwiuavvvqqt4ybvgvi7tyo4hjl5xgfuvpdf6otjiycgwqbym2qad.onion/wiki/resources/favicon.ico\",\"mHeader\":\"Hidden Wiki\",\"mBody\":\"One of the largest repository of categorized hidden web URL's\"},{\"mUrl\":\"https://www.facebookcorewwwi.onion/\",\"mIcon\":\"https://cdn1.iconfinder.com/data/icons/logotypes/32/square-facebook-512.png\",\"mHeader\":\"Facebook\",\"mBody\":\"Connect with friends and the world around you on Facebook\"},{\"mUrl\":\"https://www.bbcnewsv2vjtpsuy.onion/\",\"mIcon\":\"https://gn-web-assets.api.bbc.com/wwhp/20210105-1702-7302953dc6fd22d3eb4efd4d73bfd2a8d91bb7df/responsive/img/apple-touch/apple-touch-180.jpg\",\"mHeader\":\"BBC News\",\"mBody\":\"We’re impartial and independent, and every day we create distinctive, world class programmes and content which inform millions of people around the world\"},{\"mUrl\":\"http://archivecaslytosk.onion/\",\"mIcon\":\"https://archive.is/apple-touch-icon-144x144.png\",\"mHeader\":\"Archieve Today\",\"mBody\":\"It takes a 'snapshot' of a webpage that will always be online even if the original page disappears. It saves a text and a graphical copy of the legacy page\"},{\"mUrl\":\"http://wasabiukrxmkdgve5kynjztuovbg43uxcbcxn6y2okcrsg7gb6jdmbad.onion/\",\"mIcon\":\"http://wasabiukrxmkdgve5kynjztuovbg43uxcbcxn6y2okcrsg7gb6jdmbad.onion/images/favicon.ico\",\"mHeader\":\"Wasabi Wallet\",\"mBody\":\"Wasabi is an open-source, non-custodial, privacy-focused Bitcoin wallet for Desktop, that implements trustless CoinJoin\"},{\"mUrl\":\"http://ow24et3tetp6tvmk.onion/\",\"mIcon\":\"http://ow24et3tetp6tvmk.onion/favicon.ico\",\"mHeader\":\"Onion Wallet\",\"mBody\":\"When using Bitcoin together with Tor you are combining the best online money with the best encryption and privacy technology available\"},{\"mUrl\":\"http://piratebayztemzmv.onion/\",\"mIcon\":\"http://piratebayztemzmv.onion/images/tpb.jpg\",\"mHeader\":\"The Pirate Bay\",\"mBody\":\"The Pirate Bay allows users to search for Magnet links. These are used to reference resources available for download via peer-to-peer networks\"}]";
/*Message Manager*/
public static final String MESSAGE_PLAYSTORE_NOT_FOUND = "Playstore Not Found";
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
android:controlX1="0"
android:controlY1="0"
android:controlX2="0.2"
android:controlY2="1"/>

View File

@ -1,4 +1,5 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -6,16 +7,15 @@
android:theme="@style/ThemeOverlay.GenesisAndroid.AppWidgetContainer"> android:theme="@style/ThemeOverlay.GenesisAndroid.AppWidgetContainer">
<LinearLayout <LinearLayout
android:id="@+id/pTopBarContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_marginTop="20dp"
android:minWidth="187dp"
android:clickable="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_height="49dp" android:layout_height="49dp"
android:layout_marginTop="20dp"
android:animateLayoutChanges="true" android:animateLayoutChanges="true"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="true"
android:gravity="start" android:gravity="start"
android:minWidth="187dp"
android:orientation="horizontal" android:orientation="horizontal"
tools:ignore="UselessParent"> tools:ignore="UselessParent">
@ -26,45 +26,38 @@
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginStart="2.5dp" android:layout_marginStart="2.5dp"
android:background="@color/clear_alpha" android:background="@color/clear_alpha"
android:clickable="false"
android:contentDescription="@string/GENERAL_TODO" android:contentDescription="@string/GENERAL_TODO"
android:focusable="false"
android:padding="6dp" android:padding="6dp"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/genesis" android:src="@drawable/genesis"
android:translationZ="1dp"/> android:translationZ="1dp" />
<TextView <LinearLayout
android:id="@+id/pSearchInputWidget"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginStart="-53dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:paddingTop="13dp" android:layout_marginStart="-53dp"
android:layout_marginEnd="1dp" android:layout_marginEnd="1dp"
android:animateLayoutChanges="true" android:orientation="horizontal"
android:background="@xml/gx_generic_input_white" android:background="@xml/gx_generic_input_white">
android:fontFamily="sans-serif"
android:completionHintView="@layout/hint_view"
android:dropDownAnchor="@id/pSearchEngineBar"
android:ems="10"
android:fadingEdgeLength="20dp"
android:focusableInTouchMode="true"
android:text="@string/GENERAL_HIDDEN_WEB"
android:importantForAutofill="no"
android:inputType="textNoSuggestions"
android:maxLines="1"
android:paddingStart="60dp"
android:paddingEnd="15dp"
android:popupElevation="0dp"
android:privateImeOptions="nm"
android:requiresFadingEdge="horizontal"
android:selectAllOnFocus="true"
android:textColor="#737373"
android:textColorHighlight="@color/text_color_highlight_v3"
android:textCursorDrawable="@xml/gx_search_cursor_state"
android:textIsSelectable="false"
android:textSize="15sp">
</TextView> <TextView
android:id="@+id/pSearchInputWidget"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="@xml/gx_generic_input_white"
android:paddingStart="60dp"
android:paddingTop="13dp"
android:paddingEnd="15dp"
android:maxLines="1"
android:ellipsize="end"
android:text="@string/GENERAL_HIDDEN_WEB"
android:textColor="#737373"
android:textSize="15sp"/>
</LinearLayout>
<ImageButton <ImageButton
android:id="@+id/pVoiceInput" android:id="@+id/pVoiceInput"
@ -75,7 +68,9 @@
android:layout_marginTop="-1dp" android:layout_marginTop="-1dp"
android:layout_marginEnd="-5dp" android:layout_marginEnd="-5dp"
android:background="@color/white" android:background="@color/white"
android:clickable="false"
android:contentDescription="@string/GENERAL_TODO" android:contentDescription="@string/GENERAL_TODO"
android:focusable="false"
android:paddingStart="10dp" android:paddingStart="10dp"
android:paddingEnd="10dp" android:paddingEnd="10dp"
android:scaleX="1.1" android:scaleX="1.1"
@ -85,4 +80,37 @@
android:visibility="visible" /> android:visibility="visible" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="49dp"
android:layout_marginTop="20dp"
android:animateLayoutChanges="true"
android:focusableInTouchMode="true"
android:gravity="start"
android:minWidth="187dp"
android:orientation="horizontal"
tools:ignore="UselessParent">
<ImageView
android:id="@+id/pTextInvoker"
android:layout_width="0dp"
android:layout_weight="1"
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:layout_height="49dp"
android:contentDescription="@string/GENERAL_TODO" />
<ImageView
android:id="@+id/pVoiceInvoker"
android:layout_width="55dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:layout_height="49dp"
android:contentDescription="@string/GENERAL_TODO" />
</LinearLayout>
</RelativeLayout> </RelativeLayout>

View File

@ -65,6 +65,8 @@ import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.PrintStream; import java.io.PrintStream;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.Reader;
import java.io.StringReader;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -86,6 +88,7 @@ import androidx.core.app.NotificationCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static org.torproject.android.service.wrapper.orbotLocalConstants.mBridgesDefault;
public class OrbotService extends VpnService implements TorServiceConstants, OrbotConstants { public class OrbotService extends VpnService implements TorServiceConstants, OrbotConstants {
@ -807,7 +810,7 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
startTorService(); startTorService();
/* if (Prefs.hostOnionServicesEnabled()) { if (Prefs.hostOnionServicesEnabled()) {
try { try {
updateLegacyV2OnionNames(); updateLegacyV2OnionNames();
} catch (SecurityException se) { } catch (SecurityException se) {
@ -818,7 +821,7 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
} catch (SecurityException se) { } catch (SecurityException se) {
logNotice("unable to upload v3 onion names"); logNotice("unable to upload v3 onion names");
} }
} */ }
} catch (Exception e) { } catch (Exception e) {
Log.i("sad","asd"); Log.i("sad","asd");
logException("Unable to start Tor: " + e.toString(), e); logException("Unable to start Tor: " + e.toString(), e);
@ -924,7 +927,7 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
torService = ((TorService.LocalBinder) iBinder).getService(); torService = ((TorService.LocalBinder) iBinder).getService();
try { try {
conn = torService.getTorControlConnection(); conn = torService.getTorControlConnection();
while (conn == null || !orbotLocalConstants.mIsTorInitialized) { while (conn == null) {
Log.v(TAG, "Waiting for Tor Control Connection..."); Log.v(TAG, "Waiting for Tor Control Connection...");
Thread.sleep(500); Thread.sleep(500);
conn = torService.getTorControlConnection(); conn = torService.getTorControlConnection();
@ -1656,9 +1659,12 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
try { try {
BufferedReader in = BufferedReader in = new BufferedReader(new InputStreamReader(getResources().openRawResource(R.raw.bridges), "UTF-8"));
new BufferedReader(new InputStreamReader(getResources().openRawResource(R.raw.bridges), "UTF-8"));
if(mBridgesDefault.length()>1){
Reader inputString = new StringReader(mBridgesDefault);
in = new BufferedReader(inputString);
}
String str; String str;
while ((str = in.readLine()) != null) { while ((str = in.readLine()) != null) {
@ -1691,7 +1697,7 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
Collections.shuffle(alBridges, bridgeSelectRandom); Collections.shuffle(alBridges, bridgeSelectRandom);
int maxBridges = 2; int maxBridges = 12;
int bridgeCount = 0; int bridgeCount = 0;
@ -1788,8 +1794,8 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
if (!TextUtils.isEmpty(action)) { if (!TextUtils.isEmpty(action)) {
if (action.equals(ACTION_START) || action.equals(ACTION_START_ON_BOOT)) { if (action.equals(ACTION_START) || action.equals(ACTION_START_ON_BOOT)) {
//if (useIPtObfsMeekProxy()) if (useIPtObfsMeekProxy())
// IPtProxy.startObfs4Proxy("DEBUG", true, false); IPtProxy.startObfs4Proxy("DEBUG", true, false);
if (useIPtSnowflakeProxy()) if (useIPtSnowflakeProxy())
startSnowflakeClient(); startSnowflakeClient();

View File

@ -43,6 +43,10 @@ public class Prefs {
return prefs.getBoolean(PREF_BRIDGES_ENABLED, bridgesEnabledDefault); return prefs.getBoolean(PREF_BRIDGES_ENABLED, bridgesEnabledDefault);
} }
public static boolean hostOnionServicesEnabled(){
return false;
}
public static void putBridgesEnabled(boolean value) { public static void putBridgesEnabled(boolean value) {
putBoolean(PREF_BRIDGES_ENABLED, value); putBoolean(PREF_BRIDGES_ENABLED, value);
} }