react-native-readium 1.0.0-alpha.3 → 1.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,6 +16,11 @@ A react-native wrapper for https://readium.org/
16
16
 
17
17
  ## Installation
18
18
 
19
+ #### Prerequisites
20
+
21
+ 1. **iOS**: Requires an iOS target >= `13.0` (see the iOS section for more details).
22
+ 2. **Android**: Requires `compileSdkVersion` >= `31` (see the Android section for more details).
23
+
19
24
  #### Install Module
20
25
 
21
26
  **NPM**
@@ -32,17 +37,14 @@ yarn add react-native-readium
32
37
 
33
38
  #### iOS
34
39
 
35
- ###### Requirements
36
-
37
- This project requires an iOS target >= `13.0`.
38
-
39
- ###### Pod Install
40
-
41
40
  Due to the current state of the `Readium` swift libraries you need to manually
42
41
  update your `Podfile` ([see more on that here](https://github.com/readium/swift-toolkit/issues/38)).
43
42
 
44
43
  ```rb
45
44
  # ./ios/Podfile
45
+ ...
46
+ platform :ios, '13.0'
47
+
46
48
  ...
47
49
 
48
50
  target 'ExampleApp' do
@@ -61,6 +63,21 @@ Finally, install the pods:
61
63
 
62
64
  `pod install`
63
65
 
66
+ #### Android
67
+
68
+ If you're not using `compileSdkVersion` >= 31 you'll need to update that:
69
+
70
+ ```groovy
71
+ // android/build.gradle
72
+ ...
73
+ buildscript {
74
+ ...
75
+ ext {
76
+ ...
77
+ compileSdkVersion = 31
78
+ ...
79
+ ```
80
+
64
81
  ## Usage
65
82
 
66
83
  ```tsx
@@ -136,16 +136,20 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
136
136
 
137
137
  dependencies {
138
138
  // noinspection GradleDynamicVersion
139
- api 'com.facebook.react:react-native:+'
139
+ api "com.facebook.react:react-native:+"
140
140
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
141
141
 
142
142
  // readium deps
143
143
  implementation "com.github.readium.kotlin-toolkit:readium-shared:$readium_version"
144
144
  implementation "com.github.readium.kotlin-toolkit:readium-streamer:$readium_version"
145
- implementation "com.github.readium.kotlin-toolkit:readium-navigator:$readium_version"
145
+ implementation ("com.github.readium.kotlin-toolkit:readium-navigator:$readium_version") {
146
+ // this package doesn't provide audio playback, so remove exoplayer
147
+ // transitive deps to avoid potential collisions with other projects.
148
+ exclude group: "com.google.android.exoplayer"
149
+ }
146
150
 
147
151
  // other deps
148
- implementation 'androidx.core:core-ktx:1.6.0'
152
+ implementation "androidx.core:core-ktx:1.6.0"
149
153
  implementation "androidx.activity:activity-ktx:1.3.1"
150
154
  implementation "androidx.appcompat:appcompat:1.3.1"
151
155
  implementation "androidx.browser:browser:1.3.0"
@@ -178,15 +182,15 @@ dependencies {
178
182
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"
179
183
  // AM NOTE: needs to stay this version for now (June 24,2020)
180
184
  //noinspection GradleDependency
181
- implementation 'org.jsoup:jsoup:1.13.1'
185
+ implementation "org.jsoup:jsoup:1.13.1"
182
186
 
183
187
  // Room database
184
- final room_version = '2.4.0-beta01'
188
+ final room_version = "2.4.0-beta01"
185
189
  implementation "androidx.room:room-runtime:$room_version"
186
190
  implementation "androidx.room:room-ktx:$room_version"
187
191
  annotationProcessor "androidx.room:room-compiler:$room_version"
188
192
 
189
- implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
193
+ implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
190
194
  //noinspection LifecycleAnnotationProcessorWithJava8
191
195
  annotationProcessor "androidx.lifecycle:lifecycle-compiler:2.3.1"
192
196
 
@@ -35,7 +35,8 @@ class ReadiumViewManager(
35
35
 
36
36
  @ReactProp(name = "file")
37
37
  fun setFile(view: ReadiumView, file: ReadableMap) {
38
- val path = file.getString("url")
38
+ val path = (file.getString("url") ?: "")
39
+ .replace("^(file:/+)?(/.*)$".toRegex(), "$2")
39
40
  val locatorMap = file.getMap("initialLocation")
40
41
  var initialLocation: Locator? = null
41
42
 
@@ -44,7 +45,7 @@ class ReadiumViewManager(
44
45
  }
45
46
 
46
47
  runBlocking {
47
- svc.openPublication(path!!, initialLocation) { fragment ->
48
+ svc.openPublication(path, initialLocation) { fragment ->
48
49
  view.addFragment(fragment)
49
50
  }
50
51
  }
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>IDEDidComputeMac32BitWarning</key>
6
+ <true/>
7
+ </dict>
8
+ </plist>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>SchemeUserState</key>
6
+ <dict>
7
+ <key>Readium.xcscheme_^#shared#^_</key>
8
+ <dict>
9
+ <key>orderHint</key>
10
+ <integer>0</integer>
11
+ </dict>
12
+ </dict>
13
+ </dict>
14
+ </plist>
@@ -9,6 +9,10 @@ import R2Navigator
9
9
  class ReadiumView : UIView, Loggable {
10
10
  var readerService: ReaderService = ReaderService()
11
11
  var readerViewController: ReaderViewController?
12
+ var viewController: UIViewController? {
13
+ let viewController = sequence(first: self, next: { $0.next }).first(where: { $0 is UIViewController })
14
+ return viewController as? UIViewController
15
+ }
12
16
  private var subscriptions = Set<AnyCancellable>()
13
17
 
14
18
  @objc var file: NSDictionary? = nil {
@@ -138,11 +142,12 @@ class ReadiumView : UIView, Loggable {
138
142
  self.updateUserSettings(settings)
139
143
  }
140
144
 
141
- let rootViewController = UIApplication.shared.delegate?.window??.rootViewController
142
- rootViewController?.addChild(readerViewController!)
143
145
  readerViewController!.view.frame = self.superview!.frame
146
+ self.viewController!.addChild(readerViewController!)
144
147
  let rootView = self.readerViewController!.view!
145
148
  self.addSubview(rootView)
149
+ self.viewController!.addChild(readerViewController!)
150
+ self.readerViewController!.didMove(toParent: self.viewController!)
146
151
 
147
152
  // bind the reader's view to be constrained to its parent
148
153
  rootView.translatesAutoresizingMaskIntoConstraints = false
@@ -150,7 +155,5 @@ class ReadiumView : UIView, Loggable {
150
155
  rootView.bottomAnchor.constraint(equalTo: self.bottomAnchor).isActive = true
151
156
  rootView.leftAnchor.constraint(equalTo: self.leftAnchor).isActive = true
152
157
  rootView.rightAnchor.constraint(equalTo: self.rightAnchor).isActive = true
153
-
154
- self.readerViewController!.didMove(toParent: rootViewController)
155
158
  }
156
159
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-readium",
3
- "version": "1.0.0-alpha.3",
3
+ "version": "1.0.0-alpha.6",
4
4
  "description": "A react-native wrapper for https://readium.org/",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",