Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#344 対応 #345

Merged
merged 1 commit into from
Sep 27, 2023
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
19 changes: 12 additions & 7 deletions lib/repository/import_export_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,25 @@ class ImportExportRepository extends ChangeNotifier {
onWillPop: () async => false,
child: FolderSelectDialog(
account: account,
fileShowTarget: "miria.json.unknown",
fileShowTarget: const ["miria.json", "miria.json.unknown"],
),
),
);

final alreadyExists = await reader(misskeyProvider(account))
var alreadyExists = await reader(misskeyProvider(account))
.drive
.files
.find(DriveFilesFindRequest(
name: "miria.json.unknown", folderId: folder?.id));
.find(DriveFilesFindRequest(name: "miria.json", folderId: folder?.id));

if (alreadyExists.isEmpty) {
await SimpleMessageDialog.show(context, "ここにMiriaの設定ファイルあれへんかったわ");
return;
alreadyExists = await reader(misskeyProvider(account)).drive.files.find(
DriveFilesFindRequest(
name: "miria.json.unknown", folderId: folder?.id));

if (alreadyExists.isEmpty) {
await SimpleMessageDialog.show(context, "ここにMiriaの設定ファイルあれへんかったわ");
return;
}
}

final importFile = alreadyExists.first;
Expand Down Expand Up @@ -110,7 +115,7 @@ class ImportExportRepository extends ChangeNotifier {
onWillPop: () async => false,
child: FolderSelectDialog(
account: account,
fileShowTarget: "miria.json.unknown",
fileShowTarget: const ["miria.json", "miria.json.unknown"],
),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:misskey_dart/misskey_dart.dart';

class FolderSelectDialog extends ConsumerStatefulWidget {
final Account account;
final String? fileShowTarget;
final List<String>? fileShowTarget;

const FolderSelectDialog({
super.key,
Expand Down Expand Up @@ -86,13 +86,15 @@ class FolderSelectDialogState extends ConsumerState<FolderSelectDialog> {
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
future: () async {
final list = await ref
.read(misskeyProvider(widget.account))
.drive
.files
.find(DriveFilesFindRequest(
folderId: path.lastOrNull?.id,
name: widget.fileShowTarget!));
final list = [];
for (final element in widget.fileShowTarget!) {
list.addAll(await ref
.read(misskeyProvider(widget.account))
.drive
.files
.find(DriveFilesFindRequest(
folderId: path.lastOrNull?.id, name: element)));
}
return list.toList();
}(),
builder: (context, item) => Row(
Expand Down