Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9773c1353 | ||
|
|
5bd1a2737d |
@@ -8,8 +8,8 @@ android {
|
|||||||
applicationId "com.streamplayer"
|
applicationId "com.streamplayer"
|
||||||
minSdk 21
|
minSdk 21
|
||||||
targetSdk 33
|
targetSdk 33
|
||||||
versionCode 100400
|
versionCode 100600
|
||||||
versionName "10.0.4"
|
versionName "10.0.6"
|
||||||
buildConfigField "String", "DEVICE_REGISTRY_URL", '"http://194.163.191.200:4000"'
|
buildConfigField "String", "DEVICE_REGISTRY_URL", '"http://194.163.191.200:4000"'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -127,6 +127,8 @@ public class EventRepository {
|
|||||||
|
|
||||||
JSONArray array = new JSONArray(json);
|
JSONArray array = new JSONArray(json);
|
||||||
List<EventItem> events = new ArrayList<>();
|
List<EventItem> events = new ArrayList<>();
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm");
|
||||||
|
|
||||||
for (int i = 0; i < array.length(); i++) {
|
for (int i = 0; i < array.length(); i++) {
|
||||||
JSONObject obj = array.getJSONObject(i);
|
JSONObject obj = array.getJSONObject(i);
|
||||||
String title = obj.optString("title");
|
String title = obj.optString("title");
|
||||||
@@ -135,8 +137,20 @@ public class EventRepository {
|
|||||||
String status = obj.optString("status");
|
String status = obj.optString("status");
|
||||||
String link = obj.optString("link");
|
String link = obj.optString("link");
|
||||||
String normalized = normalizeLink(link);
|
String normalized = normalizeLink(link);
|
||||||
|
|
||||||
|
// Ajustar hora: la web muestra hora de España, Argentina es +2 horas
|
||||||
|
String displayTime = time;
|
||||||
|
try {
|
||||||
|
if (time != null && !time.isEmpty()) {
|
||||||
|
LocalTime localTime = LocalTime.parse(time.trim(), formatter);
|
||||||
|
LocalTime adjustedTime = localTime.plusHours(2);
|
||||||
|
displayTime = adjustedTime.format(formatter);
|
||||||
|
}
|
||||||
|
} catch (DateTimeParseException ignored) {
|
||||||
|
}
|
||||||
|
|
||||||
long startMillis = parseEventTime(time);
|
long startMillis = parseEventTime(time);
|
||||||
events.add(new EventItem(title, time, category, status, normalized, extractChannelName(link), startMillis));
|
events.add(new EventItem(title, displayTime, category, status, normalized, extractChannelName(link), startMillis));
|
||||||
}
|
}
|
||||||
return Collections.unmodifiableList(events);
|
return Collections.unmodifiableList(events);
|
||||||
}
|
}
|
||||||
@@ -167,9 +181,11 @@ public class EventRepository {
|
|||||||
try {
|
try {
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm");
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm");
|
||||||
LocalTime localTime = LocalTime.parse(time.trim(), formatter);
|
LocalTime localTime = LocalTime.parse(time.trim(), formatter);
|
||||||
|
// Ajustar hora: la web muestra hora de España, Argentina es +2 horas
|
||||||
|
LocalTime adjustedTime = localTime.plusHours(2);
|
||||||
ZoneId zone = ZoneId.of("America/Argentina/Buenos_Aires");
|
ZoneId zone = ZoneId.of("America/Argentina/Buenos_Aires");
|
||||||
LocalDate today = LocalDate.now(zone);
|
LocalDate today = LocalDate.now(zone);
|
||||||
ZonedDateTime start = ZonedDateTime.of(LocalDateTime.of(today, localTime), zone);
|
ZonedDateTime start = ZonedDateTime.of(LocalDateTime.of(today, adjustedTime), zone);
|
||||||
ZonedDateTime now = ZonedDateTime.now(zone);
|
ZonedDateTime now = ZonedDateTime.now(zone);
|
||||||
if (start.isBefore(now.minusHours(12))) {
|
if (start.isBefore(now.minusHours(12))) {
|
||||||
start = start.plusDays(1);
|
start = start.plusDays(1);
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public class UpdateManager {
|
|||||||
private static final String TAG = "UpdateManager";
|
private static final String TAG = "UpdateManager";
|
||||||
private static final String LATEST_RELEASE_URL =
|
private static final String LATEST_RELEASE_URL =
|
||||||
"https://gitea.cbcren.online/api/v1/repos/renato97/app/releases/latest";
|
"https://gitea.cbcren.online/api/v1/repos/renato97/app/releases/latest";
|
||||||
|
private static final String GITEA_TOKEN = "4b94b3610136529861af0821040a801906821a0f";
|
||||||
|
|
||||||
private final Context appContext;
|
private final Context appContext;
|
||||||
private final Handler mainHandler;
|
private final Handler mainHandler;
|
||||||
@@ -74,6 +75,7 @@ public class UpdateManager {
|
|||||||
try {
|
try {
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(LATEST_RELEASE_URL)
|
.url(LATEST_RELEASE_URL)
|
||||||
|
.header("Authorization", "token " + GITEA_TOKEN)
|
||||||
.get()
|
.get()
|
||||||
.build();
|
.build();
|
||||||
try (Response response = httpClient.newCall(request).execute()) {
|
try (Response response = httpClient.newCall(request).execute()) {
|
||||||
@@ -247,7 +249,11 @@ public class UpdateManager {
|
|||||||
if (TextUtils.isEmpty(url)) {
|
if (TextUtils.isEmpty(url)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Request request = new Request.Builder().url(url).get().build();
|
Request request = new Request.Builder()
|
||||||
|
.url(url)
|
||||||
|
.header("Authorization", "token " + GITEA_TOKEN)
|
||||||
|
.get()
|
||||||
|
.build();
|
||||||
try (Response response = httpClient.newCall(request).execute()) {
|
try (Response response = httpClient.newCall(request).execute()) {
|
||||||
if (!response.isSuccessful() || response.body() == null) {
|
if (!response.isSuccessful() || response.body() == null) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user