use of com.instructure.canvasapi2.models.Conversation in project instructure-android by instructure.
the class InboxManager method getConversationsFiltered.
public static void getConversationsFiltered(InboxApi.Scope scope, String canvasContext, boolean forceNetwork, StatusCallback<List<Conversation>> callback) {
if (isTesting() || mTesting) {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
InboxManager_Test.getConversationsFiltered(scope, canvasContext, adapter, callback, params);
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(true).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
InboxApi.getConversationsFiltered(scope, canvasContext, adapter, callback, params);
}
}
use of com.instructure.canvasapi2.models.Conversation in project instructure-android by instructure.
the class InboxManager method starConversation.
public static void starConversation(long conversationId, boolean starred, Conversation.WorkflowState workFlowState, StatusCallback<Conversation> callback) {
if (isTesting() || mTesting) {
InboxManager_Test.updateConversation(conversationId, null, starred, callback);
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withShouldIgnoreToken(false).withPerPageQueryParam(false).build();
InboxApi.updateConversation(adapter, callback, params, conversationId, workFlowState, starred);
}
}
use of com.instructure.canvasapi2.models.Conversation in project instructure-android by instructure.
the class InboxManager method addMessageToConversationSynchronous.
@Nullable
public static Conversation addMessageToConversationSynchronous(long conversationId, String messageText, List<Long> attachmentIds) {
if (isTesting() || mTesting) {
// TODO
return new Conversation();
} else {
RestBuilder adapter = new RestBuilder();
RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).build();
try {
Response<Conversation> response = InboxApi.addMessageToConversationSynchronous(adapter, params, conversationId, messageText, attachmentIds);
return response.isSuccessful() ? response.body() : null;
} catch (IOException e) {
return null;
}
}
}
use of com.instructure.canvasapi2.models.Conversation in project instructure-android by instructure.
the class ConversationTest method getLastMessagePreview.
@Test
public void getLastMessagePreview() {
Conversation conversation = new Conversation();
conversation.setDeletedString("conversation deleted");
conversation.setLastMessage("last message");
conversation.setDeleted(false);
assertEquals("last message", conversation.getLastMessagePreview());
}
use of com.instructure.canvasapi2.models.Conversation in project instructure-android by instructure.
the class ConversationTest method hasMedia.
@Test
public void hasMedia() {
Conversation conversation = new Conversation();
ArrayList<String> properties = new ArrayList<>();
properties.add("media_objects");
conversation.setProperties(properties);
assertEquals(true, conversation.hasMedia());
}
Aggregations