Skip to content
This repository was archived by the owner on Jun 15, 2024. It is now read-only.

Commit 1bf80c7

Browse files
committed
fix(eveyrthing): upgrade to NativeScript 3.0.0
This release is almost a full rewrite and fixes a number of issues as well as being made compatible with NativeScript 3. Close #8, close #15, close #16, close #18. Also related is #17. BREAKING CHANGE: The plugin no longer auto-registers a tag in Angular applications. Instructions to register a `PDFView` element have been added to the project README.
1 parent 18ac92c commit 1bf80c7

File tree

104 files changed

+1581
-932
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+1581
-932
lines changed

.gitignore

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
*.js
22
*.js.map
33
*.log
4-
/demo/app/*.js
5-
/demo/*.d.ts
6-
/demo/lib
7-
/demo/platforms
8-
/demo/node_modules
9-
/node_modules
4+
!scripts/*.js
5+
demo/app/*.js
6+
!demo/karma.conf.js
7+
!demo/app/tests/*.js
8+
demo/*.d.ts
9+
!demo/references.d.ts
10+
demo/lib
11+
demo/platforms
12+
demo/node_modules
13+
node_modules

.npmignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
demo/
2+
screenshots/
3+
*.gif
24
*.png
3-
*.log
5+
*.log
6+
*.map
7+
*.ts
8+
!*.d.ts

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Place your settings in this file to overwrite default and user settings.
21
{
32
"files.exclude": {
43
"**/*.js": {

AndroidPdfViewer.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ declare class Configurator {
3939
pages(...pageNumbers: number[]): this;
4040
enableDoubletap(enable: boolean): this;
4141
enableSwipe(enable: boolean): this;
42-
onLoad(onLoadCompleteListener: pdfviewer.listener.OnLoadCompleteListener): this;
42+
onLoad(
43+
onLoadCompleteListener: pdfviewer.listener.OnLoadCompleteListener
44+
): this;
4345
swipeHorizontal(horizontal: boolean): this;
44-
}
46+
}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
The MIT License (MIT)
22

33
nativescript-pdf-view
4-
Copyright (c) 2016, Merott Movahedi
4+
Copyright (c) 2017, Merott Movahedi
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy of
77
this software and associated documentation files (the "Software"), to deal in

README.md

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,42 @@
1-
# nativescript-pdf-view
1+
# NativeScript PDFView
22

3-
This is a very basic PDF view implementation that does only one thing, and
4-
that is to display PDF files. It conveniently uses the iOS `UIWebView`, but
5-
for Android it uses [AndroidPdfViewer](https://github.com/barteksc/AndroidPdfViewer).
3+
A minimal PDF view implementation that does only one thing, and that is to display PDF files in the simplest way possible. It conveniently uses the iOS `WKWebView`, and for Android it uses [`AndroidPdfViewer`](https://github.com/barteksc/AndroidPdfViewer).
64

7-
This plugin does the bare minimum required to render the PDF, no configuration
8-
options, and no error handling have been built yet. I welcome all Pull Requests!
5+
This plugin does the bare minimum required to render the PDF, no configuration options, and no error handling have been built yet. I welcome all Pull Requests!
96

10-
# Usage
7+
My aim is to keep the features consistent across iOS and Android.
118

12-
##
9+
## Installation
1310

14-
Check out the [demo](./demo) folder for a sample usage.
11+
```
12+
tns plugin add nativescript-pdf-view
13+
```
1514

16-
## Angular 2
15+
## Usage
1716

18-
If you're using the plugin with Angular 2, the plugin automatically registers
19-
`PDFView` as a valid tag for Angular templates. Usage is simple:
17+
### Vanilla NativeScript
2018

21-
1. Make sure to import `nativescript-pdf-view` somewhere in your code, e.g:
19+
```xml
20+
<Page
21+
xmlns="http://schemas.nativescript.org/tns.xsd"
22+
xmlns:pdf="nativescript-pdf-view"
23+
loaded="pageLoaded">
24+
<pdf:PDFView src="{{ pdfUrl }}" load="{{ onLoad }}" />
25+
</Page>
26+
```
2227

23-
```ts
24-
import 'nativescript-pdf-view';
25-
```
28+
### Angular NativeScript
2629

27-
2. Include the tag in your template:
30+
```ts
31+
import { PDFView } from 'nativescript-pdf-view';
32+
import { registerElement } from 'nativescript-angular';
33+
registerElement('PDFView', () => PDFView);
34+
```
2835

29-
```html
30-
<PDFView [src]="src" (load)="onLoad()"></PDFView>
31-
```
36+
```html
37+
<PDFView [src]="src" (load)="onLoad()"></PDFView>
38+
```
3239

33-
# Try the Demo
40+
## Demo
3441

35-
To try the demo, `cd` into the `demo` folder, and run the following commands:
36-
37-
```sh
38-
npm install
39-
40-
# iOS
41-
tns platform add ios
42-
tns run ios
43-
44-
# Android
45-
tns platform add android
46-
tns run android
47-
```
42+
Check out the [demo](./demo) folder for a demo application using this plugin. You can run the demo by executing `npm run demo.ios` and `npm run demo.android` from the root directory of the project.

demo/app/App_Resources/Android/AndroidManifest.xml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="__PACKAGE__"
3+
package="com.merott.nativescriptpdfviewdemo"
44
android:versionCode="1"
55
android:versionName="1.0">
66

@@ -23,15 +23,18 @@
2323
android:allowBackup="true"
2424
android:icon="@drawable/icon"
2525
android:label="@string/app_name"
26-
android:theme="@style/AppTheme" >
26+
android:theme="@style/AppTheme">
27+
2728
<activity
2829
android:name="com.tns.NativeScriptActivity"
2930
android:label="@string/title_activity_kimera"
30-
android:configChanges="keyboardHidden|orientation|screenSize">
31+
android:configChanges="keyboardHidden|orientation|screenSize"
32+
android:theme="@style/LaunchScreenTheme">
3133

32-
<intent-filter>
33-
<action android:name="android.intent.action.MAIN" />
34+
<meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />
3435

36+
<intent-filter>
37+
<action android:name="android.intent.action.MAIN" />
3538
<category android:name="android.intent.category.LAUNCHER" />
3639
</intent-filter>
3740
</activity>
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
// Add your native dependencies here:
2-
3-
// Uncomment to add recyclerview-v7 dependency
4-
//dependencies {
5-
// compile 'com.android.support:recyclerview-v7:+'
6-
//}
1+
android {
2+
defaultConfig {
3+
generatedDensities = []
4+
applicationId = "com.merott.nativescriptpdfviewdemo"
5+
}
6+
aaptOptions {
7+
additionalParameters "--no-version-vectors"
8+
}
9+
}
Loading
Loading

0 commit comments

Comments
 (0)