-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[video_player] Updated Pigeon version #4726
Conversation
acc1d24
to
35e22a9
Compare
697b1b8
to
a7e195b
Compare
This pull request is not mergeable in its current state, likely because of a merge conflict. Pre-submit CI jobs were not triggered. Pushing a new commit to this branch that resolves the issue will result in pre-submit jobs being scheduled. |
I didn't look into the async or null safety usage, just getting everything updated. There were a few things that were had tweaked that we should fix in pigeon:
|
@@ -1,3 +1,7 @@ | |||
## 2.3.0 | |||
|
|||
* Update Pigeon to ^1.0.16. |
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.
Nit: Updates
Per repo CHANGELOG style guide.
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.
fyi: The style guide just says it should be the present tense, it doesn't specify which conjugation should be used (ie 3rd person singular, neutral).
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.
done
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.
It doesn't just say it should be in present tense, it says it should be "present tense indicative". I assumed that the fact the package was the implied subject was obvious, but I'll add that.
It also specifically says:
For example, "Adds cool new feature.", not "Add" or "Added"
So I'm not clear how it's ambiguous that this should be "Updates" rather than "Update". But I'll add even more specific grammar notes there if you like.
@@ -1,3 +1,7 @@ | |||
## 2.3.0 | |||
|
|||
* Update Pigeon to 1.0.x. |
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.
Same version and verb form comments here.
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.
done (conjugation)
packages/video_player/video_player_avfoundation/ios/Classes/messages.g.h
Outdated
Show resolved
Hide resolved
+ (FLTCreateMessage *)fromMap:(NSDictionary *)dict { | ||
FLTCreateMessage *pigeonResult = [[FLTCreateMessage alloc] init]; | ||
pigeonResult.asset = dict[@"asset"]; | ||
if ((NSNull *)pigeonResult.asset == [NSNull null]) { |
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.
Pigeon fix (so, not for this PR): a simpler solution occurs to me for this type issue than local variables. You can generate a static helper C function at the top of this file and use it for the lookups:
NSObject *GetNullableObjectFromDictionary(NSDictionary *dict, NSString *key) {
NSObject *value = dict[key];
return value == [NSNull null] ? nil : value;
}
Then fromMap is just a series of:
pigeonResult.foo = GetNullableObjectFromDictionary(@"foo");
...
statements. Shorter, and no type abuse.
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.
Good call. I'll try to do some cleanup on the few pigeon things I saw today. I'll add that to the list.
|
||
NSObject<FlutterMessageCodec> *FLTVideoPlayerApiGetCodec() { | ||
static dispatch_once_t s_pred = 0; | ||
static FlutterStandardMessageCodec *s_sharedObject = nil; |
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.
Pigeon fix: These names violate style; it should be sPred
and sSharedObject
. Hungarian-style prefixes (s
, k
) in ObjC still use normal naming rules.
86c87bc
to
76476fe
Compare
76476fe
to
0145c0c
Compare
@stuartmorgan friendly ping, I think we are good here. I talked about updating pigeon but we've landed the fix in pigeon and we'll grab it the next time. The differences are trivial. |
class TextureMessage { | ||
int textureId; | ||
int? textureId; |
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.
Shouldn't textureId
be non-null in all of these, now that that's supported?
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.
I mentioned that in my first comment I didn't investigate async or nullability changes. I just want this PR to be an upgrade of pigeon, no semantics changes.
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.
- // @dart = 2.9
This is a semantics change though.
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.
It shouldn't be. In Pigeon if you switch to NNBD then make all types nullable the semantics are the same, the syntax is changed only. Pigeon is special since it doesn't allow logic, just declarations.
int textureId; | ||
bool isLooping; | ||
int? textureId; | ||
bool? isLooping; |
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.
In fact, shouldn't all of the values in these classes be non-null?
String? uri; | ||
String? packageName; | ||
String? formatHint; | ||
Map<String?, String?>? httpHeaders; |
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.
This should definitely be non-null so that we don't have the nil-vs-empty confusion.
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.
You've marked this as nullable. It should be non-nullable (default empty) like the class it is mirroring.
Hey @stuartmorgan , I wanted to address nullability and async changes in a different PR in order to separate the big pigeon upgrade from functionality changes. |
I understand why async changes would be separate since they involve rewriting logic, but I don't understand why nullability would be separate. A core part of this PR is that you are upgrading In fact, I would expect that not adding a bunch of unwanted nullability annotations would make this diff smaller. |
Yea, probably. It's just that was explicitly listed as a non-goal of this PR in order to change less variables. Let me queue up another PR for you. |
@stuartmorgan I have a draft prepared for updating the nullability: #4742 I don't know if it's easy to see but there was code that had to be changed to accommodate the new semantics that didn't have to get changed in this PR since they were the same. |
I understand that you wrote it down; that doesn't mean that it's actually desirable to have done so. Every single NNBD upgrade we did across flutter/plugin and flutter/packages involved auditing the desired nullability of each item and changing the code accordingly, not blindly adding There is no reason to make a Pigeon update different in that regard. We should not migrate a file from non-NNBD to NNBD without giving it the desired nullability semantics.
Yes, that's a normal part of an NNBD upgrade. (And it appears that they were incredibly minor, and primarily consistent of removing one |
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.
(Updating review status to reflect comments above, since I forgot to do that as a review)
@stuartmorgan This isn't an NNBD upgrade, I know it looks like one but it isn't. We are only using Dart for the front-end compiler, not the backend. I've written the whole backend, this is not changing the semantics or the generated code. It's just changing how the Dart front-end works. We really should separate the change in semantics into a different PR. |
I'm not talking about the package; I know that the package has already been converted. I'm talking about messages.dart, where you are making the following change: -// @dart = 2.9
I am aware that it is not changing the generated code, but it is changing the semantics of everything in that file from "we aren't making any claims about the intended nullability of these values" to "we are explicitly claiming that all of these things are intended to be nullable". Those new semantics are wrong, because those things are not all intended to be nullable. I'm not going to approve a PR that explicitly puts the wrong (as defined by the desired behavior of the API layer) annotations in messages.dart just to preserve behavior that we don't want, any more than I would have approved a package-level NNBD update that did the same thing to the rest of the code. |
I think that's where our disconnect is. That isn't what things meant before NNBD. It meant "all of my values are nullable". So the smallest change for upgrading would have been to keep those semantics "all of my values are nullable". |
e3125dd
to
0be5dc9
Compare
I talked offline with stuart. Moving the fields from implicitly nullable to explicitly nullable means null values should be accommodated in the handlers. Instead of going through the work to make that happen it's easier just to do the migration to nonnull values now when that was their intended usage. So, while this is 2 big changes in one PR, it's less contradictory and more clear to land it in one PR. |
@stuartmorgan I've adopted the null-safety annotations that match the usage. Everything is non-null except for the fields in CreateMessage because that's how they are created in the dart side: plugins/packages/video_player/video_player_android/lib/src/android_video_player.dart Line 36 in 9d32c83
Line 84 in 9d32c83
|
String? uri; | ||
String? packageName; | ||
String? formatHint; | ||
Map<String?, String?>? httpHeaders; |
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.
You've marked this as nullable. It should be non-nullable (default empty) like the class it is mirroring.
String? uri; | ||
String? packageName; | ||
String? formatHint; | ||
Map<String?, String?>? httpHeaders; |
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.
Same.
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.
Done. FYI they were nonnull in the DataSource class, but in both the android implementation and the ios implementation they were nullable.
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.
Yes, but the fact that it's traditionally been hard to reason about nullability across the platform channel boundary—leading to code that is either over-cautious like in this case, or not cautious enough and buggy as in other cases—is exactly why I think Pigeon NNBD support is a substantial opportunity.
0be5dc9
to
c702665
Compare
@@ -43,11 +43,12 @@ class PositionMessage { | |||
} | |||
|
|||
class CreateMessage { | |||
CreateMessage({required this.httpHeaders}); |
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.
Why is this required, rather than defaulting to an empty collection?
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.
Pigeon demands there be no logic here, it doesn't generate code for initialization.
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.
Filed flutter/flutter#98448
@@ -177,7 +177,7 @@ - (void)createVideoOutputAndDisplayLink:(FLTFrameUpdater *)frameUpdater { | |||
|
|||
- (instancetype)initWithURL:(NSURL *)url | |||
frameUpdater:(FLTFrameUpdater *)frameUpdater | |||
httpHeaders:(NSDictionary<NSString *, NSString *> *)headers { | |||
httpHeaders:(nonnull NSDictionary<NSString *, NSString *> *)headers { | |||
NSDictionary<NSString *, id> *options = nil; | |||
if (headers != nil && [headers count] != 0) { |
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.
The headers != nil
can be removed.
(Technically it could have been removed either way since [nil count]
is zero, but it should definitely be removed now.)
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.
done
399cc68
to
df6a66a
Compare
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.
LGTM given the current Pigeon limitations.
* google/master: (340 commits) [camera]remove "selfRef" for SavePhotoDelegate and ensure thread safety (flutter#4780) Roll Flutter from 919d205 to adafd66 (5 revisions) (flutter#4876) [google_sign_in] Update platform interface analysis options (flutter#4872) Roll Flutter from b623279 to 919d205 (2 revisions) (flutter#4871) Roll Flutter from 14a2b13 to b623279 (5 revisions) (flutter#4870) [image_picker] Update platform interface analysis options (flutter#4837) [ci] Re-enable stable webview Android tests (flutter#4867) Roll Flutter from 286c975 to 14a2b13 (1 revision) (flutter#4865) [local_auth] support localizedFallbackTitle in IOSAuthMessages (flutter#3806) [image_picker] Update app-facing and web analysis options (flutter#4838) Roll Flutter from 8386344 to 286c975 (4 revisions) (flutter#4864) Roll Flutter from e9f83cf to 8386344 (6 revisions) (flutter#4862) [camera] Switch web package to new analysis options (flutter#4834) [flutter_plugin_tool] Fix iOS/macOS naming (flutter#4861) [webview_flutter] Fix debuggingEnabled on Android (flutter#4859) Roll Flutter from ca2a751 to e9f83cf (10 revisions) (flutter#4857) fix license (flutter#4858) [video_player] add allowBackgroundPlayback option platform interface changes (flutter#4807) [video_player] Updated Pigeon version (flutter#4726) Roll Flutter from 381cb28 to ca2a751 (5 revisions) (flutter#4850) ... # Conflicts: # packages/camera/camera/CHANGELOG.md # packages/camera/camera/android/build.gradle # packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/Camera.java # packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/MethodCallHandlerImpl.java # packages/camera/camera/ios/Classes/CameraPlugin.m # packages/camera/camera/ios/camera.podspec # packages/camera/camera/lib/camera.dart # packages/camera/camera/lib/src/camera_controller.dart # packages/camera/camera/pubspec.yaml
Updated
video_player_android
andvideo_player_avfoundation
to use the latest version of pigeon.Test exempt: Refactor, no new features.
Changes:
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.