Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 4ef31b6

Browse files
authored
Revert commit e742a7b (#3976)
1 parent ba2d0ae commit 4ef31b6

File tree

7 files changed

+26
-286
lines changed

7 files changed

+26
-286
lines changed
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
## 0.1.1
2-
3-
* Exposed most of the NSLocale object via the SKProductWrapper class.
4-
51
## 0.1.0
62

73
* Initial open-source release.

packages/in_app_purchase/in_app_purchase_ios/ios/Classes/FIAObjectTranslator.m

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -107,38 +107,10 @@ + (NSDictionary *)getMapFromNSLocale:(NSLocale *)locale {
107107
return nil;
108108
}
109109
NSMutableDictionary *map = [[NSMutableDictionary alloc] init];
110-
111-
[map setObject:[locale objectForKey:NSLocaleIdentifier] ?: [NSNull null]
112-
forKey:@"localeIdentifier"];
113-
[map setObject:[locale objectForKey:NSLocaleCountryCode] ?: [NSNull null] forKey:@"countryCode"];
114-
[map setObject:[locale objectForKey:NSLocaleLanguageCode] ?: [NSNull null]
115-
forKey:@"languageCode"];
116-
[map setObject:[locale objectForKey:NSLocaleScriptCode] ?: [NSNull null] forKey:@"scriptCode"];
117-
[map setObject:[locale objectForKey:NSLocaleVariantCode] ?: [NSNull null] forKey:@"variantCode"];
118-
[map setObject:[locale objectForKey:NSLocaleCollationIdentifier] ?: [NSNull null]
119-
forKey:@"collationIdentifier"];
120-
[map setObject:[locale objectForKey:NSLocaleCollatorIdentifier] ?: [NSNull null]
121-
forKey:@"collatorIdentifier"];
122-
[map setObject:[locale objectForKey:NSLocaleUsesMetricSystem] ?: [NSNull null]
123-
forKey:@"usesMetricSystem"];
124-
[map setObject:[locale objectForKey:NSLocaleMeasurementSystem] ?: [NSNull null]
125-
forKey:@"measurementSystem"];
126-
[map setObject:[locale objectForKey:NSLocaleDecimalSeparator] ?: [NSNull null]
127-
forKey:@"decimalSeparator"];
128-
[map setObject:[locale objectForKey:NSLocaleGroupingSeparator] ?: [NSNull null]
129-
forKey:@"groupingSeparator"];
130110
[map setObject:[locale objectForKey:NSLocaleCurrencySymbol] ?: [NSNull null]
131111
forKey:@"currencySymbol"];
132112
[map setObject:[locale objectForKey:NSLocaleCurrencyCode] ?: [NSNull null]
133113
forKey:@"currencyCode"];
134-
[map setObject:[locale objectForKey:NSLocaleQuotationEndDelimiterKey] ?: [NSNull null]
135-
forKey:@"endDelimiterKey"];
136-
[map setObject:[locale objectForKey:NSLocaleQuotationBeginDelimiterKey] ?: [NSNull null]
137-
forKey:@"beginDelimiterKey"];
138-
[map setObject:[locale objectForKey:NSLocaleAlternateQuotationEndDelimiterKey] ?: [NSNull null]
139-
forKey:@"alternateQuotationEndDelimiterKey"];
140-
[map setObject:[locale objectForKey:NSLocaleAlternateQuotationBeginDelimiterKey] ?: [NSNull null]
141-
forKey:@"alternateQuotationBeginDelimiterKey"];
142114
return map;
143115
}
144116

packages/in_app_purchase/in_app_purchase_ios/lib/src/store_kit_wrappers/sk_product_wrapper.dart

Lines changed: 18 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -329,102 +329,25 @@ class SKProductWrapper {
329329
/// Object that indicates the locale of the price
330330
///
331331
/// It is a thin wrapper of [NSLocale](https://developer.apple.com/documentation/foundation/nslocale?language=objc).
332+
// TODO(cyanglaz): NSLocale is a complex object, want to see the actual need of getting this expanded.
333+
// Matching android to only get the currencySymbol for now.
334+
// https://github.com/flutter/flutter/issues/26610
332335
@JsonSerializable()
333336
class SKPriceLocaleWrapper {
334337
/// Creates a new price locale for `currencySymbol` and `currencyCode`.
335-
SKPriceLocaleWrapper({
336-
required this.localeIdentifier,
337-
required this.countryCode,
338-
required this.languageCode,
339-
required this.scriptCode,
340-
required this.variantCode,
341-
required this.collationIdentifier,
342-
required this.collatorIdentifier,
343-
required this.usesMetricSystem,
344-
required this.measurementSystem,
345-
required this.decimalSeparator,
346-
required this.groupingSeparator,
347-
required this.currencySymbol,
348-
required this.currencyCode,
349-
required this.endDelimiterKey,
350-
required this.beginDelimiterKey,
351-
required this.alternateQuotationEndDelimiterKey,
352-
required this.alternateQuotationBeginDelimiterKey,
353-
});
338+
SKPriceLocaleWrapper(
339+
{required this.currencySymbol, required this.currencyCode});
354340

355341
/// Constructing an instance from a map from the Objective-C layer.
356342
///
357343
/// This method should only be used with `map` values returned by [SKProductWrapper.fromJson] and [SKProductDiscountWrapper.fromJson].
358344
factory SKPriceLocaleWrapper.fromJson(Map<String, dynamic>? map) {
359345
if (map == null) {
360-
return SKPriceLocaleWrapper(
361-
localeIdentifier: '',
362-
countryCode: '',
363-
languageCode: '',
364-
scriptCode: '',
365-
variantCode: '',
366-
collationIdentifier: '',
367-
collatorIdentifier: '',
368-
usesMetricSystem: true,
369-
measurementSystem: '',
370-
decimalSeparator: '',
371-
groupingSeparator: '',
372-
currencySymbol: '',
373-
currencyCode: '',
374-
endDelimiterKey: '',
375-
beginDelimiterKey: '',
376-
alternateQuotationEndDelimiterKey: '',
377-
alternateQuotationBeginDelimiterKey: '',
378-
);
346+
return SKPriceLocaleWrapper(currencyCode: '', currencySymbol: '');
379347
}
380348
return _$SKPriceLocaleWrapperFromJson(map);
381349
}
382350

383-
///The identifier for the locale, e.g. "en_US" for US locale.
384-
@JsonKey(defaultValue: '')
385-
final String localeIdentifier;
386-
387-
///The country or region code for the locale, e.g. "US" for en_US locale.
388-
@JsonKey(defaultValue: '')
389-
final String countryCode;
390-
391-
///The language code for the locale, e.g. "en" for en_US locale.
392-
@JsonKey(defaultValue: '')
393-
final String languageCode;
394-
395-
///The script code for the locale, e.g. "Latn" for en_US locale.
396-
@JsonKey(defaultValue: '')
397-
final String scriptCode;
398-
399-
///The variant code for the locale, e.g. "POSIX".
400-
@JsonKey(defaultValue: '')
401-
final String variantCode;
402-
403-
///The collation associated with the locale, e.g. "pinyin".
404-
@JsonKey(defaultValue: '')
405-
final String collationIdentifier;
406-
407-
///The collation identifier for the locale, e.g. "en".
408-
@JsonKey(defaultValue: '')
409-
final String collatorIdentifier;
410-
411-
///A flag whether the locale uses the metric system.
412-
///If the value is false, you can typically assume American measurement units (e.g. miles).
413-
@JsonKey(defaultValue: true)
414-
final bool usesMetricSystem;
415-
416-
///The measurement associated with the locale, e.g. "Metric" or "U.S.".
417-
@JsonKey(defaultValue: '')
418-
final String measurementSystem;
419-
420-
///The decimal separator associated with the locale, e.g. "." or ",".
421-
@JsonKey(defaultValue: '')
422-
final String decimalSeparator;
423-
424-
///The numeric grouping separator associated with the locale, e.g. "," or " ".
425-
@JsonKey(defaultValue: '')
426-
final String groupingSeparator;
427-
428351
///The currency symbol for the locale, e.g. $ for US locale.
429352
@JsonKey(defaultValue: '')
430353
final String currencySymbol;
@@ -433,64 +356,19 @@ class SKPriceLocaleWrapper {
433356
@JsonKey(defaultValue: '')
434357
final String currencyCode;
435358

436-
///The end quotation symbol associated with the locale, e.g. "”", "“", "»", or "」".
437-
@JsonKey(defaultValue: '')
438-
final String endDelimiterKey;
439-
440-
///The begin quotation symbol associated with the locale, e.g. "“", "„", "«", or "「".
441-
@JsonKey(defaultValue: '')
442-
final String beginDelimiterKey;
443-
444-
///The alternate end quotation symbol associated with the locale, e.g. "“", "„", "«", or "「".
445-
@JsonKey(defaultValue: '')
446-
final String alternateQuotationEndDelimiterKey;
447-
448-
///The alternating begin quotation symbol associated with the locale, e.g. "“", "„", "«", or "「".
449-
@JsonKey(defaultValue: '')
450-
final String alternateQuotationBeginDelimiterKey;
451-
452359
@override
453-
bool operator ==(Object other) =>
454-
identical(this, other) ||
455-
other is SKPriceLocaleWrapper &&
456-
runtimeType == other.runtimeType &&
457-
localeIdentifier == other.localeIdentifier &&
458-
countryCode == other.countryCode &&
459-
languageCode == other.languageCode &&
460-
scriptCode == other.scriptCode &&
461-
variantCode == other.variantCode &&
462-
collationIdentifier == other.collationIdentifier &&
463-
collatorIdentifier == other.collatorIdentifier &&
464-
usesMetricSystem == other.usesMetricSystem &&
465-
measurementSystem == other.measurementSystem &&
466-
decimalSeparator == other.decimalSeparator &&
467-
groupingSeparator == other.groupingSeparator &&
468-
currencySymbol == other.currencySymbol &&
469-
currencyCode == other.currencyCode &&
470-
endDelimiterKey == other.endDelimiterKey &&
471-
beginDelimiterKey == other.beginDelimiterKey &&
472-
alternateQuotationEndDelimiterKey ==
473-
other.alternateQuotationEndDelimiterKey &&
474-
alternateQuotationBeginDelimiterKey ==
475-
other.alternateQuotationBeginDelimiterKey;
360+
bool operator ==(Object other) {
361+
if (identical(other, this)) {
362+
return true;
363+
}
364+
if (other.runtimeType != runtimeType) {
365+
return false;
366+
}
367+
final SKPriceLocaleWrapper typedOther = other as SKPriceLocaleWrapper;
368+
return typedOther.currencySymbol == currencySymbol &&
369+
typedOther.currencyCode == currencyCode;
370+
}
476371

477372
@override
478-
int get hashCode =>
479-
localeIdentifier.hashCode ^
480-
countryCode.hashCode ^
481-
languageCode.hashCode ^
482-
scriptCode.hashCode ^
483-
variantCode.hashCode ^
484-
collationIdentifier.hashCode ^
485-
collatorIdentifier.hashCode ^
486-
usesMetricSystem.hashCode ^
487-
measurementSystem.hashCode ^
488-
decimalSeparator.hashCode ^
489-
groupingSeparator.hashCode ^
490-
currencySymbol.hashCode ^
491-
currencyCode.hashCode ^
492-
endDelimiterKey.hashCode ^
493-
beginDelimiterKey.hashCode ^
494-
alternateQuotationEndDelimiterKey.hashCode ^
495-
alternateQuotationBeginDelimiterKey.hashCode;
373+
int get hashCode => hashValues(this.currencySymbol, this.currencyCode);
496374
}

packages/in_app_purchase/in_app_purchase_ios/lib/src/store_kit_wrappers/sk_product_wrapper.g.dart

Lines changed: 0 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/in_app_purchase/in_app_purchase_ios/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: in_app_purchase_ios
22
description: An implementation for the iOS platform of the Flutter `in_app_purchase` plugin. This uses the iOS StoreKit Framework.
33
repository: https://github.com/flutter/plugins/tree/master/packages/in_app_purchase/in_app_purchase_ios
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
5-
version: 0.1.1
5+
version: 0.1.0
66

77
environment:
88
sdk: ">=2.12.0 <3.0.0"

packages/in_app_purchase/in_app_purchase_ios/test/store_kit_wrappers/sk_product_test.dart

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -44,27 +44,8 @@ void main() {
4444
final SKProductDiscountWrapper wrapper =
4545
SKProductDiscountWrapper.fromJson(<String, dynamic>{});
4646
expect(wrapper.price, '');
47-
expect(
48-
wrapper.priceLocale,
49-
SKPriceLocaleWrapper(
50-
localeIdentifier: '',
51-
countryCode: '',
52-
languageCode: '',
53-
scriptCode: '',
54-
variantCode: '',
55-
collationIdentifier: '',
56-
collatorIdentifier: '',
57-
usesMetricSystem: true,
58-
measurementSystem: '',
59-
decimalSeparator: '',
60-
groupingSeparator: '',
61-
currencySymbol: '',
62-
currencyCode: '',
63-
endDelimiterKey: '',
64-
beginDelimiterKey: '',
65-
alternateQuotationEndDelimiterKey: '',
66-
alternateQuotationBeginDelimiterKey: '',
67-
));
47+
expect(wrapper.priceLocale,
48+
SKPriceLocaleWrapper(currencyCode: '', currencySymbol: ''));
6849
expect(wrapper.numberOfPeriods, 0);
6950
expect(wrapper.paymentMode, SKProductDiscountPaymentMode.payAsYouGo);
7051
expect(
@@ -88,27 +69,8 @@ void main() {
8869
expect(wrapper.productIdentifier, '');
8970
expect(wrapper.localizedTitle, '');
9071
expect(wrapper.localizedDescription, '');
91-
expect(
92-
wrapper.priceLocale,
93-
SKPriceLocaleWrapper(
94-
localeIdentifier: '',
95-
countryCode: '',
96-
languageCode: '',
97-
scriptCode: '',
98-
variantCode: '',
99-
collationIdentifier: '',
100-
collatorIdentifier: '',
101-
usesMetricSystem: true,
102-
measurementSystem: '',
103-
decimalSeparator: '',
104-
groupingSeparator: '',
105-
currencySymbol: '',
106-
currencyCode: '',
107-
endDelimiterKey: '',
108-
beginDelimiterKey: '',
109-
alternateQuotationEndDelimiterKey: '',
110-
alternateQuotationBeginDelimiterKey: '',
111-
));
72+
expect(wrapper.priceLocale,
73+
SKPriceLocaleWrapper(currencyCode: '', currencySymbol: ''));
11274
expect(wrapper.subscriptionGroupIdentifier, null);
11375
expect(wrapper.price, '');
11476
expect(wrapper.subscriptionPeriod, null);

0 commit comments

Comments
 (0)