Skip to content

Commit 16cd71b

Browse files
committed
finish iOS plugin
1 parent 85fa58f commit 16cd71b

File tree

8 files changed

+61
-13
lines changed

8 files changed

+61
-13
lines changed

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# jverification-react-native
2+
3+
极光官方开发的[极光验证](https://docs.jiguang.cn/jverification/guideline/intro/) react-native 插件,为开发者提供了快速验证用户输入的手机号码和本机 SIM 卡号码一致性的功能,提高用户体验和安全性。暂时只支持 iOS平台。
4+
5+
## 安装
6+
7+
```
8+
npm install jverification-react-native --save
9+
npm install jcore-react-native --save
10+
react-native link
11+
```
12+
## 配置
13+
14+
#### iOS
15+
16+
- 打开工程,进入 Build Settings -> Framework search paths 添加 framework 搜索路径
17+
18+
```
19+
$(SRCROOT)/../node_modules/jverification-react-native/ios/RCTJVerificationModule
20+
```
21+
22+
- 打开工程,进入 Build Settings -> Other Link Flag 添加一行编译选项
23+
24+
```
25+
-framework "EAccountSDK"
26+
-framework "TYRZNoUISDK"
27+
-framework "account_verify_sdk_core"
28+
```
29+
30+
## API
31+
32+
#### Usage:
33+
34+
```javascript
35+
import JVerification from 'jverification-react-native'
36+
37+
JVerification.init({
38+
appKey: '替换成激光管网注册的 appKey',
39+
channel: 'the optional channel'
40+
});
41+
```
42+
43+
44+
> 注意: 需要先调用 JVerification.init 方法其他功能才能正常使用。
45+
46+
47+
48+
接口说明参考: [index.js](./index.js)
49+
50+
用法参考: [demo](./example/App.js)
51+

example/App.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,22 @@ var styles = StyleSheet.create({
3838
class Button extends React.Component {
3939
render() {
4040
return <TouchableHighlight
41-
style={styles.setBtnStyle}
4241
onPress={this.props.onPress}
4342
underlayColor='#e4083f'
4443
activeOpacity={0.5}
4544
>
46-
<Text style={styles.textStyle}>{this.props.title}</Text>
45+
<View
46+
style={styles.setBtnStyle}
47+
>
48+
<Text style={styles.textStyle}>{this.props.title}</Text>
49+
</View>
4750
</TouchableHighlight>
4851
}
4952
}
5053

5154
// type Props = {};
5255

53-
export default class App extends Component {
56+
export default class App extends React.Component {
5457
render() {
5558
return (
5659
<View style={styles.container}>

example/ios/example.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
CF82A662DE7F43D9A0F84BF2 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AC31C14A1CB04A29A7B6A394 /* UIKit.framework */; };
5353
D346DF4C6C2A47E0AB7FF338 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 137AC1746E2541D385F5D49B /* libz.tbd */; };
5454
E62272DED9CC4557BC100094 /* libresolv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 70FEF277EA1243DAA6B99D2D /* libresolv.tbd */; };
55-
EEFF2D7E2B484AAAA1EBC58E /* UserNotifications.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F19EFD12E634069BA3AC0CE /* UserNotifications.framework */; };
55+
EEFF2D7E2B484AAAA1EBC58E /* UserNotifications.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9F19EFD12E634069BA3AC0CE /* UserNotifications.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
5656
F19C1B2462E7418F9D407C79 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6C92BDCBA1CA4798B9341B60 /* Foundation.framework */; };
5757
FC12C47A75504E22B712091D /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 41CDA630DA3E479CA9DEED90 /* Security.framework */; };
5858
/* End PBXBuildFile section */

example/package-lock.json

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
},
99
"dependencies": {
1010
"jcore-react-native": "^1.2.11",
11-
"jverification-react-native": "file:..",
1211
"react": "16.6.0-alpha.8af6728",
1312
"react-native": "^0.57.4"
1413
},

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default class JVerification {
2525
* 获取手机号校验token
2626
* @param {Function} callback = (result) => {
2727
* result = {
28-
* code: string,
28+
* code: int,
2929
* content: string
3030
* }
3131
* }
@@ -42,7 +42,7 @@ export default class JVerification {
4242
* }
4343
* @param {Function} callback = (result) => {
4444
* result = {
45-
* code: string,
45+
* code: int,
4646
* content: string
4747
* }
4848
* }

ios/RCTJVerificationModule/RCTJVerificationModule.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ - (id)init {
6969
}
7070

7171

72-
RCT_EXPORT_METHOD(getToken: (NSDictionary *)params
73-
callback: (RCTResponseSenderBlock)callback) {
72+
RCT_EXPORT_METHOD(getToken: (RCTResponseSenderBlock)callback) {
7473

7574
[JVERIFICATIONService getToken:^(NSDictionary *result) {
7675
callback(@[result]);

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"ios": {
2525
"sharedLibraries": [
2626
"libz",
27-
"UserNotifications",
2827
"CoreTelephony",
2928
"Security",
3029
"CFNetwork",

0 commit comments

Comments
 (0)