diff --git a/ACKNOWLEDGEMENTS.md b/ACKNOWLEDGEMENTS.md index 12c9c10a..e5808ddb 100644 --- a/ACKNOWLEDGEMENTS.md +++ b/ACKNOWLEDGEMENTS.md @@ -160,6 +160,111 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------- + +Copyright 2001-2004 Unicode, Inc. + +Disclaimer + +This source code is provided as is by Unicode, Inc. No claims are +made as to fitness for any particular purpose. No warranties of any +kind are expressed or implied. The recipient agrees to determine +applicability of information provided. If this file has been +purchased on magnetic or optical media from Unicode, Inc., the +sole remedy for any claim will be exchange of defective media +within 90 days of receipt. + +Limitations on Rights to Redistribute This Code + +Unicode, Inc. hereby grants the right to freely use the information +supplied in this file in the creation of products supporting the +Unicode Standard, and to make copies of this file in any form +for internal or external distribution as long as this notice +remains attached. + +-------------------------------------------------------------------- + +libunwind - a platform-independent unwind library + Copyright (C) 2008 Google, Inc + Contributed by Paul Pluzhnikov + Copyright (C) 2010 Konstantin Belousov + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +-------------------------------------------------------------------- + +Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + +@APPLE_LICENSE_HEADER_START@ + +This file contains Original Code and/or Modifications of Original Code +as defined in and that are subject to the Apple Public Source License +Version 2.0 (the 'License'). You may not use this file except in +compliance with the License. Please obtain a copy of the License at +http://www.opensource.apple.com/apsl/ and read it before using this +file. + +The Original Code and all software distributed under the License are +distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER +EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, +INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. +Please see the License for the specific language governing rights and +limitations under the License. + +@APPLE_LICENSE_HEADER_END@ + +-------------------------------------------------------------------- + +Copyright (c) 1989, 1993 +The Regents of the University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + This product includes software developed by the University of + California, Berkeley and its contributors. +4. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + + -------------------------------------------------------------------------------- ## Caveat (https://github.com/googlefonts/caveat) @@ -383,22 +488,6 @@ FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------------------------------------------------- -## cpp-btree (https://github.com/Kronuz/cpp-btree) - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - - -------------------------------------------------------------------------------- ## cppformat (https://github.com/cppformat/cppformat) @@ -453,6 +542,212 @@ FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-------------------------------------------------------------------------------- +## djinni-support-lib (https://github.com/cross-language-cpp/djinni-support-lib) + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + -------------------------------------------------------------------------------- ## dukglue (https://github.com/Aloshi/dukglue) @@ -777,31 +1072,6 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -## gsl (https://github.com/Microsoft/GSL) - -Copyright (c) 2015 Microsoft Corporation. All rights reserved. - -This code is licensed under the MIT License (MIT). - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -------------------------------------------------------------------------------- HarfBuzz is licensed under the so-called "Old MIT" license. Details follow. For parts of HarfBuzz that are licensed under different licenses see individual @@ -1448,6 +1718,8 @@ that were granted to the IJG for code derived from their software. -------------------------------------------------------------------------------- +## libtiff (http://www.libtiff.org/) + Copyright (c) 1988-1997 Sam Leffler Copyright (c) 1991-1997 Silicon Graphics, Inc. @@ -3350,34 +3622,38 @@ See the License for the specific language governing permissions and limitations under the License. -------------------------------------------------------------------------------- -## XMP Toolkit SDK (http://www.adobe.com/devnet/xmp.html) +## XMP Toolkit SDK (https://github.com/adobe/XMP-Toolkit-SDK) -Copyright (c) 1999 - 2010, Adobe Systems Incorporated All rights reserved. +BSD 3-Clause License -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: +Copyright (c) 2020, Adobe +All rights reserved. -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: -* Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or - other materials provided with the distribution. +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. -* Neither the name of Adobe Systems Incorporated, nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- ## zlib (http://www.zlib.net/) diff --git a/CHANGELOG.md b/CHANGELOG.md index d77cfcb2..7a568a3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ ## Newest Release +### 2.3.0 - 19 Jul 2022 + +- Adds Android Toolbar menu customization from `PSPDFKitView` properties. (#33417) +- Adds handling multiple initializations exception. (#35079) +- Updates the deployment target to iOS 14.0. (#33871) +- Updates for PSPDFKit 11.4.0 for iOS. (#33485) +- PSPDFKit now requires React Native 0.68 or later. (#33875) +- PSPDFKit now requires Xcode 13.4.1 or later. (#32495) + +## Previous Releases + ### 2.2.2 - 15 Mar 2022 - Adds image support to `PSKDFKit.present()` on Android. (#33312) @@ -7,8 +18,6 @@ - Updates for PSPDFKit 11.3.0 for iOS. (#33485) - Fixes React Native Annotation Processor API for Android. (#33189, #33302) -## Previous Releases - ### 2.2.1 - 04 Mar 2022 - Updates for PSPDFKit 8.1.2 for Android. (#33315) diff --git a/README.md b/README.md index fcd2c00d..691e5c15 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ Let's create a simple app that integrates PSPDFKit and uses the `react-native-ps yarn install ``` -1. Open your project’s Podfile in a text editor to update the platform to iOS 13, and add the PSPDFKit Podspec: +1. Open your project’s Podfile in a text editor to update the platform to iOS 14, and add the PSPDFKit Podspec: ```bash open ios/Podfile @@ -106,7 +106,7 @@ Let's create a simple app that integrates PSPDFKit and uses the `react-native-ps require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' - platform :ios, '10.0' - + platform :ios, '13.0' + + platform :ios, '14.0' target 'PSPDFKitDemo' do config = use_native_modules! @@ -153,7 +153,7 @@ Let's create a simple app that integrates PSPDFKit and uses the `react-native-ps open PSPDFKitDemo.xcworkspace ``` -1. Make sure the deployment target is set to 13.0 or higher: +1. Make sure the deployment target is set to 14.0 or higher: ![deployment-target](./screenshots/deployment-target.png) diff --git a/android/build.gradle b/android/build.gradle index 9db81a6e..355a2929 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -15,7 +15,7 @@ * Contains gradle configuration constants */ ext { - PSPDFKIT_VERSION = '8.1.2' + PSPDFKIT_VERSION = 'SNAPSHOT' } buildscript { diff --git a/android/src/main/java/com/pspdfkit/react/PSPDFKitModule.java b/android/src/main/java/com/pspdfkit/react/PSPDFKitModule.java index e32a48f7..b4f38336 100644 --- a/android/src/main/java/com/pspdfkit/react/PSPDFKitModule.java +++ b/android/src/main/java/com/pspdfkit/react/PSPDFKitModule.java @@ -52,6 +52,7 @@ import java.util.EnumSet; import java.util.HashMap; import java.util.Map; +import com.pspdfkit.exceptions.InvalidPSPDFKitLicenseException; public class PSPDFKitModule extends ReactContextBaseJavaModule implements Application.ActivityLifecycleCallbacks, ActivityEventListener { @@ -210,15 +211,25 @@ public void run() { } @ReactMethod - public void setLicenseKey(@Nullable String licenseKey) { - PSPDFKit.initialize(getReactApplicationContext().getApplicationContext(), licenseKey, new ArrayList<>(), HYBRID_TECHNOLOGY); + public void setLicenseKey(@Nullable String licenseKey, @Nullable Promise promise) { + try { + PSPDFKit.initialize(resumedActivity, licenseKey, new ArrayList<>(), HYBRID_TECHNOLOGY); + promise.resolve("Initialised PSPDFKit"); + } catch (InvalidPSPDFKitLicenseException e) { + promise.reject(e); + } } @ReactMethod - public void setLicenseKeys(@Nullable String androidLicenseKey, @Nullable String iOSLicenseKey) { + public void setLicenseKeys(@Nullable String androidLicenseKey, @Nullable String iOSLicenseKey, @Nullable Promise promise) { // Here, we ignore the `iOSLicenseKey` parameter and only care about `androidLicenseKey`. // `iOSLicenseKey` will be used to activate the license on iOS. - PSPDFKit.initialize(getReactApplicationContext().getApplicationContext(), androidLicenseKey, new ArrayList<>(), HYBRID_TECHNOLOGY); + try { + PSPDFKit.initialize(resumedActivity, androidLicenseKey, new ArrayList<>(), HYBRID_TECHNOLOGY); + promise.resolve("Initialised PSPDFKit"); + } catch (InvalidPSPDFKitLicenseException e) { + promise.reject(e); + } } @ReactMethod diff --git a/android/src/main/java/com/pspdfkit/react/ReactPdfViewManager.java b/android/src/main/java/com/pspdfkit/react/ReactPdfViewManager.java index 9912373d..4dd98a2a 100644 --- a/android/src/main/java/com/pspdfkit/react/ReactPdfViewManager.java +++ b/android/src/main/java/com/pspdfkit/react/ReactPdfViewManager.java @@ -30,6 +30,8 @@ import com.pspdfkit.react.events.PdfViewDataReturnedEvent; import com.pspdfkit.react.menu.ReactGroupingRule; import com.pspdfkit.views.PdfView; +import com.pspdfkit.configuration.activity.PdfActivityConfiguration; + import org.json.JSONObject; @@ -61,6 +63,7 @@ public class ReactPdfViewManager extends ViewGroupManager { public static final int COMMAND_REMOVE_ANNOTATION = 10; public static final int COMMAND_GET_ALL_ANNOTATIONS = 11; public static final int COMMAND_REMOVE_FRAGMENT = 12; + public static final int COMMAND_SET_TOOLBAR_MENU_ITEMS = 13; private CompositeDisposable annotationDisposables = new CompositeDisposable(); @@ -105,6 +108,7 @@ public Map getCommandsMap() { commandMap.put("removeAnnotation", COMMAND_REMOVE_ANNOTATION); commandMap.put("getAllAnnotations", COMMAND_GET_ALL_ANNOTATIONS); commandMap.put("removeFragment", COMMAND_REMOVE_FRAGMENT); + commandMap.put("setToolbarMenuItems", COMMAND_SET_TOOLBAR_MENU_ITEMS); return commandMap; } @@ -170,6 +174,15 @@ public void setSelectedFontName(@NonNull final PdfView view, @Nullable final Str view.setSelectedFontName(selectedFontName); } + @ReactProp(name = "toolbarMenuItems") + public void setToolbarMenuItems(@NonNull final PdfView view, @Nullable final ReadableArray toolbarItems) { + if (toolbarItems != null) { + PdfActivityConfiguration.Builder currentConfiguration = new PdfActivityConfiguration.Builder(view.getConfiguration()); + ToolbarMenuItemsAdapter newConfigurations = new ToolbarMenuItemsAdapter(currentConfiguration, toolbarItems); + view.setConfiguration(newConfigurations.build()); + } + } + @Nullable @Override public Map getExportedCustomDirectEventTypeConstants() { @@ -285,6 +298,11 @@ public void accept(JSONObject jsonObject) { // to stop `react-native-screens` from crashing the App when the back button is pressed. root.removeFragment(true); break; + case COMMAND_SET_TOOLBAR_MENU_ITEMS: + if (args != null && args.size() == 1) { + setToolbarMenuItems(root,args.getArray(0)); + } + break; } } diff --git a/android/src/main/java/com/pspdfkit/react/ToolbarMenuItemsAdapter.java b/android/src/main/java/com/pspdfkit/react/ToolbarMenuItemsAdapter.java new file mode 100644 index 00000000..861f771a --- /dev/null +++ b/android/src/main/java/com/pspdfkit/react/ToolbarMenuItemsAdapter.java @@ -0,0 +1,109 @@ +/* + * ToolbarMenuItemsAdapter.java + * + * PSPDFKit + * + * Copyright © 2022 PSPDFKit GmbH. All rights reserved. + * + * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW + * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT. + * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES. + * This notice may not be removed from this file. + */ + +package com.pspdfkit.react; + +import com.facebook.react.bridge.ReadableArray; +import com.pspdfkit.configuration.activity.PdfActivityConfiguration; +import com.pspdfkit.configuration.sharing.ShareFeatures; + +import io.reactivex.annotations.NonNull; + +/** + * This class is used for mapping the toolbar menu items for customization. + */ +public class ToolbarMenuItemsAdapter { + + // Toolbar customization items. + private static final String TOOLBAR_ITEM_SEARCH = "searchButtonItem"; + private static final String TOOLBAR_ITEM_READER_VIEW = "readerViewButtonItem"; + private static final String TOOLBAR_ITEM_ANNOTATIONS = "annotationButtonItem"; + private static final String TOOLBAR_ITEM_THUMBNAILS = "thumbnailsButtonItem"; + private static final String TOOLBAR_ITEM_SHARE = "shareButtonItem"; + private static final String TOOLBAR_ITEM_SETTINGS = "settingsButtonItem"; + private static final String TOOLBAR_ITEM_OUTLINE = "outlineButtonItem"; + private static final String TOOLBAR_ITEM_BOOKMARKS = "bookmarkButtonItem"; + private static final String TOOLBAR_ITEM_PRINT = "printButtonItem"; + private static final String TOOLBAR_ITEM_ANNOTATION_LIST = "annotationListButtonItem"; + private static final String TOOLBAR_ITEM_DOCUMENT_INFO_VIEW = "documentInfoViewButtonItem"; + + private final PdfActivityConfiguration.Builder newConfigurations; + + /** + * @param currentConfiguration The current configurations. + * @param toolbarItems The toolbar items to be customized. + */ + public ToolbarMenuItemsAdapter(@NonNull final PdfActivityConfiguration.Builder currentConfiguration, @NonNull final ReadableArray toolbarItems) { + PdfActivityConfiguration.Builder configuration = disableDefaultToolbarItems(currentConfiguration); + + for (int i = 0; i < toolbarItems.size(); i++) { + String toolbarItem = toolbarItems.getString(i); + switch (toolbarItem) { + case TOOLBAR_ITEM_SEARCH: + configuration.enableSearch(); + break; + case TOOLBAR_ITEM_READER_VIEW: + configuration.enableReaderView(true); + break; + case TOOLBAR_ITEM_ANNOTATIONS: + configuration.enableAnnotationEditing(); + break; + case TOOLBAR_ITEM_THUMBNAILS: + configuration.showThumbnailGrid(); + break; + case TOOLBAR_ITEM_SHARE: + configuration.setEnabledShareFeatures(ShareFeatures.all()); + break; + case TOOLBAR_ITEM_SETTINGS: + configuration.showSettingsMenu(); + break; + case TOOLBAR_ITEM_OUTLINE: + configuration.enableOutline(); + break; + case TOOLBAR_ITEM_BOOKMARKS: + configuration.enableBookmarkList(); + break; + case TOOLBAR_ITEM_PRINT: + configuration.enablePrinting(); + break; + case TOOLBAR_ITEM_ANNOTATION_LIST: + configuration.enableAnnotationList(); + break; + case TOOLBAR_ITEM_DOCUMENT_INFO_VIEW: + configuration.enableDocumentInfoView(); + break; + } + } + newConfigurations = configuration; + } + + private PdfActivityConfiguration.Builder disableDefaultToolbarItems(final PdfActivityConfiguration.Builder configuration) { + configuration.disableSearch() + .enableReaderView(false) + .disableAnnotationEditing() + .hideThumbnailGrid() + .setEnabledShareFeatures(ShareFeatures.none()) + .hideSettingsMenu() + .hideThumbnailGrid() + .disableOutline() + .disableAnnotationList() + .disablePrinting() + .disableBookmarkList() + .disableDocumentInfoView(); + return configuration; + } + + public PdfActivityConfiguration build() { + return newConfigurations.build(); + } +} diff --git a/android/src/main/java/com/pspdfkit/views/PdfView.java b/android/src/main/java/com/pspdfkit/views/PdfView.java index ba8b6c6f..748d62a5 100644 --- a/android/src/main/java/com/pspdfkit/views/PdfView.java +++ b/android/src/main/java/com/pspdfkit/views/PdfView.java @@ -213,6 +213,10 @@ public void setConfiguration(PdfActivityConfiguration configuration) { setupFragment(); } + public PdfActivityConfiguration getConfiguration() { + return configuration; + } + public void setDocument(@Nullable String documentPath) { if (documentPath == null) { this.document = null; diff --git a/index.js b/index.js index 9b545a6e..59551530 100644 --- a/index.js +++ b/index.js @@ -505,6 +505,23 @@ class PSPDFKitView extends React.Component { } }; + /** + * Customise visible toolbar menu items for Android. + * + * @param toolbarMenuItems The list of bar button items. See the full list of button items here: https://pspdfkit.com/guides/react-native/user-interface/toolbars/main-toolbar/. + * + * @platform android + */ + setToolbarMenuItems = function(toolbarMenuItems){ + if(Platform.OS =="android"){ + UIManager.dispatchViewManagerCommand( + findNodeHandle(this.refs.pdfView), + this._getViewManagerConfig("RCTPSPDFKitView").Commands.setToolbarMenuItems, + [toolbarMenuItems] + ); + } + } + /** * Removes the currently displayed Android Native PdfUiFragment. * @@ -667,6 +684,12 @@ PSPDFKitView.propTypes = { * @platform ios */ toolbarTitle: PropTypes.string, + /** + * androidToolbarMenuItems: Customize the the toolbar menu items for Android. + * The full list of toolbar menu items: https://github.com/PSPDFKit/react-native/blob/master/android/src/main/java/com/pspdfkit/react/ToolbarMenuItemsAdapter.java + * @platform android + */ + androidToolbarMenuItems: PropTypes.array, /** * showNavigationButtonInToolbar: When set to true the toolbar integrated into the PSPDFKitView will display a back button in the top left corner. * diff --git a/ios/RCTPSPDFKit.xcodeproj/project.pbxproj b/ios/RCTPSPDFKit.xcodeproj/project.pbxproj index efc40a0d..bd47c27c 100644 --- a/ios/RCTPSPDFKit.xcodeproj/project.pbxproj +++ b/ios/RCTPSPDFKit.xcodeproj/project.pbxproj @@ -281,7 +281,7 @@ "$(SRCROOT)/../../react-native/React/**", "$(SRCROOT)/../samples/Catalog/node_modules/react-native/React/**", ); - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -340,7 +340,7 @@ "$(SRCROOT)/../../react-native/React/**", "$(SRCROOT)/../samples/Catalog/node_modules/react-native/React/**", ); - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; diff --git a/package.json b/package.json index aa9deda5..cff4fdc6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-pspdfkit", - "version": "2.2.2", + "version": "2.3.0", "description": "React Native PDF Library by PSPDFKit", "keywords": [ "react native", @@ -21,12 +21,12 @@ "format": "prettier \"{samples/**/*.{md,js},*.{md,js}}\" --write" }, "peerDependencies": { - "prop-types": "^15.7.2", + "prop-types": "^15.8.1", "react": "^17.0.2", - "react-native": "^0.66.3" + "react-native": "^0.68.2" }, "dependencies": {}, "devDependencies": { - "prettier": "^2.5.1" + "prettier": "^2.7.1" } } diff --git a/react-native-pspdfkit.podspec b/react-native-pspdfkit.podspec index a6e50ad0..9b94945d 100644 --- a/react-native-pspdfkit.podspec +++ b/react-native-pspdfkit.podspec @@ -13,7 +13,7 @@ Pod::Spec.new do |s| DESC s.authors = { 'PSPDFKit GmbH' => 'support@pspdfkit.com' } s.homepage = 'https://pspdfkit.com/guides/react-native/' - s.platform = :ios, '13.0' + s.platform = :ios, '14.0' s.module_name = 'PSPDFKitReactNativeiOS' s.source = { :git => 'https://github.com/PSPDFKit/react-native' } s.source_files = 'ios/*.{xcodeproj}', 'ios/RCTPSPDFKit/*.{h,m,swift}', 'ios/RCTPSPDFKit/Converters/*.{h,m,swift}' diff --git a/samples/Catalog/.eslintignore b/samples/Catalog/.eslintignore new file mode 100644 index 00000000..62b6cc03 --- /dev/null +++ b/samples/Catalog/.eslintignore @@ -0,0 +1,4 @@ +./android +./ios +./assets +./node_modules/**/*.js diff --git a/samples/Catalog/.eslintrc.js b/samples/Catalog/.eslintrc.js index 40c6dcd0..f000635b 100644 --- a/samples/Catalog/.eslintrc.js +++ b/samples/Catalog/.eslintrc.js @@ -1,4 +1,8 @@ module.exports = { root: true, extends: '@react-native-community', + rules: { + 'react/no-string-refs': 'off', + 'no-alert': 'off', + }, }; diff --git a/samples/Catalog/.prettierrc.js b/samples/Catalog/.prettierrc.js index 84196d95..e17873e8 100644 --- a/samples/Catalog/.prettierrc.js +++ b/samples/Catalog/.prettierrc.js @@ -1,7 +1,10 @@ module.exports = { - bracketSpacing: false, - jsxBracketSameLine: true, + bracketSpacing: true, + bracketSameLine: false, singleQuote: true, trailingComma: 'all', arrowParens: 'avoid', + "endOfLine": "auto", + "printWidth": 80, + "tabWidth": 2, }; diff --git a/samples/Catalog/Catalog.js b/samples/Catalog/Catalog.js index 3c3af8ab..f297d538 100644 --- a/samples/Catalog/Catalog.js +++ b/samples/Catalog/Catalog.js @@ -172,7 +172,7 @@ const examples = [ component.props.navigation.navigate('SplitPDF'); }, }, - Platform.OS === 'ios' && { + { key: 'item11', name: 'Customize the Toolbar', description: 'Show how to customize buttons in the toolbar.', diff --git a/samples/Catalog/configuration/Constants.js b/samples/Catalog/configuration/Constants.js index f959983a..50cb3a92 100644 --- a/samples/Catalog/configuration/Constants.js +++ b/samples/Catalog/configuration/Constants.js @@ -1,5 +1,6 @@ // Document names import fileSystem from 'react-native-fs'; +import { Platform } from 'react-native'; const tiffImageName = 'PSPDFKit_Image_Example.tiff'; const formDocumentName = 'Form_example.pdf'; @@ -24,4 +25,6 @@ export const tiffImagePath = export const pspdfkitColor = '#267AD4'; export const writableDocumentPath = - fileSystem.DocumentDirectoryPath + '/' + exampleDocumentName; + Platform.OS === 'ios' + ? fileSystem.DocumentDirectoryPath + '/' + exampleDocumentName + : 'file://' + fileSystem.DocumentDirectoryPath + '/' + exampleDocumentName; diff --git a/samples/Catalog/examples/AnnotationProcessing.js b/samples/Catalog/examples/AnnotationProcessing.js index b38e19a3..302a4472 100644 --- a/samples/Catalog/examples/AnnotationProcessing.js +++ b/samples/Catalog/examples/AnnotationProcessing.js @@ -1,15 +1,18 @@ -import {BaseExampleAutoHidingHeaderComponent} from '../helpers/BaseExampleAutoHidingHeaderComponent'; -import {Button, processColor, View} from 'react-native'; +import { BaseExampleAutoHidingHeaderComponent } from '../helpers/BaseExampleAutoHidingHeaderComponent'; +import { Button, processColor, View } from 'react-native'; import PSPDFKitView from 'react-native-pspdfkit'; -import {pspdfkitColor, writableDocumentPath} from '../configuration/Constants'; +import { + pspdfkitColor, + writableDocumentPath, +} from '../configuration/Constants'; import fileSystem from 'react-native-fs'; -import {PSPDFKit} from '../helpers/PSPDFKit'; +import { PSPDFKit } from '../helpers/PSPDFKit'; import React from 'react'; export class AnnotationProcessing extends BaseExampleAutoHidingHeaderComponent { render() { return ( - + - - + +