add clone profile detect
This commit is contained in:
4 files changed
+13
-6
No files matched your search
@@ -40,10 +40,14 @@ class ProfileEditActivity : BaseActivity() {
|
||||
queryById(id)
|
||||
} ?: return@launch finish()
|
||||
|
||||
if (metadata.name.isBlank())
|
||||
toolbar.setTitle(R.string.new_profile)
|
||||
else
|
||||
toolbar.setTitle(R.string.edit_profile)
|
||||
when {
|
||||
metadata.lastModified > 0 ->
|
||||
toolbar.setTitle(R.string.edit_profile)
|
||||
metadata.name.isBlank() ->
|
||||
toolbar.setTitle(R.string.new_profile)
|
||||
else ->
|
||||
toolbar.setTitle(R.string.clone_profile)
|
||||
}
|
||||
|
||||
val fragment = ProfileEditFragment(
|
||||
metadata.name, metadata.uri, metadata.interval,
|
||||
|
||||
@@ -130,4 +130,5 @@
|
||||
<string name="loading">载入中</string>
|
||||
<string name="tips_support"><![CDATA[Clash for Android 是一个<strong>免费开源</strong>的项目<br /> 我们<strong>不提供</strong>任何代理服务<br />请务必<strong>不要</strong>反馈非应用自身引起的问题]]></string>
|
||||
<string name="donate">捐赠</string>
|
||||
<string name="clone_profile">复制配置</string>
|
||||
</resources>
|
||||
@@ -68,6 +68,7 @@
|
||||
<string name="loading">Loading</string>
|
||||
|
||||
<string name="new_profile">New Profile</string>
|
||||
<string name="clone_profile">Clone Profile</string>
|
||||
<string name="edit_profile">Edit Profile</string>
|
||||
<string name="clash_start_failure">Clash Start Failure</string>
|
||||
<string name="refresh">Refresh</string>
|
||||
|
||||
@@ -82,8 +82,9 @@ class ProfileService : BaseService() {
|
||||
return runBlocking {
|
||||
val clonedId = generateNextId()
|
||||
|
||||
pending[clonedId] = queryMetadataById(id)?.copy(id = clonedId, active = false)
|
||||
?: return@runBlocking -1L
|
||||
pending[clonedId] =
|
||||
queryMetadataById(id)?.copy(id = clonedId, active = false, lastModified = 0)
|
||||
?: return@runBlocking -1L
|
||||
|
||||
clonedId
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user