From 4f790da515c794f2de684cae569a588e6d747abd Mon Sep 17 00:00:00 2001 From: Todor Totev Date: Mon, 11 Jan 2016 17:56:51 +0200 Subject: [PATCH] Fast livesync for images in app folder --- lib/definitions/platform.d.ts | 1 + lib/services/android-project-service.ts | 3 ++- lib/services/ios-project-service.ts | 3 ++- lib/services/usb-livesync-service.ts | 2 +- test/platform-commands.ts | 3 +-- test/stubs.ts | 6 ++++-- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/definitions/platform.d.ts b/lib/definitions/platform.d.ts index 7f46dcbdab..62ccdf5933 100644 --- a/lib/definitions/platform.d.ts +++ b/lib/definitions/platform.d.ts @@ -40,6 +40,7 @@ interface IPlatformData { configurationFilePath?: string; relativeToFrameworkConfigurationFilePath: string; mergeXmlConfig?: any[]; + fastLivesyncFileExtensions: string[]; } interface IPlatformsData { diff --git a/lib/services/android-project-service.ts b/lib/services/android-project-service.ts index 75e5e5af46..a4f9d30f2c 100644 --- a/lib/services/android-project-service.ts +++ b/lib/services/android-project-service.ts @@ -56,7 +56,8 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject configurationFileName: "AndroidManifest.xml", configurationFilePath: path.join(projectRoot, "src", "main", "AndroidManifest.xml"), relativeToFrameworkConfigurationFilePath: path.join("src", "main", "AndroidManifest.xml"), - mergeXmlConfig: [{ "nodename": "manifest", "attrname": "*" }, {"nodename": "application", "attrname": "*"}] + mergeXmlConfig: [{ "nodename": "manifest", "attrname": "*" }, {"nodename": "application", "attrname": "*"}], + fastLivesyncFileExtensions: [".jpg", ".gif", ".png", ".bmp", ".webp"] // http://developer.android.com/guide/appendix/media-formats.html }; } diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index 24bcaa6beb..1142915749 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -64,7 +64,8 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ configurationFileName: "Info.plist", configurationFilePath: path.join(projectRoot, this.$projectData.projectName, this.$projectData.projectName+"-Info.plist"), relativeToFrameworkConfigurationFilePath: path.join("__PROJECT_NAME__", "__PROJECT_NAME__-Info.plist"), - mergeXmlConfig: [{ "nodename": "plist", "attrname": "*" }, {"nodename": "dict", "attrname": "*"}] + mergeXmlConfig: [{ "nodename": "plist", "attrname": "*" }, {"nodename": "dict", "attrname": "*"}], + fastLivesyncFileExtensions: [".tiff", ".tif", ".jpg", "jpeg", "gif", ".png", ".bmp", ".BMPf", ".ico", ".cur", ".xbm"] // https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImage_Class/ }; } diff --git a/lib/services/usb-livesync-service.ts b/lib/services/usb-livesync-service.ts index 3a5f0e18fb..27ea6f4e66 100644 --- a/lib/services/usb-livesync-service.ts +++ b/lib/services/usb-livesync-service.ts @@ -120,7 +120,7 @@ export class UsbLiveSyncService extends usbLivesyncServiceBaseLib.UsbLiveSyncSer let localProjectRootPath = platform.toLowerCase() === "ios" ? platformData.appDestinationDirectoryPath : null; - let fastLivesyncFileExtensions = [".css", ".xml"]; + let fastLivesyncFileExtensions = [".css", ".xml"].concat(platformData.fastLivesyncFileExtensions); let fastLiveSync = (filePath: string) => { this.$dispatcher.dispatch(() => { diff --git a/test/platform-commands.ts b/test/platform-commands.ts index f4d1255cfd..9b33c4d360 100644 --- a/test/platform-commands.ts +++ b/test/platform-commands.ts @@ -25,10 +25,9 @@ class PlatformData implements IPlatformData { deviceBuildOutputPath = ""; validPackageNamesForDevice: string[] = []; frameworkFilesExtensions = [".jar", ".dat"]; - frameworkVersion = ""; appDestinationDirectoryPath = ""; - appResourcesDestinationDirectoryPath = ""; relativeToFrameworkConfigurationFilePath = ""; + fastLivesyncFileExtensions: string[] = []; } class ErrorsNoFailStub implements IErrors { diff --git a/test/stubs.ts b/test/stubs.ts index be34db8dde..07f33d17fa 100644 --- a/test/stubs.ts +++ b/test/stubs.ts @@ -268,7 +268,8 @@ export class PlatformsDataStub implements IPlatformsData { deviceBuildOutputPath: "", validPackageNamesForDevice: [], frameworkFilesExtensions: [], - relativeToFrameworkConfigurationFilePath: "" + relativeToFrameworkConfigurationFilePath: "", + fastLivesyncFileExtensions: [] }; } @@ -289,7 +290,8 @@ export class PlatformProjectServiceStub implements IPlatformProjectService { validPackageNamesForDevice: [], frameworkFilesExtensions: [], appDestinationDirectoryPath: "", - relativeToFrameworkConfigurationFilePath: "" + relativeToFrameworkConfigurationFilePath: "", + fastLivesyncFileExtensions: [] }; } getAppResourcesDestinationDirectoryPath(): IFuture{