Tor Fixes

master
msmannan00 2019-06-25 00:48:05 +05:00
parent 76a728fe59
commit 907173b534
21 changed files with 352 additions and 128 deletions

View File

@ -44,32 +44,31 @@ android {
flavorDimensions "abi"
productFlavors {
/*arm {
versionCode 156
versionName "156"
arm {
versionCode 175
versionName "175"
dimension "abi"
buildConfigField "String", "VARIANT", "\"arm\""
}*/
aarch64 {
versionCode 157
versionName "157"
dimension "abi"
buildConfigField "String", "VARIANT", "\"aarch64\""
}
/*
aarch64 {
versionCode 176
versionName "176"
dimension "abi"
buildConfigField "String", "VARIANT", "\"aarch64\""
}
x86 {
versionCode 158
versionName "158"
versionCode 177
versionName "177"
dimension "abi"
buildConfigField "String", "VARIANT", "\"i686\""
}
x86_64 {
versionCode 159
versionName "159"
versionCode 178
versionName "178"
dimension "abi"
buildConfigField "String", "VARIANT", "\"x86_64\""
}*/
}
}
@ -91,7 +90,7 @@ android {
universalApk true
}
}
}
}
}
configurations.all {
@ -107,27 +106,28 @@ configurations.all {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation "cz.msebera.android:httpclient:4.4.1.2"
implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta2'
implementation 'cz.msebera.android:httpclient:4.5.8'
//x86Implementation "org.mozilla.geckoview:geckoview-x86:67.0.20190521210220"
//x86_64Implementation "org.mozilla.geckoview:geckoview-x86_64:67.0.20190521210220"
//armImplementation "org.mozilla.geckoview:geckoview-armeabi-v7a:67.0.20190521210220"
x86Implementation "org.mozilla.geckoview:geckoview-x86:67.0.20190521210220"
x86_64Implementation "org.mozilla.geckoview:geckoview-x86_64:67.0.20190521210220"
armImplementation "org.mozilla.geckoview:geckoview-armeabi-v7a:67.0.20190521210220"
implementation 'com.google.firebase:firebase-core:17.0.0'
aarch64Implementation "org.mozilla.geckoview:geckoview-arm64-v8a:67.0.20190521210220"
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.crowdfire.cfalertdialog:cfalertdialog:1.1.0'
implementation 'com.github.jehy:Tor-Onion-Proxy-Library:0.0.7'
implementation 'org.slf4j:slf4j-api:1.7.7'
implementation 'org.slf4j:slf4j-android:1.7.7'
implementation 'org.slf4j:slf4j-api:2.0.0-alpha0'
implementation 'org.slf4j:slf4j-android:1.7.26'
implementation 'com.google.android.gms:play-services-ads:18.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.gms:play-services-ads:17.2.1'
implementation 'com.android.support:appcompat-v7:28.1.1'
implementation 'com.android.support:design:28.1.1'
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') {
transitive = true;
}
implementation 'com.android.support:appcompat-v7:28.0.0'
}
apply plugin: 'com.android.application'
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

48
app/google-services.json Normal file
View File

@ -0,0 +1,48 @@
{
"project_info": {
"project_number": "891955481900",
"firebase_url": "https://genesis-app-a512d.firebaseio.com",
"project_id": "genesis-app-a512d",
"storage_bucket": "genesis-app-a512d.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:891955481900:android:360c1798435c303f",
"android_client_info": {
"package_name": "com.darkweb.genesissearchengine"
}
},
"oauth_client": [
{
"client_id": "891955481900-20ves4hv1nujrthcs2u75to1gn6c3v59.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.darkweb.genesissearchengine",
"certificate_hash": "fc03dc31bd3710e568f8a20d1818adc49af8d139"
}
},
{
"client_id": "891955481900-94h8etf05qautcg9ue2vfc4ct2oikr3e.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCwvxQTaK8F6nevbWkL2t1TTEljQNZeKXc"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "891955481900-94h8etf05qautcg9ue2vfc4ct2oikr3e.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}

View File

@ -1,10 +1,11 @@
package com.darkweb.genesissearchengine.appManager;
import android.annotation.SuppressLint;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.support.constraint.ConstraintLayout;
import android.support.design.widget.FloatingActionButton;
import android.os.Looper;
import android.os.Message;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
@ -15,15 +16,21 @@ import android.webkit.WebView;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.messages;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.preference_manager;
import com.darkweb.genesissearchengine.helperMethod;
import com.darkweb.genesissearchengine.httpManager.serverRequestManager;
import com.darkweb.genesissearchengine.pluginManager.message_manager;
import com.darkweb.genesissearchengine.pluginManager.orbot_manager;
import com.example.myapplication.R;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import static java.lang.Thread.sleep;
import java.util.ArrayList;
public class applicationViewController
{
@ -36,7 +43,12 @@ public class applicationViewController
private FloatingActionButton floatingButton;
private ImageView loading;
private ImageView splashlogo;
private TextView loadingText;
/*Private Variables*/
private boolean pageLoadedSuccessfully = true;
private boolean isSplashLoading = false;
private Handler updateUIHandler = null;
/*ProgressBar Delayed Updater*/
Handler progressBarHandler = null;
@ -53,7 +65,7 @@ public class applicationViewController
{
}
public void initialization(WebView webView1, ProgressBar progressBar, EditText searchbar, ConstraintLayout splashScreen, ConstraintLayout requestFailure, FloatingActionButton floatingButton, ImageView loading, ImageView splashlogo)
public void initialization(WebView webView1, TextView loadingText, ProgressBar progressBar, EditText searchbar, ConstraintLayout splashScreen, ConstraintLayout requestFailure, FloatingActionButton floatingButton, ImageView loading, ImageView splashlogo)
{
this.webView = webView1;
this.progressBar = progressBar;
@ -63,12 +75,14 @@ public class applicationViewController
this.floatingButton = floatingButton;
this.loading = loading;
this.splashlogo = splashlogo;
this.loadingText = loadingText;
app_model.getInstance().getAppInstance().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
checkSSLTextColor();
initSplashScreen();
initLock();
initViews();
createUpdateUiHandler();
}
public boolean isHiddenView()
@ -107,19 +121,85 @@ public class applicationViewController
/*Helper Methods*/
public void onInternetError()
{
splashScreen.animate().setStartDelay(2000).alpha(0);
disableSplashScreen();
requestFailure.setVisibility(View.VISIBLE);
webView.setAlpha(0);
requestFailure.animate().alpha(1f).setDuration(150);
pageLoadedSuccessfully = false;
Log.i("jhgjhg",0+"");
onClearSearchBarCursor();
onProgressBarUpdate(0);
disableFloatingView();
}
public void onDisableInternetError()
public void disableSplashScreen()
{
requestFailure.animate().alpha(0f).setDuration(150).withEndAction((() -> requestFailure.setVisibility(View.INVISIBLE)));;
if(!isSplashLoading)
{
isSplashLoading = true;
new Thread()
{
public void run()
{
try
{
boolean isFirstInstall = preference_manager.getInstance().getBool(keys.hasOrbotInstalled,true);
while (!status.isTorInitialized && isFirstInstall)
{
startPostTask(messages.UPDATE_LOADING_TEXT);
sleep(100);
}
preference_manager.getInstance().setBool(keys.hasOrbotInstalled,false);
startPostTask(messages.DISABLE_SPLASH_SCREEN);
}
catch (Exception ex)
{
Log.i("Fizza",ex.getMessage());
}
}
}.start();
}
}
public void startPostTask(int m_id)
{
Message message = new Message();
message.what = m_id;
updateUIHandler.sendMessage(message);
}
@SuppressLint("HandlerLeak")
private void createUpdateUiHandler()
{
updateUIHandler = new Handler()
{
@Override
public void handleMessage(Message msg)
{
if(msg.what == messages.UPDATE_LOADING_TEXT)
{
loadingText.setText(orbot_manager.getInstance().getLogs());
}
if(msg.what == messages.DISABLE_SPLASH_SCREEN)
{
status.isApplicationLoaded = true;
splashScreen.animate().alpha(0.0f).setDuration(200).setListener(null).withEndAction((() -> splashScreen.setVisibility(View.GONE)));
onWelcomeMessageCheck();
}
}
};
}
public boolean onDisableInternetError()
{
if(requestFailure.getAlpha()==1)
{
requestFailure.animate().alpha(0f).setDuration(150).withEndAction((() -> requestFailure.setVisibility(View.INVISIBLE)));;
return true;
}
else
{
return false;
}
}
public void onPageFinished(boolean status)
@ -135,9 +215,8 @@ public class applicationViewController
onUpdateView(true);
}
//onUpdateSearchBar(webView.getUrl());
splashScreen.animate().alpha(0.0f).setStartDelay(150).setDuration(200).setListener(null).withEndAction((() -> splashScreen.setVisibility(View.GONE)));
disableSplashScreen();
floatingButton.animate().alpha(0).withEndAction((() -> floatingButton.setVisibility(View.GONE)));;
onWelcomeMessageCheck();
app_model.getInstance().getAppInstance().stopHiddenView();
}
@ -252,14 +331,11 @@ public class applicationViewController
public void onWelcomeMessageCheck()
{
if(!status.isApplicationLoaded)
if(!preference_manager.getInstance().getBool("FirstTimeLoaded",false))
{
if(!preference_manager.getInstance().getBool("FirstTimeLoaded",false))
{
message_manager.getInstance().welcomeMessage();
}
serverRequestManager.getInstance().versionChecker();
message_manager.getInstance().welcomeMessage();
}
serverRequestManager.getInstance().versionChecker();
}
public void onReload()

View File

@ -1,22 +1,19 @@
package com.darkweb.genesissearchengine.appManager;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.support.constraint.ConstraintLayout;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.*;
import android.webkit.*;
import android.widget.*;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.darkweb.genesissearchengine.*;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.dataManager.preference_manager;
import com.darkweb.genesissearchengine.pluginManager.*;
import com.example.myapplication.R;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import org.mozilla.geckoview.GeckoView;
@ -34,6 +31,7 @@ public class application_controller extends AppCompatActivity
private FloatingActionButton floatingButton;
private ImageView loadingIcon;
private ImageView splashlogo;
private TextView loadingText;
/*Redirection Objects*/
private geckoClients geckoclient = null;
@ -58,7 +56,8 @@ public class application_controller extends AppCompatActivity
preference_manager.getInstance().initialize();
orbot_manager.getInstance().reinitOrbot();
admanager.getInstance().initialize();
applicationViewController.getInstance().initialization(webView,progressBar,searchbar,splashScreen,requestFailure,floatingButton, loadingIcon,splashlogo);
applicationViewController.getInstance().initialization(webView,loadingText,progressBar,searchbar,splashScreen,requestFailure,floatingButton, loadingIcon,splashlogo);
firebase.getInstance().initialize();
geckoclient.initialize(geckoView);
startApplication();
@ -96,6 +95,7 @@ public class application_controller extends AppCompatActivity
loadingIcon = findViewById(R.id.imageView_loading_back);
splashlogo = findViewById(R.id.backsplash);
geckoView = findViewById(R.id.webLoader);
loadingText = findViewById(R.id.loadingText);
webviewclient = new webviewClient();
geckoclient = new geckoClients();
@ -116,6 +116,7 @@ public class application_controller extends AppCompatActivity
public void setWebViewSettings(WebView view)
{
view.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
view.getSettings().setJavaScriptEnabled(true);
view.getSettings().setUseWideViewPort(true);
}
@ -186,9 +187,9 @@ public class application_controller extends AppCompatActivity
applicationViewController.getInstance().disableFloatingView();
}
public void onDisableInternetError()
public boolean onDisableInternetError()
{
applicationViewController.getInstance().onDisableInternetError();
return applicationViewController.getInstance().onDisableInternetError();
}
public void onProgressBarUpdateView(int progress)

View File

@ -1,16 +1,17 @@
package com.darkweb.genesissearchengine.appManager;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import com.darkweb.genesissearchengine.helperMethod;
import com.darkweb.genesissearchengine.pluginManager.admanager;
import com.darkweb.genesissearchengine.pluginManager.fabricManager;
import com.darkweb.genesissearchengine.pluginManager.orbot_manager;
import org.mozilla.geckoview.GeckoRuntime;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.GeckoView;
import java.util.ArrayList;
public class geckoClients
{
private GeckoSession session1 = null;
@ -21,20 +22,26 @@ public class geckoClients
boolean isRunning = false;
boolean isContentLoading = false;
String navigatedURL = "";
boolean isFirstTimeLoad = true;
ArrayList<String> urlList = new ArrayList<>();
private boolean loadingCompeleted = false;
private String currentURL = "";
private boolean wasBackPressed = false;
public void loadGeckoURL(String url,GeckoView geckoView)
{
boolean init_status = orbot_manager.getInstance().initOrbot(url);
if (init_status)
{
urlList.clear();
navigatedURL = "";
loadingCompeleted = false;
initialize(geckoView);
session1.loadUri(url);
app_model.getInstance().getAppInstance().onRequestTriggered(true,url);
app_model.getInstance().getAppInstance().onProgressBarUpdateView(4);
isFirstTimeLoad = true;
}
}
@ -57,7 +64,6 @@ public class geckoClients
public void onLocationChange(GeckoSession session, String url)
{
navigatedURL = url;
Log.i("SHITJ1",""+url);
}
@Override
@ -72,11 +78,13 @@ public class geckoClients
@Override
public void onPageStart(GeckoSession session, String url)
{
wasBackPressed = false;
isRunning = true;
loadingCompeleted = false;
currentURL = url;
fabricManager.getInstance().sendEvent("ONION GECKO_CLIENT URL REQEST : " + url + "--");
app_model.getInstance().getAppInstance().onUpdateSearchBarView(url);
if(navigatedURL.equals(currentURL))
{
isContentLoading = false;
@ -103,14 +111,31 @@ public class geckoClients
{
if(!success && !isContentLoading)
{
app_model.getInstance().getAppInstance().onPageFinished(true);
app_model.getInstance().getAppInstance().onInternetErrorView();
fabricManager.getInstance().sendEvent("ONION GECKO_CLIENT URL ERROR : " + success + "--" + isContentLoading);
}
else if(success)
{
if(isFirstTimeLoad)
{
admanager.getInstance().showAd(true);
isFirstTimeLoad = false;
}
if((urlList.size()==0 || urlList.size()>0 && !urlList.get(urlList.size()-1).equals(navigatedURL))&&!wasBackPressed)
{
urlList.add(navigatedURL);
}
if(urlList.size()>0)
{
admanager.getInstance().showAd(false);
}
app_model.getInstance().getAppInstance().onDisableInternetError();
app_model.getInstance().getAppInstance().onProgressBarUpdateView(0);
fabricManager.getInstance().sendEvent("ONION GECKO_CLIENT URL SUCCESS : " + success + "--" + isContentLoading);
app_model.getInstance().getAppInstance().onPageFinished(true);
}
}
}
@ -124,7 +149,6 @@ public class geckoClients
{
if(progress>=100)
{
app_model.getInstance().getAppInstance().onPageFinished(true);
loadingCompeleted = true;
isContentLoading = false;
}
@ -148,23 +172,26 @@ public class geckoClients
public void onHiddenGoBack(GeckoView geckoView)
{
boolean init_status = orbot_manager.getInstance().initOrbot("");
if (init_status)
{
if(canSessionGoBack)
if(urlList.size()>1)
{
app_model.getInstance().getAppInstance().onDisableInternetError();
session1.goBack();
fabricManager.getInstance().sendEvent("ONION LOCAL RETURNED : ");
urlList.remove(urlList.size() - 1);
wasBackPressed = true;
session1.stop();
session1.loadUri(urlList.get(urlList.size() - 1));
app_model.getInstance().getAppInstance().onUpdateSearchBarView(urlList.get(urlList.size()-1));
}
else if(isRunning)
{
fabricManager.getInstance().sendEvent("ONION RETURNED TO GENESIS : ");
geckoView.releaseSession();
stopHiddenView(geckoView);
app_model.getInstance().getAppInstance().onUpdateView(true);
if(urlList.size()>0)
{
urlList.remove(urlList.size()-1);
}
stopHiddenView(geckoView);
app_model.getInstance().getAppInstance().onUpdateView(true);
app_model.getInstance().getAppInstance().onDisableInternetError();
}
}
}
public void stopHiddenView(GeckoView geckoView)
@ -173,9 +200,13 @@ public class geckoClients
{
isRunning = false;
loadingCompeleted = false;
session1.stop();
session1.close();
}
geckoView.releaseSession();
}
public boolean isGeckoViewRunning()
@ -185,15 +216,8 @@ public class geckoClients
public void onReloadHiddenView()
{
boolean init_status = orbot_manager.getInstance().initOrbot("");
if (init_status)
{
if(session1!=null)
{
loadingCompeleted = false;
session1.stop();
session1.reload();
}
}
wasBackPressed = true;
session1.stop();
session1.loadUri(navigatedURL);
}
}

View File

@ -27,6 +27,7 @@ public class webviewClient
}
if(!url.contains("boogle"))
{
app_model.getInstance().getAppInstance().stopHiddenView();
fabricManager.getInstance().sendEvent("BASE SIMPLE SEARCHED : " + url);
isGeckoView = true;
if(orbot_manager.getInstance().initOrbot(url))

View File

@ -19,5 +19,6 @@ public class keys
public static String proxy_useragent_override = "general.useragent.override";
public static String proxy_donottrackheader_enabled = "privacy.donottrackheader.enabled";
public static String proxy_donottrackheader_value = "privacy.donottrackheader.value";
public static String hasOrbotInstalled = "hasOrbotInstalled";
}

View File

@ -3,8 +3,10 @@ package com.darkweb.genesissearchengine.constants;
public class messages
{
/*Post Messages*/
public final static int LOCAL_HOMEPAGE_CACHED =3;
public final static int LOCAL_HOMEPAGE_CACHED =0;
public final static int INTERNET_ERROR =2;
public final static int MESSAGE_UPDATE_TEXT_CHILD_THREAD =1;
public final static int LOAD_WEBVIEW_BACKGROUND = 2;
public final static int DISABLE_SPLASH_SCREEN =3;
public final static int UPDATE_LOADING_TEXT =5;
}

View File

@ -3,7 +3,7 @@ package com.darkweb.genesissearchengine.constants;
public class status
{
public static boolean isApplicationLoaded = false;
public static boolean isPlayStoreInstalled = false;
public static boolean isPlayStoreInstalled = true;
public static boolean isTorInitialized = false;
public static String version_code = "5.0";

View File

@ -28,13 +28,13 @@ public class preference_manager
}
/*Saving Preferences*/
public void saveString(String valueKey, String value)
public void setString(String valueKey, String value)
{
edit.putString(valueKey, value);
edit.commit();
}
public void saveBool(String valueKey, boolean value)
public void setBool(String valueKey, boolean value)
{
edit.putBoolean(valueKey, value);
edit.commit();
@ -50,4 +50,5 @@ public class preference_manager
{
return prefs.getBoolean(valueKey, valueDefault);
}
}

View File

@ -61,7 +61,7 @@ public class serverRequestManager
sb.append(charArray, 0, numCharsRead);
}
String result = sb.toString();
preference_manager.getInstance().saveString("version",result);
preference_manager.getInstance().setString("version",result);
}
catch (IOException e) {

View File

@ -24,21 +24,22 @@ public class admanager
public void initialize()
{
MobileAds.initialize(app_model.getInstance().getAppContext(), "ca-app-pub-5074525529134731~2926711128 ");
/*
MobileAds.initialize(app_model.getInstance().getAppContext(), "ca-app-pub-5074525529134731~2926711128");
mInterstitialAd = new InterstitialAd(app_model.getInstance().getAppContext());
mInterstitialAd.setAdUnitId("ca-app-pub-5074525529134731/8478420705");
mInterstitialAd.loadAd(new AdRequest.Builder().build());
mInterstitialAd.loadAd(new AdRequest.Builder().build());*/
}
/*Helper Methods*/
public void showAd(boolean isAdForced)
{
/*
if(!mInterstitialAd.isLoading() && !mInterstitialAd.isLoaded())
{
mInterstitialAd.loadAd(new AdRequest.Builder().build());
if(isAdForced || adCount==0 || adCount%3==0)
if(isAdForced || adCount==0 || adCount%5==0)
{
adCount = 0;
}
@ -65,6 +66,6 @@ public class admanager
adCount += 1;
}
}
}
}*/
}
}

View File

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

View File

@ -0,0 +1,35 @@
package com.darkweb.genesissearchengine.pluginManager;
import android.os.Bundle;
import com.darkweb.genesissearchengine.appManager.app_model;
import com.google.firebase.analytics.FirebaseAnalytics;
public class firebase
{
private static final firebase ourInstance = new firebase();
public static firebase getInstance()
{
return ourInstance;
}
private FirebaseAnalytics mFirebaseAnalytics;
public void initialize()
{
mFirebaseAnalytics = FirebaseAnalytics.getInstance(app_model.getInstance().getAppContext());
}
public void logEvent(String value,String id)
{
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, id);
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, value);
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "Custom");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
}
private firebase()
{
}
}

View File

@ -12,7 +12,6 @@ import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.preference_manager;
import com.darkweb.genesissearchengine.httpManager.serverRequestManager;
import com.example.myapplication.R;
public class message_manager
@ -65,7 +64,7 @@ public class message_manager
})
.addButton(strings.welcome_message_bt5, -1, -1, CFAlertDialog.CFAlertActionStyle.NEGATIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED , (dialog, which) -> {
dialog.dismiss();
preference_manager.getInstance().saveBool(keys.first_time_loaded,true);
preference_manager.getInstance().setBool(keys.first_time_loaded,true);
});
builder.show();

View File

@ -17,7 +17,7 @@ public class orbot_manager {
/*Private Variables*/
private boolean isLoading = false;
private int threadCounter = 100;
/*Local Initialization*/
private static final orbot_manager ourInstance = new orbot_manager();
private OnionProxyManager onionProxyManager = null;
@ -36,6 +36,7 @@ public class orbot_manager {
{
if(!status.isTorInitialized)
{
fabricManager.getInstance().sendEvent("TOR NOT INITIALIZED : " + url);
message_manager.getInstance().startingOrbotInfo(url);
return false;
}
@ -51,31 +52,58 @@ public class orbot_manager {
{
public void run()
{
try
while (true)
{
while (true)
try
{
if(!isLoading && (onionProxyManager == null || !onionProxyManager.isRunning()))
if(onionProxyManager!=null)
{
if(onionProxyManager != null)
if(onionProxyManager.isRunning())
{
onionProxyManager.stop();
status.isTorInitialized = true;
threadCounter = 5000;
}
}
if(!isLoading && !status.isTorInitialized)
{
if(onionProxyManager == null)
{
onionProxyManager = new AndroidOnionProxyManager(app_model.getInstance().getAppContext(), strings.torfolder);
}
isLoading = false;
status.isTorInitialized = false;
initializeTorClient();
}
sleep(1000);
else
{
sleep(threadCounter);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}.start();
}
public String getLogs()
{
if(onionProxyManager!=null)
{
String Logs = onionProxyManager.getLastLog();
if(Logs.equals(""))
{
return "Loading Please Wait";
}
Logs=Logs.replace("FAILED","Securing");
return Logs;
}
return "Loading Please Wait";
}
public void initializeTorClient()
{
if(!isLoading)
@ -89,14 +117,6 @@ public class orbot_manager {
try
{
isLoading = true;
String fileStorageLocation = strings.torfolder;
if(onionProxyManager!=null && onionProxyManager.isRunning())
{
break;
}
onionProxyManager = new AndroidOnionProxyManager(app_model.getInstance().getAppContext(), fileStorageLocation);
int totalSecondsPerTorStartup = 4 * 60;
int totalTriesPerTorStartup = 5;
@ -108,14 +128,12 @@ public class orbot_manager {
continue;
}
if (onionProxyManager.isRunning()) {
app_model.getInstance().setPort(onionProxyManager.getIPv4LocalHostSocksPort());
initializeProxy();
//sleep(1500);
status.isTorInitialized = true;
isLoading = false;
break;
}
app_model.getInstance().setPort(onionProxyManager.getIPv4LocalHostSocksPort());
initializeProxy();
status.isTorInitialized = true;
isLoading = false;
break;
} catch (Exception ex) {
ex.printStackTrace();
continue;

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
@ -38,7 +38,7 @@
</WebView>
</FrameLayout>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/requestFailure"
android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent"
@ -101,7 +101,8 @@
app:layout_constraintTop_toBottomOf="@+id/textView"
app:layout_constraintBottom_toTopOf="@+id/reloadButton" android:layout_marginBottom="35dp"
android:layout_marginTop="35dp" android:contentDescription="@string/todo"/>
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="71dp"
@ -181,7 +182,7 @@
android:progressTint="@color/progress_tint"
android:progress="50" app:layout_constraintTop_toTopOf="parent"
/>
<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:background="@color/ease_blue"
android:id="@+id/splashScreen"
@ -190,9 +191,24 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/backsplash"
android:textAlignment="center"
android:background="@xml/splash_gradient" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:text="Loading Please Wait"
android:textColor="@color/white"
android:textFontWeight="5"
android:layout_width="match_parent"
android:gravity="center"
android:textAlignment="center"
android:singleLine="true"
android:ellipsize="end"
android:layout_height="wrap_content" android:id="@+id/loadingText"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="37dp" android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"/>
<ImageView
android:layout_width="35dp"
android:layout_height="35dp"
@ -200,9 +216,9 @@
android:id="@+id/imageView_loading_back" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
<android.support.design.widget.FloatingActionButton
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:src="@drawable/icon_ban"
android:layout_height="wrap_content"
@ -215,4 +231,4 @@
android:id="@+id/floatingActionButton3" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" android:layout_marginBottom="24dp"
android:layout_marginEnd="24dp"/>
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -9,6 +9,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'io.fabric.tools:gradle:1.29.0'
classpath 'com.google.gms:google-services:4.2.0'
}
}

View File

@ -13,3 +13,5 @@ org.gradle.jvmargs=-Xmx1536m
# org.gradle.parallel=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
android.useAndroidX=true
android.enableJetifier=true

View File

@ -1,2 +0,0 @@
configurations.maybeCreate("default")
artifacts.add("default", file('tor-android-binary-0.3.4.9.aar'))