Skip to content

Commit 2d8f16d

Browse files
author
PSPDFKit
committed
Release 3.7.2
1 parent 1a04ff4 commit 2d8f16d

File tree

15 files changed

+318
-97
lines changed

15 files changed

+318
-97
lines changed

CHANGELOG.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
## Newest Release
22

3-
### 3.7.1 - 18 Oct 2023
3+
### 3.7.2 - 12 Jan 2024
44

5-
- Fixed issue where iOS Appstore upload fails due to PSPDFKit Flutter missing "CFBundleShortVersionString" key. (#42166)
6-
- Fixed issue where Plugin returned "Document is missing or invalid" during pdfViewControllerWillDismiss events. (#42255)
5+
- Adds `flutterPdfFragmentAdded` callback for Android. (#42631)
6+
- Updates FlutterAppCompatActivity to Support Flutter 3.16.0. (#42767)
77

88
## Previous Releases
99

10+
### 3.7.1 - 18 Oct 2023
11+
12+
- Fixes issue where iOS Appstore upload fails due to PSPDFKit Flutter missing "CFBundleShortVersionString" key. (#42166)
13+
- Fixes issue where Plugin returned "Document is missing or invalid" during pdfViewControllerWillDismiss events. (#42255)
14+
1015
### 3.7.0 - 07 Sep 2023
1116

1217
- Adds annotation preset customization. (#41669)

android/src/main/java/com/pspdfkit/flutter/pspdfkit/EventDispatcher.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ public void notifyActivityOnPause() {
5252
sendEvent("flutterPdfActivityOnPause");
5353
}
5454

55-
55+
public void notifyPdfFragmentAdded() {
56+
sendEvent("flutterPdfFragmentAdded");
57+
}
5658

5759
public void notifyInstantSyncStarted(String documentId) {
5860
sendEvent("pspdfkitInstantSyncStarted", documentId);
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.pspdfkit.flutter.pspdfkit
2+
3+
import android.content.Context
4+
import androidx.fragment.app.Fragment
5+
import androidx.fragment.app.FragmentManager
6+
7+
class FlutterPdfUiFragmentCallbacks: FragmentManager.FragmentLifecycleCallbacks() {
8+
9+
override fun onFragmentAttached(
10+
fm: FragmentManager,
11+
f: Fragment,
12+
context: Context
13+
) {
14+
if (f.tag?.contains("PSPDFKit.Fragment") == true) {
15+
EventDispatcher.getInstance().notifyPdfFragmentAdded()
16+
}
17+
}
18+
}

android/src/main/java/com/pspdfkit/flutter/pspdfkit/PSPDFKitView.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ internal class PSPDFKitView(
7575
.build()
7676
}
7777
}
78+
getFragmentActivity(context).supportFragmentManager.registerFragmentLifecycleCallbacks(FlutterPdfUiFragmentCallbacks(), true)
7879

7980
fragmentContainerView?.let {
8081
it.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {

android/src/main/java/io/flutter/embedding/android/FlutterAppCompatActivity.java

Lines changed: 211 additions & 52 deletions
Large diffs are not rendered by default.

example/ios/Podfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ end
2828
require File.expand_path(File.join("packages", "flutter_tools", "bin", "podhelper"), flutter_root)
2929

3030
flutter_ios_podfile_setup
31+
host_cpu = RbConfig::CONFIG["host_cpu"]
3132

3233
target "Runner" do
3334
flutter_install_all_ios_pods __dir__
@@ -39,5 +40,10 @@ end
3940
post_install do |installer|
4041
installer.pods_project.targets.each do |target|
4142
flutter_additional_ios_build_settings(target)
43+
target.build_configurations.each do |target_config|
44+
if host_cpu.eql?("x86_64")
45+
target_config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
46+
end
47+
end
4248
end
4349
end

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
97C146E61CF9000F007C117D /* Project object */ = {
165165
isa = PBXProject;
166166
attributes = {
167-
LastUpgradeCheck = 1300;
167+
LastUpgradeCheck = 1430;
168168
ORGANIZATIONNAME = "The Chromium Authors";
169169
TargetAttributes = {
170170
97C146ED1CF9000F007C117D = {

example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1300"
3+
LastUpgradeVersion = "1430"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

example/lib/main.dart

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,17 @@ class MyApp extends StatelessWidget {
130130

131131
@override
132132
Widget build(BuildContext context) {
133-
return const MaterialApp(home: HomePage());
133+
return MaterialApp(
134+
home: const HomePage(),
135+
theme: ThemeData(
136+
useMaterial3: false,
137+
primaryColor: Colors.blue,
138+
appBarTheme: const AppBarTheme(
139+
backgroundColor: Colors.blue,
140+
foregroundColor: Colors.white,
141+
),
142+
),
143+
);
134144
}
135145
}
136146

@@ -142,13 +152,7 @@ class HomePage extends StatefulWidget {
142152
}
143153

144154
class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
145-
static final ThemeData lightTheme =
146-
ThemeData(primaryColor: Colors.black, dividerColor: Colors.grey[400]);
147-
148-
static final ThemeData darkTheme =
149-
ThemeData(primaryColor: Colors.white, dividerColor: Colors.grey[800]);
150155
String _frameworkVersion = '';
151-
ThemeData currentTheme = lightTheme;
152156

153157
void showDocument() async {
154158
final extractedDocument = await extractAsset(context, _documentPath);
@@ -576,18 +580,6 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
576580
super.dispose();
577581
}
578582

579-
@override
580-
void didChangePlatformBrightness() {
581-
currentTheme =
582-
WidgetsBinding.instance.window.platformBrightness == Brightness.light
583-
? lightTheme
584-
: darkTheme;
585-
setState(() {
586-
build(context);
587-
});
588-
super.didChangePlatformBrightness();
589-
}
590-
591583
String frameworkVersion() {
592584
return '$_pspdfkitFor $_frameworkVersion\n';
593585
}
@@ -637,6 +629,14 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
637629
print('pdfViewControllerDidDismissHandler');
638630
}
639631

632+
void flutterPdfFragmentAdded() {
633+
print('flutterPdfFragmentAdded');
634+
}
635+
636+
void pspdfkitDocumentLoaded(String? documentId) {
637+
print('pspdfkitDocumentLoaded: $documentId');
638+
}
639+
640640
@override
641641
Widget build(BuildContext context) {
642642
Pspdfkit.flutterPdfActivityOnPause =
@@ -645,17 +645,16 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
645645
() => pdfViewControllerWillDismissHandler();
646646
Pspdfkit.pdfViewControllerDidDismiss =
647647
() => pdfViewControllerDidDismissHandler();
648-
649-
currentTheme = MediaQuery.of(context).platformBrightness == Brightness.light
650-
? lightTheme
651-
: darkTheme;
648+
Pspdfkit.flutterPdfFragmentAdded = () => flutterPdfFragmentAdded();
649+
Pspdfkit.pspdfkitDocumentLoaded =
650+
(documentId) => pspdfkitDocumentLoaded(documentId);
652651

653652
final listTiles = <Widget>[
654653
Container(
655654
color: Colors.grey[200],
656655
padding: const EdgeInsets.fromLTRB(20, 20, 20, 20),
657656
child: Text(_pspdfkitWidgetExamples,
658-
style: currentTheme.textTheme.headline4?.copyWith(
657+
style: Theme.of(context).textTheme.headline4?.copyWith(
659658
fontSize: _fontSize, fontWeight: FontWeight.bold))),
660659
ListTile(
661660
title: const Text(_basicExample),
@@ -738,7 +737,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
738737
color: Colors.grey[200],
739738
padding: const EdgeInsets.fromLTRB(20, 20, 20, 20),
740739
child: Text(_pspdfkitGlobalPluginExamples,
741-
style: currentTheme.textTheme.headline4?.copyWith(
740+
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
742741
fontSize: _fontSize, fontWeight: FontWeight.bold))),
743742
ListTile(
744743
title: const Text(_basicExampleGlobal),
@@ -779,17 +778,15 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
779778
];
780779
return Scaffold(
781780
appBar: AppBar(title: const Text(_pspdfkitFlutterPluginTitle)),
782-
body: ExampleListView(currentTheme, frameworkVersion(), listTiles));
781+
body: ExampleListView(frameworkVersion(), listTiles));
783782
}
784783
}
785784

786785
class ExampleListView extends StatelessWidget {
787-
final ThemeData themeData;
788786
final String frameworkVersion;
789787
final List<Widget> widgets;
790788

791-
const ExampleListView(this.themeData, this.frameworkVersion, this.widgets,
792-
{Key? key})
789+
const ExampleListView(this.frameworkVersion, this.widgets, {Key? key})
793790
: super(key: key);
794791

795792
@override
@@ -800,10 +797,10 @@ class ExampleListView extends StatelessWidget {
800797
padding: const EdgeInsets.only(top: 24),
801798
child: Center(
802799
child: Text(frameworkVersion,
803-
style: themeData.textTheme.headline4?.copyWith(
800+
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
804801
fontSize: _fontSize,
805802
fontWeight: FontWeight.bold,
806-
color: themeData.primaryColor)))),
803+
color: Theme.of(context).primaryColor)))),
807804
Expanded(
808805
child: ListView.separated(
809806
itemCount: widgets.length,

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: pspdfkit_example
22
description: Demonstrates how to use the pspdfkit plugin.
3-
version: 3.7.1
3+
version: 3.7.2
44
homepage: https://pspdfkit.com/
55
environment:
66
sdk: '>=2.17.0 <4.0.0'

0 commit comments

Comments
 (0)