(String src, String dest, final CallbackContext callback)
| 817 | } |
| 818 | |
| 819 | private void copy(String src, String dest, final CallbackContext callback) { |
| 820 | final String splittedStr[] = src.split(SEPARATOR, 2); |
| 821 | final String srcUri = splittedStr[0]; |
| 822 | final String srcId = splittedStr[1]; |
| 823 | final String destId = dest.split(SEPARATOR, 2)[1]; |
| 824 | |
| 825 | cordova |
| 826 | .getThreadPool() |
| 827 | .execute( |
| 828 | new Runnable() { |
| 829 | @Override |
| 830 | public void run() { |
| 831 | try { |
| 832 | Uri newUri = copy(srcUri, srcId, destId); |
| 833 | if (newUri == null) { |
| 834 | callback.error("Unable to copy " + src); |
| 835 | } else { |
| 836 | callback.success( |
| 837 | srcUri + SEPARATOR + DocumentsContract.getDocumentId(newUri) |
| 838 | ); |
| 839 | } |
| 840 | } catch (Exception e) { |
| 841 | callback.error(e.toString()); |
| 842 | } |
| 843 | } |
| 844 | } |
| 845 | ); |
| 846 | } |
| 847 | |
| 848 | private Uri copy(String root, String srcId, String destId) |
| 849 | throws IOException, FileNotFoundException { |
no test coverage detected