Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,15 @@ jobs:
java-version: 21
- run: flutter build apk --debug --flavor sideload
- run: flutter build apk --debug --flavor play

ios:
# Proves the iOS project compiles (Swift, Xcode project, plugins). Unsigned: signing happens on the owner's Mac.
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- run: flutter pub get
- run: flutter build ios --debug --no-codesign
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
- iPhone: Pagemark now runs on iOS (reading and backup reminders, Face ID, barcode scanning). The app-switcher preview is covered while the Locked tab is open. iPhone only for now (no iPad layout yet).

### Changed
- iPhone: lock screens say Touch ID on phones that have it instead of Face ID; the home-screen widget page and the "Open security settings" button are hidden on iPhone, where they cannot work yet.

### Fixed
- iPhone: after restoring a backup, Pagemark explains how to close and reopen it, because iOS apps cannot close themselves.

## [1.1.1] - 2026-10-18

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion assets/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Go to Settings → Notifications. Your phone may ask if Pagemark can send notifi
- **Remind me to back up** reminds you every week, 2 weeks or month to save a copy of your library. Choose **How often**.

## Home-screen widget
Go to Settings → Widget and shortcuts to choose whether the widget shows book titles. To add it, press and hold an empty spot on your home screen, tap **Widgets**, find **Pagemark** and tap **Add**. It shows the books you are reading and your yearly goal. It never shows your locked books.
The widget is on Android only for now. Go to Settings → Widget and shortcuts to choose whether the widget shows book titles. To add it, press and hold an empty spot on your home screen, tap **Widgets**, find **Pagemark** and tap **Add**. It shows the books you are reading and your yearly goal. It never shows your locked books.

## Quick ways in
Press and hold the Pagemark icon on your home screen for two shortcuts: **Add book** and **Reading now** (only the books you are reading).
Expand Down
5 changes: 5 additions & 0 deletions docs/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ Running-timer notification that shows on the lock screen; timer without logging

---

### Post-publish: GitHub cleanup (after the first App Store / Play release)
- One `main` branch for every platform and store; Android `sideload`/`play` are flavors, iOS is `flutter build ipa`. No long-lived per-store branches; releases are tags (`vX.Y.Z`, `vX.Y.Z-ios` if iOS needs its own build).
- Merge `ios-first-build` (with the release fixes) into `main`, then delete it and `Pagemark-APK`; merge or close `privacy-page`.
- Protect `main`: pull requests only, CI required (both Android flavors + an iOS `--no-codesign` build). Turn on "Automatically delete head branches".

## 4. Working away from home

### Get a working checkout (any OS)
Expand Down
16 changes: 10 additions & 6 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
8482BBE900D8D694966A2A06 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3508BB1B8274BA89810BB1D2 /* Pods_Runner.framework */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
A1B2C3D41F00000000000002 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = A1B2C3D41F00000000000001 /* PrivacyInfo.xcprivacy */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
C05E3ED2EA0D87006E4BE082 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 281E730E93B50230414F50BD /* Pods_RunnerTests.framework */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -67,6 +68,7 @@
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
A1B2C3D41F00000000000001 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9989FA84709C9A8E176CB61E /* Pods-Runner.debug-sideload.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug-sideload.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug-sideload.xcconfig"; sourceTree = "<group>"; };
A815C38AF803120FE072AA59 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -175,6 +177,7 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
97C147021CF9000F007C117D /* Info.plist */,
A1B2C3D41F00000000000001 /* PrivacyInfo.xcprivacy */,
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
Expand Down Expand Up @@ -289,6 +292,7 @@
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
A1B2C3D41F00000000000002 /* PrivacyInfo.xcprivacy in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -529,7 +533,7 @@
SDKROOT = iphoneos;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SUPPORTED_PLATFORMS = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
VALIDATE_PRODUCT = YES;
};
name = Profile;
Expand Down Expand Up @@ -653,7 +657,7 @@
SDKROOT = iphoneos;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SUPPORTED_PLATFORMS = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
VALIDATE_PRODUCT = YES;
};
name = "Profile-sideload";
Expand Down Expand Up @@ -728,7 +732,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
};
Expand Down Expand Up @@ -782,7 +786,7 @@
SUPPORTED_PLATFORMS = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand Down Expand Up @@ -919,7 +923,7 @@
SUPPORTED_PLATFORMS = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
VALIDATE_PRODUCT = YES;
};
name = "Release-sideload";
Expand Down Expand Up @@ -994,7 +998,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
};
name = "Debug-sideload";
};
Expand Down
31 changes: 31 additions & 0 deletions ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,47 @@ import UIKit

@main
@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate {
/// Set from Dart (`Secure.set`) while the locked library is on screen.
private var secure = false
private let coverTag = 0x5061_6765 // "Page"

override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
// lets flutter_local_notifications show reminders while Pagemark is open
UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
// iOS has no FLAG_SECURE: cover the window before the app-switcher snapshot is taken
NotificationCenter.default.addObserver(self, selector: #selector(sceneWillDeactivate(_:)), name: UIScene.willDeactivateNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(sceneDidActivate(_:)), name: UIScene.didActivateNotification, object: nil)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}

func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
guard let registrar = engineBridge.pluginRegistry.registrar(forPlugin: "PagemarkSecure") else { return }
let channel = FlutterMethodChannel(name: "pagemark/secure", binaryMessenger: registrar.messenger())
channel.setMethodCallHandler { [weak self] call, result in
guard call.method == "setSecure", let on = call.arguments as? Bool else {
result(FlutterMethodNotImplemented)
return
}
self?.secure = on
result(nil)
}
}

@objc private func sceneWillDeactivate(_ note: Notification) {
guard secure, let window = (note.object as? UIWindowScene)?.windows.first(where: { $0.isKeyWindow }) ?? (note.object as? UIWindowScene)?.windows.first,
window.viewWithTag(coverTag) == nil else { return }
let cover = UIView(frame: window.bounds)
cover.tag = coverTag
cover.backgroundColor = .systemBackground
cover.autoresizingMask = [.flexibleWidth, .flexibleHeight]
window.addSubview(cover)
}

@objc private func sceneDidActivate(_ note: Notification) {
(note.object as? UIWindowScene)?.windows.forEach { $0.viewWithTag(coverTag)?.removeFromSuperview() }
}
}
9 changes: 2 additions & 7 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
Expand Down Expand Up @@ -65,12 +67,5 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
31 changes: 31 additions & 0 deletions ios/Runner/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyTracking</key>
<false/>
<key>NSPrivacyTrackingDomains</key>
<array/>
<key>NSPrivacyCollectedDataTypes</key>
<array/>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
</array>
</dict>
</array>
</dict>
</plist>
11 changes: 11 additions & 0 deletions lib/lock.dart
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,17 @@ class LockService {
}
}

/// iOS only: true when the device unlocks with Touch ID rather than Face ID, so screens name the right one.
static Future<bool> hasTouchId() async {
if (defaultTargetPlatform != TargetPlatform.iOS) return false;
try {
final types = await _auth.getAvailableBiometrics();
return types.contains(BiometricType.fingerprint) && !types.contains(BiometricType.face);
} catch (_) {
return false;
}
}

/// Does the phone offer a *strong* biometric (fingerprint)? Face unlock on many Android phones is only "weak".
/// iOS never reports strong/weak: Face ID and Touch ID are both strong, and come back as face or fingerprint.
static Future<bool> strongBiometricAvailable() async {
Expand Down
4 changes: 3 additions & 1 deletion lib/lock_ui.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart' show defaultTargetPlatform;
import 'package:flutter/services.dart';
import 'lock.dart';
import 'widgets.dart';
Expand Down Expand Up @@ -291,7 +292,8 @@ class _LockGateState extends State<LockGate> {
textAlign: TextAlign.center,
),
const SizedBox(height: 12),
FilledButton(onPressed: openSecuritySettings, child: const Text('Open security settings')),
// iOS has no way to open its passcode settings from an app
if (defaultTargetPlatform == TargetPlatform.android) FilledButton(onPressed: openSecuritySettings, child: const Text('Open security settings')),
TextButton(onPressed: _load, child: const Text('Try again')),
] else
FilledButton.icon(onPressed: _device, icon: Icon(biometricIcon), label: const Text('Unlock')),
Expand Down
3 changes: 3 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import 'app_lock.dart';
import 'backup_reminder.dart';
import 'covers.dart';
import 'export.dart';
import 'lock.dart';
import 'log.dart';
import 'notifier.dart';
import 'privacy.dart';
import 'db.dart';
import 'themes.dart';
import 'ui.dart';
import 'widgets.dart';

final db = AppDb();
late SharedPreferences prefs;
Expand All @@ -33,6 +35,7 @@ Future<void> main() async {
hideLockedTab.value = prefs.getBool('hide_locked') ?? false;
hideLockedTab.addListener(() => prefs.setBool('hide_locked', hideLockedTab.value));
initAppLockSettings();
iosTouchId = await LockService.hasTouchId();
for (final k in prefs.getKeys().where((k) => k.startsWith('bk_')).toList()) {
await prefs.remove(k); // leftovers of the Google Drive backup, removed in 0.8.2
}
Expand Down
10 changes: 8 additions & 2 deletions lib/restore_ui.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart' show TargetPlatform, defaultTargetPlatform;
import 'package:flutter/services.dart' show SystemNavigator;
import 'package:intl/intl.dart';
import 'package:path_provider/path_provider.dart';
Expand Down Expand Up @@ -55,10 +56,15 @@ Future<void> restoreFlow(BuildContext context, File picked) async {
barrierDismissible: false,
builder: (c) => AlertDialog(
title: const Text('Restored'),
content: Text('Pagemark will now close. Open it again to see your restored library.'
content: Text(defaultTargetPlatform == TargetPlatform.iOS
? 'Swipe up from the bottom of the screen and pause, swipe Pagemark away, then open it again to see your restored library.'
: 'Pagemark will now close. Open it again to see your restored library.'
'${check.lockedBooks > 0 ? '\n\nYour ${check.lockedBooks} locked book${check.lockedBooks == 1 ? '' : 's'} came back too, but your PIN is not part of backups. '
'Open the Locked tab and set a new PIN to reach ${check.lockedBooks == 1 ? 'it' : 'them'}.' : ''}'),
actions: [FilledButton(onPressed: () => SystemNavigator.pop(), child: const Text('Close Pagemark'))], // a graceful exit, not exit(0)
// iOS ignores SystemNavigator.pop and forbids quitting in code, so the user closes it from the app switcher
actions: [
if (defaultTargetPlatform != TargetPlatform.iOS) FilledButton(onPressed: () => SystemNavigator.pop(), child: const Text('Close Pagemark')), // a graceful exit, not exit(0)
],
),
);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/ui/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class SettingsPage extends StatelessWidget {
const Divider(),
_row(context, Icons.palette_outlined, SettingsTitles.appearance, 'Choose your colours', () => const _AppearancePage()),
_row(context, Icons.notifications_active_outlined, SettingsTitles.notifications, 'Reading and backup reminders', () => const _NotificationsPage()),
_row(context, Icons.widgets_outlined, SettingsTitles.widget, 'Home-screen widget and icon shortcuts', () => const _WidgetPage()),
// the home-screen widget is Android-only for now (iOS needs a WidgetKit extension)
if (defaultTargetPlatform == TargetPlatform.android) _row(context, Icons.widgets_outlined, SettingsTitles.widget, 'Home-screen widget and icon shortcuts', () => const _WidgetPage()),
_row(context, Icons.lock_outline, SettingsTitles.privacy, 'PIN, $biometricName and your private library', () => _PrivacyPage(onLockNow: onLockNow)),
_row(context, Icons.cloud_upload_outlined, SettingsTitles.backup, 'Keep your library safe, or bring it back', () => const BackupSettingsPage()),
_row(context, Icons.swap_horiz, SettingsTitles.importExport, 'Bring books in from another app, or take your list out', () => const _ImportExportPage()),
Expand Down
8 changes: 5 additions & 3 deletions lib/widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ class _ExpandableTextState extends State<ExpandableText> {

/// Words that differ between phones, so screens name what the user actually has.
bool get _ios => defaultTargetPlatform == TargetPlatform.iOS;
String get biometricName => _ios ? 'Face ID' : 'fingerprint';
String get biometricNameCap => _ios ? 'Face ID' : 'Fingerprint';
IconData get biometricIcon => _ios ? Icons.face : Icons.fingerprint;
/// True on an iPhone/iPad with Touch ID instead of Face ID (iPhone SE); set once at start by `LockService.hasTouchId`.
bool iosTouchId = false;
String get biometricName => _ios ? (iosTouchId ? 'Touch ID' : 'Face ID') : 'fingerprint';
String get biometricNameCap => _ios ? (iosTouchId ? 'Touch ID' : 'Face ID') : 'Fingerprint';
IconData get biometricIcon => _ios && !iosTouchId ? Icons.face : Icons.fingerprint;
String get phoneSettingsName => _ios ? 'iPhone Settings' : 'Android Settings';
String get cloudDriveName => _ios ? 'iCloud Drive' : 'Google Drive';

Expand Down
38 changes: 38 additions & 0 deletions test/ios_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import 'package:flutter/foundation.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pagemark/lock.dart';
import 'package:pagemark/widgets.dart';

void main() {
tearDown(() {
debugDefaultTargetPlatformOverride = null;
iosTouchId = false;
});

test('Android keeps its words', () {
debugDefaultTargetPlatformOverride = TargetPlatform.android;
expect(biometricName, 'fingerprint');
expect(biometricNameCap, 'Fingerprint');
expect(phoneSettingsName, 'Android Settings');
expect(cloudDriveName, 'Google Drive');
});

test('iPhone with Face ID', () {
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
expect(biometricName, 'Face ID');
expect(phoneSettingsName, 'iPhone Settings');
expect(cloudDriveName, 'iCloud Drive');
});

test('iPhone with Touch ID never says Face ID', () {
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
iosTouchId = true;
expect(biometricName, 'Touch ID');
expect(biometricNameCap, 'Touch ID');
});

test('Touch ID detection is iOS-only', () async {
debugDefaultTargetPlatformOverride = TargetPlatform.android;
expect(await LockService.hasTouchId(), isFalse);
});
}
Loading