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

Chore/move queued item #4085

Closed
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:amplify_logging_cloudwatch/src/amplify_log_stream_name_provider.dart';
import 'package:amplify_logging_cloudwatch/src/path_provider/flutter_path_provider.dart';
import 'package:amplify_logging_cloudwatch/src/queued_item_store/dart_queued_item_store.dart';
import 'package:aws_logging_cloudwatch/aws_logging_cloudwatch.dart';
import 'package:aws_logging_cloudwatch/src/queued_item_store/dart_queued_item_store.dart';

/// {@macro aws_logging_cloudwatch.cloudwatch_logger_plugin}
class AmplifyCloudWatchLoggerPlugin extends CloudWatchLoggerPlugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import 'dart:async';

import 'package:aws_common/aws_common.dart';
import 'package:amplify_core/amplify_core.dart';
// ignore: implementation_imports
import 'package:aws_logging_cloudwatch/src/queued_item_store/queued_item_store.dart';
import 'package:meta/meta.dart';
Expand All @@ -14,7 +14,7 @@ import 'package:meta/meta.dart';
class DartQueuedItemStore implements QueuedItemStore, Closeable {
/// {@macro amplify_logging_cloudwatch.dart_queued_item_store}
// ignore: avoid_unused_constructor_parameters
DartQueuedItemStore(String? storagePath) {
DartQueuedItemStore(AppPathProvider appPathProvider) {
throw UnimplementedError('constructor has not been implemented.');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,17 @@

import 'dart:async';

import 'package:amplify_logging_cloudwatch/src/queued_item_store/drift/drift_queued_item_store.dart';
import 'package:aws_common/aws_common.dart';
import 'package:amplify_core/amplify_core.dart';
import 'package:aws_logging_cloudwatch/src/queued_item_store/drift/drift_queued_item_store.dart';
// ignore: implementation_imports
import 'package:aws_logging_cloudwatch/src/queued_item_store/queued_item_store.dart';
import 'package:meta/meta.dart';
import 'package:path_provider/path_provider.dart';

/// {@macro amplify_logging_cloudwatch.dart_queued_item_store}
class DartQueuedItemStore implements QueuedItemStore, Closeable {
/// {@macro amplify_logging_cloudwatch.dart_queued_item_store}
factory DartQueuedItemStore(String? storagePath) {
final FutureOr<String> path;
if (storagePath == null) {
path = getApplicationSupportDirectory().then((value) => value.path);
} else {
path = storagePath;
}
factory DartQueuedItemStore(AppPathProvider pathProvider) {
final FutureOr<String> path = pathProvider.getApplicationSupportPath();
final database = DriftQueuedItemStore(path);
return DartQueuedItemStore._(database);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import 'dart:async';

import 'package:amplify_core/amplify_core.dart';
import 'package:amplify_logging_cloudwatch/src/queued_item_store/index_db/indexed_db_adapter.dart';
import 'package:aws_logging_cloudwatch/src/queued_item_store/in_memory_queued_item_store.dart';
import 'package:aws_logging_cloudwatch/src/queued_item_store/index_db/indexed_db_adapter.dart';
import 'package:aws_logging_cloudwatch/src/queued_item_store/queued_item_store.dart';
import 'package:meta/meta.dart';

Expand All @@ -17,7 +17,7 @@ class DartQueuedItemStore
implements QueuedItemStore, Closeable {
/// {@macro amplify_logging_cloudwatch.index_db_queued_item_store}
// ignore: avoid_unused_constructor_parameters
DartQueuedItemStore(String? storagePath);
DartQueuedItemStore(AppPathProvider appPathProvider);

late final Future<QueuedItemStore> _database = () async {
if (await IndexedDbAdapter.checkIsIndexedDBSupported()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ environment:

dependencies:
amplify_core: ">=1.4.0 <1.5.0"
amplify_db_common_dart: ">=0.3.0+1 <0.4.0"
aws_common: ">=0.6.0 <0.7.0"
aws_signature_v4: ">=0.5.0 <0.6.0"
built_collection: ^5.1.1
built_value: ">=8.6.0 <8.7.0"
collection: ^1.15.0
drift: ">=2.11.0 <2.12.0"
fixnum: ^1.1.0
intl: ">=0.18.0 <1.0.0"
json_annotation: ">=4.8.1 <4.9.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import 'package:amplify_logging_cloudwatch/src/queued_item_store/dart_queued_item_store.dart';
import 'package:amplify_core/src/types/app_path_provider/app_path_provider.dart';
import 'package:aws_logging_cloudwatch/src/queued_item_store/dart_queued_item_store.dart';
import 'package:aws_logging_cloudwatch/src/queued_item_store/queued_item_store.dart';
import 'package:test/test.dart';

class MyPathProvider implements AppPathProvider {
@override
Future<String> getApplicationSupportPath() {
return Future.value('/tmp');
}

@override
Future<String> getTemporaryPath() {
return Future.value('/tmp');
}
}

void main() {
late DartQueuedItemStore db;

group('DartQueuedItemStore ', () {
setUpAll(() {
db = DartQueuedItemStore('/tmp');
final pathProvider = MyPathProvider();
db = DartQueuedItemStore(pathProvider);
});

tearDownAll(() async {
Expand Down
Loading