@papyrus-sdk/engine-native 0.2.22-beta.4 → 0.2.22-beta.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.
@@ -1,6 +1,9 @@
1
+ require 'json'
2
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
3
+
1
4
  Pod::Spec.new do |s|
2
5
  s.name = 'PapyrusNativeEngine'
3
- s.version = '0.2.12'
6
+ s.version = package['version']
4
7
  s.summary = 'Papyrus Native Engine (PDFKit)'
5
8
  s.homepage = 'https://solrachix.github.io/Papyrus/'
6
9
  s.license = { :type => 'MIT' }
@@ -23,17 +26,18 @@ Pod::Spec.new do |s|
23
26
  archive_version_details.c archive_virtual.c
24
27
  ]
25
28
  s.source_files = [
26
- '**/*.{h,m,mm,swift}',
27
- '../vendor/libarchive/PapyrusComicArchive.{h,cpp}',
28
- '../vendor/libarchive/config/PapyrusArchiveConfig.h',
29
- '../vendor/libarchive/libarchive/*.h',
30
- ] + archive_sources.map { |file| "../vendor/libarchive/libarchive/#{file}" }
29
+ 'ios/**/*.{h,m,mm,swift}',
30
+ 'vendor/libarchive/PapyrusComicArchive.{h,cpp}',
31
+ 'vendor/libarchive/config/PapyrusArchiveConfig.h',
32
+ 'vendor/libarchive/libarchive/*.h',
33
+ ] + archive_sources.map { |file| "vendor/libarchive/libarchive/#{file}" }
31
34
  s.frameworks = 'PDFKit', 'PencilKit'
32
35
  s.libraries = 'z'
33
36
  s.requires_arc = true
34
37
  s.swift_version = '5.0'
35
38
  s.pod_target_xcconfig = {
36
- 'HEADER_SEARCH_PATHS' => '$(inherited) "$(PODS_TARGET_SRCROOT)/../vendor/libarchive" "$(PODS_TARGET_SRCROOT)/../vendor/libarchive/libarchive" "$(PODS_TARGET_SRCROOT)/../vendor/libarchive/config"',
39
+ 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
40
+ 'HEADER_SEARCH_PATHS' => '$(inherited) "$(PODS_TARGET_SRCROOT)/vendor/libarchive" "$(PODS_TARGET_SRCROOT)/vendor/libarchive/libarchive" "$(PODS_TARGET_SRCROOT)/vendor/libarchive/config"',
37
41
  'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) PLATFORM_CONFIG_H=\\"PapyrusArchiveConfig.h\\"',
38
42
  }
39
43
 
@@ -568,7 +568,7 @@ public class PapyrusNativeEngineModule extends ReactContextBaseJavaModule {
568
568
  }
569
569
 
570
570
  @ReactMethod
571
- public void getPageIndex(String engineId, Object dest, Promise promise) {
571
+ public void getPageIndex(String engineId, ReadableMap dest, Promise promise) {
572
572
  promise.resolve(null);
573
573
  }
574
574
 
@@ -35,10 +35,6 @@ NS_ASSUME_NONNULL_BEGIN
35
35
 
36
36
  NS_ASSUME_NONNULL_END
37
37
 
38
- @implementation PapyrusNativeEngine
39
-
40
- RCT_EXPORT_MODULE(PapyrusNativeEngine)
41
-
42
38
  static NSMutableDictionary<NSString *, NSNumber *> *PapyrusPageViewTags;
43
39
 
44
40
  static NSString *PapyrusViewKeyFor(NSString *engineId, NSInteger pageIndex) {
@@ -284,6 +280,10 @@ static NSArray<NSDictionary *> *PapyrusBuildOutlineItems(PDFOutline *outline, PD
284
280
  return items;
285
281
  }
286
282
 
283
+ @implementation PapyrusNativeEngine
284
+
285
+ RCT_EXPORT_MODULE(PapyrusNativeEngine)
286
+
287
287
  + (BOOL)requiresMainQueueSetup {
288
288
  return YES;
289
289
  }
@@ -411,9 +411,9 @@ RCT_EXPORT_METHOD(loadComic:(NSString *)engineId
411
411
  BOOL opened = papyrus_comic_open(engineId.UTF8String, (int)generation, path.UTF8String, cache.UTF8String, &count, message, sizeof(message));
412
412
  if (opened && ownsPath) PapyrusRememberComicSource(path, engineId, generation);
413
413
  else if (!opened && ownsPath) [[NSFileManager defaultManager] removeItemAtPath:path error:nil];
414
+ NSString *reason = message[0] ? [NSString stringWithUTF8String:message] : @"Unable to open comic archive";
414
415
  dispatch_async(dispatch_get_main_queue(), ^{
415
416
  if (!opened) {
416
- NSString *reason = message[0] ? [NSString stringWithUTF8String:message] : @"Unable to open comic archive";
417
417
  reject(@"papyrus_comic_load_failed", reason, nil);
418
418
  } else {
419
419
  resolve(@{@"pageCount": @(count)});
@@ -876,7 +876,10 @@ RCT_EXPORT_METHOD(renderPage:(NSString *)engineId
876
876
  target:(nonnull NSNumber *)target
877
877
  scale:(CGFloat)scale
878
878
  zoom:(CGFloat)zoom
879
- rotation:(NSInteger)rotation) {
879
+ rotation:(NSInteger)rotation
880
+ requestId:(NSString *)requestId
881
+ telemetryContext:(NSDictionary *)telemetryContext) {
882
+ #pragma unused(requestId, telemetryContext)
880
883
  dispatch_async(dispatch_get_main_queue(), ^{
881
884
  PDFDocument *document = [[PapyrusEngineStore shared] documentForEngine:engineId];
882
885
  UIView *view = [self.bridge.uiManager viewForReactTag:target];
@@ -102,7 +102,7 @@
102
102
  NSUInteger currentGeneration = [self generationForDocument:document];
103
103
  if (lease.generation != currentGeneration) return NO;
104
104
  PapyrusPageRotationRecord *record =
105
- [self.recordsForDocument:document create:NO][@(pageIndex)];
105
+ [[self recordsForDocument:document create:NO] objectForKey:@(pageIndex)];
106
106
  if (!record || record.generation != currentGeneration) return NO;
107
107
  return [record.leaseTokens containsObject:lease.token];
108
108
  }
@@ -143,7 +143,7 @@
143
143
  }
144
144
 
145
145
  PapyrusPageRotationRecord *record =
146
- [self.recordsForDocument:document create:NO][@(pageIndex)];
146
+ [[self recordsForDocument:document create:NO] objectForKey:@(pageIndex)];
147
147
  NSInteger effectiveRotation =
148
148
  [self normalizeRotation:record.originalRotation + viewerRotation];
149
149
  page.rotation = (int)effectiveRotation;
@@ -164,7 +164,7 @@
164
164
  NSAssert(NSThread.isMainThread, @"PDF page rotations must be changed on the main thread");
165
165
  @synchronized (self) {
166
166
  NSDictionary<NSNumber *, PapyrusPageRotationRecord *> *records =
167
- [[self.recordsForDocument:document create:NO] copy];
167
+ [[self recordsForDocument:document create:NO] copy];
168
168
  [records enumerateKeysAndObjectsUsingBlock:^(NSNumber *pageIndex,
169
169
  PapyrusPageRotationRecord *record,
170
170
  __unused BOOL *stop) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@papyrus-sdk/engine-native",
3
- "version": "0.2.22-beta.4",
3
+ "version": "0.2.22-beta.6",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "papyrus",
@@ -32,7 +32,7 @@
32
32
  "android/consumer-rules.pro",
33
33
  "ios/*.h",
34
34
  "ios/*.m",
35
- "ios/*.podspec",
35
+ "*.podspec",
36
36
  "vendor/libarchive",
37
37
  "third_party_licenses",
38
38
  "react-native.config.js"
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
2
  project: {
3
3
  ios: {
4
- podspecPath: 'ios/PapyrusNativeEngine.podspec',
4
+ podspecPath: 'PapyrusNativeEngine.podspec',
5
5
  },
6
6
  android: {
7
7
  sourceDir: 'android',
@@ -5,7 +5,7 @@ This source snapshot is libarchive **v3.8.9**, pinned to upstream commit
5
5
  `https://github.com/libarchive/libarchive`.
6
6
 
7
7
  Papyrus compiles only the read-side source subset listed in both
8
- `android/src/main/cpp/CMakeLists.txt` and `ios/PapyrusNativeEngine.podspec`.
8
+ `android/src/main/cpp/CMakeLists.txt` and `PapyrusNativeEngine.podspec`.
9
9
  The public C++ adapter in this directory filters comic archive entries,
10
10
  orders them naturally, and extracts one selected image at a time to a bounded
11
11
  cache. It does not write or modify archives.
@@ -2,6 +2,12 @@
2
2
  #define PAPYRUS_ARCHIVE_CONFIG_H
3
3
  #define __LIBARCHIVE_CONFIG_H_INCLUDED 1
4
4
 
5
+ /* Import permission macros directly rather than relying on transitive headers. */
6
+ #if defined(__APPLE__)
7
+ #include <sys/types.h>
8
+ #include <sys/stat.h>
9
+ #endif
10
+
5
11
  /* Minimal POSIX configuration for the libarchive reader subset used by Papyrus. */
6
12
  #define HAVE_INTTYPES_H 1
7
13
  #define HAVE_STDINT_H 1