Skip to content

Commit

Permalink
Disable local connection on android temporary, related to #569
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Jan 10, 2024
1 parent a7ea1e1 commit 9d9f8ec
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 20 deletions.
3 changes: 3 additions & 0 deletions app/lib/api/file_system/file_system_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ Future<String> getButterflyDirectory([bool root = false]) async {
return path;
}
if (Platform.isAndroid) {
if (path != null) {
path = Uri.tryParse(path)?.toFilePath();
}
path ??= (await getExternalStorageDirectory())?.path;
}
path ??= (await getApplicationDocumentsDirectory()).path;
Expand Down
4 changes: 4 additions & 0 deletions app/lib/settings/connections.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'dart:ui';
import 'package:butterfly/api/open.dart';
import 'package:butterfly/cubits/settings.dart';
import 'package:butterfly/widgets/window.dart';
import 'package:collection/collection.dart';
import 'package:file_selector/file_selector.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -56,6 +57,9 @@ class ConnectionsSettingsPage extends StatelessWidget {
context: context,
title: AppLocalizations.of(context).addConnection,
childrenBuilder: (context) => ExternalStorageType.values
.whereNot((e) =>
e == ExternalStorageType.local &&
Platform.isAndroid)
.map((e) => ListTile(
title: Text(e.getLocalizedName(context)),
leading: PhosphorIcon(
Expand Down
21 changes: 13 additions & 8 deletions app/lib/settings/data.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:archive/archive.dart';
import 'package:butterfly/api/file_system/file_system_io.dart';
import 'package:butterfly/api/save.dart';
Expand Down Expand Up @@ -75,14 +77,17 @@ class _DataSettingsPageState extends State<DataSettingsPage> {
)
: Text(
AppLocalizations.of(context).defaultPath),
onTap: () async {
final settingsCubit =
context.read<SettingsCubit>();
final selectedDir = await getDirectoryPath();
if (selectedDir != null) {
_changePath(settingsCubit, selectedDir);
}
},
onTap: Platform.isAndroid
? null
: () async {
final settingsCubit =
context.read<SettingsCubit>();
final selectedDir =
await getDirectoryPath();
if (selectedDir != null) {
_changePath(settingsCubit, selectedDir);
}
},
trailing: state.documentPath.isNotEmpty
? IconButton(
icon: const PhosphorIcon(
Expand Down
16 changes: 8 additions & 8 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ packages:
dependency: "direct main"
description:
name: camera
sha256: f3813a634fd1350a9d2a78ee70e5b247cebedc9c58a24560992620e57a8a5600
sha256: "9499cbc2e51d8eb0beadc158b288380037618ce4e30c9acbc4fae1ac3ecb5797"
url: "https://pub.dev"
source: hosted
version: "0.10.5+8"
version: "0.10.5+9"
camera_android:
dependency: transitive
description:
Expand Down Expand Up @@ -397,10 +397,10 @@ packages:
dependency: "direct main"
description:
name: file_selector
sha256: "84eaf3e034d647859167d1f01cfe7b6352488f34c1b4932635012b202014c25b"
sha256: "070062b9fca7482baf60af671219086e188e50dd80497393e7d58532b56215d3"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
version: "1.0.2"
file_selector_android:
dependency: transitive
description:
Expand Down Expand Up @@ -895,10 +895,10 @@ packages:
dependency: "direct main"
description:
name: path_provider
sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa
sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
path_provider_android:
dependency: transitive
description:
Expand Down Expand Up @@ -1310,10 +1310,10 @@ packages:
dependency: "direct main"
description:
name: url_launcher
sha256: e9aa5ea75c84cf46b3db4eea212523591211c3cf2e13099ee4ec147f54201c86
sha256: d25bb0ca00432a5e1ee40e69c36c85863addf7cc45e433769d61bed3fe81fd96
url: "https://pub.dev"
source: hosted
version: "6.2.2"
version: "6.2.3"
url_launcher_android:
dependency: transitive
description:
Expand Down
8 changes: 4 additions & 4 deletions app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ dependencies:
flutter_svg: ^2.0.9
flutter_bloc: ^8.1.3
intl: ^0.18.0
path_provider: ^2.1.1
path_provider: ^2.1.2
shared_preferences: ^2.2.2
url_launcher: ^6.2.2
file_selector: ^1.0.1
url_launcher: ^6.2.3
file_selector: ^1.0.2
phosphor_flutter:
git:
url: https://github.com/CodeDoctorDE/phosphor-flutter
Expand All @@ -44,7 +44,7 @@ dependencies:
xml: ^6.5.0
collection: ^1.18.0
bloc_concurrency: ^0.2.3
camera: ^0.10.5+8
camera: ^0.10.5+9
camera_windows: ^0.2.1+9
window_manager: ^0.3.7
flex_color_scheme: ^7.3.1
Expand Down

0 comments on commit 9d9f8ec

Please sign in to comment.