|
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. |
24 | 3 |
|
25 | | -/*global Phoenix*/ |
| 4 | +/*global*/ |
26 | 5 |
|
27 | 6 | define(function (require, exports, module) { |
28 | 7 |
|
29 | | - var PreferencesManager = brackets.getModule("preferences/PreferencesManager"), |
30 | | - ExtensionInterface = brackets.getModule("utils/ExtensionInterface"), |
| 8 | + const PreferencesManager = brackets.getModule("preferences/PreferencesManager"), |
31 | 9 | HealthDataPreview = require("HealthDataPreview"), |
32 | 10 | HealthDataPopup = require("HealthDataPopup"); |
33 | 11 |
|
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. |
40 | 16 |
|
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(); |
49 | 18 |
|
50 | 19 | function handleHealthDataStatistics() { |
51 | 20 | HealthDataPreview.previewHealthData(); |
52 | 21 | } |
53 | 22 |
|
54 | | - let popupShownInThisSession = false; |
55 | 23 | 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); |
63 | 24 | if(!window.testEnvironment){ |
64 | 25 | const alreadyShown = PreferencesManager.getViewState("healthDataNotificationShown"); |
65 | 26 | const prefs = PreferencesManager.getExtensionPrefs("healthData"); |
|
0 commit comments