Skip to content

Commit a360c55

Browse files
committed
Release 0.2.2+79
1 parent b97e47b commit a360c55

5 files changed

Lines changed: 161 additions & 22 deletions

File tree

.github/docs/release-notes.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
## PPM Build 77
1+
## PPM Build 79
22

3-
- **Search Questions** is now available! Features:
4-
- Filtering by subjects and / or by levels
5-
- Checking answers with one click
6-
- Previewing original question papers and mark schemes
7-
- Enhances application performance
8-
- Fixes update check dialog
3+
- Adds paper preview in **Checkout** page.
94

105
**Note:** Past Paper Master is still in beta test, and there are still many features to be added and bugs to be fixed. Please report any issues you encounter to SCIE.DEV. Thank you for your support!
116

@@ -15,9 +10,9 @@ See [commit history](https://github.com/SCIEDEV/PastPaperMaster/commits/main) fo
1510

1611
Currently, none of the binaries are signed due to a lack of developer certificate. (which is expensive!)
1712

18-
- `ppm-macos-v0.2.1-beta+77.tar.gz` macOS Universal application.
13+
- `ppm-macos-v0.2.2-beta+79.tar.gz` macOS Universal application.
1914
- Since this application is not signed, you may need to click the <kbd>Open anyway</kbd> button in System Settings » Privacy & Security.
2015
- Opening this app anyway should be secure since this app is already open source; if you are still concerned of security, just build this app from source and use that binary.
21-
- `ppm-windows-v0.2.1-beta+77.zip` Windows x64 application.
16+
- `ppm-windows-v0.2.2-beta+79.zip` Windows x64 application.
2217
- Again, this application is not signed. You may see Windows Defender warning about this application.
23-
- `ppm-linux-v0.2.1-beta+77.tar.gz` Linux x64 application.
18+
- `ppm-linux-v0.2.2-beta+79.tar.gz` Linux x64 application.

lib/core/global.dart

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,21 @@ late BuildContext globalContext;
88
const String kAppStage = 'Beta Version';
99

1010
const String kReleaseNotes = '''
11-
- **Search Questions** is now available! Features:
12-
- Filtering by subjects and / or by levels
13-
- Checking answers with one click
14-
- Previewing original question papers and mark schemes
15-
- Enhances application performance
16-
- Fixes update check dialog
11+
- Adds paper preview in **Checkout** page.
1712
1813
**Note:** Past Paper Master is still in beta test, and there are still many features to be added and bugs to be fixed. Please report any issues you encounter to SCIE.DEV. Thank you for your support!
1914
2015
See [full changelog](https://github.com/SCIEDEV/PastPaperMaster/releases) and [commit history](https://github.com/SCIEDEV/PastPaperMaster/commits/main/) for changes in previous versions.
2116
''';
2217

2318
const String kAppStageShort = 'β ';
24-
const String kVersionTag = 'v0.2.1-beta+77';
19+
const String kVersionTag = 'v0.2.2-beta+79';
2520
const int kMajorVersion = 0;
2621
const int kMinorVersion = 2;
27-
const int kPatchVersion = 1;
28-
const int kBuildNumber = 77;
22+
const int kPatchVersion = 2;
23+
const int kBuildNumber = 79;
2924
const int kDatabaseVersion = 1;
30-
const String kLastCommitHash = '95bd791b0de68adebcea532880ca21dadced0bb4';
25+
const String kLastCommitHash = 'b97e47be0c1e0b1839708acde87420b585ec4e16';
3126

3227
const String kBundledDataPath = 'assets/json/';
3328
const String kLocalDataPath = '/json/';

lib/core/provider.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,26 @@ class CheckoutItem {
116116

117117
CheckoutItem(this.name, this.path);
118118

119+
String getItemUrl() {
120+
final StringBuffer url = StringBuffer("https://papers.gceguide.com/");
121+
if (path.isEmpty) {
122+
return url.toString();
123+
}
124+
if (path[0] == "IGCSE") {
125+
url.write("Cambridge%20IGCSE/");
126+
} else if (path[0] == "A(S) Level") {
127+
url.write("A%20Levels/");
128+
} else {
129+
// Hopefully we won't reach here :(
130+
throw Exception("Invalid document path: ${path[0]}");
131+
}
132+
for (var i = 1; i < path.length; i++) {
133+
url.write("${path[i]}/");
134+
}
135+
url.write(name);
136+
return url.toString();
137+
}
138+
119139
@override
120140
bool operator ==(Object other) =>
121141
identical(this, other) || other is CheckoutItem && name == other.name;

lib/pages/checkout.dart

Lines changed: 130 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import 'package:flutter/material.dart';
2+
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
23
import 'package:past_paper_master/components/button.dart';
34
import 'package:past_paper_master/components/dialogs.dart';
45
import 'package:past_paper_master/core/box_decorations.dart';
56
import 'package:past_paper_master/core/colors.dart';
67
import 'package:past_paper_master/core/global.dart';
78
import 'package:past_paper_master/core/provider.dart';
89
import 'package:past_paper_master/core/textstyle.dart';
10+
import 'package:pdfrx/pdfrx.dart';
911
import 'package:provider/provider.dart';
1012
import 'package:rive/rive.dart';
1113

@@ -168,6 +170,28 @@ class CheckoutEntryRow extends StatelessWidget {
168170
style: MTextStyles.smRgGrey500,
169171
),
170172
),
173+
SizedBox(
174+
width: 28,
175+
height: 28,
176+
child: RawMaterialButton(
177+
onPressed: () {
178+
showPdfPreview(
179+
context,
180+
item.name,
181+
item.getItemUrl(),
182+
);
183+
},
184+
shape: const RoundedRectangleBorder(
185+
borderRadius: BorderRadius.all(Radius.circular(4)),
186+
),
187+
child: Icon(
188+
FeatherIcons.eye,
189+
color: MColors.grey.shade500,
190+
size: 16,
191+
),
192+
),
193+
),
194+
const SizedBox(width: 4),
171195
if (isSelected)
172196
Icon(
173197
Icons.square_rounded,
@@ -185,6 +209,111 @@ class CheckoutEntryRow extends StatelessWidget {
185209
),
186210
);
187211
}
212+
213+
void showPdfPreview(
214+
BuildContext context,
215+
String viewingPdfName,
216+
String viewingPdfUrl,
217+
) {
218+
viewingPdfName = 'File Preview · $viewingPdfName';
219+
Navigator.push(
220+
context,
221+
MaterialPageRoute<void>(
222+
builder: (BuildContext context) {
223+
return Scaffold(
224+
appBar: AppBar(
225+
title: Text(viewingPdfName),
226+
elevation: 8.0,
227+
shadowColor: const Color(0x19101828),
228+
titleTextStyle: MTextStyles.lgMdGrey900,
229+
shape: Border(
230+
bottom: BorderSide(
231+
color: MColors.grey.shade200,
232+
),
233+
),
234+
backgroundColor: MColors.white,
235+
// add a back button
236+
leading: RawMaterialButton(
237+
onPressed: () {
238+
Navigator.pop(context);
239+
},
240+
child: Icon(
241+
FeatherIcons.chevronLeft,
242+
color: MColors.grey.shade700,
243+
size: 24,
244+
),
245+
),
246+
centerTitle: false,
247+
),
248+
body: PdfViewer.uri(
249+
params: PdfViewerParams(
250+
enableTextSelection: true,
251+
maxScale: 10.0,
252+
backgroundColor: MColors.grey.shade50,
253+
errorBannerBuilder: (context, error, stackTrace, documentRef) =>
254+
Container(
255+
decoration: BoxDecoration(
256+
color: MColors.white,
257+
borderRadius: const BorderRadius.only(
258+
bottomLeft: Radius.circular(8),
259+
bottomRight: Radius.circular(8),
260+
),
261+
border: Border.all(
262+
color: MColors.grey.shade200,
263+
strokeAlign: BorderSide.strokeAlignOutside,
264+
),
265+
),
266+
padding: const EdgeInsets.symmetric(
267+
vertical: 48,
268+
horizontal: 24,
269+
),
270+
child: Column(
271+
mainAxisAlignment: MainAxisAlignment.center,
272+
children: [
273+
const SizedBox(
274+
width: 64,
275+
height: 64,
276+
child: RiveAnimation.asset(
277+
'assets/rive/empty_folder.riv',
278+
artboard: 'empty download',
279+
fit: BoxFit.fitWidth,
280+
),
281+
),
282+
const SizedBox(
283+
height: 8,
284+
width: double.infinity,
285+
),
286+
Text(
287+
'Cannot view document',
288+
style: MTextStyles.mdMdGrey900,
289+
),
290+
const SizedBox(
291+
height: 4,
292+
width: double.infinity,
293+
),
294+
Text(
295+
'The document is not a PDF, or a network error occurred.',
296+
style: MTextStyles.smRgGrey500,
297+
),
298+
Text(
299+
'If you believe that this should not have happened, screenshot this page and report it to SCIE.DEV.',
300+
style: MTextStyles.smRgGrey500,
301+
),
302+
Text(
303+
error.toString(),
304+
style: MTextStyles.smRgGrey200,
305+
),
306+
],
307+
),
308+
),
309+
),
310+
Uri.parse(viewingPdfUrl),
311+
),
312+
);
313+
},
314+
),
315+
);
316+
}
188317
}
189318

190319
class CheckoutTableHeader extends StatelessWidget {
@@ -217,7 +346,7 @@ class CheckoutTableHeader extends StatelessWidget {
217346
style: MTextStyles.xsMdGrey500,
218347
),
219348
),
220-
const SizedBox(width: 16),
349+
const SizedBox(width: 48),
221350
],
222351
),
223352
);

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Past Paper Master.
33

44
publish_to: "none"
55

6-
version: 0.2.1+77
6+
version: 0.2.2+79
77

88
environment:
99
sdk: ">=2.18.2 <3.0.0"

0 commit comments

Comments
 (0)