Skip to content

Add last opened timestamp display in 3-dots menu for deeplinks#160

Merged
yogeshpaliyal merged 7 commits intomasterfrom
copilot/log-deeplink-launch-time
Oct 9, 2025
Merged

Add last opened timestamp display in 3-dots menu for deeplinks#160
yogeshpaliyal merged 7 commits intomasterfrom
copilot/log-deeplink-launch-time

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 9, 2025

Overview

This PR adds functionality to track and display the full date and time when each deeplink was last opened, addressing the feature request in the related issue.

Changes

Database Schema

  • Created a new DeeprOpenLog table to maintain a complete history of when each deeplink is opened
  • Each log entry records the deeplink ID and timestamp when it was opened
  • Created migration script (3.sqm) to ensure backward compatibility for existing installations
  • The main Deepr table remains unchanged, keeping it clean and normalized

UI Enhancement

The 3-dots menu now displays an informational "Last Opened" entry showing when the deeplink was last used:

Before:

📋 Copy link
🔗 Add shortcut
📱 Show QR Code
✏️ Edit
🗑️ Delete

After:

📋 Copy link
ℹ️ Last Opened: Feb 27, 2025 2:30 PM  (new - shown in gray)
🔗 Add shortcut
📱 Show QR Code
✏️ Edit
🗑️ Delete

The timestamp entry:

  • Appears only after a link has been opened at least once
  • Is styled as disabled/informational (gray text, not clickable)
  • Uses locale-aware date formatting via the existing formatDateTime() utility
  • Updates automatically each time the link is opened

Internationalization

Added translations for "Last Opened: %s" in all 6 supported languages:

  • 🇬🇧 English: "Last Opened: %s"
  • 🇩🇪 German: "Zuletzt geöffnet: %s"
  • 🇪🇸 Spanish: "Último abierto: %s"
  • 🇫🇷 French: "Dernière ouverture : %s"
  • 🇮🇳 Hindi: "अंतिम बार खोला गया: %s"
  • 🇵🇰 Urdu: "آخری بار کھولا گیا: %s"

Technical Details

Architecture

The implementation uses a separate logging table for better data normalization and future extensibility:

CREATE TABLE DeeprOpenLog (
  id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
  deeplinkId INTEGER NOT NULL,
  openedAt TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
  FOREIGN KEY (deeplinkId) REFERENCES Deepr(id) ON DELETE CASCADE
);

When a deeplink is opened:

  1. incrementOpenedCount updates the counter in the Deepr table
  2. insertDeeprOpenLog creates a new log entry with the current timestamp

Queries use a subquery to efficiently fetch the most recent open time:

(SELECT openedAt FROM DeeprOpenLog WHERE deeplinkId = Deepr.id 
 ORDER BY openedAt DESC LIMIT 1) AS lastOpenedAt

Benefits of Separate Logging Table

  • Complete History: Maintains a full log of all opens, not just the last one
  • Future Analytics: Enables features like open frequency analysis, time pattern detection, etc.
  • Data Normalization: Keeps the main Deepr table clean and focused
  • Referential Integrity: CASCADE delete ensures log entries are cleaned up when deeplinks are deleted

User Experience

This feature complements the existing "Opened: X" counter by providing temporal context:

  • Opened count (main card): Shows how many times a link has been opened
  • Last Opened (3-dots menu): Shows when it was last opened

Together, these provide comprehensive usage tracking for each deeplink, helping users identify frequently used links and when they last accessed them.

Backward Compatibility

  • Existing deeplinks will not display a timestamp until they are opened for the first time after the update
  • The migration script ensures smooth upgrades from previous versions
  • No breaking changes to existing functionality

Fixes #116

Original prompt

This section details on the original issue you should resolve

<issue_title>Log full date and time of when a deeplink is launched in 3 dots menu</issue_title>
<issue_description>Could be useful</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #116

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits October 9, 2025 02:34
Co-authored-by: yogeshpaliyal <9381846+yogeshpaliyal@users.noreply.github.com>
Co-authored-by: yogeshpaliyal <9381846+yogeshpaliyal@users.noreply.github.com>
Copilot AI changed the title [WIP] Log full date and time of deeplink launch Add last opened timestamp display in 3-dots menu for deeplinks Oct 9, 2025
Copilot AI requested a review from yogeshpaliyal October 9, 2025 02:41
@yogeshpaliyal
Copy link
Copy Markdown
Owner

@copilot
Log to a different table, in that table keep when a deeplink is openeded

Co-authored-by: yogeshpaliyal <9381846+yogeshpaliyal@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 9, 2025

@copilot
Log to a different table, in that table keep when a deeplink is openeded

Done! I've refactored the implementation to use a separate DeeprOpenLog table as requested (commit 11f8db8).

Changes:

  • Created DeeprOpenLog table to log each deeplink open event with timestamp
  • Removed lastOpenedAt column from main Deepr table
  • Queries now use a subquery to fetch the most recent log entry
  • incrementOpenedCount now also inserts into the log table

Benefits of this approach:

  • Maintains complete history of all opens (not just the last one)
  • Enables future analytics features (frequency, patterns, etc.)
  • Keeps main table clean and normalized
  • Referential integrity with CASCADE delete

The UI remains unchanged and works seamlessly with the new architecture.

@yogeshpaliyal yogeshpaliyal marked this pull request as ready for review October 9, 2025 06:26
@yogeshpaliyal yogeshpaliyal merged commit 0bf14d1 into master Oct 9, 2025
1 check passed
@yogeshpaliyal yogeshpaliyal deleted the copilot/log-deeplink-launch-time branch October 9, 2025 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Log full date and time of when a deeplink is launched in 3 dots menu

2 participants