From a4b1c0f8123a5ee38f4bf573ca6c9e7c41610fd5 Mon Sep 17 00:00:00 2001 From: Ram Vibhakar Date: Wed, 19 Aug 2015 21:30:54 +0800 Subject: [PATCH] Save new version fix and migrate fix --- .../canvas/components/popup/KSketch_SaveOptions.mxml | 2 +- .../edu/smu/ksketch2/utils/KSketch_MigrateCache.as | 4 +--- .../src/sg/edu/smu/ksketch2/utils/KWebData.as | 12 ++++++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/KSKInterface/src/sg/edu/smu/ksketch2/canvas/components/popup/KSketch_SaveOptions.mxml b/KSKInterface/src/sg/edu/smu/ksketch2/canvas/components/popup/KSketch_SaveOptions.mxml index fd741860..e2067d02 100755 --- a/KSKInterface/src/sg/edu/smu/ksketch2/canvas/components/popup/KSketch_SaveOptions.mxml +++ b/KSKInterface/src/sg/edu/smu/ksketch2/canvas/components/popup/KSketch_SaveOptions.mxml @@ -207,7 +207,7 @@ } //save to cache - if (!overwriteSave) { + if (_canvasView._isNewSketch) { _cacheControl.addToCache(objDoc); } else { _cacheControl.updateCache(objDoc); diff --git a/KSKInterface/src/sg/edu/smu/ksketch2/utils/KSketch_MigrateCache.as b/KSKInterface/src/sg/edu/smu/ksketch2/utils/KSketch_MigrateCache.as index 383d3caf..a4588c35 100644 --- a/KSKInterface/src/sg/edu/smu/ksketch2/utils/KSketch_MigrateCache.as +++ b/KSKInterface/src/sg/edu/smu/ksketch2/utils/KSketch_MigrateCache.as @@ -12,15 +12,13 @@ public class KSketch_MigrateCache { public function KSketch_MigrateCache() { } public function migrateData(){ - if(_mySOV1.data){ + if(_mySOV1.data != null){ if(_mySOV1.data.userSketch) { var obj:Object = com.adobe.serialization.json.JSON.decode(_mySOV1.data.userSketch, true); buildCacheV2(obj.sketches) } if(_mySOV1.data.user){ _cacheControl.user = com.adobe.serialization.json.JSON.decode(_mySOV1.data.user,true); - } else { - _cacheControl.newUser(); } _mySOV1.clear(); } diff --git a/KSKInterface/src/sg/edu/smu/ksketch2/utils/KWebData.as b/KSKInterface/src/sg/edu/smu/ksketch2/utils/KWebData.as index 88b5664c..77a026cd 100755 --- a/KSKInterface/src/sg/edu/smu/ksketch2/utils/KWebData.as +++ b/KSKInterface/src/sg/edu/smu/ksketch2/utils/KWebData.as @@ -33,8 +33,16 @@ import mx.utils.UIDUtil; if(userData.sketchData.originalName != "" && (sketchName == userData.sketchData.originalName)) { data.sketchId = userData.sketchData.sketchId; - data.originalVersion = userData.sketchData.originalVersion; - data.originalSketch = userData.sketchData.originalSketch; + if((userData.sketchData as Object).hasOwnProperty('originalVersion')) { + data.originalVersion = userData.sketchData.originalVersion; + } else { + data.originalVersion = userData.sketchData.version; + } + if((userData.sketchData as Object).hasOwnProperty('originalSketch')) { + data.originalSketch = userData.sketchData.originalSketch; + } else { + data.originalSketch = userData.sketchData.originalSketchId; + } data.originalName = userData.sketchData.originalName; } else