Use new api getChatMessages() call.
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
parent
6c1039126e
commit
74bf89ef26
|
@ -58,6 +58,7 @@ import org.moire.ultrasonic.api.subsonic.SubsonicAPIClient;
|
||||||
import org.moire.ultrasonic.api.subsonic.models.AlbumListType;
|
import org.moire.ultrasonic.api.subsonic.models.AlbumListType;
|
||||||
import org.moire.ultrasonic.api.subsonic.models.JukeboxAction;
|
import org.moire.ultrasonic.api.subsonic.models.JukeboxAction;
|
||||||
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild;
|
import org.moire.ultrasonic.api.subsonic.models.MusicDirectoryChild;
|
||||||
|
import org.moire.ultrasonic.api.subsonic.response.ChatMessagesResponse;
|
||||||
import org.moire.ultrasonic.api.subsonic.response.GenresResponse;
|
import org.moire.ultrasonic.api.subsonic.response.GenresResponse;
|
||||||
import org.moire.ultrasonic.api.subsonic.response.GetAlbumList2Response;
|
import org.moire.ultrasonic.api.subsonic.response.GetAlbumList2Response;
|
||||||
import org.moire.ultrasonic.api.subsonic.response.GetAlbumListResponse;
|
import org.moire.ultrasonic.api.subsonic.response.GetAlbumListResponse;
|
||||||
|
@ -86,6 +87,7 @@ import org.moire.ultrasonic.api.subsonic.response.StreamResponse;
|
||||||
import org.moire.ultrasonic.api.subsonic.response.SubsonicResponse;
|
import org.moire.ultrasonic.api.subsonic.response.SubsonicResponse;
|
||||||
import org.moire.ultrasonic.data.APIAlbumConverter;
|
import org.moire.ultrasonic.data.APIAlbumConverter;
|
||||||
import org.moire.ultrasonic.data.APIArtistConverter;
|
import org.moire.ultrasonic.data.APIArtistConverter;
|
||||||
|
import org.moire.ultrasonic.data.APIChatMessageConverter;
|
||||||
import org.moire.ultrasonic.data.APIIndexesConverter;
|
import org.moire.ultrasonic.data.APIIndexesConverter;
|
||||||
import org.moire.ultrasonic.data.APIJukeboxConverter;
|
import org.moire.ultrasonic.data.APIJukeboxConverter;
|
||||||
import org.moire.ultrasonic.data.APILyricsConverter;
|
import org.moire.ultrasonic.data.APILyricsConverter;
|
||||||
|
@ -1246,29 +1248,15 @@ public class RESTMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ChatMessage> getChatMessages(Long since, Context context, ProgressListener progressListener) throws Exception
|
public List<ChatMessage> getChatMessages(Long since,
|
||||||
{
|
Context context,
|
||||||
checkServerVersion(context, "1.2", "Chat not supported.");
|
ProgressListener progressListener) throws Exception {
|
||||||
|
updateProgressListener(progressListener, R.string.parser_reading);
|
||||||
|
Response<ChatMessagesResponse> response = subsonicAPIClient.getApi()
|
||||||
|
.getChatMessages(since).execute();
|
||||||
|
checkResponseSuccessful(response);
|
||||||
|
|
||||||
HttpParams params = new BasicHttpParams();
|
return APIChatMessageConverter.toDomainEntitiesList(response.body().getChatMessages());
|
||||||
HttpConnectionParams.setSoTimeout(params, SOCKET_READ_TIMEOUT_GET_RANDOM_SONGS);
|
|
||||||
|
|
||||||
List<String> parameterNames = new ArrayList<String>();
|
|
||||||
List<Object> parameterValues = new ArrayList<Object>();
|
|
||||||
|
|
||||||
parameterNames.add("since");
|
|
||||||
parameterValues.add(since);
|
|
||||||
|
|
||||||
Reader reader = getReader(context, progressListener, "getChatMessages", params, parameterNames, parameterValues);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return new ChatMessageParser(context).parse(reader, progressListener);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Util.close(reader);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue