CalDAV now goes through Minamp's own HTTP/TLS client (Bouncy Castle TLS 1.2, Mozilla roots, keep-alive) instead of Apache HttpClient on Android 2.3's TLS 1.0, as the iPod version does with BearSSL. The phone reaches the normal https:// Nextcloud address at home and away; a pinned self-signed server or the old bridge still works. - NetHttp transport; requests run on big-stack threads (the handshake overflows AsyncTask/IntentService stacks on Android 2.x) - http:// -> https:// redirects on the same host are followed; other hosts still refused - bridge wording replaced in Galician and English; README updated - NetTest (TLS + CalDAV discovery through the new transport) replaces BridgeTest Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
56 lines
2.4 KiB
Java
56 lines
2.4 KiB
Java
package org.gingercal;
|
|
|
|
import java.util.Calendar;
|
|
import java.util.TimeZone;
|
|
|
|
/** Galician output: date names, month titles, first weekday, formatted and server messages. */
|
|
public class I18nTest {
|
|
static int fails;
|
|
|
|
static void check(String got, String want) {
|
|
boolean ok = got.equals(want);
|
|
System.out.println((ok ? " ok " : " FAIL ") + got + (ok ? "" : " (want: " + want + ")"));
|
|
if (!ok) fails++;
|
|
}
|
|
|
|
public static void main(String[] a) throws Exception {
|
|
TimeZone.setDefault(TimeZone.getTimeZone("Europe/Madrid"));
|
|
Calendar c = Calendar.getInstance();
|
|
c.clear();
|
|
c.set(2026, Calendar.OCTOBER, 15, 9, 30);
|
|
long t = c.getTimeInMillis();
|
|
|
|
L.gl = true;
|
|
check(L.df("EEE d MMM").format(c.getTime()), "xov 15 out");
|
|
check(L.df("EEEE d 'de' MMMM").format(c.getTime()), "xoves 15 de outubro");
|
|
check(L.monthTitle(t), "Outubro de 2026");
|
|
c.set(Calendar.MONTH, Calendar.JUNE);
|
|
check(L.monthTitle(c.getTimeInMillis()), "Xuño de 2026");
|
|
check(String.valueOf(L.firstDayOfWeek() == Calendar.MONDAY), "true");
|
|
check(L.f("Today · %s", "xov 15 out"), "Hoxe · xov 15 out");
|
|
check(L.f("%d min before", 15), "15 min antes");
|
|
check(L.f("Every %d hours", 3), "Cada 3 horas");
|
|
Syncer.Result r = new Syncer.Result();
|
|
r.calendars = 2;
|
|
r.fetched = 1;
|
|
r.events = 7;
|
|
r.skipped = 1;
|
|
check(r.summary(), "Calendarios: 2, actualizados: 1 (eventos: 7), sen cambios: 1");
|
|
check(new DavException.UntrustedCert("AA", "s", "i", "e", false).getMessage(),
|
|
"Este teléfono non confía no certificado do servidor");
|
|
try {
|
|
Dav.checkRedirect("http://192.168.1.20/remote.php/dav/", "https://nxc.anosanube.ovh/remote.php/dav/",
|
|
new java.util.ArrayList<String>(), 301);
|
|
} catch (DavException e) {
|
|
check(e.getMessage().substring(0, 44), "O servidor redirixiu a https://nxc.anosanube");
|
|
}
|
|
check(L.t("not in the table"), "not in the table"); // unknown text falls back to English
|
|
|
|
L.gl = false;
|
|
check(L.monthTitle(t), "October 2026");
|
|
check(r.summary(), "2 calendars: 1 refreshed (7 events), 1 unchanged");
|
|
System.out.println(fails == 0 ? "ALL PASSED" : fails + " FAILED");
|
|
System.exit(fails == 0 ? 0 : 1);
|
|
}
|
|
}
|