-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Pigeon]: version 0.1.0 (objc and testing features) #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9a3793c
240f1f5
680338c
8276e70
0cd0e9d
5f89206
00e7f7d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
arguments= | ||
auto.sync=false | ||
build.scans.enabled=false | ||
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) | ||
connection.project.dir= | ||
eclipse.preferences.version=1 | ||
gradle.user.home= | ||
java.home=/Library/Java/JavaVirtualMachines/jdk-11.0.4.jdk/Contents/Home | ||
jvm.arguments= | ||
offline.mode=false | ||
override.workspace.settings=true | ||
show.console.view=true | ||
show.executions.view=true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-10/"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/> | ||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/> | ||
<classpathentry kind="output" path="bin/default"/> | ||
</classpath> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Autogenerated from Pigeon (v0.1.0-experimental.11), do not edit directly. | ||
// Autogenerated from Pigeon (v0.1.0), do not edit directly. | ||
// See also: https://pub.dev/packages/pigeon | ||
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import | ||
import 'dart:async'; | ||
|
@@ -66,18 +66,18 @@ class Nested { | |
|
||
abstract class FlutterSearchApi { | ||
SearchReply search(SearchRequest arg); | ||
} | ||
|
||
void FlutterSearchApiSetup(FlutterSearchApi api) { | ||
{ | ||
const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>( | ||
'dev.flutter.pigeon.FlutterSearchApi.search', StandardMessageCodec()); | ||
channel.setMessageHandler((dynamic message) async { | ||
final Map<dynamic, dynamic> mapMessage = message as Map<dynamic, dynamic>; | ||
final SearchRequest input = SearchRequest._fromMap(mapMessage); | ||
final SearchReply output = api.search(input); | ||
return output._toMap(); | ||
}); | ||
static void setup(FlutterSearchApi api) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. great! We should note the need to call this in the package's README There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit surprised though that it's in this abstract |
||
{ | ||
const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>( | ||
'dev.flutter.pigeon.FlutterSearchApi.search', StandardMessageCodec()); | ||
channel.setMessageHandler((dynamic message) async { | ||
final Map<dynamic, dynamic> mapMessage = | ||
message as Map<dynamic, dynamic>; | ||
final SearchRequest input = SearchRequest._fromMap(mapMessage); | ||
final SearchReply output = api.search(input); | ||
return output._toMap(); | ||
}); | ||
} | ||
} | ||
} | ||
|
||
|
@@ -128,3 +128,20 @@ class Api { | |
} | ||
} | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not for this PR but I don' think we should do it soon. We should doc annotate the output classes, especially since we decided that the person writing the pigeon file might not be the person consuming these Dart/Java/ObjC classes and the latter could use some help in knowing what to do with these. |
||
abstract class TestHostApi { | ||
SearchReply search(SearchRequest arg); | ||
static void setup(TestHostApi api) { | ||
{ | ||
const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>( | ||
'dev.flutter.pigeon.Api.search', StandardMessageCodec()); | ||
channel.setMockMessageHandler((dynamic message) async { | ||
final Map<dynamic, dynamic> mapMessage = | ||
message as Map<dynamic, dynamic>; | ||
final SearchRequest input = SearchRequest._fromMap(mapMessage); | ||
final SearchReply output = api.search(input); | ||
return <dynamic, dynamic>{'result': output._toMap()}; | ||
}); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export 'pigeon_lib.dart'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and below, we should be careful with the terminology to avoid confusion. What you're adding here isn't quite a mock which is a stand-in for a real object and that just registers calls. What this PR does doesn't replace the real object. It just adds a matched object that "works" and that's different from the real implementation. i.e. it's a fake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is merit to what you are saying but
mock
is the terminology used by channels, that's why I chose it (https://api.flutter.dev/flutter/services/MethodChannel/setMockMethodCallHandler.html)