Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rn-apple-healthkit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ym
rn-apple-healthkit
Commits
2178a8ed
Commit
2178a8ed
authored
May 11, 2018
by
Evgenii Evstropov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add function to check share(write) permissions authorisation
parent
9c5f2734
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
1 deletion
+25
-1
RCTAppleHealthKit/RCTAppleHealthKit+TypesAndPermissions.h
RCTAppleHealthKit/RCTAppleHealthKit+TypesAndPermissions.h
+2
-0
RCTAppleHealthKit/RCTAppleHealthKit+TypesAndPermissions.m
RCTAppleHealthKit/RCTAppleHealthKit+TypesAndPermissions.m
+0
-1
RCTAppleHealthKit/RCTAppleHealthKit.h
RCTAppleHealthKit/RCTAppleHealthKit.h
+1
-0
RCTAppleHealthKit/RCTAppleHealthKit.m
RCTAppleHealthKit/RCTAppleHealthKit.m
+22
-0
No files found.
RCTAppleHealthKit/RCTAppleHealthKit+TypesAndPermissions.h
View file @
2178a8ed
...
...
@@ -10,6 +10,8 @@
@interface
RCTAppleHealthKit
(
TypesAndPermissions
)
-
(
NSDictionary
*
)
readPermsDict
;
-
(
NSDictionary
*
)
writePermsDict
;
-
(
NSSet
*
)
getReadPermsFromOptions
:(
NSArray
*
)
options
;
-
(
NSSet
*
)
getWritePermsFromOptions
:(
NSArray
*
)
options
;
...
...
RCTAppleHealthKit/RCTAppleHealthKit+TypesAndPermissions.m
View file @
2178a8ed
...
...
@@ -83,7 +83,6 @@
return
writePerms
;
}
// Returns HealthKit read permissions from options array
-
(
NSSet
*
)
getReadPermsFromOptions
:(
NSArray
*
)
options
{
NSDictionary
*
readPermDict
=
[
self
readPermsDict
];
...
...
RCTAppleHealthKit/RCTAppleHealthKit.h
View file @
2178a8ed
...
...
@@ -19,6 +19,7 @@
-
(
void
)
isHealthKitAvailable
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
initializeHealthKit
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
checkPermission
:(
NSString
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
-
(
void
)
getModuleInfo
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
;
@end
RCTAppleHealthKit/RCTAppleHealthKit.m
View file @
2178a8ed
...
...
@@ -36,6 +36,11 @@ RCT_EXPORT_METHOD(initHealthKit:(NSDictionary *)input callback:(RCTResponseSende
[
self
initializeHealthKit
:
input
callback
:
callback
];
}
RCT_EXPORT_METHOD
(
checkSharePermission
:
(
NSString
*
)
input
callback
:
(
RCTResponseSenderBlock
)
callback
)
{
[
self
checkPermission
:
input
callback
:
callback
];
}
RCT_EXPORT_METHOD
(
initStepCountObserver
:
(
NSDictionary
*
)
input
callback
:
(
RCTResponseSenderBlock
)
callback
)
{
[
self
fitness_initializeStepEventObserver
:
input
callback
:
callback
];
...
...
@@ -248,6 +253,23 @@ RCT_EXPORT_METHOD(saveMindfulSession:(NSDictionary *)input callback:(RCTResponse
}
}
-
(
void
)
checkPermission
:(
NSString
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
{
self
.
healthStore
=
[[
HKHealthStore
alloc
]
init
];
if
([
HKHealthStore
isHealthDataAvailable
])
{
HKObjectType
*
val
=
[[
self
writePermsDict
]
objectForKey
:
input
];
if
([
self
.
healthStore
authorizationStatusForType
:
val
]
==
HKAuthorizationStatusSharingAuthorized
)
{
callback
(@[[
NSNull
null
],
@true
]);
}
else
{
callback
(@[[
NSNull
null
],
@false
]);
}
}
else
{
callback
(@[
RCTMakeError
(
@"HealthKit data is not available"
,
nil
,
nil
)]);
}
}
-
(
void
)
getModuleInfo
:(
NSDictionary
*
)
input
callback
:(
RCTResponseSenderBlock
)
callback
{
NSDictionary
*
info
=
@{
...
...
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