mirror of https://github.com/M66B/FairEmail.git
Map event time zones
This commit is contained in:
parent
c44dc96934
commit
aee3fc4f5d
|
@ -48,3 +48,4 @@ FairEmail uses:
|
|||
* [Send](https://github.com/timvisee/send). [Mozilla Public License 2.0](https://github.com/timvisee/send/blob/master/LICENSE).
|
||||
* [DetectHtml](https://github.com/dbennett455/DetectHtml). [The MIT License](https://github.com/dbennett455/DetectHtml/blob/master/LICENSE).
|
||||
* [Liberation Sans Narrow font](https://github.com/liberationfonts/liberation-sans-narrow). Copyright (C) 1989, 1991 Free Software Foundation, Inc. [GNU General Public License version 2 with exceptions](https://fedoraproject.org/wiki/Licensing/LiberationFontLicense).
|
||||
* [Evolution/MAPIProvider](https://github.com/GNOME/evolution-mapi/). Copyright (C) 1991, 1999 Free Software Foundation, Inc. [GNU Lesser General Public License, version 2.1](https://github.com/GNOME/evolution-mapi/blob/master/COPYING).
|
||||
|
|
|
@ -48,3 +48,4 @@ FairEmail uses:
|
|||
* [Send](https://github.com/timvisee/send). [Mozilla Public License 2.0](https://github.com/timvisee/send/blob/master/LICENSE).
|
||||
* [DetectHtml](https://github.com/dbennett455/DetectHtml). [The MIT License](https://github.com/dbennett455/DetectHtml/blob/master/LICENSE).
|
||||
* [Liberation Sans Narrow font](https://github.com/liberationfonts/liberation-sans-narrow). Copyright (C) 1989, 1991 Free Software Foundation, Inc. [GNU General Public License version 2 with exceptions](https://fedoraproject.org/wiki/Licensing/LiberationFontLicense).
|
||||
* [Evolution/MAPIProvider](https://github.com/GNOME/evolution-mapi/). Copyright (C) 1991, 1999 Free Software Foundation, Inc. [GNU Lesser General Public License, version 2.1](https://github.com/GNOME/evolution-mapi/blob/master/COPYING).
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
Dateline Standard Time~~~Pacific/Apia
|
||||
Samoa Standard Time~~~Pacific/Midway
|
||||
Hawaiian Standard Time~~~Pacific/Honolulu
|
||||
Alaskan Standard Time~~~America/Anchorage
|
||||
Pacific Standard Time~~~America/Los_Angeles
|
||||
Pacific Standard Time (Mexico)~~~America/Tijuana
|
||||
US Mountain Standard Time~~~America/Phoenix
|
||||
Mountain Standard Time (Mexico)~~~America/Mazatlan
|
||||
Mexico Standard Time 2~~~America/Chihuahua
|
||||
Mountain Standard Time~~~America/Denver
|
||||
Central America Standard Time~~~America/Costa_Rica
|
||||
Central Standard Time~~~America/Chicago
|
||||
Central Standard Time (Mexico)~~~America/Monterrey
|
||||
Mexico Standard Time~~~America/Mexico_City
|
||||
Canada Central Standard Time~~~America/Winnipeg
|
||||
SA Pacific Standard Time~~~America/Bogota
|
||||
Eastern Standard Time~~~America/New_York
|
||||
US Eastern Standard Time~~~America/Indiana/Indianapolis
|
||||
Venezuela Standard Time~~~America/Caracas
|
||||
Atlantic Standard Time~~~America/Halifax
|
||||
SA Western Standard Time~~~America/La_Paz
|
||||
Central Brazilian Standard Time~~~America/Manaus
|
||||
Pacific SA Standard Time~~~America/La_Paz
|
||||
Newfoundland Standard Time~~~America/St_Johns
|
||||
E. South America Standard Time~~~America/Bahia
|
||||
SA Eastern Standard Time~~~America/Argentina/Buenos_Aires
|
||||
Greenland Standard Time~~~America/Godthab
|
||||
Montevideo Standard Time~~~America/Montevideo
|
||||
Mid-Atlantic Standard Time~~~Atlantic/South_Georgia
|
||||
Azores Standard Time~~~Atlantic/Azores
|
||||
Cape Verde Standard Time~~~Atlantic/Cape_Verde
|
||||
Greenwich Standard Time~~~Africa/Casablanca
|
||||
GMT Standard Time~~~Europe/Dublin
|
||||
UTC~~~UTC
|
||||
W. Europe Standard Time~~~Europe/Berlin
|
||||
Central Europe Standard Time~~~Europe/Prague
|
||||
Romance Standard Time~~~Europe/Paris
|
||||
Central European Standard Time~~~Europe/Belgrade
|
||||
W. Central Africa Standard Time~~~Africa/Luanda
|
||||
Jordan Standard Time~~~Asia/Amman
|
||||
GTB Standard Time~~~Europe/Athens
|
||||
Middle East Standard Time~~~Asia/Beirut
|
||||
Egypt Standard Time~~~Africa/Cairo
|
||||
South Africa Standard Time~~~Africa/Harare
|
||||
FLE Standard Time~~~Europe/Helsinki
|
||||
Israel Standard Time~~~Asia/Jerusalem
|
||||
E. Europe Standard Time~~~Europe/Minsk
|
||||
Namibia Standard Time~~~Africa/Windhoek
|
||||
Arabic Standard Time~~~Asia/Baghdad
|
||||
Arab Standard Time~~~Asia/Qatar
|
||||
Russian Standard Time~~~Europe/Moscow
|
||||
E. Africa Standard Time~~~Africa/Nairobi
|
||||
Georgian Standard Time~~~Asia/Tbilisi
|
||||
Iran Standard Time~~~Asia/Tehran
|
||||
Arabian Standard Time~~~Asia/Muscat
|
||||
Azerbaijan Standard Time~~~Asia/Baku
|
||||
Caucasus Standard Time~~~Asia/Yerevan
|
||||
Armenian Standard Time~~~Asia/Yerevan
|
||||
Afghanistan Standard Time~~~Asia/Kabul
|
||||
Ekaterinburg Standard Time~~~Asia/Yekaterinburg
|
||||
West Asia Standard Time~~~Asia/Karachi
|
||||
India Standard Time~~~Asia/Kolkata
|
||||
Sri Lanka Standard Time~~~Asia/Colombo
|
||||
Nepal Standard Time~~~Asia/Kathmandu
|
||||
N. Central Asia Standard Time~~~Asia/Novosibirsk
|
||||
Central Asia Standard Time~~~Asia/Dhaka
|
||||
Myanmar Standard Time~~~Asia/Rangoon
|
||||
SE Asia Standard Time~~~Asia/Bangkok
|
||||
North Asia Standard Time~~~Asia/Krasnoyarsk
|
||||
China Standard Time~~~Asia/Shanghai
|
||||
North Asia East Standard Time~~~Asia/Ulaanbaatar
|
||||
Singapore Standard Time~~~Asia/Singapore
|
||||
W. Australia Standard Time~~~Australia/Perth
|
||||
Taipei Standard Time~~~Asia/Taipei
|
||||
Tokyo Standard Time~~~Asia/Tokyo
|
||||
Korea Standard Time~~~Asia/Seoul
|
||||
Yakutsk Standard Time~~~Asia/Yakutsk
|
||||
Cen. Australia Standard Time~~~Australia/Adelaide
|
||||
AUS Central Standard Time~~~Australia/Darwin
|
||||
E. Australia Standard Time~~~Australia/Brisbane
|
||||
AUS Eastern Standard Time~~~Australia/Sydney
|
||||
West Pacific Standard Time~~~Pacific/Guam
|
||||
Tasmania Standard Time~~~Australia/Hobart
|
||||
Vladivostok Standard Time~~~Asia/Vladivostok
|
||||
Central Pacific Standard Time~~~Asia/Magadan
|
||||
New Zealand Standard Time~~~Pacific/Auckland
|
||||
Fiji Standard Time~~~Pacific/Fiji
|
||||
Tonga Standard Time~~~Pacific/Tongatapu
|
|
@ -33,6 +33,9 @@ import androidx.preference.PreferenceManager;
|
|||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
@ -129,44 +132,6 @@ public class CalendarHelper {
|
|||
}
|
||||
}
|
||||
|
||||
if (false) {
|
||||
// BEGIN:VCALENDAR
|
||||
// METHOD:REQUEST
|
||||
// PRODID:Microsoft Exchange Server 2010
|
||||
// VERSION:2.0
|
||||
// BEGIN:VTIMEZONE
|
||||
// TZID:W. Europe Standard Time
|
||||
// BEGIN:STANDARD
|
||||
// DTSTART:16010101T030000
|
||||
// TZOFFSETFROM:+0200
|
||||
// TZOFFSETTO:+0100
|
||||
// RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
|
||||
// END:STANDARD
|
||||
// BEGIN:DAYLIGHT
|
||||
// DTSTART:16010101T020000
|
||||
// TZOFFSETFROM:+0100
|
||||
// TZOFFSETTO:+0200
|
||||
// RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
|
||||
// END:DAYLIGHT
|
||||
// END:VTIMEZONE
|
||||
// BEGIN:VEVENT
|
||||
// UID:...
|
||||
// DTSTART;TZID=W. Europe Standard Time:20231030T100000
|
||||
// DTEND;TZID=W. Europe Standard Time:20231030T110000
|
||||
// ...
|
||||
for (TimezoneAssignment assignment : icalendar.getTimezoneInfo().getTimezones()) {
|
||||
for (List<ICalComponent> components : assignment.getComponent().getComponents().getMap().values())
|
||||
for (ICalComponent component : components) {
|
||||
RecurrenceRule recurrence = component.getProperty(RecurrenceRule.class);
|
||||
if (recurrence != null) {
|
||||
RecurrenceRuleScribe scribe = new RecurrenceRuleScribe();
|
||||
WriteContext wcontext = new WriteContext(ICalVersion.V2_0, icalendar.getTimezoneInfo(), null);
|
||||
String rrule = scribe.writeText(recurrence, wcontext);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String organizer = (event.getOrganizer() == null ? null : event.getOrganizer().getEmail());
|
||||
|
||||
String summary = (event.getSummary() == null ? null : event.getSummary().getValue());
|
||||
|
@ -180,9 +145,25 @@ public class CalendarHelper {
|
|||
TimezoneInfo tzinfo = icalendar.getTimezoneInfo();
|
||||
TimezoneAssignment tza = (tzinfo == null ? null : tzinfo.getTimezone(event.getDateStart()));
|
||||
TimeZone tz = (tza == null ? null : tza.getTimeZone());
|
||||
//if (tz != null && "W. Europe Standard Time".equals(tz.getID()))
|
||||
// tz.setID("GMT");
|
||||
String tzid = (tz == null ? TimeZone.getDefault().getID() : tz.getID());
|
||||
String tzid = (tz == null ? null : tz.getID());
|
||||
if (tzid == null)
|
||||
tzid = TimeZone.getDefault().getID();
|
||||
else {
|
||||
// https://github.com/GNOME/evolution-mapi/blob/master/src/libexchangemapi/tz-mapi-to-ical
|
||||
try (InputStream is = context.getAssets().open("tz-mapi-to-ical.txt")) {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader((is)));
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
String[] info = line.split("~~~");
|
||||
if (info.length == 2 && info[0].equalsIgnoreCase(tzid)) {
|
||||
EntityLog.log(context, "Event map " + tzid + " to " + info[1]);
|
||||
tz.setID(info[1]);
|
||||
}
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
|
||||
String rrule = null;
|
||||
RecurrenceRule recurrence = event.getRecurrenceRule();
|
||||
|
|
Loading…
Reference in New Issue