Skip to content

Commit

Permalink
For mozilla-mobile#12345 - Set id for all site permissions
Browse files Browse the repository at this point in the history
This will allow identifying with what permissions the user interacts.
  • Loading branch information
Mugurell committed Jun 17, 2022
1 parent d10a193 commit b908147
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,28 +67,86 @@ sealed class Permission {
abstract val id: String?
abstract val desc: String?

data class ContentAudioCapture(override val id: String? = "", override val desc: String? = "") : Permission()
data class ContentAudioMicrophone(override val id: String? = "", override val desc: String? = "") : Permission()
data class ContentAudioOther(override val id: String? = "", override val desc: String? = "") : Permission()
data class ContentGeoLocation(override val id: String? = "", override val desc: String? = "") : Permission()
data class ContentNotification(override val id: String? = "", override val desc: String? = "") : Permission()
data class ContentProtectedMediaId(override val id: String? = "", override val desc: String? = "") : Permission()
data class ContentVideoCamera(override val id: String? = "", override val desc: String? = "") : Permission()
data class ContentVideoCapture(override val id: String? = "", override val desc: String? = "") : Permission()
data class ContentVideoScreen(override val id: String? = "", override val desc: String? = "") : Permission()
data class ContentVideoOther(override val id: String? = "", override val desc: String? = "") : Permission()
data class ContentAutoPlayAudible(override val id: String? = "", override val desc: String? = "") : Permission()
data class ContentAutoPlayInaudible(override val id: String? = "", override val desc: String? = "") : Permission()
data class ContentPersistentStorage(override val id: String? = "", override val desc: String? = "") : Permission()
data class ContentMediaKeySystemAccess(override val id: String? = "", override val desc: String? = "") :
Permission()
data class ContentCrossOriginStorageAccess(override val id: String? = "", override val desc: String? = "") :
Permission()
data class ContentAudioCapture(
override val id: String? = "ContentAudioCapture",
override val desc: String? = "",
) : Permission()
data class ContentAudioMicrophone(
override val id: String? = "ContentAudioMicrophone",
override val desc: String? = "",
) : Permission()
data class ContentAudioOther(
override val id: String? = "ContentAudioOther",
override val desc: String? = "",
) : Permission()
data class ContentGeoLocation(
override val id: String? = "ContentGeoLocation",
override val desc: String? = "",
) : Permission()
data class ContentNotification(
override val id: String? = "ContentNotification",
override val desc: String? = "",
) : Permission()
data class ContentProtectedMediaId(
override val id: String? = "ContentProtectedMediaId",
override val desc: String? = "",
) : Permission()
data class ContentVideoCamera(
override val id: String? = "ContentVideoCamera",
override val desc: String? = "",
) : Permission()
data class ContentVideoCapture(
override val id: String? = "ContentVideoCapture",
override val desc: String? = "",
) : Permission()
data class ContentVideoScreen(
override val id: String? = "ContentVideoScreen",
override val desc: String? = "",
) : Permission()
data class ContentVideoOther(
override val id: String? = "ContentVideoOther",
override val desc: String? = "",
) : Permission()
data class ContentAutoPlayAudible(
override val id: String? = "ContentAutoPlayAudible",
override val desc: String? = "",
) : Permission()
data class ContentAutoPlayInaudible(
override val id: String? = "ContentAutoPlayInaudible",
override val desc: String? = "",
) : Permission()
data class ContentPersistentStorage(
override val id: String? = "ContentPersistentStorage",
override val desc: String? = "",
) : Permission()
data class ContentMediaKeySystemAccess(
override val id: String? = "ContentMediaKeySystemAccess",
override val desc: String? = "",
) : Permission()
data class ContentCrossOriginStorageAccess(
override val id: String? = "ContentCrossOriginStorageAccess",
override val desc: String? = "",
) : Permission()

data class AppCamera(override val id: String? = "", override val desc: String? = "") : Permission()
data class AppAudio(override val id: String? = "", override val desc: String? = "") : Permission()
data class AppLocationCoarse(override val id: String? = "", override val desc: String? = "") : Permission()
data class AppLocationFine(override val id: String? = "", override val desc: String? = "") : Permission()
data class AppCamera(
override val id: String? = "AppCamera",
override val desc: String? = "",
) : Permission()
data class AppAudio(
override val id: String? = "AppAudio",
override val desc: String? = "",
) : Permission()
data class AppLocationCoarse(
override val id: String? = "AppLocationCoarse",
override val desc: String? = "",
) : Permission()
data class AppLocationFine(
override val id: String? = "AppLocationFine",
override val desc: String? = "",
) : Permission()

data class Generic(override val id: String?, override val desc: String? = "") : Permission()
data class Generic(
override val id: String? = "Generic",
override val desc: String? = "",
) : Permission()
}
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ class SitePermissionsFeatureTest {
ContentVideoCamera(),
ContentVideoCapture(),
ContentCrossOriginStorageAccess(),
Generic(id = null)
Generic()
)

var exceptionThrown = false
Expand Down
3 changes: 3 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ permalink: /changelog/
* [Gecko](https://github.com/mozilla-mobile/android-components/blob/main/buildSrc/src/main/java/Gecko.kt)
* [Configuration](https://github.com/mozilla-mobile/android-components/blob/main/.config.yml)

* **site-permission-feature**
* 🆕 [issue #12345](https://github.com/mozilla-mobile/android-components/issues/12345) - Add an id for all site permissions allowing to easily identify with what permissions the user interacts.

* **site-permission-feature**
* 🆕 [issue #12338](https://github.com/mozilla-mobile/android-components/issues/12338) - Add support for setting a custom text for the negative button of the site permission prompts. Use "Block" for the storage access prompt.

Expand Down

0 comments on commit b908147

Please sign in to comment.