From b32897232ffa645b8bbc89ef34883af4fb9c5017 Mon Sep 17 00:00:00 2001 From: Kamo Spertsyan Date: Thu, 2 Feb 2023 14:16:26 +0300 Subject: [PATCH 1/3] Flutter warnings fixed (#204) Co-authored-by: GitHub Action --- fastlane/report.xml | 15 +++++++++++++++ lib/src/automations.dart | 2 -- lib/src/dto/environment.dart | 2 -- lib/src/qonversion_config_builder.dart | 4 +--- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/fastlane/report.xml b/fastlane/report.xml index dcaa8920..0592561b 100644 --- a/fastlane/report.xml +++ b/fastlane/report.xml @@ -4,5 +4,20 @@ + + + + + + + + + + + + + + + diff --git a/lib/src/automations.dart b/lib/src/automations.dart index 0f604a4b..6850abac 100644 --- a/lib/src/automations.dart +++ b/lib/src/automations.dart @@ -1,5 +1,3 @@ -import 'dart:ffi'; - import 'package:qonversion_flutter/qonversion_flutter.dart'; import 'package:qonversion_flutter/src/internal/automations_internal.dart'; diff --git a/lib/src/dto/environment.dart b/lib/src/dto/environment.dart index 36a35a48..8c629ad0 100644 --- a/lib/src/dto/environment.dart +++ b/lib/src/dto/environment.dart @@ -1,5 +1,3 @@ -import 'package:json_annotation/json_annotation.dart'; - enum QEnvironment { sandbox, production, diff --git a/lib/src/qonversion_config_builder.dart b/lib/src/qonversion_config_builder.dart index 45ebf0b2..c38f4fe9 100644 --- a/lib/src/qonversion_config_builder.dart +++ b/lib/src/qonversion_config_builder.dart @@ -1,5 +1,3 @@ -import 'package:qonversion_flutter/src/qonversion_config.dart'; - import '../qonversion_flutter.dart'; class QonversionConfigBuilder { @@ -11,7 +9,7 @@ class QonversionConfigBuilder { QEntitlementsCacheLifetime _entitlementsCacheLifetime = QEntitlementsCacheLifetime.month; - String? _proxyUrl = null; + String? _proxyUrl; QonversionConfigBuilder(this.projectKey, this.launchMode); From 95c860c9f8f5b6d515fe9306a6897e34056b84dc Mon Sep 17 00:00:00 2001 From: Kamo Spertsyan Date: Thu, 2 Feb 2023 18:21:48 +0300 Subject: [PATCH 2/3] Flutter warnings fixed (part 2) (#205) * Flutter warnings fixed (#203) Co-authored-by: GitHub Action * Flutter warnings fixed (part 2) --------- Co-authored-by: GitHub Action --- lib/src/dto/eligibility.dart | 2 +- lib/src/dto/eligibility.g.dart | 5 --- lib/src/dto/launch_mode.dart | 2 - lib/src/dto/screen_presentation_config.dart | 2 +- lib/src/dto/screen_presentation_config.g.dart | 34 ----------------- lib/src/dto/sku_details/sku_details.dart | 37 +++++++++---------- lib/src/dto/user.dart | 2 +- lib/src/dto/user.g.dart | 5 --- 8 files changed, 20 insertions(+), 69 deletions(-) diff --git a/lib/src/dto/eligibility.dart b/lib/src/dto/eligibility.dart index a8d2829e..a9685557 100644 --- a/lib/src/dto/eligibility.dart +++ b/lib/src/dto/eligibility.dart @@ -13,7 +13,7 @@ enum QEligibilityStatus { eligible, } -@JsonSerializable() +@JsonSerializable(createToJson: false) class QEligibility { @JsonKey(name: "status", defaultValue: QEligibilityStatus.unknown) final QEligibilityStatus status; diff --git a/lib/src/dto/eligibility.g.dart b/lib/src/dto/eligibility.g.dart index cb02822e..64ed96ef 100644 --- a/lib/src/dto/eligibility.g.dart +++ b/lib/src/dto/eligibility.g.dart @@ -13,11 +13,6 @@ QEligibility _$QEligibilityFromJson(Map json) { ); } -Map _$QEligibilityToJson(QEligibility instance) => - { - 'status': _$QEligibilityStatusEnumMap[instance.status], - }; - K _$enumDecode( Map enumValues, Object? source, { diff --git a/lib/src/dto/launch_mode.dart b/lib/src/dto/launch_mode.dart index 038fa2f4..c0b70b09 100644 --- a/lib/src/dto/launch_mode.dart +++ b/lib/src/dto/launch_mode.dart @@ -1,5 +1,3 @@ -import 'package:json_annotation/json_annotation.dart'; - enum QLaunchMode { analytics, subscriptionManagement, diff --git a/lib/src/dto/screen_presentation_config.dart b/lib/src/dto/screen_presentation_config.dart index 8c0b83bd..f5ca7431 100644 --- a/lib/src/dto/screen_presentation_config.dart +++ b/lib/src/dto/screen_presentation_config.dart @@ -3,7 +3,7 @@ import 'screen_presentation_style.dart'; part 'screen_presentation_config.g.dart'; -@JsonSerializable() +@JsonSerializable(createFactory: false) class QScreenPresentationConfig { /// Describes how screens will be displayed. /// For mode details see the enum description. diff --git a/lib/src/dto/screen_presentation_config.g.dart b/lib/src/dto/screen_presentation_config.g.dart index a6dc1234..e2f5552f 100644 --- a/lib/src/dto/screen_presentation_config.g.dart +++ b/lib/src/dto/screen_presentation_config.g.dart @@ -6,14 +6,6 @@ part of 'screen_presentation_config.dart'; // JsonSerializableGenerator // ************************************************************************** -QScreenPresentationConfig _$QScreenPresentationConfigFromJson( - Map json) { - return QScreenPresentationConfig( - _$enumDecode(_$QScreenPresentationStyleEnumMap, json['presentationStyle']), - json['animated'] as bool, - ); -} - Map _$QScreenPresentationConfigToJson( QScreenPresentationConfig instance) => { @@ -22,32 +14,6 @@ Map _$QScreenPresentationConfigToJson( 'animated': animatedToJson(instance.animated), }; -K _$enumDecode( - Map enumValues, - Object? source, { - K? unknownValue, -}) { - if (source == null) { - throw ArgumentError( - 'A value must be provided. Supported values: ' - '${enumValues.values.join(', ')}', - ); - } - - return enumValues.entries.singleWhere( - (e) => e.value == source, - orElse: () { - if (unknownValue == null) { - throw ArgumentError( - '`$source` is not one of the supported values: ' - '${enumValues.values.join(', ')}', - ); - } - return MapEntry(unknownValue, enumValues.values.first); - }, - ).key; -} - const _$QScreenPresentationStyleEnumMap = { QScreenPresentationStyle.push: 'Push', QScreenPresentationStyle.fullScreen: 'FullScreen', diff --git a/lib/src/dto/sku_details/sku_details.dart b/lib/src/dto/sku_details/sku_details.dart index d5d131bc..dbb0fbd8 100644 --- a/lib/src/dto/sku_details/sku_details.dart +++ b/lib/src/dto/sku_details/sku_details.dart @@ -1,7 +1,5 @@ // Copyright 2019 The Chromium Authors. All rights reserved. -import 'dart:ui' show hashValues; - import 'package:json_annotation/json_annotation.dart'; part 'sku_details.g.dart'; @@ -112,29 +110,28 @@ class SkuDetailsWrapper { return false; } - final SkuDetailsWrapper typedOther = other; - return typedOther is SkuDetailsWrapper && - typedOther.description == description && - typedOther.freeTrialPeriod == freeTrialPeriod && - typedOther.introductoryPrice == introductoryPrice && - typedOther.introductoryPriceAmountMicros == + return other is SkuDetailsWrapper && + other.description == description && + other.freeTrialPeriod == freeTrialPeriod && + other.introductoryPrice == introductoryPrice && + other.introductoryPriceAmountMicros == introductoryPriceAmountMicros && - typedOther.introductoryPriceCycles == introductoryPriceCycles && - typedOther.introductoryPricePeriod == introductoryPricePeriod && - typedOther.price == price && - typedOther.priceAmountMicros == priceAmountMicros && - typedOther.sku == sku && - typedOther.subscriptionPeriod == subscriptionPeriod && - typedOther.title == title && - typedOther.type == type && - typedOther.originalPrice == originalPrice && - typedOther.originalPriceAmountMicros == originalPriceAmountMicros && - typedOther.originalJson == originalJson; + other.introductoryPriceCycles == introductoryPriceCycles && + other.introductoryPricePeriod == introductoryPricePeriod && + other.price == price && + other.priceAmountMicros == priceAmountMicros && + other.sku == sku && + other.subscriptionPeriod == subscriptionPeriod && + other.title == title && + other.type == type && + other.originalPrice == originalPrice && + other.originalPriceAmountMicros == originalPriceAmountMicros && + other.originalJson == originalJson; } @override int get hashCode { - return hashValues( + return Object.hash( description.hashCode, freeTrialPeriod.hashCode, introductoryPrice.hashCode, diff --git a/lib/src/dto/user.dart b/lib/src/dto/user.dart index 06f18529..ed3b6d8d 100644 --- a/lib/src/dto/user.dart +++ b/lib/src/dto/user.dart @@ -2,7 +2,7 @@ import 'package:json_annotation/json_annotation.dart'; part 'user.g.dart'; -@JsonSerializable() +@JsonSerializable(createToJson: false) class QUser { @JsonKey(name: "qonversionId") final String qonversionId; diff --git a/lib/src/dto/user.g.dart b/lib/src/dto/user.g.dart index add22fb4..485f259f 100644 --- a/lib/src/dto/user.g.dart +++ b/lib/src/dto/user.g.dart @@ -12,8 +12,3 @@ QUser _$QUserFromJson(Map json) { json['identityId'] as String, ); } - -Map _$QUserToJson(QUser instance) => { - 'qonversionId': instance.qonversionId, - 'identityId': instance.identityId, - }; From 424312445fde65a9bac2cf657f1c66cc4ee0179f Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 2 Feb 2023 18:29:48 +0300 Subject: [PATCH 3/3] Flutter warnings fixed (part 3) --- lib/src/dto/sk_product/discount.dart | 4 +--- lib/src/dto/sk_product/sk_product_wrapper.dart | 6 ++---- lib/src/dto/sk_product/subscription_period.dart | 4 +--- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/src/dto/sk_product/discount.dart b/lib/src/dto/sk_product/discount.dart index db90b0f2..cb1d5913 100644 --- a/lib/src/dto/sk_product/discount.dart +++ b/lib/src/dto/sk_product/discount.dart @@ -1,5 +1,3 @@ -import 'dart:ui'; - import 'package:json_annotation/json_annotation.dart'; import 'package:qonversion_flutter/src/internal/mapper.dart'; @@ -72,6 +70,6 @@ class SKProductDiscountWrapper { } @override - int get hashCode => hashValues(this.price, this.priceLocale, + int get hashCode => Object.hash(this.price, this.priceLocale, this.numberOfPeriods, this.paymentMode, this.subscriptionPeriod); } diff --git a/lib/src/dto/sk_product/sk_product_wrapper.dart b/lib/src/dto/sk_product/sk_product_wrapper.dart index 9b68630b..8641e9a1 100644 --- a/lib/src/dto/sk_product/sk_product_wrapper.dart +++ b/lib/src/dto/sk_product/sk_product_wrapper.dart @@ -1,7 +1,5 @@ // Copyright 2019 The Chromium Authors. All rights reserved. -import 'dart:ui' show hashValues; - import 'package:json_annotation/json_annotation.dart'; import 'package:qonversion_flutter/src/internal/mapper.dart'; @@ -92,7 +90,7 @@ class SKProductWrapper { } @override - int get hashCode => hashValues( + int get hashCode => Object.hash( this.productIdentifier, this.localizedTitle, this.localizedDescription, @@ -139,5 +137,5 @@ class SKPriceLocaleWrapper { } @override - int get hashCode => hashValues(this.currencySymbol, this.currencyCode); + int get hashCode => Object.hash(this.currencySymbol, this.currencyCode); } diff --git a/lib/src/dto/sk_product/subscription_period.dart b/lib/src/dto/sk_product/subscription_period.dart index 26cadb41..a7734039 100644 --- a/lib/src/dto/sk_product/subscription_period.dart +++ b/lib/src/dto/sk_product/subscription_period.dart @@ -1,5 +1,3 @@ -import 'dart:ui'; - import 'package:json_annotation/json_annotation.dart'; import 'subscription_period_unit.dart'; @@ -53,5 +51,5 @@ class SKProductSubscriptionPeriodWrapper { } @override - int get hashCode => hashValues(this.numberOfUnits, this.unit); + int get hashCode => Object.hash(this.numberOfUnits, this.unit); }