Updated on 2026-08-14
This commit is contained in:
parent
8f77a7ab99
commit
cd6da4efe7
8 changed files with 56 additions and 46 deletions
|
|
@ -25,9 +25,9 @@ import java.io.OutputStreamWriter;
|
|||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
|
|
@ -297,14 +297,14 @@ public class ServerApiHelper {
|
|||
private ArtworkListener artworkListener;
|
||||
|
||||
public interface ArtworkListener {
|
||||
void onArtwork(String artworkId, InputStream inputStream, Instant updateDate);
|
||||
void onArtwork(String artworkId, InputStream inputStream, Date updateDate);
|
||||
}
|
||||
|
||||
public void setArtworkListener(ArtworkListener listener) {
|
||||
artworkListener = listener;
|
||||
}
|
||||
|
||||
public void requestArtwork(String artworkId, Instant updateDate, TangemCard card) {
|
||||
public void requestArtwork(String artworkId, Date updateDate, TangemCard card) {
|
||||
|
||||
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
|
||||
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
|
||||
|
|
@ -548,9 +548,9 @@ public class ServerApiHelper {
|
|||
if (response.code() == 200) {
|
||||
String stringResponse;
|
||||
try {
|
||||
stringResponse = response.body().string();
|
||||
stringResponse = response.body() != null ? response.body().string() : null;
|
||||
lastVersionListener.onLastVersion(stringResponse);
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
package com.tangem.data.network.model
|
||||
|
||||
import android.os.Build
|
||||
import java.text.SimpleDateFormat
|
||||
import java.time.Instant
|
||||
import java.time.LocalDateTime
|
||||
import java.time.ZoneOffset
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.util.*
|
||||
|
||||
class CardVerifyAndGetInfo {
|
||||
|
|
@ -38,16 +33,12 @@ class CardVerifyAndGetInfo {
|
|||
var hash: String = "",
|
||||
var date: String = ""
|
||||
) {
|
||||
fun getUpdateDate(): Instant? {
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
return LocalDateTime.parse(date, DateTimeFormatter.ISO_LOCAL_DATE_TIME).toInstant(ZoneOffset.UTC)
|
||||
} else {
|
||||
return SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US).parse(date).toInstant()
|
||||
}
|
||||
fun getUpdateDate(): Date? {
|
||||
return try {
|
||||
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US).parse(date)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
return null
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue