From 129ba628f781cd4c6c3938cc37a2484d8a2c517f Mon Sep 17 00:00:00 2001 From: James Lin Date: Thu, 30 Aug 2018 14:31:31 -0700 Subject: [PATCH] Mark deprecated Flutter iOS APIs as unavailable The following were previously marked as deprecated over a month ago: * FlutterStandardBigInteger * -[FlutterDartProject initFromDefaultSourceForConfiguration] Remove their implementations and mark them as unavailable. --- .../darwin/ios/framework/Headers/Flutter.h | 4 ++ .../ios/framework/Headers/FlutterCodecs.h | 23 +---------- .../framework/Headers/FlutterDartProject.h | 2 +- .../ios/framework/Headers/FlutterMacros.h | 2 +- .../framework/Source/FlutterDartProject.mm | 7 +--- .../framework/Source/FlutterStandardCodec.mm | 41 ------------------- .../Source/FlutterStandardCodec_Internal.h | 1 + .../Source/flutter_standard_codec_unittest.mm | 16 +------- 8 files changed, 12 insertions(+), 84 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Headers/Flutter.h b/shell/platform/darwin/ios/framework/Headers/Flutter.h index 668a39eed354a..49464e40dc06b 100644 --- a/shell/platform/darwin/ios/framework/Headers/Flutter.h +++ b/shell/platform/darwin/ios/framework/Headers/Flutter.h @@ -8,6 +8,10 @@ /** BREAKING CHANGES: + August 31, 2018: Marked -[FlutterDartProject + initFromDefaultSourceForConfiguration] and FlutterStandardBigInteger as + unavailable. + July 26, 2018: Marked -[FlutterDartProject initFromDefaultSourceForConfiguration] deprecated. diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h b/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h index 8f06d51ea94c0..54d7eeca54fda 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h @@ -154,13 +154,6 @@ FLUTTER_EXPORT - `FlutterStandardTypedData`: `Uint8List`, `Int32List`, `Int64List`, or `Float64List` - `NSArray`: `List` - `NSDictionary`: `Map` - - Support for `FlutterStandardBigInteger` has been deprecated on 2018-01-09 to be - made unavailable four weeks after this change is available on the Flutter alpha - branch. `FlutterStandardBigInteger` were needed because the Dart 1.0 `int` type - had no size limit. With Dart 2.0, the `int` type is a fixed-size, 64-bit signed - integer. If you need to communicate larger integers, use `NSString` encoding - instead. */ FLUTTER_EXPORT @interface FlutterStandardMessageCodec : NSObject @@ -309,25 +302,13 @@ FLUTTER_EXPORT and `FlutterStandardMethodCodec`. */ FLUTTER_EXPORT -FLUTTER_DEPRECATED( - "Deprecated on 2018-01-09 to be made unavailable four weeks after the " - "deprecation is available on the flutter/flutter alpha branch. " +FLUTTER_UNAVAILABLE( + "Unavailable on 2018-08-31. Deprecated on 2018-01-09. " "FlutterStandardBigInteger was needed because the Dart 1.0 int type had no " "size limit. With Dart 2.0, the int type is a fixed-size, 64-bit signed " "integer. If you need to communicate larger integers, use NSString encoding " "instead.") @interface FlutterStandardBigInteger : NSObject -/** - Creates a `FlutterStandardBigInteger` from a hexadecimal representation. - - - Parameter hex: a hexadecimal string. - */ -+ (instancetype)bigIntegerWithHex:(NSString*)hex; - -/** - The hexadecimal string representation of this integer. - */ -@property(readonly, nonatomic) NSString* hex; @end /** diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterDartProject.h b/shell/platform/darwin/ios/framework/Headers/FlutterDartProject.h index 08e7cea2e4f0e..bef67aa04a937 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterDartProject.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterDartProject.h @@ -21,7 +21,7 @@ FLUTTER_EXPORT - (instancetype)initWithFlutterAssetsWithScriptSnapshot:(NSURL*)flutterAssetsURL NS_DESIGNATED_INITIALIZER; -- (instancetype)initFromDefaultSourceForConfiguration FLUTTER_DEPRECATED("Use -init instead."); +- (instancetype)initFromDefaultSourceForConfiguration FLUTTER_UNAVAILABLE("Use -init instead."); /** Returns the file name for the given asset. diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h b/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h index ea19d1cb5fb12..e3050963192e1 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterMacros.h @@ -21,7 +21,7 @@ #endif // defined(NS_ASSUME_NONNULL_BEGIN) /** - Indicates that the API has been deprecated for the specifed reason. Code that + Indicates that the API has been deprecated for the specified reason. Code that uses the deprecated API will continue to work as before. However, the API will soon become unavailable and users are encouraged to immediately take the appropriate action mentioned in the deprecation message and the BREAKING diff --git a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm index a89c61acfccb7..64eb73650dcc1 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm @@ -208,12 +208,7 @@ - (instancetype)initWithFlutterAssetsWithScriptSnapshot:(NSURL*)flutterAssetsURL return self; } -#pragma mark - Convenience initializers - -// Exists for backward-compatibility. Expect this to be removed. -- (instancetype)initFromDefaultSourceForConfiguration { - return [self init]; -} +#pragma mark - Settings accessors - (const blink::Settings&)settings { return _settings; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm b/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm index f995adfd95ccc..a70fe44036fd6 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec.mm @@ -203,41 +203,6 @@ - (NSUInteger)hash { } @end -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - -@implementation FlutterStandardBigInteger -+ (instancetype)bigIntegerWithHex:(NSString*)hex { - return [[[FlutterStandardBigInteger alloc] initWithHex:hex] autorelease]; -} - -- (instancetype)initWithHex:(NSString*)hex { - NSAssert(hex, @"Hex cannot be nil"); - self = [super init]; - NSAssert(self, @"Super init cannot be nil"); - _hex = [hex retain]; - return self; -} - -- (void)dealloc { - [_hex release]; - [super dealloc]; -} - -- (BOOL)isEqual:(id)object { - if (self == object) - return YES; - if (![object isKindOfClass:[FlutterStandardBigInteger class]]) - return NO; - FlutterStandardBigInteger* other = (FlutterStandardBigInteger*)object; - return [self.hex isEqual:other.hex]; -} - -- (NSUInteger)hash { - return [self.hex hash]; -} -@end - #pragma mark - Writer and reader of standard codec @implementation FlutterStandardWriter { @@ -336,10 +301,6 @@ - (void)writeValue:(id)value { NSString* string = value; [self writeByte:FlutterStandardFieldString]; [self writeUTF8:string]; - } else if ([value isKindOfClass:[FlutterStandardBigInteger class]]) { - FlutterStandardBigInteger* bigInt = value; - [self writeByte:FlutterStandardFieldIntHex]; - [self writeUTF8:bigInt.hex]; } else if ([value isKindOfClass:[FlutterStandardTypedData class]]) { FlutterStandardTypedData* typedData = value; [self writeByte:FlutterStandardFieldForDataType(typedData.type)]; @@ -479,7 +440,6 @@ - (id)readValueOfType:(UInt8)type { return [NSNumber numberWithDouble:value]; } case FlutterStandardFieldIntHex: - return [FlutterStandardBigInteger bigIntegerWithHex:[self readUTF8]]; case FlutterStandardFieldString: return [self readUTF8]; case FlutterStandardFieldUInt8Data: @@ -522,4 +482,3 @@ - (FlutterStandardReader*)readerWithData:(NSData*)data { return [[[FlutterStandardReader alloc] initWithData:data] autorelease]; } @end -#pragma clang diagnostic pop diff --git a/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec_Internal.h b/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec_Internal.h index e4129e3732188..24197e1ea8d6a 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec_Internal.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterStandardCodec_Internal.h @@ -16,6 +16,7 @@ typedef NS_ENUM(NSInteger, FlutterStandardField) { FlutterStandardFieldIntHex, FlutterStandardFieldFloat64, FlutterStandardFieldString, + // The following must match the corresponding order from `FlutterStandardDataType`. FlutterStandardFieldUInt8Data, FlutterStandardFieldInt32Data, FlutterStandardFieldInt64Data, diff --git a/shell/platform/darwin/ios/framework/Source/flutter_standard_codec_unittest.mm b/shell/platform/darwin/ios/framework/Source/flutter_standard_codec_unittest.mm index af32c95fa714b..402962c6637d0 100644 --- a/shell/platform/darwin/ios/framework/Source/flutter_standard_codec_unittest.mm +++ b/shell/platform/darwin/ios/framework/Source/flutter_standard_codec_unittest.mm @@ -66,16 +66,13 @@ void checkEncodeDecode(id value) { checkEncodeDecode(@(value), [NSData dataWithBytes:bytes length:9]); } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" TEST(FlutterStandardCodec, CanEncodeAndDecodeUInt64AsHexString) { FlutterStandardMessageCodec* codec = [FlutterStandardMessageCodec sharedInstance]; UInt64 u64 = 0xfffffffffffffffa; NSData* encoded = [codec encode:@(u64)]; - FlutterStandardBigInteger* decoded = [codec decode:encoded]; - ASSERT_TRUE([decoded.hex isEqual:@"fffffffffffffffa"]); + NSString* decoded = [codec decode:encoded]; + ASSERT_TRUE([decoded isEqual:@"fffffffffffffffa"]); } -#pragma clang diagnostic pop TEST(FlutterStandardCodec, CanEncodeAndDecodeSInt8) { uint8_t bytes[5] = {0x03, 0xfe, 0xff, 0xff, 0xff}; @@ -99,15 +96,6 @@ void checkEncodeDecode(id value) { checkEncodeDecode(@(0x1234567890abcdef), [NSData dataWithBytes:bytes length:9]); } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -TEST(FlutterStandardCodec, CanEncodeAndDecodeBigInteger) { - FlutterStandardBigInteger* value = - [FlutterStandardBigInteger bigIntegerWithHex:@"-abcdef0123456789abcdef01234567890"]; - checkEncodeDecode(value); -} -#pragma clang diagnostic pop - TEST(FlutterStandardCodec, CanEncodeAndDecodeFloat32) { uint8_t bytes[16] = {0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xfb, 0x21, 0x09, 0x40};