-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation of comparision nomadhelper.html deployed vs lo…
…cal one - Logic generate hashes and compare both content hashes for each file (reference #57)
- Loading branch information
1 parent
8d9aca5
commit 10c1731
Showing
5 changed files
with
193 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...r.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/services/NomadHelperUrlDelegate.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package services | ||
{ | ||
import classes.managers.UrlProvider; | ||
|
||
import org.apache.royale.html.Alert; | ||
import org.apache.royale.net.HTTPService; | ||
import org.apache.royale.net.beads.CORSCredentialsBead; | ||
import org.apache.royale.net.events.FaultEvent; | ||
|
||
public class NomadHelperUrlDelegate | ||
{ | ||
public function getNomadHelper(nomadHelperUrl:String, resultCallback:Function, faultCallback:Function=null):void | ||
{ | ||
if (faultCallback == null) | ||
{ | ||
faultCallback = onFault; | ||
} | ||
|
||
var service:HTTPService = new HTTPService(); | ||
service.addBead(new CORSCredentialsBead(true)); | ||
service.url = nomadHelperUrl; | ||
service.method = "GET"; | ||
service.addEventListener("complete", resultCallback); | ||
service.addEventListener("ioError", faultCallback); | ||
service.send(); | ||
} | ||
|
||
public function getLocalNomadHelper(resultCallback:Function, faultCallback:Function=null):void | ||
{ | ||
if (faultCallback == null) | ||
{ | ||
faultCallback = onFault; | ||
} | ||
|
||
var service:HTTPService = new HTTPService(); | ||
service.addBead(new CORSCredentialsBead(true)); | ||
service.url = UrlProvider.NOMAD_HELPER_FILE_URL; | ||
service.method = "GET"; | ||
service.addEventListener("complete", resultCallback); | ||
service.addEventListener("ioError", faultCallback); | ||
service.send(); | ||
} | ||
|
||
public function onFault(event:FaultEvent):void | ||
{ | ||
Alert.show(event.message.toLocaleString(), this); | ||
} | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
Super.Human.Portal_Royale/src/net/apacheRoyaleTemplatedApp/utils/NomadHelperUrlTasks.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package utils | ||
{ | ||
import org.apache.royale.utils.async.SequentialAsyncTask; | ||
import services.NomadHelperUrlDelegate; | ||
import org.apache.royale.utils.async.AsyncTask; | ||
import org.apache.royale.utils.async.PromiseTask; | ||
import org.apache.royale.net.events.FaultEvent; | ||
|
||
public class NomadHelperUrlTasks extends SequentialAsyncTask | ||
{ | ||
public function NomadHelperUrlTasks(tasks:Array=null) | ||
{ | ||
super(tasks); | ||
|
||
|
||
} | ||
|
||
override public function run(data:Object=null):void | ||
{ | ||
if (data == null) | ||
{ | ||
cancel(); | ||
return; | ||
} | ||
|
||
var localNomadHelperTask:PromiseTask = new PromiseTask(new Promise(function(resolve:Function, reject:Function){ | ||
var localNomadHelper:NomadHelperUrlDelegate = new NomadHelperUrlDelegate(); | ||
localNomadHelper.getLocalNomadHelper(function(event:Event):void{ | ||
resolve(event); | ||
}, function onFault(fault:FaultEvent):void{ | ||
reject(fault); | ||
}) | ||
})); | ||
this.addTask(localNomadHelperTask); | ||
|
||
var remoteNomadHelperTask:PromiseTask = new PromiseTask(new Promise(function(resolve:Function, reject:Function){ | ||
var localNomadHelper:NomadHelperUrlDelegate = new NomadHelperUrlDelegate(); | ||
localNomadHelper.getNomadHelper(String(data), function(event:Event):void{ | ||
resolve(event); | ||
}, function onFault(fault:FaultEvent):void{ | ||
reject(fault); | ||
}) | ||
})); | ||
this.addTask(remoteNomadHelperTask); | ||
|
||
super.run(data); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters