mirror of
https://github.com/etesync/android
synced 2024-12-23 15:18:14 +00:00
Use UUIDs for newly generated event/task UIDs (RFC 7986 5.3 UID Property)
This commit is contained in:
parent
f819dbf33f
commit
643e2b23ea
@ -49,8 +49,6 @@ import com.etesync.syncadapter.resource.LocalCalendar;
|
|||||||
import com.etesync.syncadapter.ui.AccountsActivity;
|
import com.etesync.syncadapter.ui.AccountsActivity;
|
||||||
import com.etesync.syncadapter.utils.HintManager;
|
import com.etesync.syncadapter.utils.HintManager;
|
||||||
|
|
||||||
import net.fortuna.ical4j.util.UidGenerator;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -100,9 +98,6 @@ public class App extends Application {
|
|||||||
@Getter
|
@Getter
|
||||||
private static HostnameVerifier hostnameVerifier;
|
private static HostnameVerifier hostnameVerifier;
|
||||||
|
|
||||||
@Getter
|
|
||||||
private static UidGenerator uidGenerator;
|
|
||||||
|
|
||||||
public final static Logger log = Logger.getLogger("syncadapter");
|
public final static Logger log = Logger.getLogger("syncadapter");
|
||||||
static {
|
static {
|
||||||
at.bitfire.cert4android.Constants.log = Logger.getLogger("syncadapter.cert4android");
|
at.bitfire.cert4android.Constants.log = Logger.getLogger("syncadapter.cert4android");
|
||||||
@ -124,8 +119,6 @@ public class App extends Application {
|
|||||||
StrictMode.enableDefaults();
|
StrictMode.enableDefaults();
|
||||||
initPrefVersion();
|
initPrefVersion();
|
||||||
|
|
||||||
uidGenerator = new UidGenerator(null, android.provider.Settings.Secure.getString(getContentResolver(), android.provider.Settings.Secure.ANDROID_ID));
|
|
||||||
|
|
||||||
appName = getString(R.string.app_name);
|
appName = getString(R.string.app_name);
|
||||||
accountType = getString(R.string.account_type);
|
accountType = getString(R.string.account_type);
|
||||||
addressBookAccountType = getString(R.string.account_type_address_book);
|
addressBookAccountType = getString(R.string.account_type_address_book);
|
||||||
|
@ -27,6 +27,7 @@ import net.fortuna.ical4j.model.property.ProdId;
|
|||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import at.bitfire.ical4android.AndroidCalendar;
|
import at.bitfire.ical4android.AndroidCalendar;
|
||||||
@ -150,7 +151,7 @@ public class LocalEvent extends AndroidEvent implements LocalResource {
|
|||||||
if (c.moveToNext())
|
if (c.moveToNext())
|
||||||
uid = c.getString(0);
|
uid = c.getString(0);
|
||||||
if (uid == null)
|
if (uid == null)
|
||||||
uid = App.getUidGenerator().generateUid().getValue();
|
uid = UUID.randomUUID().toString();
|
||||||
|
|
||||||
final String newFileName = uid;
|
final String newFileName = uid;
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ import org.dmfs.provider.tasks.TaskContract.Tasks;
|
|||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import at.bitfire.ical4android.AndroidTask;
|
import at.bitfire.ical4android.AndroidTask;
|
||||||
import at.bitfire.ical4android.AndroidTaskFactory;
|
import at.bitfire.ical4android.AndroidTaskFactory;
|
||||||
@ -100,7 +101,7 @@ public class LocalTask extends AndroidTask implements LocalResource {
|
|||||||
|
|
||||||
public void prepareForUpload() throws CalendarStorageException {
|
public void prepareForUpload() throws CalendarStorageException {
|
||||||
try {
|
try {
|
||||||
final String uid = App.getUidGenerator().generateUid().getValue();
|
final String uid = UUID.randomUUID().toString();
|
||||||
final String newFileName = uid + ".ics";
|
final String newFileName = uid + ".ics";
|
||||||
|
|
||||||
ContentValues values = new ContentValues(2);
|
ContentValues values = new ContentValues(2);
|
||||||
|
Loading…
Reference in New Issue
Block a user