mirror of
https://github.com/flutter/packages.git
synced 2025-07-01 23:51:55 +08:00
[pigeon] Fixes double prefixes added to enum names for Objc HostApis and FlutterApis (#6263)
In some areas of the Objc generator, the the name created from [_objcTypeForDartType](https://github.com/flutter/packages/blob/main/packages/pigeon/lib/objc_generator.dart#L1353) is being passed to [_enumName](https://github.com/flutter/packages/blob/main/packages/pigeon/lib/objc_generator.dart#L1196) and both of these methods add a prefix to enums. The locations are when they are used in `HostApi` or `FlutterApi` methods, but the name of the generated enum would be correct. e.g. `FLTEnumName` vs `FLTFLTEnumName`. This fixes the locations where this is happening by passing the AST name to `_enumName` instead.
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
## 17.1.3
|
||||||
|
|
||||||
|
* [objc] Fixes double prefixes added to enum names.
|
||||||
|
|
||||||
## 17.1.2
|
## 17.1.2
|
||||||
|
|
||||||
* [swift] Separates message call code generation into separate methods.
|
* [swift] Separates message call code generation into separate methods.
|
||||||
|
@ -13,7 +13,7 @@ import 'ast.dart';
|
|||||||
/// The current version of pigeon.
|
/// The current version of pigeon.
|
||||||
///
|
///
|
||||||
/// This must match the version in pubspec.yaml.
|
/// This must match the version in pubspec.yaml.
|
||||||
const String pigeonVersion = '17.1.2';
|
const String pigeonVersion = '17.1.3';
|
||||||
|
|
||||||
/// Read all the content from [stdin] to a String.
|
/// Read all the content from [stdin] to a String.
|
||||||
String readStdin() {
|
String readStdin() {
|
||||||
|
@ -359,7 +359,7 @@ class ObjcHeaderGenerator extends StructuredGenerator<ObjcOptions> {
|
|||||||
String? lastArgType;
|
String? lastArgType;
|
||||||
String? returnType;
|
String? returnType;
|
||||||
final String enumReturnType = _enumName(
|
final String enumReturnType = _enumName(
|
||||||
returnTypeName.baseName,
|
func.returnType.baseName,
|
||||||
suffix: ' *_Nullable',
|
suffix: ' *_Nullable',
|
||||||
prefix: generatorOptions.prefix,
|
prefix: generatorOptions.prefix,
|
||||||
box: true,
|
box: true,
|
||||||
@ -765,7 +765,7 @@ static FlutterError *createConnectionError(NSString *channelName) {
|
|||||||
} else if (arg.type.isEnum) {
|
} else if (arg.type.isEnum) {
|
||||||
indent.writeln('NSNumber *${argName}AsNumber = $valueGetter;');
|
indent.writeln('NSNumber *${argName}AsNumber = $valueGetter;');
|
||||||
indent.writeln(
|
indent.writeln(
|
||||||
'${_enumName(arg.type.baseName, suffix: ' *', prefix: '', box: true)}$argName = ${argName}AsNumber == nil ? nil : [[${_enumName(arg.type.baseName, prefix: generatorOptions.prefix, box: true)} alloc] initWithValue:[${argName}AsNumber integerValue]];');
|
'${_enumName(arg.type.baseName, suffix: ' *', prefix: generatorOptions.prefix, box: true)}$argName = ${argName}AsNumber == nil ? nil : [[${_enumName(arg.type.baseName, prefix: generatorOptions.prefix, box: true)} alloc] initWithValue:[${argName}AsNumber integerValue]];');
|
||||||
} else {
|
} else {
|
||||||
indent.writeln('${objcArgType.beforeString}$argName = $valueGetter;');
|
indent.writeln('${objcArgType.beforeString}$argName = $valueGetter;');
|
||||||
}
|
}
|
||||||
@ -799,7 +799,7 @@ static FlutterError *createConnectionError(NSString *channelName) {
|
|||||||
|
|
||||||
if (func.returnType.isEnum) {
|
if (func.returnType.isEnum) {
|
||||||
returnTypeString =
|
returnTypeString =
|
||||||
'${_enumName(returnType.baseName, suffix: ' *_Nullable', prefix: generatorOptions.prefix, box: true)} enumValue';
|
'${_enumName(func.returnType.baseName, suffix: ' *_Nullable', prefix: generatorOptions.prefix, box: true)} enumValue';
|
||||||
}
|
}
|
||||||
if (func.parameters.isEmpty) {
|
if (func.parameters.isEmpty) {
|
||||||
indent.writeScoped(
|
indent.writeScoped(
|
||||||
@ -1132,7 +1132,7 @@ static FlutterError *createConnectionError(NSString *channelName) {
|
|||||||
indent.writeln('completion(nil);');
|
indent.writeln('completion(nil);');
|
||||||
} else {
|
} else {
|
||||||
if (func.returnType.isEnum) {
|
if (func.returnType.isEnum) {
|
||||||
final String enumName = _enumName(returnType.baseName,
|
final String enumName = _enumName(func.returnType.baseName,
|
||||||
prefix: languageOptions.prefix, box: true);
|
prefix: languageOptions.prefix, box: true);
|
||||||
indent.writeln('NSNumber *outputAsNumber = $nullCheck;');
|
indent.writeln('NSNumber *outputAsNumber = $nullCheck;');
|
||||||
indent.writeln(
|
indent.writeln(
|
||||||
@ -1212,7 +1212,7 @@ String _callbackForType(
|
|||||||
if (type.isVoid) {
|
if (type.isVoid) {
|
||||||
return 'void (^)(FlutterError *_Nullable)';
|
return 'void (^)(FlutterError *_Nullable)';
|
||||||
} else if (type.isEnum) {
|
} else if (type.isEnum) {
|
||||||
return 'void (^)(${_enumName(objcType.baseName, suffix: ' *_Nullable', prefix: options.prefix, box: true)}, FlutterError *_Nullable)';
|
return 'void (^)(${_enumName(type.baseName, suffix: ' *_Nullable', prefix: options.prefix, box: true)}, FlutterError *_Nullable)';
|
||||||
} else {
|
} else {
|
||||||
return 'void (^)(${objcType.beforeString}_Nullable, FlutterError *_Nullable)';
|
return 'void (^)(${objcType.beforeString}_Nullable, FlutterError *_Nullable)';
|
||||||
}
|
}
|
||||||
|
@ -17,14 +17,14 @@
|
|||||||
@implementation AllDatatypesTest
|
@implementation AllDatatypesTest
|
||||||
|
|
||||||
- (void)testAllNull {
|
- (void)testAllNull {
|
||||||
AllNullableTypes *everything = [[AllNullableTypes alloc] init];
|
FLTAllNullableTypes *everything = [[FLTAllNullableTypes alloc] init];
|
||||||
EchoBinaryMessenger *binaryMessenger =
|
EchoBinaryMessenger *binaryMessenger =
|
||||||
[[EchoBinaryMessenger alloc] initWithCodec:FlutterIntegrationCoreApiGetCodec()];
|
[[EchoBinaryMessenger alloc] initWithCodec:FLTFlutterIntegrationCoreApiGetCodec()];
|
||||||
FlutterIntegrationCoreApi *api =
|
FLTFlutterIntegrationCoreApi *api =
|
||||||
[[FlutterIntegrationCoreApi alloc] initWithBinaryMessenger:binaryMessenger];
|
[[FLTFlutterIntegrationCoreApi alloc] initWithBinaryMessenger:binaryMessenger];
|
||||||
XCTestExpectation *expectation = [self expectationWithDescription:@"callback"];
|
XCTestExpectation *expectation = [self expectationWithDescription:@"callback"];
|
||||||
[api echoAllNullableTypes:everything
|
[api echoAllNullableTypes:everything
|
||||||
completion:^(AllNullableTypes *_Nonnull result, FlutterError *_Nullable error) {
|
completion:^(FLTAllNullableTypes *_Nonnull result, FlutterError *_Nullable error) {
|
||||||
XCTAssertNil(result.aNullableBool);
|
XCTAssertNil(result.aNullableBool);
|
||||||
XCTAssertNil(result.aNullableInt);
|
XCTAssertNil(result.aNullableInt);
|
||||||
XCTAssertNil(result.aNullableDouble);
|
XCTAssertNil(result.aNullableDouble);
|
||||||
@ -41,7 +41,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)testAllEquals {
|
- (void)testAllEquals {
|
||||||
AllNullableTypes *everything = [[AllNullableTypes alloc] init];
|
FLTAllNullableTypes *everything = [[FLTAllNullableTypes alloc] init];
|
||||||
everything.aNullableBool = @NO;
|
everything.aNullableBool = @NO;
|
||||||
everything.aNullableInt = @(1);
|
everything.aNullableInt = @(1);
|
||||||
everything.aNullableDouble = @(2.0);
|
everything.aNullableDouble = @(2.0);
|
||||||
@ -58,12 +58,12 @@
|
|||||||
everything.aNullableMap = @{@"hello" : @(1234)};
|
everything.aNullableMap = @{@"hello" : @(1234)};
|
||||||
everything.nullableMapWithObject = @{@"hello" : @(1234), @"goodbye" : @"world"};
|
everything.nullableMapWithObject = @{@"hello" : @(1234), @"goodbye" : @"world"};
|
||||||
EchoBinaryMessenger *binaryMessenger =
|
EchoBinaryMessenger *binaryMessenger =
|
||||||
[[EchoBinaryMessenger alloc] initWithCodec:FlutterIntegrationCoreApiGetCodec()];
|
[[EchoBinaryMessenger alloc] initWithCodec:FLTFlutterIntegrationCoreApiGetCodec()];
|
||||||
FlutterIntegrationCoreApi *api =
|
FLTFlutterIntegrationCoreApi *api =
|
||||||
[[FlutterIntegrationCoreApi alloc] initWithBinaryMessenger:binaryMessenger];
|
[[FLTFlutterIntegrationCoreApi alloc] initWithBinaryMessenger:binaryMessenger];
|
||||||
XCTestExpectation *expectation = [self expectationWithDescription:@"callback"];
|
XCTestExpectation *expectation = [self expectationWithDescription:@"callback"];
|
||||||
[api echoAllNullableTypes:everything
|
[api echoAllNullableTypes:everything
|
||||||
completion:^(AllNullableTypes *_Nonnull result, FlutterError *_Nullable error) {
|
completion:^(FLTAllNullableTypes *_Nonnull result, FlutterError *_Nullable error) {
|
||||||
XCTAssertEqual(result.aNullableBool, everything.aNullableBool);
|
XCTAssertEqual(result.aNullableBool, everything.aNullableBool);
|
||||||
XCTAssertEqual(result.aNullableInt, everything.aNullableInt);
|
XCTAssertEqual(result.aNullableInt, everything.aNullableInt);
|
||||||
XCTAssertEqual(result.aNullableDouble, everything.aNullableDouble);
|
XCTAssertEqual(result.aNullableDouble, everything.aNullableDouble);
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#import "MockBinaryMessenger.h"
|
#import "MockBinaryMessenger.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@interface MockHostSmallApi : NSObject <HostSmallApi>
|
@interface MockHostSmallApi : NSObject <FLTHostSmallApi>
|
||||||
@property(nonatomic, copy) NSString *output;
|
@property(nonatomic, copy) NSString *output;
|
||||||
@property(nonatomic, retain) FlutterError *voidVoidError;
|
@property(nonatomic, retain) FlutterError *voidVoidError;
|
||||||
@end
|
@end
|
||||||
@ -42,11 +42,11 @@
|
|||||||
|
|
||||||
- (void)testAsyncHost2Flutter {
|
- (void)testAsyncHost2Flutter {
|
||||||
MockBinaryMessenger *binaryMessenger =
|
MockBinaryMessenger *binaryMessenger =
|
||||||
[[MockBinaryMessenger alloc] initWithCodec:FlutterIntegrationCoreApiGetCodec()];
|
[[MockBinaryMessenger alloc] initWithCodec:FLTFlutterIntegrationCoreApiGetCodec()];
|
||||||
NSString *value = @"Test";
|
NSString *value = @"Test";
|
||||||
binaryMessenger.result = value;
|
binaryMessenger.result = value;
|
||||||
FlutterIntegrationCoreApi *flutterApi =
|
FLTFlutterIntegrationCoreApi *flutterApi =
|
||||||
[[FlutterIntegrationCoreApi alloc] initWithBinaryMessenger:binaryMessenger];
|
[[FLTFlutterIntegrationCoreApi alloc] initWithBinaryMessenger:binaryMessenger];
|
||||||
XCTestExpectation *expectation = [self expectationWithDescription:@"echo callback"];
|
XCTestExpectation *expectation = [self expectationWithDescription:@"echo callback"];
|
||||||
[flutterApi echoAsyncString:value
|
[flutterApi echoAsyncString:value
|
||||||
completion:^(NSString *_Nonnull output, FlutterError *_Nullable error) {
|
completion:^(NSString *_Nonnull output, FlutterError *_Nullable error) {
|
||||||
@ -58,9 +58,9 @@
|
|||||||
|
|
||||||
- (void)testAsyncFlutter2HostVoidVoid {
|
- (void)testAsyncFlutter2HostVoidVoid {
|
||||||
MockBinaryMessenger *binaryMessenger =
|
MockBinaryMessenger *binaryMessenger =
|
||||||
[[MockBinaryMessenger alloc] initWithCodec:HostSmallApiGetCodec()];
|
[[MockBinaryMessenger alloc] initWithCodec:FLTHostSmallApiGetCodec()];
|
||||||
MockHostSmallApi *mockHostSmallApi = [[MockHostSmallApi alloc] init];
|
MockHostSmallApi *mockHostSmallApi = [[MockHostSmallApi alloc] init];
|
||||||
SetUpHostSmallApi(binaryMessenger, mockHostSmallApi);
|
SetUpFLTHostSmallApi(binaryMessenger, mockHostSmallApi);
|
||||||
NSString *channelName = @"dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid";
|
NSString *channelName = @"dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid";
|
||||||
XCTAssertNotNil(binaryMessenger.handlers[channelName]);
|
XCTAssertNotNil(binaryMessenger.handlers[channelName]);
|
||||||
|
|
||||||
@ -75,12 +75,12 @@
|
|||||||
|
|
||||||
- (void)testAsyncFlutter2HostVoidVoidError {
|
- (void)testAsyncFlutter2HostVoidVoidError {
|
||||||
MockBinaryMessenger *binaryMessenger =
|
MockBinaryMessenger *binaryMessenger =
|
||||||
[[MockBinaryMessenger alloc] initWithCodec:HostSmallApiGetCodec()];
|
[[MockBinaryMessenger alloc] initWithCodec:FLTHostSmallApiGetCodec()];
|
||||||
MockHostSmallApi *mockHostSmallApi = [[MockHostSmallApi alloc] init];
|
MockHostSmallApi *mockHostSmallApi = [[MockHostSmallApi alloc] init];
|
||||||
mockHostSmallApi.voidVoidError = [FlutterError errorWithCode:@"code"
|
mockHostSmallApi.voidVoidError = [FlutterError errorWithCode:@"code"
|
||||||
message:@"message"
|
message:@"message"
|
||||||
details:nil];
|
details:nil];
|
||||||
SetUpHostSmallApi(binaryMessenger, mockHostSmallApi);
|
SetUpFLTHostSmallApi(binaryMessenger, mockHostSmallApi);
|
||||||
NSString *channelName = @"dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid";
|
NSString *channelName = @"dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.voidVoid";
|
||||||
XCTAssertNotNil(binaryMessenger.handlers[channelName]);
|
XCTAssertNotNil(binaryMessenger.handlers[channelName]);
|
||||||
|
|
||||||
@ -96,11 +96,11 @@
|
|||||||
|
|
||||||
- (void)testAsyncFlutter2Host {
|
- (void)testAsyncFlutter2Host {
|
||||||
MockBinaryMessenger *binaryMessenger =
|
MockBinaryMessenger *binaryMessenger =
|
||||||
[[MockBinaryMessenger alloc] initWithCodec:HostSmallApiGetCodec()];
|
[[MockBinaryMessenger alloc] initWithCodec:FLTHostSmallApiGetCodec()];
|
||||||
MockHostSmallApi *mockHostSmallApi = [[MockHostSmallApi alloc] init];
|
MockHostSmallApi *mockHostSmallApi = [[MockHostSmallApi alloc] init];
|
||||||
NSString *value = @"Test";
|
NSString *value = @"Test";
|
||||||
mockHostSmallApi.output = value;
|
mockHostSmallApi.output = value;
|
||||||
SetUpHostSmallApi(binaryMessenger, mockHostSmallApi);
|
SetUpFLTHostSmallApi(binaryMessenger, mockHostSmallApi);
|
||||||
NSString *channelName = @"dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo";
|
NSString *channelName = @"dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo";
|
||||||
XCTAssertNotNil(binaryMessenger.handlers[channelName]);
|
XCTAssertNotNil(binaryMessenger.handlers[channelName]);
|
||||||
|
|
||||||
@ -117,9 +117,9 @@
|
|||||||
|
|
||||||
- (void)testAsyncFlutter2HostError {
|
- (void)testAsyncFlutter2HostError {
|
||||||
MockBinaryMessenger *binaryMessenger =
|
MockBinaryMessenger *binaryMessenger =
|
||||||
[[MockBinaryMessenger alloc] initWithCodec:HostSmallApiGetCodec()];
|
[[MockBinaryMessenger alloc] initWithCodec:FLTHostSmallApiGetCodec()];
|
||||||
MockHostSmallApi *mockHostSmallApi = [[MockHostSmallApi alloc] init];
|
MockHostSmallApi *mockHostSmallApi = [[MockHostSmallApi alloc] init];
|
||||||
SetUpHostSmallApi(binaryMessenger, mockHostSmallApi);
|
SetUpFLTHostSmallApi(binaryMessenger, mockHostSmallApi);
|
||||||
NSString *channelName = @"dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo";
|
NSString *channelName = @"dev.flutter.pigeon.pigeon_integration_tests.HostSmallApi.echo";
|
||||||
XCTAssertNotNil(binaryMessenger.handlers[channelName]);
|
XCTAssertNotNil(binaryMessenger.handlers[channelName]);
|
||||||
|
|
||||||
|
@ -17,18 +17,18 @@
|
|||||||
@implementation ListTest
|
@implementation ListTest
|
||||||
|
|
||||||
- (void)testListInList {
|
- (void)testListInList {
|
||||||
TestMessage *top = [[TestMessage alloc] init];
|
FLTTestMessage *top = [[FLTTestMessage alloc] init];
|
||||||
TestMessage *inside = [[TestMessage alloc] init];
|
FLTTestMessage *inside = [[FLTTestMessage alloc] init];
|
||||||
inside.testList = @[ @1, @2, @3 ];
|
inside.testList = @[ @1, @2, @3 ];
|
||||||
top.testList = @[ inside ];
|
top.testList = @[ inside ];
|
||||||
EchoBinaryMessenger *binaryMessenger =
|
EchoBinaryMessenger *binaryMessenger =
|
||||||
[[EchoBinaryMessenger alloc] initWithCodec:FlutterSmallApiGetCodec()];
|
[[EchoBinaryMessenger alloc] initWithCodec:FLTFlutterSmallApiGetCodec()];
|
||||||
FlutterSmallApi *api = [[FlutterSmallApi alloc] initWithBinaryMessenger:binaryMessenger];
|
FLTFlutterSmallApi *api = [[FLTFlutterSmallApi alloc] initWithBinaryMessenger:binaryMessenger];
|
||||||
XCTestExpectation *expectation = [self expectationWithDescription:@"callback"];
|
XCTestExpectation *expectation = [self expectationWithDescription:@"callback"];
|
||||||
[api echoWrappedList:top
|
[api echoWrappedList:top
|
||||||
completion:^(TestMessage *_Nonnull result, FlutterError *_Nullable err) {
|
completion:^(FLTTestMessage *_Nonnull result, FlutterError *_Nullable err) {
|
||||||
XCTAssertEqual(1u, result.testList.count);
|
XCTAssertEqual(1u, result.testList.count);
|
||||||
XCTAssertTrue([result.testList[0] isKindOfClass:[TestMessage class]]);
|
XCTAssertTrue([result.testList[0] isKindOfClass:[FLTTestMessage class]]);
|
||||||
XCTAssertEqualObjects(inside.testList, [result.testList[0] testList]);
|
XCTAssertEqualObjects(inside.testList, [result.testList[0] testList]);
|
||||||
[expectation fulfill];
|
[expectation fulfill];
|
||||||
}];
|
}];
|
||||||
|
@ -6,5 +6,5 @@
|
|||||||
|
|
||||||
#import "CoreTests.gen.h"
|
#import "CoreTests.gen.h"
|
||||||
|
|
||||||
@interface AlternateLanguageTestPlugin : NSObject <FlutterPlugin, HostIntegrationCoreApi>
|
@interface AlternateLanguageTestPlugin : NSObject <FlutterPlugin, FLTHostIntegrationCoreApi>
|
||||||
@end
|
@end
|
||||||
|
@ -7,16 +7,16 @@
|
|||||||
#import "CoreTests.gen.h"
|
#import "CoreTests.gen.h"
|
||||||
|
|
||||||
@interface AlternateLanguageTestPlugin ()
|
@interface AlternateLanguageTestPlugin ()
|
||||||
@property(nonatomic) FlutterIntegrationCoreApi *flutterAPI;
|
@property(nonatomic) FLTFlutterIntegrationCoreApi *flutterAPI;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/// This plugin handles the native side of the integration tests in example/integration_test/.
|
/// This plugin handles the native side of the integration tests in example/integration_test/.
|
||||||
@implementation AlternateLanguageTestPlugin
|
@implementation AlternateLanguageTestPlugin
|
||||||
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
|
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
|
||||||
AlternateLanguageTestPlugin *plugin = [[AlternateLanguageTestPlugin alloc] init];
|
AlternateLanguageTestPlugin *plugin = [[AlternateLanguageTestPlugin alloc] init];
|
||||||
SetUpHostIntegrationCoreApi([registrar messenger], plugin);
|
SetUpFLTHostIntegrationCoreApi([registrar messenger], plugin);
|
||||||
plugin.flutterAPI =
|
plugin.flutterAPI =
|
||||||
[[FlutterIntegrationCoreApi alloc] initWithBinaryMessenger:[registrar messenger]];
|
[[FLTFlutterIntegrationCoreApi alloc] initWithBinaryMessenger:[registrar messenger]];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark HostIntegrationCoreApi implementation
|
#pragma mark HostIntegrationCoreApi implementation
|
||||||
@ -24,13 +24,13 @@
|
|||||||
- (void)noopWithError:(FlutterError *_Nullable *_Nonnull)error {
|
- (void)noopWithError:(FlutterError *_Nullable *_Nonnull)error {
|
||||||
}
|
}
|
||||||
|
|
||||||
- (nullable AllTypes *)echoAllTypes:(AllTypes *)everything
|
- (nullable FLTAllTypes *)echoAllTypes:(FLTAllTypes *)everything
|
||||||
error:(FlutterError *_Nullable *_Nonnull)error {
|
error:(FlutterError *_Nullable *_Nonnull)error {
|
||||||
return everything;
|
return everything;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (nullable AllNullableTypes *)echoAllNullableTypes:(nullable AllNullableTypes *)everything
|
- (nullable FLTAllNullableTypes *)echoAllNullableTypes:(nullable FLTAllNullableTypes *)everything
|
||||||
error:(FlutterError *_Nullable *_Nonnull)error {
|
error:(FlutterError *_Nullable *_Nonnull)error {
|
||||||
return everything;
|
return everything;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,13 +84,14 @@
|
|||||||
return aMap;
|
return aMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (nullable AllClassesWrapper *)echoClassWrapper:(AllClassesWrapper *)wrapper
|
- (nullable FLTAllClassesWrapper *)echoClassWrapper:(FLTAllClassesWrapper *)wrapper
|
||||||
error:(FlutterError *_Nullable *_Nonnull)error {
|
error:(FlutterError *_Nullable *_Nonnull)error {
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (AnEnumBox *_Nullable)echoEnum:(AnEnum)anEnum error:(FlutterError *_Nullable *_Nonnull)error {
|
- (FLTAnEnumBox *_Nullable)echoEnum:(FLTAnEnum)anEnum
|
||||||
return [[AnEnumBox alloc] initWithValue:anEnum];
|
error:(FlutterError *_Nullable *_Nonnull)error {
|
||||||
|
return [[FLTAnEnumBox alloc] initWithValue:anEnum];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (nullable NSString *)echoNamedDefaultString:(NSString *)aString
|
- (nullable NSString *)echoNamedDefaultString:(NSString *)aString
|
||||||
@ -108,25 +109,25 @@
|
|||||||
return @(anInt);
|
return @(anInt);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (nullable NSString *)extractNestedNullableStringFrom:(AllClassesWrapper *)wrapper
|
- (nullable NSString *)extractNestedNullableStringFrom:(FLTAllClassesWrapper *)wrapper
|
||||||
error:(FlutterError *_Nullable *_Nonnull)error {
|
error:(FlutterError *_Nullable *_Nonnull)error {
|
||||||
return wrapper.allNullableTypes.aNullableString;
|
return wrapper.allNullableTypes.aNullableString;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (nullable AllClassesWrapper *)
|
- (nullable FLTAllClassesWrapper *)
|
||||||
createNestedObjectWithNullableString:(nullable NSString *)nullableString
|
createNestedObjectWithNullableString:(nullable NSString *)nullableString
|
||||||
error:(FlutterError *_Nullable *_Nonnull)error {
|
error:(FlutterError *_Nullable *_Nonnull)error {
|
||||||
AllNullableTypes *innerObject = [[AllNullableTypes alloc] init];
|
FLTAllNullableTypes *innerObject = [[FLTAllNullableTypes alloc] init];
|
||||||
innerObject.aNullableString = nullableString;
|
innerObject.aNullableString = nullableString;
|
||||||
return [AllClassesWrapper makeWithAllNullableTypes:innerObject allTypes:nil];
|
return [FLTAllClassesWrapper makeWithAllNullableTypes:innerObject allTypes:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (nullable AllNullableTypes *)sendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool
|
- (nullable FLTAllNullableTypes *)
|
||||||
anInt:(nullable NSNumber *)aNullableInt
|
sendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool
|
||||||
aString:(nullable NSString *)aNullableString
|
anInt:(nullable NSNumber *)aNullableInt
|
||||||
error:(FlutterError *_Nullable *_Nonnull)
|
aString:(nullable NSString *)aNullableString
|
||||||
error {
|
error:(FlutterError *_Nullable *_Nonnull)error {
|
||||||
AllNullableTypes *someTypes = [[AllNullableTypes alloc] init];
|
FLTAllNullableTypes *someTypes = [[FLTAllNullableTypes alloc] init];
|
||||||
someTypes.aNullableBool = aNullableBool;
|
someTypes.aNullableBool = aNullableBool;
|
||||||
someTypes.aNullableInt = aNullableInt;
|
someTypes.aNullableInt = aNullableInt;
|
||||||
someTypes.aNullableString = aNullableString;
|
someTypes.aNullableString = aNullableString;
|
||||||
@ -175,8 +176,8 @@
|
|||||||
return aNullableMap;
|
return aNullableMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (AnEnumBox *_Nullable)echoNullableEnum:(nullable AnEnumBox *)AnEnumBoxed
|
- (FLTAnEnumBox *_Nullable)echoNullableEnum:(nullable FLTAnEnumBox *)AnEnumBoxed
|
||||||
error:(FlutterError *_Nullable *_Nonnull)error {
|
error:(FlutterError *_Nullable *_Nonnull)error {
|
||||||
return AnEnumBoxed;
|
return AnEnumBoxed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,13 +208,13 @@
|
|||||||
completion(nil, [FlutterError errorWithCode:@"code" message:@"message" details:@"details"]);
|
completion(nil, [FlutterError errorWithCode:@"code" message:@"message" details:@"details"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)echoAsyncAllTypes:(AllTypes *)everything
|
- (void)echoAsyncAllTypes:(FLTAllTypes *)everything
|
||||||
completion:(void (^)(AllTypes *_Nullable, FlutterError *_Nullable))completion {
|
completion:(void (^)(FLTAllTypes *_Nullable, FlutterError *_Nullable))completion {
|
||||||
completion(everything, nil);
|
completion(everything, nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)echoAsyncNullableAllNullableTypes:(nullable AllNullableTypes *)everything
|
- (void)echoAsyncNullableAllNullableTypes:(nullable FLTAllNullableTypes *)everything
|
||||||
completion:(void (^)(AllNullableTypes *_Nullable,
|
completion:(void (^)(FLTAllNullableTypes *_Nullable,
|
||||||
FlutterError *_Nullable))completion {
|
FlutterError *_Nullable))completion {
|
||||||
completion(everything, nil);
|
completion(everything, nil);
|
||||||
}
|
}
|
||||||
@ -260,9 +261,9 @@
|
|||||||
completion(aMap, nil);
|
completion(aMap, nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)echoAsyncEnum:(AnEnum)anEnum
|
- (void)echoAsyncEnum:(FLTAnEnum)anEnum
|
||||||
completion:(void (^)(AnEnumBox *_Nullable, FlutterError *_Nullable))completion {
|
completion:(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion {
|
||||||
completion([[AnEnumBox alloc] initWithValue:anEnum], nil);
|
completion([[FLTAnEnumBox alloc] initWithValue:anEnum], nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)echoAsyncNullableInt:(nullable NSNumber *)anInt
|
- (void)echoAsyncNullableInt:(nullable NSNumber *)anInt
|
||||||
@ -308,8 +309,9 @@
|
|||||||
completion(aMap, nil);
|
completion(aMap, nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)echoAsyncNullableEnum:(nullable AnEnumBox *)AnEnumBoxed
|
- (void)echoAsyncNullableEnum:(nullable FLTAnEnumBox *)AnEnumBoxed
|
||||||
completion:(void (^)(AnEnumBox *_Nullable, FlutterError *_Nullable))completion {
|
completion:
|
||||||
|
(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion {
|
||||||
completion(AnEnumBoxed, nil);
|
completion(AnEnumBoxed, nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,10 +334,11 @@
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)callFlutterEchoAllTypes:(AllTypes *)everything
|
- (void)callFlutterEchoAllTypes:(FLTAllTypes *)everything
|
||||||
completion:(void (^)(AllTypes *_Nullable, FlutterError *_Nullable))completion {
|
completion:
|
||||||
|
(void (^)(FLTAllTypes *_Nullable, FlutterError *_Nullable))completion {
|
||||||
[self.flutterAPI echoAllTypes:everything
|
[self.flutterAPI echoAllTypes:everything
|
||||||
completion:^(AllTypes *value, FlutterError *error) {
|
completion:^(FLTAllTypes *value, FlutterError *error) {
|
||||||
completion(value, error);
|
completion(value, error);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
@ -343,14 +346,15 @@
|
|||||||
- (void)callFlutterSendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool
|
- (void)callFlutterSendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool
|
||||||
anInt:(nullable NSNumber *)aNullableInt
|
anInt:(nullable NSNumber *)aNullableInt
|
||||||
aString:(nullable NSString *)aNullableString
|
aString:(nullable NSString *)aNullableString
|
||||||
completion:(void (^)(AllNullableTypes *_Nullable,
|
completion:(void (^)(FLTAllNullableTypes *_Nullable,
|
||||||
FlutterError *_Nullable))completion {
|
FlutterError *_Nullable))completion {
|
||||||
[self.flutterAPI sendMultipleNullableTypesABool:aNullableBool
|
[self.flutterAPI
|
||||||
anInt:aNullableInt
|
sendMultipleNullableTypesABool:aNullableBool
|
||||||
aString:aNullableString
|
anInt:aNullableInt
|
||||||
completion:^(AllNullableTypes *value, FlutterError *error) {
|
aString:aNullableString
|
||||||
completion(value, error);
|
completion:^(FLTAllNullableTypes *value, FlutterError *error) {
|
||||||
}];
|
completion(value, error);
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)callFlutterEchoBool:(BOOL)aBool
|
- (void)callFlutterEchoBool:(BOOL)aBool
|
||||||
@ -411,19 +415,19 @@
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)callFlutterEchoEnum:(AnEnum)anEnum
|
- (void)callFlutterEchoEnum:(FLTAnEnum)anEnum
|
||||||
completion:(void (^)(AnEnumBox *_Nullable, FlutterError *_Nullable))completion {
|
completion:(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion {
|
||||||
[self.flutterAPI echoEnum:anEnum
|
[self.flutterAPI echoEnum:anEnum
|
||||||
completion:^(AnEnumBox *value, FlutterError *error) {
|
completion:^(FLTAnEnumBox *value, FlutterError *error) {
|
||||||
completion(value, error);
|
completion(value, error);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)callFlutterEchoAllNullableTypes:(nullable AllNullableTypes *)everything
|
- (void)callFlutterEchoAllNullableTypes:(nullable FLTAllNullableTypes *)everything
|
||||||
completion:(void (^)(AllNullableTypes *_Nullable,
|
completion:(void (^)(FLTAllNullableTypes *_Nullable,
|
||||||
FlutterError *_Nullable))completion {
|
FlutterError *_Nullable))completion {
|
||||||
[self.flutterAPI echoAllNullableTypes:everything
|
[self.flutterAPI echoAllNullableTypes:everything
|
||||||
completion:^(AllNullableTypes *value, FlutterError *error) {
|
completion:^(FLTAllNullableTypes *value, FlutterError *error) {
|
||||||
completion(value, error);
|
completion(value, error);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
@ -491,11 +495,11 @@
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)callFlutterEchoNullableEnum:(nullable AnEnumBox *)AnEnumBoxed
|
- (void)callFlutterEchoNullableEnum:(nullable FLTAnEnumBox *)AnEnumBoxed
|
||||||
completion:
|
completion:(void (^)(FLTAnEnumBox *_Nullable,
|
||||||
(void (^)(AnEnumBox *_Nullable, FlutterError *_Nullable))completion {
|
FlutterError *_Nullable))completion {
|
||||||
[self.flutterAPI echoNullableEnum:AnEnumBoxed
|
[self.flutterAPI echoNullableEnum:AnEnumBoxed
|
||||||
completion:^(AnEnumBox *value, FlutterError *error) {
|
completion:^(FLTAnEnumBox *value, FlutterError *error) {
|
||||||
completion(value, error);
|
completion(value, error);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
@ -14,27 +14,27 @@
|
|||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
typedef NS_ENUM(NSUInteger, AnEnum) {
|
typedef NS_ENUM(NSUInteger, FLTAnEnum) {
|
||||||
AnEnumOne = 0,
|
FLTAnEnumOne = 0,
|
||||||
AnEnumTwo = 1,
|
FLTAnEnumTwo = 1,
|
||||||
AnEnumThree = 2,
|
FLTAnEnumThree = 2,
|
||||||
AnEnumFortyTwo = 3,
|
FLTAnEnumFortyTwo = 3,
|
||||||
AnEnumFourHundredTwentyTwo = 4,
|
FLTAnEnumFourHundredTwentyTwo = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Wrapper for AnEnum to allow for nullability.
|
/// Wrapper for FLTAnEnum to allow for nullability.
|
||||||
@interface AnEnumBox : NSObject
|
@interface FLTAnEnumBox : NSObject
|
||||||
@property(nonatomic, assign) AnEnum value;
|
@property(nonatomic, assign) FLTAnEnum value;
|
||||||
- (instancetype)initWithValue:(AnEnum)value;
|
- (instancetype)initWithValue:(FLTAnEnum)value;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@class AllTypes;
|
@class FLTAllTypes;
|
||||||
@class AllNullableTypes;
|
@class FLTAllNullableTypes;
|
||||||
@class AllClassesWrapper;
|
@class FLTAllClassesWrapper;
|
||||||
@class TestMessage;
|
@class FLTTestMessage;
|
||||||
|
|
||||||
/// A class containing all supported types.
|
/// A class containing all supported types.
|
||||||
@interface AllTypes : NSObject
|
@interface FLTAllTypes : NSObject
|
||||||
/// `init` unavailable to enforce nonnull fields, see the `make` class method.
|
/// `init` unavailable to enforce nonnull fields, see the `make` class method.
|
||||||
- (instancetype)init NS_UNAVAILABLE;
|
- (instancetype)init NS_UNAVAILABLE;
|
||||||
+ (instancetype)makeWithABool:(BOOL)aBool
|
+ (instancetype)makeWithABool:(BOOL)aBool
|
||||||
@ -47,7 +47,7 @@ typedef NS_ENUM(NSUInteger, AnEnum) {
|
|||||||
aFloatArray:(FlutterStandardTypedData *)aFloatArray
|
aFloatArray:(FlutterStandardTypedData *)aFloatArray
|
||||||
aList:(NSArray *)aList
|
aList:(NSArray *)aList
|
||||||
aMap:(NSDictionary *)aMap
|
aMap:(NSDictionary *)aMap
|
||||||
anEnum:(AnEnum)anEnum
|
anEnum:(FLTAnEnum)anEnum
|
||||||
aString:(NSString *)aString
|
aString:(NSString *)aString
|
||||||
anObject:(id)anObject;
|
anObject:(id)anObject;
|
||||||
@property(nonatomic, assign) BOOL aBool;
|
@property(nonatomic, assign) BOOL aBool;
|
||||||
@ -60,13 +60,13 @@ typedef NS_ENUM(NSUInteger, AnEnum) {
|
|||||||
@property(nonatomic, strong) FlutterStandardTypedData *aFloatArray;
|
@property(nonatomic, strong) FlutterStandardTypedData *aFloatArray;
|
||||||
@property(nonatomic, copy) NSArray *aList;
|
@property(nonatomic, copy) NSArray *aList;
|
||||||
@property(nonatomic, copy) NSDictionary *aMap;
|
@property(nonatomic, copy) NSDictionary *aMap;
|
||||||
@property(nonatomic, assign) AnEnum anEnum;
|
@property(nonatomic, assign) FLTAnEnum anEnum;
|
||||||
@property(nonatomic, copy) NSString *aString;
|
@property(nonatomic, copy) NSString *aString;
|
||||||
@property(nonatomic, strong) id anObject;
|
@property(nonatomic, strong) id anObject;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/// A class containing all supported nullable types.
|
/// A class containing all supported nullable types.
|
||||||
@interface AllNullableTypes : NSObject
|
@interface FLTAllNullableTypes : NSObject
|
||||||
+ (instancetype)makeWithANullableBool:(nullable NSNumber *)aNullableBool
|
+ (instancetype)makeWithANullableBool:(nullable NSNumber *)aNullableBool
|
||||||
aNullableInt:(nullable NSNumber *)aNullableInt
|
aNullableInt:(nullable NSNumber *)aNullableInt
|
||||||
aNullableInt64:(nullable NSNumber *)aNullableInt64
|
aNullableInt64:(nullable NSNumber *)aNullableInt64
|
||||||
@ -81,7 +81,7 @@ typedef NS_ENUM(NSUInteger, AnEnum) {
|
|||||||
nullableMapWithAnnotations:
|
nullableMapWithAnnotations:
|
||||||
(nullable NSDictionary<NSString *, NSString *> *)nullableMapWithAnnotations
|
(nullable NSDictionary<NSString *, NSString *> *)nullableMapWithAnnotations
|
||||||
nullableMapWithObject:(nullable NSDictionary<NSString *, id> *)nullableMapWithObject
|
nullableMapWithObject:(nullable NSDictionary<NSString *, id> *)nullableMapWithObject
|
||||||
aNullableEnum:(nullable AnEnumBox *)aNullableEnum
|
aNullableEnum:(nullable FLTAnEnumBox *)aNullableEnum
|
||||||
aNullableString:(nullable NSString *)aNullableString
|
aNullableString:(nullable NSString *)aNullableString
|
||||||
aNullableObject:(nullable id)aNullableObject;
|
aNullableObject:(nullable id)aNullableObject;
|
||||||
@property(nonatomic, strong, nullable) NSNumber *aNullableBool;
|
@property(nonatomic, strong, nullable) NSNumber *aNullableBool;
|
||||||
@ -98,7 +98,7 @@ typedef NS_ENUM(NSUInteger, AnEnum) {
|
|||||||
@property(nonatomic, copy, nullable)
|
@property(nonatomic, copy, nullable)
|
||||||
NSDictionary<NSString *, NSString *> *nullableMapWithAnnotations;
|
NSDictionary<NSString *, NSString *> *nullableMapWithAnnotations;
|
||||||
@property(nonatomic, copy, nullable) NSDictionary<NSString *, id> *nullableMapWithObject;
|
@property(nonatomic, copy, nullable) NSDictionary<NSString *, id> *nullableMapWithObject;
|
||||||
@property(nonatomic, strong, nullable) AnEnumBox *aNullableEnum;
|
@property(nonatomic, strong, nullable) FLTAnEnumBox *aNullableEnum;
|
||||||
@property(nonatomic, copy, nullable) NSString *aNullableString;
|
@property(nonatomic, copy, nullable) NSString *aNullableString;
|
||||||
@property(nonatomic, strong, nullable) id aNullableObject;
|
@property(nonatomic, strong, nullable) id aNullableObject;
|
||||||
@end
|
@end
|
||||||
@ -108,35 +108,35 @@ typedef NS_ENUM(NSUInteger, AnEnum) {
|
|||||||
/// This is needed to test nested nullable and non-nullable classes,
|
/// This is needed to test nested nullable and non-nullable classes,
|
||||||
/// `AllNullableTypes` is non-nullable here as it is easier to instantiate
|
/// `AllNullableTypes` is non-nullable here as it is easier to instantiate
|
||||||
/// than `AllTypes` when testing doesn't require both (ie. testing null classes).
|
/// than `AllTypes` when testing doesn't require both (ie. testing null classes).
|
||||||
@interface AllClassesWrapper : NSObject
|
@interface FLTAllClassesWrapper : NSObject
|
||||||
/// `init` unavailable to enforce nonnull fields, see the `make` class method.
|
/// `init` unavailable to enforce nonnull fields, see the `make` class method.
|
||||||
- (instancetype)init NS_UNAVAILABLE;
|
- (instancetype)init NS_UNAVAILABLE;
|
||||||
+ (instancetype)makeWithAllNullableTypes:(AllNullableTypes *)allNullableTypes
|
+ (instancetype)makeWithAllNullableTypes:(FLTAllNullableTypes *)allNullableTypes
|
||||||
allTypes:(nullable AllTypes *)allTypes;
|
allTypes:(nullable FLTAllTypes *)allTypes;
|
||||||
@property(nonatomic, strong) AllNullableTypes *allNullableTypes;
|
@property(nonatomic, strong) FLTAllNullableTypes *allNullableTypes;
|
||||||
@property(nonatomic, strong, nullable) AllTypes *allTypes;
|
@property(nonatomic, strong, nullable) FLTAllTypes *allTypes;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/// A data class containing a List, used in unit tests.
|
/// A data class containing a List, used in unit tests.
|
||||||
@interface TestMessage : NSObject
|
@interface FLTTestMessage : NSObject
|
||||||
+ (instancetype)makeWithTestList:(nullable NSArray *)testList;
|
+ (instancetype)makeWithTestList:(nullable NSArray *)testList;
|
||||||
@property(nonatomic, copy, nullable) NSArray *testList;
|
@property(nonatomic, copy, nullable) NSArray *testList;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/// The codec used by HostIntegrationCoreApi.
|
/// The codec used by FLTHostIntegrationCoreApi.
|
||||||
NSObject<FlutterMessageCodec> *HostIntegrationCoreApiGetCodec(void);
|
NSObject<FlutterMessageCodec> *FLTHostIntegrationCoreApiGetCodec(void);
|
||||||
|
|
||||||
/// The core interface that each host language plugin must implement in
|
/// The core interface that each host language plugin must implement in
|
||||||
/// platform_test integration tests.
|
/// platform_test integration tests.
|
||||||
@protocol HostIntegrationCoreApi
|
@protocol FLTHostIntegrationCoreApi
|
||||||
/// A no-op function taking no arguments and returning no value, to sanity
|
/// A no-op function taking no arguments and returning no value, to sanity
|
||||||
/// test basic calling.
|
/// test basic calling.
|
||||||
- (void)noopWithError:(FlutterError *_Nullable *_Nonnull)error;
|
- (void)noopWithError:(FlutterError *_Nullable *_Nonnull)error;
|
||||||
/// Returns the passed object, to test serialization and deserialization.
|
/// Returns the passed object, to test serialization and deserialization.
|
||||||
///
|
///
|
||||||
/// @return `nil` only when `error != nil`.
|
/// @return `nil` only when `error != nil`.
|
||||||
- (nullable AllTypes *)echoAllTypes:(AllTypes *)everything
|
- (nullable FLTAllTypes *)echoAllTypes:(FLTAllTypes *)everything
|
||||||
error:(FlutterError *_Nullable *_Nonnull)error;
|
error:(FlutterError *_Nullable *_Nonnull)error;
|
||||||
/// Returns an error, to test error handling.
|
/// Returns an error, to test error handling.
|
||||||
- (nullable id)throwErrorWithError:(FlutterError *_Nullable *_Nonnull)error;
|
- (nullable id)throwErrorWithError:(FlutterError *_Nullable *_Nonnull)error;
|
||||||
/// Returns an error from a void function, to test error handling.
|
/// Returns an error from a void function, to test error handling.
|
||||||
@ -182,12 +182,13 @@ NSObject<FlutterMessageCodec> *HostIntegrationCoreApiGetCodec(void);
|
|||||||
/// Returns the passed map to test nested class serialization and deserialization.
|
/// Returns the passed map to test nested class serialization and deserialization.
|
||||||
///
|
///
|
||||||
/// @return `nil` only when `error != nil`.
|
/// @return `nil` only when `error != nil`.
|
||||||
- (nullable AllClassesWrapper *)echoClassWrapper:(AllClassesWrapper *)wrapper
|
- (nullable FLTAllClassesWrapper *)echoClassWrapper:(FLTAllClassesWrapper *)wrapper
|
||||||
error:(FlutterError *_Nullable *_Nonnull)error;
|
error:(FlutterError *_Nullable *_Nonnull)error;
|
||||||
/// Returns the passed enum to test serialization and deserialization.
|
/// Returns the passed enum to test serialization and deserialization.
|
||||||
///
|
///
|
||||||
/// @return `nil` only when `error != nil`.
|
/// @return `nil` only when `error != nil`.
|
||||||
- (AnEnumBox *_Nullable)echoEnum:(AnEnum)anEnum error:(FlutterError *_Nullable *_Nonnull)error;
|
- (FLTAnEnumBox *_Nullable)echoEnum:(FLTAnEnum)anEnum
|
||||||
|
error:(FlutterError *_Nullable *_Nonnull)error;
|
||||||
/// Returns the default string.
|
/// Returns the default string.
|
||||||
///
|
///
|
||||||
/// @return `nil` only when `error != nil`.
|
/// @return `nil` only when `error != nil`.
|
||||||
@ -204,27 +205,27 @@ NSObject<FlutterMessageCodec> *HostIntegrationCoreApiGetCodec(void);
|
|||||||
- (nullable NSNumber *)echoRequiredInt:(NSInteger)anInt
|
- (nullable NSNumber *)echoRequiredInt:(NSInteger)anInt
|
||||||
error:(FlutterError *_Nullable *_Nonnull)error;
|
error:(FlutterError *_Nullable *_Nonnull)error;
|
||||||
/// Returns the passed object, to test serialization and deserialization.
|
/// Returns the passed object, to test serialization and deserialization.
|
||||||
- (nullable AllNullableTypes *)echoAllNullableTypes:(nullable AllNullableTypes *)everything
|
- (nullable FLTAllNullableTypes *)echoAllNullableTypes:(nullable FLTAllNullableTypes *)everything
|
||||||
error:(FlutterError *_Nullable *_Nonnull)error;
|
error:(FlutterError *_Nullable *_Nonnull)error;
|
||||||
/// Returns the inner `aString` value from the wrapped object, to test
|
/// Returns the inner `aString` value from the wrapped object, to test
|
||||||
/// sending of nested objects.
|
/// sending of nested objects.
|
||||||
- (nullable NSString *)extractNestedNullableStringFrom:(AllClassesWrapper *)wrapper
|
- (nullable NSString *)extractNestedNullableStringFrom:(FLTAllClassesWrapper *)wrapper
|
||||||
error:(FlutterError *_Nullable *_Nonnull)error;
|
error:(FlutterError *_Nullable *_Nonnull)error;
|
||||||
/// Returns the inner `aString` value from the wrapped object, to test
|
/// Returns the inner `aString` value from the wrapped object, to test
|
||||||
/// sending of nested objects.
|
/// sending of nested objects.
|
||||||
///
|
///
|
||||||
/// @return `nil` only when `error != nil`.
|
/// @return `nil` only when `error != nil`.
|
||||||
- (nullable AllClassesWrapper *)
|
- (nullable FLTAllClassesWrapper *)
|
||||||
createNestedObjectWithNullableString:(nullable NSString *)nullableString
|
createNestedObjectWithNullableString:(nullable NSString *)nullableString
|
||||||
error:(FlutterError *_Nullable *_Nonnull)error;
|
error:(FlutterError *_Nullable *_Nonnull)error;
|
||||||
/// Returns passed in arguments of multiple types.
|
/// Returns passed in arguments of multiple types.
|
||||||
///
|
///
|
||||||
/// @return `nil` only when `error != nil`.
|
/// @return `nil` only when `error != nil`.
|
||||||
- (nullable AllNullableTypes *)sendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool
|
- (nullable FLTAllNullableTypes *)
|
||||||
anInt:(nullable NSNumber *)aNullableInt
|
sendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool
|
||||||
aString:(nullable NSString *)aNullableString
|
anInt:(nullable NSNumber *)aNullableInt
|
||||||
error:(FlutterError *_Nullable *_Nonnull)
|
aString:(nullable NSString *)aNullableString
|
||||||
error;
|
error:(FlutterError *_Nullable *_Nonnull)error;
|
||||||
/// Returns passed in int.
|
/// Returns passed in int.
|
||||||
- (nullable NSNumber *)echoNullableInt:(nullable NSNumber *)aNullableInt
|
- (nullable NSNumber *)echoNullableInt:(nullable NSNumber *)aNullableInt
|
||||||
error:(FlutterError *_Nullable *_Nonnull)error;
|
error:(FlutterError *_Nullable *_Nonnull)error;
|
||||||
@ -251,8 +252,8 @@ NSObject<FlutterMessageCodec> *HostIntegrationCoreApiGetCodec(void);
|
|||||||
- (nullable NSDictionary<NSString *, id> *)echoNullableMap:
|
- (nullable NSDictionary<NSString *, id> *)echoNullableMap:
|
||||||
(nullable NSDictionary<NSString *, id> *)aNullableMap
|
(nullable NSDictionary<NSString *, id> *)aNullableMap
|
||||||
error:(FlutterError *_Nullable *_Nonnull)error;
|
error:(FlutterError *_Nullable *_Nonnull)error;
|
||||||
- (AnEnumBox *_Nullable)echoNullableEnum:(nullable AnEnumBox *)anEnumBoxed
|
- (FLTAnEnumBox *_Nullable)echoNullableEnum:(nullable FLTAnEnumBox *)anEnumBoxed
|
||||||
error:(FlutterError *_Nullable *_Nonnull)error;
|
error:(FlutterError *_Nullable *_Nonnull)error;
|
||||||
/// Returns passed in int.
|
/// Returns passed in int.
|
||||||
- (nullable NSNumber *)echoOptionalNullableInt:(nullable NSNumber *)aNullableInt
|
- (nullable NSNumber *)echoOptionalNullableInt:(nullable NSNumber *)aNullableInt
|
||||||
error:(FlutterError *_Nullable *_Nonnull)error;
|
error:(FlutterError *_Nullable *_Nonnull)error;
|
||||||
@ -289,8 +290,8 @@ NSObject<FlutterMessageCodec> *HostIntegrationCoreApiGetCodec(void);
|
|||||||
completion:(void (^)(NSDictionary<NSString *, id> *_Nullable,
|
completion:(void (^)(NSDictionary<NSString *, id> *_Nullable,
|
||||||
FlutterError *_Nullable))completion;
|
FlutterError *_Nullable))completion;
|
||||||
/// Returns the passed enum, to test asynchronous serialization and deserialization.
|
/// Returns the passed enum, to test asynchronous serialization and deserialization.
|
||||||
- (void)echoAsyncEnum:(AnEnum)anEnum
|
- (void)echoAsyncEnum:(FLTAnEnum)anEnum
|
||||||
completion:(void (^)(AnEnumBox *_Nullable, FlutterError *_Nullable))completion;
|
completion:(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion;
|
||||||
/// Responds with an error from an async function returning a value.
|
/// Responds with an error from an async function returning a value.
|
||||||
- (void)throwAsyncErrorWithCompletion:(void (^)(id _Nullable, FlutterError *_Nullable))completion;
|
- (void)throwAsyncErrorWithCompletion:(void (^)(id _Nullable, FlutterError *_Nullable))completion;
|
||||||
/// Responds with an error from an async void function.
|
/// Responds with an error from an async void function.
|
||||||
@ -299,11 +300,11 @@ NSObject<FlutterMessageCodec> *HostIntegrationCoreApiGetCodec(void);
|
|||||||
- (void)throwAsyncFlutterErrorWithCompletion:(void (^)(id _Nullable,
|
- (void)throwAsyncFlutterErrorWithCompletion:(void (^)(id _Nullable,
|
||||||
FlutterError *_Nullable))completion;
|
FlutterError *_Nullable))completion;
|
||||||
/// Returns the passed object, to test async serialization and deserialization.
|
/// Returns the passed object, to test async serialization and deserialization.
|
||||||
- (void)echoAsyncAllTypes:(AllTypes *)everything
|
- (void)echoAsyncAllTypes:(FLTAllTypes *)everything
|
||||||
completion:(void (^)(AllTypes *_Nullable, FlutterError *_Nullable))completion;
|
completion:(void (^)(FLTAllTypes *_Nullable, FlutterError *_Nullable))completion;
|
||||||
/// Returns the passed object, to test serialization and deserialization.
|
/// Returns the passed object, to test serialization and deserialization.
|
||||||
- (void)echoAsyncNullableAllNullableTypes:(nullable AllNullableTypes *)everything
|
- (void)echoAsyncNullableAllNullableTypes:(nullable FLTAllNullableTypes *)everything
|
||||||
completion:(void (^)(AllNullableTypes *_Nullable,
|
completion:(void (^)(FLTAllNullableTypes *_Nullable,
|
||||||
FlutterError *_Nullable))completion;
|
FlutterError *_Nullable))completion;
|
||||||
/// Returns passed in int asynchronously.
|
/// Returns passed in int asynchronously.
|
||||||
- (void)echoAsyncNullableInt:(nullable NSNumber *)anInt
|
- (void)echoAsyncNullableInt:(nullable NSNumber *)anInt
|
||||||
@ -332,21 +333,23 @@ NSObject<FlutterMessageCodec> *HostIntegrationCoreApiGetCodec(void);
|
|||||||
completion:(void (^)(NSDictionary<NSString *, id> *_Nullable,
|
completion:(void (^)(NSDictionary<NSString *, id> *_Nullable,
|
||||||
FlutterError *_Nullable))completion;
|
FlutterError *_Nullable))completion;
|
||||||
/// Returns the passed enum, to test asynchronous serialization and deserialization.
|
/// Returns the passed enum, to test asynchronous serialization and deserialization.
|
||||||
- (void)echoAsyncNullableEnum:(nullable AnEnumBox *)anEnumBoxed
|
- (void)echoAsyncNullableEnum:(nullable FLTAnEnumBox *)anEnumBoxed
|
||||||
completion:(void (^)(AnEnumBox *_Nullable, FlutterError *_Nullable))completion;
|
completion:
|
||||||
|
(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion;
|
||||||
- (void)callFlutterNoopWithCompletion:(void (^)(FlutterError *_Nullable))completion;
|
- (void)callFlutterNoopWithCompletion:(void (^)(FlutterError *_Nullable))completion;
|
||||||
- (void)callFlutterThrowErrorWithCompletion:(void (^)(id _Nullable,
|
- (void)callFlutterThrowErrorWithCompletion:(void (^)(id _Nullable,
|
||||||
FlutterError *_Nullable))completion;
|
FlutterError *_Nullable))completion;
|
||||||
- (void)callFlutterThrowErrorFromVoidWithCompletion:(void (^)(FlutterError *_Nullable))completion;
|
- (void)callFlutterThrowErrorFromVoidWithCompletion:(void (^)(FlutterError *_Nullable))completion;
|
||||||
- (void)callFlutterEchoAllTypes:(AllTypes *)everything
|
- (void)callFlutterEchoAllTypes:(FLTAllTypes *)everything
|
||||||
completion:(void (^)(AllTypes *_Nullable, FlutterError *_Nullable))completion;
|
completion:
|
||||||
- (void)callFlutterEchoAllNullableTypes:(nullable AllNullableTypes *)everything
|
(void (^)(FLTAllTypes *_Nullable, FlutterError *_Nullable))completion;
|
||||||
completion:(void (^)(AllNullableTypes *_Nullable,
|
- (void)callFlutterEchoAllNullableTypes:(nullable FLTAllNullableTypes *)everything
|
||||||
|
completion:(void (^)(FLTAllNullableTypes *_Nullable,
|
||||||
FlutterError *_Nullable))completion;
|
FlutterError *_Nullable))completion;
|
||||||
- (void)callFlutterSendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool
|
- (void)callFlutterSendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool
|
||||||
anInt:(nullable NSNumber *)aNullableInt
|
anInt:(nullable NSNumber *)aNullableInt
|
||||||
aString:(nullable NSString *)aNullableString
|
aString:(nullable NSString *)aNullableString
|
||||||
completion:(void (^)(AllNullableTypes *_Nullable,
|
completion:(void (^)(FLTAllNullableTypes *_Nullable,
|
||||||
FlutterError *_Nullable))completion;
|
FlutterError *_Nullable))completion;
|
||||||
- (void)callFlutterEchoBool:(BOOL)aBool
|
- (void)callFlutterEchoBool:(BOOL)aBool
|
||||||
completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion;
|
completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion;
|
||||||
@ -364,8 +367,8 @@ NSObject<FlutterMessageCodec> *HostIntegrationCoreApiGetCodec(void);
|
|||||||
- (void)callFlutterEchoMap:(NSDictionary<NSString *, id> *)aMap
|
- (void)callFlutterEchoMap:(NSDictionary<NSString *, id> *)aMap
|
||||||
completion:(void (^)(NSDictionary<NSString *, id> *_Nullable,
|
completion:(void (^)(NSDictionary<NSString *, id> *_Nullable,
|
||||||
FlutterError *_Nullable))completion;
|
FlutterError *_Nullable))completion;
|
||||||
- (void)callFlutterEchoEnum:(AnEnum)anEnum
|
- (void)callFlutterEchoEnum:(FLTAnEnum)anEnum
|
||||||
completion:(void (^)(AnEnumBox *_Nullable, FlutterError *_Nullable))completion;
|
completion:(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion;
|
||||||
- (void)callFlutterEchoNullableBool:(nullable NSNumber *)aBool
|
- (void)callFlutterEchoNullableBool:(nullable NSNumber *)aBool
|
||||||
completion:
|
completion:
|
||||||
(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion;
|
(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion;
|
||||||
@ -387,20 +390,20 @@ NSObject<FlutterMessageCodec> *HostIntegrationCoreApiGetCodec(void);
|
|||||||
- (void)callFlutterEchoNullableMap:(nullable NSDictionary<NSString *, id> *)aMap
|
- (void)callFlutterEchoNullableMap:(nullable NSDictionary<NSString *, id> *)aMap
|
||||||
completion:(void (^)(NSDictionary<NSString *, id> *_Nullable,
|
completion:(void (^)(NSDictionary<NSString *, id> *_Nullable,
|
||||||
FlutterError *_Nullable))completion;
|
FlutterError *_Nullable))completion;
|
||||||
- (void)callFlutterEchoNullableEnum:(nullable AnEnumBox *)anEnumBoxed
|
- (void)callFlutterEchoNullableEnum:(nullable FLTAnEnumBox *)anEnumBoxed
|
||||||
completion:
|
completion:
|
||||||
(void (^)(AnEnumBox *_Nullable, FlutterError *_Nullable))completion;
|
(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
extern void SetUpHostIntegrationCoreApi(id<FlutterBinaryMessenger> binaryMessenger,
|
extern void SetUpFLTHostIntegrationCoreApi(id<FlutterBinaryMessenger> binaryMessenger,
|
||||||
NSObject<HostIntegrationCoreApi> *_Nullable api);
|
NSObject<FLTHostIntegrationCoreApi> *_Nullable api);
|
||||||
|
|
||||||
/// The codec used by FlutterIntegrationCoreApi.
|
/// The codec used by FLTFlutterIntegrationCoreApi.
|
||||||
NSObject<FlutterMessageCodec> *FlutterIntegrationCoreApiGetCodec(void);
|
NSObject<FlutterMessageCodec> *FLTFlutterIntegrationCoreApiGetCodec(void);
|
||||||
|
|
||||||
/// The core interface that the Dart platform_test code implements for host
|
/// The core interface that the Dart platform_test code implements for host
|
||||||
/// integration tests to call into.
|
/// integration tests to call into.
|
||||||
@interface FlutterIntegrationCoreApi : NSObject
|
@interface FLTFlutterIntegrationCoreApi : NSObject
|
||||||
- (instancetype)initWithBinaryMessenger:(id<FlutterBinaryMessenger>)binaryMessenger;
|
- (instancetype)initWithBinaryMessenger:(id<FlutterBinaryMessenger>)binaryMessenger;
|
||||||
/// A no-op function taking no arguments and returning no value, to sanity
|
/// A no-op function taking no arguments and returning no value, to sanity
|
||||||
/// test basic calling.
|
/// test basic calling.
|
||||||
@ -410,19 +413,19 @@ NSObject<FlutterMessageCodec> *FlutterIntegrationCoreApiGetCodec(void);
|
|||||||
/// Responds with an error from an async void function.
|
/// Responds with an error from an async void function.
|
||||||
- (void)throwErrorFromVoidWithCompletion:(void (^)(FlutterError *_Nullable))completion;
|
- (void)throwErrorFromVoidWithCompletion:(void (^)(FlutterError *_Nullable))completion;
|
||||||
/// Returns the passed object, to test serialization and deserialization.
|
/// Returns the passed object, to test serialization and deserialization.
|
||||||
- (void)echoAllTypes:(AllTypes *)everything
|
- (void)echoAllTypes:(FLTAllTypes *)everything
|
||||||
completion:(void (^)(AllTypes *_Nullable, FlutterError *_Nullable))completion;
|
completion:(void (^)(FLTAllTypes *_Nullable, FlutterError *_Nullable))completion;
|
||||||
/// Returns the passed object, to test serialization and deserialization.
|
/// Returns the passed object, to test serialization and deserialization.
|
||||||
- (void)echoAllNullableTypes:(nullable AllNullableTypes *)everything
|
- (void)echoAllNullableTypes:(nullable FLTAllNullableTypes *)everything
|
||||||
completion:
|
completion:
|
||||||
(void (^)(AllNullableTypes *_Nullable, FlutterError *_Nullable))completion;
|
(void (^)(FLTAllNullableTypes *_Nullable, FlutterError *_Nullable))completion;
|
||||||
/// Returns passed in arguments of multiple types.
|
/// Returns passed in arguments of multiple types.
|
||||||
///
|
///
|
||||||
/// Tests multiple-arity FlutterApi handling.
|
/// Tests multiple-arity FlutterApi handling.
|
||||||
- (void)sendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool
|
- (void)sendMultipleNullableTypesABool:(nullable NSNumber *)aNullableBool
|
||||||
anInt:(nullable NSNumber *)aNullableInt
|
anInt:(nullable NSNumber *)aNullableInt
|
||||||
aString:(nullable NSString *)aNullableString
|
aString:(nullable NSString *)aNullableString
|
||||||
completion:(void (^)(AllNullableTypes *_Nullable,
|
completion:(void (^)(FLTAllNullableTypes *_Nullable,
|
||||||
FlutterError *_Nullable))completion;
|
FlutterError *_Nullable))completion;
|
||||||
/// Returns the passed boolean, to test serialization and deserialization.
|
/// Returns the passed boolean, to test serialization and deserialization.
|
||||||
- (void)echoBool:(BOOL)aBool
|
- (void)echoBool:(BOOL)aBool
|
||||||
@ -448,8 +451,8 @@ NSObject<FlutterMessageCodec> *FlutterIntegrationCoreApiGetCodec(void);
|
|||||||
completion:
|
completion:
|
||||||
(void (^)(NSDictionary<NSString *, id> *_Nullable, FlutterError *_Nullable))completion;
|
(void (^)(NSDictionary<NSString *, id> *_Nullable, FlutterError *_Nullable))completion;
|
||||||
/// Returns the passed enum to test serialization and deserialization.
|
/// Returns the passed enum to test serialization and deserialization.
|
||||||
- (void)echoEnum:(AnEnum)anEnum
|
- (void)echoEnum:(FLTAnEnum)anEnum
|
||||||
completion:(void (^)(AnEnumBox *_Nullable, FlutterError *_Nullable))completion;
|
completion:(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion;
|
||||||
/// Returns the passed boolean, to test serialization and deserialization.
|
/// Returns the passed boolean, to test serialization and deserialization.
|
||||||
- (void)echoNullableBool:(nullable NSNumber *)aBool
|
- (void)echoNullableBool:(nullable NSNumber *)aBool
|
||||||
completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion;
|
completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion;
|
||||||
@ -474,8 +477,8 @@ NSObject<FlutterMessageCodec> *FlutterIntegrationCoreApiGetCodec(void);
|
|||||||
completion:(void (^)(NSDictionary<NSString *, id> *_Nullable,
|
completion:(void (^)(NSDictionary<NSString *, id> *_Nullable,
|
||||||
FlutterError *_Nullable))completion;
|
FlutterError *_Nullable))completion;
|
||||||
/// Returns the passed enum to test serialization and deserialization.
|
/// Returns the passed enum to test serialization and deserialization.
|
||||||
- (void)echoNullableEnum:(nullable AnEnumBox *)anEnumBoxed
|
- (void)echoNullableEnum:(nullable FLTAnEnumBox *)anEnumBoxed
|
||||||
completion:(void (^)(AnEnumBox *_Nullable, FlutterError *_Nullable))completion;
|
completion:(void (^)(FLTAnEnumBox *_Nullable, FlutterError *_Nullable))completion;
|
||||||
/// A no-op function taking no arguments and returning no value, to sanity
|
/// A no-op function taking no arguments and returning no value, to sanity
|
||||||
/// test basic asynchronous calling.
|
/// test basic asynchronous calling.
|
||||||
- (void)noopAsyncWithCompletion:(void (^)(FlutterError *_Nullable))completion;
|
- (void)noopAsyncWithCompletion:(void (^)(FlutterError *_Nullable))completion;
|
||||||
@ -484,38 +487,38 @@ NSObject<FlutterMessageCodec> *FlutterIntegrationCoreApiGetCodec(void);
|
|||||||
completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion;
|
completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/// The codec used by HostTrivialApi.
|
/// The codec used by FLTHostTrivialApi.
|
||||||
NSObject<FlutterMessageCodec> *HostTrivialApiGetCodec(void);
|
NSObject<FlutterMessageCodec> *FLTHostTrivialApiGetCodec(void);
|
||||||
|
|
||||||
/// An API that can be implemented for minimal, compile-only tests.
|
/// An API that can be implemented for minimal, compile-only tests.
|
||||||
@protocol HostTrivialApi
|
@protocol FLTHostTrivialApi
|
||||||
- (void)noopWithError:(FlutterError *_Nullable *_Nonnull)error;
|
- (void)noopWithError:(FlutterError *_Nullable *_Nonnull)error;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
extern void SetUpHostTrivialApi(id<FlutterBinaryMessenger> binaryMessenger,
|
extern void SetUpFLTHostTrivialApi(id<FlutterBinaryMessenger> binaryMessenger,
|
||||||
NSObject<HostTrivialApi> *_Nullable api);
|
NSObject<FLTHostTrivialApi> *_Nullable api);
|
||||||
|
|
||||||
/// The codec used by HostSmallApi.
|
/// The codec used by FLTHostSmallApi.
|
||||||
NSObject<FlutterMessageCodec> *HostSmallApiGetCodec(void);
|
NSObject<FlutterMessageCodec> *FLTHostSmallApiGetCodec(void);
|
||||||
|
|
||||||
/// A simple API implemented in some unit tests.
|
/// A simple API implemented in some unit tests.
|
||||||
@protocol HostSmallApi
|
@protocol FLTHostSmallApi
|
||||||
- (void)echoString:(NSString *)aString
|
- (void)echoString:(NSString *)aString
|
||||||
completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion;
|
completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion;
|
||||||
- (void)voidVoidWithCompletion:(void (^)(FlutterError *_Nullable))completion;
|
- (void)voidVoidWithCompletion:(void (^)(FlutterError *_Nullable))completion;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
extern void SetUpHostSmallApi(id<FlutterBinaryMessenger> binaryMessenger,
|
extern void SetUpFLTHostSmallApi(id<FlutterBinaryMessenger> binaryMessenger,
|
||||||
NSObject<HostSmallApi> *_Nullable api);
|
NSObject<FLTHostSmallApi> *_Nullable api);
|
||||||
|
|
||||||
/// The codec used by FlutterSmallApi.
|
/// The codec used by FLTFlutterSmallApi.
|
||||||
NSObject<FlutterMessageCodec> *FlutterSmallApiGetCodec(void);
|
NSObject<FlutterMessageCodec> *FLTFlutterSmallApiGetCodec(void);
|
||||||
|
|
||||||
/// A simple API called in some unit tests.
|
/// A simple API called in some unit tests.
|
||||||
@interface FlutterSmallApi : NSObject
|
@interface FLTFlutterSmallApi : NSObject
|
||||||
- (instancetype)initWithBinaryMessenger:(id<FlutterBinaryMessenger>)binaryMessenger;
|
- (instancetype)initWithBinaryMessenger:(id<FlutterBinaryMessenger>)binaryMessenger;
|
||||||
- (void)echoWrappedList:(TestMessage *)msg
|
- (void)echoWrappedList:(FLTTestMessage *)msg
|
||||||
completion:(void (^)(TestMessage *_Nullable, FlutterError *_Nullable))completion;
|
completion:(void (^)(FLTTestMessage *_Nullable, FlutterError *_Nullable))completion;
|
||||||
- (void)echoString:(NSString *)aString
|
- (void)echoString:(NSString *)aString
|
||||||
completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion;
|
completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion;
|
||||||
@end
|
@end
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@ name: pigeon
|
|||||||
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
|
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
|
||||||
repository: https://github.com/flutter/packages/tree/main/packages/pigeon
|
repository: https://github.com/flutter/packages/tree/main/packages/pigeon
|
||||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+pigeon%22
|
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+pigeon%22
|
||||||
version: 17.1.2 # This must match the version in lib/generator_tools.dart
|
version: 17.1.3 # This must match the version in lib/generator_tools.dart
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.1.0
|
sdk: ^3.1.0
|
||||||
|
@ -2931,4 +2931,178 @@ void main() {
|
|||||||
'return [FlutterError errorWithCode:@"channel-error" message:[NSString stringWithFormat:@"%@/%@/%@", @"Unable to establish connection on channel: \'", channelName, @"\'."] details:@""]'));
|
'return [FlutterError errorWithCode:@"channel-error" message:[NSString stringWithFormat:@"%@/%@/%@", @"Unable to establish connection on channel: \'", channelName, @"\'."] details:@""]'));
|
||||||
expect(code, contains('completion(createConnectionError(channelName))'));
|
expect(code, contains('completion(createConnectionError(channelName))'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('header of FlutterApi uses correct enum name with prefix', () {
|
||||||
|
final Enum enum1 = Enum(
|
||||||
|
name: 'Enum1',
|
||||||
|
members: <EnumMember>[
|
||||||
|
EnumMember(name: 'one'),
|
||||||
|
EnumMember(name: 'two'),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
final Root root = Root(apis: <Api>[
|
||||||
|
AstFlutterApi(name: 'Api', methods: <Method>[
|
||||||
|
Method(
|
||||||
|
name: 'doSomething',
|
||||||
|
location: ApiLocation.flutter,
|
||||||
|
isAsynchronous: true,
|
||||||
|
parameters: <Parameter>[],
|
||||||
|
returnType: TypeDeclaration(
|
||||||
|
baseName: 'Enum1',
|
||||||
|
isNullable: false,
|
||||||
|
associatedEnum: enum1,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
], classes: <Class>[], enums: <Enum>[
|
||||||
|
enum1,
|
||||||
|
]);
|
||||||
|
final StringBuffer sink = StringBuffer();
|
||||||
|
const ObjcGenerator generator = ObjcGenerator();
|
||||||
|
final OutputFileOptions<ObjcOptions> generatorOptions =
|
||||||
|
OutputFileOptions<ObjcOptions>(
|
||||||
|
fileType: FileType.header,
|
||||||
|
languageOptions: const ObjcOptions(prefix: 'FLT'),
|
||||||
|
);
|
||||||
|
generator.generate(
|
||||||
|
generatorOptions,
|
||||||
|
root,
|
||||||
|
sink,
|
||||||
|
dartPackageName: DEFAULT_PACKAGE_NAME,
|
||||||
|
);
|
||||||
|
final String code = sink.toString();
|
||||||
|
expect(code, isNot(contains('FLTFLT')));
|
||||||
|
expect(code, contains('FLTEnum1Box'));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('source of FlutterApi uses correct enum name with prefix', () {
|
||||||
|
final Enum enum1 = Enum(
|
||||||
|
name: 'Enum1',
|
||||||
|
members: <EnumMember>[
|
||||||
|
EnumMember(name: 'one'),
|
||||||
|
EnumMember(name: 'two'),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
final Root root = Root(apis: <Api>[
|
||||||
|
AstFlutterApi(name: 'Api', methods: <Method>[
|
||||||
|
Method(
|
||||||
|
name: 'doSomething',
|
||||||
|
location: ApiLocation.flutter,
|
||||||
|
isAsynchronous: true,
|
||||||
|
parameters: <Parameter>[],
|
||||||
|
returnType: TypeDeclaration(
|
||||||
|
baseName: 'Enum1',
|
||||||
|
isNullable: false,
|
||||||
|
associatedEnum: enum1,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
], classes: <Class>[], enums: <Enum>[
|
||||||
|
enum1,
|
||||||
|
]);
|
||||||
|
final StringBuffer sink = StringBuffer();
|
||||||
|
const ObjcGenerator generator = ObjcGenerator();
|
||||||
|
final OutputFileOptions<ObjcOptions> generatorOptions =
|
||||||
|
OutputFileOptions<ObjcOptions>(
|
||||||
|
fileType: FileType.source,
|
||||||
|
languageOptions: const ObjcOptions(prefix: 'FLT'),
|
||||||
|
);
|
||||||
|
generator.generate(
|
||||||
|
generatorOptions,
|
||||||
|
root,
|
||||||
|
sink,
|
||||||
|
dartPackageName: DEFAULT_PACKAGE_NAME,
|
||||||
|
);
|
||||||
|
final String code = sink.toString();
|
||||||
|
expect(code, isNot(contains('FLTFLT')));
|
||||||
|
expect(code, contains('FLTEnum1Box'));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('header of HostApi uses correct enum name with prefix', () {
|
||||||
|
final Enum enum1 = Enum(
|
||||||
|
name: 'Enum1',
|
||||||
|
members: <EnumMember>[
|
||||||
|
EnumMember(name: 'one'),
|
||||||
|
EnumMember(name: 'two'),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
final TypeDeclaration enumType = TypeDeclaration(
|
||||||
|
baseName: 'Enum1',
|
||||||
|
isNullable: false,
|
||||||
|
associatedEnum: enum1,
|
||||||
|
);
|
||||||
|
final Root root = Root(apis: <Api>[
|
||||||
|
AstHostApi(name: 'Api', methods: <Method>[
|
||||||
|
Method(
|
||||||
|
name: 'doSomething',
|
||||||
|
location: ApiLocation.host,
|
||||||
|
isAsynchronous: true,
|
||||||
|
parameters: <Parameter>[Parameter(name: 'value', type: enumType)],
|
||||||
|
returnType: enumType,
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
], classes: <Class>[], enums: <Enum>[
|
||||||
|
enum1,
|
||||||
|
]);
|
||||||
|
final StringBuffer sink = StringBuffer();
|
||||||
|
const ObjcGenerator generator = ObjcGenerator();
|
||||||
|
final OutputFileOptions<ObjcOptions> generatorOptions =
|
||||||
|
OutputFileOptions<ObjcOptions>(
|
||||||
|
fileType: FileType.header,
|
||||||
|
languageOptions: const ObjcOptions(prefix: 'FLT'),
|
||||||
|
);
|
||||||
|
generator.generate(
|
||||||
|
generatorOptions,
|
||||||
|
root,
|
||||||
|
sink,
|
||||||
|
dartPackageName: DEFAULT_PACKAGE_NAME,
|
||||||
|
);
|
||||||
|
final String code = sink.toString();
|
||||||
|
expect(code, isNot(contains('FLTFLT')));
|
||||||
|
expect(code, contains('FLTEnum1Box'));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('source of HostApi uses correct enum name with prefix', () {
|
||||||
|
final Enum enum1 = Enum(
|
||||||
|
name: 'Enum1',
|
||||||
|
members: <EnumMember>[
|
||||||
|
EnumMember(name: 'one'),
|
||||||
|
EnumMember(name: 'two'),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
final TypeDeclaration enumType = TypeDeclaration(
|
||||||
|
baseName: 'Enum1',
|
||||||
|
isNullable: false,
|
||||||
|
associatedEnum: enum1,
|
||||||
|
);
|
||||||
|
final Root root = Root(apis: <Api>[
|
||||||
|
AstHostApi(name: 'Api', methods: <Method>[
|
||||||
|
Method(
|
||||||
|
name: 'doSomething',
|
||||||
|
location: ApiLocation.host,
|
||||||
|
isAsynchronous: true,
|
||||||
|
parameters: <Parameter>[Parameter(name: 'value', type: enumType)],
|
||||||
|
returnType: enumType,
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
], classes: <Class>[], enums: <Enum>[
|
||||||
|
enum1,
|
||||||
|
]);
|
||||||
|
final StringBuffer sink = StringBuffer();
|
||||||
|
const ObjcGenerator generator = ObjcGenerator();
|
||||||
|
final OutputFileOptions<ObjcOptions> generatorOptions =
|
||||||
|
OutputFileOptions<ObjcOptions>(
|
||||||
|
fileType: FileType.source,
|
||||||
|
languageOptions: const ObjcOptions(prefix: 'FLT'),
|
||||||
|
);
|
||||||
|
generator.generate(
|
||||||
|
generatorOptions,
|
||||||
|
root,
|
||||||
|
sink,
|
||||||
|
dartPackageName: DEFAULT_PACKAGE_NAME,
|
||||||
|
);
|
||||||
|
final String code = sink.toString();
|
||||||
|
expect(code, isNot(contains('FLTFLT')));
|
||||||
|
expect(code, contains('FLTEnum1Box'));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
@ -151,6 +151,7 @@ Future<int> generateTestPigeons({required String baseDir}) async {
|
|||||||
objcSourceOut: skipLanguages.contains(GeneratorLanguage.objc)
|
objcSourceOut: skipLanguages.contains(GeneratorLanguage.objc)
|
||||||
? null
|
? null
|
||||||
: '$alternateOutputBase/ios/Classes/$pascalCaseName.gen.m',
|
: '$alternateOutputBase/ios/Classes/$pascalCaseName.gen.m',
|
||||||
|
objcPrefix: input == 'core_tests' ? 'FLT' : '',
|
||||||
suppressVersion: true,
|
suppressVersion: true,
|
||||||
dartPackageName: 'pigeon_integration_tests',
|
dartPackageName: 'pigeon_integration_tests',
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user