bug fixes

master
msmannan00 2019-08-11 14:06:26 +05:00
parent 3edb5a092a
commit ed0c04e917
33 changed files with 572 additions and 238 deletions

View File

@ -2,7 +2,6 @@ apply plugin: 'com.android.application'
apply from: 'variables.gradle' apply from: 'variables.gradle'
apply plugin: 'maven' apply plugin: 'maven'
apply plugin: 'io.fabric'
ext { ext {
@ -41,7 +40,7 @@ android {
flavorDimensions project.ext.dimen flavorDimensions project.ext.dimen
productFlavors { productFlavors {
/*arm { arm {
versionCode project.ext.arm_vcode versionCode project.ext.arm_vcode
versionName project.ext.arm_vname versionName project.ext.arm_vname
dimension project.ext.dimen dimension project.ext.dimen
@ -50,17 +49,17 @@ android {
versionCode project.ext.aarch_vcode versionCode project.ext.aarch_vcode
versionName project.ext.aarch_vname versionName project.ext.aarch_vname
dimension project.ext.dimen dimension project.ext.dimen
}*/ }
x86 { x86 {
versionCode project.ext.x86_vcode versionCode project.ext.x86_vcode
versionName project.ext.x86_vname versionName project.ext.x86_vname
dimension project.ext.dimen dimension project.ext.dimen
} }
/*x86_64 { x86_64 {
versionCode project.ext.x64_vcode versionCode project.ext.x64_vcode
versionName project.ext.x64_vname versionName project.ext.x64_vname
dimension project.ext.dimen dimension project.ext.dimen
}*/ }
} }
@ -97,10 +96,10 @@ dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support:appcompat-v7:28.0.0'
/*Firefox ABI Splits*/ /*Firefox ABI Splits*/
x86Implementation "org.mozilla.geckoview:geckoview-x86:68.0.20190711090008" //implementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}:${geckoviewVersion}"
//x86_64Implementation "org.mozilla.geckoview:geckoview-x86_64:68.0.20190711090008" //x86_64Implementation "org.mozilla.geckoview:geckoview-x86_64:68.0.20190711090008"
//armImplementation "org.mozilla.geckoview:geckoview-armeabi-v7a:68.0.20190711090008" //armImplementation "org.mozilla.geckoview:geckoview-armeabi-v7a:68.0.20190711090008"
//aarch64Implementation "org.mozilla.geckoview:geckoview-arm64-v8a:68.0.20190711090008" aarch64Implementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}:${geckoviewVersion}"
/*Alert Dialog*/ /*Alert Dialog*/
implementation 'com.crowdfire.cfalertdialog:cfalertdialog:1.1.0' implementation 'com.crowdfire.cfalertdialog:cfalertdialog:1.1.0'
@ -116,6 +115,7 @@ dependencies {
/*Crashlytics*/ /*Crashlytics*/
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1' implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar')
} }
apply plugin: 'com.android.application' apply plugin: 'com.android.application'

View File

@ -31,7 +31,7 @@
android:required="false"/> android:required="false"/>
<activity <activity
android:name="com.darkweb.genesissearchengine.appManager.home_activity.application_controller" android:name="com.darkweb.genesissearchengine.appManager.home_activity.home_controller"
android:windowSoftInputMode="adjustNothing" android:windowSoftInputMode="adjustNothing"
android:screenOrientation="portrait"> android:screenOrientation="portrait">
<intent-filter> <intent-filter>
@ -48,6 +48,12 @@
<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-5074525529134731~2926711128"/> android:value="ca-app-pub-5074525529134731~2926711128"/>
<service
android:name="com.darkweb.genesissearchengine.appManager.home_activity.DownloadFileService"
android:enabled="true"
android:exported="false" />
</application> </application>
</manifest> </manifest>

View File

@ -2,8 +2,8 @@ package com.darkweb.genesissearchengine.appManager.database_manager;
import android.database.Cursor; import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import com.darkweb.genesissearchengine.appManager.home_activity.home_model;
import com.darkweb.genesissearchengine.appManager.list_manager.list_row_model; import com.darkweb.genesissearchengine.appManager.list_manager.list_row_model;
import com.darkweb.genesissearchengine.appManager.home_activity.app_model;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import java.util.ArrayList; import java.util.ArrayList;
@ -33,7 +33,7 @@ public class database_controller
{ {
try try
{ {
database_instance = app_model.getInstance().getAppInstance().openOrCreateDatabase(constants.databae_name, MODE_PRIVATE, null); database_instance = home_model.getInstance().getHomeInstance().openOrCreateDatabase(constants.databae_name, MODE_PRIVATE, null);
database_instance.execSQL("CREATE TABLE IF NOT EXISTS " + "history" + " (id INT(4),date VARCHAR,url VARCHAR);"); database_instance.execSQL("CREATE TABLE IF NOT EXISTS " + "history" + " (id INT(4),date VARCHAR,url VARCHAR);");
database_instance.execSQL("CREATE TABLE IF NOT EXISTS " + "bookmark" + " (id INT(4),title VARCHAR,url VARCHAR);"); database_instance.execSQL("CREATE TABLE IF NOT EXISTS " + "bookmark" + " (id INT(4),title VARCHAR,url VARCHAR);");
@ -58,7 +58,7 @@ public class database_controller
if (c.moveToFirst()){ if (c.moveToFirst()){
do { do {
tempmodel.add(new list_row_model(c.getString(2), c.getString(1),Integer.parseInt(c.getString(0)))); tempmodel.add(new list_row_model(c.getString(2), c.getString(1),Integer.parseInt(c.getString(0))));
app_model.getInstance().initSuggestions(c.getString(2)); home_model.getInstance().initSuggestions(c.getString(2));
} while(c.moveToNext()); } while(c.moveToNext());
} }
c.close(); c.close();

View File

@ -0,0 +1,41 @@
package com.darkweb.genesissearchengine.appManager.home_activity;
import android.app.DownloadManager;
import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Environment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public class DownloadFileService extends IntentService
{
private static final String DOWNLOAD_PATH = "com.spartons.androiddownloadmanager_DownloadSongService_Download_path";
private static final String DESTINATION_PATH = "com.spartons.androiddownloadmanager_DownloadSongService_Destination_path";
public DownloadFileService() {
super("DownloadSongService");
}
public static Intent getDownloadService(final @NonNull Context callingClassContext, final @NonNull String downloadPath, final @NonNull String destinationPath) {
return new Intent(callingClassContext, DownloadFileService.class)
.putExtra(DOWNLOAD_PATH, downloadPath)
.putExtra(DESTINATION_PATH, destinationPath);
}
@Override
protected void onHandleIntent(@Nullable Intent intent) {
String downloadPath = intent.getStringExtra(DOWNLOAD_PATH);
String destinationPath = intent.getStringExtra(DESTINATION_PATH);
startDownload(downloadPath, destinationPath);
}
private void startDownload(String downloadPath, String destinationPath) {
String []fn = downloadPath.split("__");
Uri uri = Uri.parse(fn[0]); // Path where you want to download file.
DownloadManager manager = (DownloadManager) home_model.getInstance().getHomeInstance().getSystemService(DOWNLOAD_SERVICE);
DownloadManager.Request req = new DownloadManager.Request(uri);
req.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fn[1]);
req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
manager.enqueue(req);
}
}

View File

@ -1,21 +0,0 @@
package com.darkweb.genesissearchengine.appManager.home_activity;
public class downloadManager
{
private static final downloadManager ourInstance = new downloadManager();
public static downloadManager getInstance()
{
return ourInstance;
}
private downloadManager()
{
}
public void initialize()
{
}
}

View File

@ -1,19 +1,28 @@
package com.darkweb.genesissearchengine.appManager.home_activity; package com.darkweb.genesissearchengine.appManager.home_activity;
import android.Manifest;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Environment;
import android.os.Handler; import android.os.Handler;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.*; import com.darkweb.genesissearchengine.constants.*;
import com.darkweb.genesissearchengine.dataManager.preference_manager; import com.darkweb.genesissearchengine.dataManager.preference_manager;
import com.darkweb.genesissearchengine.pluginManager.fabricManager; import com.darkweb.genesissearchengine.pluginManager.fabricManager;
import com.darkweb.genesissearchengine.pluginManager.localNotification;
import com.darkweb.genesissearchengine.pluginManager.message_manager; import com.darkweb.genesissearchengine.pluginManager.message_manager;
import com.darkweb.genesissearchengine.pluginManager.orbot_manager; import com.darkweb.genesissearchengine.pluginManager.orbot_manager;
import org.mozilla.geckoview.GeckoResult; import org.mozilla.geckoview.*;
import org.mozilla.geckoview.GeckoRuntime;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.GeckoView;
import java.util.ArrayList; import java.util.LinkedList;
import static com.google.ads.AdRequest.LOGTAG;
class geckoClients class geckoClients
{ {
@ -52,8 +61,8 @@ class geckoClients
navigatedURL = ""; navigatedURL = "";
loadingCompeleted = false; loadingCompeleted = false;
session1.loadUri(url); session1.loadUri(url);
app_model.getInstance().getAppInstance().onRequestTriggered(true,url); home_model.getInstance().getHomeInstance().onRequestTriggered(true,url);
app_model.getInstance().getAppInstance().onProgressBarUpdateView(4); home_model.getInstance().getHomeInstance().onProgressBarUpdateView(4);
isFirstTimeLoad = true; isFirstTimeLoad = true;
wasBackPressed = false; wasBackPressed = false;
isContentLoading = false; isContentLoading = false;
@ -64,7 +73,7 @@ class geckoClients
void initialize(GeckoView geckoView) void initialize(GeckoView geckoView)
{ {
session1 = new GeckoSession(); session1 = new GeckoSession();
runtime1 = GeckoRuntime.getDefault(app_model.getInstance().getAppContext()); runtime1 = GeckoRuntime.getDefault(home_model.getInstance().getAppContext());
runtime1.getSettings().setJavaScriptEnabled(status.java_status); runtime1.getSettings().setJavaScriptEnabled(status.java_status);
session1.open(runtime1); session1.open(runtime1);
geckoView.releaseSession(); geckoView.releaseSession();
@ -73,11 +82,12 @@ class geckoClients
session1.setNavigationDelegate(new navigationDelegate()); session1.setNavigationDelegate(new navigationDelegate());
geckoView.setVisibility(View.VISIBLE); geckoView.setVisibility(View.VISIBLE);
geckoView.setAlpha(1); geckoView.setAlpha(1);
session1.setContentDelegate(new ExampleContentDelegate());
} }
public void initializeDownloadManager() public void initializeDownloadManager()
{ {
//DownloadsFeature downloadsFeature = new DownloadsFeature(app_model.getInstance().getAppContext(),null,null,null,session1); //DownloadsFeature downloadsFeature = new DownloadsFeature(home_model.getInstance().getAppContext(),null,null,null,session1);
} }
class navigationDelegate implements GeckoSession.NavigationDelegate class navigationDelegate implements GeckoSession.NavigationDelegate
@ -86,10 +96,10 @@ class geckoClients
public void onLocationChange(GeckoSession session, String url) public void onLocationChange(GeckoSession session, String url)
{ {
navigatedURL = url; navigatedURL = url;
if(isUrlSavable && app_model.getInstance().getNavigation().size()>0 && !url.equals("about:blank")) if(isUrlSavable && home_model.getInstance().getNavigation().size()>0 && !url.equals("about:blank"))
{ {
app_model.getInstance().addHistory(navigatedURL); home_model.getInstance().addHistory(navigatedURL);
app_model.getInstance().addNavigation(navigatedURL,enums.navigationType.onion); home_model.getInstance().addNavigation(navigatedURL,enums.navigationType.onion);
} }
} }
@ -113,7 +123,7 @@ class geckoClients
loadingCompeleted = false; loadingCompeleted = false;
fabricManager.getInstance().sendEvent("ONION GECKO_CLIENT URL REQEST : " + url + "--"); fabricManager.getInstance().sendEvent("ONION GECKO_CLIENT URL REQEST : " + url + "--");
app_model.getInstance().getAppInstance().onUpdateSearchBarView(url); home_model.getInstance().getHomeInstance().onUpdateSearchBarView(url);
isContentLoading = !navigatedURL.equals(url); isContentLoading = !navigatedURL.equals(url);
navigatedURL = url; navigatedURL = url;
@ -133,12 +143,12 @@ class geckoClients
{ {
if(isFirstTimeLoad) if(isFirstTimeLoad)
{ {
app_model.getInstance().getAppInstance().hideSplashScreen(); home_model.getInstance().getHomeInstance().hideSplashScreen();
} }
if(!success && !isContentLoading && !wasBackPressed) if(!success && !isContentLoading && !wasBackPressed)
{ {
app_model.getInstance().getAppInstance().onPageFinished(true); home_model.getInstance().getHomeInstance().onPageFinished(true);
app_model.getInstance().getAppInstance().onInternetErrorView(); home_model.getInstance().getHomeInstance().onInternetErrorView();
fabricManager.getInstance().sendEvent("ONION GECKO_CLIENT URL ERROR : " + success + "--" + isContentLoading); fabricManager.getInstance().sendEvent("ONION GECKO_CLIENT URL ERROR : " + success + "--" + isContentLoading);
} }
else if(success) else if(success)
@ -148,30 +158,30 @@ class geckoClients
{ {
if(!isAppRated) if(!isAppRated)
{ {
isAppRated = true; //isAppRated = true;
message_manager.getInstance().rateApp(); //message_manager.getInstance().rateApp();
} }
} }
else if(isAppRated || 1==1) else if(isAppRated || 1==1)
{ {
if(isFirstTimeLoad && navigatedURL.contains(".onion")) if(isFirstTimeLoad && navigatedURL.contains(".onion"))
{ {
app_model.getInstance().getAppInstance().onShowAd(enums.adID.hidden_onion_start); home_model.getInstance().getHomeInstance().onShowAd(enums.adID.hidden_onion_start);
} }
else if(!isFirstTimeLoad && navigatedURL.contains(".onion")) else if(!isFirstTimeLoad && navigatedURL.contains(".onion"))
{ {
app_model.getInstance().getAppInstance().onShowAd(enums.adID.hidden_onion); home_model.getInstance().getHomeInstance().onShowAd(enums.adID.hidden_onion);
} }
else if(!isFirstTimeLoad && !navigatedURL.contains(".onion")) else if(!isFirstTimeLoad && !navigatedURL.contains(".onion"))
{ {
app_model.getInstance().getAppInstance().onShowAd(enums.adID.hidden_base); home_model.getInstance().getHomeInstance().onShowAd(enums.adID.hidden_base);
} }
} }
app_model.getInstance().getAppInstance().onDisableInternetError(); home_model.getInstance().getHomeInstance().onDisableInternetError();
app_model.getInstance().getAppInstance().onProgressBarUpdateView(0); home_model.getInstance().getHomeInstance().onProgressBarUpdateView(0);
fabricManager.getInstance().sendEvent("ONION GECKO_CLIENT URL SUCCESS : " + success + "--" + isContentLoading); fabricManager.getInstance().sendEvent("ONION GECKO_CLIENT URL SUCCESS : " + success + "--" + isContentLoading);
app_model.getInstance().getAppInstance().onPageFinished(true); home_model.getInstance().getHomeInstance().onPageFinished(true);
} }
isUrlSavable = true; isUrlSavable = true;
@ -194,11 +204,11 @@ class geckoClients
} }
else if(progress>=5) else if(progress>=5)
{ {
app_model.getInstance().getAppInstance().onProgressBarUpdateView(progress); home_model.getInstance().getHomeInstance().onProgressBarUpdateView(progress);
} }
else else
{ {
app_model.getInstance().getAppInstance().onProgressBarUpdateView(4); home_model.getInstance().getHomeInstance().onProgressBarUpdateView(4);
} }
} }
@ -218,12 +228,12 @@ class geckoClients
wasBackPressed = true; wasBackPressed = true;
session1.stop(); session1.stop();
if(app_model.getInstance().getAppInstance().isInternetErrorOpened()) if(home_model.getInstance().getHomeInstance().isInternetErrorOpened())
{ {
initialize(geckoView); initialize(geckoView);
} }
session1.loadUri(app_model.getInstance().getNavigation().get(app_model.getInstance().getNavigation().size()-1).getURL()); session1.loadUri(home_model.getInstance().getNavigation().get(home_model.getInstance().getNavigation().size()-1).getURL());
} }
void stopHiddenView(GeckoView geckoView,boolean releaseView,boolean backPressed) void stopHiddenView(GeckoView geckoView,boolean releaseView,boolean backPressed)
@ -258,7 +268,7 @@ class geckoClients
void onReloadHiddenView() void onReloadHiddenView()
{ {
if(app_model.getInstance().getNavigation().get(app_model.getInstance().getNavigation().size()-1).type().equals(enums.navigationType.onion)) if(home_model.getInstance().getNavigation().get(home_model.getInstance().getNavigation().size()-1).type().equals(enums.navigationType.onion))
{ {
isRunning = false; isRunning = false;
loadingCompeleted = false; loadingCompeleted = false;
@ -267,7 +277,188 @@ class geckoClients
wasBackPressed = true; wasBackPressed = true;
session1.stop(); session1.stop();
session1.loadUri(app_model.getInstance().getNavigation().get(app_model.getInstance().getNavigation().size()-1).getURL()); session1.loadUri(home_model.getInstance().getNavigation().get(home_model.getInstance().getNavigation().size()-1).getURL());
} }
} }
private class ExampleContentDelegate implements GeckoSession.ContentDelegate {
@Override
public void onFocusRequest(final GeckoSession session) {
Log.i(LOGTAG, "Content requesting focus");
}
@Override
public void onContextMenu(final GeckoSession session,
int screenX, int screenY,
final ContextElement element) {
Log.d(LOGTAG, "onContextMenu screenX=" + screenX +
" screenY=" + screenY +
" type=" + element.type +
" linkUri=" + element.linkUri +
" title=" + element.title +
" alt=" + element.altText +
" srcUri=" + element.srcUri);
}
@Override
public void onExternalResponse(GeckoSession session, GeckoSession.WebResponseInfo response) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndTypeAndNormalize(Uri.parse(response.uri), response.contentType);
home_model.getInstance().getHomeInstance().startActivity(intent);
} catch (ActivityNotFoundException e) {
wasBackPressed = true;
home_model.getInstance().getHomeInstance().onProgressBarUpdateView(0);
downloadFile(response);
}
}
}
private void downloadFile(GeckoSession.WebResponseInfo response) {
session1
.getUserAgent()
.accept(userAgent -> downloadFile(response, userAgent),
exception -> {
throw new IllegalStateException("Could not get UserAgent string.");
});
}
private static final int REQUEST_WRITE_EXTERNAL_STORAGE = 3;
private LinkedList<GeckoSession.WebResponseInfo> mPendingDownloads = new LinkedList<>();
private void downloadFile(GeckoSession.WebResponseInfo response, String userAgent) {
if (ContextCompat.checkSelfPermission(home_model.getInstance().getHomeInstance(),
Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
mPendingDownloads.add(response);
ActivityCompat.requestPermissions(home_model.getInstance().getHomeInstance(),
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
REQUEST_WRITE_EXTERNAL_STORAGE);
return;
}
url = Uri.parse(response.uri);
downloadFile = response.filename != null ? response.filename : url.getLastPathSegment();
message_manager.getInstance().downloadFile(downloadFile);
}
String downloadFile = "";
Uri url;
void downloadFile()
{
home_model.getInstance().getHomeInstance().startService(DownloadFileService.getDownloadService(home_model.getInstance().getHomeInstance(), url.toString()+"__"+downloadFile, Environment.DIRECTORY_DOWNLOADS));
localNotification.getInstance().createNotification("Downloading | " + downloadFile,"Starting Download");
}
private class ExampleContentBlockingDelegate
implements ContentBlocking.Delegate {
private int mBlockedAds = 0;
private int mBlockedAnalytics = 0;
private int mBlockedSocial = 0;
private int mBlockedContent = 0;
private int mBlockedTest = 0;
private void clearCounters() {
mBlockedAds = 0;
mBlockedAnalytics = 0;
mBlockedSocial = 0;
mBlockedContent = 0;
mBlockedTest = 0;
}
private void logCounters() {
Log.d(LOGTAG, "Trackers blocked: " + mBlockedAds + " ads, " +
mBlockedAnalytics + " analytics, " +
mBlockedSocial + " social, " +
mBlockedContent + " content, " +
mBlockedTest + " test");
}
@Override
public void onContentBlocked(final GeckoSession session,
final ContentBlocking.BlockEvent event) {
Log.d(LOGTAG, "onContentBlocked" +
" AT: " + event.getAntiTrackingCategory() +
" SB: " + event.getSafeBrowsingCategory() +
" CB: " + event.getCookieBehaviorCategory() +
" URI: " + event.uri);
if ((event.getAntiTrackingCategory() &
ContentBlocking.AntiTracking.TEST) != 0) {
mBlockedTest++;
}
if ((event.getAntiTrackingCategory() &
ContentBlocking.AntiTracking.AD) != 0) {
mBlockedAds++;
}
if ((event.getAntiTrackingCategory() &
ContentBlocking.AntiTracking.ANALYTIC) != 0) {
mBlockedAnalytics++;
}
if ((event.getAntiTrackingCategory() &
ContentBlocking.AntiTracking.SOCIAL) != 0) {
mBlockedSocial++;
}
if ((event.getAntiTrackingCategory() &
ContentBlocking.AntiTracking.CONTENT) != 0) {
mBlockedContent++;
}
}
@Override
public void onContentLoaded(final GeckoSession session,
final ContentBlocking.BlockEvent event) {
Log.d(LOGTAG, "onContentLoaded" +
" AT: " + event.getAntiTrackingCategory() +
" SB: " + event.getSafeBrowsingCategory() +
" CB: " + event.getCookieBehaviorCategory() +
" URI: " + event.uri);
}
}
private final class ExampleTelemetryDelegate
implements RuntimeTelemetry.Delegate {
@Override
public void onTelemetryReceived(final @NonNull RuntimeTelemetry.Metric metric) {
Log.d(LOGTAG, "onTelemetryReceived " + metric);
}
}
} }

View File

@ -19,7 +19,7 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton;
import org.mozilla.geckoview.GeckoView; import org.mozilla.geckoview.GeckoView;
public class application_controller extends AppCompatActivity public class home_controller extends AppCompatActivity
{ {
/*View Webviews*/ /*View Webviews*/
private WebView webView; private WebView webView;
@ -63,9 +63,10 @@ public class application_controller extends AppCompatActivity
viewController.getInstance().initialization(webView,loadingText,progressBar,searchbar,splashScreen,requestFailure,floatingButton, loadingIcon,splashlogo); viewController.getInstance().initialization(webView,loadingText,progressBar,searchbar,splashScreen,requestFailure,floatingButton, loadingIcon,splashlogo);
firebase.getInstance().initialize(); firebase.getInstance().initialize();
geckoclient.initialize(geckoView); geckoclient.initialize(geckoView);
app_model.getInstance().initialization(); home_model.getInstance().initialization();
initBoogle(); initBoogle();
downloadManager.getInstance().initialize();
} }
else else
{ {
@ -92,13 +93,13 @@ public class application_controller extends AppCompatActivity
{ {
webView.stopLoading(); webView.stopLoading();
onloadURL(constants.backendBing,true,false); onloadURL(constants.backendBing,true,false);
if(app_model.getInstance().getNavigation().size()!=1) if(home_model.getInstance().getNavigation().size()!=1)
{ {
app_model.getInstance().addNavigation(constants.backendBing,enums.navigationType.onion); home_model.getInstance().addNavigation(constants.backendBing,enums.navigationType.onion);
} }
if(app_model.getInstance().getNavigation().size()>0) if(home_model.getInstance().getNavigation().size()>0)
{ {
app_model.getInstance().getNavigation().set(0,new navigation_model(constants.backendBing,enums.navigationType.onion)); home_model.getInstance().getNavigation().set(0,new navigation_model(constants.backendBing,enums.navigationType.onion));
} }
return false; return false;
} }
@ -106,26 +107,26 @@ public class application_controller extends AppCompatActivity
{ {
webView.stopLoading(); webView.stopLoading();
onloadURL(constants.backendGoogle,true,false); onloadURL(constants.backendGoogle,true,false);
if(app_model.getInstance().getNavigation().size()!=1) if(home_model.getInstance().getNavigation().size()!=1)
{ {
app_model.getInstance().addNavigation(constants.backendGoogle,enums.navigationType.onion); home_model.getInstance().addNavigation(constants.backendGoogle,enums.navigationType.onion);
} }
if(app_model.getInstance().getNavigation().size()>0) if(home_model.getInstance().getNavigation().size()>0)
{ {
app_model.getInstance().getNavigation().set(0,new navigation_model(constants.backendGoogle,enums.navigationType.onion)); home_model.getInstance().getNavigation().set(0,new navigation_model(constants.backendGoogle,enums.navigationType.onion));
} }
return false; return false;
} }
else else
{ {
onloadURL(constants.backendGenesis,false,false); onloadURL(constants.backendGenesis,false,false);
if(app_model.getInstance().getNavigation().size()!=1) if(home_model.getInstance().getNavigation().size()!=1)
{ {
app_model.getInstance().addNavigation(constants.backendGenesis,enums.navigationType.base); home_model.getInstance().addNavigation(constants.backendGenesis,enums.navigationType.base);
} }
if(app_model.getInstance().getNavigation().size()>0) if(home_model.getInstance().getNavigation().size()>0)
{ {
app_model.getInstance().getNavigation().set(0,new navigation_model(constants.backendGenesis,enums.navigationType.base)); home_model.getInstance().getNavigation().set(0,new navigation_model(constants.backendGenesis,enums.navigationType.base));
} }
return true; return true;
} }
@ -133,8 +134,8 @@ public class application_controller extends AppCompatActivity
public void initializeAppModel() public void initializeAppModel()
{ {
app_model.getInstance().setAppContext(this); home_model.getInstance().setAppContext(this);
app_model.getInstance().setAppInstance(this); home_model.getInstance().setAppInstance(this);
} }
public void initializeConnections() public void initializeConnections()
@ -143,14 +144,6 @@ public class application_controller extends AppCompatActivity
geckoView = findViewById(R.id.webLoader); geckoView = findViewById(R.id.webLoader);
geckoView.Browser browser = mGeckoView.getCurrentBrowser();
if (browser == null) {
browser = mGeckoView.addBrowser(text.getText().toString());
} else {
browser.loadUrl(text.getText().toString());
}
progressBar = findViewById(R.id.progressBar); progressBar = findViewById(R.id.progressBar);
requestFailure = findViewById(R.id.requestFailure); requestFailure = findViewById(R.id.requestFailure);
splashScreen = findViewById(R.id.splashScreen); splashScreen = findViewById(R.id.splashScreen);
@ -225,7 +218,7 @@ public class application_controller extends AppCompatActivity
{ {
geckoclient.loadGeckoURL(url,geckoView,isUrlSavable,webView.getVisibility()==View.VISIBLE); geckoclient.loadGeckoURL(url,geckoView,isUrlSavable,webView.getVisibility()==View.VISIBLE);
} }
else if(!app_model.getInstance().isUrlRepeatable(url,webView.getUrl()) || webView.getVisibility() == View.GONE) else if(!home_model.getInstance().isUrlRepeatable(url,webView.getUrl()) || webView.getVisibility() == View.GONE)
{ {
webView.loadUrl(url); webView.loadUrl(url);
onRequestTriggered(isHiddenWeb,url); onRequestTriggered(isHiddenWeb,url);
@ -343,6 +336,11 @@ public class application_controller extends AppCompatActivity
return requestFailure.getAlpha()==1; return requestFailure.getAlpha()==1;
} }
public void downloadFile()
{
geckoclient.downloadFile();
}
/*-------------------------------------------------------Menu Handler----------------------------------------------------*/ /*-------------------------------------------------------Menu Handler----------------------------------------------------*/
public boolean onMenuOptionSelected(MenuItem item) { public boolean onMenuOptionSelected(MenuItem item) {
@ -351,5 +349,7 @@ public class application_controller extends AppCompatActivity
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
} }

View File

@ -1,6 +1,5 @@
package com.darkweb.genesissearchengine.appManager.home_activity; package com.darkweb.genesissearchengine.appManager.home_activity;
import android.util.Log;
import android.util.Patterns; import android.util.Patterns;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
@ -21,11 +20,11 @@ import java.net.URL;
public class home_ehandler public class home_ehandler
{ {
application_controller appContoller; home_controller appContoller;
public home_ehandler() public home_ehandler()
{ {
appContoller = app_model.getInstance().getAppInstance(); appContoller = home_model.getInstance().getHomeInstance();
} }
public boolean onEditorClicked(TextView v, int actionId, KeyEvent event) public boolean onEditorClicked(TextView v, int actionId, KeyEvent event)
@ -54,7 +53,7 @@ public class home_ehandler
else else
{ {
fabricManager.getInstance().sendEvent("EDITOR ONION URL REQUEST : " + url); fabricManager.getInstance().sendEvent("EDITOR ONION URL REQUEST : " + url);
app_model.getInstance().getAppInstance().onloadURL(url,true,true); home_model.getInstance().getHomeInstance().onloadURL(url,true,true);
return true; return true;
} }
} }
@ -63,7 +62,7 @@ public class home_ehandler
catch (IOException e){} catch (IOException e){}
String editedURL = getSearchEngine(v.getText().toString().replaceAll(" ","+")); String editedURL = getSearchEngine(v.getText().toString().replaceAll(" ","+"));
app_model.getInstance().addHistory(editedURL); home_model.getInstance().addHistory(editedURL);
appContoller.onloadURL(editedURL,false,true); appContoller.onloadURL(editedURL,false,true);
appContoller.onClearSearchBarCursorView(); appContoller.onClearSearchBarCursorView();
fabricManager.getInstance().sendEvent("EDITOR SEARCHED : " + editedURL); fabricManager.getInstance().sendEvent("EDITOR SEARCHED : " + editedURL);
@ -133,7 +132,7 @@ public class home_ehandler
} }
else if (menuId == R.id.menu4) else if (menuId == R.id.menu4)
{ {
message_manager.getInstance().bookmark(app_model.getInstance().getAppInstance().getSearchBarUrl()); message_manager.getInstance().bookmark(home_model.getInstance().getHomeInstance().getSearchBarUrl());
} }
else if (menuId == R.id.menu5) else if (menuId == R.id.menu5)
{ {
@ -151,6 +150,10 @@ public class home_ehandler
{ {
helperMethod.shareApp(); helperMethod.shareApp();
} }
else if (menuId == R.id.menu0)
{
helperMethod.openDownloadFolder();
}
} }

View File

@ -3,17 +3,15 @@ package com.darkweb.genesissearchengine.appManager.home_activity;
import android.content.Context; import android.content.Context;
import android.net.Uri; import android.net.Uri;
import com.darkweb.genesissearchengine.appManager.database_manager.database_controller; import com.darkweb.genesissearchengine.appManager.database_manager.database_controller;
import com.darkweb.genesissearchengine.appManager.list_manager.list_controller;
import com.darkweb.genesissearchengine.appManager.list_manager.list_row_model; import com.darkweb.genesissearchengine.appManager.list_manager.list_row_model;
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.status; import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperMethod;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
public class app_model public class home_model
{ {
/*Data Objects*/ /*Data Objects*/
private ArrayList<list_row_model> history = new ArrayList<list_row_model>(); private ArrayList<list_row_model> history = new ArrayList<list_row_model>();
@ -23,7 +21,7 @@ public class app_model
private static int port = 9150; private static int port = 9150;
private Context appContext; private Context appContext;
private application_controller appInstance; private home_controller appInstance;
/*Initializations*/ /*Initializations*/
public void initialization(){ public void initialization(){
@ -33,8 +31,8 @@ public class app_model
} }
/*Setter Getter Initializations*/ /*Setter Getter Initializations*/
private static final app_model ourInstance = new app_model(); private static final home_model ourInstance = new home_model();
public static app_model getInstance() public static home_model getInstance()
{ {
return ourInstance; return ourInstance;
} }
@ -47,7 +45,7 @@ public class app_model
} }
public void setPort(int port) public void setPort(int port)
{ {
app_model.port = port; home_model.port = port;
} }
@ -61,11 +59,11 @@ public class app_model
} }
public application_controller getAppInstance() public home_controller getHomeInstance()
{ {
return appInstance; return appInstance;
} }
public void setAppInstance(application_controller appInstance) public void setAppInstance(home_controller appInstance)
{ {
this.appInstance = appInstance; this.appInstance = appInstance;
} }
@ -80,7 +78,7 @@ public class app_model
{ {
database_controller.getInstance().execSQL("delete from history where 1"); database_controller.getInstance().execSQL("delete from history where 1");
} }
app_model.getInstance().getAppInstance().reInitializeSuggestion(); home_model.getInstance().getHomeInstance().reInitializeSuggestion();
} }
public void addHistory(String url) { public void addHistory(String url) {
@ -146,7 +144,7 @@ public class app_model
suggestions.add(actual_url); suggestions.add(actual_url);
} }
suggestions.add(url.replace("https://","").replace("http://","")); suggestions.add(url.replace("https://","").replace("http://",""));
app_model.getInstance().getAppInstance().reInitializeSuggestion(); home_model.getInstance().getHomeInstance().reInitializeSuggestion();
} }
public ArrayList<String> getSuggestions() { public ArrayList<String> getSuggestions() {
return new ArrayList<String>(suggestions); return new ArrayList<String>(suggestions);
@ -166,7 +164,7 @@ public class app_model
/*Helper Method*/ /*Helper Method*/
public boolean isUrlRepeatable(String url,String viewUrl){ public boolean isUrlRepeatable(String url,String viewUrl){
return url.equals(viewUrl) && !app_model.getInstance().getAppInstance().isInternetErrorOpened() || url.contains("https://boogle.store/search?q=&"); return url.equals(viewUrl) && !home_model.getInstance().getHomeInstance().isInternetErrorOpened() || url.contains("https://boogle.store/search?q=&");
} }

View File

@ -19,7 +19,6 @@ import com.darkweb.genesissearchengine.constants.*;
import com.darkweb.genesissearchengine.dataManager.preference_manager; import com.darkweb.genesissearchengine.dataManager.preference_manager;
import com.darkweb.genesissearchengine.helperMethod; import com.darkweb.genesissearchengine.helperMethod;
import com.darkweb.genesissearchengine.httpManager.serverRequestManager; import com.darkweb.genesissearchengine.httpManager.serverRequestManager;
import com.darkweb.genesissearchengine.pluginManager.admanager;
import com.darkweb.genesissearchengine.pluginManager.message_manager; import com.darkweb.genesissearchengine.pluginManager.message_manager;
import com.darkweb.genesissearchengine.pluginManager.orbot_manager; import com.darkweb.genesissearchengine.pluginManager.orbot_manager;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -70,7 +69,7 @@ public class viewController
this.splashlogo = splashlogo; this.splashlogo = splashlogo;
this.loadingText = loadingText; this.loadingText = loadingText;
app_model.getInstance().getAppInstance().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); home_model.getInstance().getHomeInstance().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
checkSSLTextColor(); checkSSLTextColor();
initSplashScreen(); initSplashScreen();
initLock(); initLock();
@ -81,7 +80,7 @@ public class viewController
private void initializeSuggestionView() private void initializeSuggestionView()
{ {
AutoCompleteAdapter suggestionAdapter = new AutoCompleteAdapter(app_model.getInstance().getAppInstance(), R.layout.hint_view, R.id.hintCompletionHeader, app_model.getInstance().getSuggestions()); AutoCompleteAdapter suggestionAdapter = new AutoCompleteAdapter(home_model.getInstance().getHomeInstance(), R.layout.hint_view, R.id.hintCompletionHeader, home_model.getInstance().getSuggestions());
int width = Math.round(helperMethod.screenWidth()); int width = Math.round(helperMethod.screenWidth());
searchbar.setThreshold(2); searchbar.setThreshold(2);
@ -91,7 +90,7 @@ public class viewController
searchbar.setDropDownHorizontalOffset(Math.round(width*0.114f)*-1); searchbar.setDropDownHorizontalOffset(Math.round(width*0.114f)*-1);
Drawable drawable; Drawable drawable;
Resources res = app_model.getInstance().getAppInstance().getResources(); Resources res = home_model.getInstance().getHomeInstance().getResources();
try { try {
drawable = Drawable.createFromXml(res, res.getXml(R.xml.rouned_corner)); drawable = Drawable.createFromXml(res, res.getXml(R.xml.rouned_corner));
searchbar.setDropDownBackgroundDrawable(drawable); searchbar.setDropDownBackgroundDrawable(drawable);
@ -108,7 +107,7 @@ public class viewController
private boolean isHiddenView() private boolean isHiddenView()
{ {
return app_model.getInstance().getAppInstance().isGeckoViewRunning(); return home_model.getInstance().getHomeInstance().isGeckoViewRunning();
} }
private void initViews() private void initViews()
@ -118,7 +117,7 @@ public class viewController
private void initLock() private void initLock()
{ {
Drawable img = app_model.getInstance().getAppInstance().getResources().getDrawable( R.drawable.icon_lock); Drawable img = home_model.getInstance().getHomeInstance().getResources().getDrawable( R.drawable.icon_lock);
searchbar.measure(0, 0); searchbar.measure(0, 0);
img.setBounds( 0, (int)(searchbar.getMeasuredHeight()*0.00), (int)(searchbar.getMeasuredHeight()*1.10), (int)(searchbar.getMeasuredHeight()*0.69) ); img.setBounds( 0, (int)(searchbar.getMeasuredHeight()*0.00), (int)(searchbar.getMeasuredHeight()*1.10), (int)(searchbar.getMeasuredHeight()*0.69) );
searchbar.setCompoundDrawables( img, null, null, null ); searchbar.setCompoundDrawables( img, null, null, null );
@ -150,7 +149,7 @@ public class viewController
onClearSearchBarCursor(); onClearSearchBarCursor();
onProgressBarUpdate(0); onProgressBarUpdate(0);
disableFloatingView(); disableFloatingView();
app_model.getInstance().getAppInstance().releaseSession(); home_model.getInstance().getHomeInstance().releaseSession();
} }
private void disableSplashScreen() private void disableSplashScreen()
@ -203,7 +202,7 @@ public class viewController
} }
else if(msg.what == messages.DISABLE_SPLASH_SCREEN) else if(msg.what == messages.DISABLE_SPLASH_SCREEN)
{ {
boolean e_status = app_model.getInstance().getAppInstance().initSearchEngine(); boolean e_status = home_model.getInstance().getHomeInstance().initSearchEngine();
if(e_status) if(e_status)
{ {
@ -255,7 +254,7 @@ public class viewController
disableSplashScreen(); disableSplashScreen();
floatingButton.animate().alpha(0).withEndAction((() -> floatingButton.setVisibility(View.GONE))); floatingButton.animate().alpha(0).withEndAction((() -> floatingButton.setVisibility(View.GONE)));
app_model.getInstance().getAppInstance().stopHiddenView(false,false); home_model.getInstance().getHomeInstance().stopHiddenView(false,false);
} }
else else
{ {
@ -304,13 +303,17 @@ public class viewController
void onUpdateSearchBar(String url) void onUpdateSearchBar(String url)
{ {
searchbar.setText(url.replace(constants.backendUrlHost,constants.frontEndUrlHost_v1)); if(!url.equals("about:blank"))
checkSSLTextColor(); {
searchbar.setText(url.replace(constants.backendUrlHost,constants.frontEndUrlHost_v1));
checkSSLTextColor();
}
} }
private void initSplashScreen() private void initSplashScreen()
{ {
boolean hasSoftKey = helperMethod.hasSoftKeys(app_model.getInstance().getAppInstance().getWindowManager()); boolean hasSoftKey = helperMethod.hasSoftKeys(home_model.getInstance().getHomeInstance().getWindowManager());
int height = helperMethod.screenHeight(hasSoftKey); int height = helperMethod.screenHeight(hasSoftKey);
splashlogo.getLayoutParams().height = height; splashlogo.getLayoutParams().height = height;
@ -341,17 +344,17 @@ public class viewController
void onBackPressed() void onBackPressed()
{ {
if(app_model.getInstance().getNavigation().size()>0) if(home_model.getInstance().getNavigation().size()>0)
{ {
if(app_model.getInstance().getNavigation().size()==1) if(home_model.getInstance().getNavigation().size()==1)
{ {
onProgressBarUpdate(0); onProgressBarUpdate(0);
helperMethod.onMinimizeApp(); helperMethod.onMinimizeApp();
return; return;
} }
else if(app_model.getInstance().getNavigation().get(app_model.getInstance().getNavigation().size()-2).type().equals(enums.navigationType.base)) else if(home_model.getInstance().getNavigation().get(home_model.getInstance().getNavigation().size()-2).type().equals(enums.navigationType.base))
{ {
app_model.getInstance().getAppInstance().stopHiddenView(true,true); home_model.getInstance().getHomeInstance().stopHiddenView(true,true);
if(webView.getVisibility()==View.VISIBLE) if(webView.getVisibility()==View.VISIBLE)
{ {
onProgressBarUpdate(4); onProgressBarUpdate(4);
@ -363,7 +366,7 @@ public class viewController
} }
/*CHANGED BUT NOT TESTED*/ /*CHANGED BUT NOT TESTED*/
app_model.getInstance().getNavigation().remove(app_model.getInstance().getNavigation().size()-1); home_model.getInstance().getNavigation().remove(home_model.getInstance().getNavigation().size()-1);
webView.bringToFront(); webView.bringToFront();
webView.setAlpha(1); webView.setAlpha(1);
@ -374,16 +377,16 @@ public class viewController
} }
else else
{ {
app_model.getInstance().getAppInstance().stopHiddenView(true,true); home_model.getInstance().getHomeInstance().stopHiddenView(true,true);
app_model.getInstance().getNavigation().remove(app_model.getInstance().getNavigation().size()-1); home_model.getInstance().getNavigation().remove(home_model.getInstance().getNavigation().size()-1);
if(webView.getVisibility()==View.VISIBLE) if(webView.getVisibility()==View.VISIBLE)
{ {
app_model.getInstance().getAppInstance().onReInitGeckoView(); home_model.getInstance().getHomeInstance().onReInitGeckoView();
app_model.getInstance().getAppInstance().onReloadHiddenView(); home_model.getInstance().getHomeInstance().onReloadHiddenView();
} }
else else
{ {
app_model.getInstance().getAppInstance().onHiddenGoBack(); home_model.getInstance().getHomeInstance().onHiddenGoBack();
} }
} }
} }
@ -424,13 +427,13 @@ public class viewController
{ {
LinearLayout parentView = (LinearLayout)view.getParent(); LinearLayout parentView = (LinearLayout)view.getParent();
PopupMenu popup = new PopupMenu(app_model.getInstance().getAppInstance(), parentView,Gravity.RIGHT); PopupMenu popup = new PopupMenu(home_model.getInstance().getHomeInstance(), parentView,Gravity.RIGHT);
MenuInflater inflater = popup.getMenuInflater(); MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.menu_main, popup.getMenu()); inflater.inflate(R.menu.menu_main, popup.getMenu());
MenuCompat.setGroupDividerEnabled(popup.getMenu(), true); MenuCompat.setGroupDividerEnabled(popup.getMenu(), true);
popup.setOnMenuItemClickListener(item -> popup.setOnMenuItemClickListener(item ->
{ {
app_model.getInstance().getAppInstance().onMenuOptionSelected(item); home_model.getInstance().getHomeInstance().onMenuOptionSelected(item);
return true; return true;
}); });
popup.show(); popup.show();
@ -439,14 +442,14 @@ public class viewController
void onReload() void onReload()
{ {
if(app_model.getInstance().getNavigation().get(app_model.getInstance().getNavigation().size()-1).type()==enums.navigationType.base) if(home_model.getInstance().getNavigation().get(home_model.getInstance().getNavigation().size()-1).type()==enums.navigationType.base)
{ {
onRequestTriggered(false,webView.getUrl()); onRequestTriggered(false,webView.getUrl());
webView.reload(); webView.reload();
} }
else else
{ {
app_model.getInstance().getAppInstance().onReloadHiddenView(); home_model.getInstance().getHomeInstance().onReloadHiddenView();
} }
} }

View File

@ -3,7 +3,6 @@ package com.darkweb.genesissearchengine.appManager.home_activity;
import android.webkit.WebChromeClient; import android.webkit.WebChromeClient;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
import com.darkweb.genesissearchengine.constants.constants;
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.helperMethod; import com.darkweb.genesissearchengine.helperMethod;
@ -21,34 +20,36 @@ public class webviewClient
@Override @Override
public boolean shouldOverrideUrlLoading(WebView view, String url) public boolean shouldOverrideUrlLoading(WebView view, String url)
{ {
isGeckoView = false; if(url.contains("advert"))
if(app_model.getInstance().isUrlRepeatable(url,view.getUrl()))
{ {
app_model.getInstance().getAppInstance().onProgressBarUpdateView(0); home_model.getInstance().getHomeInstance().onProgressBarUpdateView(0);
helperMethod.openPlayStore(url.split("__")[1]);
return true;
}
isGeckoView = false;
if(home_model.getInstance().isUrlRepeatable(url,view.getUrl()))
{
home_model.getInstance().getHomeInstance().onProgressBarUpdateView(0);
return true; return true;
} }
if(!url.contains("boogle")) if(!url.contains("boogle"))
{ {
if(url.startsWith("advert")) home_model.getInstance().getHomeInstance().stopHiddenView(false,false);
{
helperMethod.openPlayStore(url.split("__")[1]);
return true;
}
app_model.getInstance().getAppInstance().stopHiddenView(false,false);
fabricManager.getInstance().sendEvent("BASE SIMPLE SEARCHED : " + url); fabricManager.getInstance().sendEvent("BASE SIMPLE SEARCHED : " + url);
isGeckoView = true; isGeckoView = true;
if(orbot_manager.getInstance().initOrbot(url)) if(orbot_manager.getInstance().initOrbot(url))
{ {
app_model.getInstance().getAppInstance().onloadURL(url,true,true); home_model.getInstance().getHomeInstance().onloadURL(url,true,true);
} }
return true; return true;
} }
else else
{ {
app_model.getInstance().addNavigation(url,enums.navigationType.base); home_model.getInstance().addNavigation(url,enums.navigationType.base);
app_model.getInstance().addHistory(url); home_model.getInstance().addHistory(url);
fabricManager.getInstance().sendEvent("BASE ONION SEARCHED : " + url); fabricManager.getInstance().sendEvent("BASE ONION SEARCHED : " + url);
app_model.getInstance().getAppInstance().onRequestTriggered(false,url); home_model.getInstance().getHomeInstance().onRequestTriggered(false,url);
return false; return false;
} }
} }
@ -56,9 +57,9 @@ public class webviewClient
public void onPageFinished(WebView view, String url) public void onPageFinished(WebView view, String url)
{ {
super.onPageFinished(view, url); super.onPageFinished(view, url);
app_model.getInstance().getAppInstance().onPageFinished(false); home_model.getInstance().getHomeInstance().onPageFinished(false);
app_model.getInstance().getAppInstance().onUpdateSearchBarView(url); home_model.getInstance().getHomeInstance().onUpdateSearchBarView(url);
app_model.getInstance().getAppInstance().onProgressBarUpdateView(0); home_model.getInstance().getHomeInstance().onProgressBarUpdateView(0);
status.isApplicationLoaded = true; status.isApplicationLoaded = true;
fabricManager.getInstance().sendEvent("BASE SUCCESSFULLY LOADED : " + url); fabricManager.getInstance().sendEvent("BASE SUCCESSFULLY LOADED : " + url);
} }
@ -67,7 +68,7 @@ public class webviewClient
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
{ {
fabricManager.getInstance().sendEvent("BASE URL ERROR : " + failingUrl + "--" + description); fabricManager.getInstance().sendEvent("BASE URL ERROR : " + failingUrl + "--" + description);
app_model.getInstance().getAppInstance().onInternetErrorView(); home_model.getInstance().getHomeInstance().onInternetErrorView();
} }
}; };
@ -81,11 +82,11 @@ public class webviewClient
{ {
if(newProgress<95 && newProgress>5) if(newProgress<95 && newProgress>5)
{ {
app_model.getInstance().getAppInstance().onProgressBarUpdateView(newProgress); home_model.getInstance().getHomeInstance().onProgressBarUpdateView(newProgress);
} }
else if(newProgress<=5) else if(newProgress<=5)
{ {
app_model.getInstance().getAppInstance().onProgressBarUpdateView(4); home_model.getInstance().getHomeInstance().onProgressBarUpdateView(4);
} }
} }
} }

View File

@ -3,12 +3,11 @@ package com.darkweb.genesissearchengine.appManager.list_manager;
import android.view.View; import android.view.View;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
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.home_activity.app_model; import com.darkweb.genesissearchengine.appManager.home_activity.home_model;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.keys;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -47,12 +46,12 @@ public class list_controller extends AppCompatActivity
if(Objects.requireNonNull(bundle).getInt(keys.list_type)==constants.list_bookmark) if(Objects.requireNonNull(bundle).getInt(keys.list_type)==constants.list_bookmark)
{ {
list_model.getInstance().setType(constants.list_bookmark); list_model.getInstance().setType(constants.list_bookmark);
list_model.getInstance().setMainList(app_model.getInstance().getBookmark()); list_model.getInstance().setMainList(home_model.getInstance().getBookmark());
} }
else else
{ {
list_model.getInstance().setType(constants.list_history); list_model.getInstance().setType(constants.list_history);
list_model.getInstance().setMainList(app_model.getInstance().getHistory()); list_model.getInstance().setMainList(home_model.getInstance().getHistory());
} }
} }
public void initializeViews(){ public void initializeViews(){

View File

@ -5,7 +5,7 @@ import android.view.View;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.EditText; import android.widget.EditText;
import com.darkweb.genesissearchengine.appManager.home_activity.app_model; import com.darkweb.genesissearchengine.appManager.home_activity.home_model;
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.helperMethod; import com.darkweb.genesissearchengine.helperMethod;
@ -76,18 +76,18 @@ public class list_ehandler
{ {
String url_temp = helperMethod.completeURL(url); String url_temp = helperMethod.completeURL(url);
app_model.getInstance().addNavigation(url, enums.navigationType.onion); home_model.getInstance().addNavigation(url, enums.navigationType.onion);
if(!url_temp.contains("boogle") && !url_temp.equals(constants.backendGoogle) && !url_temp.equals(constants.backendBing)) if(!url_temp.contains("boogle") && !url_temp.equals(constants.backendGoogle) && !url_temp.equals(constants.backendBing))
{ {
if(orbot_manager.getInstance().initOrbot(url_temp)) if(orbot_manager.getInstance().initOrbot(url_temp))
{ {
app_model.getInstance().getAppInstance().onloadURL(url_temp,true,false); home_model.getInstance().getHomeInstance().onloadURL(url_temp,true,false);
} }
} }
else else
{ {
app_model.getInstance().getAppInstance().onloadURL(url_temp,false,false); home_model.getInstance().getHomeInstance().onloadURL(url_temp,false,false);
} }
list_model.getInstance().getListInstance().closeView(); list_model.getInstance().getListInstance().closeView();

View File

@ -1,16 +1,11 @@
package com.darkweb.genesissearchengine.appManager.list_manager; package com.darkweb.genesissearchengine.appManager.list_manager;
import android.graphics.Color;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.view.View; import android.view.View;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.appManager.database_manager.database_controller; import com.darkweb.genesissearchengine.appManager.database_manager.database_controller;
import com.darkweb.genesissearchengine.appManager.home_activity.app_model; import com.darkweb.genesissearchengine.appManager.home_activity.home_model;
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.pluginManager.message_manager; import com.darkweb.genesissearchengine.pluginManager.message_manager;
@ -39,7 +34,7 @@ class list_view_controller
void onClearHistory() void onClearHistory()
{ {
if(app_model.getInstance().getHistory().size()>0) if(home_model.getInstance().getHistory().size()>0)
{ {
message_manager.getInstance().clearData(); message_manager.getInstance().clearData();
} }
@ -49,7 +44,7 @@ class list_view_controller
{ {
list_model.getInstance().getModel().clear(); list_model.getInstance().getModel().clear();
list_model.getInstance().getMainList().clear(); list_model.getInstance().getMainList().clear();
app_model.getInstance().getSuggestions().clear(); home_model.getInstance().getSuggestions().clear();
emptyListNotifier.setAlpha(0f); emptyListNotifier.setAlpha(0f);
emptyListNotifier.setVisibility(View.VISIBLE); emptyListNotifier.setVisibility(View.VISIBLE);

View File

@ -2,7 +2,7 @@ package com.darkweb.genesissearchengine.appManager.setting_manager;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Spinner; import android.widget.Spinner;
import com.darkweb.genesissearchengine.appManager.home_activity.app_model; import com.darkweb.genesissearchengine.appManager.home_activity.home_model;
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;
@ -84,12 +84,12 @@ class setting_view_controller
if(status.search_status != setting_model.getInstance().search_status) if(status.search_status != setting_model.getInstance().search_status)
{ {
status.search_status = setting_model.getInstance().search_status; status.search_status = setting_model.getInstance().search_status;
app_model.getInstance().getAppInstance().initSearchEngine(); home_model.getInstance().getHomeInstance().initSearchEngine();
} }
else if(status.java_status != setting_model.getInstance().java_status) else if(status.java_status != setting_model.getInstance().java_status)
{ {
status.java_status = setting_model.getInstance().java_status; status.java_status = setting_model.getInstance().java_status;
app_model.getInstance().getAppInstance().onReInitGeckoView(); home_model.getInstance().getHomeInstance().onReInitGeckoView();
} }
status.history_status = setting_model.getInstance().history_status; status.history_status = setting_model.getInstance().history_status;

View File

@ -3,14 +3,10 @@ package com.darkweb.genesissearchengine.appManager.setting_manager;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.Spinner; import android.widget.Spinner;
import com.darkweb.genesissearchengine.appManager.home_activity.app_model;
import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.dataManager.preference_manager; import com.darkweb.genesissearchengine.dataManager.preference_manager;
import com.example.myapplication.R; import com.example.myapplication.R;
import static com.darkweb.genesissearchengine.constants.status.*;
import static com.darkweb.genesissearchengine.constants.status.search_status;
public class settings_ehandler public class settings_ehandler
{ {
/*Initializations*/ /*Initializations*/

View File

@ -9,4 +9,5 @@ public class messages
public final static int DISABLE_SPLASH_SCREEN =3; public final static int DISABLE_SPLASH_SCREEN =3;
public final static int UPDATE_LOADING_TEXT =5; public final static int UPDATE_LOADING_TEXT =5;
public final static int SHOW_ADS =6; public final static int SHOW_ADS =6;
public final static int DOWNLOAD_NOTIFICATION =7;
} }

View File

@ -62,6 +62,10 @@ public class strings
public static String clear_bt1 = "Clear Data"; public static String clear_bt1 = "Clear Data";
public static String clear_bt2 = "Dismiss"; public static String clear_bt2 = "Dismiss";
public static String download_title = "Download Notification";
public static String download_message = "Download File | ";
public static String download_positive = "Download";
public static String download_negative = "Dismiss";
/*Text Manager*/ /*Text Manager*/
@ -75,5 +79,6 @@ public class strings
} }

View File

@ -2,7 +2,7 @@ package com.darkweb.genesissearchengine.dataManager;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import com.darkweb.genesissearchengine.appManager.home_activity.app_model; import com.darkweb.genesissearchengine.appManager.home_activity.home_model;
public class preference_manager public class preference_manager
{ {
@ -25,7 +25,7 @@ public class preference_manager
public void initialize() public void initialize()
{ {
prefs = PreferenceManager.getDefaultSharedPreferences(app_model.getInstance().getAppContext()); prefs = PreferenceManager.getDefaultSharedPreferences(home_model.getInstance().getAppContext());
edit = prefs.edit(); edit = prefs.edit();
} }

View File

@ -1,16 +1,13 @@
package com.darkweb.genesissearchengine; package com.darkweb.genesissearchengine;
import android.app.DownloadManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Color;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.view.Display; import android.view.Display;
import android.view.View; import android.view.View;
@ -20,22 +17,20 @@ import android.view.animation.Animation;
import android.view.animation.RotateAnimation; import android.view.animation.RotateAnimation;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import androidx.core.app.ShareCompat; import androidx.core.app.ShareCompat;
import com.darkweb.genesissearchengine.appManager.home_activity.app_model; import com.darkweb.genesissearchengine.appManager.home_activity.home_model;
import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.dataManager.preference_manager; import com.darkweb.genesissearchengine.dataManager.preference_manager;
import com.example.myapplication.BuildConfig; import com.example.myapplication.BuildConfig;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.text.Normalizer;
import java.util.Locale;
public class helperMethod public class helperMethod
{ {
/*Helper Methods*/ /*Helper Methods*/
public static boolean isNetworkAvailable(){ public static boolean isNetworkAvailable(){
ConnectivityManager cm = (ConnectivityManager) app_model.getInstance().getAppContext().getSystemService(Context.CONNECTIVITY_SERVICE); ConnectivityManager cm = (ConnectivityManager) home_model.getInstance().getAppContext().getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = cm.getActiveNetworkInfo(); NetworkInfo networkInfo = cm.getActiveNetworkInfo();
return networkInfo != null && networkInfo.isConnected(); return networkInfo != null && networkInfo.isConnected();
} }
@ -51,28 +46,34 @@ public class helperMethod
} }
public static void hideKeyboard() { public static void hideKeyboard() {
View view = app_model.getInstance().getAppInstance().findViewById(android.R.id.content); View view = home_model.getInstance().getHomeInstance().findViewById(android.R.id.content);
if (view != null) if (view != null)
{ {
InputMethodManager imm = (InputMethodManager) app_model.getInstance().getAppInstance().getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager) home_model.getInstance().getHomeInstance().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0); imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
} }
} }
public static void rateApp(){ public static void rateApp(){
preference_manager.getInstance().setBool(keys.isAppRated,true); preference_manager.getInstance().setBool(keys.isAppRated,true);
app_model.getInstance().getAppInstance().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.darkweb.genesissearchengine"))); home_model.getInstance().getHomeInstance().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.darkweb.genesissearchengine")));
} }
public static void shareApp() { public static void shareApp() {
ShareCompat.IntentBuilder.from(app_model.getInstance().getAppInstance()) ShareCompat.IntentBuilder.from(home_model.getInstance().getHomeInstance())
.setType("text/plain") .setType("text/plain")
.setChooserTitle("Hi! Check out this Awesome App") .setChooserTitle("Hi! Check out this Awesome App")
.setSubject("Hi! Check out this Awesome App") .setSubject("Hi! Check out this Awesome App")
.setText("Genesis | Onion Search | http://play.google.com/store/apps/details?id=" + app_model.getInstance().getAppInstance().getPackageName()) .setText("Genesis | Onion Search | http://play.google.com/store/apps/details?id=" + home_model.getInstance().getHomeInstance().getPackageName())
.startChooser(); .startChooser();
} }
public static void openDownloadFolder()
{
home_model.getInstance().getHomeInstance().startActivity(new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS));
}
public static String getHost(String link){ public static String getHost(String link){
URL url = null; URL url = null;
try try
@ -90,16 +91,16 @@ public class helperMethod
} }
public static void openActivity( Class<?> cls,int type){ public static void openActivity( Class<?> cls,int type){
Intent myIntent = new Intent(app_model.getInstance().getAppInstance(), cls); Intent myIntent = new Intent(home_model.getInstance().getHomeInstance(), cls);
myIntent.putExtra(keys.list_type, type); myIntent.putExtra(keys.list_type, type);
app_model.getInstance().getAppInstance().startActivity(myIntent); home_model.getInstance().getHomeInstance().startActivity(myIntent);
} }
public static void onMinimizeApp(){ public static void onMinimizeApp(){
Intent startMain = new Intent(Intent.ACTION_MAIN); Intent startMain = new Intent(Intent.ACTION_MAIN);
startMain.addCategory(Intent.CATEGORY_HOME); startMain.addCategory(Intent.CATEGORY_HOME);
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
app_model.getInstance().getAppInstance().startActivity(startMain); home_model.getInstance().getHomeInstance().startActivity(startMain);
} }
/*Splash Screen Initializations*/ /*Splash Screen Initializations*/
@ -121,7 +122,7 @@ public class helperMethod
} }
public static int getNavigationBarHeight() { public static int getNavigationBarHeight() {
Resources resources = app_model.getInstance().getAppContext().getResources(); Resources resources = home_model.getInstance().getAppContext().getResources();
int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android"); int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
if (resourceId > 0) { if (resourceId > 0) {
return resources.getDimensionPixelSize(resourceId); return resources.getDimensionPixelSize(resourceId);
@ -171,7 +172,6 @@ public class helperMethod
{ {
Intent intent = new Intent(Intent.ACTION_VIEW); Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id="+packageName)); intent.setData(Uri.parse("market://details?id="+packageName));
app_model.getInstance().getAppInstance().startActivity(intent); home_model.getInstance().getHomeInstance().startActivity(intent);
} }
} }

View File

@ -5,7 +5,7 @@ import android.os.Message;
import android.os.Handler; import android.os.Handler;
import com.darkweb.genesissearchengine.appManager.home_activity.app_model; import com.darkweb.genesissearchengine.appManager.home_activity.home_model;
import com.darkweb.genesissearchengine.constants.messages; import com.darkweb.genesissearchengine.constants.messages;
public class webRequestHandler public class webRequestHandler
@ -63,11 +63,11 @@ public class webRequestHandler
{ {
if(msg.what == messages.MESSAGE_UPDATE_TEXT_CHILD_THREAD) if(msg.what == messages.MESSAGE_UPDATE_TEXT_CHILD_THREAD)
{ {
//app_model.getInstance().getAppInstance().onloadURL(client.getHtmlResponse()); //home_model.getInstance().getHomeInstance().onloadURL(client.getHtmlResponse());
} }
else if (msg.what == messages.INTERNET_ERROR) else if (msg.what == messages.INTERNET_ERROR)
{ {
app_model.getInstance().getAppInstance().onInternetErrorView(); home_model.getInstance().getHomeInstance().onInternetErrorView();
} }
} }
}; };

View File

@ -1,6 +1,6 @@
package com.darkweb.genesissearchengine.pluginManager; package com.darkweb.genesissearchengine.pluginManager;
import com.darkweb.genesissearchengine.appManager.home_activity.app_model; import com.darkweb.genesissearchengine.appManager.home_activity.home_model;
import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.enums;
import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.InterstitialAd; import com.google.android.gms.ads.InterstitialAd;
@ -28,7 +28,7 @@ public class admanager
public void initialize() public void initialize()
{ {
MobileAds.initialize(app_model.getInstance().getAppInstance(), "ca-app-pub-5074525529134731~2926711128"); MobileAds.initialize(home_model.getInstance().getHomeInstance(), "ca-app-pub-5074525529134731~2926711128");
mInterstitialHidden_base = initAd("ca-app-pub-5074525529134731/1637043432"); mInterstitialHidden_base = initAd("ca-app-pub-5074525529134731/1637043432");
//mInterstitialHidden_onion = initAd("ca-app-pub-5074525529134731/4332539288"); //mInterstitialHidden_onion = initAd("ca-app-pub-5074525529134731/4332539288");
//mInterstitialInternal = initAd("ca-app-pub-5074525529134731/8478420705"); //mInterstitialInternal = initAd("ca-app-pub-5074525529134731/8478420705");
@ -36,7 +36,7 @@ public class admanager
public InterstitialAd initAd(String id) public InterstitialAd initAd(String id)
{ {
InterstitialAd adInstance = new InterstitialAd(app_model.getInstance().getAppInstance()); InterstitialAd adInstance = new InterstitialAd(home_model.getInstance().getHomeInstance());
adInstance.setAdUnitId(id); adInstance.setAdUnitId(id);
adInstance.loadAd(new AdRequest.Builder().build()); adInstance.loadAd(new AdRequest.Builder().build());

View File

@ -54,8 +54,8 @@ public class analyticmanager
public void sendEvent(String value) public void sendEvent(String value)
{ {
firebase.getInstance().logEvent(value,uniqueID); //firebase.getInstance().logEvent(value,uniqueID);
Answers.getInstance().logCustom(new CustomEvent(value)); //Answers.getInstance().logCustom(new CustomEvent(value));
} }

View File

@ -1,9 +1,5 @@
package com.darkweb.genesissearchengine.pluginManager; package com.darkweb.genesissearchengine.pluginManager;
import com.crashlytics.android.Crashlytics;
import com.darkweb.genesissearchengine.appManager.home_activity.app_model;
import io.fabric.sdk.android.Fabric;
public class fabricManager public class fabricManager
{ {
/*Private Variables*/ /*Private Variables*/
@ -23,9 +19,9 @@ public class fabricManager
public void init() public void init()
{ {
Fabric.with(app_model.getInstance().getAppContext(), new Crashlytics()); //Fabric.with(home_model.getInstance().getAppContext(), new Crashlytics());
analyticmanager.getInstance().initialize(app_model.getInstance().getAppContext()); //analyticmanager.getInstance().initialize(home_model.getInstance().getAppContext());
analyticmanager.getInstance().logUser(); //analyticmanager.getInstance().logUser();
} }
/*Helper Methods*/ /*Helper Methods*/

View File

@ -19,7 +19,7 @@ public class firebase
public void initialize() public void initialize()
{ {
//mFirebaseAnalytics = FirebaseAnalytics.getInstance(app_model.getInstance().getAppContext()); //mFirebaseAnalytics = FirebaseAnalytics.getInstance(home_model.getInstance().getAppContext());
} }
/*Helper Methods*/ /*Helper Methods*/

View File

@ -0,0 +1,86 @@
package com.darkweb.genesissearchengine.pluginManager;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.SystemClock;
import androidx.core.app.NotificationCompat;
import com.darkweb.genesissearchengine.appManager.home_activity.home_model;
import com.example.myapplication.R;
public class localNotification
{
private static final localNotification ourInstance = new localNotification();
public static localNotification getInstance()
{
return ourInstance;
}
private localNotification()
{
mContext = home_model.getInstance().getAppContext();
}
private Context mContext;
private NotificationManager mNotificationManager;
private NotificationCompat.Builder mBuilder;
public static final String NOTIFICATION_CHANNEL_ID = "10001";
/**
* Create and push the notification
*/
public void createNotification(String title, String message)
{
/**Creates an explicit intent for an Activity in your app**/
Intent resultIntent = new Intent(mContext , home_model.getInstance().getHomeInstance().getClass());
resultIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent resultPendingIntent = PendingIntent.getActivity(mContext,
0 /* Request code */, resultIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder = new NotificationCompat.Builder(mContext);
mBuilder.setSmallIcon(R.xml.ic_icon_download_notification);
mBuilder.setContentTitle(title)
.setContentText(message)
.setAutoCancel(true)
.setContentIntent(resultPendingIntent);
mNotificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O)
{
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel notificationChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, "NOTIFICATION_CHANNEL_NAME", importance);
assert mNotificationManager != null;
mBuilder.setChannelId(NOTIFICATION_CHANNEL_ID);
mNotificationManager.createNotificationChannel(notificationChannel);
}
assert mNotificationManager != null;
int oneTimeID = (int) SystemClock.uptimeMillis();
mNotificationManager.notify(oneTimeID, mBuilder.build());
mNotificationManager.notify(oneTimeID /* Request Code */, mBuilder.build());
new Thread()
{
public void run()
{
try
{
sleep(5000);
mNotificationManager.cancel(oneTimeID);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
}.start();
}
}

View File

@ -10,9 +10,9 @@ import android.text.InputType;
import android.widget.EditText; import android.widget.EditText;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import com.crowdfire.cfalertdialog.CFAlertDialog; import com.crowdfire.cfalertdialog.CFAlertDialog;
import com.darkweb.genesissearchengine.appManager.home_activity.home_model;
import com.darkweb.genesissearchengine.appManager.list_manager.list_model; import com.darkweb.genesissearchengine.appManager.list_manager.list_model;
import com.darkweb.genesissearchengine.appManager.home_activity.app_model; import com.darkweb.genesissearchengine.appManager.home_activity.home_controller;
import com.darkweb.genesissearchengine.appManager.home_activity.application_controller;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.strings; import com.darkweb.genesissearchengine.constants.strings;
@ -38,8 +38,8 @@ public class message_manager
/*Helper Methods*/ /*Helper Methods*/
public void welcomeMessage() public void welcomeMessage()
{ {
Context application_context = app_model.getInstance().getAppContext(); Context application_context = home_model.getInstance().getAppContext();
application_controller controller = app_model.getInstance().getAppInstance(); home_controller controller = home_model.getInstance().getHomeInstance();
CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context)
.setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT) .setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT)
@ -78,7 +78,7 @@ public class message_manager
public void baseURLError() public void baseURLError()
{ {
Context application_context = app_model.getInstance().getAppContext(); Context application_context = home_model.getInstance().getAppContext();
CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context)
.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
.setTitle(strings.base_error_title) .setTitle(strings.base_error_title)
@ -94,7 +94,7 @@ public class message_manager
public void abiError(String currentAbi) public void abiError(String currentAbi)
{ {
Context application_context = app_model.getInstance().getAppContext(); Context application_context = home_model.getInstance().getAppContext();
CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context)
.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
.setTitle(strings.abi_error_title) .setTitle(strings.abi_error_title)
@ -121,7 +121,7 @@ public class message_manager
public void ratedSuccessfully() public void ratedSuccessfully()
{ {
Context application_context = app_model.getInstance().getAppContext(); Context application_context = home_model.getInstance().getAppContext();
CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context)
.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
.setTitle(strings.rate_success_title) .setTitle(strings.rate_success_title)
@ -137,7 +137,7 @@ public class message_manager
public void reportedSuccessfully(String title,String desc) public void reportedSuccessfully(String title,String desc)
{ {
Context application_context = app_model.getInstance().getAppContext(); Context application_context = home_model.getInstance().getAppContext();
CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context)
.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
.setTitle(title) .setTitle(title)
@ -155,16 +155,16 @@ public class message_manager
public void bookmark(String url) public void bookmark(String url)
{ {
final EditText input = new EditText(app_model.getInstance().getAppInstance()); final EditText input = new EditText(home_model.getInstance().getHomeInstance());
input.setInputType(InputType.TYPE_CLASS_TEXT); input.setInputType(InputType.TYPE_CLASS_TEXT);
input.setText(""); input.setText("");
input.setBackground(ContextCompat.getDrawable(app_model.getInstance().getAppContext(), R.xml.search_back_default)); input.setBackground(ContextCompat.getDrawable(home_model.getInstance().getAppContext(), R.xml.search_back_default));
input.setPadding(40,15,40,15); input.setPadding(40,15,40,15);
input.setHeight(80); input.setHeight(80);
input.setTextSize(17); input.setTextSize(17);
input.setHint("Enter Bookmark Title"); input.setHint("Enter Bookmark Title");
Context application_context = app_model.getInstance().getAppContext(); Context application_context = home_model.getInstance().getAppContext();
CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context)
.setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT) .setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT)
.setBackgroundColor(application_context.getResources().getColor(R.color.blue_dark_v2)) .setBackgroundColor(application_context.getResources().getColor(R.color.blue_dark_v2))
@ -173,7 +173,7 @@ public class message_manager
.setHeaderView(input) .setHeaderView(input)
.setMessage("Bookmark URL | " + url + "\n") .setMessage("Bookmark URL | " + url + "\n")
.addButton(strings.bookmark_url_bt1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { .addButton(strings.bookmark_url_bt1, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> {
app_model.getInstance().addBookmark(url.replace("genesis.onion","boogle.store"),input.getText().toString()); home_model.getInstance().addBookmark(url.replace("genesis.onion","boogle.store"),input.getText().toString());
dialog.dismiss(); dialog.dismiss();
}) })
.addButton(strings.bookmark_url_bt2, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { .addButton(strings.bookmark_url_bt2, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> {
@ -206,7 +206,7 @@ public class message_manager
public void reportURL() public void reportURL()
{ {
Context application_context = app_model.getInstance().getAppContext(); Context application_context = home_model.getInstance().getAppContext();
CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context)
.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
.setTitle(strings.report_url_title) .setTitle(strings.report_url_title)
@ -226,7 +226,7 @@ public class message_manager
public void rateApp() public void rateApp()
{ {
Context application_context = app_model.getInstance().getAppContext(); Context application_context = home_model.getInstance().getAppContext();
CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context)
.setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT) .setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT)
.setTitle(strings.rate_title) .setTitle(strings.rate_title)
@ -235,7 +235,7 @@ public class message_manager
.setMessage(strings.rate_message) .setMessage(strings.rate_message)
.addButton(strings.rate_positive, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { .addButton(strings.rate_positive, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> {
preference_manager.getInstance().setBool(keys.isAppRated,true); preference_manager.getInstance().setBool(keys.isAppRated,true);
app_model.getInstance().getAppInstance().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.darkweb.genesissearchengine"))); home_model.getInstance().getHomeInstance().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.darkweb.genesissearchengine")));
dialog.dismiss(); dialog.dismiss();
}) })
.addButton(strings.rate_negative, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { .addButton(strings.rate_negative, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> {
@ -247,12 +247,32 @@ public class message_manager
builder.show(); builder.show();
} }
public void downloadFile(String filename)
{
Context application_context = home_model.getInstance().getAppContext();
CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context)
.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
.setTitle(strings.download_title)
.setBackgroundColor(application_context.getResources().getColor(R.color.blue_dark_v2))
.setTextColor(application_context.getResources().getColor(R.color.black))
.setMessage(strings.download_message + filename)
.addButton(strings.download_positive, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> {
home_model.getInstance().getHomeInstance().downloadFile();
dialog.dismiss();
})
.addButton(strings.download_negative, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> {
dialog.dismiss();
});
builder.show();
}
public void startingOrbotInfo(String url) public void startingOrbotInfo(String url)
{ {
if(!isPopupOn) if(!isPopupOn)
{ {
isPopupOn = true; isPopupOn = true;
Context application_context = app_model.getInstance().getAppContext(); Context application_context = home_model.getInstance().getAppContext();
CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context)
.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
.setTitle(strings.orbot_init_title) .setTitle(strings.orbot_init_title)
@ -279,11 +299,11 @@ public class message_manager
{ {
if(!url.equals("")) if(!url.equals(""))
{ {
app_model.getInstance().getAppInstance().onloadURL(url,true,true); home_model.getInstance().getHomeInstance().onloadURL(url,true,true);
} }
else else
{ {
app_model.getInstance().getAppInstance().onReload(); home_model.getInstance().getHomeInstance().onReload();
} }
} }
}, 500); }, 500);
@ -296,7 +316,7 @@ public class message_manager
public void versionWarning(String currentAbi) public void versionWarning(String currentAbi)
{ {
Context application_context = app_model.getInstance().getAppContext(); Context application_context = home_model.getInstance().getAppContext();
CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context)
.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
.setTitle(strings.version_title) .setTitle(strings.version_title)

View File

@ -1,6 +1,6 @@
package com.darkweb.genesissearchengine.pluginManager; package com.darkweb.genesissearchengine.pluginManager;
import com.darkweb.genesissearchengine.appManager.home_activity.app_model; import com.darkweb.genesissearchengine.appManager.home_activity.home_model;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.constants.status;
@ -75,7 +75,7 @@ public class orbot_manager {
{ {
if(onionProxyManager == null) if(onionProxyManager == null)
{ {
onionProxyManager = new AndroidOnionProxyManager(app_model.getInstance().getAppContext(), strings.torfolder); onionProxyManager = new AndroidOnionProxyManager(home_model.getInstance().getAppContext(), strings.torfolder);
} }
isLoading = false; isLoading = false;
status.isTorInitialized = false; status.isTorInitialized = false;
@ -121,7 +121,7 @@ public class orbot_manager {
continue; continue;
} }
app_model.getInstance().setPort(onionProxyManager.getIPv4LocalHostSocksPort()); home_model.getInstance().setPort(onionProxyManager.getIPv4LocalHostSocksPort());
initializeProxy(); initializeProxy();
status.isTorInitialized = true; status.isTorInitialized = true;
isLoading = false; isLoading = false;
@ -144,7 +144,7 @@ public class orbot_manager {
{ {
PrefsHelper.setPref(keys.proxy_type, constants.proxy_type); PrefsHelper.setPref(keys.proxy_type, constants.proxy_type);
PrefsHelper.setPref(keys.proxy_socks,constants.proxy_socks); PrefsHelper.setPref(keys.proxy_socks,constants.proxy_socks);
PrefsHelper.setPref(keys.proxy_socks_port, app_model.getInstance().getPort()); PrefsHelper.setPref(keys.proxy_socks_port, home_model.getInstance().getPort());
PrefsHelper.setPref(keys.proxy_socks_version,constants.proxy_socks_version); PrefsHelper.setPref(keys.proxy_socks_version,constants.proxy_socks_version);
PrefsHelper.setPref(keys.proxy_socks_remote_dns,constants.proxy_socks_remote_dns); PrefsHelper.setPref(keys.proxy_socks_remote_dns,constants.proxy_socks_remote_dns);
PrefsHelper.setPref(keys.proxy_cache,constants.proxy_cache); PrefsHelper.setPref(keys.proxy_cache,constants.proxy_cache);

View File

@ -6,7 +6,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white" android:background="@color/white"
tools:context="com.darkweb.genesissearchengine.appManager.home_activity.application_controller"> tools:context="com.darkweb.genesissearchengine.appManager.home_activity.home_controller">
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">

View File

@ -3,6 +3,10 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
tools:context="example.javatpoint.com.optionmenu.MainActivity"> tools:context="example.javatpoint.com.optionmenu.MainActivity">
<item android:id="@+id/menu0"
android:title="Downloads"
app:showAsAction="always"
android:icon="@android:drawable/btn_star"/>
<item android:id="@+id/menu1" <item android:id="@+id/menu1"
android:title="History" android:title="History"
app:showAsAction="always" app:showAsAction="always"

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M19,9h-4V3H9v6H5l7,7 7,-7zM5,18v2h14v-2H5z"/>
</vector>

View File

@ -18,8 +18,8 @@
project.ext.dimen = 'abi' project.ext.dimen = 'abi'
/*firefox version*/ /*firefox version*/
project.ext.firefox_version = "67.0.20190613202504" project.ext.firefox_version = "70.0.20190809215748"
project.ext.firefox_channel = "" project.ext.firefox_channel = "nightly"
/*Application Preferences*/ /*Application Preferences*/
project.ext.compileSdkVersion = 29 project.ext.compileSdkVersion = 29

View File

@ -2,6 +2,7 @@ buildscript {
repositories { repositories {
google() google()
jcenter() jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.fabric.io/public' } maven { url 'https://maven.fabric.io/public' }
} }
dependencies { dependencies {