PageRenderTime 5147ms CodeModel.GetById 44ms RepoModel.GetById 2ms app.codeStats 0ms

/PhoneGapDemoClient/apps/PhoneGapDemoClient/iphone/native/www/default/wlclient/js/challengeHandlers/remoteDisableChallengeHandler.js

https://bitbucket.org/sebsto/phonegapdemo
JavaScript | 59 lines | 40 code | 9 blank | 10 comment | 3 complexity | 9a9cf0833be49cb95717a051a512ea83 MD5 | raw file
Possible License(s): LGPL-2.0, BSD-3-Clause, MIT
  1. /* JavaScript content from wlclient/js/challengeHandlers/remoteDisableChallengeHandler.js in Common Resources */
  2. var wl_remoteDisableChallengeHandler = WL.Client.createWLChallengeHandler("wl_remoteDisableRealm");
  3. wl_remoteDisableChallengeHandler.handleChallenge = function(obj) {
  4. var message = obj.message;
  5. WL.SimpleDialog.show(WL.ClientMessages.notificationTitle, message, [ {
  6. text : WL.ClientMessages.close,
  7. handler : function() {
  8. wl_remoteDisableChallengeHandler.submitChallengeAnswer(obj.messageId);
  9. }
  10. } ]);
  11. // TODO: ilan what to do here do we still save this?
  12. if (getEnv() != WL.Env.BLACKBERRY) {
  13. __WL.LocalStorage.setValue(WL.Client.LAST_NOTIFICATION_KEY, message);
  14. }
  15. };
  16. function getEnv() {
  17. return WL.StaticAppProps.ENVIRONMENT;
  18. }
  19. wl_remoteDisableChallengeHandler.handleFailure = function(err) {
  20. var message = err.message;
  21. var downloadLink = err.downloadLink;
  22. /*
  23. * Processor default handler for failure (display message and close App).
  24. */
  25. function defaultRemoteDisableDenialHandler() {
  26. var buttons = [ {
  27. text : WL.ClientMessages.exitApplication,
  28. handler : function() {
  29. // Note you must add the null options to openURL
  30. // otherwise the event is assumed the 3rd argument.
  31. WL.App.close();
  32. }
  33. } ];
  34. if (downloadLink) {
  35. buttons.push({
  36. text : WL.ClientMessages.getNewVersion,
  37. handler : function() {
  38. // Note you must add the null options to openURL
  39. // otherwise the event is assumed the 3rd argument.
  40. WL.App.openURL(downloadLink, "_new", null);
  41. WL.App.close();
  42. }
  43. });
  44. }
  45. // Patch - downloadNewVersion element is added in the msg string.
  46. WL.SimpleDialog.show(WL.ClientMessages.applicationDenied, message, buttons);
  47. WL.Client.__hideBusy();
  48. }
  49. WL.Client.__handleOnRemoteDisableDenial(defaultRemoteDisableDenialHandler);
  50. };