This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrated path_provider_ios to pigeon.
- Loading branch information
Showing
11 changed files
with
451 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/path_provider/path_provider_ios/ios/Classes/messages.g.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Autogenerated from Pigeon (v3.1.5), do not edit directly. | ||
// See also: https://pub.dev/packages/pigeon | ||
#import <Foundation/Foundation.h> | ||
@protocol FlutterBinaryMessenger; | ||
@protocol FlutterMessageCodec; | ||
@class FlutterError; | ||
@class FlutterStandardTypedData; | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/// The codec used by FLTPathProviderApi. | ||
NSObject<FlutterMessageCodec> *FLTPathProviderApiGetCodec(void); | ||
|
||
@protocol FLTPathProviderApi | ||
- (nullable NSString *)getTemporaryPathWithError:(FlutterError *_Nullable *_Nonnull)error; | ||
- (nullable NSString *)getApplicationSupportPathWithError:(FlutterError *_Nullable *_Nonnull)error; | ||
- (nullable NSString *)getLibraryPathWithError:(FlutterError *_Nullable *_Nonnull)error; | ||
- (nullable NSString *)getApplicationDocumentsPathWithError: | ||
(FlutterError *_Nullable *_Nonnull)error; | ||
@end | ||
|
||
extern void FLTPathProviderApiSetup(id<FlutterBinaryMessenger> binaryMessenger, | ||
NSObject<FLTPathProviderApi> *_Nullable api); | ||
|
||
NS_ASSUME_NONNULL_END |
143 changes: 143 additions & 0 deletions
143
packages/path_provider/path_provider_ios/ios/Classes/messages.g.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
// Autogenerated from Pigeon (v3.1.5), do not edit directly. | ||
// See also: https://pub.dev/packages/pigeon | ||
#import "messages.g.h" | ||
#import <Flutter/Flutter.h> | ||
|
||
#if !__has_feature(objc_arc) | ||
#error File requires ARC to be enabled. | ||
#endif | ||
|
||
static NSDictionary<NSString *, id> *wrapResult(id result, FlutterError *error) { | ||
NSDictionary *errorDict = (NSDictionary *)[NSNull null]; | ||
if (error) { | ||
errorDict = @{ | ||
@"code" : (error.code ?: [NSNull null]), | ||
@"message" : (error.message ?: [NSNull null]), | ||
@"details" : (error.details ?: [NSNull null]), | ||
}; | ||
} | ||
return @{ | ||
@"result" : (result ?: [NSNull null]), | ||
@"error" : errorDict, | ||
}; | ||
} | ||
static id GetNullableObject(NSDictionary *dict, id key) { | ||
id result = dict[key]; | ||
return (result == [NSNull null]) ? nil : result; | ||
} | ||
static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { | ||
id result = array[key]; | ||
return (result == [NSNull null]) ? nil : result; | ||
} | ||
|
||
@interface FLTPathProviderApiCodecReader : FlutterStandardReader | ||
@end | ||
@implementation FLTPathProviderApiCodecReader | ||
@end | ||
|
||
@interface FLTPathProviderApiCodecWriter : FlutterStandardWriter | ||
@end | ||
@implementation FLTPathProviderApiCodecWriter | ||
@end | ||
|
||
@interface FLTPathProviderApiCodecReaderWriter : FlutterStandardReaderWriter | ||
@end | ||
@implementation FLTPathProviderApiCodecReaderWriter | ||
- (FlutterStandardWriter *)writerWithData:(NSMutableData *)data { | ||
return [[FLTPathProviderApiCodecWriter alloc] initWithData:data]; | ||
} | ||
- (FlutterStandardReader *)readerWithData:(NSData *)data { | ||
return [[FLTPathProviderApiCodecReader alloc] initWithData:data]; | ||
} | ||
@end | ||
|
||
NSObject<FlutterMessageCodec> *FLTPathProviderApiGetCodec() { | ||
static dispatch_once_t sPred = 0; | ||
static FlutterStandardMessageCodec *sSharedObject = nil; | ||
dispatch_once(&sPred, ^{ | ||
FLTPathProviderApiCodecReaderWriter *readerWriter = | ||
[[FLTPathProviderApiCodecReaderWriter alloc] init]; | ||
sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; | ||
}); | ||
return sSharedObject; | ||
} | ||
|
||
void FLTPathProviderApiSetup(id<FlutterBinaryMessenger> binaryMessenger, | ||
NSObject<FLTPathProviderApi> *api) { | ||
{ | ||
FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] | ||
initWithName:@"dev.flutter.pigeon.PathProviderApi.getTemporaryPath" | ||
binaryMessenger:binaryMessenger | ||
codec:FLTPathProviderApiGetCodec()]; | ||
if (api) { | ||
NSCAssert( | ||
[api respondsToSelector:@selector(getTemporaryPathWithError:)], | ||
@"FLTPathProviderApi api (%@) doesn't respond to @selector(getTemporaryPathWithError:)", | ||
api); | ||
[channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { | ||
FlutterError *error; | ||
NSString *output = [api getTemporaryPathWithError:&error]; | ||
callback(wrapResult(output, error)); | ||
}]; | ||
} else { | ||
[channel setMessageHandler:nil]; | ||
} | ||
} | ||
{ | ||
FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] | ||
initWithName:@"dev.flutter.pigeon.PathProviderApi.getApplicationSupportPath" | ||
binaryMessenger:binaryMessenger | ||
codec:FLTPathProviderApiGetCodec()]; | ||
if (api) { | ||
NSCAssert([api respondsToSelector:@selector(getApplicationSupportPathWithError:)], | ||
@"FLTPathProviderApi api (%@) doesn't respond to " | ||
@"@selector(getApplicationSupportPathWithError:)", | ||
api); | ||
[channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { | ||
FlutterError *error; | ||
NSString *output = [api getApplicationSupportPathWithError:&error]; | ||
callback(wrapResult(output, error)); | ||
}]; | ||
} else { | ||
[channel setMessageHandler:nil]; | ||
} | ||
} | ||
{ | ||
FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] | ||
initWithName:@"dev.flutter.pigeon.PathProviderApi.getLibraryPath" | ||
binaryMessenger:binaryMessenger | ||
codec:FLTPathProviderApiGetCodec()]; | ||
if (api) { | ||
NSCAssert( | ||
[api respondsToSelector:@selector(getLibraryPathWithError:)], | ||
@"FLTPathProviderApi api (%@) doesn't respond to @selector(getLibraryPathWithError:)", | ||
api); | ||
[channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { | ||
FlutterError *error; | ||
NSString *output = [api getLibraryPathWithError:&error]; | ||
callback(wrapResult(output, error)); | ||
}]; | ||
} else { | ||
[channel setMessageHandler:nil]; | ||
} | ||
} | ||
{ | ||
FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] | ||
initWithName:@"dev.flutter.pigeon.PathProviderApi.getApplicationDocumentsPath" | ||
binaryMessenger:binaryMessenger | ||
codec:FLTPathProviderApiGetCodec()]; | ||
if (api) { | ||
NSCAssert([api respondsToSelector:@selector(getApplicationDocumentsPathWithError:)], | ||
@"FLTPathProviderApi api (%@) doesn't respond to " | ||
@"@selector(getApplicationDocumentsPathWithError:)", | ||
api); | ||
[channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { | ||
FlutterError *error; | ||
NSString *output = [api getApplicationDocumentsPathWithError:&error]; | ||
callback(wrapResult(output, error)); | ||
}]; | ||
} else { | ||
[channel setMessageHandler:nil]; | ||
} | ||
} | ||
} |
121 changes: 121 additions & 0 deletions
121
packages/path_provider/path_provider_ios/lib/messages.g.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
// Autogenerated from Pigeon (v3.1.5), 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 | ||
// @dart = 2.12 | ||
import 'dart:async'; | ||
import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List; | ||
|
||
import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer; | ||
import 'package:flutter/services.dart'; | ||
|
||
class _PathProviderApiCodec extends StandardMessageCodec { | ||
const _PathProviderApiCodec(); | ||
} | ||
|
||
class PathProviderApi { | ||
/// Constructor for [PathProviderApi]. 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. | ||
PathProviderApi({BinaryMessenger? binaryMessenger}) | ||
: _binaryMessenger = binaryMessenger; | ||
|
||
final BinaryMessenger? _binaryMessenger; | ||
|
||
static const MessageCodec<Object?> codec = _PathProviderApiCodec(); | ||
|
||
Future<String?> getTemporaryPath() async { | ||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>( | ||
'dev.flutter.pigeon.PathProviderApi.getTemporaryPath', codec, | ||
binaryMessenger: _binaryMessenger); | ||
final Map<Object?, Object?>? replyMap = | ||
await channel.send(null) as Map<Object?, Object?>?; | ||
if (replyMap == null) { | ||
throw PlatformException( | ||
code: 'channel-error', | ||
message: 'Unable to establish connection on channel.', | ||
); | ||
} else if (replyMap['error'] != null) { | ||
final Map<Object?, Object?> error = | ||
(replyMap['error'] as Map<Object?, Object?>?)!; | ||
throw PlatformException( | ||
code: (error['code'] as String?)!, | ||
message: error['message'] as String?, | ||
details: error['details'], | ||
); | ||
} else { | ||
return (replyMap['result'] as String?); | ||
} | ||
} | ||
|
||
Future<String?> getApplicationSupportPath() async { | ||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>( | ||
'dev.flutter.pigeon.PathProviderApi.getApplicationSupportPath', codec, | ||
binaryMessenger: _binaryMessenger); | ||
final Map<Object?, Object?>? replyMap = | ||
await channel.send(null) as Map<Object?, Object?>?; | ||
if (replyMap == null) { | ||
throw PlatformException( | ||
code: 'channel-error', | ||
message: 'Unable to establish connection on channel.', | ||
); | ||
} else if (replyMap['error'] != null) { | ||
final Map<Object?, Object?> error = | ||
(replyMap['error'] as Map<Object?, Object?>?)!; | ||
throw PlatformException( | ||
code: (error['code'] as String?)!, | ||
message: error['message'] as String?, | ||
details: error['details'], | ||
); | ||
} else { | ||
return (replyMap['result'] as String?); | ||
} | ||
} | ||
|
||
Future<String?> getLibraryPath() async { | ||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>( | ||
'dev.flutter.pigeon.PathProviderApi.getLibraryPath', codec, | ||
binaryMessenger: _binaryMessenger); | ||
final Map<Object?, Object?>? replyMap = | ||
await channel.send(null) as Map<Object?, Object?>?; | ||
if (replyMap == null) { | ||
throw PlatformException( | ||
code: 'channel-error', | ||
message: 'Unable to establish connection on channel.', | ||
); | ||
} else if (replyMap['error'] != null) { | ||
final Map<Object?, Object?> error = | ||
(replyMap['error'] as Map<Object?, Object?>?)!; | ||
throw PlatformException( | ||
code: (error['code'] as String?)!, | ||
message: error['message'] as String?, | ||
details: error['details'], | ||
); | ||
} else { | ||
return (replyMap['result'] as String?); | ||
} | ||
} | ||
|
||
Future<String?> getApplicationDocumentsPath() async { | ||
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>( | ||
'dev.flutter.pigeon.PathProviderApi.getApplicationDocumentsPath', codec, | ||
binaryMessenger: _binaryMessenger); | ||
final Map<Object?, Object?>? replyMap = | ||
await channel.send(null) as Map<Object?, Object?>?; | ||
if (replyMap == null) { | ||
throw PlatformException( | ||
code: 'channel-error', | ||
message: 'Unable to establish connection on channel.', | ||
); | ||
} else if (replyMap['error'] != null) { | ||
final Map<Object?, Object?> error = | ||
(replyMap['error'] as Map<Object?, Object?>?)!; | ||
throw PlatformException( | ||
code: (error['code'] as String?)!, | ||
message: error['message'] as String?, | ||
details: error['details'], | ||
); | ||
} else { | ||
return (replyMap['result'] as String?); | ||
} | ||
} | ||
} |
Oops, something went wrong.