Commit 766dbffb authored by fallenstardust's avatar fallenstardust

修复安装新版本会覆盖原有收藏夹记录的问题

parent 64c23f81
...@@ -251,7 +251,8 @@ public class BaseActivity extends AppCompatActivity { ...@@ -251,7 +251,8 @@ public class BaseActivity extends AppCompatActivity {
} }
/** /**
*权限申请 * 权限申请
*
* @return 是否满足权限申请条件 * @return 是否满足权限申请条件
*/ */
protected boolean startPermissionsActivity() { protected boolean startPermissionsActivity() {
...@@ -260,11 +261,12 @@ public class BaseActivity extends AppCompatActivity { ...@@ -260,11 +261,12 @@ public class BaseActivity extends AppCompatActivity {
/** /**
* 权限申请 * 权限申请
*
* @param permissions 要申请的权限列表 * @param permissions 要申请的权限列表
* @return 是否满足权限申请条件 * @return 是否满足权限申请条件
*/ */
protected boolean startPermissionsActivity(String[] permissions) { protected boolean startPermissionsActivity(String[] permissions) {
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.M) if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
return false; return false;
if (permissions == null || permissions.length == 0) if (permissions == null || permissions.length == 0)
return false; return false;
...@@ -298,6 +300,7 @@ public class BaseActivity extends AppCompatActivity { ...@@ -298,6 +300,7 @@ public class BaseActivity extends AppCompatActivity {
/** /**
* 权限申请回调 * 权限申请回调
*
* @param isOk 权限申请是否成功 * @param isOk 权限申请是否成功
*/ */
protected void onPermission(boolean isOk) { protected void onPermission(boolean isOk) {
......
...@@ -15,6 +15,7 @@ import android.util.Log; ...@@ -15,6 +15,7 @@ import android.util.Log;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import cn.garymb.ygomobile.AppsSettings; import cn.garymb.ygomobile.AppsSettings;
...@@ -348,14 +349,20 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> { ...@@ -348,14 +349,20 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
private int copyCoreConfig(String toPath, boolean needsUpdate) { private int copyCoreConfig(String toPath, boolean needsUpdate) {
try { try {
String path = getDatapath("conf"); /* String path = getDatapath("conf");
int count = IOUtils.copyFilesFromAssets(mContext, path, toPath, needsUpdate); int count = IOUtils.copyFilesFromAssets(mContext, path, toPath, needsUpdate);
if (count < 3) { if (count < 3) {
return ERROR_CORE_CONFIG_LOST; return ERROR_CORE_CONFIG_LOST;
} }*/
//替换换行符 File systemfile = new File(AppsSettings.get().getResourcePath(), Constants.CORE_SYSTEM_PATH);
File stringfile = new File(AppsSettings.get().getResourcePath(), Constants.CORE_STRING_PATH); File stringfile = new File(AppsSettings.get().getResourcePath(), Constants.CORE_STRING_PATH);
File botfile = new File(AppsSettings.get().getResourcePath(), Constants.BOT_CONF); File botfile = new File(AppsSettings.get().getResourcePath(), Constants.BOT_CONF);
if (!systemfile.exists()) {
IOUtils.copyFilesFromAssets(mContext, getDatapath("conf") + "/" + Constants.CORE_SYSTEM_PATH, toPath, false);
}
IOUtils.copyFilesFromAssets(mContext, getDatapath("conf") + "/" + Constants.CORE_STRING_PATH, toPath, needsUpdate);
IOUtils.copyFilesFromAssets(mContext, getDatapath("conf") + "/" + CORE_BOT_CONF_PATH, toPath, needsUpdate);
//替换换行符
fixString(stringfile.getAbsolutePath()); fixString(stringfile.getAbsolutePath());
fixString(botfile.getAbsolutePath()); fixString(botfile.getAbsolutePath());
return ERROR_NONE; return ERROR_NONE;
......
...@@ -287,6 +287,7 @@ ...@@ -287,6 +287,7 @@
\n还原:将已在上述备份路径的所有卡组还原到此</string> \n还原:将已在上述备份路径的所有卡组还原到此</string>
<string name="restore_deck">发现本机有卡组备份记录,是否还原?</string> <string name="restore_deck">发现本机有卡组备份记录,是否还原?</string>
<string name="explain_permission"> <string name="explain_permission">
将申请以下必要权限: 使用本软件此类功能将申请以下必要权限:
\n存储权限:备份/还原卡组,自定义背景/头像/卡背必需</string> \n安装未知应用权限:安装更新包,备份、还原卡组必需
\n存储权限:备份、还原卡组,自定义背景、头像、卡背必需</string>
</resources> </resources>
...@@ -290,6 +290,7 @@ ...@@ -290,6 +290,7 @@
\nRestore\: restore backed up decks</string> \nRestore\: restore backed up decks</string>
<string name="restore_deck">found backed up decks in your Device\, restore\?</string> <string name="restore_deck">found backed up decks in your Device\, restore\?</string>
<string name="explain_permission"> <string name="explain_permission">
necessary permissions will be applied\: Very necessary permissions will be applied\:
\nInstall unknow apps\: Install upgrade and Change Settings
\nStorage Access\:backup\/restore deck\,set custom background\/avatars\/cardback</string> \nStorage Access\:backup\/restore deck\,set custom background\/avatars\/cardback</string>
</resources> </resources>
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