Fill out the implementation of pushUser in actfmsyncservice

pull/14/head
Sam Bosley 12 years ago
parent b948fb2f52
commit a58844e05d

@ -55,6 +55,7 @@ import com.todoroo.astrid.dao.TagDataDao;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.dao.TaskDao.TaskCriteria;
import com.todoroo.astrid.dao.UpdateDao;
import com.todoroo.astrid.dao.UserDao;
import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.MetadataApiDao.MetadataCriteria;
import com.todoroo.astrid.data.RemoteModel;
@ -99,6 +100,7 @@ public final class ActFmSyncService {
@Autowired TaskDao taskDao;
@Autowired TagDataDao tagDataDao;
@Autowired UpdateDao updateDao;
@Autowired UserDao userDao;
@Autowired MetadataDao metadataDao;
@Autowired ABTestEventReportingService abTestEventReportingService;
@ -913,8 +915,15 @@ public final class ActFmSyncService {
params.add("id"); params.add(model.getValue(User.REMOTE_ID));
params.add("status"); params.add(model.getValue(User.PENDING_STATUS));
JSONObject result = actFmInvoker.invoke("user_set_status", params);
System.err.println("RESULT: " + result);
JSONObject result = actFmInvoker.invoke("user_set_status", params.toArray(new Object[params.size()]));
if (result.optString("status").equals("success")) {
String newStatus = result.optString("friendship_status");
if (!TextUtils.isEmpty(newStatus)) {
model.setValue(User.STATUS, newStatus);
model.setValue(User.PENDING_STATUS, "");
userDao.saveExisting(model);
}
}
} catch (IOException e) {
handleException("user-status", e);
}

@ -18,6 +18,7 @@ import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.actfm.sync.ActFmSyncService;
import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.dao.UserDao;
@ -43,6 +44,8 @@ public class PersonViewFragment extends TaskListFragment {
@Autowired ActFmPreferenceService actFmPreferenceService;
@Autowired ActFmSyncService actFmSyncService;
private AsyncImageView userImage;
private TextView userSubtitle;
private TextView userStatusButton;

Loading…
Cancel
Save