Skip to content

Commit 81bc2d6

Browse files
committed
chore: show privacy notice early so it doesnt overlap with pro upgrade dialog after 10 secs
1 parent 173dc05 commit 81bc2d6

File tree

2 files changed

+12
-52
lines changed

2 files changed

+12
-52
lines changed

src/extensions/default/HealthData/HealthDataNotification.js

Lines changed: 9 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,26 @@
1-
/*
2-
* Copyright (c) 2021 - present core.ai . All rights reserved.
3-
* Original work Copyright (c) 2015 - 2021 Adobe Systems Incorporated. All rights reserved.
4-
*
5-
* Permission is hereby granted, free of charge, to any person obtaining a
6-
* copy of this software and associated documentation files (the "Software"),
7-
* to deal in the Software without restriction, including without limitation
8-
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
9-
* and/or sell copies of the Software, and to permit persons to whom the
10-
* Software is furnished to do so, subject to the following conditions:
11-
*
12-
* The above copyright notice and this permission notice shall be included in
13-
* all copies or substantial portions of the Software.
14-
*
15-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21-
* DEALINGS IN THE SOFTWARE.
22-
*
23-
*/
1+
// SPDX-License-Identifier: AGPL-3.0-only
2+
// Copyright (c) 2021 - present core.ai. All rights reserved.
243

25-
/*global Phoenix*/
4+
/*global*/
265

276
define(function (require, exports, module) {
287

29-
var PreferencesManager = brackets.getModule("preferences/PreferencesManager"),
30-
ExtensionInterface = brackets.getModule("utils/ExtensionInterface"),
8+
const PreferencesManager = brackets.getModule("preferences/PreferencesManager"),
319
HealthDataPreview = require("HealthDataPreview"),
3210
HealthDataPopup = require("HealthDataPopup");
3311

34-
const NEW_PROJECT_EXTENSION_INTERFACE = "Extn.Phoenix.newProject",
35-
// Since we don't have any user accounts or trackable ID to uniquely identify a user on first launch,
36-
// we should be ok GDPR wise to delay showing the health data popup. But it was found later to be annoying
37-
// and a workflow distraction. So we show the health data popup almost immediately so that the user can
38-
// close all the popups in on go.
39-
POPUP_FIRST_LAUNCH_SHOW_DELAY = 5000;
12+
// Since we don't have any user accounts or trackable ID to uniquely identify a user on first launch,
13+
// we should be ok GDPR wise to delay showing the health data popup. But it was found later to be annoying
14+
// and a workflow distraction. So we show the health data popup almost immediately so that the user can
15+
// close all the popups in on go.
4016

41-
let newProjectExtension;
42-
ExtensionInterface.waitAndGetExtensionInterface(NEW_PROJECT_EXTENSION_INTERFACE)
43-
.then(interfaceObj => {
44-
newProjectExtension = interfaceObj;
45-
interfaceObj.on(interfaceObj.EVENT_NEW_PROJECT_DIALOGUE_CLOSED, ()=>{
46-
setTimeout(_showFirstLaunchPopup, POPUP_FIRST_LAUNCH_SHOW_DELAY);
47-
});
48-
});
17+
_showFirstLaunchPopup();
4918

5019
function handleHealthDataStatistics() {
5120
HealthDataPreview.previewHealthData();
5221
}
5322

54-
let popupShownInThisSession = false;
5523
function _showFirstLaunchPopup() {
56-
// call this only after newProjectExtn interface is available
57-
// Check whether the notification dialog should be shown. It will be shown only one time.
58-
if(popupShownInThisSession){
59-
return;
60-
}
61-
popupShownInThisSession = true;
62-
newProjectExtension.off(newProjectExtension.EVENT_NEW_PROJECT_DIALOGUE_CLOSED, _showFirstLaunchPopup);
6324
if(!window.testEnvironment){
6425
const alreadyShown = PreferencesManager.getViewState("healthDataNotificationShown");
6526
const prefs = PreferencesManager.getExtensionPrefs("healthData");

src/services/promotions.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,9 @@ define(function (require, exports, module) {
371371
}
372372

373373
function _isAnyDialogsVisible() {
374-
const $modal = $(`.modal.instance`);
375-
const $notifications = $(`.notification-ui-tooltip`);
376-
return ($modal.length > 0 && $modal.is(':visible')) ||
377-
($notifications.length > 0 && $notifications.is(':visible'));
374+
const dialogsVisible = $(`.modal.instance`).is(':visible');
375+
const notificationsVisible = $(`.notification-ui-tooltip`).is(':visible');
376+
return dialogsVisible || notificationsVisible;
378377
}
379378

380379
/**

0 commit comments

Comments
 (0)