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
0b536cff
Commit
0b536cff
authored
Dec 23, 2018
by
Evgeny Evstropov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copy-right corrects. Decomposition. Fix error message. Fix difference between ios 11 and 10
parent
b1862448
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
85 additions
and
65 deletions
+85
-65
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Activity.h
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Activity.h
+3
-1
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Activity.m
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Activity.m
+2
-2
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Body.h
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Body.h
+2
-1
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Body.m
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Body.m
+2
-1
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Characteristic.h
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Characteristic.h
+2
-1
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Characteristic.m
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Characteristic.m
+2
-1
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.h
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.h
+2
-1
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m
+9
-28
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Sleep.h
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Sleep.h
+2
-1
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Sleep.m
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Sleep.m
+2
-1
RCTAppleHealthKit/RCTAppleHealthKit+Queries.h
RCTAppleHealthKit/RCTAppleHealthKit+Queries.h
+2
-1
RCTAppleHealthKit/RCTAppleHealthKit+Queries.m
RCTAppleHealthKit/RCTAppleHealthKit+Queries.m
+28
-20
RCTAppleHealthKit/RCTAppleHealthKit+TypesAndPermissions.h
RCTAppleHealthKit/RCTAppleHealthKit+TypesAndPermissions.h
+2
-1
RCTAppleHealthKit/RCTAppleHealthKit+TypesAndPermissions.m
RCTAppleHealthKit/RCTAppleHealthKit+TypesAndPermissions.m
+2
-1
RCTAppleHealthKit/RCTAppleHealthKit+Utils.h
RCTAppleHealthKit/RCTAppleHealthKit+Utils.h
+3
-1
RCTAppleHealthKit/RCTAppleHealthKit+Utils.m
RCTAppleHealthKit/RCTAppleHealthKit+Utils.m
+16
-1
RCTAppleHealthKit/RCTAppleHealthKit.h
RCTAppleHealthKit/RCTAppleHealthKit.h
+2
-1
RCTAppleHealthKit/RCTAppleHealthKit.m
RCTAppleHealthKit/RCTAppleHealthKit.m
+2
-1
No files found.
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Activity.h
View file @
0b536cff
...
...
@@ -3,8 +3,10 @@
// RCTAppleHealthKit
//
// Created by Alexander Vallorosi on 4/27/17.
// Copyright © 2017 Alexander Vallorosi. All rights reserved.
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
//
#import "RCTAppleHealthKit.h"
@interface
RCTAppleHealthKit
(
Methods_Activity
)
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Activity.m
View file @
0b536cff
...
...
@@ -3,8 +3,8 @@
// RCTAppleHealthKit
//
// Created by Alexander Vallorosi on 4/27/17.
//
Copyright © 2017 Alexander Vallorosi. All rights reserved.
//
//
This source code is licensed under the MIT-style license found in the
//
LICENSE file in the root directory of this source tree.
#import "RCTAppleHealthKit+Methods_Activity.h"
#import "RCTAppleHealthKit+Queries.h"
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Body.h
View file @
0b536cff
...
...
@@ -3,7 +3,8 @@
// RCTAppleHealthKit
//
// Created by Greg Wilson on 2016-06-26.
// Copyright © 2016 Greg Wilson. All rights reserved.
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
//
#import "RCTAppleHealthKit.h"
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Body.m
View file @
0b536cff
...
...
@@ -3,7 +3,8 @@
// RCTAppleHealthKit
//
// Created by Greg Wilson on 2016-06-26.
// Copyright © 2016 Greg Wilson. All rights reserved.
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
//
#import "RCTAppleHealthKit+Methods_Body.h"
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Characteristic.h
View file @
0b536cff
...
...
@@ -3,7 +3,8 @@
// RCTAppleHealthKit
//
// Created by Greg Wilson on 2016-06-29.
// Copyright © 2016 Greg Wilson. All rights reserved.
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
//
#import "RCTAppleHealthKit.h"
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Characteristic.m
View file @
0b536cff
...
...
@@ -3,7 +3,8 @@
// RCTAppleHealthKit
//
// Created by Greg Wilson on 2016-06-29.
// Copyright © 2016 Greg Wilson. All rights reserved.
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
//
#import "RCTAppleHealthKit+Methods_Characteristic.h"
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.h
View file @
0b536cff
...
...
@@ -3,7 +3,8 @@
// RCTAppleHealthKit
//
// Created by Greg Wilson on 2016-06-26.
// Copyright © 2016 Greg Wilson. All rights reserved.
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
//
#import "RCTAppleHealthKit.h"
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Fitness.m
View file @
0b536cff
...
...
@@ -3,7 +3,8 @@
// RCTAppleHealthKit
//
// Created by Greg Wilson on 2016-06-26.
// Copyright © 2016 Greg Wilson. All rights reserved.
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
//
#import "RCTAppleHealthKit+Methods_Fitness.h"
...
...
@@ -59,21 +60,11 @@
NSPredicate
*
predicate
=
[
HKQuery
predicateForSamplesWithStartDate
:
startDate
endDate
:
endDate
options
:
HKQueryOptionStrictStartDate
];
HKSampleType
*
samplesType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierStepCount
];
if
([
type
isEqual
:
@"Walking"
])
{
samplesType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierStepCount
];
}
else
if
([
type
isEqual
:
@"StairClimbing"
])
{
samplesType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierFlightsClimbed
];
}
else
if
([
type
isEqual
:
@"Running"
]){
samplesType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierDistanceWalkingRunning
];
HKSampleType
*
samplesType
=
[
RCTAppleHealthKit
hkQuantityTypeFromString
:
type
];
if
([
type
isEqual
:
@"Running"
]
||
[
type
isEqual
:
@"Cycling"
])
{
unit
=
[
HKUnit
mileUnit
];
}
else
if
([
type
isEqual
:
@"Cycling"
]){
samplesType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierDistanceCycling
];
unit
=
[
HKUnit
mileUnit
];
}
else
if
([
type
isEqual
:
@"Workout"
]){
samplesType
=
[
HKObjectType
workoutType
];
}
NSLog
(
@"error getting samples: %@"
,
[
samplesType
identifier
]);
[
self
fetchSamplesOfType
:
samplesType
unit:
unit
predicate:
predicate
...
...
@@ -84,8 +75,8 @@
callback
(@[[
NSNull
null
],
results
]);
return
;
}
else
{
NSLog
(
@"error getting
active energy burned
samples: %@"
,
error
);
callback
(@[
RCTMakeError
(
@"error getting
active energy burned
samples"
,
nil
,
nil
)]);
NSLog
(
@"error getting samples: %@"
,
error
);
callback
(@[
RCTMakeError
(
@"error getting samples"
,
nil
,
nil
)]);
return
;
}
}];
...
...
@@ -96,19 +87,9 @@
HKUnit
*
unit
=
[
RCTAppleHealthKit
hkUnitFromOptions
:
input
key
:
@"unit"
withDefault
:
[
HKUnit
countUnit
]];
NSString
*
type
=
[
RCTAppleHealthKit
stringFromOptions
:
input
key
:
@"type"
withDefault
:
@"Walking"
];
HKSampleType
*
samplesType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierStepCount
];
if
([
type
isEqual
:
@"Walking"
])
{
samplesType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierStepCount
];
}
else
if
([
type
isEqual
:
@"StairClimbing"
])
{
samplesType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierFlightsClimbed
];
}
else
if
([
type
isEqual
:
@"Running"
]){
samplesType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierDistanceWalkingRunning
];
unit
=
[
HKUnit
mileUnit
];
}
else
if
([
type
isEqual
:
@"Cycling"
]){
samplesType
=
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierDistanceCycling
];
HKSampleType
*
samplesType
=
[
RCTAppleHealthKit
hkQuantityTypeFromString
:
type
];
if
([
type
isEqual
:
@"Running"
]
||
[
type
isEqual
:
@"Cycling"
])
{
unit
=
[
HKUnit
mileUnit
];
}
else
if
([
type
isEqual
:
@"Workout"
]){
samplesType
=
[
HKObjectType
workoutType
];
}
[
self
setObserverForType
:
samplesType
unit
:
unit
];
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Sleep.h
View file @
0b536cff
...
...
@@ -3,7 +3,8 @@
// RCTAppleHealthKit
//
// Created by Greg Wilson on 2016-11-06.
// Copyright © 2016 Greg Wilson. All rights reserved.
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
//
#import "RCTAppleHealthKit.h"
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Methods_Sleep.m
View file @
0b536cff
...
...
@@ -3,7 +3,8 @@
// RCTAppleHealthKit
//
// Created by Greg Wilson on 2016-11-06.
// Copyright © 2016 Greg Wilson. All rights reserved.
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
//
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Queries.h
View file @
0b536cff
...
...
@@ -3,7 +3,8 @@
// RCTAppleHealthKit
//
// Created by Greg Wilson on 2016-06-26.
// Copyright © 2016 Greg Wilson. All rights reserved.
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
//
#import "RCTAppleHealthKit.h"
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Queries.m
View file @
0b536cff
...
...
@@ -3,7 +3,8 @@
// RCTAppleHealthKit
//
// Created by Greg Wilson on 2016-06-26.
// Copyright © 2016 Greg Wilson. All rights reserved.
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
//
#import "RCTAppleHealthKit+Queries.h"
...
...
@@ -106,8 +107,6 @@
[
self
.
healthStore
executeQuery
:
query
];
}
-
(
void
)
fetchSamplesOfType
:(
HKSampleType
*
)
type
unit
:(
HKUnit
*
)
unit
predicate
:(
NSPredicate
*
)
predicate
...
...
@@ -146,13 +145,23 @@
isTracked
=
false
;
}
NSString
*
device
=
@""
;
if
(
@available
(
iOS
11
.
0
,
*
))
{
device
=
[[
sample
sourceRevision
]
productType
];
}
else
{
device
=
[[
sample
device
]
name
];
if
(
!
device
)
{
device
=
@"iPhone"
;
}
}
NSDictionary
*
elem
=
@{
@"activityName"
:
[
NSNumber
numberWithInt
:[
sample
workoutActivityType
]],
@"calories"
:
@
(
energy
),
@"tracked"
:
@
(
isTracked
),
@"sourceName"
:
[[[
sample
sourceRevision
]
source
]
name
],
@"sourceId"
:
[[[
sample
sourceRevision
]
source
]
bundleIdentifier
],
@"device"
:
[[
sample
sourceRevision
]
productType
]
,
@"device"
:
device
,
@"distance"
:
@
(
distance
),
@"start"
:
startDateString
,
@"end"
:
endDateString
...
...
@@ -244,7 +253,6 @@
limit
:(
NSUInteger
)
lim
completion
:(
void
(
^
)(
NSArray
*
,
NSError
*
))
completion
{
NSSortDescriptor
*
timeSortDescriptor
=
[[
NSSortDescriptor
alloc
]
initWithKey
:
HKSampleSortIdentifierEndDate
ascending:
false
];
...
...
RCTAppleHealthKit/RCTAppleHealthKit+TypesAndPermissions.h
View file @
0b536cff
...
...
@@ -3,7 +3,8 @@
// RCTAppleHealthKit
//
// Created by Greg Wilson on 2016-06-26.
// Copyright © 2016 Greg Wilson. All rights reserved.
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
//
#import "RCTAppleHealthKit.h"
...
...
RCTAppleHealthKit/RCTAppleHealthKit+TypesAndPermissions.m
View file @
0b536cff
...
...
@@ -3,7 +3,8 @@
// RCTAppleHealthKit
//
// Created by Greg Wilson on 2016-06-26.
// Copyright © 2016 Greg Wilson. All rights reserved.
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
//
#import "RCTAppleHealthKit+TypesAndPermissions.h"
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Utils.h
View file @
0b536cff
...
...
@@ -3,7 +3,8 @@
// RCTAppleHealthKit
//
// Created by Greg Wilson on 2016-06-26.
// Copyright © 2016 Greg Wilson. All rights reserved.
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
//
#import "RCTAppleHealthKit.h"
...
...
@@ -22,6 +23,7 @@
+
(
NSDate
*
)
startDateFromOptions
:(
NSDictionary
*
)
options
;
+
(
NSDate
*
)
endDateFromOptions
:(
NSDictionary
*
)
options
;
+
(
NSDate
*
)
endDateFromOptionsDefaultNow
:(
NSDictionary
*
)
options
;
+
(
HKSampleType
*
)
hkQuantityTypeFromString
:(
NSString
*
)
type
;
+
(
HKUnit
*
)
hkUnitFromOptions
:(
NSDictionary
*
)
options
key
:(
NSString
*
)
key
withDefault
:(
HKUnit
*
)
defaultValue
;
+
(
NSUInteger
)
uintFromOptions
:(
NSDictionary
*
)
options
key
:(
NSString
*
)
key
withDefault
:(
NSUInteger
)
defaultValue
;
...
...
RCTAppleHealthKit/RCTAppleHealthKit+Utils.m
View file @
0b536cff
...
...
@@ -3,7 +3,8 @@
// RCTAppleHealthKit
//
// Created by Greg Wilson on 2016-06-26.
// Copyright © 2016 Greg Wilson. All rights reserved.
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
//
#import "RCTAppleHealthKit+Utils.h"
...
...
@@ -123,6 +124,20 @@
return
date
;
}
+
(
HKSampleType
*
)
hkQuantityTypeFromString
:(
NSString
*
)
type
{
if
([
type
isEqual
:
@"Walking"
])
{
return
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierStepCount
];
}
else
if
([
type
isEqual
:
@"StairClimbing"
])
{
return
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierFlightsClimbed
];
}
else
if
([
type
isEqual
:
@"Running"
]){
return
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierDistanceWalkingRunning
];
}
else
if
([
type
isEqual
:
@"Cycling"
]){
return
[
HKObjectType
quantityTypeForIdentifier
:
HKQuantityTypeIdentifierDistanceCycling
];
}
// default [type isEqual:@"Workout"])
return
[
HKObjectType
workoutType
];
}
+
(
HKUnit
*
)
hkUnitFromOptions
:(
NSDictionary
*
)
options
key
:(
NSString
*
)
key
withDefault
:(
HKUnit
*
)
defaultValue
{
NSString
*
unitString
=
[
options
objectForKey
:
key
];
...
...
RCTAppleHealthKit/RCTAppleHealthKit.h
View file @
0b536cff
...
...
@@ -3,7 +3,8 @@
// RCTAppleHealthKit
//
// Created by Greg Wilson on 2016-06-26.
// Copyright © 2016 Greg Wilson. All rights reserved.
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
//
#import <Foundation/Foundation.h>
...
...
RCTAppleHealthKit/RCTAppleHealthKit.m
View file @
0b536cff
...
...
@@ -3,7 +3,8 @@
// RCTAppleHealthKit
//
// Created by Greg Wilson on 2016-06-26.
// Copyright © 2016 Greg Wilson. All rights reserved.
// This source code is licensed under the MIT-style license found in the
// LICENSE file in the root directory of this source tree.
//
#import "RCTAppleHealthKit.h"
...
...
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