Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
permission_handler
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
songyanzhi
permission_handler
Commits
089b6bd2
Unverified
Commit
089b6bd2
authored
Jun 15, 2021
by
Maurits van Beusekom
Committed by
GitHub
Jun 15, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #598 from Baseflow/issue/597
Fix deprecation warning on iOS using phone permissions.
parents
72d3dde2
639350e7
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
12 deletions
+38
-12
permission_handler/CHANGELOG.md
+4
-0
permission_handler/example/ios/Runner.xcodeproj/project.pbxproj
+3
-0
permission_handler/example/lib/main.dart
+9
-5
permission_handler/ios/Classes/strategies/PhonePermissionStrategy.m
+21
-6
permission_handler/pubspec.yaml
+1
-1
No files found.
permission_handler/CHANGELOG.md
View file @
089b6bd2
## 8.1.1
*
Fixed deprecation issue when checking phone capabilities on iOS (see issue
[
#597
](
https://github.com/Baseflow/flutter-permission-handler/issues/597
)
).
## 8.1.0
*
Added support for iOS 12+ Critical Alerts permission requesting.
...
...
permission_handler/example/ios/Runner.xcodeproj/project.pbxproj
View file @
089b6bd2
...
...
@@ -355,6 +355,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME
=
AppIcon
;
CLANG_ENABLE_MODULES
=
YES
;
CURRENT_PROJECT_VERSION
=
"$(FLUTTER_BUILD_NUMBER)"
;
DEVELOPMENT_TEAM
=
7624MWN53C
;
ENABLE_BITCODE
=
NO
;
FRAMEWORK_SEARCH_PATHS
=
(
"$(inherited)"
,
...
...
@@ -491,6 +492,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME
=
AppIcon
;
CLANG_ENABLE_MODULES
=
YES
;
CURRENT_PROJECT_VERSION
=
"$(FLUTTER_BUILD_NUMBER)"
;
DEVELOPMENT_TEAM
=
7624MWN53C
;
ENABLE_BITCODE
=
NO
;
FRAMEWORK_SEARCH_PATHS
=
(
"$(inherited)"
,
...
...
@@ -521,6 +523,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME
=
AppIcon
;
CLANG_ENABLE_MODULES
=
YES
;
CURRENT_PROJECT_VERSION
=
"$(FLUTTER_BUILD_NUMBER)"
;
DEVELOPMENT_TEAM
=
7624MWN53C
;
ENABLE_BITCODE
=
NO
;
FRAMEWORK_SEARCH_PATHS
=
(
"$(inherited)"
,
...
...
permission_handler/example/lib/main.dart
View file @
089b6bd2
...
...
@@ -114,23 +114,27 @@ class _PermissionState extends State<PermissionWidget> {
_permissionStatus
.
toString
(),
style:
TextStyle
(
color:
getPermissionColor
()),
),
trailing:
IconButton
(
trailing:
(
_permission
is
PermissionWithService
)
?
IconButton
(
icon:
const
Icon
(
Icons
.
info
,
color:
Colors
.
white
,
),
onPressed:
()
{
checkServiceStatus
(
context
,
_permission
);
}),
checkServiceStatus
(
context
,
_permission
as
PermissionWithService
);
})
:
null
,
onTap:
()
{
requestPermission
(
_permission
);
},
);
}
void
checkServiceStatus
(
BuildContext
context
,
Permission
permission
)
async
{
void
checkServiceStatus
(
BuildContext
context
,
PermissionWithService
permission
)
async
{
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Text
((
await
permission
.
status
).
toString
()),
content:
Text
((
await
permission
.
s
erviceS
tatus
).
toString
()),
));
}
...
...
permission_handler/ios/Classes/strategies/PhonePermissionStrategy.m
View file @
089b6bd2
...
...
@@ -30,15 +30,30 @@
}
// https://stackoverflow.com/a/11595365
-
(
bool
)
canDevicePlaceAPhoneCall
{
/*
* Returns YES if the device can place a phone call
/**
* Returns YES if the device can place a phone call.
*/
// Device supports phone calls, lets confirm it can place one right now
-
(
bool
)
canDevicePlaceAPhoneCall
{
CTTelephonyNetworkInfo
*
netInfo
=
[[
CTTelephonyNetworkInfo
alloc
]
init
];
if
(
@available
(
iOS
12
.
0
,
*
))
{
NSDictionary
<
NSString
*
,
CTCarrier
*>
*
providers
=
[
netInfo
serviceSubscriberCellularProviders
];
for
(
NSString
*
key
in
providers
)
{
CTCarrier
*
carrier
=
[
providers
objectForKey
:
key
];
if
([
self
canPlacePhoneCallWithCarrier
:
carrier
])
{
return
YES
;
}
}
return
NO
;
}
else
{
CTCarrier
*
carrier
=
[
netInfo
subscriberCellularProvider
];
return
[
self
canPlacePhoneCallWithCarrier
:
carrier
];
}
}
-
(
bool
)
canPlacePhoneCallWithCarrier
:
(
CTCarrier
*
)
carrier
{
// https://stackoverflow.com/a/11595365
NSString
*
mnc
=
[
carrier
mobileNetworkCode
];
if
(([
mnc
length
]
==
0
)
||
([
mnc
isEqualToString
:
@"65535"
]))
{
// Device cannot place a call at this time. SIM might be removed.
...
...
permission_handler/pubspec.yaml
View file @
089b6bd2
name
:
permission_handler
description
:
Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
version
:
8.1.
0
version
:
8.1.
1
homepage
:
https://github.com/baseflowit/flutter-permission-handler
flutter
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment