From 9cffca135b8e59017033d25a71d40f04c6dd95a6 Mon Sep 17 00:00:00 2001 From: DatDang Date: Tue, 27 Feb 2024 10:03:42 +0700 Subject: [PATCH] TF-2628 Create ADR describing open PDF attachment logic --- ...ogic-for-opening-pdf-in-new-browser-tab.md | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 docs/adr/0039-logic-for-opening-pdf-in-new-browser-tab.md diff --git a/docs/adr/0039-logic-for-opening-pdf-in-new-browser-tab.md b/docs/adr/0039-logic-for-opening-pdf-in-new-browser-tab.md new file mode 100644 index 000000000..a551371d9 --- /dev/null +++ b/docs/adr/0039-logic-for-opening-pdf-in-new-browser-tab.md @@ -0,0 +1,31 @@ +# 39. Logic for displaying PDF in new browser tab + +Date: 2024-02-23 + +## Status + +Accepted + +## Context + +- When user tap PDF attachment inside email web, the attachment should be automatically opened in new tab +- The attachment button in web at the moment can be tapped on itself, and also at the download icon inside it +- The behavior when tapping either of those places are the same + +## Decision + +Separate the business logic of both tappable places: + +1. When download icon is tapped + +- Create download anchor and click on it programmatically, triggering the download action of the browser +- After the browser download the file, browser will handle the file by its own settings & policies + +2. When anywhere else inside the attachment button is tapped + +- If attachment is PDF, trigger window.open from html.dart with `_blank` parameter so that the file is opened in new tab +- If attachment is not PDF, treat the action as if the download icon is tapped as case 1 + +## Consequences + +- Different behaviors will be triggered depends on where user taps inside the attachment button on Twake Mail web