diff --git a/.idea/misc.xml b/.idea/misc.xml index 91255167..d1072453 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -84,7 +84,9 @@ + + @@ -95,6 +97,7 @@ + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b0982c79..a7bc428d 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -33,6 +33,11 @@ android:name="com.hiddenservices.onionservices.appManager.advertManager.advertController" android:exported="true" /> + + + + Privacy Policy

Intelligence

-

Facebook

-

Twitter

+

Facebook

+

Twitter

Linkedin

-

Instagram

-

Youtube

+

Instagram

+

Youtube






@@ -110,11 +110,11 @@ diff --git a/app/src/main/assets/homepage/homepage.html b/app/src/main/assets/homepage/homepage.html index 99685de6..ac47e150 100755 --- a/app/src/main/assets/homepage/homepage.html +++ b/app/src/main/assets/homepage/homepage.html @@ -92,11 +92,11 @@

Privacy Policy

Intelligence

-

Facebook

-

Twitter

+

Facebook

+

Twitter

Linkedin

-

Instagram

-

Youtube

+

Instagram

+

Youtube






diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/advertManager/advertController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/advertManager/advertController.java index 4db1ff3d..f370da24 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/advertManager/advertController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/advertManager/advertController.java @@ -56,7 +56,6 @@ public class advertController extends AppCompatActivity { finish(); } - /* Callbacks */ public class webivewViewCallback implements eventObserver.eventListener { @Override diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/advertManager/advertViewController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/advertManager/advertViewController.java index 19db75c4..f499dfb3 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/advertManager/advertViewController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/advertManager/advertViewController.java @@ -6,12 +6,14 @@ import android.widget.ProgressBar; import androidx.appcompat.app.AppCompatActivity; import com.example.myapplication.R; import com.hiddenservices.onionservices.eventObserver; +import com.hiddenservices.onionservices.helperManager.sharedUIMethod; import java.util.List; public class advertViewController extends AppCompatActivity { private WebView mWebView; + private AppCompatActivity mContext; private ProgressBar mProgressBar; @Override @@ -22,6 +24,7 @@ public class advertViewController extends AppCompatActivity { advertViewController(AppCompatActivity pContext, eventObserver.eventListener pEvent, WebView pGeckoView, ProgressBar pProgressBar) { + this.mContext = pContext; this.mWebView = pGeckoView; this.mProgressBar = pProgressBar; @@ -29,6 +32,7 @@ public class advertViewController extends AppCompatActivity { } private void initViews(){ + sharedUIMethod.updateStatusBar(mContext); } public void onUpdateProgressBar(boolean status){ diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeController.java index 2c441093..a3213624 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/homeController/homeController.java @@ -1,10 +1,10 @@ package com.hiddenservices.onionservices.appManager.homeManager.homeController; +import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION; + import android.annotation.SuppressLint; import android.app.ActivityManager; -import android.app.AlarmManager; import android.app.DownloadManager; -import android.app.PendingIntent; import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; import android.content.ClipData; @@ -52,9 +52,11 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.applovin.mediation.ads.MaxAdView; import com.hiddenservices.onionservices.appManager.activityContextManager; +import com.hiddenservices.onionservices.appManager.advertManager.advertController; import com.hiddenservices.onionservices.appManager.bookmarkManager.bookmarkSettings.bookmarkSettingController; import com.hiddenservices.onionservices.appManager.bookmarkManager.bookmarkHome.bookmarkController; import com.hiddenservices.onionservices.appManager.historyManager.historyController; +import com.hiddenservices.onionservices.appManager.orionAdvertManager.orionAdvertController; import com.hiddenservices.onionservices.dataManager.models.historyRowModel; import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.NestedGeckoView; import com.hiddenservices.onionservices.appManager.homeManager.geckoManager.*; @@ -99,8 +101,6 @@ import java.util.Locale; import java.util.Objects; import java.util.concurrent.Callable; import mozilla.components.support.utils.DownloadUtils; -import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; -import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION; import static androidx.appcompat.app.AppCompatDelegate.setDefaultNightMode; import static com.hiddenservices.onionservices.constants.constants.CONST_EXTERNAL_SHORTCUT_COMMAND_ERASE_OPEN; import static com.hiddenservices.onionservices.constants.constants.CONST_EXTERNAL_SHORTCUT_COMMAND_RESTART; @@ -197,7 +197,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba private boolean mSearchBarLoading = false; private boolean mSearchBarLoadingOpening = false; private boolean mSearchBarWasBackButtonPressed = false; - private boolean mWasEdittextChanged = false; private String mSearchBarPreviousText = strings.GENERIC_EMPTY_STR; private Handler mScrollHandler = null; private Runnable mScrollRunnable = null; @@ -341,6 +340,11 @@ public class homeController extends AppCompatActivity implements ComponentCallba mSearchBarLoading = false; } + public void onAdvertClick(View view){ + Intent myIntent = new Intent(this, orionAdvertController.class); + startActivity(myIntent); + } + public void initSuggestions(){ mSuggestions = (ArrayList)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_SUGGESTIONS, Collections.singletonList(mSearchbar.getText().toString())); } @@ -978,7 +982,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba @Override public void onTextChanged(CharSequence s, int start, int before, int count) { - mWasEdittextChanged = true; + new Handler().postDelayed(() -> { String mText = mSearchbar.getText().toString(); @@ -1010,7 +1014,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba if(mSuggestions.size()>0){ mSuggestions = (ArrayList)dataController.getInstance().invokeSuggestions(dataEnums.eSuggestionCommands.M_GET_SUGGESTIONS, Collections.singletonList(mText)); if(mHintListView.getAdapter()==null){ - initSuggestionView(mSuggestions, mText.toString()); + initSuggestionView(mSuggestions, mText); }else if(!mSearchBarLoadingOpening){ mEdittextChanged.removeCallbacks(postToServerRunnable); if(!mSearchBarLoading){ @@ -1064,7 +1068,6 @@ public class homeController extends AppCompatActivity implements ComponentCallba if(!hasFocus) { msearchstatuscopy = false; - mWasEdittextChanged = false; mSearchBarWasBackButtonPressed = true; new Handler().postDelayed(() -> { @@ -1115,7 +1118,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba }; public void onSearchBarInvoked(View view){ - String url = mGeckoClient.getSession().getCurrentURL(); + String url; if(!mSearchBarPreviousText.equals(mSearchbar.getText().toString())){ url = mSearchbar.getText().toString(); }else { @@ -1610,7 +1613,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba { pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); activityContextManager.getInstance().setCurrentActivity(this); - if (mGeckoClient.getSession()!=null && mGeckoClient!=null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && mGeckoClient.getUriPermission()!=null) { + if (mGeckoClient.getSession() != null && mGeckoClient != null && mGeckoClient.getUriPermission() != null) { this.revokeUriPermission(mGeckoClient.getUriPermission(), Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); } if(isSuggestionSearchOpened){ @@ -1643,7 +1646,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba mProgressBar.setProgress(0); } }else { - if(model.getSession().getSessionID() != mGeckoClient.getSession().getSessionID()){ + if(!model.getSession().getSessionID().equals(mGeckoClient.getSession().getSessionID())){ onLoadTab(model.getSession(),false,true, false); } if(mGeckoClient.getSession().getProgress()!=100){ diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/orionAdvertManager/orionAdvertController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/orionAdvertManager/orionAdvertController.java new file mode 100644 index 00000000..cdcb6bf3 --- /dev/null +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/orionAdvertManager/orionAdvertController.java @@ -0,0 +1,77 @@ +package com.hiddenservices.onionservices.appManager.orionAdvertManager; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.webkit.WebView; +import android.widget.ProgressBar; + +import androidx.appcompat.app.AppCompatActivity; + +import com.example.myapplication.R; +import com.hiddenservices.onionservices.appManager.settingManager.advertSetttings.advertSettingController; +import com.hiddenservices.onionservices.eventObserver; + +import java.util.Collections; +import java.util.List; + +public class orionAdvertController extends AppCompatActivity { + + WebView mWebView; + ProgressBar mProgressBar; + orionAdvertViewController mAdvertViewController; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_orion_adview_controller); + + initializeViews(); + onInitializeAdvertisements(); + onInitAdvert(); + } + + private void initializeViews() { + mWebView = findViewById(R.id.pWebView); + mProgressBar = findViewById(R.id.mProgressBar); + mAdvertViewController = new orionAdvertViewController(this, null, mWebView, mProgressBar); + } + + void onInitAdvert(){ + mWebView.getSettings().setDomStorageEnabled(true); + mWebView.getSettings().setGeolocationEnabled(true); + mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); + mWebView.getSettings().setUseWideViewPort(true); + mWebView.getSettings().setAppCacheEnabled(true); + mWebView.getSettings().setDatabaseEnabled(true); + mWebView.setWebViewClient(new orionAdvertWebViewClient(new webivewViewCallback())); + } + + private void onInitializeAdvertisements(){ + mWebView.loadUrl("https://360wise.com"); + } + + /* Helper Methods */ + public void onClose(View view) { + finish(); + } + + public void onSettings(View view) { + Intent myIntent = new Intent(this, advertSettingController.class); + startActivity(myIntent); + } + + + /* Callbacks */ + public class webivewViewCallback implements eventObserver.eventListener { + @Override + public Object invokeObserver(List data, Object event_type) { + if(event_type.equals(orionAdvertEnums.eOrionAdvertClientCallback.M_UPDATE_PROGRESSBAR)){ + mAdvertViewController.onTrigger(orionAdvertEnums.eOrionAdvertViewController.M_UPDATE_PROGRESSBAR, Collections.singletonList(data.get(0))); + } + return null; + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/orionAdvertManager/orionAdvertEnums.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/orionAdvertManager/orionAdvertEnums.java new file mode 100644 index 00000000..73730bc1 --- /dev/null +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/orionAdvertManager/orionAdvertEnums.java @@ -0,0 +1,13 @@ +package com.hiddenservices.onionservices.appManager.orionAdvertManager; + +class orionAdvertEnums +{ + /*History Manager*/ + public enum eOrionAdvertClientCallback { + M_UPDATE_PROGRESSBAR + } + + public enum eOrionAdvertViewController { + M_UPDATE_PROGRESSBAR + } +} \ No newline at end of file diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/orionAdvertManager/orionAdvertViewController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/orionAdvertManager/orionAdvertViewController.java new file mode 100644 index 00000000..1885bde6 --- /dev/null +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/orionAdvertManager/orionAdvertViewController.java @@ -0,0 +1,58 @@ +package com.hiddenservices.onionservices.appManager.orionAdvertManager; + +import android.os.Bundle; +import android.webkit.WebView; +import android.widget.ProgressBar; + +import androidx.appcompat.app.AppCompatActivity; + +import com.example.myapplication.R; +import com.hiddenservices.onionservices.eventObserver; +import com.hiddenservices.onionservices.helperManager.sharedUIMethod; + +import java.util.List; + +public class orionAdvertViewController extends AppCompatActivity { + + private WebView mWebView; + private AppCompatActivity mContext; + private ProgressBar mProgressBar; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_adview_controller); + } + + orionAdvertViewController(AppCompatActivity pContext, eventObserver.eventListener pEvent, WebView pGeckoView, ProgressBar pProgressBar) + { + this.mContext = pContext; + this.mWebView = pGeckoView; + this.mProgressBar = pProgressBar; + + initViews(); + } + + private void initViews(){ + sharedUIMethod.updateStatusBar(mContext); + } + + public void onUpdateProgressBar(boolean status){ + if(status){ + mProgressBar.animate().setDuration(350).alpha(1); + }else { + mProgressBar.animate().setDuration(350).alpha(0); + } + } + + public void onTrigger(orionAdvertEnums.eOrionAdvertViewController pCommands, List pData){ + if(pCommands.equals(orionAdvertEnums.eOrionAdvertViewController.M_UPDATE_PROGRESSBAR)){ + onUpdateProgressBar((boolean)pData.get(0)); + } + } + + public void onTrigger(orionAdvertEnums.eOrionAdvertViewController pCommands){ + } + +} + diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/orionAdvertManager/orionAdvertWebViewClient.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/orionAdvertManager/orionAdvertWebViewClient.java new file mode 100644 index 00000000..d2a15396 --- /dev/null +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/orionAdvertManager/orionAdvertWebViewClient.java @@ -0,0 +1,34 @@ +package com.hiddenservices.onionservices.appManager.orionAdvertManager; + +import android.graphics.Bitmap; +import android.webkit.WebResourceError; +import android.webkit.WebResourceRequest; +import android.webkit.WebView; + +import com.hiddenservices.onionservices.eventObserver; + +import java.util.Collections; + +public class orionAdvertWebViewClient extends android.webkit.WebViewClient { + + private eventObserver.eventListener mEvent; + public orionAdvertWebViewClient(eventObserver.eventListener pEvent){ + mEvent = pEvent; + } + + @Override + public void onPageStarted(WebView view, String url, Bitmap favicon) { + mEvent.invokeObserver(Collections.singletonList(true), orionAdvertEnums.eOrionAdvertClientCallback.M_UPDATE_PROGRESSBAR); + } + + @Override + public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error){ + mEvent.invokeObserver(Collections.singletonList(false), orionAdvertEnums.eOrionAdvertClientCallback.M_UPDATE_PROGRESSBAR); + } + + @Override + public void onPageFinished(WebView view, String url) { + mEvent.invokeObserver(Collections.singletonList(false), orionAdvertEnums.eOrionAdvertClientCallback.M_UPDATE_PROGRESSBAR); + } + +} diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/advertSetttings/advertResources/advert_constants.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/advertSetttings/advertResources/advert_constants.java new file mode 100644 index 00000000..50730b1a --- /dev/null +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/advertSetttings/advertResources/advert_constants.java @@ -0,0 +1,14 @@ +package com.hiddenservices.onionservices.appManager.settingManager.advertSetttings.advertResources; + +public class advert_constants +{ + public static boolean S_INSENSITIVE_CATEGORIES = false; + public static boolean S_APP_REDIRECTION = false; + public static boolean S_SEARCH_RESULTS = false; + public static boolean S_SENSOR_ADVERTISEMENT = false; + public static boolean S_NON_TRACKABLE_ADVERTISEMENT = false; + public static boolean S_VIDEO_ADVERTISEMENT = false; + public static boolean S_AUTHORIZED_ADVERTISERS = false; + public static boolean S_ERROR_REPORTING = false; + public static boolean S_NATIVE_ADVERTISERS = false; +} \ No newline at end of file diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/advertSetttings/advertSettingController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/advertSetttings/advertSettingController.java new file mode 100644 index 00000000..feaf326f --- /dev/null +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/advertSetttings/advertSettingController.java @@ -0,0 +1,157 @@ +package com.hiddenservices.onionservices.appManager.settingManager.advertSetttings; + +import android.content.res.Configuration; +import android.os.Bundle; +import android.view.View; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import com.hiddenservices.onionservices.appManager.activityContextManager; +import com.hiddenservices.onionservices.appManager.helpManager.helpController; +import com.hiddenservices.onionservices.appManager.settingManager.advertSetttings.advertResources.advert_constants; +import com.hiddenservices.onionservices.constants.constants; +import com.hiddenservices.onionservices.eventObserver; +import com.hiddenservices.onionservices.helperManager.helperMethod; +import com.hiddenservices.onionservices.appManager.activityThemeManager; +import com.hiddenservices.onionservices.pluginManager.pluginController; +import com.hiddenservices.onionservices.pluginManager.pluginEnums; +import com.example.myapplication.R; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class advertSettingController extends AppCompatActivity { + + /* UI Variables */ + + /* Private Variables */ + + private advertSettingModel mAdvertSettingModel; + private advertSettingViewController mAdvertSettingViewController; + private ArrayList mSwitchButton = new ArrayList<>(); + + /* Initializations */ + + @Override + protected void onCreate(Bundle savedInstanceState) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + activityContextManager.getInstance().onStack(this); + + super.onCreate(savedInstanceState); + setContentView(R.layout.setting_advert_view); + + initializeViews(); + } + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); + super.onConfigurationChanged(newConfig); + + if(newConfig.uiMode != getResources().getConfiguration().uiMode){ + activityContextManager.getInstance().onResetTheme(); + activityThemeManager.getInstance().onConfigurationChanged(this); + } + } + + private void initializeViews() { + + mSwitchButton.add(findViewById(R.id.pAdOptionSwitch1)); + mSwitchButton.add(findViewById(R.id.pAdOptionSwitch2)); + mSwitchButton.add(findViewById(R.id.pAdOptionSwitch3)); + mSwitchButton.add(findViewById(R.id.pAdOptionSwitch4)); + mSwitchButton.add(findViewById(R.id.pAdOptionSwitch5)); + mSwitchButton.add(findViewById(R.id.pAdOptionSwitch6)); + mSwitchButton.add(findViewById(R.id.pAdOptionSwitch7)); + mSwitchButton.add(findViewById(R.id.pAdOptionSwitch8)); + mSwitchButton.add(findViewById(R.id.pAdOptionSwitch9)); + + mAdvertSettingViewController = new advertSettingViewController(this, new settingLogViewCallback(), mSwitchButton); + mAdvertSettingModel = new advertSettingModel(new settingLogModelCallback()); + } + + /*View Callbacks*/ + + private class settingLogViewCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List pData, Object pCommands) + { + return null; + } + } + + /*Model Callbacks*/ + + private class settingLogModelCallback implements eventObserver.eventListener{ + + @Override + public Object invokeObserver(List pData, Object pCommands) + { + return null; + } + } + + /* LOCAL OVERRIDES */ + + @Override + public void onResume() + { + pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_RESUME); + activityContextManager.getInstance().setCurrentActivity(this); + super.onResume(); + } + + @Override + public void onBackPressed() { + onClose(null); + } + + @Override + protected void onDestroy() { + activityContextManager.getInstance().onRemoveStack(this); + super.onDestroy(); + } + + /*UI Redirection*/ + + public void onClose(View view){ + finish(); + } + + public void onTriggerUI(View view){ + if(view.getId() == R.id.pAdOption1){ + mAdvertSettingViewController.onTrigger(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH, Collections.singletonList(0)); + advert_constants.S_INSENSITIVE_CATEGORIES = mSwitchButton.get(0).isChecked(); + }else if(view.getId() == R.id.pAdOption2){ + mAdvertSettingViewController.onTrigger(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH, Collections.singletonList(1)); + advert_constants.S_APP_REDIRECTION = mSwitchButton.get(1).isChecked(); + }else if(view.getId() == R.id.pAdOption3){ + mAdvertSettingViewController.onTrigger(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH, Collections.singletonList(2)); + advert_constants.S_SEARCH_RESULTS = mSwitchButton.get(2).isChecked(); + }else if(view.getId() == R.id.pAdOption4){ + mAdvertSettingViewController.onTrigger(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH, Collections.singletonList(3)); + advert_constants.S_SENSOR_ADVERTISEMENT = mSwitchButton.get(3).isChecked(); + }else if(view.getId() == R.id.pAdOption5){ + mAdvertSettingViewController.onTrigger(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH, Collections.singletonList(4)); + advert_constants.S_NON_TRACKABLE_ADVERTISEMENT = mSwitchButton.get(4).isChecked(); + }else if(view.getId() == R.id.pAdOption6){ + mAdvertSettingViewController.onTrigger(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH, Collections.singletonList(5)); + advert_constants.S_VIDEO_ADVERTISEMENT = mSwitchButton.get(5).isChecked(); + }else if(view.getId() == R.id.pAdOption7){ + mAdvertSettingViewController.onTrigger(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH, Collections.singletonList(6)); + advert_constants.S_AUTHORIZED_ADVERTISERS = mSwitchButton.get(6).isChecked(); + }else if(view.getId() == R.id.pAdOption8){ + mAdvertSettingViewController.onTrigger(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH, Collections.singletonList(7)); + advert_constants.S_ERROR_REPORTING = mSwitchButton.get(7).isChecked(); + }else if(view.getId() == R.id.pAdOption9){ + mAdvertSettingViewController.onTrigger(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH, Collections.singletonList(8)); + advert_constants.S_NATIVE_ADVERTISERS = mSwitchButton.get(8).isChecked(); + } + } + + public void onOpenInfo(View view) { + helperMethod.openActivity(helpController.class, constants.CONST_LIST_HISTORY, this,true); + } + +} diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/advertSetttings/advertSettingEnums.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/advertSetttings/advertSettingEnums.java new file mode 100644 index 00000000..3f592a9c --- /dev/null +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/advertSetttings/advertSettingEnums.java @@ -0,0 +1,15 @@ +package com.hiddenservices.onionservices.appManager.settingManager.advertSetttings; + +class advertSettingEnums +{ + /* Log Model */ + + public enum eAdvertSettingModel { + } + + /* Log View Controller */ + + public enum eAdvertSettingViewController { + M_TOGGLE_SWITCH + } +} \ No newline at end of file diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/advertSetttings/advertSettingModel.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/advertSetttings/advertSettingModel.java new file mode 100644 index 00000000..7a80ea07 --- /dev/null +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/advertSetttings/advertSettingModel.java @@ -0,0 +1,24 @@ +package com.hiddenservices.onionservices.appManager.settingManager.advertSetttings; + +import com.hiddenservices.onionservices.eventObserver; +import java.util.List; + +class advertSettingModel +{ + /*Variable Declaration*/ + + private eventObserver.eventListener mEvent; + + /*Initializations*/ + + advertSettingModel(eventObserver.eventListener mEvent){ + this.mEvent = mEvent; + } + + /*Helper Methods*/ + + public Object onTrigger(advertSettingEnums.eAdvertSettingModel pCommands, List pData){ + return null; + } + +} diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/advertSetttings/advertSettingViewController.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/advertSetttings/advertSettingViewController.java new file mode 100644 index 00000000..2128ba0c --- /dev/null +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/settingManager/advertSetttings/advertSettingViewController.java @@ -0,0 +1,85 @@ +package com.hiddenservices.onionservices.appManager.settingManager.advertSetttings; + +import androidx.appcompat.app.AppCompatActivity; + +import com.google.android.material.switchmaterial.SwitchMaterial; +import com.hiddenservices.onionservices.appManager.settingManager.advertSetttings.advertResources.advert_constants; +import com.hiddenservices.onionservices.eventObserver; +import com.hiddenservices.onionservices.helperManager.sharedUIMethod; + +import java.util.ArrayList; +import java.util.List; + +class advertSettingViewController +{ + /*Private Variables*/ + + private eventObserver.eventListener mEvent; + private AppCompatActivity mContext; + private ArrayList mSwitchButton; + + /*Initializations*/ + + advertSettingViewController(advertSettingController pContext, eventObserver.eventListener pEvent, ArrayList pSwitchButton) + { + this.mEvent = pEvent; + this.mContext = pContext; + this.mSwitchButton = pSwitchButton; + + initPostUI(); + initViews(); + } + + private void initViews() + { + if(advert_constants.S_INSENSITIVE_CATEGORIES){ + mSwitchButton.get(0).toggle(); + } + if(advert_constants.S_APP_REDIRECTION){ + mSwitchButton.get(1).toggle(); + } + if(advert_constants.S_SEARCH_RESULTS){ + mSwitchButton.get(2).toggle(); + } + if(advert_constants.S_SENSOR_ADVERTISEMENT){ + mSwitchButton.get(3).toggle(); + } + if(advert_constants.S_NON_TRACKABLE_ADVERTISEMENT){ + mSwitchButton.get(4).toggle(); + } + if(advert_constants.S_VIDEO_ADVERTISEMENT){ + mSwitchButton.get(5).toggle(); + } + if(advert_constants.S_AUTHORIZED_ADVERTISERS){ + mSwitchButton.get(6).toggle(); + } + if(advert_constants.S_ERROR_REPORTING){ + mSwitchButton.get(7).toggle(); + } + if(advert_constants.S_NATIVE_ADVERTISERS){ + mSwitchButton.get(8).toggle(); + } + } + + /*Helper Methods*/ + + private void initPostUI(){ + sharedUIMethod.updateStatusBar(mContext); + } + + private void onToggleSwitch(int m_id){ + mSwitchButton.get(m_id).toggle(); + } + /*Triggers*/ + + public Object onTrigger(advertSettingEnums.eAdvertSettingViewController pCommands, List pData){ + if(pCommands.equals(advertSettingEnums.eAdvertSettingViewController.M_TOGGLE_SWITCH)){ + onToggleSwitch((int)pData.get(0)); + } + return null; + } + + public Object onTrigger(advertSettingEnums.eAdvertSettingViewController pCommands){ + return onTrigger(pCommands, null); + } +} diff --git a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/orionAdvertManager.java b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/orionAdvertManager.java new file mode 100644 index 00000000..dbf551dd --- /dev/null +++ b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/adPluginManager/orionAdvertManager.java @@ -0,0 +1,110 @@ +package com.hiddenservices.onionservices.pluginManager.adPluginManager; + +import static com.hiddenservices.onionservices.pluginManager.pluginEnums.eAdManagerCallbacks.M_ON_AD_LOAD; +import static org.mozilla.gecko.util.ThreadUtils.runOnUiThread; +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.drawable.BitmapDrawable; +import android.view.View; + +import com.applovin.mediation.ads.MaxAdView; +import com.hiddenservices.onionservices.eventObserver; +import com.hiddenservices.onionservices.pluginManager.pluginEnums; +import org.torproject.android.service.wrapper.orbotLocalConstants; +import java.io.InputStream; +import java.lang.ref.WeakReference; +import java.net.HttpURLConnection; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.URL; + +public class orionAdvertManager +{ + /*Private Variables */ + + private eventObserver.eventListener mEvent; + private WeakReference mBannerAds; + + private boolean bannerAdsLoaded = false; + private boolean bannerAdRequested = false; + + /*Initializations*/ + + public orionAdvertManager(eventObserver.eventListener pEvent, MaxAdView pBannerAds, Context pContext) { + this.mEvent = pEvent; + this.mBannerAds = new WeakReference(pBannerAds); + + new Thread(){ + public void run(){ + while (true){ + try { + sleep(10000); + initializeBannerAds(pContext); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + }.start(); + + + initializeBannerAds(pContext); + } + + private void initializeBannerAds(Context pContext){ + try { + if(orbotLocalConstants.mSOCKSPort!=-1){ + URL url = new URL("http://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion/fetch_advert/"); + Proxy proxy; + HttpURLConnection mHttpConnection; + proxy = new Proxy(Proxy.Type.SOCKS, InetSocketAddress.createUnresolved("127.0.0.1", orbotLocalConstants.mSOCKSPort)); + mHttpConnection = (HttpURLConnection) url.openConnection(proxy); + mHttpConnection.setRequestProperty("User-Agent","Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0"); + mHttpConnection.setRequestProperty("Accept","*/*"); + mHttpConnection.connect(); + InputStream input = mHttpConnection.getInputStream(); + Bitmap mBitmap = BitmapFactory.decodeStream(input); + BitmapDrawable mDrawable = new BitmapDrawable(pContext.getResources(), mBitmap); + runOnUiThread(() -> { + this.mBannerAds.get().setAlpha(0); + this.mBannerAds.get().setVisibility(View.GONE); + this.mBannerAds.get().setBackground(mDrawable); + this.bannerAdsLoaded = true; + mEvent.invokeObserver(null, M_ON_AD_LOAD); + }); + } + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + /*Local Helper Methods*/ + + private void loadAds(){ + if(!bannerAdRequested){ + bannerAdRequested = true; + } + } + + private boolean isAdvertLoaded(){ + return bannerAdsLoaded; + } + + + /*External Triggers*/ + + public Object onTrigger(pluginEnums.eAdManager pEventType) { + if(pEventType.equals(pluginEnums.eAdManager.M_INITIALIZE_BANNER_ADS)) + { + loadAds(); + } + else if(pEventType.equals(pluginEnums.eAdManager.M_IS_ADVERT_LOADED)) + { + return isAdvertLoaded(); + } + return null; + } + +} + diff --git a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/downloadPluginManager/downloadManager.java b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/downloadPluginManager/downloadManager.java index 39e04ea1..dc843267 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/downloadPluginManager/downloadManager.java +++ b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/downloadPluginManager/downloadManager.java @@ -2,7 +2,6 @@ package com.hiddenservices.onionservices.pluginManager.downloadPluginManager; import android.app.NotificationManager; import android.content.Context; -import android.os.Environment; import androidx.appcompat.app.AppCompatActivity; import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.helperManager.helperMethod; diff --git a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/pluginController.java b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/pluginController.java index 74d644bd..de2835d6 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/pluginManager/pluginController.java +++ b/app/src/main/java/com/hiddenservices/onionservices/pluginManager/pluginController.java @@ -18,6 +18,7 @@ import com.hiddenservices.onionservices.dataManager.dataEnums; import com.hiddenservices.onionservices.eventObserver; import com.hiddenservices.onionservices.helperManager.helperMethod; import com.hiddenservices.onionservices.pluginManager.adPluginManager.appLovinManager; +import com.hiddenservices.onionservices.pluginManager.adPluginManager.orionAdvertManager; import com.hiddenservices.onionservices.pluginManager.analyticPluginManager.analyticManager; import com.hiddenservices.onionservices.pluginManager.downloadPluginManager.downloadManager; import com.hiddenservices.onionservices.pluginManager.langPluginManager.langManager; @@ -46,6 +47,7 @@ public class pluginController /*Plugin Instance*/ private appLovinManager mAdManager; + private orionAdvertManager mOrionAdvertManager; private analyticManager mAnalyticsManager; private messageManager mMessageManager; private notifictionManager mNotificationManager; @@ -87,6 +89,7 @@ public class pluginController mNotificationManager = new notifictionManager(mHomeController,new notificationCallback()); mAdManager = new appLovinManager(new admobCallback(), ((homeController)mHomeController.get()).getBannerAd(), mHomeController.get()); + mOrionAdvertManager = new orionAdvertManager(new admobCallback(), ((homeController)mHomeController.get()).getBannerAd(), mHomeController.get()); mAnalyticsManager = new analyticManager(mHomeController,new analyticCallback()); mMessageManager = new messageManager(new messageCallback()); mOrbotManager = orbotManager.getInstance(); @@ -126,8 +129,13 @@ public class pluginController } public Object onAdsInvoke(List pData, pluginEnums.eAdManager pEventType){ - if(mAdManager !=null){ - return mAdManager.onTrigger(pEventType); + + // if(mAdManager !=null){ + // return mAdManager.onTrigger(pEventType); + // } + + if(mOrionAdvertManager !=null){ + return mOrionAdvertManager.onTrigger(pEventType); } return null; } @@ -355,7 +363,7 @@ public class pluginController helperMethod.restartAndOpen(false); return null; }); - mHomeController.get().finish(); + // mHomeController.get().finish(); } return null; } diff --git a/app/src/main/res/layouts/adview/layout-land/certificate_info.xml b/app/src/main/res/layouts/adview/layout-land/certificate_info.xml new file mode 100644 index 00000000..baf6ad74 --- /dev/null +++ b/app/src/main/res/layouts/adview/layout-land/certificate_info.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layouts/adview/layout-land/secure_connection_popup.xml b/app/src/main/res/layouts/adview/layout-land/secure_connection_popup.xml new file mode 100644 index 00000000..5439b033 --- /dev/null +++ b/app/src/main/res/layouts/adview/layout-land/secure_connection_popup.xml @@ -0,0 +1,361 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +