Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
R
react-native-device-info
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
放牛的园子
react-native-device-info
Commits
22b4e52b
Commit
22b4e52b
authored
Mar 07, 2017
by
Kacyn Fujii
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add check if security is enabled
parent
c843144e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
0 deletions
+16
-0
RNDeviceInfo.m
RNDeviceInfo/RNDeviceInfo.m
+7
-0
RNDeviceModule.java
...c/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java
+6
-0
deviceinfo.js
deviceinfo.js
+3
-0
No files found.
RNDeviceInfo/RNDeviceInfo.m
View file @
22b4e52b
...
@@ -162,6 +162,12 @@ RCT_EXPORT_MODULE()
...
@@ -162,6 +162,12 @@ RCT_EXPORT_MODULE()
return
[[
UIDevice
currentDevice
]
userInterfaceIdiom
]
==
UIUserInterfaceIdiomPad
;
return
[[
UIDevice
currentDevice
]
userInterfaceIdiom
]
==
UIUserInterfaceIdiomPad
;
}
}
-
(
bool
)
isSecurityEnabled
{
LAContext
*
context
=
[[
LAContext
alloc
]
init
];
return
([
context
canEvaluatePolicy
:
LAPolicyDeviceOwnerAuthenticationWithBiometrics
error
:
nil
]);
}
-
(
NSDictionary
*
)
constantsToExport
-
(
NSDictionary
*
)
constantsToExport
{
{
UIDevice
*
currentDevice
=
[
UIDevice
currentDevice
];
UIDevice
*
currentDevice
=
[
UIDevice
currentDevice
];
...
@@ -186,6 +192,7 @@ RCT_EXPORT_MODULE()
...
@@ -186,6 +192,7 @@ RCT_EXPORT_MODULE()
@"timezone"
:
self
.
timezone
,
@"timezone"
:
self
.
timezone
,
@"isEmulator"
:
@
(
self
.
isEmulator
),
@"isEmulator"
:
@
(
self
.
isEmulator
),
@"isTablet"
:
@
(
self
.
isTablet
),
@"isTablet"
:
@
(
self
.
isTablet
),
@"isSecurityEnabled"
:
@
(
self
.
isSecurityEnabled
),
};
};
}
}
...
...
android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java
View file @
22b4e52b
...
@@ -69,6 +69,11 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
...
@@ -69,6 +69,11 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
return
layout
==
Configuration
.
SCREENLAYOUT_SIZE_LARGE
||
layout
==
Configuration
.
SCREENLAYOUT_SIZE_XLARGE
;
return
layout
==
Configuration
.
SCREENLAYOUT_SIZE_LARGE
||
layout
==
Configuration
.
SCREENLAYOUT_SIZE_XLARGE
;
}
}
private
Boolean
isSecurityEnabled
()
{
KeyguardManager
keyguardManager
=
(
KeyguardManager
)
this
.
reactContext
.
getSystemService
(
Context
.
KEYGUARD_SERVICE
);
//api 16+
return
keyguardManager
.
isKeyguardSecure
();
}
@Override
@Override
public
@Nullable
Map
<
String
,
Object
>
getConstants
()
{
public
@Nullable
Map
<
String
,
Object
>
getConstants
()
{
HashMap
<
String
,
Object
>
constants
=
new
HashMap
<
String
,
Object
>();
HashMap
<
String
,
Object
>
constants
=
new
HashMap
<
String
,
Object
>();
...
@@ -113,6 +118,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
...
@@ -113,6 +118,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
constants
.
put
(
"timezone"
,
TimeZone
.
getDefault
().
getID
());
constants
.
put
(
"timezone"
,
TimeZone
.
getDefault
().
getID
());
constants
.
put
(
"isEmulator"
,
this
.
isEmulator
());
constants
.
put
(
"isEmulator"
,
this
.
isEmulator
());
constants
.
put
(
"isTablet"
,
this
.
isTablet
());
constants
.
put
(
"isTablet"
,
this
.
isTablet
());
constants
.
put
(
"isSecurityEnabled"
,
this
.
isSecurityEnabled
());
return
constants
;
return
constants
;
}
}
}
}
deviceinfo.js
View file @
22b4e52b
...
@@ -62,4 +62,7 @@ module.exports = {
...
@@ -62,4 +62,7 @@ module.exports = {
isTablet
:
function
()
{
isTablet
:
function
()
{
return
RNDeviceInfo
.
isTablet
;
return
RNDeviceInfo
.
isTablet
;
},
},
isSecurityEnabled
:
function
()
{
return
RNDeviceInfo
.
isSecurityEnabled
;
},
};
};
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