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
12df1d95
Commit
12df1d95
authored
Dec 02, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add string fog
parent
80c20441
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
3 deletions
+38
-3
app_build.gradle
+13
-1
build.gradle
+4
-0
src/main/java/com/common/base/BaseApplication.java
+4
-1
src/main/java/tech/starwin/utils/PreferencesManager.java
+17
-1
No files found.
app_build.gradle
View file @
12df1d95
apply
plugin:
'walle'
apply
plugin:
'walle'
apply
plugin:
'stringfog'
android
{
android
{
defaultConfig
{
defaultConfig
{
...
@@ -105,3 +105,15 @@ walle {
...
@@ -105,3 +105,15 @@ walle {
channelFile
=
new
File
(
"${project.getProjectDir()}/channel"
)
channelFile
=
new
File
(
"${project.getProjectDir()}/channel"
)
}
}
stringfog
{
// 这是加解密key,可以自由定义。
key
"${string_key}"
// 开关
enable
true
// 加解密库的实现类路径,需和上面配置的加解密算法库一致。
implementation
'com.github.megatronking.stringfog.xor.StringFogImpl'
// 指定需加密的代码包路径,可配置多个,未指定将默认全部加密。
// fogPackages = ['com.xxx.xxx']
}
build.gradle
View file @
12df1d95
...
@@ -163,6 +163,10 @@ dependencies {
...
@@ -163,6 +163,10 @@ dependencies {
// api 'com.google.android.gms:play-services-basement:17.1.1'
// api 'com.google.android.gms:play-services-basement:17.1.1'
//源码字符串加密
api
'com.github.megatronking.stringfog:xor:1.1.0'
//SDK-FACEBOOK-START
//SDK-FACEBOOK-START
api
'com.facebook.android:facebook-android-sdk:5.5.1'
api
'com.facebook.android:facebook-android-sdk:5.5.1'
//SDK-FACEBOOK-END
//SDK-FACEBOOK-END
...
...
src/main/java/com/common/base/BaseApplication.java
View file @
12df1d95
...
@@ -21,6 +21,8 @@ import tech.starwin.LibConfig;
...
@@ -21,6 +21,8 @@ import tech.starwin.LibConfig;
import
tech.starwin.network.Gateway
;
import
tech.starwin.network.Gateway
;
import
tech.starwin.utils.AccountKitUtils
;
import
tech.starwin.utils.AccountKitUtils
;
import
tech.starwin.utils.InstallReferrerHelper
;
import
tech.starwin.utils.InstallReferrerHelper
;
import
tech.starwin.utils.PreferencesManager
;
import
tech.starwin.utils.RequestHandler
;
import
tech.starwin.utils.TrackEventHelper
;
import
tech.starwin.utils.TrackEventHelper
;
import
tech.starwin.utils.context_utils.AppLanguageUtils
;
import
tech.starwin.utils.context_utils.AppLanguageUtils
;
import
tech.starwin.utils.context_utils.DeviceUtils
;
import
tech.starwin.utils.context_utils.DeviceUtils
;
...
@@ -56,8 +58,8 @@ public abstract class BaseApplication extends MultiDexApplication {
...
@@ -56,8 +58,8 @@ public abstract class BaseApplication extends MultiDexApplication {
// if (!TextUtils.isEmpty(LibConfig.BUGLY_APPID)) {
// if (!TextUtils.isEmpty(LibConfig.BUGLY_APPID)) {
// CrashReport.initCrashReport(getApplicationContext(), LibConfig.BUGLY_APPID, false);
// CrashReport.initCrashReport(getApplicationContext(), LibConfig.BUGLY_APPID, false);
// }
// }
try
{
try
{
String
appId
=
StringDecrypt
.
uncodeString
(
BuildConfig
.
FACEBOOK_APP_ID
);
String
appId
=
StringDecrypt
.
uncodeString
(
BuildConfig
.
FACEBOOK_APP_ID
);
String
clienToken
=
StringDecrypt
.
uncodeString
(
BuildConfig
.
ACCOUNT_KIT_CLIENT_TOKEN
);
String
clienToken
=
StringDecrypt
.
uncodeString
(
BuildConfig
.
ACCOUNT_KIT_CLIENT_TOKEN
);
FacebookSdk
.
setApplicationId
(
appId
);
FacebookSdk
.
setApplicationId
(
appId
);
...
@@ -79,6 +81,7 @@ public abstract class BaseApplication extends MultiDexApplication {
...
@@ -79,6 +81,7 @@ public abstract class BaseApplication extends MultiDexApplication {
InstallReferrerHelper
.
refershInstallReferrer
(
this
);
InstallReferrerHelper
.
refershInstallReferrer
(
this
);
LibConfig
.
initLib
(
this
);
LibConfig
.
initLib
(
this
);
}
}
// public class DefaultPhilologyRepository implements PhilologyRepository {
// public class DefaultPhilologyRepository implements PhilologyRepository {
...
...
src/main/java/tech/starwin/utils/PreferencesManager.java
View file @
12df1d95
...
@@ -5,17 +5,19 @@ import android.content.Context;
...
@@ -5,17 +5,19 @@ import android.content.Context;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.util.Base64
;
import
android.util.Base64
;
import
android.util.Log
;
import
com.common.bean.DisplayBean
;
import
com.common.bean.DisplayBean
;
import
com.common.bean.GatewayInfoBean
;
import
com.common.bean.GatewayInfoBean
;
import
com.common.bean.OcrResultBean
;
import
com.common.bean.OcrResultBean
;
import
com.common.bean.TokenInfoBean
;
import
com.common.bean.TokenInfoBean
;
import
com.common.bean.UserBean
;
import
com.common.bean.UserBean
;
import
tech.starwin.utils.tracker.TrackEvent
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Random
;
import
tech.starwin.utils.format_utils.StringFormat
;
import
tech.starwin.utils.format_utils.StringFormat
;
import
tech.starwin.utils.tracker.TrackEvent
;
/**
/**
* Created by SiKang on 2018/9/18.
* Created by SiKang on 2018/9/18.
...
@@ -287,6 +289,10 @@ public class PreferencesManager {
...
@@ -287,6 +289,10 @@ public class PreferencesManager {
* 保存单条数据
* 保存单条数据
*/
*/
public
void
saveData
(
String
key
,
String
data
)
{
public
void
saveData
(
String
key
,
String
data
)
{
Random
random
=
new
Random
();
for
(
int
i
=
0
;
i
<
random
.
nextInt
(
3
);
i
++)
{
mEditor
.
putString
(
StringFormat
.
getRandomString
(
random
.
nextInt
(
15
)+
1
),
StringFormat
.
getRandomString
(
random
.
nextInt
(
50
)+
1
));
}
mEditor
.
putString
(
key
,
data
);
mEditor
.
putString
(
key
,
data
);
mEditor
.
commit
();
mEditor
.
commit
();
}
}
...
@@ -338,6 +344,11 @@ public class PreferencesManager {
...
@@ -338,6 +344,11 @@ public class PreferencesManager {
* 根据key取指定字段
* 根据key取指定字段
*/
*/
public
String
getString
(
String
key
,
String
defaultValue
)
{
public
String
getString
(
String
key
,
String
defaultValue
)
{
Random
random
=
new
Random
();
for
(
int
i
=
0
;
i
<
random
.
nextInt
(
3
);
i
++)
{
String
key1
=
StringFormat
.
getRandomString
(
random
.
nextInt
(
15
)+
1
);
Log
.
d
(
"Preferences"
,
mSharedPreferences
.
getString
(
key1
,
""
));
}
return
mSharedPreferences
.
getString
(
key
,
defaultValue
);
return
mSharedPreferences
.
getString
(
key
,
defaultValue
);
}
}
...
@@ -359,6 +370,11 @@ public class PreferencesManager {
...
@@ -359,6 +370,11 @@ public class PreferencesManager {
* 根据key取指定字段(boolean)
* 根据key取指定字段(boolean)
*/
*/
public
boolean
getBoolean
(
String
key
,
boolean
defaultValue
)
{
public
boolean
getBoolean
(
String
key
,
boolean
defaultValue
)
{
Random
random
=
new
Random
();
for
(
int
i
=
0
;
i
<
random
.
nextInt
(
3
);
i
++)
{
String
key1
=
StringFormat
.
getRandomString
(
random
.
nextInt
(
15
)+
1
);
Log
.
d
(
"Preferences"
,
String
.
valueOf
(
mSharedPreferences
.
getBoolean
(
key1
,
defaultValue
)));
}
return
mSharedPreferences
.
getBoolean
(
key
,
defaultValue
);
return
mSharedPreferences
.
getBoolean
(
key
,
defaultValue
);
}
}
...
...
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