2020 */
2121
2222/*unittests: ExtensionManager*/
23+ /*global Phoenix*/
2324
2425define ( function ( require , exports , module ) {
2526
@@ -500,6 +501,7 @@ define(function (require, exports, module) {
500501 */
501502 ExtensionManagerView . prototype . _installUsingDialog = function ( id , _isUpdate ) {
502503 var entry = this . model . extensions [ id ] ;
504+ const self = this ;
503505 if ( entry && entry . registryInfo ) {
504506 const compatInfo = ExtensionManager . getCompatibilityInfo ( entry . registryInfo , brackets . metadata . apiVersion ) ,
505507 url = ExtensionManager . getExtensionURL ( id , compatInfo . compatibleVersion ) ,
@@ -510,10 +512,26 @@ define(function (require, exports, module) {
510512 // TODO: this should set .done on the returned promise
511513 if ( _isUpdate ) {
512514 // save to metric id as it is from public extension store.
513- Metrics . countEvent ( Metrics . EVENT_TYPE . EXTENSIONS , "install" , id ) ;
514- InstallExtensionDialog . updateUsingDialog ( url ) . done ( ExtensionManager . updateFromDownload ) ;
515- } else {
516515 Metrics . countEvent ( Metrics . EVENT_TYPE . EXTENSIONS , "update" , id ) ;
516+ InstallExtensionDialog . updateUsingDialog ( url ) . done ( ( installResult ) => {
517+ if ( Phoenix . browser . isTauri ) {
518+ // in tauri, due to browser cache for asset urls, updates to extensions will still load old
519+ // extension through the http cache. So we show a restart app for the update to take effect
520+ // message.
521+ entry . installInfo . metadata = entry . registryInfo . metadata ;
522+ self . model . _getEntry ( id ) . updateAvailable = false ;
523+ // this is a hack as we will drop this extnsion manager and move to new one. so this will do.
524+ self . model . trigger ( "change" , id ) ;
525+ Dialogs . showModalDialog (
526+ DefaultDialogs . DIALOG_ID_INFO ,
527+ Strings . EXTENSION_UPDATE_RESTART_TITLE ,
528+ Strings . EXTENSION_UPDATE_RESTART_MESSAGE
529+ ) ;
530+ }
531+ ExtensionManager . updateFromDownload ( installResult ) ;
532+ } ) ;
533+ } else {
534+ Metrics . countEvent ( Metrics . EVENT_TYPE . EXTENSIONS , "install" , id ) ;
517535 InstallExtensionDialog . installUsingDialog ( url ) ;
518536 }
519537 }
0 commit comments