diff --git a/astrid/AndroidManifest.xml b/astrid/AndroidManifest.xml index 020f7cc04..01a1594e7 100644 --- a/astrid/AndroidManifest.xml +++ b/astrid/AndroidManifest.xml @@ -22,6 +22,8 @@ + + diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksPreferenceService.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksPreferenceService.java index e6ef32515..72d172832 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksPreferenceService.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksPreferenceService.java @@ -27,4 +27,13 @@ public class GtasksPreferenceService extends SyncProviderUtilities { /** GTasks user's default list id */ public static final String PREF_DEFAULT_LIST = IDENTIFIER + "_defaultlist"; //$NON-NLS-1$ + /** GTasks user name */ + public static final String PREF_USER_NAME = IDENTIFIER + "_user"; //$NON-NLS-1$ + + /** GTasks user password */ + public static final String PREF_PASSWORD = IDENTIFIER + "_password"; //$NON-NLS-1$ + + /** GTasks is apps for domain boolean */ + public static final String PREF_IS_DOMAIN = IDENTIFIER + "_domain"; //$NON-NLS-1$ + } \ No newline at end of file diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksLoginActivity.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksLoginActivity.java index e660720c2..91ce0d628 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksLoginActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksLoginActivity.java @@ -44,6 +44,7 @@ import com.todoroo.andlib.service.Autowired; import com.todoroo.andlib.service.ContextManager; import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.utility.DialogUtilities; +import com.todoroo.andlib.utility.Preferences; import com.todoroo.astrid.gtasks.GtasksBackgroundService; import com.todoroo.astrid.gtasks.GtasksPreferenceService; import com.todoroo.astrid.service.StatisticsService; @@ -128,6 +129,10 @@ public class GtasksLoginActivity extends Activity { String token = gcm.getToken(); gtasksPreferenceService.setToken(token); StatisticsService.reportEvent("gtasks-login"); + Preferences.setString(GtasksPreferenceService.PREF_USER_NAME, email); + Preferences.setString(GtasksPreferenceService.PREF_PASSWORD, password); + Preferences.setBoolean(GtasksPreferenceService.PREF_IS_DOMAIN, isDomain); + synchronize(); } catch (GoogleLoginException e) { errorMessage.append(getString(R.string.gtasks_GLA_errorAuth)); diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksSyncProvider.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksSyncProvider.java index 28b50d408..b8971bf23 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksSyncProvider.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/sync/GtasksSyncProvider.java @@ -156,7 +156,10 @@ public class GtasksSyncProvider extends SyncProvider { Log.e("astrid-sync", "No token, unable to sync"); return; } else { - connectionManager = new GoogleConnectionManager(authToken); + connectionManager = new GoogleConnectionManager( + Preferences.getStringValue(GtasksPreferenceService.PREF_USER_NAME), + Preferences.getStringValue(GtasksPreferenceService.PREF_PASSWORD), + !Preferences.getBoolean(GtasksPreferenceService.PREF_IS_DOMAIN, false)); } taskService = new GoogleTaskService(connectionManager);