This file contains hidden or 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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" | |
| xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:rim="http://www.blackberry.com/ns/widgets" | |
| id="cordova-plugin-pesdk" version="1.1.0"> | |
| <name>PESDK</name> | |
| <description>PhotoEditor SDK Cordova Plugin</description> | |
| <license>Apache 2.0</license> | |
| <keywords>cordova,camera</keywords> | |
| <repo>https://github.com/imgly/pesdk-cordova-demo.git</repo> |
This file contains hidden or 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
| - (void)present:(CDVInvokedUrlCommand *)command { | |
| if (self.lastCommand == nil) { | |
| self.lastCommand = command; | |
| PESDKConfiguration *configuration = [[PESDKConfiguration alloc] initWithBuilder:^(PESDKConfigurationBuilder * _Nonnull builder) { | |
| // Customize the SDK to match your requirements: | |
| // ...eg.: | |
| // [builder setBackgroundColor:[UIColor whiteColor]]; | |
| }]; | |
This file contains hidden or 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
| var PESDK = { | |
| present: function(success, failure, options) { | |
| cordova.exec(success, failure, "PESDK", "present", [options]); | |
| } | |
| }; | |
| module.exports = PESDK; |
This file contains hidden or 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
| + (void)initialize { | |
| if (self == [PESDKPlugin self]) { | |
| [PESDK unlockWithLicenseAt:[[NSBundle mainBundle] URLForResource:@"LICENSE_IOS" withExtension:nil]]; | |
| } | |
| } |
This file contains hidden or 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
| onDeviceReady: function() { | |
| selectImageBtn = document.getElementById('js-selectImageBtn'); | |
| selectImageBtn.addEventListener('click', function() { | |
| // TODO: Open PhotoEditor SDK | |
| }); | |
| selectImageBtn.disabled = false; | |
| } |
This file contains hidden or 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
| onDeviceReady: function() { | |
| selectImageBtn = document.getElementById('js-selectImageBtn'); | |
| selectImageBtn.addEventListener('click', function() { | |
| window.imagePicker.getPictures( | |
| function(results) { | |
| let imageURI = results[0]; | |
| PESDK.present( | |
| function(result){ alert('PESDK result: ' + JSON.stringify(result)); }, | |
| function(error){ alert('PESDK error: ' + error); }, | |
| { path: imageURI } |
This file contains hidden or 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
| @Override | |
| public void initialize(CordovaInterface cordova, CordovaWebView webView) { | |
| super.initialize(cordova, webView); | |
| PESDK.init(cordova.getActivity().getApplication(), "LICENSE_ANDROID"); | |
| } |
This file contains hidden or 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
| private Runnable present(final Activity mainActivity, final String filepath, final CallbackContext callbackContext) { | |
| callback = callbackContext; | |
| final PESDKPlugin self = this; | |
| return new Runnable() { | |
| public void run() { | |
| if (mainActivity != null) { | |
| SettingsList settingsList = new SettingsList(); | |
| settingsList | |
| .getSettingsModel(EditorLoadSettings.class) | |
| .setImageSourcePath(filepath.replace("file://", ""), true) // Load with delete protection true! |
This file contains hidden or 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
| func spriteEditControllerPreviewView(_ spriteEditController: SpriteEditController) -> UIView? { | |
| return self.previewViewController?.previewView | |
| } |
This file contains hidden or 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
| func stickerSelectionController(_ stickerSelectionController: StickerSelectionController, didSelect sticker: Sticker, with image: UIImage) { | |
| guard let referenceSize = delegate?.stickerViewControllerReferenceSize(self) else { return } | |
| var model = StickerSpriteModel(sticker: sticker) | |
| let aspectRatio = referenceSize.width / referenceSize.height | |
| model.normalizedCenter = CGPoint(x: 0.5, y: 0.5) | |
| model.normalizedSize = CGSize(width: 0.3, height: 0.3 * aspectRatio) | |
| delegate?.stickerViewControllerDidFinish(self, stickerModel: model) | |
| dismiss(animated: true, completion: nil) | |
| } |
OlderNewer