Skip to content

Commit

Permalink
Merge pull request #3 from weiruiyang/master
Browse files Browse the repository at this point in the history
demo用例setCustomUIWithConfig参数调整和setCustomUIWithConfig参数解析调整
  • Loading branch information
jiguang-official committed Jul 22, 2019
2 parents e715471 + d85e71c commit 015ac58
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 41 deletions.
88 changes: 52 additions & 36 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand All @@ -18,45 +18,61 @@
under the License.
-->
<html>
<head>
<title>Hello World</title>
<script type="text/javascript">
function onDeviceReady() {
JGJVerificationPlugin.setDebugMode(true);
JGJVerificationPlugin.init();
}
<head>
<title>Hello World</title>

<script type="text/javascript">
function onDeviceReady() {
JGJVerificationPlugin.setDebugMode(true);
JGJVerificationPlugin.init();
}
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);

}

function setCustomUIWithConfig() {
var json = "";

if("Android"==device.model){

function setCustomUIWithConfig() {

if("Android"==device.platform){
var c = 0xff000000;
json = "{\"setNavColor\":"+c+"}";
}else if("Ios"==device.model){
// var json = "{\"setNavColor\":"+c+"}";
var json = {
setNavColor:0xff000000,
setLogBtnText:"Demo loginAuth",
setAppPrivacyColor:[0xff00f000,0xff000000]
}

json = JSON.stringify(json);
// alert(json);
JGJVerificationPlugin.setCustomUIWithConfig(json);
}else if("iOS"==device.platform){
var c = 0xff000000;
json = "{\"navColor\":"+c+"}";
// var json = "{\"navColor\":"+c+"}";
var json={
navColor:0xff000000,
logBtnText:"Demo loginAuth",
appPrivacyColor:[0xff00f000,0xff000000]
}

json = JSON.stringify(json);
// alert(json);
JGJVerificationPlugin.setCustomUIWithConfig(json);
}
JGJVerificationPlugin.setCustomUIWithConfig(json);
}
</script>
</head>
<body onload="onLoad()">
<div class="app">
<h1>Apache Cordova</h1>
</div>
<button onclick="JGJVerificationPlugin.loginAuth(true,function(msg){alert(msg);})">loginAuth</button>
<button onclick="JGJVerificationPlugin.isInitSuccess(function(msg){alert(msg);})">isInitSuccess</button>
<button onclick="JGJVerificationPlugin.checkVerifyEnable(function(msg){alert(msg);})">checkVerifyEnable</button>
<button onclick="JGJVerificationPlugin.getToken(3000,function(msg){alert(msg);})">getToken</button>
<button onclick="JGJVerificationPlugin.verifyNumber('dddddddd','12222222',function(msg){alert(msg);})">verifyNumbe</button>
<button onclick="JGJVerificationPlugin.preLogin(3000,function(msg){alert(msg);})">preLogin</button>
<button onclick="JGJVerificationPlugin.dismissLoginAuth()">dismissLoginAuth</button>
<button onclick="javascript:setCustomUIWithConfig()">setCustomUIWithConfig</button>
<script type="text/javascript" src="cordova.js"></script>
</body>
</script>
</head>
<body onload="onLoad()">
<div class="app">
<h1>Apache Cordova</h1>
</div>
<button onclick="JGJVerificationPlugin.loginAuth(true,function(msg){alert(msg);})">loginAuth</button>
<button onclick="JGJVerificationPlugin.isInitSuccess(function(msg){alert(msg);})">isInitSuccess</button>
<button onclick="JGJVerificationPlugin.checkVerifyEnable(function(msg){alert(msg);})">checkVerifyEnable</button>
<button onclick="JGJVerificationPlugin.getToken(3000,function(msg){alert(msg);})">getToken</button>
<button onclick="JGJVerificationPlugin.verifyNumber('dddddddd','12222222',function(msg){alert(msg);})">verifyNumbe</button>
<button onclick="JGJVerificationPlugin.preLogin(3000,function(msg){alert(msg);})">preLogin</button>
<button onclick="JGJVerificationPlugin.dismissLoginAuth()">dismissLoginAuth</button>
<button onclick="javascript:setCustomUIWithConfig()">setCustomUIWithConfig</button>
<script type="text/javascript" src="cordova.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jg-jverification-cordova-plugin",
"version": "1.1.1",
"version": "1.1.2",
"description": "JVerification-cordova-plugin",
"cordova": {
"id": "jg-jverification-cordova-plugin",
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<plugin xmlns:android="http://schemas.android.com/apk/res/android"
id="jg-jverification-cordova-plugin" version="1.1.1"
id="jg-jverification-cordova-plugin" version="1.1.2"
xmlns="http://apache.org/cordova/ns/plugins/1.0">
<name>JVerification-cordova-plugin</name>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ void dismissLoginAuth(JSONArray data, CallbackContext callbackContext) {
private static final String setSloganOffsetY = "setSloganOffsetY";

void setCustomUIWithConfig(JSONArray data, CallbackContext callbackContext) throws JSONException {

JSONObject jsonObject = data.getJSONObject(0);
JSONObject jsonObject = new JSONObject(data.getString(0));
Iterator<String> keys = jsonObject.keys();

JVerifyUIConfig.Builder uiConfigBuilder = new JVerifyUIConfig.Builder();
Expand Down Expand Up @@ -274,4 +273,4 @@ void setUiConfig(JVerifyUIConfig.Builder uiConfigBuilder, JSONObject jsonObject,
break;// "setSloganOffsetY";
}
}
}
}

0 comments on commit 015ac58

Please sign in to comment.