Skip to content

Commit

Permalink
Merge pull request #12 from naaando/35-bug-com-imagem-maior-que-o-sup…
Browse files Browse the repository at this point in the history
…ortado

35 bug com imagem maior que o suportado
  • Loading branch information
naaando authored Nov 19, 2023
2 parents 75c670a + a22ae95 commit 139df47
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 21 deletions.
2 changes: 2 additions & 0 deletions pets-api/app/Http/Controllers/PetImageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
use App\Models\Pet;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Spatie\LaravelImageOptimizer\Middlewares\OptimizeImages;

class PetImageController extends Controller
{
public function __construct()
{
$this->middleware(OptimizeImages::class)->only('update');
$this->authorizeResource(Pet::class, 'pet');
}

Expand Down
1 change: 1 addition & 0 deletions pets-api/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"laravel/tinker": "^2.8",
"league/flysystem-aws-s3-v3": "^3.0",
"sentry/sentry-laravel": "^3.8",
"spatie/laravel-image-optimizer": "^1.7",
"spiral/roadrunner-cli": "^2.5",
"spiral/roadrunner-http": "^3.0"
},
Expand Down
127 changes: 125 additions & 2 deletions pets-api/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 10 additions & 9 deletions pets/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import 'package:sentry_logging/sentry_logging.dart';
import 'package:timezone/data/latest_all.dart' as tz;
import 'package:timezone/timezone.dart' as tz;
import 'package:flutter_timezone/flutter_timezone.dart';
import 'package:sentry_logging/sentry_logging.dart';

import 'notifications.dart';

Expand Down Expand Up @@ -40,12 +39,14 @@ void main() async {

await FastCachedImageConfig.init();

await SentryFlutter.init(
(options) => options..addIntegration(LoggingIntegration()),
appRunner: () => runApp(
const ProviderScope(
child: App(),
),
),
);
appRunner() => runApp(const ProviderScope(child: App()));

if (kReleaseMode) {
await SentryFlutter.init(
(options) => options..addIntegration(LoggingIntegration()),
appRunner: appRunner,
);
} else {
appRunner();
}
}
9 changes: 2 additions & 7 deletions pets/lib/provider/pet_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ Future<List<Pet>> petsOrderedByUpdate(PetsOrderedByUpdateRef ref) async {
final pets = ref.watch(petsProvider);

return pets.when(
data: (pets) => pets.values.toList()
..sort(
(a, b) => a.updatedAt is String
? DateTime.parse(a.updatedAt ?? '').microsecondsSinceEpoch
: DateTime.parse(a.createdAt ?? '').microsecondsSinceEpoch,
),
data: (pets) =>
pets.values.toList()..sort((a, b) => a.nome.compareTo(b.nome)),
error: (e, s) => throw e,
loading: () => [],
);
Expand Down Expand Up @@ -54,7 +50,6 @@ class Pets extends _$Pets {
savedPet = savedPet.copyWith(imagemUrl: imageUrl);
}

await future;
return savedPet;
} finally {
ref.invalidateSelf();
Expand Down
4 changes: 2 additions & 2 deletions pets/lib/provider/pet_provider.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pets/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.8.2+39
version: 1.8.3+40

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

0 comments on commit 139df47

Please sign in to comment.