Skip to content

Commit

Permalink
Revert "adding nil check (flutter#1072)"
Browse files Browse the repository at this point in the history
This reverts commit dece9a6.
  • Loading branch information
andreidiaconu authored Feb 17, 2019
1 parent 521b93d commit 1ce5155
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
4 changes: 0 additions & 4 deletions packages/package_info/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
## 0.3.2+1

* Fixed a crash on IOS when some of the package infos are not available.

## 0.3.2

* Updated Gradle tooling to match Android Studio 3.1.2.
Expand Down
15 changes: 9 additions & 6 deletions packages/package_info/ios/Classes/PackageInfoPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {

- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
if ([call.method isEqualToString:@"getAll"]) {
NSString* displayName =
[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
// Cannot put nil into a map so return an empty string.
if (displayName == nil) {
displayName = @"";
}
result(@{
@"appName" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]
?: [NSNull null],
@"packageName" : [[NSBundle mainBundle] bundleIdentifier] ?: [NSNull null],
@"version" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]
?: [NSNull null],
@"appName" : displayName,
@"packageName" : [[NSBundle mainBundle] bundleIdentifier],
@"version" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"],
@"buildNumber" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]
?: [NSNull null],
});
} else {
result(FlutterMethodNotImplemented);
Expand Down
2 changes: 1 addition & 1 deletion packages/package_info/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Flutter plugin for querying information about the application
package, such as CFBundleVersion on iOS or versionCode on Android.
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/package_info
version: 0.3.2+1
version: 0.3.2

flutter:
plugin:
Expand Down

0 comments on commit 1ce5155

Please sign in to comment.