Commit e07ce94b by Maurits van Beusekom

Merge branch 'release/2.1.1'

parents 8bc75640 5ca3b604
...@@ -46,7 +46,7 @@ matrix: ...@@ -46,7 +46,7 @@ matrix:
env: env:
- SHARD="Build example ipas" - SHARD="Build example ipas"
language: generic language: generic
osx_image: xcode9.3 osx_image: xcode10.1
before_script: before_script:
- ./scripts/before_build_ipas.sh - ./scripts/before_build_ipas.sh
- export PATH=$HOME/flutter/bin:$HOME/flutter/bin/cache/dart-sdk/bin:$PATH - export PATH=$HOME/flutter/bin:$HOME/flutter/bin/cache/dart-sdk/bin:$PATH
......
## 2.1.1
* Update to the latest version of Swift (4.2);
* Make sure that the correct Swift version is set in the `Podfile` of consuming Apps;
* Updated configuration for statis code analyses, so it complies with the Flutter recommendations.
## 2.1.0 ## 2.1.0
* Added Android support to check if location services are enabled. If location services are not running the permission check returns `PermissionStatus.DISABLED`. * Added Android support to check if location services are enabled. If location services are not running the permission check returns `PermissionStatus.DISABLED`.
......
...@@ -22,7 +22,7 @@ To use this plugin, add `permission_handler` as a [dependency in your pubspec.ya ...@@ -22,7 +22,7 @@ To use this plugin, add `permission_handler` as a [dependency in your pubspec.ya
```yaml ```yaml
dependencies: dependencies:
permission_handler: '^2.1.0' permission_handler: '^2.1.1'
``` ```
> **NOTE:** There's a known issue with integrating plugins that use Swift into a Flutter project created with the Objective-C template. See issue [Flutter#16049](https://github.com/flutter/flutter/issues/16049) for help on integration. > **NOTE:** There's a known issue with integrating plugins that use Swift into a Flutter project created with the Objective-C template. See issue [Flutter#16049](https://github.com/flutter/flutter/issues/16049) for help on integration.
......
...@@ -7,7 +7,9 @@ ...@@ -7,7 +7,9 @@
# See the configuration guide for more # See the configuration guide for more
# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer # https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer
# #
# There are four similar analysis options files in the flutter repos: # There are other similar analysis options files in the flutter repos,
# which should be kept in sync with this file:
#
# - analysis_options.yaml (this file) # - analysis_options.yaml (this file)
# - packages/flutter/lib/analysis_options_user.yaml # - packages/flutter/lib/analysis_options_user.yaml
# - https://github.com/flutter/plugins/blob/master/analysis_options.yaml # - https://github.com/flutter/plugins/blob/master/analysis_options.yaml
...@@ -15,13 +17,8 @@ ...@@ -15,13 +17,8 @@
# #
# This file contains the analysis options used by Flutter tools, such as IntelliJ, # This file contains the analysis options used by Flutter tools, such as IntelliJ,
# Android Studio, and the `flutter analyze` command. # Android Studio, and the `flutter analyze` command.
#
# The flutter/plugins repo contains a copy of this file, which should be kept
# in sync with this file.
analyzer: analyzer:
language:
enableSuperMixins: true
strong-mode: strong-mode:
implicit-dynamic: false implicit-dynamic: false
errors: errors:
...@@ -67,38 +64,43 @@ linter: ...@@ -67,38 +64,43 @@ linter:
- avoid_relative_lib_imports - avoid_relative_lib_imports
- avoid_renaming_method_parameters - avoid_renaming_method_parameters
- avoid_return_types_on_setters - avoid_return_types_on_setters
# - avoid_returning_null # we do this commonly # - avoid_returning_null # there are plenty of valid reasons to return null
# - avoid_returning_this # https://github.com/dart-lang/linter/issues/842 # - avoid_returning_this # there are plenty of valid reasons to return this
# - avoid_setters_without_getters # not yet tested # - avoid_setters_without_getters # not yet tested
# - avoid_single_cascade_in_expression_statements # not yet tested # - avoid_single_cascade_in_expression_statements # not yet tested
- avoid_slow_async_io - avoid_slow_async_io
# - avoid_types_as_parameter_names # https://github.com/dart-lang/linter/pull/954/files - avoid_types_as_parameter_names
# - avoid_types_on_closure_parameters # conflicts with always_specify_types # - avoid_types_on_closure_parameters # conflicts with always_specify_types
# - avoid_unused_constructor_parameters # https://github.com/dart-lang/linter/pull/847 - avoid_unused_constructor_parameters
- avoid_void_async
- await_only_futures - await_only_futures
- camel_case_types - camel_case_types
- cancel_subscriptions - cancel_subscriptions
# - cascade_invocations # not yet tested # - cascade_invocations # not yet tested
# - close_sinks # https://github.com/flutter/flutter/issues/5789 # - close_sinks # not reliable enough
# - comment_references # blocked on https://github.com/dart-lang/dartdoc/issues/1153 # - comment_references # blocked on https://github.com/flutter/flutter/issues/20765
# - constant_identifier_names # https://github.com/dart-lang/linter/issues/204 # - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
- control_flow_in_finally - control_flow_in_finally
# - curly_braces_in_flow_control_structures # not yet tested
- directives_ordering - directives_ordering
- empty_catches - empty_catches
- empty_constructor_bodies - empty_constructor_bodies
- empty_statements - empty_statements
# - file_names # not yet tested
- hash_and_equals - hash_and_equals
- implementation_imports - implementation_imports
# - invariant_booleans # https://github.com/flutter/flutter/issues/5790 # - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
- iterable_contains_unrelated_type - iterable_contains_unrelated_type
# - join_return_with_assignment # not yet tested # - join_return_with_assignment # not yet tested
- library_names - library_names
- library_prefixes - library_prefixes
# - lines_longer_than_80_chars # not yet tested
- list_remove_unrelated_type - list_remove_unrelated_type
# - literal_only_boolean_expressions # https://github.com/flutter/flutter/issues/5791 # - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181
- no_adjacent_strings_in_list - no_adjacent_strings_in_list
- no_duplicate_case_values - no_duplicate_case_values
- non_constant_identifier_names - non_constant_identifier_names
# - null_closures # not yet tested
# - omit_local_variable_types # opposite of always_specify_types # - omit_local_variable_types # opposite of always_specify_types
# - one_member_abstracts # too many false positives # - one_member_abstracts # too many false positives
# - only_throw_errors # https://github.com/flutter/flutter/issues/5792 # - only_throw_errors # https://github.com/flutter/flutter/issues/5792
...@@ -124,13 +126,17 @@ linter: ...@@ -124,13 +126,17 @@ linter:
- prefer_final_locals - prefer_final_locals
- prefer_foreach - prefer_foreach
# - prefer_function_declarations_over_variables # not yet tested # - prefer_function_declarations_over_variables # not yet tested
- prefer_generic_function_type_aliases
- prefer_initializing_formals - prefer_initializing_formals
# - prefer_interpolation_to_compose_strings # not yet tested # - prefer_interpolation_to_compose_strings # not yet tested
# - prefer_iterable_whereType # https://github.com/dart-lang/sdk/issues/32463
- prefer_is_empty - prefer_is_empty
- prefer_is_not_empty - prefer_is_not_empty
- prefer_iterable_whereType
# - prefer_mixin # https://github.com/dart-lang/language/issues/32
- prefer_single_quotes - prefer_single_quotes
- prefer_typing_uninitialized_variables - prefer_typing_uninitialized_variables
- prefer_void_to_null
# - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml
- recursive_getters - recursive_getters
- slash_for_doc_comments - slash_for_doc_comments
- sort_constructors_first - sort_constructors_first
...@@ -140,21 +146,22 @@ linter: ...@@ -140,21 +146,22 @@ linter:
- throw_in_finally - throw_in_finally
# - type_annotate_public_apis # subset of always_specify_types # - type_annotate_public_apis # subset of always_specify_types
- type_init_formals - type_init_formals
# - unawaited_futures # https://github.com/flutter/flutter/issues/5793 # - unawaited_futures # too many false positives
- unnecessary_brace_in_string_interps - unnecessary_brace_in_string_interps
# - unnecessary_const - unnecessary_const
- unnecessary_getters_setters - unnecessary_getters_setters
# - unnecessary_lambdas # https://github.com/dart-lang/linter/issues/498 # - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
- unnecessary_new
- unnecessary_null_aware_assignments - unnecessary_null_aware_assignments
- unnecessary_null_in_if_null_operators - unnecessary_null_in_if_null_operators
- unnecessary_overrides - unnecessary_overrides
- unnecessary_parenthesis - unnecessary_parenthesis
# - unnecessary_statements # not yet tested - unnecessary_statements
- unnecessary_this - unnecessary_this
- unrelated_type_equality_checks - unrelated_type_equality_checks
- use_rethrow_when_possible - use_rethrow_when_possible
# - use_setters_to_change_properties # not yet tested # - use_setters_to_change_properties # not yet tested
# - use_string_buffers # https://github.com/dart-lang/linter/pull/664 # - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review # - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
- valid_regexps - valid_regexps
# - void_checks # not yet tested # - void_checks # not yet tested
\ No newline at end of file
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
); );
inputPaths = ( inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", "${PODS_ROOT}/../.symlinks/flutter/ios-release/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/permission_handler/permission_handler.framework", "${BUILT_PRODUCTS_DIR}/permission_handler/permission_handler.framework",
); );
name = "[CP] Embed Pods Frameworks"; name = "[CP] Embed Pods Frameworks";
...@@ -445,7 +445,7 @@ ...@@ -445,7 +445,7 @@
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0; SWIFT_VERSION = 4.2;
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };
name = Debug; name = Debug;
...@@ -472,7 +472,7 @@ ...@@ -472,7 +472,7 @@
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0; SWIFT_VERSION = 4.2;
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };
name = Release; name = Release;
......
<?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>BuildSystemType</key>
<string>Original</string>
</dict>
</plist>
...@@ -5,7 +5,7 @@ import Flutter ...@@ -5,7 +5,7 @@ import Flutter
@objc class AppDelegate: FlutterAppDelegate { @objc class AppDelegate: FlutterAppDelegate {
override func application( override func application(
_ application: UIApplication, _ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool { ) -> Bool {
GeneratedPluginRegistrant.register(with: self) GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions) return super.application(application, didFinishLaunchingWithOptions: launchOptions)
......
...@@ -3,14 +3,14 @@ import 'dart:io'; ...@@ -3,14 +3,14 @@ import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
void main() => runApp(new MyApp()); void main() => runApp(MyApp());
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new MaterialApp( return MaterialApp(
home: new Scaffold( home: Scaffold(
appBar: new AppBar( appBar: AppBar(
title: const Text('Plugin example app'), title: const Text('Plugin example app'),
actions: <Widget>[ actions: <Widget>[
IconButton( IconButton(
...@@ -21,8 +21,8 @@ class MyApp extends StatelessWidget { ...@@ -21,8 +21,8 @@ class MyApp extends StatelessWidget {
) )
], ],
), ),
body: new Center( body: Center(
child: new ListView( child: ListView(
children: PermissionGroup.values children: PermissionGroup.values
.where((PermissionGroup permission) { .where((PermissionGroup permission) {
if (Platform.isIOS) { if (Platform.isIOS) {
...@@ -38,7 +38,7 @@ class MyApp extends StatelessWidget { ...@@ -38,7 +38,7 @@ class MyApp extends StatelessWidget {
} }
}) })
.map((PermissionGroup permission) => .map((PermissionGroup permission) =>
new PermissionWidget(permission)) PermissionWidget(permission))
.toList()), .toList()),
), ),
)); ));
...@@ -67,13 +67,15 @@ class _PermissionState extends State<PermissionWidget> { ...@@ -67,13 +67,15 @@ class _PermissionState extends State<PermissionWidget> {
_listenForPermissionStatus(); _listenForPermissionStatus();
} }
void _listenForPermissionStatus() async { void _listenForPermissionStatus() {
final PermissionStatus status = final Future<PermissionStatus> statusFuture =
await PermissionHandler().checkPermissionStatus(_permissionGroup); PermissionHandler().checkPermissionStatus(_permissionGroup);
statusFuture.then((PermissionStatus status) {
setState(() { setState(() {
_permissionStatus = status; _permissionStatus = status;
}); });
});
} }
Color getPermissionColor() { Color getPermissionColor() {
...@@ -89,11 +91,11 @@ class _PermissionState extends State<PermissionWidget> { ...@@ -89,11 +91,11 @@ class _PermissionState extends State<PermissionWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new ListTile( return ListTile(
title: new Text(_permissionGroup.toString()), title: Text(_permissionGroup.toString()),
subtitle: new Text( subtitle: Text(
_permissionStatus.toString(), _permissionStatus.toString(),
style: new TextStyle(color: getPermissionColor()), style: TextStyle(color: getPermissionColor()),
), ),
onTap: () async { onTap: () async {
requestPermission(_permissionGroup); requestPermission(_permissionGroup);
...@@ -101,13 +103,16 @@ class _PermissionState extends State<PermissionWidget> { ...@@ -101,13 +103,16 @@ class _PermissionState extends State<PermissionWidget> {
); );
} }
void requestPermission(PermissionGroup permission) async { void requestPermission(PermissionGroup permission) {
final List<PermissionGroup> permissions = <PermissionGroup>[permission]; final List<PermissionGroup> permissions = <PermissionGroup>[permission];
final Map<PermissionGroup, PermissionStatus> permissionRequestResult = final Future<Map<PermissionGroup, PermissionStatus>> requestFuture =
await PermissionHandler().requestPermissions(permissions); PermissionHandler().requestPermissions(permissions);
requestFuture
.then((Map<PermissionGroup, PermissionStatus> permissionRequestResult) {
setState(() { setState(() {
_permissionStatus = permissionRequestResult[permission]; _permissionStatus = permissionRequestResult[permission];
}); });
});
} }
} }
...@@ -47,12 +47,12 @@ class PermissionManager: NSObject { ...@@ -47,12 +47,12 @@ class PermissionManager: NSObject {
static func openAppSettings(result: @escaping FlutterResult) { static func openAppSettings(result: @escaping FlutterResult) {
if #available(iOS 8.0, *) { if #available(iOS 8.0, *) {
if #available(iOS 10, *) { if #available(iOS 10, *) {
UIApplication.shared.open(URL.init(string: UIApplicationOpenSettingsURLString)!, options: [:], UIApplication.shared.open(URL.init(string: UIApplication.openSettingsURLString)!, options: convertToUIApplicationOpenExternalURLOptionsKeyDictionary([:]),
completionHandler: { completionHandler: {
(success) in result(success) (success) in result(success)
}) })
} else { } else {
let success = UIApplication.shared.openURL(URL.init(string: UIApplicationOpenSettingsURLString)!) let success = UIApplication.shared.openURL(URL.init(string: UIApplication.openSettingsURLString)!)
result(success) result(success)
} }
} }
...@@ -89,3 +89,8 @@ class PermissionManager: NSObject { ...@@ -89,3 +89,8 @@ class PermissionManager: NSObject {
} }
} }
} }
// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertToUIApplicationOpenExternalURLOptionsKeyDictionary(_ input: [String: Any]) -> [UIApplication.OpenExternalURLOptionsKey: Any] {
return Dictionary(uniqueKeysWithValues: input.map { key, value in (UIApplication.OpenExternalURLOptionsKey(rawValue: key), value)})
}
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'permission_handler' s.name = 'permission_handler'
s.version = '2.1.0' s.version = '2.1.1'
s.summary = 'Permission plugin for Flutter.' s.summary = 'Permission plugin for Flutter.'
s.description = <<-DESC s.description = <<-DESC
Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions. Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
...@@ -17,5 +17,6 @@ Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Andro ...@@ -17,5 +17,6 @@ Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Andro
s.dependency 'Flutter' s.dependency 'Flutter'
s.ios.deployment_target = '8.0' s.ios.deployment_target = '8.0'
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.2' }
end end
...@@ -15,9 +15,9 @@ class PermissionHandler { ...@@ -15,9 +15,9 @@ class PermissionHandler {
factory PermissionHandler() { factory PermissionHandler() {
if (_instance == null) { if (_instance == null) {
const MethodChannel methodChannel = const MethodChannel methodChannel =
const MethodChannel('flutter.baseflow.com/permissions/methods'); MethodChannel('flutter.baseflow.com/permissions/methods');
_instance = new PermissionHandler.private(methodChannel); _instance = PermissionHandler.private(methodChannel);
} }
return _instance; return _instance;
} }
......
name: permission_handler name: permission_handler
description: Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions. description: Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
version: 2.1.0 version: 2.1.1
author: Baseflow <hello@baseflow.com> author: Baseflow <hello@baseflow.com>
homepage: https://github.com/baseflowit/flutter-permission-handler homepage: https://github.com/baseflowit/flutter-permission-handler
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment