Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -205,6 +205,7 @@
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
111 changes: 62 additions & 49 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
@@ -1,53 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Platform Metadata</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>platform_metadata_example</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>meta_key</key>
<string> meta_value from ios </string>
</dict>
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Platform Metadata</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>platform_metadata_example</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>meta_key</key>
<string> meta_value from ios </string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleURLSchemes</key>
<array>
<string>wcflutterwallet</string>
</array>
</dict>
</array>
</dict>
</plist>
7 changes: 4 additions & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,17 @@ class _MyAppState extends State<MyApp> {
}

Future<void> getMetaData() async {
String metaDataValue;
dynamic metaDataValue;
try {
metaDataValue = await PlatformMetadata.getMetaDataValue('meta_key') ?? '';
metaDataValue =
await PlatformMetadata.getMetaDataValue('CFBundleURLTypes');
} on PlatformException {
metaDataValue = 'Failed to get metaDataValue.';
}
if (!mounted) return;

setState(() {
_metaDataValue = metaDataValue;
_metaDataValue = metaDataValue.toString();
});
}

Expand Down
38 changes: 19 additions & 19 deletions ios/Classes/PlatformMetadataPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ import Flutter
import UIKit

public class PlatformMetadataPlugin: NSObject, FlutterPlugin {
public static func register(with registrar: FlutterPluginRegistrar) {
let channel = FlutterMethodChannel(name: "platform_metadata", binaryMessenger: registrar.messenger())
let instance = PlatformMetadataPlugin()
registrar.addMethodCallDelegate(instance, channel: channel)
}

public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {

switch call.method {
case "getMetaData":
let arg = call.arguments as! String
let apiURL = Bundle.infoPlistValue(forKey: arg) as? String
result(apiURL)

default:
result(nil)
}
}

public static func register(with registrar: FlutterPluginRegistrar) {
let channel = FlutterMethodChannel(name: "platform_metadata", binaryMessenger: registrar.messenger())
let instance = PlatformMetadataPlugin()
registrar.addMethodCallDelegate(instance, channel: channel)
}
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
switch call.method {
case "getMetaData":
let arg = call.arguments as! String
let apiURL = Bundle.infoPlistValue(forKey: arg)
result(apiURL)
default:
result(nil)
}
}
}

extension Bundle {
Expand Down
2 changes: 1 addition & 1 deletion lib/platform_metadata.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'platform_metadata_platform_interface.dart';

class PlatformMetadata {
static Future<String?> getMetaDataValue(String metaDataName) {
static Future<dynamic> getMetaDataValue(String metaDataName) {
return PlatformMetadataPlatform.instance.getMetaDataValue(metaDataName);
}
}
8 changes: 5 additions & 3 deletions lib/platform_metadata_method_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ class MethodChannelPlatformMetadata extends PlatformMetadataPlatform {
final methodChannel = const MethodChannel('platform_metadata');

@override
Future<String?> getMetaDataValue(String mateDataName) async {
final metaDataValue =
await methodChannel.invokeMethod<String>('getMetaData', mateDataName);
Future<dynamic> getMetaDataValue(String mateDataName) async {
final metaDataValue = await methodChannel.invokeMethod<dynamic>(
'getMetaData',
mateDataName,
);
return metaDataValue;
}
}
2 changes: 1 addition & 1 deletion lib/platform_metadata_platform_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract class PlatformMetadataPlatform extends PlatformInterface {
_instance = instance;
}

Future<String?> getMetaDataValue(String mateDataName) {
Future<dynamic> getMetaDataValue(String mateDataName) {
throw UnimplementedError('getMetaData() has not been implemented.');
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies:
sdk: flutter
flutter_web_plugins:
sdk: flutter
plugin_platform_interface: ^2.0.2
plugin_platform_interface: ^2.1.8

dev_dependencies:
flutter_test:
Expand Down