설명 없음

EmailComposerProxy.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* globals Windows: true */
  2. /*
  3. Copyright 2013-2016 appPlant UG
  4. Licensed to the Apache Software Foundation (ASF) under one
  5. or more contributor license agreements. See the NOTICE file
  6. distributed with this work for additional information
  7. regarding copyright ownership. The ASF licenses this file
  8. to you under the Apache License, Version 2.0 (the
  9. "License"); you may not use this file except in compliance
  10. with the License. You may obtain a copy of the License at
  11. http://www.apache.org/licenses/LICENSE-2.0
  12. Unless required by applicable law or agreed to in writing,
  13. software distributed under the License is distributed on an
  14. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. KIND, either express or implied. See the License for the
  16. specific language governing permissions and limitations
  17. under the License.
  18. */
  19. var WinLauncher = Windows.System.Launcher,
  20. WinMail = Windows.ApplicationModel.Email;
  21. /**
  22. * Verifies if sending emails is supported on the device.
  23. *
  24. * @param {Function} success
  25. * Success callback function
  26. * @param {Function} error
  27. * Error callback function
  28. * @param {Array} args
  29. * Interface arguments
  30. */
  31. exports.isAvailable = function (success, error, args) {
  32. success(true);
  33. };
  34. /**
  35. * Displays the email composer pre-filled with data.
  36. *
  37. * @param {Function} success
  38. * Success callback function
  39. * @param {Function} error
  40. * Error callback function
  41. * @param {Array} args
  42. * Interface arguments
  43. */
  44. exports.open = function (success, error, args) {
  45. var props = args[0],
  46. impl = exports.impl;
  47. if (WinMail) {
  48. impl.getDraftWithProperties(props)
  49. .then(WinMail.EmailManager.showComposeNewEmailAsync)
  50. .done(success, error);
  51. } else {
  52. var mailTo = impl.getMailTo(props);
  53. WinLauncher
  54. .launchUriAsync(mailTo)
  55. .done(success, error);
  56. }
  57. };
  58. require('cordova/exec/proxy').add('EmailComposer', exports);