mirror of
https://github.com/etesync/android
synced 2024-11-26 01:48:34 +00:00
Only allow collection owners to edit it.
This commit is contained in:
parent
290aa159b2
commit
71e37fb9a6
@ -15,6 +15,7 @@ import com.etesync.syncadapter.Constants
|
|||||||
import com.etesync.syncadapter.R
|
import com.etesync.syncadapter.R
|
||||||
import com.etesync.syncadapter.resource.LocalCalendar
|
import com.etesync.syncadapter.resource.LocalCalendar
|
||||||
import com.etesync.syncadapter.ui.BaseActivity
|
import com.etesync.syncadapter.ui.BaseActivity
|
||||||
|
import com.etesync.syncadapter.ui.EditCollectionActivity
|
||||||
import com.etesync.syncadapter.ui.WebViewActivity
|
import com.etesync.syncadapter.ui.WebViewActivity
|
||||||
import com.etesync.syncadapter.utils.HintManager
|
import com.etesync.syncadapter.utils.HintManager
|
||||||
import com.etesync.syncadapter.utils.ShowcaseBuilder
|
import com.etesync.syncadapter.utils.ShowcaseBuilder
|
||||||
@ -109,12 +110,23 @@ class ViewCollectionFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
|
val cachedCollection = collectionModel.value!!
|
||||||
|
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.on_edit -> {
|
R.id.on_edit -> {
|
||||||
|
if (cachedCollection.col.accessLevel == "adm") {
|
||||||
parentFragmentManager.commit {
|
parentFragmentManager.commit {
|
||||||
replace(R.id.fragment_container, EditCollectionFragment(collectionModel.value!!))
|
replace(R.id.fragment_container, EditCollectionFragment(cachedCollection))
|
||||||
addToBackStack(EditCollectionFragment::class.java.name)
|
addToBackStack(EditCollectionFragment::class.java.name)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
val dialog = AlertDialog.Builder(requireContext())
|
||||||
|
.setIcon(R.drawable.ic_info_dark)
|
||||||
|
.setTitle(R.string.not_allowed_title)
|
||||||
|
.setMessage(R.string.edit_owner_only_anon)
|
||||||
|
.setPositiveButton(android.R.string.yes) { _, _ -> }.create()
|
||||||
|
dialog.show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
R.id.on_manage_members -> {
|
R.id.on_manage_members -> {
|
||||||
Toast.makeText(context, "Manage", Toast.LENGTH_LONG).show()
|
Toast.makeText(context, "Manage", Toast.LENGTH_LONG).show()
|
||||||
|
@ -147,6 +147,7 @@
|
|||||||
<string name="members_owner_only">Only the owner of this collection (%s) is allowed to view its members.</string>
|
<string name="members_owner_only">Only the owner of this collection (%s) is allowed to view its members.</string>
|
||||||
<string name="not_allowed_title">Not Allowed</string>
|
<string name="not_allowed_title">Not Allowed</string>
|
||||||
<string name="edit_owner_only">Only the owner of this collection (%s) is allowed to edit it.</string>
|
<string name="edit_owner_only">Only the owner of this collection (%s) is allowed to edit it.</string>
|
||||||
|
<string name="edit_owner_only_anon">Only the owner of this collection is allowed to edit it.</string>
|
||||||
<string name="members_old_journals_not_allowed">Sharing of old-style journals is not allowed. In order to share this journal, create a new one, and copy its contents over using the \"import\" dialog. If you are experiencing any issues, please contact support.</string>
|
<string name="members_old_journals_not_allowed">Sharing of old-style journals is not allowed. In order to share this journal, create a new one, and copy its contents over using the \"import\" dialog. If you are experiencing any issues, please contact support.</string>
|
||||||
<string name="use_native_apps_title">Did you know?</string>
|
<string name="use_native_apps_title">Did you know?</string>
|
||||||
<string name="use_native_apps_body">EteSync seamlessly integrates with Android, so to use it, just use your existing address book and calendar apps!\n\nFor more information, please check out the user guide.</string>
|
<string name="use_native_apps_body">EteSync seamlessly integrates with Android, so to use it, just use your existing address book and calendar apps!\n\nFor more information, please check out the user guide.</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user