forked from upstream-mirrors/quik
Create two different flavors: with analytics disabled for a free (as in
"free-speech") flavors and the usual version for Google Play
This commit is contained in:
+13
-3
@@ -5,6 +5,17 @@ repositories {
|
||||
}
|
||||
|
||||
android {
|
||||
flavorDimensions "analytics"
|
||||
|
||||
productFlavors {
|
||||
withAnalytics {
|
||||
dimension "analytics"
|
||||
}
|
||||
noAnalytics {
|
||||
dimension "analytics"
|
||||
}
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
checkReleaseBuilds false
|
||||
abortOnError false
|
||||
@@ -51,8 +62,7 @@ dependencies {
|
||||
compile 'com.android.support:appcompat-v7:22.2.1'
|
||||
compile 'com.android.support:support-v13:22.2.1'
|
||||
compile 'com.android.support:recyclerview-v7:22.2.1'
|
||||
compile 'com.google.android.gms:play-services-analytics:7.5.0'
|
||||
|
||||
withAnalyticsCompile 'com.google.android.gms:play-services-analytics:7.5.0'
|
||||
// External services
|
||||
compile 'com.crittercism:crittercism-android-agent:5.0.3'
|
||||
withAnalyticsCompile 'com.crittercism:crittercism-android-agent:5.0.3'
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<uses-permission android:name="com.android.vending.BILLING" />
|
||||
|
||||
<application
|
||||
android:name=".QKSMSApp"
|
||||
android:name=".QKSMSApp_"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher_teal"
|
||||
android:label="@string/app_name"
|
||||
|
||||
@@ -31,7 +31,6 @@ import android.util.Log;
|
||||
import com.android.mms.transaction.MmsSystemEventReceiver;
|
||||
import com.android.mms.util.DownloadManager;
|
||||
import com.android.mms.util.RateController;
|
||||
import com.crittercism.app.Crittercism;
|
||||
import com.moez.QKSMS.common.AnalyticsManager;
|
||||
import com.moez.QKSMS.common.LiveViewManager;
|
||||
import com.moez.QKSMS.common.google.DraftCache;
|
||||
@@ -77,7 +76,6 @@ public class QKSMSApp extends Application {
|
||||
// Initialize analytics, leakcanary, and crittercism
|
||||
AnalyticsManager.getInstance().init(this);
|
||||
refWatcher = LeakCanary.install(this);
|
||||
Crittercism.initialize(getApplicationContext(), getString(R.string.crtsm_key));
|
||||
|
||||
// Figure out the country *before* loading contacts and formatting numbers
|
||||
Country country = new Country(Locale.getDefault().getCountry(), Country.COUNTRY_SOURCE_LOCALE);
|
||||
@@ -155,7 +153,7 @@ public class QKSMSApp extends Application {
|
||||
*/
|
||||
public TelephonyManager getTelephonyManager() {
|
||||
if (mTelephonyManager == null) {
|
||||
mTelephonyManager = (TelephonyManager)getApplicationContext()
|
||||
mTelephonyManager = (TelephonyManager) getApplicationContext()
|
||||
.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
}
|
||||
return mTelephonyManager;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.moez.QKSMS;
|
||||
|
||||
public class QKSMSApp_ extends QKSMSApp {
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.moez.QKSMS.common;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public enum AnalyticsManager {
|
||||
INSTANCE;
|
||||
|
||||
private final static String TAG = "AnalyticsManager";
|
||||
private final static boolean LOCAL_LOGV = false;
|
||||
public final static String CATEGORY_MESSAGES = "messages";
|
||||
// Note: For preferences events, the action will just be the preference value.
|
||||
public final static String CATEGORY_PREFERENCE_CHANGE = "preference_change";
|
||||
public final static String CATEGORY_PREFERENCE_CLICK = "preference_click";
|
||||
public final static String CATEGORY_REPORT = "report";
|
||||
public final static String ACTION_SEND_MESSAGE = "send_message";
|
||||
public final static String ACTION_ATTACH_IMAGE = "attach_image";
|
||||
public final static String ACTION_ATTACH_FROM_CAMERA = "attach_from_camera";
|
||||
|
||||
public static AnalyticsManager getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void init(Context context) {
|
||||
}
|
||||
|
||||
public void sendEvent(String category, String action, String label) {
|
||||
}
|
||||
|
||||
public void sendEvent(String category, String action, String label, long value) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.moez.QKSMS;
|
||||
|
||||
import com.crittercism.app.Crittercism;
|
||||
|
||||
public class QKSMSApp_ extends QKSMSApp {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Crittercism.initialize(getApplicationContext(), getString(R.string.crtsm_key));
|
||||
}
|
||||
}
|
||||
+5
-4
@@ -2,6 +2,7 @@ package com.moez.QKSMS.common;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.analytics.GoogleAnalytics;
|
||||
import com.google.android.gms.analytics.HitBuilders;
|
||||
import com.google.android.gms.analytics.Tracker;
|
||||
@@ -56,8 +57,8 @@ public enum AnalyticsManager {
|
||||
|
||||
HitBuilders.EventBuilder b = new HitBuilders.EventBuilder();
|
||||
if (category != null) b.setCategory(category);
|
||||
if (action != null) b.setAction(action);
|
||||
if (label != null) b.setLabel(label);
|
||||
if (action != null) b.setAction(action);
|
||||
if (label != null) b.setLabel(label);
|
||||
|
||||
mTracker.send(b.build());
|
||||
}
|
||||
@@ -68,8 +69,8 @@ public enum AnalyticsManager {
|
||||
|
||||
HitBuilders.EventBuilder b = new HitBuilders.EventBuilder();
|
||||
if (category != null) b.setCategory(category);
|
||||
if (action != null) b.setAction(action);
|
||||
if (label != null) b.setLabel(label);
|
||||
if (action != null) b.setAction(action);
|
||||
if (label != null) b.setLabel(label);
|
||||
b.setValue(value);
|
||||
|
||||
mTracker.send(b.build());
|
||||
Reference in New Issue
Block a user