Fix for RTM duplicating tasks on sync (it was happening twice), fix for PDV log in activity not showing up, fix for PDV not logging you out

pull/14/head
Tim Su 14 years ago
parent c03394e6bd
commit bfbd493fe9

@ -11,6 +11,7 @@ import android.graphics.drawable.BitmapDrawable;
import com.timsu.astrid.R;
import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.Order;
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.sql.QueryTemplate;
import com.todoroo.astrid.activity.FilterListActivity;
@ -41,10 +42,17 @@ public final class CoreFilterExposer extends BroadcastReceiver {
SearchFilter searchFilter = new SearchFilter(r.getString(R.string.BFE_Search));
searchFilter.listingIcon = ((BitmapDrawable)r.getDrawable(R.drawable.tango_search)).getBitmap();
Filter recent = new Filter(r.getString(R.string.BFE_Recent),
r.getString(R.string.BFE_Recent),
new QueryTemplate().orderBy(Order.desc(Task.MODIFICATION_DATE)).limit(15),
null);
recent.listingIcon = ((BitmapDrawable)r.getDrawable(R.drawable.tango_new)).getBitmap();
// transmit filter list
FilterListItem[] list = new FilterListItem[2];
FilterListItem[] list = new FilterListItem[3];
list[0] = inbox;
list[1] = searchFilter;
list[1] = recent;
list[2] = searchFilter;
Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_SEND_FILTERS);
broadcastIntent.putExtra(AstridApiConstants.EXTRAS_RESPONSE, list);
context.sendBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ);

@ -80,7 +80,7 @@ public class ProducteevDetailExposer extends BroadcastReceiver implements Detail
!= Preferences.getLong(ProducteevUtilities.PREF_DEFAULT_DASHBOARD, 0L) &&
ownerDashboard != null) {
String dashboardName = ownerDashboard.getValue(ProducteevDashboard.NAME);
builder.append("<img src='silk_script'/> ").append(dashboardName).append(TaskAdapter.DETAIL_SEPARATOR); //$NON-NLS-1$
builder.append("<img src='silk_folder'/> ").append(dashboardName).append(TaskAdapter.DETAIL_SEPARATOR); //$NON-NLS-1$
}
// display responsible user if not current one

@ -38,12 +38,11 @@ public class ProducteevUtilities extends SyncProviderUtilities {
public static final String PREF_SERVER_LAST_SYNC = IDENTIFIER + "_last_server"; //$NON-NLS-1$
public static final String PREF_EMAIL = IDENTIFIER + "_email"; //$NON-NLS-1$
public static final String PREF_PASSWORD = IDENTIFIER + "_password"; //$NON-NLS-1$
/** Producteev user's default dashboard. This is different from the
* preference key, which indicates where user wants to put new tasks */
public static final String PREF_DEFAULT_DASHBOARD = IDENTIFIER + "_defaultdash"; //$NON-NLS-1$
/** Producteev user's id */
public static final String PREF_USER_ID = IDENTIFIER + "_userid"; //$NON-NLS-1$
/**

@ -21,10 +21,10 @@ import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.Join;
import com.todoroo.andlib.sql.Query;
import com.todoroo.astrid.dao.MetadataDao;
import com.todoroo.astrid.dao.MetadataDao.MetadataCriteria;
import com.todoroo.astrid.dao.StoreObjectDao;
import com.todoroo.astrid.dao.StoreObjectDao.StoreObjectCriteria;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.dao.MetadataDao.MetadataCriteria;
import com.todoroo.astrid.dao.StoreObjectDao.StoreObjectCriteria;
import com.todoroo.astrid.dao.TaskDao.TaskCriteria;
import com.todoroo.astrid.model.Metadata;
import com.todoroo.astrid.model.StoreObject;
@ -80,6 +80,7 @@ public final class ProducteevDataService {
public void clearMetadata() {
metadataDao.deleteWhere(Metadata.KEY.eq(ProducteevTask.METADATA_KEY));
metadataDao.deleteWhere(Metadata.KEY.eq(ProducteevNote.METADATA_KEY));
storeObjectDao.deleteWhere(StoreObject.TYPE.eq(ProducteevDashboard.TYPE));
}
/**
@ -147,7 +148,7 @@ public final class ProducteevDataService {
task.pdvTask.setValue(Metadata.KEY, ProducteevTask.METADATA_KEY);
for(Metadata metadata : task.metadata) {
metadata.setValue(Metadata.TASK, task.task.getId());
metadataDao.createNew(metadata);
metadataDao.persist(metadata);
}
}

@ -82,6 +82,8 @@ public class ProducteevSyncProvider extends SyncProvider<ProducteevTaskContainer
*/
public void signOut() {
preferences.setToken(null);
Preferences.setString(R.string.producteev_PPr_email, null);
Preferences.setString(R.string.producteev_PPr_password, null);
preferences.clearLastSyncDate();
dataService = ProducteevDataService.getInstance();
@ -163,8 +165,9 @@ public class ProducteevSyncProvider extends SyncProvider<ProducteevTaskContainer
if(context instanceof Activity)
((Activity)context).startActivityForResult(intent, 0);
else {
preferences.setToken(null);
preferences.stopOngoing();
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
ProducteevUtilities.INSTANCE.stopOngoing();
}
} else {
invoker.authenticate(email, password);

@ -67,7 +67,7 @@ public class MilkDetailExposer extends BroadcastReceiver implements DetailExpose
return null;
if(listId > 0 && !"Inbox".equals(listName)) { //$NON-NLS-1$
builder.append("<img src='silk_script'/> ").append(listName).append(TaskAdapter.DETAIL_SEPARATOR); //$NON-NLS-1$
builder.append("<img src='silk_folder'/> ").append(listName).append(TaskAdapter.DETAIL_SEPARATOR); //$NON-NLS-1$
}
int repeat = metadata.getValue(MilkTask.REPEATING);

@ -84,6 +84,7 @@ public class MilkLoginActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.rmilk_login_activity);
setTitle(R.string.rmilk_MPr_header);
String urlParam = getIntent().getStringExtra(URL_TOKEN);

@ -159,7 +159,7 @@ public class MilkPreferences extends TodorooPreferences {
boolean loggedIn = MilkUtilities.isLoggedIn();
preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference p) {
new RTMSyncProvider().synchronize(MilkPreferences.this);
startService(new Intent(MilkPreferences.this, MilkBackgroundService.class));
finish();
return true;
}

@ -217,7 +217,8 @@ public class RTMSyncProvider extends SyncProvider<RTMTaskContainer> {
((Activity)context).startActivityForResult(intent, 0);
else {
// can't synchronize until user logs in
MilkUtilities.setToken(null);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
MilkUtilities.stopOngoing();
}

@ -12,6 +12,9 @@
<!-- Search Filter -->
<string name="BFE_Search">Search...</string>
<!-- Recently Modified -->
<string name="BFE_Recent">Recently Modified</string>
<!-- Build Your Own Filter -->
<string name="BFE_Custom">Custom Filter...</string>

Loading…
Cancel
Save