Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/ios_platform_images/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 0.2.4+1

* Updates to Pigeon v22.
* Updates minimum supported SDK version to Flutter 3.19/Dart 3.3.

## 0.2.4
Expand Down
108 changes: 62 additions & 46 deletions packages/ios_platform_images/lib/src/messages.g.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Autogenerated from Pigeon (v11.0.1), do not edit directly.
// Autogenerated from Pigeon (v22.6.4), 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, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers

import 'dart:async';
import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;

import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
import 'package:flutter/services.dart';

PlatformException _createConnectionError(String channelName) {
return PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel: "$channelName".',
);
}

/// A serialization of a platform image's data.
class PlatformImageData {
PlatformImageData({
Expand Down Expand Up @@ -40,12 +47,15 @@ class PlatformImageData {
}
}

class _PlatformImagesApiCodec extends StandardMessageCodec {
const _PlatformImagesApiCodec();
class _PigeonCodec extends StandardMessageCodec {
const _PigeonCodec();
@override
void writeValue(WriteBuffer buffer, Object? value) {
if (value is PlatformImageData) {
buffer.putUint8(128);
if (value is int) {
buffer.putUint8(4);
buffer.putInt64(value);
} else if (value is PlatformImageData) {
buffer.putUint8(129);
writeValue(buffer, value.encode());
} else {
super.writeValue(buffer, value);
Expand All @@ -55,7 +65,7 @@ class _PlatformImagesApiCodec extends StandardMessageCodec {
@override
Object? readValueOfType(int type, ReadBuffer buffer) {
switch (type) {
case 128:
case 129:
return PlatformImageData.decode(readValue(buffer)!);
default:
return super.readValueOfType(type, buffer);
Expand All @@ -67,60 +77,66 @@ class PlatformImagesApi {
/// Constructor for [PlatformImagesApi]. The [binaryMessenger] named argument is
/// available for dependency injection. If it is left null, the default
/// BinaryMessenger will be used which routes to the host platform.
PlatformImagesApi({BinaryMessenger? binaryMessenger})
: _binaryMessenger = binaryMessenger;
final BinaryMessenger? _binaryMessenger;
PlatformImagesApi(
{BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''})
: pigeonVar_binaryMessenger = binaryMessenger,
pigeonVar_messageChannelSuffix =
messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
final BinaryMessenger? pigeonVar_binaryMessenger;

static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();

static const MessageCodec<Object?> codec = _PlatformImagesApiCodec();
final String pigeonVar_messageChannelSuffix;

/// Returns the URL for the given resource, or null if no such resource is
/// found.
Future<String?> resolveUrl(
String arg_resourceName, String? arg_extension) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.ios_platform_images.PlatformImagesApi.resolveUrl',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList = await channel
.send(<Object?>[arg_resourceName, arg_extension]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
Future<String?> resolveUrl(String resourceName, String? extension) async {
final String pigeonVar_channelName =
'dev.flutter.pigeon.ios_platform_images.PlatformImagesApi.resolveUrl$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel =
BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final List<Object?>? pigeonVar_replyList = await pigeonVar_channel
.send(<Object?>[resourceName, extension]) as List<Object?>?;
if (pigeonVar_replyList == null) {
throw _createConnectionError(pigeonVar_channelName);
} else if (pigeonVar_replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
code: pigeonVar_replyList[0]! as String,
message: pigeonVar_replyList[1] as String?,
details: pigeonVar_replyList[2],
);
} else {
return (replyList[0] as String?);
return (pigeonVar_replyList[0] as String?);
}
}

/// Returns the data for the image resource with the given name, or null if
/// no such resource is found.
Future<PlatformImageData?> loadImage(String arg_name) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.ios_platform_images.PlatformImagesApi.loadImage',
codec,
binaryMessenger: _binaryMessenger);
final List<Object?>? replyList =
await channel.send(<Object?>[arg_name]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyList.length > 1) {
Future<PlatformImageData?> loadImage(String name) async {
final String pigeonVar_channelName =
'dev.flutter.pigeon.ios_platform_images.PlatformImagesApi.loadImage$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel =
BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final List<Object?>? pigeonVar_replyList =
await pigeonVar_channel.send(<Object?>[name]) as List<Object?>?;
if (pigeonVar_replyList == null) {
throw _createConnectionError(pigeonVar_channelName);
} else if (pigeonVar_replyList.length > 1) {
throw PlatformException(
code: replyList[0]! as String,
message: replyList[1] as String?,
details: replyList[2],
code: pigeonVar_replyList[0]! as String,
message: pigeonVar_replyList[1] as String?,
details: pigeonVar_replyList[2],
);
} else {
return (replyList[0] as PlatformImageData?);
return (pigeonVar_replyList[0] as PlatformImageData?);
}
}
}
4 changes: 2 additions & 2 deletions packages/ios_platform_images/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: ios_platform_images
description: A plugin to share images between Flutter and iOS in add-to-app setups.
repository: https://github.com/flutter/packages/tree/main/packages/ios_platform_images
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+ios_platform_images%22
version: 0.2.4
version: 0.2.4+1

environment:
sdk: ^3.3.0
Expand All @@ -21,7 +21,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
pigeon: ^11.0.0
pigeon: ^22.6.4

topics:
- image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,12 @@ class FakePlatformImagesApi implements PlatformImagesApi {
passedExtension = extension;
return resolutionResult;
}

@override
// ignore: non_constant_identifier_names
BinaryMessenger? get pigeonVar_binaryMessenger => null;

@override
// ignore: non_constant_identifier_names
String get pigeonVar_messageChannelSuffix => '';
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 2.4.1

* Updates to Pigeon v22.
* Updates minimum supported SDK version to Flutter 3.19/Dart 3.3.

## 2.4.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Autogenerated from Pigeon (v10.1.3), do not edit directly.
// Autogenerated from Pigeon (v22.6.4), do not edit directly.
// See also: https://pub.dev/packages/pigeon

import Foundation
Expand All @@ -14,11 +14,36 @@ import Foundation
#error("Unsupported platform.")
#endif

/// Error class for passing custom error details to Dart side.
final class PigeonError: Error {
let code: String
let message: String?
let details: Any?

init(code: String, message: String?, details: Any?) {
self.code = code
self.message = message
self.details = details
}

var localizedDescription: String {
return
"PigeonError(code: \(code), message: \(message ?? "<nil>"), details: \(details ?? "<nil>")"
}
}

private func wrapResult(_ result: Any?) -> [Any?] {
return [result]
}

private func wrapError(_ error: Any) -> [Any?] {
if let pigeonError = error as? PigeonError {
return [
pigeonError.code,
pigeonError.message,
pigeonError.details,
]
}
if let flutterError = error as? FlutterError {
return [
flutterError.code,
Expand All @@ -33,6 +58,10 @@ private func wrapError(_ error: Any) -> [Any?] {
]
}

private func isNullish(_ value: Any?) -> Bool {
return value is NSNull || value == nil
}

private func nilOrValue<T>(_ value: Any?) -> T? {
if value is NSNull { return nil }
return value as! T?
Expand All @@ -46,6 +75,47 @@ enum DirectoryType: Int {
case temp = 4
case applicationCache = 5
}

private class messagesPigeonCodecReader: FlutterStandardReader {
override func readValue(ofType type: UInt8) -> Any? {
switch type {
case 129:
let enumResultAsInt: Int? = nilOrValue(self.readValue() as! Int?)
if let enumResultAsInt = enumResultAsInt {
return DirectoryType(rawValue: enumResultAsInt)
}
return nil
default:
return super.readValue(ofType: type)
}
}
}

private class messagesPigeonCodecWriter: FlutterStandardWriter {
override func writeValue(_ value: Any) {
if let value = value as? DirectoryType {
super.writeByte(129)
super.writeValue(value.rawValue)
} else {
super.writeValue(value)
}
}
}

private class messagesPigeonCodecReaderWriter: FlutterStandardReaderWriter {
override func reader(with data: Data) -> FlutterStandardReader {
return messagesPigeonCodecReader(data: data)
}

override func writer(with data: NSMutableData) -> FlutterStandardWriter {
return messagesPigeonCodecWriter(data: data)
}
}

class messagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable {
static let shared = messagesPigeonCodec(readerWriter: messagesPigeonCodecReaderWriter())
}

/// Generated protocol from Pigeon that represents a handler of messages from Flutter.
protocol PathProviderApi {
func getDirectoryPath(type: DirectoryType) throws -> String?
Expand All @@ -54,15 +124,21 @@ protocol PathProviderApi {

/// Generated setup class from Pigeon to handle messages through the `binaryMessenger`.
class PathProviderApiSetup {
/// The codec used by PathProviderApi.
static var codec: FlutterStandardMessageCodec { messagesPigeonCodec.shared }
/// Sets up an instance of `PathProviderApi` to handle messages through the `binaryMessenger`.
static func setUp(binaryMessenger: FlutterBinaryMessenger, api: PathProviderApi?) {
static func setUp(
binaryMessenger: FlutterBinaryMessenger, api: PathProviderApi?,
messageChannelSuffix: String = ""
) {
let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : ""
let getDirectoryPathChannel = FlutterBasicMessageChannel(
name: "dev.flutter.pigeon.PathProviderApi.getDirectoryPath", binaryMessenger: binaryMessenger)
name:
"dev.flutter.pigeon.path_provider_foundation.PathProviderApi.getDirectoryPath\(channelSuffix)",
binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
getDirectoryPathChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let typeArg = DirectoryType(rawValue: args[0] as! Int)!
let typeArg = args[0] as! DirectoryType
do {
let result = try api.getDirectoryPath(type: typeArg)
reply(wrapResult(result))
Expand All @@ -74,7 +150,9 @@ class PathProviderApiSetup {
getDirectoryPathChannel.setMessageHandler(nil)
}
let getContainerPathChannel = FlutterBasicMessageChannel(
name: "dev.flutter.pigeon.PathProviderApi.getContainerPath", binaryMessenger: binaryMessenger)
name:
"dev.flutter.pigeon.path_provider_foundation.PathProviderApi.getContainerPath\(channelSuffix)",
binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
getContainerPathChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
Expand Down
Loading
Loading