Skip to content

Commit

Permalink
🌐 wor 🚧 king ➖
Browse files Browse the repository at this point in the history
  • Loading branch information
devfemibadmus committed Aug 24, 2024
1 parent a6a5fef commit 855d43b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
3 changes: 1 addition & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ class _MyHomePageState extends State<MyHomePage> {
TextButton(
onPressed: () {
Navigator.of(context).pop();
SystemNavigator.pop();
},
child: Text(
'Cancel',
Expand Down Expand Up @@ -196,7 +195,7 @@ class _MyHomePageState extends State<MyHomePage> {
TextButton(
onPressed: () {
platform.invokeMethod("requestAccessToFolder");
print(permissions);
Navigator.of(context).pop();
},
child: Text(
'Okay',
Expand Down
6 changes: 3 additions & 3 deletions lib/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ List<MediaFiles> filterByMimeType(List<MediaFiles> list, List<String> formats) {
}).toList();
}

Future<String> mediaFileAction(String filePath, String action) async =>
await platform.invokeMethod(action, {'filePath': filePath}).catchError(
(e) => "Error: ${e.message}");
Future<bool> mediaFileAction(String filePath, String action) async =>
await platform.invokeMethod(
action, {'url': filePath}).catchError((e) => "Error: ${e.message}");

bool listsAreEqual(List<MediaFiles> list1, List<MediaFiles> list2) {
if (list1.length != list2.length) return false;
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/widgets/preview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class _PreviewState extends State<Preview> {
final fileInfo =
widget.previewFile[!move ? widget.index : currentIndex];
final actionMap = {
"download": () => mediaFileAction(fileInfo.url, 'saveStatus'),
"download": () => mediaFileAction(fileInfo.url, 'saveMedia'),
"delete": () {
Navigator.pop(context);
return mediaFileAction(fileInfo.url, 'deleteStatus');
Expand Down
9 changes: 4 additions & 5 deletions lib/pages/wws.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,19 @@ class GridManagerState extends State<GridManager> {
mediaFileAction(mediaFile.url, 'shareMedia').then(
(value) => scaffold.showSnackBar(
SnackBar(
content: Text(value),
content: Text("$value"),
),
),
);
},
onDoubleTap: () {
scaffold.hideCurrentSnackBar();
final action = appType != 'SAVED'
? 'saveStatus'
: 'deleteStatus';
final action =
appType != 'SAVED' ? 'saveMedia' : 'deleteStatus';
mediaFileAction(mediaFile.url, action).then(
(value) => scaffold.showSnackBar(
SnackBar(
content: Text(value),
content: Text("$value"),
),
),
);
Expand Down

0 comments on commit 855d43b

Please sign in to comment.