Skip to content

Commit

Permalink
Upgrade to PSPDFKit 5 for Android
Browse files Browse the repository at this point in the history
  • Loading branch information
David Schreiber-Ranner committed Nov 15, 2018
1 parent b094da5 commit 2373146
Show file tree
Hide file tree
Showing 14 changed files with 200 additions and 203 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015-2017 PSPDFKit GmbH
Copyright (c) 2015-2018 PSPDFKit GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
192 changes: 95 additions & 97 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pspdfkit-cordova-android",
"version": "4.3.0",
"version": "5.0.14.3.0",
"description": "Integration of the PSPDFKit for Android library.",
"cordova": {
"id": "pspdfkit-cordova-android",
Expand All @@ -21,7 +21,7 @@
],
"engines": {
"cordovaDependencies": {
"4.3.0": { "cordova-android": ">=7.0.0" }
"5.0.1": { "cordova-android": ">=7.0.0" }
}
},
"author": "PSPDFKit",
Expand Down
32 changes: 23 additions & 9 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
<?xml version='1.0' encoding='utf-8'?>
<!--
~ plugin.xml
~
~ PSPDFKit
~
~ Copyright (c) 2015-2017 PSPDFKit GmbH. All rights reserved.
~ Copyright (c) 2015-2018 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.
-->
<plugin id="pspdfkit-cordova-android" version="4.3.0" xmlns="http://apache.org/cordova/ns/plugins/1.0"
<plugin id="pspdfkit-cordova-android" version="5.0.1" xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<name>PSPDFKit-Android</name>
<description>Integration of the PSPDFKit for Android library.</description>
Expand All @@ -20,10 +16,21 @@
<license>MIT</license>

<info><![CDATA[
You're almost set up for using PSPDFKit-Android for Apache Cordova! Two more steps:
Thanks for using the PSPDFKit for Cordova/Ionic wrapper. There's only on more step to get you started:
1) You need to add following lines to the `local.properties` (usually inside platforms/android/):
pspdfkit.password = YOUR_PASSWORD
pspdfkit.license = YOUR_PSPDFKIT_LICENSE
1) Place your PSPDFKit library aar file into the `platforms/android/app/libs/` directory of your project.
2) Add your PSPDFKit license key to the <meta-data name="pspdfkit_license_key"> tag of your AndroidManifest.xml.
2) Inside your `project.properties` you need to set the `target` to `android-28`.
Make sure to replace YOUR_PASSWORD and YOUR_PSPDFKIT_LICENSE with the actual PSPDFKit customer password
and license string that you received while requesting a demo at https://pspdfkit.com/try/ or via the PSPDFKit
customer portal (in case you already own a license).
For the complete documentation and troubleshooting, check out our documentation at https://github.com/PSPDFKit/Cordova-Android.
In case there are issues, feel free to reach out to our support team at https://pspdfkit.com/support/request/.
]]></info>

<js-module name="PSPDFKit" src="www/PSPDFKit.js">
Expand All @@ -42,6 +49,7 @@ You're almost set up for using PSPDFKit-Android for Apache Cordova! Two more ste

<resource-file src="src/android/res/values/styles.xml" target="res/values/styles.xml" />

<framework custom="true" src="src/android/config.gradle" type="gradleReference"/>
<framework custom="true" src="src/android/pspdfkit.gradle" type="gradleReference"/>

<config-file parent="/*" target="res/xml/config.xml">
Expand All @@ -50,6 +58,12 @@ You're almost set up for using PSPDFKit-Android for Apache Cordova! Two more ste
</feature>
</config-file>

<config-file parent="/*/application" target="app/src/main/AndroidManifest.xml">
<meta-data
android:name="pspdfkit_license_key"
android:value="@string/PSPDFKIT_LICENSE_KEY" />
</config-file>

<config-file parent="/*/application" target="app/src/main/AndroidManifest.xml" after="activity">
<activity android:name="com.pspdfkit.ui.PdfActivity"
android:theme="@style/PSPDFKit.Theme"
Expand Down
55 changes: 55 additions & 0 deletions src/android/config.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright (c) 2018 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.
*/

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

ext.pspdfkitMavenUrl = localProperties.getProperty('pspdfkit.mavenUrl')
if (pspdfkitMavenUrl == null || pspdfkitMavenUrl == '') {
ext.pspdfkitMavenUrl = 'https://customers.pspdfkit.com/maven/'
}

ext.pspdfkitUsername = localProperties.getProperty('pspdfkit.username')
if (pspdfkitUsername == null || pspdfkitUsername == '') {
ext.pspdfkitUsername = 'pspdfkit'
}

ext.pspdfkitPassword = localProperties.getProperty('pspdfkit.password')
if (pspdfkitPassword == null || pspdfkitPassword == '') {
throw new GradleException("PSPDFKit password was not specified. The password is required to download the PSPDFKit AAR file from PSPDFKit servers"
+ " into your project. Please specify as pspdfkit.password inside the local.properties file. In case you don't own a password for PSPDFKit"
+ " yet, you can request an evaluation copy of PSPDFKit at https://pspdfkit.com/try/. If you already own a license of PSPDFKit, you can"
+ " access it at https://customers.pspdfkit.com/.")
}

ext.pspdfkitLicense = localProperties.getProperty('pspdfkit.license')
if (pspdfkitLicense == null || pspdfkitLicense == '') {
throw new GradleException("PSPDFKit license was not specified. The license is required to initialize and run PSPDFKit."
+ " Please specify as pspdfkit.license inside the local.properties file. In case you don't own a license for PSPDFKit"
+ " yet, you can request an evaluation copy of PSPDFKit at https://pspdfkit.com/try/. If you already own a license of"
+ " PSPDFKit, you can access it at https://customers.pspdfkit.com/.")
}

def pspdfkitIsDemo = localProperties.getProperty('pspdfkit.demo')
if (pspdfkitIsDemo == null) {
pspdfkitIsDemo = pspdfkitPassword.startsWith('TRIAL-')
} else {
pspdfkitIsDemo = Boolean.parseBoolean(pspdfkitIsDemo)
}

ext.pspdfkitMavenModuleName = pspdfkitIsDemo ? 'pspdfkit-demo' : 'pspdfkit'
ext.pspdfkitVersion = localProperties.getProperty('pspdfkit.version')
if (pspdfkitVersion == null || pspdfkitVersion == '') {
ext.pspdfkitVersion = '5.0.1'
}
6 changes: 1 addition & 5 deletions src/android/java/com/pspdfkit/cordova/ExtractAssetTask.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/*
* ExtractAssetTask.java
*
* PSPDFKit
*
* Copyright (c) 2015-2017 PSPDFKit GmbH. All rights reserved.
* Copyright (c) 2015-2018 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/*
* PSPDFKitCordovaPlugin.java
*
* PSPDFKit
*
* Copyright (c) 2015-2017 PSPDFKit GmbH. All rights reserved.
* Copyright (c) 2015-2018 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/*
* PSPDFKitCordovaPluginException.java
*
* PSPDFKit
*
* Copyright (c) 2015-2017 PSPDFKit GmbH. All rights reserved.
* Copyright (c) 2015-2018 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.
Expand Down
39 changes: 16 additions & 23 deletions src/android/pspdfkit.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/*
* pspdfkit.gradle
*
* PSPDFKit
*
* Copyright (c) 2015-2017 PSPDFKit GmbH. All rights reserved.
* Copyright (c) 2015-2018 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.
Expand All @@ -12,30 +8,27 @@
*/

repositories {
flatDir {
dirs 'libs'
maven {
url pspdfkitMavenUrl
credentials {
username pspdfkitUsername
// The PSPDFKit password has to be specified in your app's local.properties file, for example:
// pspdfkit.password = MY_PSPDFKIT_PASSWORD
password pspdfkitPassword
}
}
maven {
url "https://maven.google.com"
}
}

def pspdfkitAarFiles = new FileNameFinder().getFileNames(new File(project.projectDir, 'libs').absolutePath, '*.aar')

if(pspdfkitAarFiles.isEmpty()) {
throw new MissingResourceException("The PSPDFKit aar file required by the PSPDFKit-Android Cordova plugin is missing. Please place this file into 'platforms/android/libs/' before building your app.");
android {
defaultConfig {
// The license string has to be specified in your app's local.properties file, for example:
// pspdfkit.license = MY_LICENSE_STRING.
resValue "string", "PSPDFKIT_LICENSE_KEY", "\"$pspdfkitLicense\""
}
}

dependencies {
compile 'com.android.support:support-v4:26.0.2'
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support:recyclerview-v7:26.0.2'
compile 'com.android.support:cardview-v7:26.0.2'
compile 'com.android.support:design:26.0.2'
compile 'io.reactivex.rxjava2:rxjava:2.1.3'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.getkeepsafe.relinker:relinker:1.2.2'
compile 'com.facebook.device.yearclass:yearclass:2.0.0'
compile 'org.jetbrains.kotlin:kotlin-stdlib:1.2.20'
compile 'com.pspdfkit:pspdfkit:+@aar'
implementation "com.pspdfkit:$pspdfkitMavenModuleName:$pspdfkitVersion"
}
41 changes: 0 additions & 41 deletions src/android/res/values/styles.xml

This file was deleted.

2 changes: 1 addition & 1 deletion tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pspdfkit-cordova-android-tests",
"version": "3.3.3",
"version": "5.0.1",
"description": "Test suite of the PSPDFKit for Android library Cordova plugin.",
"cordova": {
"id": "pspdfkit-cordova-android-tests",
Expand Down
8 changes: 2 additions & 6 deletions tests/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ plugin.xml
~
~ PSPDFKit
~
~ Copyright (c) 2015-2017 PSPDFKit GmbH. All rights reserved.
~ Copyright (c) 2015-2018 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.
Expand All @@ -13,7 +9,7 @@
-->
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="pspdfkit-cordova-android-tests"
version="3.3.3">
version="5.0.1">
<name>PSPDFKit-Android Tests</name>
<license>MIT</license>

Expand Down
4 changes: 1 addition & 3 deletions tests/tests.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/**
PSPDFKit
Copyright (c) 2015-2017 PSPDFKit GmbH. All rights reserved.
Copyright (c) 2015-2018 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.
Expand Down
6 changes: 1 addition & 5 deletions www/PSPDFKit.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/*
* PSPDFKit.js
*
* PSPDFKit
*
* Copyright (c) 2015-2017 PSPDFKit GmbH. All rights reserved.
* Copyright (c) 2015-2018 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.
Expand Down

0 comments on commit 2373146

Please sign in to comment.