@@ -54,11 +54,19 @@ define(function (require, exports, module) {
5454 UrlParams = require ( "utils/UrlParams" ) . UrlParams ,
5555 NodeUtils = require ( "utils/NodeUtils" ) ,
5656 PathUtils = require ( "thirdparty/path-utils/path-utils" ) ,
57- DefaultExtensions = JSON . parse ( require ( "text!extensions/default/DefaultExtensions.json" ) ) ;
57+ DefaultExtensions = JSON . parse ( require ( "text!extensions/default/DefaultExtensions.json" ) ) ,
58+ Dialogs = require ( "widgets/Dialogs" ) ,
59+ PreferencesManager = require ( "preferences/PreferencesManager" ) ,
60+ Mustache = require ( "thirdparty/mustache/mustache" ) ,
61+ Strings = require ( "strings" ) ,
62+ DeprecatedExtensionsTemplate = require ( "text!htmlContent/deprecated-extensions-dialog.html" ) ;
5863
5964 // takedown/dont load extensions that are compromised at app start - start
6065 const EXTENSION_TAKEDOWN_LOCALSTORAGE_KEY = "PH_EXTENSION_TAKEDOWN_LIST" ;
6166
67+ // deprecated extensions dialog state key
68+ const STATE_DEPRECATED_EXTENSIONS_DIALOG_SHOWN = "deprecatedExtensionsDialogShown" ;
69+
6270 function _getTakedownListLS ( ) {
6371 try {
6472 let list = localStorage . getItem ( EXTENSION_TAKEDOWN_LOCALSTORAGE_KEY ) ;
@@ -1018,6 +1026,8 @@ define(function (require, exports, module) {
10181026
10191027 promise . always ( function ( ) {
10201028 _init = true ;
1029+ // Check for deprecated extensions after all extensions have loaded
1030+ _checkAndShowDeprecatedExtensionsDialog ( ) ;
10211031 } ) ;
10221032
10231033 return promise ;
@@ -1032,6 +1042,55 @@ define(function (require, exports, module) {
10321042 return takedownExtensionList . has ( extensionID ) ;
10331043 }
10341044
1045+ /**
1046+ * Check if any deprecated extensions are installed and show a dialog once
1047+ * @private
1048+ */
1049+ function _checkAndShowDeprecatedExtensionsDialog ( ) {
1050+ // Check if we've already shown the dialog
1051+ const dialogShown = PreferencesManager . stateManager . get ( STATE_DEPRECATED_EXTENSIONS_DIALOG_SHOWN ) ;
1052+ if ( dialogShown ) {
1053+ return ;
1054+ }
1055+
1056+ // Get deprecated extensions config
1057+ const deprecatedExtensionsConfig = DefaultExtensions . deprecatedExtensions ;
1058+ if ( ! deprecatedExtensionsConfig || ! deprecatedExtensionsConfig . extensionIDsAndDocs ) {
1059+ return ;
1060+ }
1061+
1062+ const deprecatedExtensionIDs = deprecatedExtensionsConfig . extensionIDsAndDocs ;
1063+
1064+ // Check which deprecated extensions are loaded
1065+ const deprecatedExtensionsFound = [ ] ;
1066+ for ( const extensionID of loadedExtensionIDs ) {
1067+ if ( deprecatedExtensionIDs [ extensionID ] ) {
1068+ deprecatedExtensionsFound . push ( {
1069+ id : extensionID ,
1070+ docUrl : deprecatedExtensionIDs [ extensionID ]
1071+ } ) ;
1072+ }
1073+ }
1074+
1075+ // If no deprecated extensions found, mark dialog as shown and return
1076+ if ( deprecatedExtensionsFound . length === 0 ) {
1077+ PreferencesManager . stateManager . set ( STATE_DEPRECATED_EXTENSIONS_DIALOG_SHOWN , true ) ;
1078+ return ;
1079+ }
1080+
1081+ // Show the dialog
1082+ const templateVars = {
1083+ extensions : deprecatedExtensionsFound ,
1084+ Strings : Strings
1085+ } ;
1086+
1087+ const $template = $ ( Mustache . render ( DeprecatedExtensionsTemplate , templateVars ) ) ;
1088+ Dialogs . showModalDialogUsingTemplate ( $template ) ;
1089+
1090+ // Mark dialog as shown
1091+ PreferencesManager . stateManager . set ( STATE_DEPRECATED_EXTENSIONS_DIALOG_SHOWN , true ) ;
1092+ }
1093+
10351094
10361095 EventDispatcher . makeEventDispatcher ( exports ) ;
10371096
0 commit comments