From b6b0b233e233bb1b8002dbc67aab19cb24b02779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanislav=20Ochotnick=C3=BD?= Date: Sun, 6 Feb 2022 16:42:02 +0100 Subject: [PATCH] Generate proper UUID strings for new tasks Tasks app works fine with tasks created in other applications, pulled from CalDav etc. When new events are created, it generates a UUID that's not really a UUID form due to how UUIDHelper is written. This change simplifies the helper and just returns the UUID generated by java util. The code had comments suggesting the method was originally returning something else besides the UUID string itself and possibly for other use cases. The underlying reason for my case is that one piece of software I use (org-caldav) is arguably buggy and expecting actual UUID. However other software I've been using generates/uses UUID so I feel like this should be a compatible/easy change that only affects new items. --- .../java/com/todoroo/astrid/helper/UUIDHelper.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/todoroo/astrid/helper/UUIDHelper.java b/app/src/main/java/com/todoroo/astrid/helper/UUIDHelper.java index 2b5922f9b..abc4dd477 100644 --- a/app/src/main/java/com/todoroo/astrid/helper/UUIDHelper.java +++ b/app/src/main/java/com/todoroo/astrid/helper/UUIDHelper.java @@ -3,15 +3,8 @@ package com.todoroo.astrid.helper; import java.util.UUID; public class UUIDHelper { - - private static final long MIN_UUID = 100000000; - - /** @return a pair consisting of the newly generated uuid and the corresponding proof text */ + /** @return a newly generated uuid */ public static String newUUID() { - long uuid; - do { - uuid = UUID.randomUUID().getLeastSignificantBits() & 0x7fffffffffffffffL; - } while (uuid < MIN_UUID); - return Long.toString(uuid); + return UUID.randomUUID().toString(); } }