Pusher: update javadoc

This commit is contained in:
Benoit Marty 2020-03-06 16:37:13 +01:00
parent 35179509f2
commit 13036a5933
3 changed files with 27 additions and 12 deletions

View File

@ -40,24 +40,35 @@ import im.vector.matrix.android.internal.di.SerializeNulls
* } * }
* </code> * </code>
*/ */
@JsonClass(generateAdapter = true) @JsonClass(generateAdapter = true)
internal data class JsonPusher( internal data class JsonPusher(
/** /**
* Required. This is a unique identifier for this pusher. See /set for more detail. Max length, 512 bytes. * Required. This is a unique identifier for this pusher. The value you should use for this is the routing or
* destination address information for the notification, for example, the APNS token for APNS or the
* Registration ID for GCM. If your notification client has no such concept, use any unique identifier.
* Max length, 512 bytes.
*
* If the kind is "email", this is the email address to send notifications to.
*/ */
@Json(name = "pushkey") @Json(name = "pushkey")
val pushKey: String, val pushKey: String,
/** /**
* Required. The kind of pusher. "http" is a pusher that sends HTTP pokes. * Required. The kind of pusher to configure.
* "http" makes a pusher that sends HTTP pokes.
* "email" makes a pusher that emails the user with unread notifications.
* null deletes the pusher.
*/ */
@SerializeNulls @SerializeNulls
@Json(name = "kind") @Json(name = "kind")
val kind: String?, val kind: String?,
/** /**
* Required. This is a reverse-DNS style identifier for the application. Max length, 64 chars. * Required. This is a reverse-DNS style identifier for the application. It is recommended that this end
* with the platform, such that different platform versions get different app identifiers.
* Max length, 64 chars.
*
* If the kind is "email", this is "m.email".
*/ */
@Json(name = "app_id") @Json(name = "app_id")
val appId: String, val appId: String,
@ -88,15 +99,17 @@ internal data class JsonPusher(
/** /**
* Required. A dictionary of information for the pusher implementation itself. * Required. A dictionary of information for the pusher implementation itself.
* If kind is http, this should contain url which is the URL to use to send notifications to.
*/ */
@Json(name = "data") @Json(name = "data")
val data: JsonPusherData? = null, val data: JsonPusherData? = null,
// Only used to update add Pusher (body of api request) /**
// Used If true, the homeserver should add another pusher with the given pushkey and App ID in addition * If true, the homeserver should add another pusher with the given pushkey and App ID in addition to any others
// to any others with different user IDs. * with different user IDs. Otherwise, the homeserver must remove any other pushers with the same App ID and pushkey
// Otherwise, the homeserver must remove any other pushers with the same App ID and pushkey for different users. * for different users.
// The default is false. * The default is false.
*/
@Json(name = "append") @Json(name = "append")
val append: Boolean? = false val append: Boolean? = false
) )

View File

@ -22,12 +22,14 @@ import com.squareup.moshi.JsonClass
internal data class JsonPusherData( internal data class JsonPusherData(
/** /**
* Required if kind is http. The URL to use to send notifications to. * Required if kind is http. The URL to use to send notifications to.
* MUST be an HTTPS URL with a path of /_matrix/push/v1/notify.
*/ */
@Json(name = "url") @Json(name = "url")
val url: String? = null, val url: String? = null,
/** /**
* The format to use when sending notifications to the Push Gateway. * The format to send notifications in to Push Gateways if the kind is http.
* Currently the only format available is 'event_id_only'.
*/ */
@Json(name = "format") @Json(name = "format")
val format: String? = null val format: String? = null

View File

@ -236,9 +236,9 @@ class VectorPreferences @Inject constructor(private val context: Context) {
return defaultPrefs.getBoolean(SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY, true) return defaultPrefs.getBoolean(SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY, true)
} }
fun setNotificationEnabledForDevice(enabled: Boolean?) { fun setNotificationEnabledForDevice(enabled: Boolean) {
defaultPrefs.edit { defaultPrefs.edit {
putBoolean(SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY, enabled!!) putBoolean(SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY, enabled)
} }
} }