ayoung19/clipboard-history

core: auto-delete by TTL setting

Opened this issue · 8 comments

Auto-delete old entries by giving entries an expiration or after the list hits a certain number of entries.

The easiest way is to remove entries by list length. But it is possible to do both and allow the user to switch between them and change the settings (max list length, number of minutes/hours/days). It depends on your goal and the complexity you want to add to the application.

Users are requesting the option to auto-delete both ways. Here is the inspiration (first two options):

image

Did you want to take this on?

Yes, I would like to work on it.

Ok I'm currently working on the popup side of this (UI that lets the user configure the settings). You can work on ingesting this setting and perform the behavior on entry creation. Does that sound good to you? Let's also start with just the max number of entries auto-delete setting:

import { z } from "zod";

// DO NOT REUSE DEPRECATED FIELDS.
export const defaultSettings = {
  totalItemsBadge: true,
  // theme: "light",
  themeV2: "system",
  localItemLimit: undefined,
};

export const Settings = z
  .object({
    totalItemsBadge: z.boolean().default(defaultSettings.totalItemsBadge),
    // theme: z.string().default(defaultSettings.theme),
    themeV2: z.string().default(defaultSettings.themeV2),
    localItemLimit: z.number().optional(),
  })
  .default(defaultSettings);
export type Settings = z.infer<typeof Settings>;

The new settings field will be localItemLimit with a type of number | undefined where undefined means it's off.

Also do you have a rough timeline on when you could do this by?

Ok, it is ok for me. The timeline depends on my free time. I am going to work on it this week.

No worries, I totally understand. Also very sorry but because this is a pretty highly requested feature and I'm going to have a lot less free time soon, I went ahead and finished the first type of auto-delete earlier tonight.

We still need the auto-delete by TTL version but that one's lower on the priority list so I can leave it to you to finish it whenever you have the time. Just give me a heads up when you begin working on it. Also, feel free to ping me for questions anytime.

Do you use Discord? I might make one to make it easier to discuss features.

No problem, I can work on auto-delete by TTL version.
I have a Discord account, so, we can contact there.