Removed all references to Task.SHARED_WITH

pull/14/head
Sam Bosley 13 years ago
parent f20cfe1360
commit b1ae98aec4

@ -169,9 +169,6 @@ public final class Task extends RemoteModel {
public static final LongProperty CREATOR_ID = new LongProperty( public static final LongProperty CREATOR_ID = new LongProperty(
TABLE, "creatorId", Property.PROP_FLAG_USER_ID); TABLE, "creatorId", Property.PROP_FLAG_USER_ID);
public static final StringProperty SHARED_WITH = new StringProperty(
TABLE, "sharedWith");
/** Last Sync date */ /** Last Sync date */
public static final LongProperty LAST_SYNC = new LongProperty( public static final LongProperty LAST_SYNC = new LongProperty(
TABLE, "lastSync", Property.PROP_FLAG_DATE); TABLE, "lastSync", Property.PROP_FLAG_DATE);
@ -296,7 +293,6 @@ public final class Task extends RemoteModel {
defaultValues.put(USER_ID.name, "0"); defaultValues.put(USER_ID.name, "0");
defaultValues.put(CREATOR_ID.name, 0); defaultValues.put(CREATOR_ID.name, 0);
defaultValues.put(USER.name, "{}"); defaultValues.put(USER.name, "{}");
defaultValues.put(SHARED_WITH.name, "{}");
defaultValues.put(PUSHED_AT.name, 0L); defaultValues.put(PUSHED_AT.name, 0L);
} }

@ -104,8 +104,6 @@ public class EditPeopleControlSet extends PopupControlSet {
private final Fragment fragment; private final Fragment fragment;
private final PeopleContainer sharedWithContainer;
private final CheckBox cbFacebook; private final CheckBox cbFacebook;
private final CheckBox cbTwitter; private final CheckBox cbTwitter;
@ -224,27 +222,6 @@ public class EditPeopleControlSet extends PopupControlSet {
@SuppressWarnings("nls") @SuppressWarnings("nls")
public void setUpData(final Task task, final TagData includeTag) { public void setUpData(final Task task, final TagData includeTag) {
try {
JSONObject sharedWith;
if(task.getValue(Task.SHARED_WITH).length() > 0)
sharedWith = new JSONObject(task.getValue(Task.SHARED_WITH));
else
sharedWith = new JSONObject();
cbFacebook.setChecked(sharedWith.optBoolean("fb", false));
cbTwitter.setChecked(sharedWith.optBoolean("tw", false));
final ArrayList<JSONObject> sharedPeople = new ArrayList<JSONObject>();
JSONArray people = sharedWith.optJSONArray("p");
if(people != null) {
for(int i = 0; i < people.length(); i++) {
String person = people.getString(i);
TextView textView = sharedWithContainer.addPerson(person, "");
textView.setEnabled(false);
sharedPeople.add(PeopleContainer.createUserJson(textView));
}
}
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -281,10 +258,6 @@ public class EditPeopleControlSet extends PopupControlSet {
} }
} }
}).start(); }).start();
} catch (JSONException e) {
exceptionService.reportError("json-reading-data", e);
}
} }
@SuppressWarnings("nls") @SuppressWarnings("nls")
@ -356,7 +329,7 @@ public class EditPeopleControlSet extends PopupControlSet {
} }
@SuppressWarnings("nls") @SuppressWarnings("nls")
private void buildAssignedToSpinner(Task t, ArrayList<JSONObject> sharedPeople) { private void buildAssignedToSpinner(Task t) {
HashSet<Long> userIds = new HashSet<Long>(); HashSet<Long> userIds = new HashSet<Long>();
HashSet<String> emails = new HashSet<String>(); HashSet<String> emails = new HashSet<String>();
HashMap<String, AssignedToUser> names = new HashMap<String, AssignedToUser>(); HashMap<String, AssignedToUser> names = new HashMap<String, AssignedToUser>();
@ -392,7 +365,6 @@ public class EditPeopleControlSet extends PopupControlSet {
// de-duplicate by user id and/or email // de-duplicate by user id and/or email
coreUsers = convertJsonUsersToAssignedUsers(coreUsersJson, userIds, emails, names); coreUsers = convertJsonUsersToAssignedUsers(coreUsersJson, userIds, emails, names);
listUsers = convertJsonUsersToAssignedUsers(sharedPeople, userIds, emails, names);
astridUsers = convertJsonUsersToAssignedUsers(astridFriends, userIds, emails, names); astridUsers = convertJsonUsersToAssignedUsers(astridFriends, userIds, emails, names);
contactPickerUser = new AssignedToUser(activity.getString(R.string.actfm_EPA_choose_contact), contactPickerUser = new AssignedToUser(activity.getString(R.string.actfm_EPA_choose_contact),
@ -761,17 +733,8 @@ public class EditPeopleControlSet extends PopupControlSet {
} }
JSONObject sharedWith = sharedWithContainer.parseSharedWithAndTags(activity, false);
EditText message = (EditText) getSharedWithView().findViewById(R.id.message); EditText message = (EditText) getSharedWithView().findViewById(R.id.message);
if (!TextUtils.isEmpty(message.getText()) && sharedWith.has("p"))
sharedWith.put("message", message.getText().toString());
if(cbFacebook.isChecked())
sharedWith.put("fb", true);
if(cbTwitter.isChecked())
sharedWith.put("tw", true);
dirty = dirty || sharedWith.has("p");
if(dirty && !actFmPreferenceService.isLoggedIn()) { if(dirty && !actFmPreferenceService.isLoggedIn()) {
DialogInterface.OnClickListener okListener = new DialogInterface.OnClickListener() { DialogInterface.OnClickListener okListener = new DialogInterface.OnClickListener() {
@Override @Override
@ -798,9 +761,6 @@ public class EditPeopleControlSet extends PopupControlSet {
return false; return false;
} }
if(!TextUtils.isEmpty(task.getValue(Task.SHARED_WITH)) || sharedWith.length() != 0)
task.setValue(Task.SHARED_WITH, sharedWith.toString());
task.putTransitory(TaskService.TRANS_ASSIGNED, true); task.putTransitory(TaskService.TRANS_ASSIGNED, true);
if (assignedView == assignedCustom) if (assignedView == assignedCustom)

@ -461,25 +461,25 @@ public final class ActFmSyncService {
} }
} }
if (values.containsKey(Task.SHARED_WITH.name)) { // if (values.containsKey(Task.SHARED_WITH.name)) {
try { // try {
JSONObject sharedWith = new JSONObject(task.getValue(Task.SHARED_WITH)); // JSONObject sharedWith = new JSONObject(task.getValue(Task.SHARED_WITH));
if (sharedWith.has("p")) { // if (sharedWith.has("p")) {
JSONArray people = sharedWith.getJSONArray("p"); // JSONArray people = sharedWith.getJSONArray("p");
for (int i = 0; i < people.length(); i++) { // for (int i = 0; i < people.length(); i++) {
params.add("share_with[]"); params.add(people.getString(i)); // params.add("share_with[]"); params.add(people.getString(i));
} // }
if (sharedWith.has("message")) { // if (sharedWith.has("message")) {
String message = sharedWith.getString("message"); // String message = sharedWith.getString("message");
if (!TextUtils.isEmpty(message)) // if (!TextUtils.isEmpty(message))
params.add("message"); params.add(message); // params.add("message"); params.add(message);
} // }
} // }
} catch (JSONException e) { // } catch (JSONException e) {
Log.e("Error parsing shared_with", task.getValue(Task.SHARED_WITH), e); // Log.e("Error parsing shared_with", task.getValue(Task.SHARED_WITH), e);
} // }
sharing = true; // sharing = true;
} // }
if (sharing) { if (sharing) {
addAbTestEventInfo(params); addAbTestEventInfo(params);

@ -150,7 +150,8 @@ public class ReminderDialog extends Dialog {
Notifications.getRandomReminder(activity.getResources().getStringArray(R.array.reminder_responses))); Notifications.getRandomReminder(activity.getResources().getStringArray(R.array.reminder_responses)));
if (Preferences.getBoolean(R.string.p_rmd_social, true)) { if (Preferences.getBoolean(R.string.p_rmd_social, true)) {
Task task = taskService.fetchById(taskId, Task.ID, Task.SHARED_WITH); Task task = new Task();
task.setId(taskId);
addFacesToReminder(activity, task); addFacesToReminder(activity, task);
} }
} }
@ -161,8 +162,6 @@ public class ReminderDialog extends Dialog {
LinkedHashSet<String> pictureUrls = new LinkedHashSet<String>(); LinkedHashSet<String> pictureUrls = new LinkedHashSet<String>();
AtomicBoolean isSharedTask = new AtomicBoolean(false); AtomicBoolean isSharedTask = new AtomicBoolean(false);
addSharedWithFaces(task, pictureUrls, isSharedTask);
if (pictureUrls.size() < MAX_FACES) { if (pictureUrls.size() < MAX_FACES) {
addTagFaces(task.getId(), pictureUrls, isSharedTask); addTagFaces(task.getId(), pictureUrls, isSharedTask);
} }
@ -221,18 +220,6 @@ public class ReminderDialog extends Dialog {
} }
} }
private void addSharedWithFaces(Task t, LinkedHashSet<String> pictureUrls, AtomicBoolean isSharedTask) {
try {
JSONObject sharedWith = new JSONObject(t.getValue(Task.SHARED_WITH));
if (sharedWith.has("p")) { //$NON-NLS-1$
JSONArray people = sharedWith.getJSONArray("p"); //$NON-NLS-1$
addPicturesFromJSONArray(people, pictureUrls, isSharedTask);
}
} catch (JSONException e) {
//
}
}
private void addTagFaces(long taskId, LinkedHashSet<String> pictureUrls, AtomicBoolean isSharedTask) { private void addTagFaces(long taskId, LinkedHashSet<String> pictureUrls, AtomicBoolean isSharedTask) {
TodorooCursor<TagData> tags = tagService.getTagDataForTask(taskId, TagData.MEMBER_COUNT.gt(0), TagData.MEMBERS); TodorooCursor<TagData> tags = tagService.getTagDataForTask(taskId, TagData.MEMBER_COUNT.gt(0), TagData.MEMBERS);
try { try {

@ -219,8 +219,7 @@ public class Database extends AbstractDatabase {
Log.e("astrid", "db-upgrade-" + oldVersion + "-" + newVersion, e); Log.e("astrid", "db-upgrade-" + oldVersion + "-" + newVersion, e);
} }
case 10: try { case 10: try {
database.execSQL("ALTER TABLE " + Task.TABLE.name + " ADD " + //
Task.SHARED_WITH.accept(visitor, null));
} catch (SQLiteException e) { } catch (SQLiteException e) {
Log.e("astrid", "db-upgrade-" + oldVersion + "-" + newVersion, e); Log.e("astrid", "db-upgrade-" + oldVersion + "-" + newVersion, e);
} }

Loading…
Cancel
Save