Commit 0b7dba64 by sikang

Merge branch 'master' of ssh://47.100.14.92:2289/sikang/lib_base

nothing
.
parents 9c8895be 62ff57ed
...@@ -80,7 +80,7 @@ dependencies { ...@@ -80,7 +80,7 @@ dependencies {
//SmartRefresh //SmartRefresh
api 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-14' api 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-14'
// api 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-alpha-14'//没有使用特殊Header,可以不加这行 api 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-alpha-14'//没有使用特殊Header,可以不加这行
//Gson //Gson
api 'com.google.code.gson:gson:2.8.2' api 'com.google.code.gson:gson:2.8.2'
......
rm -rf ../resGuardApks rm -rf ../resGuardApks
cd .. cd ..
gradlew clean
gradlew resguardAppProductGoogleplayRelease gradlew resguardAppProductGoogleplayRelease
#cd script #cd script
#./rename_project.sh #./rename_project.sh
......
apply plugin: 'AndResGuard'
andResGuard {
// mappingFile = file("./resource_mapping.txt")
mappingFile = null
//不使用7zip
use7zip = false
//使用签名
useSign = true
// keep住所有资源的原始路径,只混淆资源的名字,不混淆路径
keepRoot = true
whiteList = [
// your icon
"R.drawable.icon",
// for fabric
"R.string.com.crashlytics.*",
//FireBase
"R.string.project_id",
// for google-services
"R.string.google_app_id",
"R.string.gcm_defaultSenderId",
"R.string.default_web_client_id",
"R.string.ga_trackingId",
"R.string.firebase_database_url",
"R.string.google_api_key",
"R.string.google_crash_reporting_api_key"
]
compressFilePattern = [
"*.png",
"*.jpg",
"*.jpeg",
"*.gif",
]
//因为不使用sevenzip 所以该处注释
// sevenzip {
// artifact = 'com.tencent.mm:SevenZip:1.2.13'
// //path = "/usr/local/bin/7za"
// }
/**
* Optional: if finalApkBackupPath is null, AndResGuard will overwrite final apk
* to the path which assemble[Task] write to
**/
// finalApkBackupPath = "${project.rootDir}/final.apk"
android.applicationVariants.all { variant ->
variant.outputs.all {
finalApkBackupPath = "${project.rootDir}/resGuardApks/${project.rootProject.name}_${variant.buildType.name}.apk"
}
}
/**
* Optional: Specifies the name of the message digest algorithm to user when digesting the entries of JAR file
* Only works in V1signing, default value is "SHA-1"
**/
// digestalg = "SHA-256"
}
\ No newline at end of file
cd ../app/src/app/ cd ..
git add . git add .
echo -n "commit message: " echo -n "commit message: "
read message read message
......
#!/usr/bin/env python3
import sys, os
import re
import time
class IllegalArgumentException(Exception):
def __init__(self, lineno, msg):
self.lineno = lineno
self.msg = msg
def __str__(self):
s = 'Exception at line number %d => %s' % (self.lineno, self.msg)
return s
class Properties(object):
""" A Python replacement for java.util.Properties """
def __init__(self, props=None):
# Note: We don't take a default properties object
# as argument yet
# Dictionary of properties.
self._props = {}
# Dictionary of properties with 'pristine' keys
# This is used for dumping the properties to a file
# using the 'store' method
self._origprops = {}
# Dictionary mapping keys from property
# dictionary to pristine dictionary
self._keymap = {}
self.othercharre = re.compile(r'(?<!\\)(\s*\=)|(?<!\\)(\s*\:)')
self.othercharre2 = re.compile(r'(\s*\=)|(\s*\:)')
self.bspacere = re.compile(r'\\(?!\s$)')
def __str__(self):
s = '{'
for key, value in self._props.items():
s = ''.join((s, key, '=', value, ', '))
s = ''.join((s[:-2], '}'))
return s
def __parse(self, lines):
""" Parse a list of lines and create
an internal property dictionary """
# Every line in the file must consist of either a comment
# or a key-value pair. A key-value pair is a line consisting
# of a key which is a combination of non-white space characters
# The separator character between key-value pairs is a '=',
# ':' or a whitespace character not including the newline.
# If the '=' or ':' characters are found, in the line, even
# keys containing whitespace chars are allowed.
# A line with only a key according to the rules above is also
# fine. In such case, the value is considered as the empty string.
# In order to include characters '=' or ':' in a key or value,
# they have to be properly escaped using the backslash character.
# Some examples of valid key-value pairs:
#
# key value
# key=value
# key:value
# key value1,value2,value3
# key value1,value2,value3 \
# value4, value5
# key
# This key= this value
# key = value1 value2 value3
# Any line that starts with a '#' is considerered a comment
# and skipped. Also any trailing or preceding whitespaces
# are removed from the key/value.
# This is a line parser. It parses the
# contents like by line.
lineno = 0
i = iter(lines)
for line in i:
lineno += 1
line = line.strip()
# Skip null lines
if not line: continue
# Skip lines which are comments
if line[0] == '#': continue
# Some flags
escaped = False
# Position of first separation char
sepidx = -1
# A flag for performing wspace re check
flag = 0
# Check for valid space separation
# First obtain the max index to which we
# can search.
m = self.othercharre.search(line)
if m:
first, last = m.span()
start, end = 0, first
flag = 1
wspacere = re.compile(r'(?<![\\\=\:])(\s)')
else:
if self.othercharre2.search(line):
# Check if either '=' or ':' is present
# in the line. If they are then it means
# they are preceded by a backslash.
# This means, we need to modify the
# wspacere a bit, not to look for
# : or = characters.
wspacere = re.compile(r'(?<![\\])(\s)')
start, end = 0, len(line)
m2 = wspacere.search(line, start, end)
if m2:
# print 'Space match=>',line
# Means we need to split by space.
first, last = m2.span()
sepidx = first
elif m:
# print 'Other match=>',line
# No matching wspace char found, need
# to split by either '=' or ':'
first, last = m.span()
sepidx = last - 1
# print line[sepidx]
# If the last character is a backslash
# it has to be preceded by a space in which
# case the next line is read as part of the
# same property
while line[-1] == '\\':
# Read next line
nextline = i.next()
nextline = nextline.strip()
lineno += 1
# This line will become part of the value
line = line[:-1] + nextline
# Now split to key,value according to separation char
if sepidx != -1:
key, value = line[:sepidx], line[sepidx + 1:]
else:
key, value = line, ''
self.processPair(key, value)
def processPair(self, key, value):
""" Process a (key, value) pair """
oldkey = key
oldvalue = value
# Create key intelligently
keyparts = self.bspacere.split(key)
# print keyparts
strippable = False
lastpart = keyparts[-1]
if lastpart.find('\\ ') != -1:
keyparts[-1] = lastpart.replace('\\', '')
# If no backspace is found at the end, but empty
# space is found, strip it
elif lastpart and lastpart[-1] == ' ':
strippable = True
key = ''.join(keyparts)
if strippable:
key = key.strip()
oldkey = oldkey.strip()
oldvalue = self.unescape(oldvalue)
value = self.unescape(value)
self._props[key] = value.strip()
# Check if an entry exists in pristine keys
if key in self._keymap:
oldkey = self._keymap.get(key)
self._origprops[oldkey] = oldvalue.strip()
else:
self._origprops[oldkey] = oldvalue.strip()
# Store entry in keymap
self._keymap[key] = oldkey
def escape(self, value):
# Java escapes the '=' and ':' in the value
# string with backslashes in the store method.
# So let us do the same.
newvalue = value.replace(':', '\:')
newvalue = newvalue.replace('=', '\=')
return newvalue
def unescape(self, value):
# Reverse of escape
newvalue = value.replace('\:', ':')
newvalue = newvalue.replace('\=', '=')
return newvalue
def load(self, stream):
""" Load properties from an open file stream """
try:
lines = stream.readlines()
self.__parse(lines)
except ValueError:
raise
def getProperty(self, key):
""" Return a property for the given key """
return self._props.get(key, '')
def setProperty(self, key, value):
""" Set the property for the given key """
if type(key) is str and type(value) is str:
self.processPair(key, value)
def propertyNames(self):
""" Return an iterator over all the keys of the property
dictionary, i.e the names of the properties """
return self._props.keys()
def list(self, out=sys.stdout):
""" Prints a listing of the properties to the
stream 'out' which defaults to the standard output """
out.write('-- listing properties --\n')
for key, value in self._props.items():
out.write(''.join((key, '=', value, '\n')))
def store(self, out, header=""):
""" Write the properties list to the stream 'out' along
with the optional 'header' """
try:
out.write(''.join(('#', header, '\n')))
# Write timestamp
tstamp = time.strftime('%a %b %d %H:%M:%S %Z %Y', time.localtime())
out.write(''.join(('#', tstamp, '\n')))
# Write properties from the pristine dictionary
for prop, val in self._origprops.items():
out.write(''.join((prop, '=', self.escape(val), '\n')))
out.close()
except ValueError:
raise
def getPropertyDict(self):
return self._props
def __getitem__(self, name):
""" To support direct dictionary like access """
return self.getProperty(name)
def __setitem__(self, name, value):
""" To support direct dictionary like access """
self.setProperty(name, value)
def __getattr__(self, name):
""" For attributes not found in self, redirect
to the properties dictionary """
try:
return self.__dict__[name]
except KeyError:
if hasattr(self._props, name):
return getattr(self._props, name)
class Reader:
def __init__(self, file_name):
self.file_name = file_name
self.properties = {}
try:
fopen = open(self.file_name, 'r')
for line in fopen:
line = line.strip()
if line.find('=') > 0 and not line.startswith('#'):
strs = line.split('=')
self.properties[strs[0].strip()] = strs[1].strip()
except ValueError:
raise e
else:
fopen.close()
def has_key(self, key):
return key in self.properties
def get(self, key, default_value=''):
if key in self.properties:
return self.properties[key]
return default_value
def put(self, key, value):
self.properties[key] = value
replace_property(self.file_name, key + '=.*', key + '=' + value, True)
reader = Reader('../../gradle.properties')
print (
'enter the new keystore name (last version : ' + reader.get('signing_keyAlias') + ') ', " ")
# 输入签名版本
keyName = os.popen('sh keystore_version.sh').read().replace('\n','')
# 输入 v* 直接更改版本号,否则改文件名
if keyName.startswith('v'):
keyName = reader.get('signing_keyAlias').split('_')[0] + '_' + keyName
print ('ready to create new kestore '+keyName)
# 修改gradle.properties
properties = Properties()
properties['org.gradle.jvmargs'] = '-Xmx1536m'
properties['signing_keyAlias'] = keyName
properties['signing_certificate'] = '../jks/' + keyName + '.keystore'
properties['signging_certificatePassword'] = keyName
properties['signging_storePassword'] = keyName
properties.store(open('../../gradle.properties', 'w'))
# 生成签名
os.system('keytool -genkey -alias ' + keyName + ' -keyalg RSA -validity 20000 -keystore ../../jks/'+keyName+'.keystore')
read message
echo "${message}"
\ No newline at end of file
cd ../../
basepath=$(cd `dirname $0`; pwd)
project_name=${basepath##*/}
echo -n "请输入渠道名(多个渠道逗号隔开,使用默认渠道文件按回车):"
read channels
cd lib_base/script/
if [[ -z ${channels} ]]
then
java -jar walle-cli-all.jar batch -f ../../script/channels ../../resGuardApks/"${project_name}"_release.apk
else
java -jar walle-cli-all.jar batch -c "${channels}" ../../resGuardApks/"${project_name}"_release.apk
fi
\ No newline at end of file
cd ../../
rm -rf resGuardApks
gradlew clean
gradlew resguardAppProductGoogleplayRelease
#cd ../base/src/base/script
#./rename_project.sh
#cd ../../../../
#gradlew resguardAppProductGoogleplayRelease
#cd ../base/src/base/script
#./reset_name.sh
\ No newline at end of file
echo "脚本使用帮助"
echo "1、编译release版本"
echo "2、创建新的签名文件"
echo "3、commit 和 push Base代码"
echo "4、commit 和 push UI代码 (需手动修改分支)"
echo "5、pull Base代码 "
echo "6、pull UI代码 "
echo "7、为 resGuardApks 目录下的 *_release.apk 打渠道包"
echo -n "请输入指令编号:"
read commod
if (($commod == '1'))
then
./release_builder.sh
elif (($commod == '2'))
then
./create_keystore.py
elif (($commod == '3'))
then
./base_push.sh
elif (($commod == '4'))
then
cd ../../script
./module_push.sh
elif (($commod == '5'))
then
cd ..
git pull
elif (($commod == '6'))
then
cd ../../
git pull
elif (($commod == '7'))
then
./make_channel.sh
else
echo "找不到编号"
fi
package com.common.bean;
import java.io.Serializable;
/**
* Created by SiKang on 2019/3/21.
*/
public class ContactBean implements Serializable {
private String id;//:0,
private String mobile;//:string,
private String name;//:string,
private String relation;//:PARENT
public ContactBean(String mobile, String name, String relation) {
this.mobile = mobile;
this.name = name;
this.relation = relation;
}
public ContactBean() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getRelation() {
return relation;
}
public void setRelation(String relation) {
this.relation = relation;
}
}
package com.common.bean;
import java.io.Serializable;
import java.util.List;
/**
* Created by SiKang on 2019/3/21.
*/
public class PhotoListBean implements Serializable {
private List<Photo> files;// [
public class Photo {
private String fileType;// "KTP_PHOTO",
private int index;// 0,
private String url;// "string"
public String getFileType() {
return fileType;
}
public void setFileType(String fileType) {
this.fileType = fileType;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
public List<Photo> getFiles() {
return files;
}
public void setFiles(List<Photo> files) {
this.files = files;
}
}
...@@ -7,6 +7,7 @@ import android.text.TextUtils; ...@@ -7,6 +7,7 @@ import android.text.TextUtils;
import android.view.View; import android.view.View;
import com.meituan.android.walle.WalleChannelReader; import com.meituan.android.walle.WalleChannelReader;
import com.scwang.smartrefresh.header.MaterialHeader;
import com.scwang.smartrefresh.layout.SmartRefreshLayout; import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.DefaultRefreshFooterCreator; import com.scwang.smartrefresh.layout.api.DefaultRefreshFooterCreator;
import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator; import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator;
...@@ -72,6 +73,7 @@ public class LibConfig { ...@@ -72,6 +73,7 @@ public class LibConfig {
public static String TD_PRODUCT_SERVER = "https://idfp.tongdun.net"; public static String TD_PRODUCT_SERVER = "https://idfp.tongdun.net";
public static String APPSFLYER_DEV_KEY; public static String APPSFLYER_DEV_KEY;
public static String XH_CHANNEL_NAME; public static String XH_CHANNEL_NAME;
public static boolean IS_COLLECT_MODE;
public static String TEST_TOKEN; public static String TEST_TOKEN;
public static String LANGUAGE = "in"; public static String LANGUAGE = "in";
public static int HARVESTER_PORT;// public static int HARVESTER_PORT;//
...@@ -210,7 +212,7 @@ public class LibConfig { ...@@ -210,7 +212,7 @@ public class LibConfig {
@Override @Override
public RefreshHeader createRefreshHeader(Context context, RefreshLayout layout) { public RefreshHeader createRefreshHeader(Context context, RefreshLayout layout) {
layout.setPrimaryColorsId(R.color.qmui_config_color_gray_9, R.color.qmui_config_color_50_pure_black);//全局设置主题颜色 layout.setPrimaryColorsId(R.color.qmui_config_color_gray_9, R.color.qmui_config_color_50_pure_black);//全局设置主题颜色
return new ClassicsHeader(context);//.setTimeFormat(new DynamicTimeFormat("更新于 %s"));//指定为经典Header,默认是 贝塞尔雷达Header return new MaterialHeader(context);//.setTimeFormat(new DynamicTimeFormat("更新于 %s"));//指定为经典Header,默认是 贝塞尔雷达Header
} }
}); });
//设置全局的Footer构建器 //设置全局的Footer构建器
......
...@@ -7,6 +7,7 @@ import android.view.View; ...@@ -7,6 +7,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
...@@ -17,6 +18,7 @@ public abstract class BaseRecyclerAdapter<T> extends RecyclerView.Adapter<Recycl ...@@ -17,6 +18,7 @@ public abstract class BaseRecyclerAdapter<T> extends RecyclerView.Adapter<Recycl
private final Context context; private final Context context;
private OnItemClickListener<T> mClickListener; private OnItemClickListener<T> mClickListener;
private OnItemLongClickListener<T> mLongClickListener; private OnItemLongClickListener<T> mLongClickListener;
private List<Integer> childClickSet;
public BaseRecyclerAdapter(Context ctx, List<T> list) { public BaseRecyclerAdapter(Context ctx, List<T> list) {
mData = (list != null) ? list : new ArrayList<T>(); mData = (list != null) ? list : new ArrayList<T>();
...@@ -37,20 +39,13 @@ public abstract class BaseRecyclerAdapter<T> extends RecyclerView.Adapter<Recycl ...@@ -37,20 +39,13 @@ public abstract class BaseRecyclerAdapter<T> extends RecyclerView.Adapter<Recycl
final RecyclerViewHolder holder = new RecyclerViewHolder(view); final RecyclerViewHolder holder = new RecyclerViewHolder(view);
initViewHolder(holder); initViewHolder(holder);
if (mClickListener != null) { if (mClickListener != null) {
holder.itemView.setOnClickListener(new View.OnClickListener() { holder.itemView.setOnClickListener(v ->
@Override mClickListener.onItemClick(holder.itemView, holder.getLayoutPosition(), mData.get(holder.getLayoutPosition())));
public void onClick(View v) {
mClickListener.onItemClick(holder.itemView, holder.getLayoutPosition(), mData.get(holder.getLayoutPosition()));
}
});
} }
if (mLongClickListener != null) { if (mLongClickListener != null) {
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() { holder.itemView.setOnLongClickListener(v -> {
@Override mLongClickListener.onItemLongClick(holder.itemView, holder.getLayoutPosition(), mData.get(holder.getLayoutPosition()));
public boolean onLongClick(View v) { return true;
mLongClickListener.onItemLongClick(holder.itemView, holder.getLayoutPosition(), mData.get(holder.getLayoutPosition()));
return true;
}
}); });
} }
return holder; return holder;
...@@ -59,6 +54,14 @@ public abstract class BaseRecyclerAdapter<T> extends RecyclerView.Adapter<Recycl ...@@ -59,6 +54,14 @@ public abstract class BaseRecyclerAdapter<T> extends RecyclerView.Adapter<Recycl
@Override @Override
public final void onBindViewHolder(RecyclerViewHolder holder, int position) { public final void onBindViewHolder(RecyclerViewHolder holder, int position) {
bindData(holder, position, mData.get(position)); bindData(holder, position, mData.get(position));
if (mClickListener != null && childClickSet.size() > 0) {
for (int id : childClickSet) {
View child = holder.getView(id);
if (child != null) {
child.setOnClickListener(v -> mClickListener.onItemClick(v, position, mData.get(position)));
}
}
}
} }
...@@ -85,8 +88,11 @@ public abstract class BaseRecyclerAdapter<T> extends RecyclerView.Adapter<Recycl ...@@ -85,8 +88,11 @@ public abstract class BaseRecyclerAdapter<T> extends RecyclerView.Adapter<Recycl
} }
public void setOnItemClickListener(OnItemClickListener<T> listener) { public void setOnItemClickListener(OnItemClickListener<T> listener, Integer... viewIds) {
mClickListener = listener; mClickListener = listener;
childClickSet = new ArrayList<>();
childClickSet.addAll(Arrays.asList(viewIds));
} }
public void setOnItemLongClickListener(OnItemLongClickListener<T> listener) { public void setOnItemLongClickListener(OnItemLongClickListener<T> listener) {
......
...@@ -66,5 +66,6 @@ public class RecyclerViewHolder extends RecyclerView.ViewHolder { ...@@ -66,5 +66,6 @@ public class RecyclerViewHolder extends RecyclerView.ViewHolder {
} }
} }
...@@ -16,6 +16,7 @@ import retrofit2.http.Query; ...@@ -16,6 +16,7 @@ import retrofit2.http.Query;
import com.common.bean.BasicAck; import com.common.bean.BasicAck;
import com.common.bean.OcrResultBean; import com.common.bean.OcrResultBean;
import com.common.bean.PhotoListBean;
import com.common.bean.RecordFilesResponse; import com.common.bean.RecordFilesResponse;
/** /**
...@@ -58,17 +59,17 @@ public interface UploadApi { ...@@ -58,17 +59,17 @@ public interface UploadApi {
/*@PUT("/loanapp/verify/face") face++*/ /*@PUT("/loanapp/verify/face") face++*/
@PUT("/loanapp/verify/yitu") @PUT("/loanapp/verify/yitu")
Observable<BasicAck> faceVerify(@Query("loanType") String loanType, Observable<BasicAck> faceVerify(@Query("loanType") String loanType,
@Query("amount") double amount, @Query("amount") double amount,
@Query("period") int period, @Query("period") int period,
@Query("periodUnit") String periodUnit, @Query("periodUnit") String periodUnit,
@Part MultipartBody.Part imageBest, @Part MultipartBody.Part imageBest,
@Part MultipartBody.Part imageEnv, @Part MultipartBody.Part imageEnv,
@Part MultipartBody.Part delta, @Part MultipartBody.Part delta,
@Query("imei") String imei, @Query("imei") String imei,
@Query("productId") long productId, @Query("productId") long productId,
@Query("thirdpartyDataFlag")Boolean thirdpartyDataFlag, @Query("thirdpartyDataFlag") Boolean thirdpartyDataFlag,
@Query("method") String method, @Query("method") String method,
@Header("X-AUTH-TOKEN") String token); @Header("X-AUTH-TOKEN") String token);
/** /**
...@@ -79,5 +80,12 @@ public interface UploadApi { ...@@ -79,5 +80,12 @@ public interface UploadApi {
Observable<OcrResultBean> identityOcr(@Part MultipartBody.Part part, @Header("X-AUTH-TOKEN") String token); Observable<OcrResultBean> identityOcr(@Part MultipartBody.Part part, @Header("X-AUTH-TOKEN") String token);
/**
* 上传其他证明图片
* @param action ADD:添加、 MODIFY:更新 、DELETE:删除
*/
@Multipart
@PUT("/record/files-extra")
Observable<ResponseBody> uploadOtherPhoto(@Part MultipartBody.Part file, @Query("fileType") String fileType, @Query("fileIndex") int fileIndex, @Query("fileAction") String action);
} }
\ No newline at end of file
...@@ -8,10 +8,12 @@ import java.util.List; ...@@ -8,10 +8,12 @@ import java.util.List;
import io.reactivex.Observable; import io.reactivex.Observable;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.Field; import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded; import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET; import retrofit2.http.GET;
import retrofit2.http.Header; import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.POST; import retrofit2.http.POST;
import retrofit2.http.PUT; import retrofit2.http.PUT;
import retrofit2.http.Path; import retrofit2.http.Path;
...@@ -21,6 +23,7 @@ import retrofit2.http.Url; ...@@ -21,6 +23,7 @@ import retrofit2.http.Url;
import com.common.bean.ActivityInfoBean; import com.common.bean.ActivityInfoBean;
import com.common.bean.BannerMessageDto; import com.common.bean.BannerMessageDto;
import com.common.bean.BasicAck; import com.common.bean.BasicAck;
import com.common.bean.ContactBean;
import com.common.bean.ContactInfoBean; import com.common.bean.ContactInfoBean;
import com.common.bean.CouponBean; import com.common.bean.CouponBean;
import com.common.bean.DisplayBean; import com.common.bean.DisplayBean;
...@@ -31,6 +34,7 @@ import com.common.bean.InviteePersonBean; ...@@ -31,6 +34,7 @@ import com.common.bean.InviteePersonBean;
import com.common.bean.LoaningAmoutBean; import com.common.bean.LoaningAmoutBean;
import com.common.bean.MsgInboxBean; import com.common.bean.MsgInboxBean;
import com.common.bean.PersonalInfoServerBean; import com.common.bean.PersonalInfoServerBean;
import com.common.bean.PhotoListBean;
import com.common.bean.RecordFilesResponse; import com.common.bean.RecordFilesResponse;
import com.common.bean.RegionBean; import com.common.bean.RegionBean;
import com.common.bean.SysDictBean; import com.common.bean.SysDictBean;
...@@ -88,13 +92,12 @@ public interface UserApi { ...@@ -88,13 +92,12 @@ public interface UserApi {
/** /**
* 上传firebase 推送图片 * 上传firebase 推送图片
* */ */
@FormUrlEncoded @FormUrlEncoded
@PUT("record/firebase_token") @PUT("record/firebase_token")
Observable<ResponseBody> uploadFirebaseToken(@Field("firebase_token") String token); Observable<ResponseBody> uploadFirebaseToken(@Field("firebase_token") String token);
/** /**
* 获取认证信息 * 获取认证信息
*/ */
...@@ -157,6 +160,14 @@ public interface UserApi { ...@@ -157,6 +160,14 @@ public interface UserApi {
@Header("X-AUTH-TOKEN") String token); @Header("X-AUTH-TOKEN") String token);
@GET("/record/emergency/contact/list")
Observable<List<ContactBean>> getContactList();
@Headers("Content-Type: application/json")
@PUT("/record/emergency/contact")
Observable<BasicAck> submitContactList(@Body List<ContactBean> contactList);
/** /**
* 提交工作认证信息 * 提交工作认证信息
*/ */
...@@ -305,7 +316,6 @@ public interface UserApi { ...@@ -305,7 +316,6 @@ public interface UserApi {
Observable<UserBankInfo> getBankCardInfo(@Header("X-AUTH-TOKEN") String token); Observable<UserBankInfo> getBankCardInfo(@Header("X-AUTH-TOKEN") String token);
@GET("chat/account") @GET("chat/account")
Observable<YWUser> getChatUserInfo(@Header("X-AUTH-TOKEN") String token); Observable<YWUser> getChatUserInfo(@Header("X-AUTH-TOKEN") String token);
...@@ -329,6 +339,12 @@ public interface UserApi { ...@@ -329,6 +339,12 @@ public interface UserApi {
@GET("banner/message") @GET("banner/message")
Observable<List<BannerMessageDto>> getBannerMsg(); Observable<List<BannerMessageDto>> getBannerMsg();
/**
* 获取其他证明图片列表
*/
@GET("/record/files-extra")
Observable<PhotoListBean> getPhotoList();
/** /**
* 提交第三方数据 * 提交第三方数据
......
...@@ -4,11 +4,20 @@ import android.content.Context; ...@@ -4,11 +4,20 @@ import android.content.Context;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.text.TextUtils; import android.text.TextUtils;
import com.common.bean.PhotoListBean;
import com.google.gson.Gson; import com.google.gson.Gson;
import java.io.File; import java.io.File;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import io.reactivex.functions.Predicate;
import io.reactivex.schedulers.Schedulers;
import tech.starwin.LibConfig; import tech.starwin.LibConfig;
import tech.starwin.base.BasePresenter; import tech.starwin.base.BasePresenter;
import tech.starwin.constants.TrackEvent; import tech.starwin.constants.TrackEvent;
...@@ -19,7 +28,7 @@ import com.common.bean.BasicAck; ...@@ -19,7 +28,7 @@ import com.common.bean.BasicAck;
import com.common.bean.OcrResultBean; import com.common.bean.OcrResultBean;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import tech.starwin.utils.GeneralUtils; import tech.starwin.utils.LogUtils;
import tech.starwin.utils.LoginManager; import tech.starwin.utils.LoginManager;
import tech.starwin.utils.MultipartBodyMaker; import tech.starwin.utils.MultipartBodyMaker;
import tech.starwin.utils.PreferencesManager; import tech.starwin.utils.PreferencesManager;
...@@ -89,16 +98,12 @@ public class UploadPresenter extends BasePresenter<UploadApi> { ...@@ -89,16 +98,12 @@ public class UploadPresenter extends BasePresenter<UploadApi> {
faceVerify(action, androidId, livenessId, amount, day, productId, "advance"); faceVerify(action, androidId, livenessId, amount, day, productId, "advance");
} }
public void faceVerify(final String action, String androidId, String faceData, double amount, int day, long productId, String method) { public void faceVerify(final String action, String androidId, String faceData, double amount, int day, long productId, String method) {
TrackEventHelper.logEvent(TrackEvent.FACE_DETECTION); TrackEventHelper.logEvent(TrackEvent.FACE_DETECTION);
handleRequest( handleRequest(
apiService.faceVerify( apiService.faceVerify(
"PAYDAY", "PAYDAY", amount, day, "D", null, null,
amount,
day,
"D",
null,
null,
MultipartBodyMaker.makeSimplePart("delta", faceData), MultipartBodyMaker.makeSimplePart("delta", faceData),
androidId, androidId,
productId, productId,
...@@ -130,6 +135,44 @@ public class UploadPresenter extends BasePresenter<UploadApi> { ...@@ -130,6 +135,44 @@ public class UploadPresenter extends BasePresenter<UploadApi> {
}); });
} }
/**
* 无活体SDK 时,后台设置活体检查次数,这里连续请求若干次,直到通过
*/
public void faceVerifyWithoutSDK(final String action, Context context, double amount, int day, long productId) {
Observable observable = Observable.fromArray(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
.flatMap((Function<Integer, ObservableSource<BasicAck>>) integer ->
apiService.faceVerify("PAYDAY", amount, day, "D", null, null,
MultipartBodyMaker.makeSimplePart("delta", "null"), AppInfoUtils.getAndroidID(context), productId,
!TextUtils.isEmpty(LibConfig.TONGDUN_PARENT_KEY), "yitu", LoginManager.get().getToken()
).onErrorReturn(throwable -> new BasicAck()))
.filter(basicAck -> basicAck != null && basicAck.getData() != null)
.take(1);
handleRequest(observable, new HttpObserver<BasicAck>() {
@Override
public void onStart() {
view.onHttpStart(action, true);
}
@Override
public void onSuccess(BasicAck data) {
TrackEventHelper.logEvent(TrackEvent.FACE_DETECTION_SUCCESS);
view.onHttpSuccess(action, data);
}
@Override
public void onError(int code, String msg) {
view.onHttpError(action, msg);
}
@Override
public void onFinish() {
view.onHttpFinish(action);
}
});
}
/** /**
* 上传fireBaseMessing Token * 上传fireBaseMessing Token
...@@ -139,4 +182,35 @@ public class UploadPresenter extends BasePresenter<UploadApi> { ...@@ -139,4 +182,35 @@ public class UploadPresenter extends BasePresenter<UploadApi> {
handleRequest(action, apiService.uploadFirebaseToken(token)); handleRequest(action, apiService.uploadFirebaseToken(token));
} }
} }
/**
* 上传其他证件照
*/
public void uploadOtherPhoto(String action, File file, List<PhotoListBean.Photo> photoList) {
int index = 0;
while (true) {
boolean isEffective = true;
for (PhotoListBean.Photo photo : photoList) {
if (index == photo.getIndex()) {
isEffective = false;
}
}
if (isEffective) {
break;
} else {
index++;
}
}
handleRequest(action, apiService.uploadOtherPhoto(MultipartBodyMaker.makeSimplePart("file", file), "EXTRA", index, "ADD"));
}
/**
* 删除其他证件照
*/
public void deleteOtherPhoto(String action, int photoIndex) {
handleRequest(action, apiService.uploadOtherPhoto(MultipartBodyMaker.makeSimplePart("file", "null"), "EXTRA", photoIndex, "DELETE"));
}
} }
...@@ -27,6 +27,7 @@ import tech.starwin.mvp.api.UploadApi; ...@@ -27,6 +27,7 @@ import tech.starwin.mvp.api.UploadApi;
import tech.starwin.mvp.api.UserApi; import tech.starwin.mvp.api.UserApi;
import com.common.bean.BankBean; import com.common.bean.BankBean;
import com.common.bean.ContactBean;
import com.common.bean.ContactInfoBean; import com.common.bean.ContactInfoBean;
import com.common.bean.DisplayBean; import com.common.bean.DisplayBean;
import com.common.bean.EmploymentServerBean; import com.common.bean.EmploymentServerBean;
...@@ -560,6 +561,28 @@ public class UserPresenter extends BasePresenter<UserApi> { ...@@ -560,6 +561,28 @@ public class UserPresenter extends BasePresenter<UserApi> {
handleRequest(action, apiService.getContactInfo(LoginManager.get().getToken())); handleRequest(action, apiService.getContactInfo(LoginManager.get().getToken()));
} }
/**
* 获取联系人信息
*/
public void getContactList(String action) {
handleRequest(action, apiService.getContactList());
}
/**
* 获取联系人信息
*/
public void submitContactList(String action, List<ContactBean> contactBeans) {
handleRequest(action, apiService.submitContactList(contactBeans));
}
/**
* 获取其他照片
* */
public void getPhotoList(String action) {
handleRequest(action, apiService.getPhotoList());
}
/** /**
* 公告 * 公告
*/ */
......
...@@ -76,6 +76,7 @@ class DefaultHeaderAddInterceptor implements Interceptor { ...@@ -76,6 +76,7 @@ class DefaultHeaderAddInterceptor implements Interceptor {
.header("X-APP-PACKAGE-NAME", LibConfig.APPLICATION_ID) .header("X-APP-PACKAGE-NAME", LibConfig.APPLICATION_ID)
.header("X-APP-NAME", LibConfig.APP_NAME) .header("X-APP-NAME", LibConfig.APP_NAME)
.header("X-APP-ROOTED", getRootStatus()) .header("X-APP-ROOTED", getRootStatus())
.header("thirdpartyDataFlag", String.valueOf(!TextUtils.isEmpty(LibConfig.TONGDUN_PARENT_KEY)))
// .header("X-APP-SIM-MOBILE", getSimInfo()) // .header("X-APP-SIM-MOBILE", getSimInfo())
.header("X-AF-ID", LibConfig.APPSFLYER_DEV_KEY == null ? "" : LibConfig.APPSFLYER_DEV_KEY) .header("X-AF-ID", LibConfig.APPSFLYER_DEV_KEY == null ? "" : LibConfig.APPSFLYER_DEV_KEY)
.header("X-GA-ID", getGAId()); .header("X-GA-ID", getGAId());
......
...@@ -9,6 +9,7 @@ import java.util.Map; ...@@ -9,6 +9,7 @@ import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit; import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory; import retrofit2.converter.gson.GsonConverterFactory;
...@@ -25,14 +26,19 @@ public class ServiceGenerator { ...@@ -25,14 +26,19 @@ public class ServiceGenerator {
private static Map<String, Object> serviceMap; private static Map<String, Object> serviceMap;
static { static {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
okHttpClient = new OkHttpClient.Builder() okHttpClient = new OkHttpClient.Builder()
.connectTimeout(TIME_OUT, TimeUnit.SECONDS) .connectTimeout(TIME_OUT, TimeUnit.SECONDS)
.writeTimeout(TIME_OUT, TimeUnit.SECONDS) .writeTimeout(TIME_OUT, TimeUnit.SECONDS)
.readTimeout(TIME_OUT, TimeUnit.SECONDS) .readTimeout(TIME_OUT, TimeUnit.SECONDS)
.addInterceptor(new DefaultHeaderAddInterceptor()) .addInterceptor(new DefaultHeaderAddInterceptor())
.addInterceptor(new FirebaseHeaderInterceptor()) .addInterceptor(new FirebaseHeaderInterceptor())
.addInterceptor(logging)
.build(); .build();
serviceMap = new HashMap<>(); serviceMap = new HashMap<>();
} }
......
...@@ -43,6 +43,13 @@ public class FragmentLauncher { ...@@ -43,6 +43,13 @@ public class FragmentLauncher {
return currentFragment; return currentFragment;
} }
public boolean isCurrent(Class<? extends Fragment> clazz) {
if (currentFragment != null) {
return currentFragment.getClass() == clazz;
}
return false;
}
public FragmentLauncher(FragmentActivity activity, @IdRes int fragmentLayout) { public FragmentLauncher(FragmentActivity activity, @IdRes int fragmentLayout) {
this.activity = activity; this.activity = activity;
...@@ -85,7 +92,6 @@ public class FragmentLauncher { ...@@ -85,7 +92,6 @@ public class FragmentLauncher {
if (framentSet.containsKey(className)) { if (framentSet.containsKey(className)) {
fragment = (T) framentSet.get(className); fragment = (T) framentSet.get(className);
if (fragment == currentFragment) { if (fragment == currentFragment) {
// fragment.setArguments(arguments);
return fragment; return fragment;
} }
} }
......
...@@ -187,9 +187,8 @@ public class InfoTranslator { ...@@ -187,9 +187,8 @@ public class InfoTranslator {
} }
/** /**
* 还款方式 * 亲属关系
*/ */
public static StringAdapter getFamilyContactAdapter(Context context) { public static StringAdapter getFamilyContactAdapter(Context context) {
StringAdapter adapter = new StringAdapter(); StringAdapter adapter = new StringAdapter();
...@@ -201,7 +200,7 @@ public class InfoTranslator { ...@@ -201,7 +200,7 @@ public class InfoTranslator {
/** /**
* 还款方式 * 朋友关系
*/ */
public static StringAdapter getFriendContactAdapter(Context context) { public static StringAdapter getFriendContactAdapter(Context context) {
StringAdapter adapter = new StringAdapter(); StringAdapter adapter = new StringAdapter();
...@@ -211,11 +210,28 @@ public class InfoTranslator { ...@@ -211,11 +210,28 @@ public class InfoTranslator {
return adapter; return adapter;
} }
/**
* 所有关系
*/
public static StringAdapter getContactRelationAdapter(Context context) {
StringAdapter adapter = new StringAdapter();
adapter.addItem(newItem(context, "PARENT", R.string.contact_father));
adapter.addItem(newItem(context, "MOTHER", R.string.contact_mother));
adapter.addItem(newItem(context, "SPOUSE", R.string.contact_spouse));
adapter.addItem(newItem(context, "FRIEND", R.string.contact_friend));
adapter.addItem(newItem(context, "CLASSMATE", R.string.contact_classmates));
adapter.addItem(newItem(context, "COLLEAGUE", R.string.contact_colleagues));
return adapter;
}
private static StringAdapter.Item newItem(Context context, String value, int info) { private static StringAdapter.Item newItem(Context context, String value, int info) {
return new StringAdapter.Item(value, context.getString(info)); return new StringAdapter.Item(value, context.getString(info));
} }
private static StringAdapter.Item newItem(Context context, String value, String info) {
return new StringAdapter.Item(value, info);
}
} }
...@@ -27,6 +27,23 @@ import tech.starwin.R; ...@@ -27,6 +27,23 @@ import tech.starwin.R;
public class StringFormat { public class StringFormat {
/** /**
* 是否有空值
*/
public static boolean hasEmpty(String value, String... values) {
if (TextUtils.isEmpty(value)) {
return true;
} else {
for (String str : values) {
if (TextUtils.isEmpty(str)) {
return true;
}
}
}
return false;
}
/**
* 格式化金额 * 格式化金额
*/ */
public static String moneyFormat(@Nullable Context context, double money) { public static String moneyFormat(@Nullable Context context, double money) {
......
...@@ -94,6 +94,8 @@ ...@@ -94,6 +94,8 @@
<string name="text_progress_rating"> 0% </string> <string name="text_progress_rating"> 0% </string>
<string name="button_certification_submit">Submit</string> <string name="button_certification_submit">Submit</string>
<string name="text_next_step">Next Step</string>
<string name="text_remain_days">05</string> <string name="text_remain_days">05</string>
<string name="text_unit_days">Day</string> <string name="text_unit_days">Day</string>
...@@ -190,6 +192,8 @@ ...@@ -190,6 +192,8 @@
<string name="text_loan_raiders">How to Borrow</string> <string name="text_loan_raiders">How to Borrow</string>
<string name="text_repayment_raiders_2">How to repayment the Loan</string> <string name="text_repayment_raiders_2">How to repayment the Loan</string>
<string name="start_loan_tip">Are you sure you want to apply for this loan?</string>
<string name="text_title_about">About Us</string> <string name="text_title_about">About Us</string>
<string name="text_title_helpcenter">Help Center</string> <string name="text_title_helpcenter">Help Center</string>
......
...@@ -120,6 +120,7 @@ ...@@ -120,6 +120,7 @@
<string name="button_bank_determine">选择</string> <string name="button_bank_determine">选择</string>
<string name="edittext_personal_info_full_name">全名</string> <string name="edittext_personal_info_full_name">全名</string>
<string name="edittext_personal_info_ktp_no">身份证号</string> <string name="edittext_personal_info_ktp_no">身份证号</string>
...@@ -187,6 +188,8 @@ ...@@ -187,6 +188,8 @@
<string name="text_temporarily_no_data">暂无数据</string> <string name="text_temporarily_no_data">暂无数据</string>
<string name="start_loan_tip">确定要申请这笔贷款吗?</string>
<string name="text_title_about">关于我们</string> <string name="text_title_about">关于我们</string>
<string name="text_title_helpcenter">帮助中心</string> <string name="text_title_helpcenter">帮助中心</string>
...@@ -460,6 +463,8 @@ ...@@ -460,6 +463,8 @@
<string name="repayment_transation_code_text">交易号</string> <string name="repayment_transation_code_text">交易号</string>
<string name="text_next_step">下一步</string>
<string name="pay_in_alfamart"> <string name="pay_in_alfamart">
\n \n
1.去Alfamart旗下(Alfamart,Alfamidi,Lawson,AND + AND)。\n 1.去Alfamart旗下(Alfamart,Alfamidi,Lawson,AND + AND)。\n
......
...@@ -57,6 +57,9 @@ ...@@ -57,6 +57,9 @@
<string name="text_no_photo">Mohon unggah foto dan mencobanya lagi</string> <string name="text_no_photo">Mohon unggah foto dan mencobanya lagi</string>
<string name="more_photo_tip">Anda perlu mengunggah setidaknya dua foto</string>
<string name="certify_not_pass">Anda harus menyelesaikan sertifikasi berikut\n</string> <string name="certify_not_pass">Anda harus menyelesaikan sertifikasi berikut\n</string>
<string name="text_loan_amount_statement">Silahkan Pilih Jumlah Pinjaman</string> <string name="text_loan_amount_statement">Silahkan Pilih Jumlah Pinjaman</string>
...@@ -114,6 +117,8 @@ ...@@ -114,6 +117,8 @@
<string name="text_days_left">Jumlah Hari Yang Tersisa</string> <string name="text_days_left">Jumlah Hari Yang Tersisa</string>
<string name="text_whats_app_id">WhatsApp ID</string> <string name="text_whats_app_id">WhatsApp ID</string>
<string name="start_loan_tip">Apakah Anda yakin ingin mengajukan pinjaman ini?</string>
<string name="text_been_payment_text">Telah Dikembalikan: </string> <string name="text_been_payment_text">Telah Dikembalikan: </string>
<string name="text_total_acount">Rp642.000</string> <string name="text_total_acount">Rp642.000</string>
...@@ -121,6 +126,10 @@ ...@@ -121,6 +126,10 @@
<string name="text_remain_text">Sisa: </string> <string name="text_remain_text">Sisa: </string>
<string name="text_been_payment_account">Rp42.000</string> <string name="text_been_payment_account">Rp42.000</string>
<string name="text_next_step">Langkah berikutnya</string>
<string name="text_add_photo">Tambahkan lebih banyak foto</string>
<string name="text_title_system_message">Pesan Sistem</string> <string name="text_title_system_message">Pesan Sistem</string>
<string name="text_customer_service_hotline">Hubungi Kami</string> <string name="text_customer_service_hotline">Hubungi Kami</string>
...@@ -242,6 +251,16 @@ ...@@ -242,6 +251,16 @@
<item>Tanggal jatuh tempo dijadwalkan 7 hari atau 14 hari setelah tanggal pengeluaran pinjaman (berdasarkan jangka waktu pinjaman yang telah anda pilih sebelumnya). Setelah pinjaman berhasil, anda dapat memeriksa tanggal jatuh tempo pinjaman pada halaman utama app.</item> <item>Tanggal jatuh tempo dijadwalkan 7 hari atau 14 hari setelah tanggal pengeluaran pinjaman (berdasarkan jangka waktu pinjaman yang telah anda pilih sebelumnya). Setelah pinjaman berhasil, anda dapat memeriksa tanggal jatuh tempo pinjaman pada halaman utama app.</item>
</string-array> </string-array>
<string-array name="photo_type" formatted="false">
<item>Slip Gaji</item>
<item>ID Pekerjaan</item>
<item>SIUP/SKU</item>
<item>Kartu Keluarga</item>
<item>NPWP</item>
</string-array>
<string name="delete_photo_tip">Anda yakin ingin menghapusnya?</string>
<string name="text_title_loanraiders">Cara meminjam</string> <string name="text_title_loanraiders">Cara meminjam</string>
<string name="text_loanraiders_step2">Di halaman utama app, pilih jumlah pinjaman dan tenggat pinjaman</string> <string name="text_loanraiders_step2">Di halaman utama app, pilih jumlah pinjaman dan tenggat pinjaman</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