Bug Fixes

Bug Fixes
master
msmannan00 2021-05-19 22:46:36 +05:00
parent 2d40f80bc1
commit 30a8bd0fcc
158 changed files with 2714 additions and 3174 deletions

View File

@ -6,6 +6,10 @@
<inspection_tool class="BooleanMethodIsAlwaysInverted" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="BooleanMethodIsAlwaysInverted" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="BusyWait" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="BusyWait" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CollectionAddAllCanBeReplacedWithConstructor" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="CollectionAddAllCanBeReplacedWithConstructor" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ConstantConditions" enabled="false" level="WARNING" enabled_by_default="false">
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" />
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" />
</inspection_tool>
<inspection_tool class="Deprecation" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="Deprecation" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="DifferentKotlinGradleVersion" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="DifferentKotlinGradleVersion" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="EmptyStatementBody" enabled="false" level="WARNING" enabled_by_default="false"> <inspection_tool class="EmptyStatementBody" enabled="false" level="WARNING" enabled_by_default="false">
@ -21,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="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" />
<inspection_tool class="SameParameterValue" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="SameParameterValue" enabled="false" level="WARNING" enabled_by_default="false" />

View File

@ -10,7 +10,7 @@
"client_info": { "client_info": {
"mobilesdk_app_id": "1:1026582312920:android:056aacc3b6f0c3b3f164ad", "mobilesdk_app_id": "1:1026582312920:android:056aacc3b6f0c3b3f164ad",
"android_client_info": { "android_client_info": {
"package_name": "com.darkweb.genesissearchengine.dev" "package_name": "com.darkweb.genesissearchengine.production"
} }
}, },
"oauth_client": [ "oauth_client": [

View File

@ -45,7 +45,7 @@
android:name="com.darkweb.genesissearchengine.appManager.proxyStatusManager.proxyStatusController" android:name="com.darkweb.genesissearchengine.appManager.proxyStatusManager.proxyStatusController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" /> android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" />
<activity <activity
android:name="com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingHomeController" android:name="com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager.settingHomeController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:label="@string/SETTING_HEADER" android:label="@string/SETTING_HEADER"
android:launchMode="singleTop" android:launchMode="singleTop"
@ -145,10 +145,10 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="com.darkweb.genesissearchengine.appManager.externalNavigationManager.externalShortcuts" <activity android:name="com.darkweb.genesissearchengine.appManager.externalCommandManager.externalShortcutController"
android:launchMode="singleTop"/> android:launchMode="singleTop"/>
<activity android:name="com.darkweb.genesissearchengine.appManager.externalNavigationManager.externalNavigationController" <activity android:name="com.darkweb.genesissearchengine.appManager.externalCommandManager.externalURLNavigationContoller"
android:launchMode="singleTask" android:launchMode="singleTask"
> >
<intent-filter> <intent-filter>
@ -194,27 +194,27 @@
android:value="be76c64dae2519d4ab8daaed88298da14c7c294f" /> android:value="be76c64dae2519d4ab8daaed88298da14c7c294f" />
<!-- Live Build --> <!-- Live Build -->
<!-- <meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-9340927969469822~8113004486" /> -->
<!-- Development Build -->
<!-- --> <meta-data <!-- --> <meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID" android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-6985886044951738~4177628900" /> android:value="ca-app-pub-9340927969469822~8113004486" />
<!-- Development Build -->
<!-- <meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-6985886044951738~4177628900" /> -->
<service <service
android:name="com.darkweb.genesissearchengine.helperManager.downloadFileService" android:name="com.darkweb.genesissearchengine.pluginManager.downloadPluginManager.downloadService"
android:enabled="true" android:enabled="true"
android:exported="false" android:exported="false"
android:stopWithTask="true" /> android:stopWithTask="true" />
<service <service
android:name="com.darkweb.genesissearchengine.helperManager.clearAllRecentServices" android:name="com.darkweb.genesissearchengine.appManager.activityStateManager"
android:stopWithTask="true" /> android:stopWithTask="true" />
<receiver android:name="com.darkweb.genesissearchengine.helperManager.userEngagementNotification" /> <receiver android:name="com.darkweb.genesissearchengine.pluginManager.notificationPluginManager.localEngagementManager" />
<receiver <receiver
android:name="com.darkweb.genesissearchengine.helperManager.downloadNotification" android:name="com.darkweb.genesissearchengine.pluginManager.pluginReciever.downloadNotificationReciever"
android:exported="false"> android:exported="false">
<intent-filter> <intent-filter>
<action android:name="Download_Cancelled" /> <action android:name="Download_Cancelled" />
@ -224,7 +224,7 @@
<!-- Permissions File Provider Live <!-- Permissions File Provider Live
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="com.darkweb.genesissearchengine.provider.dev" android:authorities="com.darkweb.genesissearchengine.production.provider"
android:exported="false" android:exported="false"
android:grantUriPermissions="true"> android:grantUriPermissions="true">
<meta-data <meta-data
@ -233,15 +233,15 @@
</provider> </provider>
<provider <provider
android:authorities="com.darkweb.genesissearchengine.dev.provider" android:authorities="com.darkweb.genesissearchengine.production.provider"
android:name="com.darkweb.genesissearchengine.clientauth.ClientAuthContentProvider" android:name="com.darkweb.genesissearchengine.libs.clientauth.ClientAuthContentProvider"
android:exported="false"/> android:exported="false"/>
--> -->
<!-- Permissions File Provider Dev --> <!-- Permissions File Provider Dev -->
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="com.darkweb.genesissearchengine.provider.dev" android:authorities="com.darkweb.genesissearchengine.production.provider"
android:exported="false" android:exported="false"
android:grantUriPermissions="true"> android:grantUriPermissions="true">
<meta-data <meta-data
@ -250,8 +250,8 @@
</provider> </provider>
<provider <provider
android:authorities="com.darkweb.genesissearchengine.provider.dev" android:authorities="com.darkweb.genesissearchengine.production.provider"
android:name="com.darkweb.genesissearchengine.clientauth.ClientAuthContentProvider" android:name="com.darkweb.genesissearchengine.libs.clientauth.ClientAuthContentProvider"
android:exported="false"/> android:exported="false"/>
<provider <provider

View File

@ -9,9 +9,8 @@ import com.darkweb.genesissearchengine.appManager.historyManager.historyControll
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController; import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController;
import com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralController; import com.darkweb.genesissearchengine.appManager.settingManager.generalManager.settingGeneralController;
import com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingHomeController; import com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager.settingHomeController;
import com.darkweb.genesissearchengine.appManager.tabManager.tabController; import com.darkweb.genesissearchengine.appManager.tabManager.tabController;
import com.darkweb.genesissearchengine.helperManager.theme;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
@ -174,7 +173,7 @@ public class activityContextManager
for(int mCounter=0;mCounter<mStackList.size();mCounter++){ for(int mCounter=0;mCounter<mStackList.size();mCounter++){
try{ try{
if(!mStackList.get(mCounter).get().isFinishing()){ if(!mStackList.get(mCounter).get().isFinishing()){
theme.getInstance().onConfigurationChanged(mStackList.get(mCounter).get()); activityThemeManager.getInstance().onConfigurationChanged(mStackList.get(mCounter).get());
} }
}catch (Exception ignored){} }catch (Exception ignored){}
} }

View File

@ -1,11 +1,11 @@
package com.darkweb.genesissearchengine.helperManager; package com.darkweb.genesissearchengine.appManager;
import android.app.Service; import android.app.Service;
import android.content.Intent; import android.content.Intent;
import android.os.IBinder; import android.os.IBinder;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
public class clearAllRecentServices extends Service { public class activityStateManager extends Service {
@Override @Override
public IBinder onBind(Intent intent) { public IBinder onBind(Intent intent) {

View File

@ -1,5 +1,4 @@
package com.darkweb.genesissearchengine.helperManager; package com.darkweb.genesissearchengine.appManager;
import android.content.Context; import android.content.Context;
import android.content.res.Configuration; import android.content.res.Configuration;
@ -9,23 +8,41 @@ import androidx.appcompat.app.AppCompatDelegate;
import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
public class theme { public class activityThemeManager {
private boolean mLocalThemeChanged; private static activityThemeManager ourInstance = new activityThemeManager();
private static theme ourInstance = new theme();
int mode = -1; int mode = -1;
public static theme getInstance() public static activityThemeManager getInstance()
{ {
return ourInstance; return ourInstance;
} }
public void onConfigurationChanged(AppCompatActivity pContext){ public void onConfigurationChanged(AppCompatActivity pContext){
boolean sDefaultNightMode = (pContext.getApplicationContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES; boolean sDefaultNightMode = (pContext.getApplicationContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
// if(status.sDefaultNightMode != sDefaultNightMode){
setupThemeLocal(pContext, sDefaultNightMode); setupThemeLocal(pContext, sDefaultNightMode);
pContext.recreate(); pContext.recreate();
// } }
public boolean onInitTheme(AppCompatActivity pContext){
boolean mIsNightMode = (pContext.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
if(status.sTheme == enums.Theme.THEME_DEFAULT){
if(!status.sDefaultNightMode && mIsNightMode){
return true;
}else if(status.sDefaultNightMode && !mIsNightMode){
return true;
}
}
else{
if(status.sTheme != enums.Theme.THEME_DARK && mIsNightMode){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
return true;
}else if(status.sTheme == enums.Theme.THEME_DARK && !mIsNightMode){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
return true;
}
}
return false;
} }
public void setupThemeLocal(Context context, boolean sDefaultNightMode) { public void setupThemeLocal(Context context, boolean sDefaultNightMode) {
@ -36,26 +53,22 @@ public class theme {
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES; mode = Configuration.UI_MODE_NIGHT_YES;
mLocalThemeChanged = true;
} }
}else if(status.sTheme == enums.Theme.THEME_LIGHT){ }else if(status.sTheme == enums.Theme.THEME_LIGHT){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO; mode = Configuration.UI_MODE_NIGHT_NO;
mLocalThemeChanged = true;
} }
}else { }else {
if(!sDefaultNightMode){ if(!sDefaultNightMode){
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){ if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_NO){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
mode = Configuration.UI_MODE_NIGHT_NO; mode = Configuration.UI_MODE_NIGHT_NO;
mLocalThemeChanged = true;
} }
}else { }else {
if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){ if(AppCompatDelegate.getDefaultNightMode() != AppCompatDelegate.MODE_NIGHT_YES){
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
mode = Configuration.UI_MODE_NIGHT_YES; mode = Configuration.UI_MODE_NIGHT_YES;
mLocalThemeChanged = true;
} }
} }
} }
@ -101,7 +114,6 @@ public class theme {
public Context initTheme(Context pContext){ public Context initTheme(Context pContext){
boolean sDefaultNightMode = (pContext.getApplicationContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES; boolean sDefaultNightMode = (pContext.getApplicationContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
boolean sDefaultNightModeCurrent = (pContext.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
if(status.sSettingIsAppStarted){ if(status.sSettingIsAppStarted){
status.mThemeApplying = true; status.mThemeApplying = true;
@ -110,7 +122,6 @@ public class theme {
status.sDefaultNightMode = sDefaultNightMode; status.sDefaultNightMode = sDefaultNightMode;
pContext = setupTheme(pContext); pContext = setupTheme(pContext);
mLocalThemeChanged = false;
mode = -1; mode = -1;
return pContext; return pContext;

View File

@ -15,6 +15,7 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R; import com.example.myapplication.R;

View File

@ -23,19 +23,18 @@ import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.databaseManager.databaseController; import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.editTextManager; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.editTextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.sql;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -45,6 +44,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import static com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkEnums.eBookmarkViewCommands.M_VERTIFY_SELECTION_MENU; import static com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkEnums.eBookmarkViewCommands.M_VERTIFY_SELECTION_MENU;
import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_BOOKMARK;
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_CLEAR_BOOKMARK; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_CLEAR_BOOKMARK;
@ -89,7 +89,7 @@ public class bookmarkController extends AppCompatActivity
if(newConfig.uiMode != getResources().getConfiguration().uiMode){ if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme(); activityContextManager.getInstance().onResetTheme();
theme.getInstance().onConfigurationChanged(this); activityThemeManager.getInstance().onConfigurationChanged(this);
} }
} }
@ -319,7 +319,7 @@ public class bookmarkController extends AppCompatActivity
mbookmarkModel.clearList(); mbookmarkModel.clearList();
((bookmarkAdapter) Objects.requireNonNull(mRecycleView.getAdapter())).invokeFilter(true ); ((bookmarkAdapter) Objects.requireNonNull(mRecycleView.getAdapter())).invokeFilter(true );
mbookmarkViewController.onTrigger(bookmarkEnums.eBookmarkViewCommands.M_CLEAR_LIST, null); mbookmarkViewController.onTrigger(bookmarkEnums.eBookmarkViewCommands.M_CLEAR_LIST, null);
databaseController.getInstance().execSQL(sql.SQL_CLEAR_BOOKMARK,null); dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_BOOKMARK,null));
mRecycleView.setAlpha(0); mRecycleView.setAlpha(0);
} }
@ -365,7 +365,7 @@ public class bookmarkController extends AppCompatActivity
mbookmarkViewController.onTrigger(bookmarkEnums.eBookmarkViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(mbookmarkModel.getList().size(),300)); mbookmarkViewController.onTrigger(bookmarkEnums.eBookmarkViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(mbookmarkModel.getList().size(),300));
} }
else if(e_type.equals(enums.etype.remove_from_database)){ else if(e_type.equals(enums.etype.remove_from_database)){
databaseController.getInstance().deleteFromList((int)data.get(0),strings.HISTORY_TITLE); dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_DELETE_FROM_HISTORY, Arrays.asList(data.get(0),strings.HISTORY_TITLE));
} }
else if(e_type.equals(enums.etype.on_verify_selected_url_menu)){ else if(e_type.equals(enums.etype.on_verify_selected_url_menu)){
mbookmarkViewController.onTrigger(M_VERTIFY_SELECTION_MENU, data); mbookmarkViewController.onTrigger(M_VERTIFY_SELECTION_MENU, data);

View File

@ -1,5 +1,7 @@
package com.darkweb.genesissearchengine.appManager.bookmarkManager; package com.darkweb.genesissearchengine.appManager.bookmarkManager;
import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel;
import java.util.ArrayList; import java.util.ArrayList;
class bookmarkModel class bookmarkModel

View File

@ -21,7 +21,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -64,7 +64,7 @@ public class bridgeController extends AppCompatActivity {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){ if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme(); activityContextManager.getInstance().onResetTheme();
theme.getInstance().onConfigurationChanged(this); activityThemeManager.getInstance().onConfigurationChanged(this);
} }
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);

View File

@ -0,0 +1,66 @@
package com.darkweb.genesissearchengine.appManager.externalCommandManager;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import org.torproject.android.service.wrapper.orbotLocalConstants;
public class externalShortcutController extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
status.sSettingIsAppStarted = false;
orbotLocalConstants.mIsTorInitialized = false;
boolean mConnect = false;
if (getIntent() != null && getIntent().getStringExtra("shortcut") != null) {
String bundleString = getIntent().getStringExtra("shortcut");
switch (bundleString) {
case "erase":
setContentView(R.layout.popup_data_cleared_shortcut);
panicExitInvoked();
new Handler().postDelayed(this::finish, 3000);
return;
case "erase_and_open":
panicExitInvoked();
mConnect = true;
break;
case "Restart":
break;
}
}
setContentView(R.layout.empty_view);
if(mConnect){
new Handler().postDelayed(() -> activityContextManager.getInstance().getHomeController().onStartApplication(null), 3000);
}
helperMethod.onDelayHandler(activityContextManager.getInstance().getHomeController(), 800, () -> {
/* Start Required Activity */
Intent intent = new Intent(this.getIntent());
intent.setClassName(this.getApplicationContext(), homeController.class.getName());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
this.startActivity(intent);
overridePendingTransition(R.anim.fade_in_lang, R.anim.fade_out_lang);
return null;
});
}
public void panicExitInvoked() {
dataController.getInstance().clearData(this);
}
}

View File

@ -1,4 +1,4 @@
package com.darkweb.genesissearchengine.appManager.externalNavigationManager; package com.darkweb.genesissearchengine.appManager.externalCommandManager;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
@ -8,14 +8,16 @@ import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME; import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME;
public class externalNavigationController extends AppCompatActivity { public class externalURLNavigationContoller extends AppCompatActivity {
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Uri data = externalNavigationController.this.getIntent().getData(); Uri data = externalURLNavigationContoller.this.getIntent().getData();
if(data == null || status.sSettingIsAppStarted){ if(data == null || status.sSettingIsAppStarted){
/* Close Activity */ /* Close Activity */
@ -26,7 +28,7 @@ public class externalNavigationController extends AppCompatActivity {
/* Create Request Handler */ /* Create Request Handler */
if(status.sSettingIsAppStarted && data!=null){ if(status.sSettingIsAppStarted && data!=null){
helperMethod.onDelayHandler(this, 3000, () -> { helperMethod.onDelayHandler(this, 250, () -> {
activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(activityContextManager.getInstance().getHomeController().completeURL(data.toString())); activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(activityContextManager.getInstance().getHomeController().completeURL(data.toString()));
activityContextManager.getInstance().getHomeController().onClearSelectionTab(); activityContextManager.getInstance().getHomeController().onClearSelectionTab();
return null; return null;
@ -36,6 +38,7 @@ public class externalNavigationController extends AppCompatActivity {
Intent bringToForegroundIntent = new Intent(activityContextManager.getInstance().getHomeController(), homeController.class); Intent bringToForegroundIntent = new Intent(activityContextManager.getInstance().getHomeController(), homeController.class);
bringToForegroundIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK); bringToForegroundIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(bringToForegroundIntent); startActivity(bringToForegroundIntent);
overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant);
} }
else if(status.sSettingIsAppRunning){ else if(status.sSettingIsAppRunning){
@ -58,13 +61,11 @@ public class externalNavigationController extends AppCompatActivity {
status.sExternalWebsite = data.toString(); status.sExternalWebsite = data.toString();
} }
this.startActivity(intent);
this.overridePendingTransition(0, 0);
/* Bring Application To Front */ /* Bring Application To Front */
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME); Intent launchIntent = getPackageManager().getLaunchIntentForPackage(CONST_PACKAGE_NAME);
startActivity(launchIntent); startActivity(launchIntent);
overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant);
/* Close Activity */ /* Close Activity */

View File

@ -1,132 +0,0 @@
package com.darkweb.genesissearchengine.appManager.externalNavigationManager;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.sql;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.databaseManager.databaseController;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import org.mozilla.geckoview.ContentBlocking;
import org.torproject.android.service.wrapper.orbotLocalConstants;
import java.util.Arrays;
import static com.darkweb.genesissearchengine.constants.constants.CONST_PACKAGE_NAME;
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
public class externalShortcuts extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
status.sSettingIsAppStarted = false;
orbotLocalConstants.mIsTorInitialized = false;
boolean mConnect = false;
if (getIntent() != null && getIntent().getStringExtra("shortcut") != null) {
String bundleString = getIntent().getStringExtra("shortcut");
switch (bundleString) {
case "erase":
setContentView(R.layout.popup_data_cleared_shortcut);
panicExitInvoked();
new Handler().postDelayed(this::finish, 3000);
return;
case "erase_and_open":
panicExitInvoked();
mConnect = true;
break;
case "Restart":
break;
}
}
setContentView(R.layout.empty_view);
if(mConnect){
new Handler().postDelayed(() -> activityContextManager.getInstance().getHomeController().onStartApplication(null), 2000);
}
new Handler().postDelayed(() ->
{
/* Start Required Activity */
Intent intent = new Intent(this.getIntent());
intent.setClassName(this.getApplicationContext(), homeController.class.getName());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
this.startActivity(intent);
overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant);
}, 800);
}
@Override
protected void onNewIntent(Intent intent)
{
super.onNewIntent(intent);
Uri data = intent.getData();
if(data!=null){
activityContextManager.getInstance().getHomeController().onOpenLinkNewTab(data.toString());
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.darkweb.genesissearchengine");
startActivity(launchIntent);
overridePendingTransition(R.anim.fade_in_instant, R.anim.fade_out_instant);
}
}
public void panicExitInvoked() {
status.sSettingIsAppStarted = false;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.VPN_ENABLED,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_TRACKING_PROTECTION, ContentBlocking.AntiTracking.DEFAULT));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_DONOT_TRACK,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_FLOAT, Arrays.asList(keys.SETTING_FONT_SIZE,100));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE, strings.SETTING_DEFAULT_LANGUAGE));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE_REGION,strings.SETTING_DEFAULT_LANGUAGE_REGION));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, constants.CONST_BACKEND_GENESIS_URL));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS,1));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_CHARACTER_ENCODING,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,0));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TOOLBAR_THEME,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME, enums.Theme.THEME_DEFAULT));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_LIST_VIEW,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_TAB_GRID,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_POPUP,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4));
databaseController.getInstance().initialize(this);
databaseController.getInstance().execSQL(sql.SQL_CLEAR_HISTORY,null);
databaseController.getInstance().execSQL(sql.SQL_CLEAR_BOOKMARK,null);
databaseController.getInstance().execSQL(sql.SQL_CLEAR_TAB,null);
status.initStatus(activityContextManager.getInstance().getHomeController());
}
}

View File

@ -22,7 +22,7 @@ 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.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -63,9 +63,10 @@ public class helpController extends AppCompatActivity {
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){ if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme(); activityContextManager.getInstance().onResetTheme();
theme.getInstance().onConfigurationChanged(this); activityThemeManager.getInstance().onConfigurationChanged(this);
} }
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);

View File

@ -18,6 +18,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.models.historyRowModel;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R; import com.example.myapplication.R;

View File

@ -24,19 +24,18 @@ import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.databaseManager.databaseController; import com.darkweb.genesissearchengine.dataManager.models.historyRowModel;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.editTextManager; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.editTextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController; import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.sql;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -45,6 +44,7 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import static com.darkweb.genesissearchengine.appManager.historyManager.historyEnums.eHistoryViewCommands.M_VERTIFY_SELECTION_MENU; import static com.darkweb.genesissearchengine.appManager.historyManager.historyEnums.eHistoryViewCommands.M_VERTIFY_SELECTION_MENU;
import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_HISTORY;
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_CLEAR_HISTORY; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_CLEAR_HISTORY;
public class historyController extends AppCompatActivity public class historyController extends AppCompatActivity
@ -88,9 +88,10 @@ public class historyController extends AppCompatActivity
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){ if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme(); activityContextManager.getInstance().onResetTheme();
theme.getInstance().onConfigurationChanged(this); activityThemeManager.getInstance().onConfigurationChanged(this);
} }
} }
@ -360,7 +361,7 @@ public class historyController extends AppCompatActivity
mHistoryModel.clearList(); mHistoryModel.clearList();
mHistoryAdapter.invokeFilter(true ); mHistoryAdapter.invokeFilter(true );
mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_CLEAR_LIST, null); mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_CLEAR_LIST, null);
databaseController.getInstance().execSQL(sql.SQL_CLEAR_HISTORY,null); dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_HISTORY,null));
} }
private void onLoadMoreHistory(boolean pLoadingEnabled) { private void onLoadMoreHistory(boolean pLoadingEnabled) {
@ -431,7 +432,7 @@ public class historyController extends AppCompatActivity
mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(mHistoryModel.getList().size(),300)); mHistoryViewController.onTrigger(historyEnums.eHistoryViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(mHistoryModel.getList().size(),300));
} }
else if(e_type.equals(enums.etype.remove_from_database)){ else if(e_type.equals(enums.etype.remove_from_database)){
databaseController.getInstance().deleteFromList((int)data.get(0),strings.HISTORY_TITLE); dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_DELETE_FROM_HISTORY, Arrays.asList(data.get(0),strings.HISTORY_TITLE));
} }
else if(e_type.equals(enums.etype.on_verify_selected_url_menu)){ else if(e_type.equals(enums.etype.on_verify_selected_url_menu)){
mHistoryViewController.onTrigger(M_VERTIFY_SELECTION_MENU, data); mHistoryViewController.onTrigger(M_VERTIFY_SELECTION_MENU, data);

View File

@ -1,5 +1,7 @@
package com.darkweb.genesissearchengine.appManager.historyManager; package com.darkweb.genesissearchengine.appManager.historyManager;
import com.darkweb.genesissearchengine.dataManager.models.historyRowModel;
import java.util.ArrayList; import java.util.ArrayList;
class historyModel class historyModel

View File

@ -10,19 +10,16 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
public class pageErrorHandler public class errorHandler
{ {
private AppCompatActivity mContext; private AppCompatActivity mContext;
private String mErrorTemplate; private String mErrorTemplate;
public String loadErrorPage(final int category, final int error, AppCompatActivity mContext, String url, InputStream mResourceURL) { public String createErrorPage(final int category, final int error,AppCompatActivity mContext,String url, InputStream mResourceURL) {
this.mContext = mContext; this.mContext = mContext;
if (mErrorTemplate == null) {
try { StringBuilder builder = new StringBuilder();
if (mErrorTemplate == null) { try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
StringBuilder builder = new StringBuilder();
InputStream stream = mResourceURL;
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
String line; String line;
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
@ -31,46 +28,23 @@ public class pageErrorHandler
} }
mErrorTemplate = builder.toString(); mErrorTemplate = builder.toString();
} catch (IOException e) {
return null;
} }
String title = helperMethod.getHost(url); }
String title = helperMethod.getHost(url);
if(url==null){ if(url==null){
url = "Hidden Error"; url = "Hidden Error";
} }
if(title==null){ if(title==null){
title = "Hidden Error"; title = "Hidden Error";
}
String replaceUrl = errorToString(error).replace("$URL",url);
String errorPage = createErrorPage("CODE : " + categoryToString(category) + " <br>TYPE : " + replaceUrl.replace("$TITLE",title),url,mResourceURL);
errorPage = translateMessage(errorPage,"CODE : " + categoryToString(category));
return errorPage;
}catch (Exception ex){
return strings.GENERIC_EMPTY_STR;
} }
} String replaceUrl = errorToString(error).replace("$URL",url);
String errorPage = createErrorPage("CODE : " + categoryToString(category) + " <br>TYPE : " + replaceUrl.replace("$TITLE",title),url,mResourceURL);
private String createErrorPage(final String error, String url, InputStream mResourceURL) throws IOException { errorPage = translateMessage(errorPage,"CODE : " + categoryToString(category));
if(error==null){ return errorPage;
return strings.GENERIC_EMPTY_STR;
}
StringBuilder builder = new StringBuilder();
InputStream stream = mResourceURL;
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
builder.append("\n");
}
mErrorTemplate = builder.toString();
String replaceUrl = mErrorTemplate.replace("$URL",url);
return replaceUrl;
} }
private String translateMessage(String message,String error){ private String translateMessage(String message,String error){
@ -165,5 +139,29 @@ public class pageErrorHandler
return "UNKNOWN"; return "UNKNOWN";
} }
} }
private String createErrorPage(final String error,String url, InputStream mResourceURL) {
if(error==null){
return strings.GENERIC_EMPTY_STR;
}
if (mErrorTemplate == null) {
StringBuilder builder = new StringBuilder();
try (InputStream stream = mResourceURL; BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
String line;
while ((line = reader.readLine()) != null) {
builder.append(line);
builder.append("\n");
}
mErrorTemplate = builder.toString();
} catch (IOException e) {
return null;
}
}
String replaceUrl = mErrorTemplate.replace("$URL",url);
return replaceUrl;
}
} }

View File

@ -34,11 +34,11 @@ import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.internalFileDownloadManager;
import com.darkweb.genesissearchengine.helperManager.downloadFileService;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.trueTime; import com.darkweb.genesissearchengine.libs.trueTime.trueTime;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
import org.json.JSONObject; import org.json.JSONObject;
import org.mozilla.gecko.util.ThreadUtils; import org.mozilla.gecko.util.ThreadUtils;
@ -58,6 +58,7 @@ import java.lang.ref.WeakReference;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -201,7 +202,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
if(!url.equals("about:blank") && !url.equals("about:config")) if(!url.equals("about:blank") && !url.equals("about:config"))
{ {
mProgress = 5; mProgress = 5;
event.invokeObserver(Arrays.asList(5, mSessionID), enums.etype.progress_update); onProgressStart();
} }
m_current_url_id = -1; m_current_url_id = -1;
} }
@ -290,8 +291,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
isPageLoading = true; isPageLoading = true;
if(!var2.equals("about:blank") && !mCurrentTitle.equals("loading")){ if(!var2.equals("about:blank") && !mCurrentTitle.equals("loading")){
mProgress = 5; mProgress = 5;
event.invokeObserver(Arrays.asList(5, mSessionID), enums.etype.progress_update); mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(5,mSessionID), enums.etype.progress_update));
//mTheme = null;
mThemeChanged = false; mThemeChanged = false;
} }
} }
@ -327,15 +327,20 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
if(!mFullScreen){ if(!mFullScreen){
mProgress = progress; mProgress = progress;
if(progress==100){ if(progress<=20) {
if(!mIsProgressBarChanging){
mIsProgressBarChanging = true;
mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(mProgress,mSessionID), enums.etype.progress_update));
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme), enums.etype.M_UPDATE_PIXEL_BACKGROUND);
}
}else {
mIsProgressBarChanging = false; mIsProgressBarChanging = false;
mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(mProgress,mSessionID), enums.etype.progress_update)); mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(5,mSessionID), enums.etype.progress_update));
}else {
if(progress==100){
if(!mIsProgressBarChanging){
mIsProgressBarChanging = true;
mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(mProgress,mSessionID), enums.etype.progress_update));
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme), enums.etype.M_UPDATE_PIXEL_BACKGROUND);
}
}else {
mIsProgressBarChanging = false;
mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(mProgress,mSessionID), enums.etype.progress_update));
}
} }
} }
@ -344,6 +349,12 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
} }
} }
public void onProgressStart(){
if(!getCurrentURL().equals("about:blank") && !getCurrentURL().contains("genesishiddentechnologies.com") && !wasPreviousErrorPage() && !getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED) && !getCurrentURL().startsWith(CONST_GENESIS_URL_CACHED_DARK) && !getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE) && !getCurrentURL().startsWith(CONST_GENESIS_HELP_URL_CACHE_DARK)){
mContext.get().runOnUiThread(() -> event.invokeObserver(Arrays.asList(5,mSessionID), enums.etype.progress_update));
}
}
public void onRedrawPixel(){ public void onRedrawPixel(){
event.invokeObserver(Arrays.asList("",mSessionID,mCurrentTitle, m_current_url_id, mTheme, false), dataEnums.eTabCommands.M_UPDATE_PIXEL); event.invokeObserver(Arrays.asList("",mSessionID,mCurrentTitle, m_current_url_id, mTheme, false), dataEnums.eTabCommands.M_UPDATE_PIXEL);
} }
@ -491,9 +502,12 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
checkApplicationRate(); checkApplicationRate();
/* Its Absence causes delay on first launch*/ /* Its Absence causes delay on first launch*/
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme, this), enums.etype.ON_UPDATE_SEARCH_BAR);
if(!mCurrentURL.contains("genesishiddentechnologies.com")){ if(!mCurrentURL.contains("genesishiddentechnologies.com")){
mProgress = 5; mProgress = 5;
event.invokeObserver(Arrays.asList(5, mSessionID, mCurrentURL), enums.etype.progress_update_forced); onProgressStart();
} }
return GeckoResult.fromValue(AllowOrDeny.ALLOW); return GeckoResult.fromValue(AllowOrDeny.ALLOW);
@ -528,7 +542,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
public GeckoResult<String> onLoadError(@NonNull GeckoSession var1, @Nullable String var2, WebRequestError var3) { public GeckoResult<String> onLoadError(@NonNull GeckoSession var1, @Nullable String var2, WebRequestError var3) {
if(status.sSettingIsAppStarted){ if(status.sSettingIsAppStarted){
pageErrorHandler handler = new pageErrorHandler(); errorHandler handler = new errorHandler();
mProgress = 0; mProgress = 0;
mPreviousErrorPage = true; mPreviousErrorPage = true;
event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_load_error); event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_load_error);
@ -545,7 +559,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
} }
return GeckoResult.fromValue("data:text/html," + handler.loadErrorPage(var3.category, var3.code,mContext.get(),var2, mResourceURL)); return GeckoResult.fromValue("data:text/html," + handler.createErrorPage(var3.category, var3.code,mContext.get(),var2, mResourceURL));
} }
return null; return null;
} }
@ -718,7 +732,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
{ {
if(mDownloadManager.getDownloadURL()!=null && mDownloadManager.getDownloadFile()!=null){ if(mDownloadManager.getDownloadURL()!=null && mDownloadManager.getDownloadFile()!=null){
if(!createAndSaveFileFromBase64Url(mDownloadManager.getDownloadURL().toString())){ if(!createAndSaveFileFromBase64Url(mDownloadManager.getDownloadURL().toString())){
mContext.get().startService(downloadFileService.getDownloadService(mContext.get().getApplicationContext(), mDownloadManager.getDownloadURL()+"__"+mDownloadManager.getDownloadFile(), Environment.DIRECTORY_DOWNLOADS)); pluginController.getInstance().onDownloadInvoke(Arrays.asList(mDownloadManager.getDownloadURL()+"__"+mDownloadManager.getDownloadFile(), Environment.DIRECTORY_DOWNLOADS), pluginEnums.eDownloadManager.M_START_SERVICE);
} }
} }
} }
@ -727,7 +741,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
{ {
if(downloadURL!=null && downloadFile!=null){ if(downloadURL!=null && downloadFile!=null){
if(!createAndSaveFileFromBase64Url(downloadURL.toString())){ if(!createAndSaveFileFromBase64Url(downloadURL.toString())){
mContext.get().startService(downloadFileService.getDownloadService(mContext.get().getApplicationContext(), downloadURL + "__" + downloadFile, Environment.DIRECTORY_DOWNLOADS)); pluginController.getInstance().onDownloadInvoke(Arrays.asList(downloadURL + "__" + downloadFile, Environment.DIRECTORY_DOWNLOADS), pluginEnums.eDownloadManager.M_START_SERVICE);
} }
} }
} }
@ -775,7 +789,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.MediaDele
String filename; String filename;
if(url.startsWith("blob")){ if(url.startsWith("blob")){
loadUri(internalFileDownloadManager.getBase64StringFromBlobUrl(url)); loadUri((String) pluginController.getInstance().onDownloadInvoke(Collections.singletonList(url), pluginEnums.eDownloadManager.M_DOWNLOAD_BLOB));
return true; return true;
} }

View File

@ -18,7 +18,7 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel; import com.darkweb.genesissearchengine.dataManager.models.historyRowModel;
import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums; import com.darkweb.genesissearchengine.appManager.tabManager.tabEnums;
import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;

View File

@ -1,9 +1,5 @@
package com.darkweb.genesissearchengine.appManager.homeManager.hintManager; package com.darkweb.genesissearchengine.appManager.homeManager.hintManager;
import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel;
import java.util.ArrayList;
public class hintModel public class hintModel
{ {
/*Private Variables*/ /*Private Variables*/

View File

@ -23,7 +23,6 @@ import android.speech.RecognizerIntent;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.util.Log; import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
@ -44,10 +43,8 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController; import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController;
import com.darkweb.genesissearchengine.constants.sql;
import com.darkweb.genesissearchengine.databaseManager.databaseController;
import com.darkweb.genesissearchengine.appManager.historyManager.historyController; import com.darkweb.genesissearchengine.appManager.historyManager.historyController;
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel; import com.darkweb.genesissearchengine.dataManager.models.historyRowModel;
import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.NestedGeckoView; import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.NestedGeckoView;
import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.*; import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.*;
import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession;
@ -57,8 +54,8 @@ import com.darkweb.genesissearchengine.appManager.languageManager.languageContro
import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController; import com.darkweb.genesissearchengine.appManager.orbotLogManager.orbotLogController;
import com.darkweb.genesissearchengine.appManager.orbotManager.orbotController; import com.darkweb.genesissearchengine.appManager.orbotManager.orbotController;
import com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager.settingSearchController; import com.darkweb.genesissearchengine.appManager.settingManager.searchEngineManager.settingSearchController;
import com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage.settingHomeController; import com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager.settingHomeController;
import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel; import com.darkweb.genesissearchengine.dataManager.models.tabRowModel;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.keys;
@ -66,16 +63,14 @@ import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.KeyboardUtils; import com.darkweb.genesissearchengine.libs.views.KeyboardUtils;
import com.darkweb.genesissearchengine.helperManager.clearAllRecentServices; import com.darkweb.genesissearchengine.appManager.activityStateManager;
import com.darkweb.genesissearchengine.helperManager.SimpleGestureFilter;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.helperManager.trueTime; import com.darkweb.genesissearchengine.libs.trueTime.trueTime;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.darkweb.genesissearchengine.widget.progressBar.AnimatedProgressBar;
import com.example.myapplication.R; import com.example.myapplication.R;
import com.google.android.gms.ads.AdView; import com.google.android.gms.ads.AdView;
import org.mozilla.geckoview.ContentBlocking; import org.mozilla.geckoview.ContentBlocking;
@ -105,6 +100,7 @@ import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE
import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_SINGLE; import static com.darkweb.genesissearchengine.constants.enums.etype.M_INITIALIZE_TAB_SINGLE;
import static com.darkweb.genesissearchengine.constants.enums.etype.M_NEW_LINK_IN_NEW_TAB; import static com.darkweb.genesissearchengine.constants.enums.etype.M_NEW_LINK_IN_NEW_TAB;
import static com.darkweb.genesissearchengine.constants.enums.etype.open_new_tab; import static com.darkweb.genesissearchengine.constants.enums.etype.open_new_tab;
import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_HISTORY;
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.*;
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION;
import static java.lang.Character.isLetter; import static java.lang.Character.isLetter;
@ -116,7 +112,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
private homeViewController mHomeViewController; private homeViewController mHomeViewController;
private homeModel mHomeModel; private homeModel mHomeModel;
private geckoClients mGeckoClient = null; private geckoClients mGeckoClient = null;
private GestureDetector mSwipeDirectionDetector;
/*View Webviews*/ /*View Webviews*/
private NestedGeckoView mGeckoView = null; private NestedGeckoView mGeckoView = null;
@ -124,7 +119,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
private ConstraintLayout mWebViewContainer; private ConstraintLayout mWebViewContainer;
/*View Objects*/ /*View Objects*/
private AnimatedProgressBar mProgressBar; private ProgressBar mProgressBar;
private ConstraintLayout mSplashScreen; private ConstraintLayout mSplashScreen;
private editTextManager mSearchbar; private editTextManager mSearchbar;
private ImageView mLoadingIcon; private ImageView mLoadingIcon;
@ -191,7 +186,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
pluginController.getInstance().preInitialize(this); pluginController.getInstance().preInitialize(this);
dataController.getInstance().initialize(this); dataController.getInstance().initialize(this);
status.initStatus(this); status.initStatus(this);
databaseController.getInstance().initialize(this); dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_INIT, Collections.singletonList(this));
trueTime.getInstance().initTime(); trueTime.getInstance().initTime();
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -462,16 +457,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false);
} }
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
if(inSignatureArea(event)){
try{
//mSwipeDirectionDetector.onTouchEvent(event);
}catch (Exception ignored){ }
}
return super.dispatchTouchEvent(event);
}
public boolean inSignatureArea(MotionEvent ev) { public boolean inSignatureArea(MotionEvent ev) {
float mEventY = ev.getY(); float mEventY = ev.getY();
return mEventY>mTopBar.getY()+mTopBar.getHeight() && mEventY<mConnectButton.getY(); return mEventY>mTopBar.getY()+mTopBar.getHeight() && mEventY<mConnectButton.getY();
@ -516,7 +501,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
Prefs.setContext(base); Prefs.setContext(base);
orbotLocalConstants.mHomeContext = new WeakReference<>(base); orbotLocalConstants.mHomeContext = new WeakReference<>(base);
Context mContext = theme.getInstance().initTheme(base); Context mContext = activityThemeManager.getInstance().initTheme(base);
activityContextManager.getInstance().setApplicationContext(mContext.getApplicationContext()); activityContextManager.getInstance().setApplicationContext(mContext.getApplicationContext());
super.attachBaseContext(LocaleHelper.onAttach(mContext, Prefs.getDefaultLocale())); super.attachBaseContext(LocaleHelper.onAttach(mContext, Prefs.getDefaultLocale()));
} }
@ -761,7 +746,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
private void initializeLocalEventHandlers() { private void initializeLocalEventHandlers() {
startService(new Intent(getBaseContext(), clearAllRecentServices.class)); startService(new Intent(getBaseContext(), activityStateManager.class));
registerReceiver(downloadStatus,new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); registerReceiver(downloadStatus,new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
@ -790,8 +775,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
if(mFindText.getText().length()==0 && mGeckoClient!=null){ if(mFindText.getText().length()==0 && mGeckoClient!=null){
mGeckoClient.getSession().getFinder().clear(); mGeckoClient.getSession().getFinder().clear();
mHomeViewController.onUpdateFindBarCount(0,0); mHomeViewController.onUpdateFindBarCount(0,0);
}else { }else if(mGeckoClient!=null){
assert mGeckoClient != null;
mGeckoClient.getSession().findInPage(mFindText.getText().toString(), GeckoSession.FINDER_FIND_MATCH_CASE & GeckoSession.FINDER_DISPLAY_HIGHLIGHT_ALL); mGeckoClient.getSession().findInPage(mFindText.getText().toString(), GeckoSession.FINDER_FIND_MATCH_CASE & GeckoSession.FINDER_DISPLAY_HIGHLIGHT_ALL);
} }
@ -950,22 +934,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba
} }
}); });
mSwipeDirectionDetector=new GestureDetector(this,new SimpleGestureFilter(){
@Override
public boolean onSwipe(Direction direction) {
if(mSplashScreen.getAlpha()>=1 && mSplashScreen.getVisibility()==View.VISIBLE){
if (direction==Direction.left){
helperMethod.openActivity(orbotLogController.class, constants.CONST_LIST_HISTORY, homeController.this, true);
}
else if (direction==Direction.right){
helperMethod.openActivity(orbotController.class, constants.CONST_LIST_HISTORY, homeController.this, true);
}
}
return true;
}
});
KeyboardUtils.addKeyboardToggleListener(this, isVisible -> isKeyboardOpened = isVisible); KeyboardUtils.addKeyboardToggleListener(this, isVisible -> isKeyboardOpened = isVisible);
mNestedScroll.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> { mNestedScroll.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
@ -1385,12 +1353,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mGeckoClient.onExitFullScreen(); mGeckoClient.onExitFullScreen();
mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false); mHomeViewController.onUpdateStatusBarTheme(mGeckoClient.getTheme(), false);
pluginController.getInstance().onMessageManagerInvoke(null, M_RESET); pluginController.getInstance().onMessageManagerInvoke(null, M_RESET);
pluginController.getInstance().onNotificationInvoke(Collections.singletonList(1296000000) , pluginEnums.eNotificationManager.M_CREATE_NOTIFICATION); pluginController.getInstance().onNotificationInvoke(Collections.singletonList(172800000) , pluginEnums.eNotificationManager.M_CREATE_NOTIFICATION);
mSearchBarWasBackButtonPressed = false; mSearchBarWasBackButtonPressed = false;
if(status.sSettingIsAppStarted){ if(status.sSettingIsAppStarted){
status.sUIInteracted = true; status.sUIInteracted = true;
} }
mHomeViewController.onUpdateFindBar(false); mHomeViewController.onUpdateFindBar(false);
mHomeViewController.onClearSelections(isKeyboardOpened);
mTopBarContainer.getLayoutTransition().setDuration(0);
} }
@Override @Override
@ -1885,7 +1855,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
databaseController.getInstance().execSQL(sql.SQL_CLEAR_HISTORY,null); dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_HISTORY,null));
dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null); dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null);
activityContextManager.getInstance().getHomeController().onClearCache(); activityContextManager.getInstance().getHomeController().onClearCache();
dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); dataController.getInstance().invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
@ -2009,11 +1979,13 @@ public class homeController extends AppCompatActivity implements ComponentCallba
final Handler handler = new Handler(); final Handler handler = new Handler();
Runnable runnable = () -> { Runnable runnable = () -> {
if(!status.sUIInteracted){ if(!status.sUIInteracted){
mHomeViewController.closeMenu(); if(mHomeViewController!=null){
mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, true); mHomeViewController.closeMenu();
mSearchbar.clearFocus(); mHomeViewController.onUpdateSearchBar(mGeckoClient.getSession().getCurrentURL(),false,true, true);
pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(strings.GENERIC_EMPTY_STR, homeController.this), M_WELCOME); mSearchbar.clearFocus();
status.sUIInteracted = true; pluginController.getInstance().onMessageManagerInvoke(Arrays.asList(strings.GENERIC_EMPTY_STR, homeController.this), M_WELCOME);
status.sUIInteracted = true;
}
} }
}; };
handler.postDelayed(runnable, 2500); handler.postDelayed(runnable, 2500);

View File

@ -40,6 +40,4 @@ class homeModel
return mURL; return mURL;
} }
} }
} }

View File

@ -41,10 +41,9 @@ import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.constants.*; import com.darkweb.genesissearchengine.constants.*;
import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.colorAnimationReciever; import com.darkweb.genesissearchengine.libs.views.ColorAnimator;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.widget.progressBar.AnimatedProgressBar;
import com.example.myapplication.R; import com.example.myapplication.R;
import com.google.android.gms.ads.AdView; import com.google.android.gms.ads.AdView;
import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.AppBarLayout;
@ -69,7 +68,7 @@ class homeViewController
/*ViewControllers*/ /*ViewControllers*/
private com.google.android.material.appbar.AppBarLayout mAppBar; private com.google.android.material.appbar.AppBarLayout mAppBar;
private ConstraintLayout mWebviewContainer; private ConstraintLayout mWebviewContainer;
private AnimatedProgressBar mProgressBar; private ProgressBar mProgressBar;
private editTextManager mSearchbar; private editTextManager mSearchbar;
private ConstraintLayout mSplashScreen; private ConstraintLayout mSplashScreen;
private TextView mLoadingText; private TextView mLoadingText;
@ -117,7 +116,7 @@ class homeViewController
private Runnable mTabDialogRunnable = null; private Runnable mTabDialogRunnable = null;
private boolean mIsTopBarExpanded = true; private boolean mIsTopBarExpanded = true;
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){ void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, ConstraintLayout webviewContainer, TextView loadingText, ProgressBar 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.mContext = context;
this.mProgressBar = progressBar; this.mProgressBar = progressBar;
this.mSearchbar = searchbar; this.mSearchbar = searchbar;
@ -211,6 +210,7 @@ class homeViewController
mGenesisLogo.setLayoutParams(newLayoutParams); mGenesisLogo.setLayoutParams(newLayoutParams);
} }
}); });
} }
@SuppressLint("WrongConstant") @SuppressLint("WrongConstant")
@ -409,7 +409,9 @@ class homeViewController
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
mVoiceInput.setVisibility(View.VISIBLE); if(status.sSettingIsAppStarted){
mVoiceInput.setVisibility(View.VISIBLE);
}
mVoiceInput.setClickable(true); mVoiceInput.setClickable(true);
mVoiceInput.setFocusable(true); mVoiceInput.setFocusable(true);
}, 0); }, 0);
@ -489,7 +491,7 @@ class homeViewController
public void initStatusBarColor(boolean mInstant) { public void initStatusBarColor(boolean mInstant) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
colorAnimationReciever oneToTwo = new colorAnimationReciever(ContextCompat.getColor(mContext, R.color.landing_ease_blue), ContextCompat.getColor(mContext, R.color.green_dark_v2)); ColorAnimator oneToTwo = new ColorAnimator(ContextCompat.getColor(mContext, R.color.landing_ease_blue), ContextCompat.getColor(mContext, R.color.green_dark_v2));
int mDelay = 1350; int mDelay = 1350;
if(status.mThemeApplying || mInstant){ if(status.mThemeApplying || mInstant){
@ -931,19 +933,16 @@ class homeViewController
if(!mSearchbar.hasFocus() || pClearText || pBypassFocus){ if(!mSearchbar.hasFocus() || pClearText || pBypassFocus){
if(mSearchEngineBar.getVisibility() == View.GONE || pBypassFocus){ if(mSearchEngineBar.getVisibility() == View.GONE || pBypassFocus){
int delay = 0; int delay = 0;
handlerLocalUrl = url; handlerLocalUrl = url;
if(searchBarUpdateHandler.hasMessages(100)){ if(searchBarUpdateHandler.hasMessages(100)){
return; searchBarUpdateHandler.removeMessages(100);
} }
searchBarUpdateHandler.sendEmptyMessage(100); searchBarUpdateHandler.sendEmptyMessage(100);
searchBarUpdateHandler.postDelayed(() -> searchBarUpdateHandler.removeMessages(100);
{ triggerUpdateSearchBar(handlerLocalUrl,showProtocol, pClearText);
searchBarUpdateHandler.removeMessages(100); mSearchbar.setTag(R.id.msearchbarProcessing,false);
triggerUpdateSearchBar(handlerLocalUrl,showProtocol, pClearText);
mSearchbar.setTag(R.id.msearchbarProcessing,false);
}, delay);
} }
} }
} }
@ -1214,6 +1213,10 @@ class homeViewController
} }
void onProgressBarUpdate(int value, boolean mForced){ void onProgressBarUpdate(int value, boolean mForced){
if(progressAnimator!=null){
progressAnimator.cancel();
}
if(mSearchbar.getText().toString().equals("genesis.onion") && !mForced || (boolean)mSearchbar.getTag(R.id.msearchbarProcessing)){ if(mSearchbar.getText().toString().equals("genesis.onion") && !mForced || (boolean)mSearchbar.getTag(R.id.msearchbarProcessing)){
mProgressBar.setProgress(0); mProgressBar.setProgress(0);
mProgressBar.setVisibility(View.GONE); mProgressBar.setVisibility(View.GONE);
@ -1225,18 +1228,26 @@ class homeViewController
if(value != mProgressBar.getProgress()){ if(value != mProgressBar.getProgress()){
if(value<=5 && value>0){ if(value<=5 && value>0){
mProgressBar.setProgress(5); setProgressAnimate(5,70);
}else { }else {
mProgressBar.setProgress(value); setProgressAnimate(value,200);
} }
if(value >= 100 || value<=0){ if(value >= 100 || value<=0){
mProgressBar.animate().alpha(0).withEndAction(() -> mProgressBar.setProgress(0)); mProgressBar.animate().alpha(0).setStartDelay(200).withEndAction(() -> mProgressBar.setProgress(0));
}else { }else {
mProgressBar.setAlpha(1); mProgressBar.setAlpha(1);
} }
} }
} }
ObjectAnimator progressAnimator = null;
private void setProgressAnimate(int pValue, int pSpeed)
{
progressAnimator = ObjectAnimator.ofInt(mProgressBar, "progress", pValue);
progressAnimator.setDuration(pSpeed);
progressAnimator.start();
}
public void onNewTabAnimation(List<Object> data, Object e_type){ public void onNewTabAnimation(List<Object> data, Object e_type){
mGeckoView.setPivotX(0); mGeckoView.setPivotX(0);
mGeckoView.setPivotY(0); mGeckoView.setPivotY(0);

View File

@ -21,7 +21,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -66,9 +66,10 @@ public class languageController extends AppCompatActivity {
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){ if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme(); activityContextManager.getInstance().onResetTheme();
theme.getInstance().onConfigurationChanged(this); activityThemeManager.getInstance().onConfigurationChanged(this);
} }
} }

View File

@ -71,7 +71,7 @@ public class orbotLogAdapter extends RecyclerView.Adapter<orbotLogAdapter.listVi
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.CONST_LOG_DUCKDUCK + mModelList.get(this.getLayoutPosition()).getLog())); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(constants.CONST_LOG_DUCKDUCK + Uri.encode(" " + mModelList.get(this.getLayoutPosition()).getLog())));
intent.putExtra(SearchManager.QUERY, mDescription.getText()); intent.putExtra(SearchManager.QUERY, mDescription.getText());
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
activityContextManager.getInstance().getHomeController().startActivity(intent); activityContextManager.getInstance().getHomeController().startActivity(intent);

View File

@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;
@ -21,7 +22,7 @@ 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.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -82,20 +83,27 @@ public class orbotLogController extends AppCompatActivity {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){ if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme(); activityContextManager.getInstance().onResetTheme();
theme.getInstance().onConfigurationChanged(this); activityThemeManager.getInstance().onConfigurationChanged(this);
} }
mNestedScrollView.stopNestedScroll(); mNestedScrollView.stopNestedScroll();
helperMethod.onDelayHandler(orbotLogController.this, 150, () -> { helperMethod.onDelayHandler(orbotLogController.this, 150, () -> {
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE || newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE || newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
if(!orbotLogStatus.sUIInteracted && ((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)>1)){ if(!orbotLogStatus.sUIInteracted && ((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)>1)){
if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){ if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){
mNestedScrollView.stopNestedScroll();
onScrollBottom(); onScrollBottom();
mNestedScrollView.stopNestedScroll();
orbotLogStatus.sScrollPosition = -1;
} }
}else { }else {
mNestedScrollView.stopNestedScroll();
mNestedScrollView.scrollTo(0,0); mNestedScrollView.scrollTo(0,0);
mNestedScrollView.smoothScrollTo(0,0);
mNestedScrollView.stopNestedScroll();
orbotLogStatus.sScrollPosition = 0;
} }
orbotLogStatus.sScrollPosition = -1;
} }
return null; return null;
@ -104,7 +112,6 @@ public class orbotLogController extends AppCompatActivity {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
} }
private void initializeViews() { private void initializeViews() {
mLogRecycleView = findViewById(R.id.pLogRecycleView); mLogRecycleView = findViewById(R.id.pLogRecycleView);
mLogs = findViewById(R.id.pLogs); mLogs = findViewById(R.id.pLogs);
@ -126,7 +133,7 @@ public class orbotLogController extends AppCompatActivity {
layoutManager.setReverseLayout(true); layoutManager.setReverseLayout(true);
mLogRecycleView.setAdapter(adapter); mLogRecycleView.setAdapter(adapter);
Objects.requireNonNull(mLogRecycleView.getItemAnimator()).setAddDuration(250); Objects.requireNonNull(mLogRecycleView.getItemAnimator()).setAddDuration(350);
mLogRecycleView.setNestedScrollingEnabled(false); mLogRecycleView.setNestedScrollingEnabled(false);
mLogRecycleView.setLayoutManager(new LinearLayoutManager(orbotLogController.this)); mLogRecycleView.setLayoutManager(new LinearLayoutManager(orbotLogController.this));
@ -151,38 +158,36 @@ public class orbotLogController extends AppCompatActivity {
@SuppressLint("NewApi") @SuppressWarnings("deprecation") @SuppressLint("NewApi") @SuppressWarnings("deprecation")
@Override @Override
public void onGlobalLayout() { public void onGlobalLayout() {
if(orbotLogStatus.sScrollPosition!=-1 && orbotLogStatus.sUIInteracted){
if(orbotLogStatus.sOrientation==-1){
orbotLogStatus.sOrientation = getResources().getConfiguration().orientation;
}
if(orbotLogStatus.sOrientation != getResources().getConfiguration().orientation && orbotLogStatus.sScrollPosition!=-1 && orbotLogStatus.sScrollPosition!=0){
mNestedScrollView.stopNestedScroll();
orbotLogStatus.sScrollPosition = 0;
mNestedScrollView.scrollTo(0, orbotLogStatus.sScrollPosition); mNestedScrollView.scrollTo(0, orbotLogStatus.sScrollPosition);
}else if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){ orbotLogStatus.sOrientation = getResources().getConfiguration().orientation;
onScrollBottom(); }else {
if(orbotLogStatus.sScrollPosition!=-1 && orbotLogStatus.sUIInteracted){
mNestedScrollView.scrollTo(0, orbotLogStatus.sScrollPosition);
}else if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){
onScrollBottom();
}
} }
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
mNestedScrollView.setOnScrollChangeListener((View.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> orbotLogStatus.sScrollPosition = scrollY); mNestedScrollView.setOnScrollChangeListener((View.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
orbotLogStatus.sScrollPosition = scrollY;
});
} }
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
mLogRecycleView.getViewTreeObserver().removeOnGlobalLayoutListener(this); mLogRecycleView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
orbotLogStatus.sOrientation = getResources().getConfiguration().orientation;
} }
}); });
mNestedScrollView.setOnTouchListener((v, event) -> {
if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){
orbotLogStatus.sUIInteracted = true;
}
if(event.getAction() == MotionEvent.ACTION_UP){
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
}
if(event.getAction() == MotionEvent.ACTION_UP){
mIsRecycleviewInteracting = false;
}else if(event.getAction() == MotionEvent.ACTION_DOWN){
mIsRecycleviewInteracting = true;
}
return false;
});
mLogRecycleView.addOnScrollListener(new RecyclerView.OnScrollListener() { mLogRecycleView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override @Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
@ -193,21 +198,50 @@ public class orbotLogController extends AppCompatActivity {
} }
}); });
mNestedScrollView.getViewTreeObserver() .addOnScrollChangedListener(() -> { mLogRecycleView.setOnTouchListener((v, event) -> onTouch(event));
if (mNestedScrollView.getScrollY() == 0)
{
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
}
else if (mNestedScrollView.getChildAt(0).getBottom() <= (mNestedScrollView.getHeight() + mNestedScrollView.getScrollY())) {
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
mNestedScrollView.setOnTouchListener((v, event) -> onTouch(event));
mLogRecycleView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (!recyclerView.canScrollVertically(1) && newState==RecyclerView.SCROLL_STATE_IDLE) {
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
}
}
});
mNestedScrollView.getViewTreeObserver() .addOnScrollChangedListener(() -> {
if (mNestedScrollView.getChildAt(0).getBottom() <= (mNestedScrollView.getHeight() + mNestedScrollView.getScrollY())) {
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
if(!mIsRecycleviewInteracting){ if(!mIsRecycleviewInteracting){
orbotLogStatus.sUIInteracted = false; orbotLogStatus.sUIInteracted = false;
} }
} }
if(mNestedScrollView.getScrollY() == 0){
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
}
}); });
} }
public boolean onTouch(MotionEvent event){
if(event.getAction() == MotionEvent.ACTION_UP){
mIsRecycleviewInteracting = false;
if(mNestedScrollView.canScrollVertically(enums.ScrollDirection.VERTICAL)){
orbotLogStatus.sUIInteracted = true;
}
}else if(event.getAction() == MotionEvent.ACTION_DOWN){
mIsRecycleviewInteracting = true;
}
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);
return false;
}
private void logToString(){ private void logToString(){
if((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)>1){ if((int)mOrbotModel.onTrigger(M_GET_LIST_SIZE)>1){
for(int mCounter=0;mCounter<(int)mOrbotModel.onTrigger(M_GET_LIST_SIZE);mCounter++){ for(int mCounter=0;mCounter<(int)mOrbotModel.onTrigger(M_GET_LIST_SIZE);mCounter++){
@ -243,6 +277,7 @@ public class orbotLogController extends AppCompatActivity {
if(!orbotLogStatus.sUIInteracted){ if(!orbotLogStatus.sUIInteracted){
helperMethod.onDelayHandler(orbotLogController.this, 150, () -> { helperMethod.onDelayHandler(orbotLogController.this, 150, () -> {
Log.i("SUPFUCK4", orbotLogStatus.sUIInteracted + "");
if(!orbotLogStatus.sUIInteracted){ if(!orbotLogStatus.sUIInteracted){
onScrollBottomAnimated(null); onScrollBottomAnimated(null);
} }
@ -271,6 +306,7 @@ public class orbotLogController extends AppCompatActivity {
public void onScrollBottomAnimated(View view) { public void onScrollBottomAnimated(View view) {
mNestedScrollView.fullScroll(View.FOCUS_DOWN); mNestedScrollView.fullScroll(View.FOCUS_DOWN);
orbotLogStatus.sUIInteracted = false; orbotLogStatus.sUIInteracted = false;
Log.i("SUPFUCK5", orbotLogStatus.sUIInteracted + "");
if(view!=null){ if(view!=null){
mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE); mOrbotLogViewController.onTrigger(M_FLOAT_BUTTON_UPDATE);

View File

@ -4,5 +4,5 @@ public class orbotLogStatus {
public static boolean sUIInteracted = false; public static boolean sUIInteracted = false;
public static int sScrollPosition = -1; public static int sScrollPosition = -1;
public static int sOrientation = -1;
} }

View File

@ -3,7 +3,6 @@ package com.darkweb.genesissearchengine.appManager.orbotManager;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@ -18,10 +17,9 @@ import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.SimpleGestureFilter;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -39,7 +37,6 @@ public class orbotController extends AppCompatActivity {
private SwitchMaterial mBridgeSwitch; private SwitchMaterial mBridgeSwitch;
private SwitchMaterial mVpnSwitch; private SwitchMaterial mVpnSwitch;
private LinearLayout mCustomizableBridgeMenu; private LinearLayout mCustomizableBridgeMenu;
private GestureDetector mSwipeDirectionDetector;
/* INITIALIZATIONS */ /* INITIALIZATIONS */
@ -65,7 +62,7 @@ public class orbotController extends AppCompatActivity {
if(newConfig.uiMode != getResources().getConfiguration().uiMode){ if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme(); activityContextManager.getInstance().onResetTheme();
theme.getInstance().onConfigurationChanged(this); activityThemeManager.getInstance().onConfigurationChanged(this);
} }
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
@ -88,16 +85,6 @@ public class orbotController extends AppCompatActivity {
/* LISTENERS */ /* LISTENERS */
private void onInitListener(){ private void onInitListener(){
mSwipeDirectionDetector=new GestureDetector(this,new SimpleGestureFilter(){
@Override
public boolean onSwipe(Direction direction) {
if (direction==Direction.left){
onClose(null);
}
return true;
}
});
} }
public class orbotModelCallback implements eventObserver.eventListener{ public class orbotModelCallback implements eventObserver.eventListener{
@ -162,16 +149,6 @@ public class orbotController extends AppCompatActivity {
onClose(null); onClose(null);
} }
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
if(inSignatureArea(event)){
try{
mSwipeDirectionDetector.onTouchEvent(event);
}catch (Exception ignored){ }
}
return super.dispatchTouchEvent(event);
}
public boolean inSignatureArea(MotionEvent ev) { public boolean inSignatureArea(MotionEvent ev) {
float mEventY = ev.getY(); float mEventY = ev.getY();
float mEventX = ev.getX(); float mEventX = ev.getX();

View File

@ -14,7 +14,7 @@ import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -52,7 +52,7 @@ public class proxyStatusController extends AppCompatActivity {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){ if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme(); activityContextManager.getInstance().onResetTheme();
theme.getInstance().onConfigurationChanged(this); activityThemeManager.getInstance().onConfigurationChanged(this);
} }
} }

View File

@ -18,7 +18,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -63,7 +63,7 @@ public class settingAccessibilityController extends AppCompatActivity {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){ if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme(); activityContextManager.getInstance().onResetTheme();
theme.getInstance().onConfigurationChanged(this); activityThemeManager.getInstance().onConfigurationChanged(this);
} }
} }

View File

@ -16,7 +16,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -58,7 +58,7 @@ public class settingAdvanceController extends AppCompatActivity {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){ if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme(); activityContextManager.getInstance().onResetTheme();
theme.getInstance().onConfigurationChanged(this); activityThemeManager.getInstance().onConfigurationChanged(this);
} }
} }

View File

@ -11,19 +11,17 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.databaseManager.databaseController;
import com.darkweb.genesissearchengine.appManager.helpManager.helpController; import com.darkweb.genesissearchengine.appManager.helpManager.helpController;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.sql;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -34,6 +32,9 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_BOOKMARK;
import static com.darkweb.genesissearchengine.constants.sql.SQL_CLEAR_HISTORY;
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_DATA_CLEARED; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_DATA_CLEARED;
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY; import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
@ -60,7 +61,7 @@ public class settingClearController extends AppCompatActivity {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){ if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme(); activityContextManager.getInstance().onResetTheme();
theme.getInstance().onConfigurationChanged(this); activityThemeManager.getInstance().onConfigurationChanged(this);
} }
} }
@ -113,13 +114,13 @@ public class settingClearController extends AppCompatActivity {
if(mCheckBoxList.get(1).isChecked()){ if(mCheckBoxList.get(1).isChecked()){
mCheckBoxList.get(1).setChecked(false); mCheckBoxList.get(1).setChecked(false);
mCheckBoxList.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); mCheckBoxList.get(1).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
databaseController.getInstance().execSQL(sql.SQL_CLEAR_HISTORY,null); dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_HISTORY,null));
dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null); dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null);
} }
if(mCheckBoxList.get(2).isChecked()){ if(mCheckBoxList.get(2).isChecked()){
mCheckBoxList.get(2).setChecked(false); mCheckBoxList.get(2).setChecked(false);
mCheckBoxList.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default))); mCheckBoxList.get(2).setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(this, R.color.c_checkbox_tint_default)));
databaseController.getInstance().execSQL(sql.SQL_CLEAR_BOOKMARK,null); dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_BOOKMARK,null));
dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_CLEAR_BOOKMARK ,null); dataController.getInstance().invokeBookmark(dataEnums.eBookmarkCommands.M_CLEAR_BOOKMARK ,null);
} }
if(mCheckBoxList.get(3).isChecked()){ if(mCheckBoxList.get(3).isChecked()){

View File

@ -19,7 +19,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -66,7 +66,7 @@ public class settingGeneralController extends AppCompatActivity {
if(!mIsThemeChanging){ if(!mIsThemeChanging){
if(newConfig.uiMode != getResources().getConfiguration().uiMode){ if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme(); activityContextManager.getInstance().onResetTheme();
theme.getInstance().onConfigurationChanged(this); activityThemeManager.getInstance().onConfigurationChanged(this);
} }
} }

View File

@ -14,7 +14,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -55,7 +55,7 @@ public class settingLogController extends AppCompatActivity {
if(newConfig.uiMode != getResources().getConfiguration().uiMode){ if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme(); activityContextManager.getInstance().onResetTheme();
theme.getInstance().onConfigurationChanged(this); activityThemeManager.getInstance().onConfigurationChanged(this);
} }
} }

View File

@ -15,7 +15,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -48,7 +48,7 @@ public class settingNotificationController extends AppCompatActivity {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){ if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme(); activityContextManager.getInstance().onResetTheme();
theme.getInstance().onConfigurationChanged(this); activityThemeManager.getInstance().onConfigurationChanged(this);
} }
} }

View File

@ -17,7 +17,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -55,7 +55,7 @@ public class settingPrivacyController extends AppCompatActivity {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){ if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme(); activityContextManager.getInstance().onResetTheme();
theme.getInstance().onConfigurationChanged(this); activityThemeManager.getInstance().onConfigurationChanged(this);
} }
} }

View File

@ -16,7 +16,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -50,7 +50,7 @@ public class settingSearchController extends AppCompatActivity {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){ if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme(); activityContextManager.getInstance().onResetTheme();
theme.getInstance().onConfigurationChanged(this); activityThemeManager.getInstance().onConfigurationChanged(this);
} }
} }

View File

@ -1,4 +1,4 @@
package com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage; package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
@ -27,7 +27,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -69,9 +69,8 @@ public class settingHomeController extends AppCompatActivity
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){ if(activityThemeManager.getInstance().onInitTheme(this)){
activityContextManager.getInstance().onResetTheme(); activityContextManager.getInstance().onResetTheme();
theme.getInstance().onConfigurationChanged(this);
} }
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);

View File

@ -1,4 +1,4 @@
package com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage; package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager;
public class settingHomeEnums public class settingHomeEnums
{ {

View File

@ -1,4 +1,4 @@
package com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage; package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;

View File

@ -1,4 +1,4 @@
package com.darkweb.genesissearchengine.appManager.settingManager.settingHomePage; package com.darkweb.genesissearchengine.appManager.settingManager.settingHomeManager;
import android.os.Build; import android.os.Build;
import android.view.View; import android.view.View;

View File

@ -16,7 +16,7 @@ import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.helperManager.theme; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -50,7 +50,7 @@ public class settingTrackingController extends AppCompatActivity {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
if(newConfig.uiMode != getResources().getConfiguration().uiMode){ if(newConfig.uiMode != getResources().getConfiguration().uiMode){
activityContextManager.getInstance().onResetTheme(); activityContextManager.getInstance().onResetTheme();
theme.getInstance().onConfigurationChanged(this); activityThemeManager.getInstance().onConfigurationChanged(this);
} }
} }

View File

@ -24,7 +24,8 @@ import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.activityContextManager;
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.helperManager.TopCropImageView; import com.darkweb.genesissearchengine.dataManager.models.tabRowModel;
import com.darkweb.genesissearchengine.libs.views.ThumbnailCrop;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -288,7 +289,7 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
TextView mDate; TextView mDate;
ImageView mLoadSession; ImageView mLoadSession;
ImageButton mRemoveRow; ImageButton mRemoveRow;
TopCropImageView mWebThumbnail; ThumbnailCrop mWebThumbnail;
FrameLayout mSelectedView; FrameLayout mSelectedView;
FrameLayout mItemSelectionMenu; FrameLayout mItemSelectionMenu;
Button mItemSelectionMenuButton; Button mItemSelectionMenuButton;

View File

@ -32,6 +32,7 @@ import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.dataManager.models.tabRowModel;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R; import com.example.myapplication.R;

View File

@ -2,10 +2,10 @@ package com.darkweb.genesissearchengine.appManager.tabManager;
import com.darkweb.genesissearchengine.dataManager.dataController; import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.dataManager.models.tabRowModel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
class tabModel class tabModel

View File

@ -10,11 +10,12 @@ public class constants
public static final String CONST_SOFTWARE_URL = "https://genesishiddentechnologies.com/search?q=softwares+tools&p_num=1&s_type=all&p_num=1&s_type=all"; public static final String CONST_SOFTWARE_URL = "https://genesishiddentechnologies.com/search?q=softwares+tools&p_num=1&s_type=all&p_num=1&s_type=all";
public static final String CONST_SOFTWARE_FINANCE = "https://genesishiddentechnologies.com/search?q=finance&p_num=1&s_type=all&p_num=1&s_type=all"; public static final String CONST_SOFTWARE_FINANCE = "https://genesishiddentechnologies.com/search?q=finance&p_num=1&s_type=all&p_num=1&s_type=all";
public static final String CONST_COMMUNITIES = "https://genesishiddentechnologies.com/search?q=news&p_num=1&s_type=all&p_num=1&s_type=all"; public static final String CONST_COMMUNITIES = "https://genesishiddentechnologies.com/search?q=news&p_num=1&s_type=all&p_num=1&s_type=all";
public static final String CONST_PLAYSTORE_URL = "http://play.google.com/store/apps/details?id=com.darkweb.genesissearchengine"; public static final String CONST_PLAYSTORE_URL = "http://play.google.com/store/apps/details?id=com.darkweb.genesissearchengine.production";
public static final String CONST_PRIVACY_POLICY_URL = "https://genesishiddentechnologies.com/privacy"; public static final String CONST_PRIVACY_POLICY_URL = "https://genesishiddentechnologies.com/privacy";
public static final String CONST_REPORT_URL = "https://genesishiddentechnologies.com/reportus?url="; public static final String CONST_REPORT_URL = "https://genesishiddentechnologies.com/reportus?url=";
public static final String CONST_SITEMAP = "https://genesishiddentechnologies.com/create"; public static final String CONST_SITEMAP = "https://genesishiddentechnologies.com/create";
public static final String CONST_PACKAGE_NAME = "com.darkweb.genesissearchengine.dev"; public static final String CONST_PACKAGE_NAME = "com.darkweb.genesissearchengine.production";
public static final String CONST_WIDGET_NAME = "com.darkweb.genesissearchengine.widget";
/*DRIVE URL DEV*/ /*DRIVE URL DEV*/
@ -47,7 +48,7 @@ public class constants
public static final String CONST_BACKEND_DUCK_DUCK_GO_URL = "https://duckduckgo.com?q=$s&ia=web"; public static final String CONST_BACKEND_DUCK_DUCK_GO_URL = "https://duckduckgo.com?q=$s&ia=web";
public static final String CONST_BACKEND_BING_URL = "https://bing.com/search?q=$s"; public static final String CONST_BACKEND_BING_URL = "https://bing.com/search?q=$s";
public static final String CONST_BACKEND_WIKI_URL = "https://en.wikipedia.org/wiki/$s"; public static final String CONST_BACKEND_WIKI_URL = "https://en.wikipedia.org/wiki/$s";
public static final String CONST_LOG_DUCKDUCK = "https://duckduckgo.com/?q=tor "; public static final String CONST_LOG_DUCKDUCK = "https://duckduckgo.com/?q=tor";
/*PROXY CONSTANTS*/ /*PROXY CONSTANTS*/

View File

@ -41,4 +41,9 @@ public class enums
public static final int VERTICAL = 1; 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,24 +1,33 @@
package com.darkweb.genesissearchengine.dataManager; package com.darkweb.genesissearchengine.dataManager;
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkRowModel; import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel;
import com.darkweb.genesissearchengine.databaseManager.databaseController;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.eventObserver;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
public class bookmarkDataModel { public class bookmarkDataModel {
/* Local Variables */
private eventObserver.eventListener mExternalEvents;
private ArrayList<bookmarkRowModel> mBookmarks; private ArrayList<bookmarkRowModel> mBookmarks;
public bookmarkDataModel(){ /* Initializations */
public bookmarkDataModel(eventObserver.eventListener pExternalEvents){
mBookmarks = new ArrayList<>(); mBookmarks = new ArrayList<>();
mExternalEvents = pExternalEvents;
} }
void initializebookmark(ArrayList<bookmarkRowModel> pBookmark){ void initializebookmark(ArrayList<bookmarkRowModel> pBookmark){
mBookmarks = pBookmark; mBookmarks = pBookmark;
} }
/* Helper Methods */
private ArrayList<bookmarkRowModel> getBookmark() { private ArrayList<bookmarkRowModel> getBookmark() {
return mBookmarks; return mBookmarks;
} }
@ -32,7 +41,7 @@ public class bookmarkDataModel {
int autoval = 0; int autoval = 0;
if(mBookmarks.size()> constants.CONST_MAX_BOOKMARK_SIZE) if(mBookmarks.size()> constants.CONST_MAX_BOOKMARK_SIZE)
{ {
databaseController.getInstance().execSQL("delete from bookmark where id="+ mBookmarks.get(mBookmarks.size()-1).getID(),null); mExternalEvents.invokeObserver(Arrays.asList("delete from bookmark where id="+ mBookmarks.get(mBookmarks.size()-1).getID(),null), dataEnums.eBookmarkCallbackCommands.M_EXEC_SQL);
} }
if(mBookmarks.size()>0) if(mBookmarks.size()>0)
@ -50,7 +59,7 @@ public class bookmarkDataModel {
params[1] = pURL; params[1] = pURL;
if(!pTitle.equals("loading")){ if(!pTitle.equals("loading")){
databaseController.getInstance().execSQL("REPLACE INTO bookmark(id,title,url) VALUES("+autoval+",?,?);",params); mExternalEvents.invokeObserver(Arrays.asList("REPLACE INTO bookmark(id,title,url) VALUES("+autoval+",?,?);",params), dataEnums.eBookmarkCallbackCommands.M_EXEC_SQL);
} }
mBookmarks.add(0,new bookmarkRowModel(pTitle, pURL,autoval)); mBookmarks.add(0,new bookmarkRowModel(pTitle, pURL,autoval));
} }
@ -65,9 +74,12 @@ public class bookmarkDataModel {
mBookmarks.remove(mCounter); mBookmarks.remove(mCounter);
} }
} }
databaseController.getInstance().execSQL("delete from bookmark where id="+ pID,null);
mExternalEvents.invokeObserver(Arrays.asList("delete from bookmark where id="+ pID,null), dataEnums.eBookmarkCallbackCommands.M_EXEC_SQL);
} }
/* External Triggers */
public Object onTrigger(dataEnums.eBookmarkCommands p_commands, List<Object> pData){ public Object onTrigger(dataEnums.eBookmarkCommands p_commands, List<Object> pData){
if(p_commands == dataEnums.eBookmarkCommands.M_GET_BOOKMARK){ if(p_commands == dataEnums.eBookmarkCommands.M_GET_BOOKMARK){
return getBookmark(); return getBookmark();

View File

@ -9,24 +9,25 @@ import com.android.volley.toolbox.Volley;
import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import static com.darkweb.genesissearchengine.constants.constants.*;
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_BRIDGE_WEBSITES;
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_BRIDGE_WEBSITES_DEV;
import static com.darkweb.genesissearchengine.constants.constants.CONST_SERVER;
import static com.darkweb.genesissearchengine.constants.constants.CONST_SERVER_DEV;
public class bridgesDataModel { public class bridgesDataModel {
private String mBridges = "null"; /* Local Variables */
private String mBridges;
private boolean mLoading = false; private boolean mLoading = false;
/* Initializations */
public bridgesDataModel(){ public bridgesDataModel(){
mBridges = status.sBridgesDefault; mBridges = status.sBridgesDefault;
} }
/* Helper Methods */
private void onLoad(Context pContext){ private void onLoad(Context pContext){
if(!mLoading){ if(!mLoading){
mLoading = true; mLoading = true;
@ -66,6 +67,8 @@ public class bridgesDataModel {
return strings.GENERIC_EMPTY_SPACE; return strings.GENERIC_EMPTY_SPACE;
} }
/* External Triggers */
public Object onTrigger(dataEnums.eBridgeWebsiteCommands p_commands, List<Object> pData){ public Object onTrigger(dataEnums.eBridgeWebsiteCommands p_commands, List<Object> pData){
if(p_commands == dataEnums.eBridgeWebsiteCommands.M_LOAD){ if(p_commands == dataEnums.eBridgeWebsiteCommands.M_LOAD){
onLoad((Context) pData.get(0)); onLoad((Context) pData.get(0));

View File

@ -2,14 +2,24 @@ package com.darkweb.genesissearchengine.dataManager;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.databaseManager.databaseController; import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel;
import com.darkweb.genesissearchengine.dataManager.models.tabRowModel;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import org.mozilla.geckoview.ContentBlocking;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import static com.darkweb.genesissearchengine.constants.sql.*;
import static com.darkweb.genesissearchengine.constants.status.mThemeApplying; import static com.darkweb.genesissearchengine.constants.status.mThemeApplying;
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
public class dataController public class dataController
{ {
@ -24,6 +34,7 @@ public class dataController
private helpDataModel mHelpDataModel; private helpDataModel mHelpDataModel;
private referenceWebsiteDataModel mReferenceWebsiteDataModel; private referenceWebsiteDataModel mReferenceWebsiteDataModel;
private bridgesDataModel mBridgeWebsiteDataModel; private bridgesDataModel mBridgeWebsiteDataModel;
private sqlCipherDataModel mSqlCipherDataModel;
/*Private Declarations*/ /*Private Declarations*/
@ -36,36 +47,44 @@ public class dataController
/*Initializations*/ /*Initializations*/
public void initialize(AppCompatActivity pAppContext){ public void initialize(AppCompatActivity pAppContext){
mHistoryModel = new historyDataModel(); mHistoryModel = new historyDataModel(new invokeHistoryCallbacks());
mTabModel = new tabDataModel(); mTabModel = new tabDataModel(new invokeTabCallbacks());
mPreferenceModel = new preferenceDataModel(pAppContext); mPreferenceModel = new preferenceDataModel(pAppContext);
mImageDataModel = new imageDataModel(); mImageDataModel = new imageDataModel();
mBookmarkDataModel = new bookmarkDataModel(); mBookmarkDataModel = new bookmarkDataModel(new invokeBookmarkCallbacks());
mSuggestionDataModel = new suggestionDataModel(pAppContext); mSuggestionDataModel = new suggestionDataModel(pAppContext);
mHelpDataModel = new helpDataModel(); mHelpDataModel = new helpDataModel();
mReferenceWebsiteDataModel = new referenceWebsiteDataModel(); mReferenceWebsiteDataModel = new referenceWebsiteDataModel();
mBridgeWebsiteDataModel = new bridgesDataModel(); mBridgeWebsiteDataModel = new bridgesDataModel();
mSqlCipherDataModel = new sqlCipherDataModel();
} }
public void initializeListData(){ public void initializeListData(){
mReferenceWebsiteDataModel.onTrigger(dataEnums.eReferenceWebsiteCommands.M_LOAD,Collections.singletonList(activityContextManager.getInstance().getHomeController())); mReferenceWebsiteDataModel.onTrigger(dataEnums.eReferenceWebsiteCommands.M_LOAD,Collections.singletonList(activityContextManager.getInstance().getHomeController()));
mBridgeWebsiteDataModel.onTrigger(dataEnums.eBridgeWebsiteCommands.M_LOAD,Collections.singletonList(activityContextManager.getInstance().getHomeController())); mBridgeWebsiteDataModel.onTrigger(dataEnums.eBridgeWebsiteCommands.M_LOAD,Collections.singletonList(activityContextManager.getInstance().getHomeController()));
mBookmarkDataModel.initializebookmark(databaseController.getInstance().selectBookmark());
ArrayList<bookmarkRowModel> mBookmarks = (ArrayList<bookmarkRowModel>)invokeSQLCipher(dataEnums.eSqlCipherCommands.M_SELECT_BOOKMARK, null);
mBookmarkDataModel.initializebookmark(mBookmarks);
if(!status.sClearOnExit) if(!status.sClearOnExit)
{ {
mHistoryModel.onTrigger(dataEnums.eHistoryCommands.M_INITIALIZE_HISTORY, Arrays.asList(databaseController.getInstance().selectHistory(0,constants.CONST_FETCHABLE_LIST_SIZE), databaseController.getInstance().getLargestHistoryID(),databaseController.getInstance().getLargestHistoryID())); ArrayList<Object> mHistory = (ArrayList<Object>)invokeSQLCipher(dataEnums.eSqlCipherCommands.M_SELECT_HISTORY, Arrays.asList(0,constants.CONST_FETCHABLE_LIST_SIZE));
int mHistoryID = (int)invokeSQLCipher(dataEnums.eSqlCipherCommands.M_HISTORY_ID, null);
mHistoryModel.onTrigger(dataEnums.eHistoryCommands.M_INITIALIZE_HISTORY, Arrays.asList(mHistory, mHistoryID, mHistoryID));
} }
else { else {
databaseController.getInstance().execSQL("delete from history where 1",null); invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList("delete from history where 1",null));
} }
if(status.sRestoreTabs || mThemeApplying){ if(status.sRestoreTabs || mThemeApplying){
mTabModel.initializeTab(databaseController.getInstance().selectTabs()); ArrayList<tabRowModel> mTabs = (ArrayList<tabRowModel>)invokeSQLCipher(dataEnums.eSqlCipherCommands.M_SELECT_TABS, null);
mTabModel.initializeTab(mTabs);
activityContextManager.getInstance().getHomeController().initTabCountForced(); activityContextManager.getInstance().getHomeController().initTabCountForced();
}else{ }else{
invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null); invokeTab(dataEnums.eTabCommands.M_CLEAR_TAB, null);
} }
} }
/*Recieving History*/ /*Trigger History*/
public Object invokeHistory(dataEnums.eHistoryCommands pCommands, List<Object> pData){ public Object invokeHistory(dataEnums.eHistoryCommands pCommands, List<Object> pData){
if(pCommands == dataEnums.eHistoryCommands.M_ADD_HISTORY){ if(pCommands == dataEnums.eHistoryCommands.M_ADD_HISTORY){
@ -74,21 +93,40 @@ public class dataController
if(pCommands.equals(dataEnums.eHistoryCommands.M_LOAD_MORE_HISTORY)){ if(pCommands.equals(dataEnums.eHistoryCommands.M_LOAD_MORE_HISTORY)){
int m_history_size = (int) mHistoryModel.onTrigger(dataEnums.eHistoryCommands.M_HISTORY_SIZE,null) - 1; int m_history_size = (int) mHistoryModel.onTrigger(dataEnums.eHistoryCommands.M_HISTORY_SIZE,null) - 1;
return mHistoryModel.onTrigger(pCommands, Collections.singletonList(databaseController.getInstance().selectHistory(m_history_size+1,constants.CONST_FETCHABLE_LIST_SIZE)));
ArrayList<Object> mHistory = (ArrayList<Object>)invokeSQLCipher(dataEnums.eSqlCipherCommands.M_SELECT_HISTORY, Arrays.asList(m_history_size+1,constants.CONST_FETCHABLE_LIST_SIZE));
return mHistoryModel.onTrigger(pCommands, mHistory);
}else { }else {
return mHistoryModel.onTrigger(pCommands, pData); return mHistoryModel.onTrigger(pCommands, pData);
} }
} }
private class invokeHistoryCallbacks implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
if(e_type.equals(dataEnums.eHistoryCallbackCommands.M_EXEC_SQL)){
invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, data);
}
return null;
}
}
/*Trigger Suggestions*/
public Object invokeSuggestions(dataEnums.eSuggestionCommands pCommands, List<Object> pData){ public Object invokeSuggestions(dataEnums.eSuggestionCommands pCommands, List<Object> pData){
return mSuggestionDataModel.onTrigger(pCommands, Arrays.asList(pData.get(0), mHistoryModel.onTrigger(dataEnums.eHistoryCommands.M_GET_HISTORY, null), mBookmarkDataModel.onTrigger(dataEnums.eBookmarkCommands.M_GET_BOOKMARK, null))); return mSuggestionDataModel.onTrigger(pCommands, Arrays.asList(pData.get(0), mHistoryModel.onTrigger(dataEnums.eHistoryCommands.M_GET_HISTORY, null), mBookmarkDataModel.onTrigger(dataEnums.eBookmarkCommands.M_GET_BOOKMARK, null)));
} }
/*Trigger Reference Websites*/
public Object invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands pCommands, List<Object> pData){ public Object invokeReferenceWebsite(dataEnums.eReferenceWebsiteCommands pCommands, List<Object> pData){
return mReferenceWebsiteDataModel.onTrigger(pCommands, null); return mReferenceWebsiteDataModel.onTrigger(pCommands, null);
} }
/*Recieving Preferences*/ /*Trigger Preferences*/
public Object invokePrefs(dataEnums.ePreferencesCommands pCommands, List<Object> pData){ public Object invokePrefs(dataEnums.ePreferencesCommands pCommands, List<Object> pData){
if(mPreferenceModel==null){ if(mPreferenceModel==null){
return null; return null;
@ -96,22 +134,106 @@ public class dataController
return mPreferenceModel.onTrigger(pCommands, pData); return mPreferenceModel.onTrigger(pCommands, pData);
} }
/*Recieving Help*/ /*Trigger Help*/
public Object invokeHelp(dataEnums.eHelpCommands pCommands, List<Object> pData){ public Object invokeHelp(dataEnums.eHelpCommands pCommands, List<Object> pData){
return mHelpDataModel.onTrigger(pCommands, pData); return mHelpDataModel.onTrigger(pCommands, pData);
} }
/*Recieving History*/ /*Trigger Bookmarks*/
public Object invokeBookmark(dataEnums.eBookmarkCommands pCommands, List<Object> pData){ public Object invokeBookmark(dataEnums.eBookmarkCommands pCommands, List<Object> pData){
return mBookmarkDataModel.onTrigger(pCommands, pData); return mBookmarkDataModel.onTrigger(pCommands, pData);
} }
private class invokeBookmarkCallbacks implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
if(e_type.equals(dataEnums.eBookmarkCallbackCommands.M_EXEC_SQL)){
invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, data);
}
return null;
}
}
/*Trigger Tabs*/
public Object invokeTab(dataEnums.eTabCommands pCommands, List<Object> pData){ public Object invokeTab(dataEnums.eTabCommands pCommands, List<Object> pData){
return mTabModel.onTrigger(pCommands, pData); return mTabModel.onTrigger(pCommands, pData);
} }
private class invokeTabCallbacks implements eventObserver.eventListener{
@Override
public Object invokeObserver(List<Object> data, Object e_type)
{
if(e_type.equals(dataEnums.eTabCallbackCommands.M_EXEC_SQL)){
invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, data);
}
return null;
}
}
/*Trigger Image Cache*/
public Object invokeImage(dataEnums.eImageCommands pCommands, List<Object> pData){ public Object invokeImage(dataEnums.eImageCommands pCommands, List<Object> pData){
return mImageDataModel.onTrigger(pCommands, pData); return mImageDataModel.onTrigger(pCommands, pData);
} }
/*Trigger SQL Cipher Database*/
public Object invokeSQLCipher(dataEnums.eSqlCipherCommands pCommands, List<Object> pData){
return mSqlCipherDataModel.onTrigger(pCommands, pData);
}
/*Helper Methods*/
public void clearData(AppCompatActivity mContext){
dataController.getInstance().initialize(mContext);
status.sSettingIsAppStarted = false;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_HISTORY,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SEARCH_SUGGESTION,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_JAVA_SCRIPT,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_HISTORY_CLEAR,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_GATEWAY_MANUAL,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_IS_WELCOME_ENABLED,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.PROXY_IS_APP_RATED,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.VPN_ENABLED,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.BRIDGE_ENABLES,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FONT_ADJUSTABLE,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_ZOOM,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_VOICE_INPUT,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_TRACKING_PROTECTION, ContentBlocking.AntiTracking.DEFAULT));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_DONOT_TRACK,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_FLOAT, Arrays.asList(keys.SETTING_FONT_SIZE,100));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE, strings.SETTING_DEFAULT_LANGUAGE));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_LANGUAGE_REGION,strings.SETTING_DEFAULT_LANGUAGE_REGION));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SETTING_SEARCH_ENGINE, constants.CONST_BACKEND_GENESIS_URL));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_BRIDGE_1,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_NOTIFICATION_STATUS,1));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_RESTORE_TAB,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_CHARACTER_ENCODING,false));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_SHOW_IMAGES,0));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_FONTS,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_TOOLBAR_THEME,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_FULL_SCREEN_BROWSIING,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.SETTING_THEME, enums.Theme.THEME_DEFAULT));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_LIST_VIEW,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_SHOW_TAB_GRID,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_OPEN_URL_IN_NEW_TAB,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.SETTING_POPUP,true));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.BRIDGE_CUSTOM_TYPE,strings.BRIDGE_CUSTOM_BRIDGE_OBFS4));
invokeSQLCipher(dataEnums.eSqlCipherCommands.M_INIT, Collections.singletonList(mContext));
invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_HISTORY,null));
invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_BOOKMARK,null));
invokeSQLCipher(dataEnums.eSqlCipherCommands.M_EXEC_SQL, Arrays.asList(SQL_CLEAR_TAB,null));
status.initStatus(mContext);
}
} }

View File

@ -2,11 +2,16 @@ package com.darkweb.genesissearchengine.dataManager;
public class dataEnums public class dataEnums
{ {
/*Settings Manager*/ /* Triggers */
public enum eHistoryCommands { public enum eHistoryCommands {
M_GET_HISTORY, M_ADD_HISTORY, M_REMOVE_HISTORY, M_CLEAR_HISTORY,M_LOAD_MORE_HISTORY ,M_INITIALIZE_HISTORY, M_HISTORY_SIZE M_GET_HISTORY, M_ADD_HISTORY, M_REMOVE_HISTORY, M_CLEAR_HISTORY,M_LOAD_MORE_HISTORY ,M_INITIALIZE_HISTORY, M_HISTORY_SIZE
} }
public enum eSqlCipherCommands {
M_INIT, M_EXEC_SQL, M_SELECT_BOOKMARK, M_SELECT_HISTORY, M_SELECT_TABS, M_HISTORY_ID, M_DELETE_FROM_HISTORY
}
public enum eBookmarkCommands { public enum eBookmarkCommands {
M_ADD_BOOKMARK, M_GET_BOOKMARK, M_DELETE_BOOKMARK, M_CLEAR_BOOKMARK; M_ADD_BOOKMARK, M_GET_BOOKMARK, M_DELETE_BOOKMARK, M_CLEAR_BOOKMARK;
} }
@ -39,4 +44,17 @@ public class dataEnums
M_GET_HELP, M_SET_HELP M_GET_HELP, M_SET_HELP
} }
/* Callbacks */
public enum eHistoryCallbackCommands {
M_EXEC_SQL
}
public enum eTabCallbackCommands {
M_EXEC_SQL
}
public enum eBookmarkCallbackCommands {
M_EXEC_SQL
}
} }

View File

@ -7,12 +7,18 @@ import java.util.List;
@SuppressLint("CommitPrefEdits") @SuppressLint("CommitPrefEdits")
class helpDataModel class helpDataModel
{ {
/* Local Variables */
private ArrayList<helpDataModel> mHelpListModel; private ArrayList<helpDataModel> mHelpListModel;
/* Initializations */
helpDataModel(){ helpDataModel(){
mHelpListModel = new ArrayList<>(); mHelpListModel = new ArrayList<>();
} }
/* Helper Methods */
ArrayList<helpDataModel> getHelpModel(){ ArrayList<helpDataModel> getHelpModel(){
return mHelpListModel; return mHelpListModel;
} }
@ -22,10 +28,8 @@ class helpDataModel
mHelpListModel.addAll(pHelpListModel); mHelpListModel.addAll(pHelpListModel);
} }
/*List Tabs*/ /* External Triggers */
/*List Suggestion*/
public Object onTrigger(dataEnums.eHelpCommands pCommands, List<Object> pData){ public Object onTrigger(dataEnums.eHelpCommands pCommands, List<Object> pData){
if(pCommands.equals(dataEnums.eHelpCommands.M_GET_HELP)){ if(pCommands.equals(dataEnums.eHelpCommands.M_GET_HELP)){
return getHelpModel(); return getHelpModel();

View File

@ -1,12 +1,13 @@
package com.darkweb.genesissearchengine.dataManager; package com.darkweb.genesissearchengine.dataManager;
import com.darkweb.genesissearchengine.databaseManager.databaseController; import com.darkweb.genesissearchengine.dataManager.models.historyRowModel;
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -15,16 +16,24 @@ import java.util.Map;
public class historyDataModel { public class historyDataModel {
/* Local Variables */
private eventObserver.eventListener mExternalEvents;
private int mMaxHistoryId = 0; private int mMaxHistoryId = 0;
private int mHistorySize = 0; private int mHistorySize = 0;
private ArrayList<historyRowModel> mHistory; private ArrayList<historyRowModel> mHistory;
private Map<Integer, historyRowModel> mHistoryCache; private Map<Integer, historyRowModel> mHistoryCache;
public historyDataModel(){ public historyDataModel(eventObserver.eventListener pExternalEvents){
mHistory = new ArrayList<>(); mHistory = new ArrayList<>();
mHistoryCache = new HashMap<>(); mHistoryCache = new HashMap<>();
mExternalEvents = pExternalEvents;
} }
/* Initializations */
void initializeHistory(ArrayList<historyRowModel> history, int pMaxHistoryId, int pHistorySize){ void initializeHistory(ArrayList<historyRowModel> history, int pMaxHistoryId, int pHistorySize){
mMaxHistoryId = pMaxHistoryId; mMaxHistoryId = pMaxHistoryId;
mHistorySize = pHistorySize; mHistorySize = pHistorySize;
@ -44,6 +53,8 @@ public class historyDataModel {
} }
} }
/* Helper Methods */
private ArrayList<historyRowModel> getHistory() { private ArrayList<historyRowModel> getHistory() {
return mHistory; return mHistory;
} }
@ -68,7 +79,7 @@ public class historyDataModel {
cal.setTime(mHistory.get(m_count).getDate()); cal.setTime(mHistory.get(m_count).getDate());
if (dayOfYear == cal.get(Calendar.DAY_OF_YEAR)) { if (dayOfYear == cal.get(Calendar.DAY_OF_YEAR)) {
databaseController.getInstance().execSQL("DELETE FROM history WHERE id = " + mHistory.get(m_count).getID(), null); mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM history WHERE id = " + mHistory.get(m_count).getID(), null), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL);
mHistoryCache.remove(mHistory.get(m_count).getID()); mHistoryCache.remove(mHistory.get(m_count).getID());
mHistory.remove(m_count); mHistory.remove(m_count);
m_count = m_count-1; m_count = m_count-1;
@ -97,12 +108,12 @@ public class historyDataModel {
params[0] = pUrl; params[0] = pUrl;
params[1] = pHeader; params[1] = pHeader;
String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime()); String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime());
databaseController.getInstance().execSQL("UPDATE history SET date = '" + m_date + "' , url = ? , title = ? WHERE id="+pID,params); mExternalEvents.invokeObserver(Arrays.asList("UPDATE history SET date = '" + m_date + "' , url = ? , title = ? WHERE id="+pID,params), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL);
return pID; return pID;
}else { }else {
if(mHistorySize > constants.CONST_MAX_LIST_DATA_SIZE) if(mHistorySize > constants.CONST_MAX_LIST_DATA_SIZE)
{ {
databaseController.getInstance().execSQL("DELETE FROM history WHERE id IN (SELECT id FROM History ORDER BY id ASC LIMIT "+(constants.CONST_MAX_LIST_DATA_SIZE /2)+")",null); mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM history WHERE id IN (SELECT id FROM History ORDER BY id ASC LIMIT "+(constants.CONST_MAX_LIST_DATA_SIZE /2)+")",null), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL);
} }
if(pHeader.equals("loading")){ if(pHeader.equals("loading")){
@ -119,7 +130,7 @@ public class historyDataModel {
String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime()); String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime());
if(!pHeader.equals("loading")){ if(!pHeader.equals("loading")){
databaseController.getInstance().execSQL("REPLACE INTO history(id,date,url,title) VALUES("+ mMaxHistoryId +",'" + m_date + "',?,?);",params); mExternalEvents.invokeObserver(Arrays.asList("REPLACE INTO history(id,date,url,title) VALUES("+ mMaxHistoryId +",'" + m_date + "',?,?);",params), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL);
} }
mHistory.add(0,new historyRowModel(pHeader,pUrl, mMaxHistoryId)); mHistory.add(0,new historyRowModel(pHeader,pUrl, mMaxHistoryId));
@ -129,13 +140,12 @@ public class historyDataModel {
} }
} }
private void removeHistory(int pID){ private void removeHistory(int pID){
databaseController.getInstance().execSQL("DELETE FROM history WHERE id = "+pID,null); mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM history WHERE id = "+pID,null), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL);
databaseController.getInstance().selectHistory(0,constants.CONST_FETCHABLE_LIST_SIZE);
mHistoryCache.remove(pID); mHistoryCache.remove(pID);
mHistorySize -= 1; mHistorySize -= 1;
} }
private void clearHistory(){ private void clearHistory(){
databaseController.getInstance().execSQL("DELETE FROM history WHERE 1 ",null); mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM history WHERE 1 ",null), dataEnums.eHistoryCallbackCommands.M_EXEC_SQL);
mHistory.clear(); mHistory.clear();
mHistoryCache.clear(); mHistoryCache.clear();
} }
@ -148,6 +158,8 @@ public class historyDataModel {
return pHistory.size() > 0; return pHistory.size() > 0;
} }
/* External Triggers */
public Object onTrigger(dataEnums.eHistoryCommands pCommands, List<Object> pData){ public Object onTrigger(dataEnums.eHistoryCommands pCommands, List<Object> pData){
if(pCommands == dataEnums.eHistoryCommands.M_GET_HISTORY){ if(pCommands == dataEnums.eHistoryCommands.M_GET_HISTORY){
return getHistory(); return getHistory();

View File

@ -4,7 +4,7 @@ import android.annotation.SuppressLint;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.dataManager.models.imageManagerModel; import com.darkweb.genesissearchengine.dataManager.models.imageRowModel;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -15,17 +15,22 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static com.darkweb.genesissearchengine.constants.constants.CONST_PROXY_SOCKS;
import static com.darkweb.genesissearchengine.constants.enums.ImageQueueStatus.M_IMAGE_LOADED_SUCCESSFULLY; import static com.darkweb.genesissearchengine.constants.constants.*;
import static com.darkweb.genesissearchengine.constants.enums.ImageQueueStatus.M_IMAGE_LOADING_FAILED; import static com.darkweb.genesissearchengine.constants.enums.ImageQueueStatus.*;
@SuppressLint("CommitPrefEdits") @SuppressLint("CommitPrefEdits")
class imageDataModel class imageDataModel
{ {
private Map<String, imageManagerModel> mImageCache;
/* Local Variables */
private Map<String, imageRowModel> mImageCache;
private Map<String, Integer> mParsedQueues; private Map<String, Integer> mParsedQueues;
private ArrayList<String> mRequestQueue; private ArrayList<String> mRequestQueue;
/* Initializations */
public imageDataModel(){ public imageDataModel(){
mImageCache = new HashMap<>(); mImageCache = new HashMap<>();
mParsedQueues = new HashMap<>(); mParsedQueues = new HashMap<>();
@ -34,6 +39,7 @@ class imageDataModel
mBackgroundThread(); mBackgroundThread();
} }
/* Helper Methods */
private void onRequestImage(String mURL){ private void onRequestImage(String mURL){
String mCraftedURL = helperMethod.completeURL(helperMethod.getDomainName(mURL))+"/favicon.ico"; String mCraftedURL = helperMethod.completeURL(helperMethod.getDomainName(mURL))+"/favicon.ico";
@ -61,10 +67,10 @@ class imageDataModel
mParsedQueues.put(mRequestQueue.get(0), enums.ImageQueueStatus.M_IMAGE_LOADING); mParsedQueues.put(mRequestQueue.get(0), enums.ImageQueueStatus.M_IMAGE_LOADING);
Bitmap mBitmap = getBitmapFromURL(mRequestQueue.get(0)); Bitmap mBitmap = getBitmapFromURL(mRequestQueue.get(0));
if(mBitmap==null){ if(mBitmap==null){
mParsedQueues.put(mRequestQueue.get(0), enums.ImageQueueStatus.M_IMAGE_LOADING_FAILED); mParsedQueues.put(mRequestQueue.get(0), M_IMAGE_LOADING_FAILED);
}else { }else {
mParsedQueues.put(mRequestQueue.get(0), M_IMAGE_LOADED_SUCCESSFULLY); mParsedQueues.put(mRequestQueue.get(0), M_IMAGE_LOADED_SUCCESSFULLY);
mImageCache.put(mRequestQueue.get(0), new imageManagerModel(helperMethod.createRandomID(), "",mRequestQueue.get(0),mBitmap)); mImageCache.put(mRequestQueue.get(0), new imageRowModel(helperMethod.createRandomID(), "",mRequestQueue.get(0),mBitmap));
} }
mRequestQueue.remove(0); mRequestQueue.remove(0);
} }
@ -93,7 +99,8 @@ class imageDataModel
} }
} }
/*List Suggestion*/ /* External Triggers */
public Object onTrigger(dataEnums.eImageCommands pCommands, List<Object> pData){ public Object onTrigger(dataEnums.eImageCommands pCommands, List<Object> pData){
if(pCommands.equals(dataEnums.eImageCommands.M_REQUEST_IMAGE_URL)){ if(pCommands.equals(dataEnums.eImageCommands.M_REQUEST_IMAGE_URL)){

View File

@ -1,4 +1,4 @@
package com.darkweb.genesissearchengine.appManager.bookmarkManager; package com.darkweb.genesissearchengine.dataManager.models;
import android.widget.ImageView; import android.widget.ImageView;
import java.util.Calendar; import java.util.Calendar;

View File

@ -1,6 +1,5 @@
package com.darkweb.genesissearchengine.appManager.historyManager; package com.darkweb.genesissearchengine.dataManager.models;
import android.os.Handler;
import android.widget.ImageView; import android.widget.ImageView;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;

View File

@ -1,9 +1,8 @@
package com.darkweb.genesissearchengine.dataManager.models; package com.darkweb.genesissearchengine.dataManager.models;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import java.util.Date;
public class imageManagerModel public class imageRowModel
{ {
/*Private Variables*/ /*Private Variables*/
@ -13,7 +12,7 @@ public class imageManagerModel
private Bitmap mImage; private Bitmap mImage;
/*Initializations*/ /*Initializations*/
public imageManagerModel(String pID, String pCreationDate, String pURL, Bitmap pImage){ public imageRowModel(String pID, String pCreationDate, String pURL, Bitmap pImage){
mID = pID; mID = pID;
mCreationDate = pCreationDate; mCreationDate = pCreationDate;
mURL = pURL; mURL = pURL;

View File

@ -1,4 +1,4 @@
package com.darkweb.genesissearchengine.appManager.tabManager; package com.darkweb.genesissearchengine.dataManager.models;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;

View File

@ -1,22 +1,29 @@
package com.darkweb.genesissearchengine.dataManager; package com.darkweb.genesissearchengine.dataManager;
import android.annotation.SuppressLint;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import java.util.List; import java.util.List;
public class preferenceDataModel { public class preferenceDataModel {
/* Local Variables */
private SharedPreferences mPrefs; private SharedPreferences mPrefs;
private SharedPreferences.Editor mEdit; private SharedPreferences.Editor mEdit;
/* Initializations */
@SuppressLint("CommitPrefEdits")
public preferenceDataModel(AppCompatActivity pAppContext){ public preferenceDataModel(AppCompatActivity pAppContext){
mPrefs = PreferenceManager.getDefaultSharedPreferences(pAppContext); mPrefs = PreferenceManager.getDefaultSharedPreferences(pAppContext);
mEdit = mPrefs.edit(); mEdit = mPrefs.edit();
} }
/* Helper Methods */
void clearPrefs(){ void clearPrefs(){
mEdit.clear(); mEdit.clear();
mEdit.apply(); mEdit.apply();
@ -51,6 +58,8 @@ public class preferenceDataModel {
return mPrefs.getInt(pValueKey, pValueDefault); return mPrefs.getInt(pValueKey, pValueDefault);
} }
/* External Triggers */
public Object onTrigger(dataEnums.ePreferencesCommands pCommands, List<Object> pData){ public Object onTrigger(dataEnums.ePreferencesCommands pCommands, List<Object> pData){
if(pCommands == dataEnums.ePreferencesCommands.M_GET_BOOL){ if(pCommands == dataEnums.ePreferencesCommands.M_GET_BOOL){
return getBool((String)pData.get(0), (boolean)pData.get(1)); return getBool((String)pData.get(0), (boolean)pData.get(1));

View File

@ -8,23 +8,25 @@ import com.android.volley.toolbox.Volley;
import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_REFERENCE_WEBSITES; import static com.darkweb.genesissearchengine.constants.constants.*;
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_REFERENCE_WEBSITES_DEV;
import static com.darkweb.genesissearchengine.constants.constants.CONST_SERVER;
import static com.darkweb.genesissearchengine.constants.constants.CONST_SERVER_DEV;
public class referenceWebsiteDataModel { public class referenceWebsiteDataModel {
private String mReferenceWebsiteData = "null"; /* Local Variables */
private String mReferenceWebsiteData;
private boolean mLoading = false; private boolean mLoading = false;
/* Initializations */
public referenceWebsiteDataModel(){ public referenceWebsiteDataModel(){
mReferenceWebsiteData = status.sReferenceWebsites; mReferenceWebsiteData = status.sReferenceWebsites;
} }
/* Helper Methods */
private void onLoad(Context pContext){ private void onLoad(Context pContext){
if(!mLoading){ if(!mLoading){
mLoading = true; mLoading = true;
@ -64,6 +66,8 @@ public class referenceWebsiteDataModel {
return strings.GENERIC_EMPTY_SPACE; return strings.GENERIC_EMPTY_SPACE;
} }
/* External Triggers */
public Object onTrigger(dataEnums.eReferenceWebsiteCommands p_commands, List<Object> pData){ public Object onTrigger(dataEnums.eReferenceWebsiteCommands p_commands, List<Object> pData){
if(p_commands == dataEnums.eReferenceWebsiteCommands.M_LOAD){ if(p_commands == dataEnums.eReferenceWebsiteCommands.M_LOAD){
onLoad((Context) pData.get(0)); onLoad((Context) pData.get(0));

View File

@ -1,13 +1,12 @@
package com.darkweb.genesissearchengine.databaseManager; package com.darkweb.genesissearchengine.dataManager;
import android.content.ContentValues;
import android.database.Cursor; import android.database.Cursor;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkRowModel; import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel;
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel; import com.darkweb.genesissearchengine.dataManager.models.historyRowModel;
import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession;
import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel; import com.darkweb.genesissearchengine.dataManager.models.tabRowModel;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import net.sqlcipher.database.SQLiteDatabaseHook; import net.sqlcipher.database.SQLiteDatabaseHook;
import net.sqlcipher.database.SQLiteDatabase; import net.sqlcipher.database.SQLiteDatabase;
@ -17,28 +16,23 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Objects; import java.util.Objects;
import static com.darkweb.genesissearchengine.constants.constants.CONST_DATABASE_NAME; import static com.darkweb.genesissearchengine.constants.constants.CONST_DATABASE_NAME;
public class databaseController public class sqlCipherDataModel
{ {
/*Private Variables*/ /*Private Variables*/
private static final databaseController sOurInstance = new databaseController();
private static SQLiteDatabase sDatabaseInstance; private static SQLiteDatabase sDatabaseInstance;
public static databaseController getInstance()
{
return sOurInstance;
}
/*Initializations*/ /*Initializations*/
public void prepareDatabaseEnvironment(AppCompatActivity app_context) { private void prepareDatabaseEnvironment(AppCompatActivity app_context) {
File databaseFile = app_context.getDatabasePath(CONST_DATABASE_NAME + "_SECURE"); File databaseFile = app_context.getDatabasePath(CONST_DATABASE_NAME + "_SECURE");
if (!databaseFile.exists()) { if (!databaseFile.exists()) {
@ -46,7 +40,7 @@ public class databaseController
} }
} }
public void initialize(AppCompatActivity app_context) private void initialize(AppCompatActivity app_context)
{ {
try try
{ {
@ -68,7 +62,7 @@ public class databaseController
/*Helper Methods*/ /*Helper Methods*/
public SQLiteDatabaseHook wrapHook(final SQLiteDatabaseHook hook) { private SQLiteDatabaseHook wrapHook(final SQLiteDatabaseHook hook) {
if (hook == null) if (hook == null)
{ {
return keyHook; return keyHook;
@ -100,7 +94,7 @@ public class databaseController
} }
}; };
public void execSQL(String query,String[] params) private void execSQL(String query,String[] params)
{ {
if(params==null) if(params==null)
{ {
@ -112,15 +106,7 @@ public class databaseController
} }
} }
public void execTab(String query, ContentValues params,String pID) private ArrayList<historyRowModel> selectHistory(int pStartIndex,int pEndIndex){
{
if(params!=null)
{
sDatabaseInstance.update(query, params, "mid = ?", new String[]{pID});
}
}
public ArrayList<historyRowModel> selectHistory(int pStartIndex,int pEndIndex){
ArrayList<historyRowModel> tempmodel = new ArrayList<>(); ArrayList<historyRowModel> tempmodel = new ArrayList<>();
Cursor c = sDatabaseInstance.rawQuery("SELECT * FROM history ORDER BY date DESC LIMIT " + pEndIndex + " OFFSET "+pStartIndex, null); Cursor c = sDatabaseInstance.rawQuery("SELECT * FROM history ORDER BY date DESC LIMIT " + pEndIndex + " OFFSET "+pStartIndex, null);
@ -145,7 +131,7 @@ public class databaseController
return tempmodel; return tempmodel;
} }
public ArrayList<tabRowModel> selectTabs(){ private ArrayList<tabRowModel> selectTabs(){
ArrayList<tabRowModel> mTempListModel = new ArrayList<>(); ArrayList<tabRowModel> mTempListModel = new ArrayList<>();
Cursor c = sDatabaseInstance.rawQuery("SELECT * FROM tab ORDER BY date ASC", null); Cursor c = sDatabaseInstance.rawQuery("SELECT * FROM tab ORDER BY date ASC", null);
@ -175,7 +161,7 @@ public class databaseController
return mTempListModel; return mTempListModel;
} }
public int getLargestHistoryID(){ private int getLargestHistoryID(){
int id = 0; int id = 0;
Cursor c = sDatabaseInstance.rawQuery("SELECT max(id) FROM history", null); Cursor c = sDatabaseInstance.rawQuery("SELECT max(id) FROM history", null);
@ -193,7 +179,7 @@ public class databaseController
return id; return id;
} }
public ArrayList<bookmarkRowModel> selectBookmark(){ private ArrayList<bookmarkRowModel> selectBookmark(){
ArrayList<bookmarkRowModel> tempmodel = new ArrayList<>(); ArrayList<bookmarkRowModel> tempmodel = new ArrayList<>();
Cursor c = sDatabaseInstance.rawQuery("SELECT * FROM bookmark ORDER BY id DESC ", null); Cursor c = sDatabaseInstance.rawQuery("SELECT * FROM bookmark ORDER BY id DESC ", null);
@ -207,8 +193,36 @@ public class databaseController
return tempmodel; return tempmodel;
} }
public void deleteFromList(int index,String table) { private void deleteFromList(int index,String table) {
databaseController.getInstance().execSQL("delete from "+table+" where id="+index,null); execSQL("delete from "+table+" where id="+index,null);
}
/* External Triggers */
public Object onTrigger(dataEnums.eSqlCipherCommands pCommands, List<Object> pData){
if(pCommands == dataEnums.eSqlCipherCommands.M_INIT){
initialize((AppCompatActivity)pData.get(0));
}
else if(pCommands == dataEnums.eSqlCipherCommands.M_EXEC_SQL){
execSQL((String)pData.get(0), (String[])pData.get(1));
}
else if(pCommands == dataEnums.eSqlCipherCommands.M_SELECT_BOOKMARK){
return selectBookmark();
}
else if(pCommands == dataEnums.eSqlCipherCommands.M_SELECT_HISTORY){
return selectHistory((int)pData.get(0), (int)pData.get(1));
}
else if(pCommands == dataEnums.eSqlCipherCommands.M_SELECT_TABS){
return selectTabs();
}
else if(pCommands == dataEnums.eSqlCipherCommands.M_HISTORY_ID){
return getLargestHistoryID();
}
else if(pCommands == dataEnums.eSqlCipherCommands.M_DELETE_FROM_HISTORY){
deleteFromList((int)pData.get(0), (String)pData.get(1));
}
return null;
} }
} }

View File

@ -4,15 +4,13 @@ import android.content.Context;
import android.view.textservice.SentenceSuggestionsInfo; import android.view.textservice.SentenceSuggestionsInfo;
import android.view.textservice.SpellCheckerSession; import android.view.textservice.SpellCheckerSession;
import android.view.textservice.SuggestionsInfo; import android.view.textservice.SuggestionsInfo;
import android.view.textservice.TextServicesManager;
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkRowModel; import com.darkweb.genesissearchengine.dataManager.models.bookmarkRowModel;
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel; import com.darkweb.genesissearchengine.dataManager.models.historyRowModel;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import org.mozilla.gecko.util.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -20,8 +18,6 @@ public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSess
/*Private Variables*/ /*Private Variables*/
private SpellCheckerSession mSpellCheckerSession;
private TextServicesManager mTextServicesManager;
private ArrayList<historyRowModel> mHintListLocalCache; private ArrayList<historyRowModel> mHintListLocalCache;
private ArrayList<historyRowModel> mCurrentList = new ArrayList<>(); private ArrayList<historyRowModel> mCurrentList = new ArrayList<>();
@ -29,16 +25,12 @@ public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSess
/*Initializations*/ /*Initializations*/
public suggestionDataModel(Context mContext){ public suggestionDataModel(Context mContext){
mTextServicesManager = (TextServicesManager) mContext.getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE);
mSpellCheckerSession = mTextServicesManager.newSpellCheckerSession(null, null, this, true);
mHintListLocalCache = initSuggestions(); mHintListLocalCache = initSuggestions();
} }
/*Helper Methods*/ /*Helper Methods*/
private ArrayList<historyRowModel> getDefaultSuggestionsOnStart(String pQuery){
private ArrayList<historyRowModel> getDefaultSuggestionsOnStart(String pQuery, int mSize, ArrayList<String> mDuplicationHandler, boolean pDefaultHostChaned){
if(pQuery.equals(strings.GENERIC_EMPTY_STR) || pQuery.trim().isEmpty()) { if(pQuery.equals(strings.GENERIC_EMPTY_STR) || pQuery.trim().isEmpty()) {
pQuery = "hidden web"; pQuery = "hidden web";
@ -123,7 +115,6 @@ public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSess
} }
mCurrentList = new ArrayList<>(); mCurrentList = new ArrayList<>();
mCurrentList.clear();
String mQueryOriginal = pQuery; String mQueryOriginal = pQuery;
pQuery = pQuery.replace("+","%").replace(" ","+"); pQuery = pQuery.replace("+","%").replace(" ","+");
ArrayList<historyRowModel> mHistory = pHistory; ArrayList<historyRowModel> mHistory = pHistory;
@ -354,7 +345,7 @@ public class suggestionDataModel implements SpellCheckerSession.SpellCheckerSess
} }
else if(pCommands == dataEnums.eSuggestionCommands.M_GET_DEFAULT_SUGGESTION) else if(pCommands == dataEnums.eSuggestionCommands.M_GET_DEFAULT_SUGGESTION)
{ {
return getDefaultSuggestionsOnStart((String) pData.get(0),0, null, false); return getDefaultSuggestionsOnStart((String) pData.get(0));
} }
return null; return null;

View File

@ -4,28 +4,20 @@ import android.annotation.SuppressLint;
import android.content.ContentValues; import android.content.ContentValues;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.os.Handler;
import android.os.Message;
import android.util.Log; import android.util.Log;
import android.widget.ImageView; import android.widget.ImageView;
import androidx.annotation.NonNull;
import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.databaseManager.databaseController;
import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession; import com.darkweb.genesissearchengine.appManager.homeManager.geckoManager.geckoSession;
import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel; import com.darkweb.genesissearchengine.dataManager.models.tabRowModel;
import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.eventObserver;
import org.mozilla.geckoview.GeckoResult; import org.mozilla.geckoview.GeckoResult;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.GeckoView;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.sql.PreparedStatement;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -33,17 +25,28 @@ import java.util.Locale;
@SuppressLint("CommitPrefEdits") @SuppressLint("CommitPrefEdits")
class tabDataModel class tabDataModel
{ {
private ArrayList<tabRowModel> mTabs = new ArrayList<>();
ArrayList<tabRowModel> getTab(){ /* Local Variables */
return mTabs;
private eventObserver.eventListener mExternalEvents;
/* Initializations */
public tabDataModel(eventObserver.eventListener pExternalEvents){
mExternalEvents = pExternalEvents;
} }
/*List Tabs*/ private ArrayList<tabRowModel> mTabs = new ArrayList<>();
void initializeTab(ArrayList<tabRowModel> pTabMdel){ void initializeTab(ArrayList<tabRowModel> pTabMdel){
mTabs.addAll(pTabMdel); mTabs.addAll(pTabMdel);
} }
/* Helper Methods */
ArrayList<tabRowModel> getTab(){
return mTabs;
}
geckoSession getHomePage(){ geckoSession getHomePage(){
if(mTabs.size()>0){ if(mTabs.size()>0){
return mTabs.get(0).getSession(); return mTabs.get(0).getSession();
@ -76,7 +79,7 @@ class tabDataModel
return enums.AddTabCallback.TAB_ADDED; return enums.AddTabCallback.TAB_ADDED;
} }
databaseController.getInstance().execSQL("REPLACE INTO tab(mid,date,title,url,theme) VALUES('"+ mTabModel.getmId() +"','" + m_date + "',?,?,?);",params); mExternalEvents.invokeObserver(Arrays.asList("REPLACE INTO tab(mid,date,title,url,theme) VALUES('"+ mTabModel.getmId() +"','" + m_date + "',?,?,?);",params), dataEnums.eTabCallbackCommands.M_EXEC_SQL);
} }
return enums.AddTabCallback.TAB_ADDED; return enums.AddTabCallback.TAB_ADDED;
} }
@ -95,7 +98,7 @@ class tabDataModel
mTabs.remove(0); mTabs.remove(0);
} }
databaseController.getInstance().execSQL("DELETE FROM tab WHERE 1",null); mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM tab WHERE 1",null), dataEnums.eTabCallbackCommands.M_EXEC_SQL);
} }
@ -115,7 +118,8 @@ class tabDataModel
break; break;
} }
} }
databaseController.getInstance().execSQL("DELETE FROM tab WHERE mid='" + mID + "'",null);
mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM tab WHERE mid='" + mID + "'",null), dataEnums.eTabCallbackCommands.M_EXEC_SQL);
}else { }else {
for(int counter = 0; counter< mTabs.size(); counter++){ for(int counter = 0; counter< mTabs.size(); counter++){
if(mTabs.get(counter).getSession().getSessionID().equals(mSession.getSessionID())) if(mTabs.get(counter).getSession().getSessionID().equals(mSession.getSessionID()))
@ -126,7 +130,7 @@ class tabDataModel
break; break;
} }
} }
databaseController.getInstance().execSQL("DELETE FROM tab WHERE mid='" + pID + "'",null); mExternalEvents.invokeObserver(Arrays.asList("DELETE FROM tab WHERE mid='" + pID + "'",null), dataEnums.eTabCallbackCommands.M_EXEC_SQL);
} }
} }
@ -137,7 +141,8 @@ class tabDataModel
if(mTabs.get(counter).getSession().getSessionID().equals(mSession.getSessionID())) if(mTabs.get(counter).getSession().getSessionID().equals(mSession.getSessionID()))
{ {
String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime()); String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime());
databaseController.getInstance().execSQL("UPDATE tab SET date = '" + m_date + "' WHERE mid='"+mTabs.get(counter).getmId() + "'",null);
mExternalEvents.invokeObserver(Arrays.asList("UPDATE tab SET date = '" + m_date + "' WHERE mid='"+mTabs.get(counter).getmId() + "'",null), dataEnums.eTabCallbackCommands.M_EXEC_SQL);
mTabs.add(0,mTabs.remove(counter)); mTabs.add(0,mTabs.remove(counter));
break; break;
} }
@ -154,7 +159,7 @@ class tabDataModel
if(mTabs.get(counter).getSession().getSessionID().equals(mSessionID)) if(mTabs.get(counter).getSession().getSessionID().equals(mSessionID))
{ {
databaseController.getInstance().execSQL("UPDATE tab SET session = '" + mSessionState + "' WHERE mid='"+mTabs.get(counter).getmId() + "'",null); mExternalEvents.invokeObserver(Arrays.asList("UPDATE tab SET session = '" + mSessionState + "' WHERE mid='"+mTabs.get(counter).getmId() + "'",null), dataEnums.eTabCallbackCommands.M_EXEC_SQL);
mTabs.add(0,mTabs.remove(counter)); mTabs.add(0,mTabs.remove(counter));
break; break;
} }
@ -184,7 +189,7 @@ class tabDataModel
return false; return false;
} }
databaseController.getInstance().execSQL("REPLACE INTO tab(mid,date,title,url,theme) VALUES('"+ mTabs.get(counter).getmId() +"','" + m_date + "',?,?,?);",params); mExternalEvents.invokeObserver(Arrays.asList("REPLACE INTO tab(mid,date,title,url,theme) VALUES('"+ mTabs.get(counter).getmId() +"','" + m_date + "',?,?,?);",params), dataEnums.eTabCallbackCommands.M_EXEC_SQL);
return true; return true;
} }
} }
@ -220,39 +225,8 @@ class tabDataModel
} }
} }
@SuppressLint("HandlerLeak")
static Handler handler = new Handler()
{
@Override
public void dispatchMessage(@NonNull Message msg) {
super.dispatchMessage(msg);
}
@NonNull
@Override
public String getMessageName(@NonNull Message message) {
return super.getMessageName(message);
}
@Override
public boolean sendMessageAtTime(@NonNull Message msg, long uptimeMillis) {
return super.sendMessageAtTime(msg, uptimeMillis);
}
@Override
public String toString() {
return super.toString();
}
@Override
public void handleMessage(Message msg)
{
Log.i("FUCK","FUCK");
}
};
// int isLoading = 0; // int isLoading = 0;
public void updatePixels(String pSessionID, GeckoResult<Bitmap> pBitmapManager, ImageView pImageView, GeckoView pGeckoView, boolean pOpenTabView){ public void updatePixels(String pSessionID, GeckoResult<Bitmap> pBitmapManager, ImageView pImageView, boolean pOpenTabView){
new Thread(){ new Thread(){
public void run(){ public void run(){
@ -260,7 +234,6 @@ class tabDataModel
for(int counter = 0; counter< mTabs.size(); counter++) { for(int counter = 0; counter< mTabs.size(); counter++) {
int finalCounter = counter; int finalCounter = counter;
if (mTabs.get(counter).getSession().getSessionID().equals(pSessionID)) { if (mTabs.get(counter).getSession().getSessionID().equals(pSessionID)) {
GeckoResult<Bitmap> mResult = pBitmapManager.withHandler(handler);
Bitmap mBitmap = pBitmapManager.poll(0); Bitmap mBitmap = pBitmapManager.poll(0);
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
@ -274,15 +247,13 @@ class tabDataModel
mTabs.get(finalCounter).setmBitmap(decoded); mTabs.get(finalCounter).setmBitmap(decoded);
if(pImageView!=null){ if(pImageView!=null){
activityContextManager.getInstance().getHomeController().runOnUiThread(() -> { activityContextManager.getInstance().getHomeController().runOnUiThread(() -> pImageView.setImageBitmap(mBitmap));
pImageView.setImageBitmap(mBitmap);
});
} }
byte[] mThumbnail = out.toByteArray(); byte[] mThumbnail = out.toByteArray();
ContentValues mContentValues = new ContentValues(); ContentValues mContentValues = new ContentValues();
mContentValues.put("mThumbnail", mThumbnail); mContentValues.put("mThumbnail", mThumbnail);
databaseController.getInstance().execTab("tab",mContentValues, mTabs.get(finalCounter).getmId()); mExternalEvents.invokeObserver(Arrays.asList("tab",mContentValues, mTabs.get(finalCounter).getmId()), dataEnums.eTabCallbackCommands.M_EXEC_SQL);
} }
} }
} }
@ -360,7 +331,7 @@ class tabDataModel
return getSuggestions((String) pData.get(0)); return getSuggestions((String) pData.get(0));
} }
else if(pCommands == dataEnums.eTabCommands.M_UPDATE_PIXEL){ else if(pCommands == dataEnums.eTabCommands.M_UPDATE_PIXEL){
updatePixels((String)pData.get(0), (GeckoResult<Bitmap>)pData.get(1), (ImageView) pData.get(2), (GeckoView) pData.get(3), (Boolean) pData.get(4)); updatePixels((String)pData.get(0), (GeckoResult<Bitmap>)pData.get(1), (ImageView) pData.get(2), (Boolean) pData.get(4));
} }
else if(pCommands == dataEnums.eTabCommands.M_HOME_PAGE){ else if(pCommands == dataEnums.eTabCommands.M_HOME_PAGE){
return getHomePage(); return getHomePage();
@ -368,5 +339,4 @@ class tabDataModel
return null; return null;
} }
} }

View File

@ -1,130 +0,0 @@
package com.darkweb.genesissearchengine.helperManager;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URI;
import java.net.URLConnection;
import java.util.List;
public class ProxySelector {
public static URLConnection openConnectionWithProxy(final URI uri) throws IOException {
return uri.toURL().openConnection(ProxySettings.getProxy());
}
public ProxySelector() {
}
public Proxy select(String scheme, String host) {
int port = -1;
Proxy proxy = null;
String nonProxyHostsKey = null;
boolean httpProxyOkay = true;
if ("http".equalsIgnoreCase(scheme)) {
port = 80;
nonProxyHostsKey = "http.nonProxyHosts";
proxy = lookupProxy("http.proxyHost", "http.proxyPort", Proxy.Type.HTTP, port);
} else if ("https".equalsIgnoreCase(scheme)) {
port = 443;
nonProxyHostsKey = "https.nonProxyHosts"; // RI doesn't support this
proxy = lookupProxy("https.proxyHost", "https.proxyPort", Proxy.Type.HTTP, port);
} else if ("ftp".equalsIgnoreCase(scheme)) {
port = 80; // not 21 as you might guess
nonProxyHostsKey = "ftp.nonProxyHosts";
proxy = lookupProxy("ftp.proxyHost", "ftp.proxyPort", Proxy.Type.HTTP, port);
} else if ("socket".equalsIgnoreCase(scheme)) {
httpProxyOkay = false;
} else {
return Proxy.NO_PROXY;
}
if (nonProxyHostsKey != null
&& isNonProxyHost(host, System.getProperty(nonProxyHostsKey))) {
return Proxy.NO_PROXY;
}
if (proxy != null) {
return proxy;
}
if (httpProxyOkay) {
proxy = lookupProxy("proxyHost", "proxyPort", Proxy.Type.HTTP, port);
if (proxy != null) {
return proxy;
}
}
proxy = lookupProxy("socksProxyHost", "socksProxyPort", Proxy.Type.SOCKS, 1080);
if (proxy != null) {
return proxy;
}
return Proxy.NO_PROXY;
}
/**
* Returns the proxy identified by the {@code hostKey} system property, or
* null.
*/
@Nullable
private Proxy lookupProxy(String hostKey, String portKey, Proxy.Type type, int defaultPort) {
final String host = System.getProperty(hostKey);
if (TextUtils.isEmpty(host)) {
return null;
}
final int port = getSystemPropertyInt(portKey, defaultPort);
if (port == -1) {
// Port can be -1. See bug 1270529.
return null;
}
return new Proxy(type, InetSocketAddress.createUnresolved(host, port));
}
private int getSystemPropertyInt(String key, int defaultValue) {
String string = System.getProperty(key);
if (string != null) {
try {
return Integer.parseInt(string);
} catch (NumberFormatException ignored) {
}
}
return defaultValue;
}
/**
* Returns true if the {@code nonProxyHosts} system property pattern exists
* and matches {@code host}.
*/
private boolean isNonProxyHost(String host, String nonProxyHosts) {
if (host == null || nonProxyHosts == null) {
return false;
}
// construct pattern
StringBuilder patternBuilder = new StringBuilder();
for (int i = 0; i < nonProxyHosts.length(); i++) {
char c = nonProxyHosts.charAt(i);
switch (c) {
case '.':
patternBuilder.append("\\.");
break;
case '*':
patternBuilder.append(".*");
break;
default:
patternBuilder.append(c);
}
}
// check whether the host is the nonProxyHosts.
String pattern = patternBuilder.toString();
return host.matches(pattern);
}
}

View File

@ -1,21 +0,0 @@
package com.darkweb.genesissearchengine.helperManager;
import java.net.InetSocketAddress;
import java.net.Proxy;
import ch.boye.httpclientandroidlib.HttpHost;
public class ProxySettings {
private static final String TOR_PROXY_ADDRESS = "127.0.0.1";
private static final int TOR_PROXY_PORT = 8118;
public static Proxy getProxy() {
// TODO make configurable
return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(TOR_PROXY_ADDRESS, TOR_PROXY_PORT));
}
public static HttpHost getProxyHost() {
// TODO make configurable
return new HttpHost(TOR_PROXY_ADDRESS, TOR_PROXY_PORT);
}
}

View File

@ -1,102 +0,0 @@
package com.darkweb.genesissearchengine.helperManager;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MotionEvent;
public class SimpleGestureFilter extends SimpleOnGestureListener{
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
float x1 = e1.getX();
float y1 = e1.getY();
float x2 = e2.getX();
float y2 = e2.getY();
Direction direction = getDirection(x1,y1,x2,y2);
return onSwipe(direction);
}
public boolean onSwipe(Direction direction){
return false;
}
/**
* Given two points in the plane p1=(x1, x2) and p2=(y1, y1), this method
* returns the direction that an arrow pointing from p1 to p2 would have.
* @param x1 the x position of the first point
* @param y1 the y position of the first point
* @param x2 the x position of the second point
* @param y2 the y position of the second point
* @return the direction
*/
public Direction getDirection(float x1, float y1, float x2, float y2){
double angle = getAngle(x1, y1, x2, y2);
return Direction.get(angle);
}
/**
*
* Finds the angle between two points in the plane (x1,y1) and (x2, y2)
* The angle is measured with 0/360 being the X-axis to the right, angles
* increase counter clockwise.
*
* @param x1 the x position of the first point
* @param y1 the y position of the first point
* @param x2 the x position of the second point
* @param y2 the y position of the second point
* @return the angle between two points
*/
public double getAngle(float x1, float y1, float x2, float y2) {
double rad = Math.atan2(y1-y2,x2-x1) + Math.PI;
return (rad*180/Math.PI + 180)%360;
}
public enum Direction{
up,
down,
left,
right;
/**
* Returns a direction given an angle.
* Directions are defined as follows:
*
* Up: [45, 135]
* Right: [0,45] and [315, 360]
* Down: [225, 315]
* Left: [135, 225]
*
* @param angle an angle from 0 to 360 - e
* @return the direction of an angle
*/
public static Direction get(double angle){
if(inRange(angle, 45, 135)){
return Direction.up;
}
else if(inRange(angle, 0,45) || inRange(angle, 315, 360)){
return Direction.right;
}
else if(inRange(angle, 225, 315)){
return Direction.down;
}
else{
return Direction.left;
}
}
/**
* @param angle an angle
* @param init the initial bound
* @param end the final bound
* @return returns true if the given angle is in the interval [init, end).
*/
private static boolean inRange(double angle, float init, float end){
return (angle >= init) && (angle < end);
}
}
}

View File

@ -700,7 +700,7 @@ public class helperMethod
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){ if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){
try { try {
Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.provider.dev", url); Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.production.provider", url);
Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(url.toString())); Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(url.toString()));
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@ -711,7 +711,7 @@ public class helperMethod
} }
} else{ } else{
try { try {
Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.provider.dev", url); Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.production.provider", url);
Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(url.toString())); Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(url.toString()));
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

View File

@ -1,91 +0,0 @@
package com.darkweb.genesissearchengine.helperManager;
import android.app.Notification ;
import android.app.NotificationChannel ;
import android.app.NotificationManager ;
import android.app.PendingIntent;
import android.content.BroadcastReceiver ;
import android.content.Context ;
import android.content.Intent ;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.os.Build;
import androidx.core.app.NotificationCompat;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.example.myapplication.R;
import java.util.Random;
public class userEngagementNotification extends BroadcastReceiver {
public void onReceive (Context context , Intent intent) {
final int NOTIFY_ID = status.mNotificationID;
String pTitle = strings.NOTIFICATION_TITLE;
String pBody = strings.NOTIFICATION_BODY[new Random().nextInt(strings.NOTIFICATION_BODY.length)];
// There are hardcoding only for show it's just strings
String name = "NOTIFICATION:INDENTIFIER:1001";
String id = "NOTIFICATION:INDENTIFIER:1001"; // The user-visible name of the channel.
String description = "NOTIFICATION:INDENTIFIER:1001"; // The user-visible description of the channel.
NotificationCompat.Builder builder;
NotificationManager mNotifManager = (NotificationManager)context.getSystemService(Context. NOTIFICATION_SERVICE ) ;
if (mNotifManager == null) {
mNotifManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
int importance = NotificationManager.IMPORTANCE_HIGH;
NotificationChannel mChannel = mNotifManager.getNotificationChannel(id);
if (mChannel == null) {
mChannel = new NotificationChannel(id, name, importance);
mChannel.setDescription(description);
mChannel.enableVibration(true);
mChannel.setLightColor(Color.GREEN);
mChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400});
mNotifManager.createNotificationChannel(mChannel);
}
builder = new NotificationCompat.Builder(context, id);
PackageManager pm = context.getPackageManager();
Intent mIntent = activityContextManager.getInstance().getHomeController().getIntent();
PendingIntent pendIntent = PendingIntent.getActivity(activityContextManager.getInstance().getCurrentActivity(), 0, mIntent, PendingIntent.FLAG_ONE_SHOT);
builder.setContentTitle(pTitle) // required
.setSmallIcon(R.drawable.notification_logo) // required
.setContentText(pBody) // required
.setDefaults(Notification.DEFAULT_ALL)
.setAutoCancel(true)
.setCategory(Notification.CATEGORY_SERVICE)
.setContentIntent(pendIntent)
.setTicker(pTitle)
.setVibrate(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400});
} else {
builder = new NotificationCompat.Builder(context);
PackageManager pm = context.getPackageManager();
Intent mIntent = activityContextManager.getInstance().getHomeController().getIntent();
PendingIntent pendIntent = PendingIntent.getActivity(activityContextManager.getInstance().getCurrentActivity(), 0, mIntent, PendingIntent. FLAG_ONE_SHOT);
builder.setContentTitle(pTitle) // required
.setSmallIcon(R.drawable.notification_logo) // required
.setContentText(pBody) // required
.setDefaults(Notification.DEFAULT_ALL)
.setAutoCancel(true)
.setContentIntent(pendIntent)
.setCategory(Notification.CATEGORY_SERVICE)
.setTicker(pTitle)
.setVibrate(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400})
.setPriority(Notification.PRIORITY_HIGH);
}
Notification notification = builder.build();
mNotifManager.notify(NOTIFY_ID, notification);
}
}

View File

@ -1,4 +1,4 @@
package com.darkweb.genesissearchengine.clientauth; package com.darkweb.genesissearchengine.libs.clientauth;
import android.content.ContentProvider; import android.content.ContentProvider;
import android.content.ContentUris; import android.content.ContentUris;
@ -19,7 +19,7 @@ public class ClientAuthContentProvider extends ContentProvider {
V3ClientAuth.HASH, V3ClientAuth.HASH,
V3ClientAuth.ENABLED, V3ClientAuth.ENABLED,
}; };
private static final String AUTH = "com.darkweb.genesissearchengine.clientauth.ClientAuthContentProvider"; private static final String AUTH = "com.darkweb.genesissearchengine.libs.clientauth.ClientAuthContentProvider";
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTH + "/v3auth"); public static final Uri CONTENT_URI = Uri.parse("content://" + AUTH + "/v3auth");
private static final int V3AUTHS = 1, V3AUTH_ID = 2; private static final int V3AUTHS = 1, V3AUTH_ID = 2;

View File

@ -1,4 +1,4 @@
package com.darkweb.genesissearchengine.clientauth; package com.darkweb.genesissearchengine.libs.clientauth;
import android.content.Context; import android.content.Context;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;

View File

@ -15,15 +15,15 @@
* limitations under the License. * limitations under the License.
*/ */
package com.darkweb.genesissearchengine.netcipher; package com.darkweb.genesissearchengine.libs.netcipher;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.darkweb.genesissearchengine.netcipher.client.TlsOnlySocketFactory; import com.darkweb.genesissearchengine.libs.netcipher.client.TlsOnlySocketFactory;
import com.darkweb.genesissearchengine.netcipher.proxy.OrbotHelper; import com.darkweb.genesissearchengine.libs.netcipher.proxy.OrbotHelper;
import java.io.IOException; import java.io.IOException;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.darkweb.genesissearchengine.netcipher.client; package com.darkweb.genesissearchengine.libs.netcipher.client;
import android.util.Log; import android.util.Log;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.darkweb.genesissearchengine.netcipher.client; package com.darkweb.genesissearchengine.libs.netcipher.client;
import ch.boye.httpclientandroidlib.HttpException; import ch.boye.httpclientandroidlib.HttpException;
import ch.boye.httpclientandroidlib.HttpHost; import ch.boye.httpclientandroidlib.HttpHost;

View File

@ -14,16 +14,13 @@
* limitations under the License. * limitations under the License.
*/ */
package com.darkweb.genesissearchengine.netcipher.client; package com.darkweb.genesissearchengine.libs.netcipher.client;
import android.content.Intent; import android.content.Intent;
import java.io.IOException; import java.io.IOException;
import java.security.KeyManagementException; import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManager;
public interface StrongBuilder<T extends StrongBuilder, C> { public interface StrongBuilder<T extends StrongBuilder, C> {

View File

@ -16,12 +16,12 @@
* limitations under the License. * limitations under the License.
*/ */
package com.darkweb.genesissearchengine.netcipher.client; package com.darkweb.genesissearchengine.libs.netcipher.client;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import com.darkweb.genesissearchengine.netcipher.proxy.OrbotHelper; import com.darkweb.genesissearchengine.libs.netcipher.proxy.OrbotHelper;
import org.json.JSONObject; import org.json.JSONObject;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.darkweb.genesissearchengine.netcipher.client; package com.darkweb.genesissearchengine.libs.netcipher.client;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.darkweb.genesissearchengine.netcipher.client; package com.darkweb.genesissearchengine.libs.netcipher.client;
public class StrongConstants { public class StrongConstants {

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.darkweb.genesissearchengine.netcipher.client; package com.darkweb.genesissearchengine.libs.netcipher.client;
import android.content.Context; import android.content.Context;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.darkweb.genesissearchengine.netcipher.client; package com.darkweb.genesissearchengine.libs.netcipher.client;
import android.content.Context; import android.content.Context;

View File

@ -17,7 +17,7 @@
* From https://stackoverflow.com/a/29946540 * From https://stackoverflow.com/a/29946540
*/ */
package com.darkweb.genesissearchengine.netcipher.client; package com.darkweb.genesissearchengine.libs.netcipher.client;
import android.net.SSLCertificateSocketFactory; import android.net.SSLCertificateSocketFactory;
import android.os.Build; import android.os.Build;

View File

@ -16,7 +16,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.darkweb.genesissearchengine.netcipher.proxy; package com.darkweb.genesissearchengine.libs.netcipher.proxy;
import android.app.Activity; import android.app.Activity;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
@ -34,7 +34,6 @@ import android.util.Log;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.darkweb.genesissearchengine.netcipher.proxy; package com.darkweb.genesissearchengine.libs.netcipher.proxy;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.darkweb.genesissearchengine.netcipher.proxy; package com.darkweb.genesissearchengine.libs.netcipher.proxy;
import java.io.IOException; import java.io.IOException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.darkweb.genesissearchengine.netcipher.proxy; package com.darkweb.genesissearchengine.libs.netcipher.proxy;
import java.net.ConnectException; import java.net.ConnectException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.darkweb.genesissearchengine.netcipher.proxy; package com.darkweb.genesissearchengine.libs.netcipher.proxy;
import java.io.IOException; import java.io.IOException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;

View File

@ -12,7 +12,7 @@
limitations under the License. limitations under the License.
*/ */
package com.darkweb.genesissearchengine.netcipher.proxy; package com.darkweb.genesissearchengine.libs.netcipher.proxy;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.darkweb.genesissearchengine.netcipher.proxy; package com.darkweb.genesissearchengine.libs.netcipher.proxy;
import android.content.Intent; import android.content.Intent;

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.darkweb.genesissearchengine.netcipher.proxy; package com.darkweb.genesissearchengine.libs.netcipher.proxy;
import android.content.Context; import android.content.Context;
import android.util.Log; import android.util.Log;

View File

@ -16,7 +16,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.darkweb.genesissearchengine.netcipher.web; package com.darkweb.genesissearchengine.libs.netcipher.web;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;

View File

@ -1,15 +1,8 @@
package com.darkweb.genesissearchengine.helperManager; package com.darkweb.genesissearchengine.libs.trueTime;
import android.widget.Toast;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
import com.instacart.library.truetime.TrueTime; import com.instacart.library.truetime.TrueTime;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
public class trueTime { public class trueTime {
@ -36,15 +29,7 @@ public class trueTime {
} }
public String getLTZ(){ public String getLTZ(){
Date deviceTime = new Date();
return System.currentTimeMillis()+strings.GENERIC_EMPTY_STR; return System.currentTimeMillis()+strings.GENERIC_EMPTY_STR;
} }
private String _formatDate(Date date, String pattern, TimeZone timeZone) {
DateFormat format = new SimpleDateFormat(pattern, Locale.ENGLISH);
format.setTimeZone(timeZone);
return format.format(date);
}
} }

View File

@ -1,15 +1,15 @@
package com.darkweb.genesissearchengine.helperManager; package com.darkweb.genesissearchengine.libs.views;
import android.graphics.Color; import android.graphics.Color;
public class colorAnimationReciever public class ColorAnimator
{ {
private final int mStartColor, mEndColor; private final int mStartColor, mEndColor;
private final float[] mStartHSV, mEndHSV; private final float[] mStartHSV, mEndHSV;
private float[] mMove = new float[3]; private float[] mMove = new float[3];
public colorAnimationReciever(int start, int end) { public ColorAnimator(int start, int end) {
mStartColor = start; mStartColor = start;
mEndColor = end; mEndColor = end;
mStartHSV = toHSV(start); mStartHSV = toHSV(start);

View File

@ -1,4 +1,4 @@
package com.darkweb.genesissearchengine.helperManager; package com.darkweb.genesissearchengine.libs.views;
import android.app.Activity; import android.app.Activity;
import android.graphics.Rect; import android.graphics.Rect;

View File

@ -1,28 +1,23 @@
package com.darkweb.genesissearchengine.helperManager; package com.darkweb.genesissearchengine.libs.views;
import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
import android.graphics.Matrix; import android.graphics.Matrix;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet; import android.util.AttributeSet;
/** public class ThumbnailCrop extends androidx.appcompat.widget.AppCompatImageView {
* Created by chris on 7/27/16.
*/
public class TopCropImageView extends androidx.appcompat.widget.AppCompatImageView {
public TopCropImageView(Context context) { public ThumbnailCrop(Context context) {
super(context); super(context);
init(); init();
} }
public TopCropImageView(Context context, AttributeSet attrs) { public ThumbnailCrop(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
init(); init();
} }
public TopCropImageView(Context context, AttributeSet attrs, int defStyleAttr) { public ThumbnailCrop(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
init(); init();
} }

View File

@ -1,26 +1,29 @@
package com.darkweb.genesissearchengine.pluginManager; package com.darkweb.genesissearchengine.pluginManager.adPluginManager;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.google.android.gms.ads.*; import com.google.android.gms.ads.*;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.List; import java.util.List;
class adManager public class adManager
{ {
/*Private Variables */ /*Private Variables */
private eventObserver.eventListener mEvent; private eventObserver.eventListener mEvent;
private WeakReference<AdView> mBannerAds; private WeakReference<AdView> mBannerAds;
private boolean mPaidStatus = false; private boolean mPaidStatus;
private boolean bannerAdsLoading = false; private boolean bannerAdsLoading = false;
private boolean bannerAdsLoaded = false; private boolean bannerAdsLoaded = false;
/*Initializations*/ /*Initializations*/
adManager(eventObserver.eventListener pEvent, AdView pBannerAds, boolean pPaidStatus) { public adManager(eventObserver.eventListener pEvent, AdView pBannerAds, boolean pPaidStatus) {
this.mEvent = pEvent; this.mEvent = pEvent;
this.mPaidStatus = pPaidStatus; this.mPaidStatus = pPaidStatus;
this.mBannerAds = new WeakReference(pBannerAds); this.mBannerAds = new WeakReference(pBannerAds);
@ -74,13 +77,19 @@ class adManager
@Override @Override
public void onAdClosed() { public void onAdClosed() {
} }
@Override
public void onAdFailedToLoad(@NonNull LoadAdError var1) {
Log.i("sadsa","");
}
}); });
} }
} }
/*External Triggers*/ /*External Triggers*/
Object onTrigger(List<Object> pData, pluginEnums.eAdManager pEventType) { public Object onTrigger(List<Object> pData, pluginEnums.eAdManager pEventType) {
if(pEventType.equals(pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS)) if(pEventType.equals(pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS))
{ {
loadAds((AppCompatActivity)pData.get(0)); loadAds((AppCompatActivity)pData.get(0));

View File

@ -1,14 +1,15 @@
package com.darkweb.genesissearchengine.pluginManager; package com.darkweb.genesissearchengine.pluginManager.analyticPluginManager;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.flurry.android.FlurryAgent; import com.flurry.android.FlurryAgent;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.List; import java.util.List;
class analyticManager public class analyticManager
{ {
/*Private Variables*/ /*Private Variables*/
@ -16,7 +17,7 @@ class analyticManager
/*Initializations*/ /*Initializations*/
analyticManager(WeakReference<AppCompatActivity> pAppContext, eventObserver.eventListener pEvent){ public analyticManager(WeakReference<AppCompatActivity> pAppContext, eventObserver.eventListener pEvent){
this.mAppContext = pAppContext; this.mAppContext = pAppContext;
initialize(); initialize();
} }
@ -39,7 +40,7 @@ class analyticManager
} }
} }
void onTrigger(List<Object> pData, pluginEnums.eAnalyticManager pEventType) { public void onTrigger(List<Object> pData, pluginEnums.eAnalyticManager pEventType) {
if(pEventType.equals(pluginEnums.eAnalyticManager.M_LOG_EVENT)) if(pEventType.equals(pluginEnums.eAnalyticManager.M_LOG_EVENT))
{ {
} }

View File

@ -1,66 +0,0 @@
package com.darkweb.genesissearchengine.pluginManager;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.helperManager.localFileDownloader;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
class downloadManager
{
/*Private Variables*/
private WeakReference<AppCompatActivity> mAppContext;
private Map<Integer, localFileDownloader> mDownloads = new HashMap<>();
private eventObserver.eventListener mEvent;
/*Initializations*/
downloadManager(WeakReference<AppCompatActivity> pAppContext, eventObserver.eventListener pEvent){
this.mAppContext = pAppContext;
this.mEvent = pEvent;
initialize();
}
private void initialize()
{
}
private void startDownload(String pPath,String pFile) {
int mID = helperMethod.createNotificationID();
localFileDownloader mFileDownloader = (localFileDownloader)new localFileDownloader(mAppContext.get().getApplicationContext(),pPath, pFile, mID, mEvent).execute(pPath);
mDownloads.put(mID,mFileDownloader);
}
private void cancelDownload(int pID) {
Objects.requireNonNull(mDownloads.get(pID)).onCancel();
}
private void onTriggerDownload(int pID) {
Objects.requireNonNull(mDownloads.get(pID)).onTrigger();
}
/*External Triggers*/
Object onTrigger(List<Object> pData, pluginEnums.eDownloadManager pEventType) {
if(pEventType.equals(pluginEnums.eDownloadManager.M_DOWNLOAD_FILE))
{
startDownload((String) pData.get(0),(String)pData.get(1));
}
else if(pEventType.equals(pluginEnums.eDownloadManager.M_CANCEL))
{
cancelDownload((int) pData.get(0));
}
else if(pEventType.equals(pluginEnums.eDownloadManager.M_TRIGGER))
{
onTriggerDownload((int) pData.get(0));
}
return null;
}
}

View File

@ -1,4 +1,4 @@
package com.darkweb.genesissearchengine.helperManager; package com.darkweb.genesissearchengine.pluginManager.downloadPluginManager;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.content.Context; import android.content.Context;
@ -6,21 +6,19 @@ import android.os.Environment;
import android.os.Handler; import android.os.Handler;
import android.util.Base64; import android.util.Base64;
import android.webkit.JavascriptInterface; import android.webkit.JavascriptInterface;
import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import com.example.myapplication.R; import com.example.myapplication.R;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.Date; import java.util.Date;
public class internalFileDownloadManager { public class blobDownloader {
private Context context; private Context context;
private NotificationManager nm; private NotificationManager nm;
public internalFileDownloadManager(Context context) { public blobDownloader(Context context) {
this.context = context; this.context = context;
} }
@ -49,6 +47,7 @@ public class internalFileDownloadManager {
} }
return "javascript: console.log('It is not a Blob URL');"; return "javascript: console.log('It is not a Blob URL');";
} }
private void convertBase64StringToPdfAndStoreIt(String base64PDf) throws IOException { private void convertBase64StringToPdfAndStoreIt(String base64PDf) throws IOException {
final int notificationId = 1; final int notificationId = 1;
String currentDateTime = DateFormat.getDateTimeInstance().format(new Date()); String currentDateTime = DateFormat.getDateTimeInstance().format(new Date());
@ -72,11 +71,7 @@ public class internalFileDownloadManager {
nm.notify(notificationId, b.build()); nm.notify(notificationId, b.build());
Handler h = new Handler(); Handler h = new Handler();
long delayInMilliseconds = 5000; long delayInMilliseconds = 5000;
h.postDelayed(new Runnable() { h.postDelayed(() -> nm.cancel(notificationId), delayInMilliseconds);
public void run() {
nm.cancel(notificationId);
}
}, delayInMilliseconds);
} }
} }
} }

View File

@ -0,0 +1,89 @@
package com.darkweb.genesissearchengine.pluginManager.downloadPluginManager;
import android.os.Environment;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.darkweb.genesissearchengine.pluginManager.pluginReciever.downloadNotificationReciever;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
public class downloadManager
{
/* Private Variables */
private WeakReference<AppCompatActivity> mAppContext;
private Map<Integer, downloadReciever> mDownloads = new HashMap<>();
private eventObserver.eventListener mEvent;
/* Initializations */
public downloadManager(WeakReference<AppCompatActivity> pAppContext, eventObserver.eventListener pEvent){
this.mAppContext = pAppContext;
this.mEvent = pEvent;
initialize();
}
private void initialize()
{
}
private void startDownload(String pPath,String pFile) {
int mID = helperMethod.createNotificationID();
downloadReciever mFileDownloader = (downloadReciever)new downloadReciever(mAppContext.get().getApplicationContext(),pPath, pFile, mID, mEvent, downloadNotificationReciever.class).execute(pPath);
mDownloads.put(mID,mFileDownloader);
}
private void cancelDownload(int pID) {
Objects.requireNonNull(mDownloads.get(pID)).onCancel();
}
private void onTriggerDownload(int pID) {
if(mDownloads!=null && mDownloads.get(pID)!=null){
mDownloads.get(pID).onTrigger();
}
}
private void onStartSercvice(String mURL, String mPath){
mAppContext.get().startService(downloadService.getDownloadService(mAppContext.get().getApplicationContext(), mURL + "__" + mPath, Environment.DIRECTORY_DOWNLOADS));
}
private String downloadBlob(String pURL){
return blobDownloader.getBase64StringFromBlobUrl(pURL);
}
/* External Triggers */
public Object onTrigger(List<Object> pData, pluginEnums.eDownloadManager pEventType) {
if(pEventType.equals(pluginEnums.eDownloadManager.M_DOWNLOAD_FILE))
{
startDownload((String) pData.get(0),(String)pData.get(1));
}
else if(pEventType.equals(pluginEnums.eDownloadManager.M_CANCEL))
{
cancelDownload((int) pData.get(0));
}
else if(pEventType.equals(pluginEnums.eDownloadManager.M_TRIGGER))
{
onTriggerDownload((int) pData.get(0));
}
else if(pEventType.equals(pluginEnums.eDownloadManager.M_START_SERVICE))
{
onStartSercvice((String) pData.get(0), (String) pData.get(1));
}
else if(pEventType.equals(pluginEnums.eDownloadManager.M_DOWNLOAD_BLOB))
{
return downloadBlob((String) pData.get(0));
}
return null;
}
}

View File

@ -1,4 +1,4 @@
package com.darkweb.genesissearchengine.helperManager; package com.darkweb.genesissearchengine.pluginManager.downloadPluginManager;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.DownloadManager; import android.app.DownloadManager;
@ -24,7 +24,8 @@ import androidx.core.content.FileProvider;
import com.darkweb.genesissearchengine.appManager.activityContextManager; import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.netcipher.client.StrongHttpsClient; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.libs.netcipher.client.StrongHttpsClient;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -39,6 +40,7 @@ import java.net.InetSocketAddress;
import java.net.Proxy; import java.net.Proxy;
import java.net.URI; import java.net.URI;
import java.net.URL; import java.net.URL;
import java.net.URLConnection;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -50,7 +52,7 @@ import static com.darkweb.genesissearchengine.constants.enums.etype.M_DOWNLOAD_F
import static java.lang.Thread.sleep; import static java.lang.Thread.sleep;
public class localFileDownloader extends AsyncTask<String, Integer, String> { public class downloadReciever extends AsyncTask<String, Integer, String> {
@SuppressLint("StaticFieldLeak") @SuppressLint("StaticFieldLeak")
private Context context; private Context context;
@ -61,21 +63,21 @@ public class localFileDownloader extends AsyncTask<String, Integer, String> {
private Boolean mIsCanceled = false; private Boolean mIsCanceled = false;
private String PROXY_ADDRESS = "localhost"; private String PROXY_ADDRESS = "localhost";
private int PROXY_PORT = 9050;
private int mID; private int mID;
private String mFileName; private String mFileName;
private float mTotalByte;
private float mDownloadByte; private float mDownloadByte;
private String mURL; private String mURL;
private eventObserver.eventListener mEvent; private eventObserver.eventListener mEvent;
private Class<?> mBroadcastReciever;
public localFileDownloader(Context pContext, String pURL, String pFileName, int pID, eventObserver.eventListener pEvent) { public downloadReciever(Context pContext, String pURL, String pFileName, int pID, eventObserver.eventListener pEvent, Class<?> pBroadcastReciever) {
this.context = pContext; this.context = pContext;
this.mFileName = pFileName; this.mFileName = pFileName;
this.mURL = pURL; this.mURL = pURL;
this.mID = pID; this.mID = pID;
this.mEvent = pEvent; this.mEvent = pEvent;
this.mBroadcastReciever = pBroadcastReciever;
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
@ -87,7 +89,7 @@ public class localFileDownloader extends AsyncTask<String, Integer, String> {
protected void onPreExecute() { protected void onPreExecute() {
super.onPreExecute(); super.onPreExecute();
Intent snoozeIntent = new Intent(context, downloadNotification.class); Intent snoozeIntent = new Intent(context, mBroadcastReciever);
snoozeIntent.setAction("Download_Cancelled"); snoozeIntent.setAction("Download_Cancelled");
snoozeIntent.putExtra("N_ID", mID); snoozeIntent.putExtra("N_ID", mID);
snoozeIntent.putExtra("N_COMMAND", 0); snoozeIntent.putExtra("N_COMMAND", 0);
@ -152,7 +154,9 @@ public class localFileDownloader extends AsyncTask<String, Integer, String> {
proxy = new Proxy(Proxy.Type.SOCKS, InetSocketAddress.createUnresolved(PROXY_ADDRESS, 9050)); proxy = new Proxy(Proxy.Type.SOCKS, InetSocketAddress.createUnresolved(PROXY_ADDRESS, 9050));
conection = (HttpURLConnection) url.openConnection(proxy); conection = (HttpURLConnection) url.openConnection(proxy);
}else { }else {
conection = (HttpURLConnection) ProxySelector.openConnectionWithProxy(new URI(f_url[0]));; Proxy mProxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 8118));
URLConnection mURLConnection = new URI(f_url[0]).toURL().openConnection(mProxy);
conection = (HttpURLConnection) mURLConnection;
} }
conection.setRequestProperty("User-Agent","Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0"); conection.setRequestProperty("User-Agent","Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0");
@ -168,7 +172,6 @@ public class localFileDownloader extends AsyncTask<String, Integer, String> {
long total = 0; long total = 0;
mTotalByte = lenghtOfFile;
while ((count = mStream.read(data)) != -1) { while ((count = mStream.read(data)) != -1) {
total += count; total += count;
int cur = (int) ((total * 100) / lenghtOfFile); int cur = (int) ((total * 100) / lenghtOfFile);
@ -219,7 +222,7 @@ public class localFileDownloader extends AsyncTask<String, Integer, String> {
HttpGet httpget = new HttpGet(urlEncoded); HttpGet httpget = new HttpGet(urlEncoded);
HttpResponse response = httpclient.execute(httpget); HttpResponse response = httpclient.execute(httpget);
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
sb.append(response.getStatusLine()).append("\n\n"); sb.append(response.getStatusLine()).append("\n\n");
InputStream mStream = response.getEntity().getContent(); InputStream mStream = response.getEntity().getContent();
@ -231,7 +234,6 @@ public class localFileDownloader extends AsyncTask<String, Integer, String> {
long total = 0; long total = 0;
float lenghtOfFile = response.getEntity().getContentLength(); float lenghtOfFile = response.getEntity().getContentLength();
mTotalByte = lenghtOfFile;
int read; int read;
while ((read = mStream.read(data)) != -1) { while ((read = mStream.read(data)) != -1) {
total += read; total += read;
@ -285,13 +287,13 @@ public class localFileDownloader extends AsyncTask<String, Integer, String> {
@Override @Override
protected void onPostExecute(String file_url) { protected void onPostExecute(String file_url) {
Intent snoozeIntentPost = new Intent(context, downloadNotification.class); Intent snoozeIntentPost = new Intent(context, mBroadcastReciever);
snoozeIntentPost.setAction("Download_Open"); snoozeIntentPost.setAction("Download_Open");
snoozeIntentPost.putExtra("N_ID", mID); snoozeIntentPost.putExtra("N_ID", mID);
snoozeIntentPost.putExtra("N_COMMAND", 1); snoozeIntentPost.putExtra("N_COMMAND", 1);
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, mID, snoozeIntentPost, PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, mID, snoozeIntentPost, PendingIntent.FLAG_UPDATE_CURRENT);
Intent snoozeIntentPost1 = new Intent(context, downloadNotification.class); Intent snoozeIntentPost1 = new Intent(context, mBroadcastReciever);
snoozeIntentPost1.setAction("Download_Cancelled"); snoozeIntentPost1.setAction("Download_Cancelled");
snoozeIntentPost1.putExtra("N_ID", mID); snoozeIntentPost1.putExtra("N_ID", mID);
snoozeIntentPost1.putExtra("N_COMMAND", 2); snoozeIntentPost1.putExtra("N_COMMAND", 2);
@ -316,7 +318,7 @@ public class localFileDownloader extends AsyncTask<String, Integer, String> {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.provider.dev", mFile); Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.production.provider", mFile);
ContentValues contentValues = new ContentValues(); ContentValues contentValues = new ContentValues();
contentValues.put(MediaStore.Downloads.TITLE, mFileName); contentValues.put(MediaStore.Downloads.TITLE, mFileName);
@ -329,7 +331,7 @@ public class localFileDownloader extends AsyncTask<String, Integer, String> {
ContentResolver database = context.getContentResolver(); ContentResolver database = context.getContentResolver();
database.insert(MediaStore.Downloads.EXTERNAL_CONTENT_URI, contentValues); database.insert(MediaStore.Downloads.EXTERNAL_CONTENT_URI, contentValues);
} else { } else {
Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.provider.dev", mFile); Uri uri = FileProvider.getUriForFile(context, "com.darkweb.genesissearchengine.production.provider", mFile);
String mime = helperMethod.getMimeType(uri.toString(), context); String mime = helperMethod.getMimeType(uri.toString(), context);
if(mime!=null){ if(mime!=null){
dm.addCompletedDownload(mFileName, mURL, false, mime, mFile.getAbsolutePath(), mFile.length(), false); dm.addCompletedDownload(mFileName, mURL, false, mime, mFile.getAbsolutePath(), mFile.length(), false);

Some files were not shown because too many files have changed in this diff Show More