Skip to content

Commit e92f64c

Browse files
committed
2 parents 35ac66e + e5a44df commit e92f64c

File tree

5 files changed

+19
-11
lines changed

5 files changed

+19
-11
lines changed

backup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -e
55
# This is used to download a stable, compatible version of the Android companion app as well as ensure backwards compatibility,
66
# so it should match the tag name in GitHub Releases.
77
# TODO: load this dynamically, i.e. configure our build system to automatically update the APP_VERSION
8-
APP_VERSION="v1.2.0"
8+
APP_VERSION="v1.2.1"
99

1010
# We use whiptail for showing dialogs.
1111
# Whiptail is used similarly as dialog, but we can't install it on macOS using Homebrew IIRC.

companion_app/lib/main_screen.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'dart:io';
33

44
import './services/backup_service.dart';
55
import './widgets/progress_widgets.dart';
6+
import 'services/file_service.dart';
67

78
class MainScreen extends StatefulWidget {
89
const MainScreen({Key? key}) : super(key: key);
@@ -27,6 +28,8 @@ class _MainScreenState extends State<MainScreen> {
2728
int contactsAmountFilesystem = 0;
2829
int contactsImported = 0;
2930

31+
final FileService fileService = FileService();
32+
3033
// No directory paths needed for main screen - uses hardcoded directories
3134

3235
@override
@@ -78,6 +81,11 @@ class _MainScreenState extends State<MainScreen> {
7881
});
7982

8083
try {
84+
// First check permissions
85+
if (!(await fileService.checkStoragePermissions())) {
86+
throw Error();
87+
}
88+
8189
// Recreate the temp directory if it already exists
8290
final directory = Directory(exportDir);
8391
if (await directory.exists()) {

companion_app/lib/services/file_service.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import 'package:device_info_plus/device_info_plus.dart';
44

55
class FileService {
66
/// Check if we have necessary storage permissions for file operations
7-
Future<bool> _checkStoragePermissions() async {
7+
Future<bool> checkStoragePermissions() async {
88
// Check storage permissions based on Android version
99
final androidInfo = await DeviceInfoPlugin().androidInfo;
1010
if (androidInfo.version.sdkInt <= 29) {
@@ -23,7 +23,7 @@ class FileService {
2323
/// Verify that we have permissions and the directory is accessible
2424
Future<bool> verifyDirectoryAccess(String directoryPath) async {
2525
// First check storage permissions
26-
if (!(await _checkStoragePermissions())) {
26+
if (!(await checkStoragePermissions())) {
2727
return false;
2828
}
2929

@@ -94,7 +94,7 @@ class FileService {
9494
Future<String?> readFile(String filePath) async {
9595
try {
9696
// Verify we have storage permissions
97-
if (!(await _checkStoragePermissions())) {
97+
if (!(await checkStoragePermissions())) {
9898
// DEBUG: No storage permissions to read file
9999
return null;
100100
}

companion_app/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1515
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
1616
# Read more about iOS versioning at
1717
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18-
version: 1.2.0+12
18+
version: 1.2.1+13
1919

2020
environment:
2121
sdk: ">=2.15.1 <3.0.0"

website/package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)