Create googleplay and generic build flavors

* gtask permissions moved to googleplay version
* billing moved to googleplay version
pull/281/head
Alex Baker 10 years ago
parent dc7da0baf8
commit 5af1883562

@ -61,6 +61,11 @@ android {
} else { } else {
buildTypes.release.signingConfig = null buildTypes.release.signingConfig = null
} }
productFlavors {
generic
googleplay
}
} }
android.applicationVariants.all { variant -> android.applicationVariants.all { variant ->

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.tasks">
<!-- **************** -->
<!-- in-app donations -->
<!-- **************** -->
<uses-permission android:name="com.android.vending.BILLING" />
<!-- **************** -->
<!-- google task sync -->
<!-- **************** -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH" />
<application>
<activity
android:name=".activities.DonationActivity"
android:theme="@style/Tasks.Dialog" />
</application>
</manifest>

@ -1,5 +1,6 @@
package org.tasks.activities; package org.tasks.activities;
import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
@ -14,14 +15,13 @@ import org.tasks.billing.IabHelper;
import org.tasks.billing.IabResult; import org.tasks.billing.IabResult;
import org.tasks.billing.Inventory; import org.tasks.billing.Inventory;
import org.tasks.billing.Purchase; import org.tasks.billing.Purchase;
import org.tasks.injection.InjectingActivity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class DonationActivity extends InjectingActivity implements IabHelper.OnIabSetupFinishedListener, public class DonationActivity extends Activity implements IabHelper.OnIabSetupFinishedListener,
IabHelper.QueryInventoryFinishedListener, IabHelper.OnIabPurchaseFinishedListener, IabHelper.QueryInventoryFinishedListener, IabHelper.OnIabPurchaseFinishedListener,
IabHelper.OnConsumeFinishedListener, IabHelper.OnConsumeMultiFinishedListener { IabHelper.OnConsumeFinishedListener, IabHelper.OnConsumeMultiFinishedListener {

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="billing_enabled">true</bool>
</resources>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="sync_enabled">true</bool>
</resources>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="gp_key">MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk8mXRE3dDXwtinUILCEzKjov2rxs3kZbLRzNrcjFWXpG9OEsUzRGLzqEN+WwibVuMRpZLj/+IxbU2sJWq/M0q+90rOhmXn46ZPeNyr77IqX2pWKIAWpzBoWq/mshRwtm9m1FIiGdBNlXrhSE7u3TGB5FuEuuSqKWvWzxeqQ7fHmlM04Lqrh1mN3FaMne8rWv+DWVHDbLrtnXBuC36glOAj17HxrzaE2v6Pv7Df3QefJ3rM1+0fAp/5jNInaP0qHAlG8WTbUmDShQ5kG3urbv3HLByyx6TSqhmNudXUK/6TusvIj50OptAG7x+UFYf956dD3diXhY3yoICvyFWx1sNwIDAQAB</string>
</resources>

@ -6,11 +6,6 @@
<!-- ================================================== Used Permissions = --> <!-- ================================================== Used Permissions = -->
<!-- **************** -->
<!-- in-app donations -->
<!-- **************** -->
<uses-permission android:name="com.android.vending.BILLING" />
<!-- ************* --> <!-- ************* -->
<!-- notifications --> <!-- notifications -->
<!-- ************* --> <!-- ************* -->
@ -32,15 +27,6 @@
<!-- **************************************** --> <!-- **************************************** -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- **************** -->
<!-- google task sync -->
<!-- **************** -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH" />
<!-- ********************* --> <!-- ********************* -->
<!-- missed call reminders --> <!-- missed call reminders -->
<!-- ********************* --> <!-- ********************* -->
@ -189,10 +175,6 @@
android:label="@string/help_and_feedback" android:label="@string/help_and_feedback"
android:theme="@style/Tasks" /> android:theme="@style/Tasks" />
<activity
android:name=".activities.DonationActivity"
android:theme="@style/Tasks.Dialog" />
<!-- Activity that configures widget --> <!-- Activity that configures widget -->
<activity android:name="com.todoroo.astrid.widget.WidgetConfigActivity"> <activity android:name="com.todoroo.astrid.widget.WidgetConfigActivity">
<intent-filter> <intent-filter>

@ -29,7 +29,6 @@ import org.tasks.activities.ClearGtaskDataActivity;
import org.tasks.activities.DeleteAllCalendarEventsActivity; import org.tasks.activities.DeleteAllCalendarEventsActivity;
import org.tasks.activities.DeleteCompletedActivity; import org.tasks.activities.DeleteCompletedActivity;
import org.tasks.activities.DeleteCompletedEventsActivity; import org.tasks.activities.DeleteCompletedEventsActivity;
import org.tasks.activities.DonationActivity;
import org.tasks.activities.ExportTaskActivity; import org.tasks.activities.ExportTaskActivity;
import org.tasks.activities.ImportTaskActivity; import org.tasks.activities.ImportTaskActivity;
import org.tasks.activities.PurgeDeletedActivity; import org.tasks.activities.PurgeDeletedActivity;
@ -81,7 +80,6 @@ import dagger.Provides;
ClearGtaskDataActivity.class, ClearGtaskDataActivity.class,
ReminderPreferences.class, ReminderPreferences.class,
HelpAndFeedbackActivity.class, HelpAndFeedbackActivity.class,
DonationActivity.class,
AppearancePreferences.class AppearancePreferences.class
}) })
public class ActivityModule { public class ActivityModule {

@ -18,6 +18,9 @@ public class BasicPreferences extends InjectingPreferenceActivity {
String action = getIntent().getAction(); String action = getIntent().getAction();
if (action == null) { if (action == null) {
addPreferencesFromResource(R.xml.preferences); addPreferencesFromResource(R.xml.preferences);
if (!getResources().getBoolean(R.bool.sync_enabled)) {
getPreferenceScreen().removePreference(findPreference(getString(R.string.synchronization)));
}
findPreference(getString(R.string.EPr_appearance_header)).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { findPreference(getString(R.string.EPr_appearance_header)).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {

@ -10,6 +10,7 @@ import com.google.api.client.repackaged.com.google.common.base.Joiner;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.tasks.BuildConfig; import org.tasks.BuildConfig;
import org.tasks.R;
import org.tasks.injection.ForApplication; import org.tasks.injection.ForApplication;
import java.util.List; import java.util.List;
@ -17,7 +18,6 @@ import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import static com.todoroo.andlib.utility.AndroidUtilities.atLeastFroyo;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
@Singleton @Singleton
@ -43,7 +43,7 @@ public class DeviceInfo {
} }
public boolean supportsBilling() { public boolean supportsBilling() {
return atLeastFroyo() && isPlayStoreAvailable(); return context.getResources().getBoolean(R.bool.billing_enabled) && isPlayStoreAvailable();
} }
public String getDebugInfo() { public String getDebugInfo() {
@ -59,7 +59,7 @@ public class DeviceInfo {
return Joiner.on("\n").join(asList( return Joiner.on("\n").join(asList(
"", "",
"----------", "----------",
"Tasks: " + BuildConfig.VERSION_NAME + " (build " + BuildConfig.VERSION_CODE + ")", "Tasks: " + BuildConfig.VERSION_NAME + " (" + BuildConfig.FLAVOR + " build " + BuildConfig.VERSION_CODE + ")",
"Android: " + Build.VERSION.RELEASE, "Android: " + Build.VERSION.RELEASE,
"Model: " + Build.MANUFACTURER + " " + Build.MODEL, "Model: " + Build.MANUFACTURER + " " + Build.MODEL,
"Product: " + Build.PRODUCT + " (" + Build.DEVICE + ")", "Product: " + Build.PRODUCT + " (" + Build.DEVICE + ")",

@ -2,4 +2,6 @@
<resources> <resources>
<bool name="at_most_honeycomb">true</bool> <bool name="at_most_honeycomb">true</bool>
<bool name="at_least_honeycomb_mr1">false</bool> <bool name="at_least_honeycomb_mr1">false</bool>
<bool name="billing_enabled">false</bool>
<bool name="sync_enabled">false</bool>
</resources> </resources>

@ -6,7 +6,6 @@
<resources> <resources>
<string name="gapi_key">AIzaSyBXGYNWNQcfse4JS5gI9teTSKMzinWzL2M</string> <string name="gapi_key">AIzaSyBXGYNWNQcfse4JS5gI9teTSKMzinWzL2M</string>
<string name="gp_key">MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk8mXRE3dDXwtinUILCEzKjov2rxs3kZbLRzNrcjFWXpG9OEsUzRGLzqEN+WwibVuMRpZLj/+IxbU2sJWq/M0q+90rOhmXn46ZPeNyr77IqX2pWKIAWpzBoWq/mshRwtm9m1FIiGdBNlXrhSE7u3TGB5FuEuuSqKWvWzxeqQ7fHmlM04Lqrh1mN3FaMne8rWv+DWVHDbLrtnXBuC36glOAj17HxrzaE2v6Pv7Df3QefJ3rM1+0fAp/5jNInaP0qHAlG8WTbUmDShQ5kG3urbv3HLByyx6TSqhmNudXUK/6TusvIj50OptAG7x+UFYf956dD3diXhY3yoICvyFWx1sNwIDAQAB</string>
<!-- ======================================================== REMINDERS == --> <!-- ======================================================== REMINDERS == -->

Loading…
Cancel
Save