@@ -841,38 +841,30 @@ function uploadApp(app, options) {
841
841
if ( appJSON ) {
842
842
device . appsInstalled . push ( appJSON ) ;
843
843
}
844
- showToast ( formatAppName ( app ) + ' Uploaded!' , 'success' ) ;
844
+ showToast ( ` ${ Utils . formatAppName ( app ) } Uploaded!` , 'success' ) ;
845
845
} ) . catch ( err => {
846
- showToast ( " Upload of" + formatAppName ( app ) + " failed" , + err , 'error' ) ;
846
+ showToast ( ` Upload of ${ Utils . formatAppName ( app ) } failed` , + err , 'error' ) ;
847
847
} ) ;
848
848
} ) ) ;
849
849
}
850
- /** Format app name into a string like App Name (AppID)*/
851
- function formatAppName ( app ) {
852
- //check if id is the same as the name, in which case we can just return the name...
853
- if ( app . name . trim ( ) . toLowerCase ( ) === app . id . trim ( ) . toLowerCase ( ) ) {
854
- return app . name ;
855
- } else {
856
- return formatAppName ( app ) ;
857
- }
858
- }
850
+
859
851
/** Prompt user and then remove app from the device */
860
852
function removeApp ( app ) {
861
- return showPrompt ( "Delete" , " Are you sure you want to delete " + formatAppName ( app ) + "?" )
853
+ return showPrompt ( "Delete" , ` Are you sure you want to delete ${ Utils . formatAppName ( app ) } ?` )
862
854
. then ( ( ) => startOperation ( { name : "Remove App" } , ( ) => getInstalledApps ( )
863
855
. then ( ( ) => Comms . removeApp ( device . appsInstalled . find ( a => a . id === app . id ) ) ) // a = from appid.info, app = from apps.json
864
856
. then ( ( ) => {
865
857
device . appsInstalled = device . appsInstalled . filter ( a => a . id != app . id ) ;
866
- showToast ( formatAppName ( app ) + " removed successfully" , "success" ) ;
858
+ showToast ( ` ${ Utils . formatAppName ( app ) } removed successfully` , "success" ) ;
867
859
} , err => {
868
- showToast ( " Removal of " + formatAppName ( app ) + " failed, " + err , "error" ) ;
860
+ showToast ( ` Removal of ${ Utils . formatAppName ( app ) } failed, ${ err } ` , "error" ) ;
869
861
} ) ) ) ;
870
862
}
871
863
872
864
/** Show window for a new app and finally upload it */
873
865
function customApp ( app ) {
874
866
return handleCustomApp ( app ) . then ( ( ) => {
875
- showToast ( formatAppName ( ) + " Uploaded!" , "success" ) ;
867
+ showToast ( ` ${ Utils . formatAppName ( ) } Uploaded!` , "success" ) ;
876
868
refreshMyApps ( ) ;
877
869
refreshLibrary ( ) ;
878
870
} ) . catch ( err => {
@@ -960,13 +952,13 @@ function updateApp(app, options) {
960
952
remove . data = AppInfo . makeDataString ( data )
961
953
return Comms . removeApp ( remove , { containsFileList :true , noReset :options . noReset , noFinish :options . noFinish } ) ;
962
954
} ) . then ( ( ) => {
963
- showToast ( " Updating " + formatAppName ( app ) + " ..." ) ;
955
+ showToast ( ` Updating ${ Utils . formatAppName ( app ) } ...` ) ;
964
956
device . appsInstalled = device . appsInstalled . filter ( a => a . id != app . id ) ;
965
957
return checkDependencies ( app , { checkForClashes :false } ) ;
966
958
} ) . then ( ( ) => Comms . uploadApp ( app , { device :device , language :LANGUAGE , noReset :options . noReset , noFinish :options . noFinish } )
967
959
) . then ( ( appJSON ) => {
968
960
if ( appJSON ) device . appsInstalled . push ( appJSON ) ;
969
- showToast ( formatAppName ( app ) + " Updated!" , "success" ) ;
961
+ showToast ( ` ${ Utils . formatAppName ( app ) } Updated!` , "success" ) ;
970
962
} ) ) ;
971
963
}
972
964
0 commit comments