1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 14:47:29 +00:00

Fix Caption de-serialization

This commit is contained in:
Ammar Githam 2021-05-25 02:08:46 +09:00
parent 841c3bdbda
commit ce31554687
3 changed files with 7 additions and 4 deletions

View File

@ -2,6 +2,9 @@ package awais.instagrabber.repositories.responses
import java.io.Serializable import java.io.Serializable
data class Caption(val userId: Long, var text: String?) : Serializable { data class Caption(
var pk: Long = 0 val userId: Long = 0,
var text: String? = null,
) : Serializable {
var pk: String? = null
} }

View File

@ -30,7 +30,7 @@ public class CaptionDeserializer implements JsonDeserializer<Caption> {
pkString = pkString.substring(0, pkString.indexOf("_")); pkString = pkString.substring(0, pkString.indexOf("_"));
} }
try { try {
caption.setPk(Long.parseLong(pkString)); caption.setPk(pkString);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
Log.e(TAG, "deserialize: ", e); Log.e(TAG, "deserialize: ", e);
} }

View File

@ -272,7 +272,7 @@ public class PostViewV2ViewModel extends ViewModel {
data.postValue(Resource.loading(null)); data.postValue(Resource.loading(null));
final Caption value = caption.getValue(); final Caption value = caption.getValue();
if (value == null) return data; if (value == null) return data;
mediaService.translate(String.valueOf(value.getPk()), "1", new ServiceCallback<String>() { mediaService.translate(value.getPk(), "1", new ServiceCallback<String>() {
@Override @Override
public void onSuccess(final String result) { public void onSuccess(final String result) {
if (TextUtils.isEmpty(result)) { if (TextUtils.isEmpty(result)) {