diff --git a/app/build.gradle b/app/build.gradle index 6e0406b8..ebed4259 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,6 @@ apply plugin: 'com.android.application' apply from: 'variables.gradle' apply plugin: 'maven' -apply plugin: 'io.fabric' ext { @@ -41,7 +40,7 @@ android { flavorDimensions project.ext.dimen productFlavors { - /*arm { + arm { versionCode project.ext.arm_vcode versionName project.ext.arm_vname dimension project.ext.dimen @@ -50,17 +49,17 @@ android { versionCode project.ext.aarch_vcode versionName project.ext.aarch_vname dimension project.ext.dimen - }*/ + } x86 { versionCode project.ext.x86_vcode versionName project.ext.x86_vname dimension project.ext.dimen } - /*x86_64 { + x86_64 { versionCode project.ext.x64_vcode versionName project.ext.x64_vname dimension project.ext.dimen - }*/ + } } @@ -97,10 +96,10 @@ dependencies { implementation 'com.android.support:appcompat-v7:28.0.0' /*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" //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*/ implementation 'com.crowdfire.cfalertdialog:cfalertdialog:1.1.0' @@ -116,6 +115,7 @@ dependencies { /*Crashlytics*/ implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1' implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') + } apply plugin: 'com.android.application' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2377d09c..b822e229 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -31,7 +31,7 @@ android:required="false"/> @@ -48,6 +48,12 @@ + + + \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/database_manager/database_controller.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/database_manager/database_controller.java index 78e7312f..55ad4fe9 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/database_manager/database_controller.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/database_manager/database_controller.java @@ -2,8 +2,8 @@ package com.darkweb.genesissearchengine.appManager.database_manager; import android.database.Cursor; 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.home_activity.app_model; import com.darkweb.genesissearchengine.constants.constants; import java.util.ArrayList; @@ -33,7 +33,7 @@ public class database_controller { 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 " + "bookmark" + " (id INT(4),title VARCHAR,url VARCHAR);"); @@ -58,7 +58,7 @@ public class database_controller if (c.moveToFirst()){ do { 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()); } c.close(); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/DownloadFileService.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/DownloadFileService.java new file mode 100644 index 00000000..d5d201ff --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/DownloadFileService.java @@ -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); + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/downloadManager.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/downloadManager.java deleted file mode 100644 index 6fc642df..00000000 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/downloadManager.java +++ /dev/null @@ -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() - { - } - -} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/geckoClients.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/geckoClients.java index da4e0fc0..4978fa9a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/geckoClients.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/geckoClients.java @@ -1,19 +1,28 @@ 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.util.Log; 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.dataManager.preference_manager; import com.darkweb.genesissearchengine.pluginManager.fabricManager; +import com.darkweb.genesissearchengine.pluginManager.localNotification; import com.darkweb.genesissearchengine.pluginManager.message_manager; import com.darkweb.genesissearchengine.pluginManager.orbot_manager; -import org.mozilla.geckoview.GeckoResult; -import org.mozilla.geckoview.GeckoRuntime; -import org.mozilla.geckoview.GeckoSession; -import org.mozilla.geckoview.GeckoView; +import org.mozilla.geckoview.*; -import java.util.ArrayList; +import java.util.LinkedList; + +import static com.google.ads.AdRequest.LOGTAG; class geckoClients { @@ -52,8 +61,8 @@ class geckoClients navigatedURL = ""; loadingCompeleted = false; session1.loadUri(url); - app_model.getInstance().getAppInstance().onRequestTriggered(true,url); - app_model.getInstance().getAppInstance().onProgressBarUpdateView(4); + home_model.getInstance().getHomeInstance().onRequestTriggered(true,url); + home_model.getInstance().getHomeInstance().onProgressBarUpdateView(4); isFirstTimeLoad = true; wasBackPressed = false; isContentLoading = false; @@ -64,7 +73,7 @@ class geckoClients void initialize(GeckoView geckoView) { session1 = new GeckoSession(); - runtime1 = GeckoRuntime.getDefault(app_model.getInstance().getAppContext()); + runtime1 = GeckoRuntime.getDefault(home_model.getInstance().getAppContext()); runtime1.getSettings().setJavaScriptEnabled(status.java_status); session1.open(runtime1); geckoView.releaseSession(); @@ -73,11 +82,12 @@ class geckoClients session1.setNavigationDelegate(new navigationDelegate()); geckoView.setVisibility(View.VISIBLE); geckoView.setAlpha(1); + session1.setContentDelegate(new ExampleContentDelegate()); } 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 @@ -86,10 +96,10 @@ class geckoClients public void onLocationChange(GeckoSession session, String 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); - app_model.getInstance().addNavigation(navigatedURL,enums.navigationType.onion); + home_model.getInstance().addHistory(navigatedURL); + home_model.getInstance().addNavigation(navigatedURL,enums.navigationType.onion); } } @@ -113,7 +123,7 @@ class geckoClients loadingCompeleted = false; 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); navigatedURL = url; @@ -133,12 +143,12 @@ class geckoClients { if(isFirstTimeLoad) { - app_model.getInstance().getAppInstance().hideSplashScreen(); + home_model.getInstance().getHomeInstance().hideSplashScreen(); } if(!success && !isContentLoading && !wasBackPressed) { - app_model.getInstance().getAppInstance().onPageFinished(true); - app_model.getInstance().getAppInstance().onInternetErrorView(); + home_model.getInstance().getHomeInstance().onPageFinished(true); + home_model.getInstance().getHomeInstance().onInternetErrorView(); fabricManager.getInstance().sendEvent("ONION GECKO_CLIENT URL ERROR : " + success + "--" + isContentLoading); } else if(success) @@ -148,30 +158,30 @@ class geckoClients { if(!isAppRated) { - isAppRated = true; - message_manager.getInstance().rateApp(); + //isAppRated = true; + //message_manager.getInstance().rateApp(); } } else if(isAppRated || 1==1) { 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")) { - app_model.getInstance().getAppInstance().onShowAd(enums.adID.hidden_onion); + home_model.getInstance().getHomeInstance().onShowAd(enums.adID.hidden_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(); - app_model.getInstance().getAppInstance().onProgressBarUpdateView(0); + home_model.getInstance().getHomeInstance().onDisableInternetError(); + home_model.getInstance().getHomeInstance().onProgressBarUpdateView(0); fabricManager.getInstance().sendEvent("ONION GECKO_CLIENT URL SUCCESS : " + success + "--" + isContentLoading); - app_model.getInstance().getAppInstance().onPageFinished(true); + home_model.getInstance().getHomeInstance().onPageFinished(true); } isUrlSavable = true; @@ -194,11 +204,11 @@ class geckoClients } else if(progress>=5) { - app_model.getInstance().getAppInstance().onProgressBarUpdateView(progress); + home_model.getInstance().getHomeInstance().onProgressBarUpdateView(progress); } else { - app_model.getInstance().getAppInstance().onProgressBarUpdateView(4); + home_model.getInstance().getHomeInstance().onProgressBarUpdateView(4); } } @@ -218,12 +228,12 @@ class geckoClients wasBackPressed = true; session1.stop(); - if(app_model.getInstance().getAppInstance().isInternetErrorOpened()) + if(home_model.getInstance().getHomeInstance().isInternetErrorOpened()) { 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) @@ -258,7 +268,7 @@ class geckoClients 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; loadingCompeleted = false; @@ -267,7 +277,188 @@ class geckoClients wasBackPressed = true; 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 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); + } + } + + + + } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/application_controller.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/home_controller.java similarity index 84% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/application_controller.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/home_controller.java index e6877b26..107cc426 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/application_controller.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/home_controller.java @@ -19,7 +19,7 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton; import org.mozilla.geckoview.GeckoView; -public class application_controller extends AppCompatActivity +public class home_controller extends AppCompatActivity { /*View Webviews*/ 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); firebase.getInstance().initialize(); geckoclient.initialize(geckoView); - app_model.getInstance().initialization(); + home_model.getInstance().initialization(); initBoogle(); - downloadManager.getInstance().initialize(); + + } else { @@ -92,13 +93,13 @@ public class application_controller extends AppCompatActivity { webView.stopLoading(); 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; } @@ -106,26 +107,26 @@ public class application_controller extends AppCompatActivity { webView.stopLoading(); 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; } else { 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; } @@ -133,8 +134,8 @@ public class application_controller extends AppCompatActivity public void initializeAppModel() { - app_model.getInstance().setAppContext(this); - app_model.getInstance().setAppInstance(this); + home_model.getInstance().setAppContext(this); + home_model.getInstance().setAppInstance(this); } public void initializeConnections() @@ -143,14 +144,6 @@ public class application_controller extends AppCompatActivity 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); requestFailure = findViewById(R.id.requestFailure); splashScreen = findViewById(R.id.splashScreen); @@ -225,7 +218,7 @@ public class application_controller extends AppCompatActivity { 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); onRequestTriggered(isHiddenWeb,url); @@ -343,6 +336,11 @@ public class application_controller extends AppCompatActivity return requestFailure.getAlpha()==1; } + public void downloadFile() + { + geckoclient.downloadFile(); + } + /*-------------------------------------------------------Menu Handler----------------------------------------------------*/ public boolean onMenuOptionSelected(MenuItem item) { @@ -351,5 +349,7 @@ public class application_controller extends AppCompatActivity return super.onOptionsItemSelected(item); } + + } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/home_ehandler.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/home_ehandler.java index 27a569ea..87f6ef20 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/home_ehandler.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/home_ehandler.java @@ -1,6 +1,5 @@ package com.darkweb.genesissearchengine.appManager.home_activity; -import android.util.Log; import android.util.Patterns; import android.view.KeyEvent; import android.view.View; @@ -21,11 +20,11 @@ import java.net.URL; public class home_ehandler { - application_controller appContoller; + home_controller appContoller; public home_ehandler() { - appContoller = app_model.getInstance().getAppInstance(); + appContoller = home_model.getInstance().getHomeInstance(); } public boolean onEditorClicked(TextView v, int actionId, KeyEvent event) @@ -54,7 +53,7 @@ public class home_ehandler else { 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; } } @@ -63,7 +62,7 @@ public class home_ehandler catch (IOException e){} String editedURL = getSearchEngine(v.getText().toString().replaceAll(" ","+")); - app_model.getInstance().addHistory(editedURL); + home_model.getInstance().addHistory(editedURL); appContoller.onloadURL(editedURL,false,true); appContoller.onClearSearchBarCursorView(); fabricManager.getInstance().sendEvent("EDITOR SEARCHED : " + editedURL); @@ -133,7 +132,7 @@ public class home_ehandler } 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) { @@ -151,6 +150,10 @@ public class home_ehandler { helperMethod.shareApp(); } + else if (menuId == R.id.menu0) + { + helperMethod.openDownloadFolder(); + } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/app_model.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/home_model.java similarity index 85% rename from app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/app_model.java rename to app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/home_model.java index fd4fb8de..f597ac1a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/app_model.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/home_model.java @@ -3,17 +3,15 @@ package com.darkweb.genesissearchengine.appManager.home_activity; import android.content.Context; import android.net.Uri; 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.constants.constants; import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.status; -import com.darkweb.genesissearchengine.helperMethod; import java.text.SimpleDateFormat; import java.util.*; -public class app_model +public class home_model { /*Data Objects*/ private ArrayList history = new ArrayList(); @@ -23,7 +21,7 @@ public class app_model private static int port = 9150; private Context appContext; - private application_controller appInstance; + private home_controller appInstance; /*Initializations*/ public void initialization(){ @@ -33,8 +31,8 @@ public class app_model } /*Setter Getter Initializations*/ - private static final app_model ourInstance = new app_model(); - public static app_model getInstance() + private static final home_model ourInstance = new home_model(); + public static home_model getInstance() { return ourInstance; } @@ -47,7 +45,7 @@ public class app_model } 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; } - public void setAppInstance(application_controller appInstance) + public void setAppInstance(home_controller appInstance) { this.appInstance = appInstance; } @@ -80,7 +78,7 @@ public class app_model { database_controller.getInstance().execSQL("delete from history where 1"); } - app_model.getInstance().getAppInstance().reInitializeSuggestion(); + home_model.getInstance().getHomeInstance().reInitializeSuggestion(); } public void addHistory(String url) { @@ -146,7 +144,7 @@ public class app_model suggestions.add(actual_url); } suggestions.add(url.replace("https://","").replace("http://","")); - app_model.getInstance().getAppInstance().reInitializeSuggestion(); + home_model.getInstance().getHomeInstance().reInitializeSuggestion(); } public ArrayList getSuggestions() { return new ArrayList(suggestions); @@ -166,7 +164,7 @@ public class app_model /*Helper Method*/ 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=&"); } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/viewController.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/viewController.java index d591d0db..fb52a345 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/viewController.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/viewController.java @@ -19,7 +19,6 @@ import com.darkweb.genesissearchengine.constants.*; import com.darkweb.genesissearchengine.dataManager.preference_manager; import com.darkweb.genesissearchengine.helperMethod; import com.darkweb.genesissearchengine.httpManager.serverRequestManager; -import com.darkweb.genesissearchengine.pluginManager.admanager; import com.darkweb.genesissearchengine.pluginManager.message_manager; import com.darkweb.genesissearchengine.pluginManager.orbot_manager; import com.example.myapplication.R; @@ -70,7 +69,7 @@ public class viewController this.splashlogo = splashlogo; 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(); initSplashScreen(); initLock(); @@ -81,7 +80,7 @@ public class viewController 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()); searchbar.setThreshold(2); @@ -91,7 +90,7 @@ public class viewController searchbar.setDropDownHorizontalOffset(Math.round(width*0.114f)*-1); Drawable drawable; - Resources res = app_model.getInstance().getAppInstance().getResources(); + Resources res = home_model.getInstance().getHomeInstance().getResources(); try { drawable = Drawable.createFromXml(res, res.getXml(R.xml.rouned_corner)); searchbar.setDropDownBackgroundDrawable(drawable); @@ -108,7 +107,7 @@ public class viewController private boolean isHiddenView() { - return app_model.getInstance().getAppInstance().isGeckoViewRunning(); + return home_model.getInstance().getHomeInstance().isGeckoViewRunning(); } private void initViews() @@ -118,7 +117,7 @@ public class viewController 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); img.setBounds( 0, (int)(searchbar.getMeasuredHeight()*0.00), (int)(searchbar.getMeasuredHeight()*1.10), (int)(searchbar.getMeasuredHeight()*0.69) ); searchbar.setCompoundDrawables( img, null, null, null ); @@ -150,7 +149,7 @@ public class viewController onClearSearchBarCursor(); onProgressBarUpdate(0); disableFloatingView(); - app_model.getInstance().getAppInstance().releaseSession(); + home_model.getInstance().getHomeInstance().releaseSession(); } private void disableSplashScreen() @@ -203,7 +202,7 @@ public class viewController } 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) { @@ -255,7 +254,7 @@ public class viewController disableSplashScreen(); floatingButton.animate().alpha(0).withEndAction((() -> floatingButton.setVisibility(View.GONE))); - app_model.getInstance().getAppInstance().stopHiddenView(false,false); + home_model.getInstance().getHomeInstance().stopHiddenView(false,false); } else { @@ -304,13 +303,17 @@ public class viewController void onUpdateSearchBar(String url) { - searchbar.setText(url.replace(constants.backendUrlHost,constants.frontEndUrlHost_v1)); - checkSSLTextColor(); + if(!url.equals("about:blank")) + { + searchbar.setText(url.replace(constants.backendUrlHost,constants.frontEndUrlHost_v1)); + checkSSLTextColor(); + } + } 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); splashlogo.getLayoutParams().height = height; @@ -341,17 +344,17 @@ public class viewController 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); helperMethod.onMinimizeApp(); 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) { onProgressBarUpdate(4); @@ -363,7 +366,7 @@ public class viewController } /*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.setAlpha(1); @@ -374,16 +377,16 @@ public class viewController } else { - app_model.getInstance().getAppInstance().stopHiddenView(true,true); - app_model.getInstance().getNavigation().remove(app_model.getInstance().getNavigation().size()-1); + home_model.getInstance().getHomeInstance().stopHiddenView(true,true); + home_model.getInstance().getNavigation().remove(home_model.getInstance().getNavigation().size()-1); if(webView.getVisibility()==View.VISIBLE) { - app_model.getInstance().getAppInstance().onReInitGeckoView(); - app_model.getInstance().getAppInstance().onReloadHiddenView(); + home_model.getInstance().getHomeInstance().onReInitGeckoView(); + home_model.getInstance().getHomeInstance().onReloadHiddenView(); } else { - app_model.getInstance().getAppInstance().onHiddenGoBack(); + home_model.getInstance().getHomeInstance().onHiddenGoBack(); } } } @@ -424,13 +427,13 @@ public class viewController { 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(); inflater.inflate(R.menu.menu_main, popup.getMenu()); MenuCompat.setGroupDividerEnabled(popup.getMenu(), true); popup.setOnMenuItemClickListener(item -> { - app_model.getInstance().getAppInstance().onMenuOptionSelected(item); + home_model.getInstance().getHomeInstance().onMenuOptionSelected(item); return true; }); popup.show(); @@ -439,14 +442,14 @@ public class viewController 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()); webView.reload(); } else { - app_model.getInstance().getAppInstance().onReloadHiddenView(); + home_model.getInstance().getHomeInstance().onReloadHiddenView(); } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/webviewClient.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/webviewClient.java index fdca1593..7c3828c7 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/webviewClient.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/home_activity/webviewClient.java @@ -3,7 +3,6 @@ package com.darkweb.genesissearchengine.appManager.home_activity; import android.webkit.WebChromeClient; import android.webkit.WebView; import android.webkit.WebViewClient; -import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.status; import com.darkweb.genesissearchengine.helperMethod; @@ -21,34 +20,36 @@ public class webviewClient @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { - isGeckoView = false; - if(app_model.getInstance().isUrlRepeatable(url,view.getUrl())) + if(url.contains("advert")) { - 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; } if(!url.contains("boogle")) { - if(url.startsWith("advert")) - { - helperMethod.openPlayStore(url.split("__")[1]); - return true; - } - app_model.getInstance().getAppInstance().stopHiddenView(false,false); + home_model.getInstance().getHomeInstance().stopHiddenView(false,false); fabricManager.getInstance().sendEvent("BASE SIMPLE SEARCHED : " + url); isGeckoView = true; if(orbot_manager.getInstance().initOrbot(url)) { - app_model.getInstance().getAppInstance().onloadURL(url,true,true); + home_model.getInstance().getHomeInstance().onloadURL(url,true,true); } return true; } else { - app_model.getInstance().addNavigation(url,enums.navigationType.base); - app_model.getInstance().addHistory(url); + home_model.getInstance().addNavigation(url,enums.navigationType.base); + home_model.getInstance().addHistory(url); fabricManager.getInstance().sendEvent("BASE ONION SEARCHED : " + url); - app_model.getInstance().getAppInstance().onRequestTriggered(false,url); + home_model.getInstance().getHomeInstance().onRequestTriggered(false,url); return false; } } @@ -56,9 +57,9 @@ public class webviewClient public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); - app_model.getInstance().getAppInstance().onPageFinished(false); - app_model.getInstance().getAppInstance().onUpdateSearchBarView(url); - app_model.getInstance().getAppInstance().onProgressBarUpdateView(0); + home_model.getInstance().getHomeInstance().onPageFinished(false); + home_model.getInstance().getHomeInstance().onUpdateSearchBarView(url); + home_model.getInstance().getHomeInstance().onProgressBarUpdateView(0); status.isApplicationLoaded = true; 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) { 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) { - app_model.getInstance().getAppInstance().onProgressBarUpdateView(newProgress); + home_model.getInstance().getHomeInstance().onProgressBarUpdateView(newProgress); } else if(newProgress<=5) { - app_model.getInstance().getAppInstance().onProgressBarUpdateView(4); + home_model.getInstance().getHomeInstance().onProgressBarUpdateView(4); } } } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_controller.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_controller.java index 6e20c1e7..7b1a8f25 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_controller.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_controller.java @@ -3,12 +3,11 @@ package com.darkweb.genesissearchengine.appManager.list_manager; import android.view.View; import android.widget.EditText; import android.widget.ImageView; -import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import androidx.recyclerview.widget.LinearLayoutManager; 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.keys; 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) { list_model.getInstance().setType(constants.list_bookmark); - list_model.getInstance().setMainList(app_model.getInstance().getBookmark()); + list_model.getInstance().setMainList(home_model.getInstance().getBookmark()); } else { 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(){ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_ehandler.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_ehandler.java index 3d95662c..a4b32b12 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_ehandler.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_ehandler.java @@ -5,7 +5,7 @@ import android.view.View; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; 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.enums; import com.darkweb.genesissearchengine.helperMethod; @@ -76,18 +76,18 @@ public class list_ehandler { 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(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 { - app_model.getInstance().getAppInstance().onloadURL(url_temp,false,false); + home_model.getInstance().getHomeInstance().onloadURL(url_temp,false,false); } list_model.getInstance().getListInstance().closeView(); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_view_controller.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_view_controller.java index 6e8c8c88..7e4b412a 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_view_controller.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/list_manager/list_view_controller.java @@ -1,16 +1,11 @@ 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.widget.EditText; import android.widget.ImageView; -import android.widget.TextView; import androidx.recyclerview.widget.RecyclerView; 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.strings; import com.darkweb.genesissearchengine.pluginManager.message_manager; @@ -39,7 +34,7 @@ class list_view_controller void onClearHistory() { - if(app_model.getInstance().getHistory().size()>0) + if(home_model.getInstance().getHistory().size()>0) { message_manager.getInstance().clearData(); } @@ -49,7 +44,7 @@ class list_view_controller { list_model.getInstance().getModel().clear(); list_model.getInstance().getMainList().clear(); - app_model.getInstance().getSuggestions().clear(); + home_model.getInstance().getSuggestions().clear(); emptyListNotifier.setAlpha(0f); emptyListNotifier.setVisibility(View.VISIBLE); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/setting_view_controller.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/setting_view_controller.java index 7d42fc9e..461adb81 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/setting_view_controller.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/setting_view_controller.java @@ -2,7 +2,7 @@ package com.darkweb.genesissearchengine.appManager.setting_manager; import android.widget.ArrayAdapter; 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.status; import com.darkweb.genesissearchengine.constants.strings; @@ -84,12 +84,12 @@ class setting_view_controller if(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) { 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; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/settings_ehandler.java b/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/settings_ehandler.java index 9cf0917d..c1d6db46 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/settings_ehandler.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/appManager/setting_manager/settings_ehandler.java @@ -3,14 +3,10 @@ package com.darkweb.genesissearchengine.appManager.setting_manager; import android.view.View; import android.widget.AdapterView; import android.widget.Spinner; -import com.darkweb.genesissearchengine.appManager.home_activity.app_model; import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.dataManager.preference_manager; 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 { /*Initializations*/ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java index 74ab7e60..e2c67e54 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/messages.java @@ -9,4 +9,5 @@ public class messages public final static int DISABLE_SPLASH_SCREEN =3; public final static int UPDATE_LOADING_TEXT =5; public final static int SHOW_ADS =6; + public final static int DOWNLOAD_NOTIFICATION =7; } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java b/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java index a6e8bbb4..6ffe55f1 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/constants/strings.java @@ -62,6 +62,10 @@ public class strings public static String clear_bt1 = "Clear Data"; 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*/ @@ -75,5 +79,6 @@ public class strings + } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/preference_manager.java b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/preference_manager.java index 1c7bb3be..1cd2ab34 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/dataManager/preference_manager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/dataManager/preference_manager.java @@ -2,7 +2,7 @@ package com.darkweb.genesissearchengine.dataManager; import android.content.SharedPreferences; 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 { @@ -25,7 +25,7 @@ public class preference_manager public void initialize() { - prefs = PreferenceManager.getDefaultSharedPreferences(app_model.getInstance().getAppContext()); + prefs = PreferenceManager.getDefaultSharedPreferences(home_model.getInstance().getAppContext()); edit = prefs.edit(); } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/helperMethod.java b/app/src/main/java/com/darkweb/genesissearchengine/helperMethod.java index 93dead56..826ebf94 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/helperMethod.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/helperMethod.java @@ -1,16 +1,13 @@ package com.darkweb.genesissearchengine; +import android.app.DownloadManager; import android.content.Context; import android.content.Intent; import android.content.res.Resources; -import android.graphics.Color; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.Uri; import android.os.Build; -import android.text.Spannable; -import android.text.SpannableString; -import android.text.style.ForegroundColorSpan; import android.util.DisplayMetrics; import android.view.Display; import android.view.View; @@ -20,22 +17,20 @@ import android.view.animation.Animation; import android.view.animation.RotateAnimation; import android.view.inputmethod.InputMethodManager; 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.dataManager.preference_manager; import com.example.myapplication.BuildConfig; import java.net.MalformedURLException; import java.net.URL; -import java.text.Normalizer; -import java.util.Locale; public class helperMethod { /*Helper Methods*/ 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(); return networkInfo != null && networkInfo.isConnected(); } @@ -51,28 +46,34 @@ public class helperMethod } 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) { - 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); } } public static void rateApp(){ 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() { - ShareCompat.IntentBuilder.from(app_model.getInstance().getAppInstance()) + ShareCompat.IntentBuilder.from(home_model.getInstance().getHomeInstance()) .setType("text/plain") .setChooserTitle("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(); } + public static void openDownloadFolder() + { + home_model.getInstance().getHomeInstance().startActivity(new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS)); + } + + public static String getHost(String link){ URL url = null; try @@ -90,16 +91,16 @@ public class helperMethod } 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); - app_model.getInstance().getAppInstance().startActivity(myIntent); + home_model.getInstance().getHomeInstance().startActivity(myIntent); } public static void onMinimizeApp(){ Intent startMain = new Intent(Intent.ACTION_MAIN); startMain.addCategory(Intent.CATEGORY_HOME); startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - app_model.getInstance().getAppInstance().startActivity(startMain); + home_model.getInstance().getHomeInstance().startActivity(startMain); } /*Splash Screen Initializations*/ @@ -121,7 +122,7 @@ public class helperMethod } 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"); if (resourceId > 0) { return resources.getDimensionPixelSize(resourceId); @@ -171,7 +172,6 @@ public class helperMethod { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("market://details?id="+packageName)); - app_model.getInstance().getAppInstance().startActivity(intent); + home_model.getInstance().getHomeInstance().startActivity(intent); } - } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/httpManager/webRequestHandler.java b/app/src/main/java/com/darkweb/genesissearchengine/httpManager/webRequestHandler.java index 83d46a21..57057873 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/httpManager/webRequestHandler.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/httpManager/webRequestHandler.java @@ -5,7 +5,7 @@ import android.os.Message; 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; public class webRequestHandler @@ -63,11 +63,11 @@ public class webRequestHandler { 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) { - app_model.getInstance().getAppInstance().onInternetErrorView(); + home_model.getInstance().getHomeInstance().onInternetErrorView(); } } }; diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/admanager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/admanager.java index 96a4d379..be524679 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/admanager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/admanager.java @@ -1,6 +1,6 @@ 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.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.InterstitialAd; @@ -28,7 +28,7 @@ public class admanager 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_onion = initAd("ca-app-pub-5074525529134731/4332539288"); //mInterstitialInternal = initAd("ca-app-pub-5074525529134731/8478420705"); @@ -36,7 +36,7 @@ public class admanager 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.loadAd(new AdRequest.Builder().build()); diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticmanager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticmanager.java index cc8575d1..a18b3b14 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticmanager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/analyticmanager.java @@ -54,8 +54,8 @@ public class analyticmanager public void sendEvent(String value) { - firebase.getInstance().logEvent(value,uniqueID); - Answers.getInstance().logCustom(new CustomEvent(value)); + //firebase.getInstance().logEvent(value,uniqueID); + //Answers.getInstance().logCustom(new CustomEvent(value)); } diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/fabricManager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/fabricManager.java index edbdcaa0..9c6a2ce9 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/fabricManager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/fabricManager.java @@ -1,9 +1,5 @@ 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 { /*Private Variables*/ @@ -23,9 +19,9 @@ public class fabricManager public void init() { - Fabric.with(app_model.getInstance().getAppContext(), new Crashlytics()); - analyticmanager.getInstance().initialize(app_model.getInstance().getAppContext()); - analyticmanager.getInstance().logUser(); + //Fabric.with(home_model.getInstance().getAppContext(), new Crashlytics()); + //analyticmanager.getInstance().initialize(home_model.getInstance().getAppContext()); + //analyticmanager.getInstance().logUser(); } /*Helper Methods*/ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/firebase.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/firebase.java index d3355177..9da09b21 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/firebase.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/firebase.java @@ -19,7 +19,7 @@ public class firebase public void initialize() { - //mFirebaseAnalytics = FirebaseAnalytics.getInstance(app_model.getInstance().getAppContext()); + //mFirebaseAnalytics = FirebaseAnalytics.getInstance(home_model.getInstance().getAppContext()); } /*Helper Methods*/ diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/localNotification.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/localNotification.java new file mode 100644 index 00000000..cf931485 --- /dev/null +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/localNotification.java @@ -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(); + + } +} diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/message_manager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/message_manager.java index ba18233a..c90e99ea 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/message_manager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/message_manager.java @@ -10,9 +10,9 @@ import android.text.InputType; import android.widget.EditText; import androidx.core.content.ContextCompat; 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.home_activity.app_model; -import com.darkweb.genesissearchengine.appManager.home_activity.application_controller; +import com.darkweb.genesissearchengine.appManager.home_activity.home_controller; import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.strings; @@ -38,8 +38,8 @@ public class message_manager /*Helper Methods*/ public void welcomeMessage() { - Context application_context = app_model.getInstance().getAppContext(); - application_controller controller = app_model.getInstance().getAppInstance(); + Context application_context = home_model.getInstance().getAppContext(); + home_controller controller = home_model.getInstance().getHomeInstance(); CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) .setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT) @@ -78,7 +78,7 @@ public class message_manager 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) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setTitle(strings.base_error_title) @@ -94,7 +94,7 @@ public class message_manager 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) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setTitle(strings.abi_error_title) @@ -121,7 +121,7 @@ public class message_manager 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) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setTitle(strings.rate_success_title) @@ -137,7 +137,7 @@ public class message_manager 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) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setTitle(title) @@ -155,16 +155,16 @@ public class message_manager 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.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.setHeight(80); input.setTextSize(17); 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) .setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT) .setBackgroundColor(application_context.getResources().getColor(R.color.blue_dark_v2)) @@ -173,7 +173,7 @@ public class message_manager .setHeaderView(input) .setMessage("Bookmark URL | " + url + "\n") .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(); }) .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() { - Context application_context = app_model.getInstance().getAppContext(); + Context application_context = home_model.getInstance().getAppContext(); CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setTitle(strings.report_url_title) @@ -226,7 +226,7 @@ public class message_manager 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) .setDialogStyle(CFAlertDialog.CFAlertStyle.ALERT) .setTitle(strings.rate_title) @@ -235,7 +235,7 @@ public class message_manager .setMessage(strings.rate_message) .addButton(strings.rate_positive, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { 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(); }) .addButton(strings.rate_negative, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> { @@ -247,12 +247,32 @@ public class message_manager 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) { if(!isPopupOn) { isPopupOn = true; - Context application_context = app_model.getInstance().getAppContext(); + Context application_context = home_model.getInstance().getAppContext(); CFAlertDialog.Builder builder = new CFAlertDialog.Builder(application_context) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setTitle(strings.orbot_init_title) @@ -279,11 +299,11 @@ public class message_manager { if(!url.equals("")) { - app_model.getInstance().getAppInstance().onloadURL(url,true,true); + home_model.getInstance().getHomeInstance().onloadURL(url,true,true); } else { - app_model.getInstance().getAppInstance().onReload(); + home_model.getInstance().getHomeInstance().onReload(); } } }, 500); @@ -296,7 +316,7 @@ public class message_manager 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) .setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET) .setTitle(strings.version_title) diff --git a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbot_manager.java b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbot_manager.java index a546c9bd..fcfbbfab 100644 --- a/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbot_manager.java +++ b/app/src/main/java/com/darkweb/genesissearchengine/pluginManager/orbot_manager.java @@ -1,6 +1,6 @@ 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.keys; import com.darkweb.genesissearchengine.constants.status; @@ -75,7 +75,7 @@ public class orbot_manager { { if(onionProxyManager == null) { - onionProxyManager = new AndroidOnionProxyManager(app_model.getInstance().getAppContext(), strings.torfolder); + onionProxyManager = new AndroidOnionProxyManager(home_model.getInstance().getAppContext(), strings.torfolder); } isLoading = false; status.isTorInitialized = false; @@ -121,7 +121,7 @@ public class orbot_manager { continue; } - app_model.getInstance().setPort(onionProxyManager.getIPv4LocalHostSocksPort()); + home_model.getInstance().setPort(onionProxyManager.getIPv4LocalHostSocksPort()); initializeProxy(); status.isTorInitialized = true; isLoading = false; @@ -144,7 +144,7 @@ public class orbot_manager { { PrefsHelper.setPref(keys.proxy_type, constants.proxy_type); 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_remote_dns,constants.proxy_socks_remote_dns); PrefsHelper.setPref(keys.proxy_cache,constants.proxy_cache); diff --git a/app/src/main/res/layout/home_view.xml b/app/src/main/res/layout/home_view.xml index 5d516814..49f0f075 100644 --- a/app/src/main/res/layout/home_view.xml +++ b/app/src/main/res/layout/home_view.xml @@ -6,7 +6,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" - tools:context="com.darkweb.genesissearchengine.appManager.home_activity.application_controller"> + tools:context="com.darkweb.genesissearchengine.appManager.home_activity.home_controller"> diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index 89bc7525..b885019b 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -3,6 +3,10 @@ xmlns:tools="http://schemas.android.com/tools" tools:context="example.javatpoint.com.optionmenu.MainActivity"> + + + diff --git a/app/variables.gradle b/app/variables.gradle index ea187fec..f03d665a 100644 --- a/app/variables.gradle +++ b/app/variables.gradle @@ -18,8 +18,8 @@ project.ext.dimen = 'abi' /*firefox version*/ - project.ext.firefox_version = "67.0.20190613202504" - project.ext.firefox_channel = "" + project.ext.firefox_version = "70.0.20190809215748" + project.ext.firefox_channel = "nightly" /*Application Preferences*/ project.ext.compileSdkVersion = 29 diff --git a/build.gradle b/build.gradle index 49a53a7f..b11e9f81 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,7 @@ buildscript { repositories { google() jcenter() + maven { url 'https://jitpack.io' } maven { url 'https://maven.fabric.io/public' } } dependencies {