mirror of
https://github.com/M66B/NetGuard.git
synced 2025-03-09 13:52:12 +00:00
Removed ads
This commit is contained in:
parent
6594886a21
commit
5f10dbd6ce
11 changed files with 5 additions and 302 deletions
|
@ -6,10 +6,10 @@ android {
|
|||
|
||||
defaultConfig {
|
||||
applicationId = "eu.faircode.netguard"
|
||||
versionName = "2.196"
|
||||
versionName = "2.197"
|
||||
minSdkVersion 22
|
||||
targetSdkVersion 27
|
||||
versionCode = 2018042701
|
||||
versionCode = 2018052201
|
||||
archivesBaseName = "NetGuard-v$versionName"
|
||||
|
||||
externalNativeBuild {
|
||||
|
@ -53,16 +53,7 @@ dependencies {
|
|||
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||
implementation 'com.android.support:recyclerview-v7:27.1.1'
|
||||
|
||||
// https://developers.google.com/android/guides/setup
|
||||
implementation 'com.google.android.gms:play-services-base:12.0.1'
|
||||
|
||||
// https://firebase.google.com/docs/android/setup
|
||||
implementation 'com.google.firebase:firebase-core:12.0.1'
|
||||
implementation 'com.google.firebase:firebase-ads:12.0.1'
|
||||
|
||||
// https://bumptech.github.io/glide/
|
||||
implementation 'com.github.bumptech.glide:glide:4.6.1'
|
||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
|
||||
implementation 'com.github.bumptech.glide:glide:4.7.1'
|
||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
|
||||
}
|
||||
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
{
|
||||
"project_info": {
|
||||
"project_number": "495063709670",
|
||||
"firebase_url": "https://netguard-811a8.firebaseio.com",
|
||||
"project_id": "netguard-811a8",
|
||||
"storage_bucket": "netguard-811a8.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:495063709670:android:4a7add5044bbfbe4",
|
||||
"android_client_info": {
|
||||
"package_name": "eu.faircode.netguard"
|
||||
}
|
||||
},
|
||||
"oauth_client": [
|
||||
{
|
||||
"client_id": "495063709670-kmrhdn2hl4hb0mhst1g41i30mn8tv4te.apps.googleusercontent.com",
|
||||
"client_type": 3
|
||||
}
|
||||
],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyAA9DsZbwqbneF65YtAwTqBRJtaChJMTd0"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"analytics_service": {
|
||||
"status": 1
|
||||
},
|
||||
"appinvite_service": {
|
||||
"status": 1,
|
||||
"other_platform_oauth_client": []
|
||||
},
|
||||
"ads_service": {
|
||||
"status": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
|
@ -21,14 +21,6 @@
|
|||
|
||||
<uses-permission android:name="eu.faircode.netguard.permission.ADMIN" />
|
||||
|
||||
<!-- Firebase -->
|
||||
<uses-permission
|
||||
android:name="com.google.android.c2dm.permission.RECEIVE"
|
||||
tools:node="remove" />
|
||||
<uses-permission
|
||||
android:name="eu.faircode.netguard.permission.C2D_MESSAGE"
|
||||
tools:node="remove" />
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.wifi"
|
||||
android:required="false" />
|
||||
|
@ -54,12 +46,6 @@
|
|||
android:theme="@style/AppThemeTeal"
|
||||
tools:ignore="ManifestResource">
|
||||
|
||||
<meta-data
|
||||
android:name="firebase_analytics_collection_deactivated"
|
||||
android:value="true" />
|
||||
<meta-data
|
||||
android:name="firebase_crash_collection_enabled"
|
||||
android:value="false" />
|
||||
<meta-data
|
||||
android:name="android.max_aspect"
|
||||
android:value="2.1" />
|
||||
|
|
|
@ -33,7 +33,6 @@ import android.net.Uri;
|
|||
import android.net.VpnService;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
import android.support.annotation.NonNull;
|
||||
|
@ -47,13 +46,11 @@ import android.support.v7.widget.LinearLayoutManager;
|
|||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.text.SpannableString;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ImageSpan;
|
||||
import android.text.style.UnderlineSpan;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
|
@ -67,16 +64,9 @@ import android.widget.CheckBox;
|
|||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.gms.ads.AdListener;
|
||||
import com.google.android.gms.ads.AdRequest;
|
||||
import com.google.android.gms.ads.AdSize;
|
||||
import com.google.android.gms.ads.AdView;
|
||||
import com.google.android.gms.ads.MobileAds;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ActivityMain extends AppCompatActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
@ -339,18 +329,15 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
registerReceiver(packageChangedReceiver, intentFilter);
|
||||
|
||||
// First use
|
||||
boolean admob = prefs.getBoolean("admob", false);
|
||||
if (!initialized || !admob) {
|
||||
if (!initialized) {
|
||||
// Create view
|
||||
LayoutInflater inflater = LayoutInflater.from(this);
|
||||
View view = inflater.inflate(R.layout.first, null, false);
|
||||
|
||||
TextView tvFirst = view.findViewById(R.id.tvFirst);
|
||||
TextView tvPrivacy = view.findViewById(R.id.tvPrivacy);
|
||||
TextView tvAdmob = view.findViewById(R.id.tvAdmob);
|
||||
tvFirst.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
tvPrivacy.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
tvAdmob.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
// Show dialog
|
||||
dialogFirst = new AlertDialog.Builder(this)
|
||||
|
@ -361,7 +348,6 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (running) {
|
||||
prefs.edit().putBoolean("initialized", true).apply();
|
||||
prefs.edit().putBoolean("admob", true).apply();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -415,9 +401,6 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
}
|
||||
|
||||
// Initialize ads
|
||||
initAds();
|
||||
|
||||
// Handle intent
|
||||
checkExtras(getIntent());
|
||||
}
|
||||
|
@ -455,12 +438,6 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
if (adapter != null)
|
||||
adapter.notifyDataSetChanged();
|
||||
|
||||
// Ads
|
||||
if (!IAB.isPurchasedAny(this) && Util.hasPlayServices(this))
|
||||
enableAds();
|
||||
else
|
||||
disableAds();
|
||||
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
|
@ -473,8 +450,6 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
return;
|
||||
|
||||
DatabaseHelper.getInstance(this).removeAccessChangedListener(accessChangedListener);
|
||||
|
||||
disableAds();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -484,10 +459,6 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
|
||||
if (Build.VERSION.SDK_INT < MIN_SDK || Util.hasXposed(this))
|
||||
return;
|
||||
|
||||
disableAds();
|
||||
if (!IAB.isPurchasedAny(this) && Util.hasPlayServices(this))
|
||||
enableAds();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -927,113 +898,6 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
});
|
||||
}
|
||||
|
||||
private void initAds() {
|
||||
// https://developers.google.com/android/reference/com/google/android/gms/ads/package-summary
|
||||
MobileAds.initialize(getApplicationContext(), getString(R.string.ad_app_id));
|
||||
|
||||
final LinearLayout llAd = findViewById(R.id.llAd);
|
||||
TextView tvAd = findViewById(R.id.tvAd);
|
||||
final AdView adView = findViewById(R.id.adView);
|
||||
|
||||
SpannableString content = new SpannableString(getString(R.string.title_pro_ads));
|
||||
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
|
||||
tvAd.setText(content);
|
||||
|
||||
tvAd.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
startActivity(new Intent(ActivityMain.this, ActivityPro.class));
|
||||
}
|
||||
});
|
||||
|
||||
adView.setAdListener(new AdListener() {
|
||||
@Override
|
||||
public void onAdLoaded() {
|
||||
Log.i(TAG, "Ad loaded");
|
||||
llAd.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdFailedToLoad(int errorCode) {
|
||||
llAd.setVisibility(View.VISIBLE);
|
||||
switch (errorCode) {
|
||||
case AdRequest.ERROR_CODE_INTERNAL_ERROR:
|
||||
Log.w(TAG, "Ad load error=INTERNAL_ERROR");
|
||||
break;
|
||||
case AdRequest.ERROR_CODE_INVALID_REQUEST:
|
||||
Log.w(TAG, "Ad load error=INVALID_REQUEST");
|
||||
break;
|
||||
case AdRequest.ERROR_CODE_NETWORK_ERROR:
|
||||
Log.w(TAG, "Ad load error=NETWORK_ERROR");
|
||||
break;
|
||||
case AdRequest.ERROR_CODE_NO_FILL:
|
||||
Log.w(TAG, "Ad load error=NO_FILL");
|
||||
break;
|
||||
default:
|
||||
Log.w(TAG, "Ad load error=" + errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdOpened() {
|
||||
Log.i(TAG, "Ad opened");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdClosed() {
|
||||
Log.i(TAG, "Ad closed");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAdLeftApplication() {
|
||||
Log.i(TAG, "Ad left app");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void enableAds() {
|
||||
RelativeLayout rlAd = findViewById(R.id.rlAd);
|
||||
LinearLayout llAd = findViewById(R.id.llAd);
|
||||
final AdView adView = findViewById(R.id.adView);
|
||||
|
||||
rlAd.setVisibility(View.VISIBLE);
|
||||
llAd.setVisibility(View.VISIBLE);
|
||||
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
AdRequest adRequest = new AdRequest.Builder()
|
||||
.addTestDevice(getString(R.string.ad_test_device_id))
|
||||
.build();
|
||||
adView.loadAd(adRequest);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
|
||||
}
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
private void disableAds() {
|
||||
RelativeLayout rlAd = findViewById(R.id.rlAd);
|
||||
AdView adView = findViewById(R.id.adView);
|
||||
|
||||
rlAd.setVisibility(View.GONE);
|
||||
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) adView.getLayoutParams();
|
||||
RelativeLayout parent = (RelativeLayout) adView.getParent();
|
||||
parent.removeView(adView);
|
||||
|
||||
adView.destroy();
|
||||
adView = new AdView(this);
|
||||
adView.setAdSize(AdSize.SMART_BANNER);
|
||||
adView.setAdUnitId(getString(R.string.ad_banner_unit_id));
|
||||
adView.setId(R.id.adView);
|
||||
adView.setLayoutParams(params);
|
||||
parent.addView(adView);
|
||||
}
|
||||
|
||||
private void checkExtras(Intent intent) {
|
||||
// Approve request
|
||||
if (intent.hasExtra(EXTRA_APPROVE)) {
|
||||
|
@ -1252,7 +1116,6 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
Button btnRate = view.findViewById(R.id.btnRate);
|
||||
TextView tvLicense = view.findViewById(R.id.tvLicense);
|
||||
TextView tvPrivacy = view.findViewById(R.id.tvPrivacy);
|
||||
TextView tvAdmob = view.findViewById(R.id.tvAdmob);
|
||||
|
||||
// Show version
|
||||
tvVersionName.setText(Util.getSelfVersionName(this));
|
||||
|
@ -1264,7 +1127,6 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
tvLicense.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
tvLicense.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
tvPrivacy.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
tvAdmob.setVisibility(IAB.isPurchasedAny(this) ? View.GONE : View.VISIBLE);
|
||||
|
||||
// Handle logcat
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
|
|
|
@ -31,7 +31,6 @@ import android.support.v7.app.AlertDialog;
|
|||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.util.Linkify;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -43,9 +42,6 @@ import android.widget.Button;
|
|||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class ActivityPro extends AppCompatActivity {
|
||||
private static final String TAG = "NetGuard.Pro";
|
||||
|
||||
|
|
|
@ -57,9 +57,6 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.android.gms.common.ConnectionResult;
|
||||
import com.google.android.gms.common.GoogleApiAvailability;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
|
@ -428,11 +425,6 @@ public class Util {
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean hasPlayServices(Context context) {
|
||||
GoogleApiAvailability api = GoogleApiAvailability.getInstance();
|
||||
return (api.isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS);
|
||||
}
|
||||
|
||||
public static boolean hasXposed(Context context) {
|
||||
if (true || !isPlayStoreInstall(context))
|
||||
return false;
|
||||
|
|
|
@ -103,15 +103,6 @@
|
|||
android:text="@string/app_privacy"
|
||||
android:textAppearance="@style/TextSmall"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAdmob"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/app_admob"
|
||||
android:textAppearance="@style/TextSmall"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
|
@ -52,14 +52,6 @@
|
|||
android:layout_marginTop="8dp"
|
||||
android:text="@string/app_privacy"
|
||||
android:textAppearance="@style/TextMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAdmob"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/app_admob"
|
||||
android:textAppearance="@style/TextMedium" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
|
@ -148,61 +148,6 @@
|
|||
android:text="@android:string/ok"
|
||||
android:textAppearance="@style/TextSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rlAd"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:id="@+id/tvDivider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dip"
|
||||
android:layout_marginTop="8dip"
|
||||
android:background="@android:color/darker_gray" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tvDivider">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llAd"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/ic_security_color_24dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAd"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:textAppearance="@style/TextSmall"
|
||||
android:textColor="?attr/colorOff" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.gms.ads.AdView
|
||||
android:id="@+id/adView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
ads:adSize="SMART_BANNER"
|
||||
ads:adUnitId="@string/ad_banner_unit_id" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
|
|
|
@ -9,12 +9,6 @@
|
|||
<string name="app_first">Great care has been taken to develop and test NetGuard,
|
||||
however it is impossible to guarantee NetGuard will work correctly on every device.
|
||||
\n\nBy using NetGuard, you agree to the <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License version 3</a></string>
|
||||
<string name="app_admob">NetGuard uses Google\'s AdMob advertising service.
|
||||
AdMob uses the device\'s advertising ID to serve personalized ads.
|
||||
AdMob\'s privacy policy is available <a href="http://www.google.com/policies/privacy/">here</a> and <a href="http://www.google.com/policies/privacy/partners/">here</a>.
|
||||
You can opt-out from personalized ads <a href="https://www.google.com/settings/u/0/ads/authenticated">here</a>.
|
||||
By using NetGuard, you agree to using AdMob to display ads.
|
||||
</string>
|
||||
<string name="app_agree">I agree</string>
|
||||
<string name="app_disagree">I disagree</string>
|
||||
|
||||
|
@ -348,8 +342,5 @@ Your internet traffic is not being sent to a remote VPN server.</string>
|
|||
<item>6</item>
|
||||
</string-array>
|
||||
|
||||
<string name="ad_app_id" translatable="false">ca-app-pub-6350249268625326~6636046697</string>
|
||||
<string name="ad_banner_unit_id" translatable="false">ca-app-pub-6350249268625326/8112779894</string>
|
||||
<string name="ad_test_device_id" translatable="false">552541D5D2716FC6104E56803A84F806</string>
|
||||
<string name="fingerprint" translatable="false">ef46f813d2c8a064d72c936b9b96d1cccc989378</string>
|
||||
</resources>
|
||||
|
|
|
@ -10,7 +10,6 @@ buildscript {
|
|||
// https://bintray.com/android/android-tools/com.android.tools.build.gradle-experimental/view
|
||||
// https://bintray.com/android/android-tools/com.google.gms.google-services/view
|
||||
classpath 'com.android.tools.build:gradle:3.1.+'
|
||||
classpath 'com.google.gms:google-services:3.1.+'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
|
Loading…
Add table
Reference in a new issue