Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lib_base
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sikang
lib_base
Commits
88684efc
Commit
88684efc
authored
Mar 08, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加SIM卡信息
parent
af29cc8b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
82 additions
and
8 deletions
+82
-8
src/main/java/com/common/base/BaseActivity.java
+10
-1
src/main/java/tech/starwin/mvp/presenter/LoanPresenter.java
+1
-0
src/main/java/tech/starwin/mvp/presenter/UserPresenter.java
+0
-1
src/main/java/tech/starwin/network/DefaultHeaderAddInterceptor.java
+22
-0
src/main/java/tech/starwin/utils/context_utils/AppInfoUtils.java
+48
-5
src/main/java/tech/starwin/utils/context_utils/PermissionsHelper.java
+1
-1
No files found.
src/main/java/com/common/base/BaseActivity.java
View file @
88684efc
...
...
@@ -30,6 +30,8 @@ import tech.starwin.base.BasePresenter;
import
tech.starwin.mvp.IView
;
import
tech.starwin.mvp.presenter.UserPresenter
;
import
tech.starwin.utils.PreferencesManager
;
import
tech.starwin.utils.context_utils.AppLanguageUtils
;
import
tech.starwin.utils.PresenterHoler
;
import
tech.starwin.utils.context_utils.FragmentLauncher
;
...
...
@@ -92,6 +94,13 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
presenterHelper
=
new
PresenterHoler
(
this
);
initRootLayout
();
/**
* display接口更新,需要在首页访问接口,为避免改动APP代码,这里在lib_base中添加功能
* */
if
(
"HomeActivity"
.
equals
(
TAG
))
{
getPresenter
(
UserPresenter
.
class
).
getCustomerMsg
(
""
);
}
}
@Override
...
...
@@ -273,7 +282,7 @@ public abstract class BaseActivity extends AppCompatActivity implements IView {
// }
// });
//bug fix:每个客户单独定制初始化动作
QMUIHelper
.
getTopbarCustomizer2
().
initTopBar
(
topBar
,
this
);
QMUIHelper
.
getTopbarCustomizer2
().
initTopBar
(
topBar
,
this
);
}
public
void
setTopBarTitle
(
String
title
)
{
...
...
src/main/java/tech/starwin/mvp/presenter/LoanPresenter.java
View file @
88684efc
...
...
@@ -19,6 +19,7 @@ import com.common.bean.LatestLoanAppBean;
import
com.common.bean.ProductBean
;
import
tech.starwin.utils.LoginManager
;
import
tech.starwin.utils.PreferencesManager
;
import
tech.starwin.utils.TrackEventHelper
;
/**
...
...
src/main/java/tech/starwin/mvp/presenter/UserPresenter.java
View file @
88684efc
...
...
@@ -83,7 +83,6 @@ public class UserPresenter extends BasePresenter<UserApi> {
public
void
accept
(
GatewayInfoBean
gatewayInfoBean
)
throws
Exception
{
Gateway
.
setGatewayInfoBean
(
gatewayInfoBean
);
EventBus
.
getDefault
().
post
(
ActionEnum
.
GATEWAY_UPDATED
);
getCustomerMsg
(
"action_getCustomerMsg"
);
}
});
}
...
...
src/main/java/tech/starwin/network/DefaultHeaderAddInterceptor.java
View file @
88684efc
...
...
@@ -17,6 +17,7 @@ import okhttp3.Response;
import
okhttp3.internal.Util
;
import
tech.starwin.LibConfig
;
import
tech.starwin.utils.LoginManager
;
import
tech.starwin.utils.context_utils.AppInfoUtils
;
/**
* Created by XLEO on 2018/1/30.
...
...
@@ -24,6 +25,8 @@ import tech.starwin.utils.LoginManager;
class
DefaultHeaderAddInterceptor
implements
Interceptor
{
public
static
String
GA_ID
=
""
;
public
static
String
SIM_INFO
=
""
;
public
static
String
ROOT_STATUS
=
""
;
@Override
public
Response
intercept
(
Chain
chain
)
throws
IOException
{
...
...
@@ -72,12 +75,31 @@ class DefaultHeaderAddInterceptor implements Interceptor {
.
header
(
"X-APP-VERSION-NAME"
,
String
.
valueOf
(
LibConfig
.
VERSION_NAME
))
.
header
(
"X-APP-PACKAGE-NAME"
,
LibConfig
.
APPLICATION_ID
)
.
header
(
"X-APP-NAME"
,
LibConfig
.
APP_NAME
)
.
header
(
"X-APP-ROOTED"
,
getRootStatus
())
.
header
(
"X-APP-SIM-MOBILE"
,
getSimInfo
())
.
header
(
"X-AF-ID"
,
LibConfig
.
APPSFLYER_DEV_KEY
==
null
?
""
:
LibConfig
.
APPSFLYER_DEV_KEY
)
.
header
(
"X-GA-ID"
,
getGAId
());
return
chain
.
proceed
(
requestBuilder
.
build
());
}
public
String
getRootStatus
()
{
if
(
TextUtils
.
isEmpty
(
ROOT_STATUS
))
{
ROOT_STATUS
=
String
.
valueOf
(
AppInfoUtils
.
isRoot
());
}
return
ROOT_STATUS
;
}
public
String
getSimInfo
()
{
if
(
TextUtils
.
isEmpty
(
SIM_INFO
))
{
String
sim_info
=
AppInfoUtils
.
getSimSerialNumber
(
LibConfig
.
getContext
())
+
","
+
AppInfoUtils
.
getPhoneNumber
(
LibConfig
.
getContext
());
if
(
sim_info
.
length
()
>
1
)
{
SIM_INFO
=
sim_info
;
}
}
return
SIM_INFO
;
}
private
String
getGAId
()
{
if
(!
TextUtils
.
isEmpty
(
GA_ID
))
{
return
GA_ID
;
...
...
src/main/java/tech/starwin/utils/context_utils/AppInfoUtils.java
View file @
88684efc
...
...
@@ -10,8 +10,10 @@ import android.support.v4.app.ActivityCompat;
import
android.telephony.TelephonyManager
;
import
android.text.TextUtils
;
import
java.io.File
;
import
java.util.UUID
;
import
tech.starwin.utils.LogUtils
;
import
tech.starwin.utils.PreferencesManager
;
/**
...
...
@@ -72,14 +74,55 @@ public class AppInfoUtils {
@SuppressLint
(
"MissingPermission"
)
public
static
String
getPhoneNumber
(
Context
context
)
{
TelephonyManager
telephonyManager
=
(
TelephonyManager
)
context
.
getSystemService
(
Context
.
TELEPHONY_SERVICE
);
String
[]
permissions
=
new
String
[]{
Manifest
.
permission
.
READ_SMS
,
Manifest
.
permission
.
READ_PHONE_STATE
};
if
(
telephonyManager
!=
null
&&
PermissionsHelper
.
isGranted
(
context
,
permissions
))
{
return
telephonyManager
.
getLine1Number
();
}
else
{
try
{
TelephonyManager
telephonyManager
=
(
TelephonyManager
)
context
.
getSystemService
(
Context
.
TELEPHONY_SERVICE
);
if
(
telephonyManager
!=
null
&&
PermissionsHelper
.
isGranted
(
context
,
Manifest
.
permission
.
READ_PHONE_STATE
))
{
return
telephonyManager
.
getLine1Number
();
}
}
catch
(
Exception
e
)
{
return
""
;
}
return
""
;
}
@SuppressLint
(
"MissingPermission"
)
public
static
String
getIMSI
(
Context
context
)
{
try
{
TelephonyManager
telephonyManager
=
(
TelephonyManager
)
context
.
getSystemService
(
Context
.
TELEPHONY_SERVICE
);
if
(
telephonyManager
!=
null
&&
PermissionsHelper
.
isGranted
(
context
,
Manifest
.
permission
.
READ_PHONE_STATE
))
{
String
imsi
=
telephonyManager
.
getSubscriberId
();
LogUtils
.
d
(
"IMSI_INFO"
,
imsi
);
return
imsi
;
}
}
catch
(
Exception
e
)
{
return
""
;
}
return
""
;
}
@SuppressLint
(
"MissingPermission"
)
public
static
String
getSimSerialNumber
(
Context
context
)
{
try
{
TelephonyManager
telephonyManager
=
(
TelephonyManager
)
context
.
getSystemService
(
Context
.
TELEPHONY_SERVICE
);
if
(
telephonyManager
!=
null
&&
PermissionsHelper
.
isGranted
(
context
,
Manifest
.
permission
.
READ_PHONE_STATE
))
{
return
telephonyManager
.
getSimSerialNumber
();
}
}
catch
(
Exception
e
)
{
return
""
;
}
return
""
;
}
/**
* 判断是否已ROOT
*/
public
static
boolean
isRoot
()
{
try
{
return
new
File
(
"/system/bin/su"
).
exists
()
||
new
File
(
"/system/xbin/su"
).
exists
();
}
catch
(
Exception
e
)
{
return
false
;
}
}
...
...
src/main/java/tech/starwin/utils/context_utils/PermissionsHelper.java
View file @
88684efc
...
...
@@ -345,7 +345,7 @@ public class PermissionsHelper {
/**
* 权限是否全部获取
*/
public
static
boolean
isGranted
(
Context
ctx
,
String
[]
permissions
)
{
public
static
boolean
isGranted
(
Context
ctx
,
String
...
permissions
)
{
if
(
permissions
==
null
||
permissions
.
length
==
0
)
{
return
false
;
}
...
...
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