Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/pub/packages/smooth_app/webvie…
Browse files Browse the repository at this point in the history
…w_flutter_wkwebview-3.15.0
  • Loading branch information
monsieurtanuki authored Oct 7, 2024
2 parents d3ec065 + 56c2cf2 commit a7b2713
Show file tree
Hide file tree
Showing 24 changed files with 692 additions and 393 deletions.
16 changes: 8 additions & 8 deletions packages/smooth_app/android/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.980.0)
aws-partitions (1.984.0)
aws-sdk-core (3.209.1)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
Expand All @@ -25,7 +25,7 @@ GEM
aws-sdk-kms (1.94.0)
aws-sdk-core (~> 3, >= 3.207.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.166.0)
aws-sdk-s3 (1.167.0)
aws-sdk-core (~> 3, >= 3.207.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
Expand All @@ -44,7 +44,7 @@ GEM
domain_name (0.6.20240107)
dotenv (2.8.1)
emoji_regex (3.2.3)
excon (0.111.0)
excon (0.112.0)
faraday (1.10.4)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
Expand Down Expand Up @@ -74,7 +74,7 @@ GEM
faraday_middleware (1.2.1)
faraday (~> 1.0)
fastimage (2.3.1)
fastlane (2.223.1)
fastlane (2.224.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand Down Expand Up @@ -160,7 +160,7 @@ GEM
httpclient (2.8.3)
jmespath (1.6.2)
json (2.7.2)
jwt (2.9.1)
jwt (2.9.3)
base64
mini_magick (4.13.2)
mini_mime (1.1.5)
Expand All @@ -179,7 +179,7 @@ GEM
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.3.7)
rexml (3.3.8)
rouge (2.0.7)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
Expand All @@ -203,13 +203,13 @@ GEM
uber (0.1.0)
unicode-display_width (2.6.0)
word_wrap (1.0.0)
xcodeproj (1.25.0)
xcodeproj (1.25.1)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (>= 3.3.2, < 4.0)
rexml (>= 3.3.6, < 4.0)
xcpretty (0.3.0)
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.1)
Expand Down
Binary file not shown.
Binary file not shown.
16 changes: 8 additions & 8 deletions packages/smooth_app/ios/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.980.0)
aws-partitions (1.984.0)
aws-sdk-core (3.209.1)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
Expand All @@ -25,7 +25,7 @@ GEM
aws-sdk-kms (1.94.0)
aws-sdk-core (~> 3, >= 3.207.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.166.0)
aws-sdk-s3 (1.167.0)
aws-sdk-core (~> 3, >= 3.207.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
Expand All @@ -45,7 +45,7 @@ GEM
domain_name (0.6.20240107)
dotenv (2.8.1)
emoji_regex (3.2.3)
excon (0.111.0)
excon (0.112.0)
faraday (1.10.4)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
Expand Down Expand Up @@ -75,7 +75,7 @@ GEM
faraday_middleware (1.2.1)
faraday (~> 1.0)
fastimage (2.3.1)
fastlane (2.223.1)
fastlane (2.224.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand Down Expand Up @@ -161,7 +161,7 @@ GEM
httpclient (2.8.3)
jmespath (1.6.2)
json (2.7.2)
jwt (2.9.1)
jwt (2.9.3)
base64
mini_magick (4.13.2)
mini_mime (1.1.5)
Expand All @@ -180,7 +180,7 @@ GEM
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.3.7)
rexml (3.3.8)
rouge (2.0.7)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
Expand Down Expand Up @@ -209,13 +209,13 @@ GEM
xcode-install (2.8.1)
claide (>= 0.9.1)
fastlane (>= 2.1.0, < 3.0.0)
xcodeproj (1.25.0)
xcodeproj (1.25.1)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (>= 3.3.2, < 4.0)
rexml (>= 3.3.6, < 4.0)
xcpretty (0.3.0)
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.1)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import 'dart:async';

import 'package:flutter/material.dart';
import 'package:openfoodfacts/openfoodfacts.dart';
import 'package:provider/provider.dart';
import 'package:smooth_app/background/background_task.dart';
import 'package:smooth_app/background/background_task_price.dart';
import 'package:smooth_app/background/operation_type.dart';
import 'package:smooth_app/database/local_database.dart';

/// Background task about adding prices to an existing proof.
class BackgroundTaskAddOtherPrice extends BackgroundTaskPrice {
BackgroundTaskAddOtherPrice._({
required super.processName,
required super.uniqueId,
required super.stamp,
// single
required this.proofId,
required super.date,
required super.currency,
required super.locationOSMId,
required super.locationOSMType,
// multi
required super.barcodes,
required super.pricesAreDiscounted,
required super.prices,
required super.pricesWithoutDiscount,
});

BackgroundTaskAddOtherPrice.fromJson(super.json)
: proofId = json[_jsonTagProofId] as int,
super.fromJson();

static const String _jsonTagProofId = 'proofId';

static const OperationType _operationType = OperationType.addOtherPrice;

final int proofId;

@override
Map<String, dynamic> toJson() {
final Map<String, dynamic> result = super.toJson();
result[_jsonTagProofId] = proofId;
return result;
}

/// Adds the background task about uploading a product image.
static Future<void> addTask({
required final BuildContext context,
required final int proofId,
required final DateTime date,
required final Currency currency,
required final int locationOSMId,
required final LocationOSMType locationOSMType,
required final List<String> barcodes,
required final List<bool> pricesAreDiscounted,
required final List<double> prices,
required final List<double?> pricesWithoutDiscount,
}) async {
final LocalDatabase localDatabase = context.read<LocalDatabase>();
final String uniqueId = await _operationType.getNewKey(localDatabase);
final BackgroundTask task = _getNewTask(
uniqueId: uniqueId,
proofId: proofId,
date: date,
currency: currency,
locationOSMId: locationOSMId,
locationOSMType: locationOSMType,
barcodes: barcodes,
pricesAreDiscounted: pricesAreDiscounted,
prices: prices,
pricesWithoutDiscount: pricesWithoutDiscount,
);
if (!context.mounted) {
return;
}
await task.addToManager(localDatabase, context: context);
}

/// Returns a new background task about changing a product.
static BackgroundTaskAddOtherPrice _getNewTask({
required final String uniqueId,
required final int proofId,
required final DateTime date,
required final Currency currency,
required final int locationOSMId,
required final LocationOSMType locationOSMType,
required final List<String> barcodes,
required final List<bool> pricesAreDiscounted,
required final List<double> prices,
required final List<double?> pricesWithoutDiscount,
}) =>
BackgroundTaskAddOtherPrice._(
uniqueId: uniqueId,
processName: _operationType.processName,
proofId: proofId,
date: date,
currency: currency,
locationOSMId: locationOSMId,
locationOSMType: locationOSMType,
barcodes: barcodes,
pricesAreDiscounted: pricesAreDiscounted,
prices: prices,
pricesWithoutDiscount: pricesWithoutDiscount,
stamp: BackgroundTaskPrice.getStamp(
date: date,
locationOSMId: locationOSMId,
locationOSMType: locationOSMType,
),
);

@override
Future<void> execute(final LocalDatabase localDatabase) async {
final String bearerToken = await getBearerToken();

await addPrices(
bearerToken: bearerToken,
proofId: proofId,
);

await closeSession(bearerToken: bearerToken);
}
}
Loading

0 comments on commit a7b2713

Please sign in to comment.