Skip to content

Commit

Permalink
Hotfix exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
ruskakimov committed Jun 8, 2021
1 parent eb9a515 commit 08c5151
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions lib/editing/data/exporter_model.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:io';

import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/material.dart';
import 'package:image_gallery_saver/image_gallery_saver.dart';
import 'package:mooltik/common/data/io/generate_image.dart';
Expand Down Expand Up @@ -69,11 +70,16 @@ class ExporterModel extends ChangeNotifier {

if (Platform.isAndroid) {
// Save to gallery on Android.
final result = await ImageGallerySaver.saveFile(videoFile.path);
try {
_outputFilePath = result['filePath'];
} catch (e) {
print(e);
final galleryResult = await ImageGallerySaver.saveFile(videoFile.path);
final galleryFilePath = galleryResult['filePath'];
_outputFilePath = galleryFilePath ?? videoFile.path;

if (galleryFilePath == null) {
throw Exception('Failed when tried uploading video to the gallery.');
}
} catch (e, stack) {
FirebaseCrashlytics.instance.recordError(e, stack);
}
} else if (Platform.isIOS) {
// iOS is more restrictive here. Usually apps show share dialog.
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.8.1
version: 1.8.2

environment:
sdk: '>=2.12.0 <3.0.0'
Expand Down

0 comments on commit 08c5151

Please sign in to comment.