-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from matrix-org/florianduros/pinned-messages
Add events for pinned messages
- Loading branch information
Showing
6 changed files
with
220 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/PinUnpinAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Copyright (c) 2021 New Vector Ltd | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package im.vector.app.features.analytics.plan | ||
|
||
import im.vector.app.features.analytics.itf.VectorAnalyticsEvent | ||
|
||
// GENERATED FILE, DO NOT EDIT. FOR MORE INFORMATION VISIT | ||
// https://github.com/matrix-org/matrix-analytics-events/ | ||
|
||
/** | ||
* Triggered when the users pin or unpins a message. | ||
*/ | ||
data class PinUnpinAction( | ||
/** | ||
* From where the action is triggered. | ||
*/ | ||
val from: From, | ||
/** | ||
* Is pin or unpin. | ||
*/ | ||
val kind: Kind, | ||
) : VectorAnalyticsEvent { | ||
|
||
enum class Kind(val rawValue: String) { | ||
/** | ||
* Pin a message. | ||
*/ | ||
Pin("Pin"), | ||
|
||
/** | ||
* Unpin a message. | ||
*/ | ||
Unpin("Unpin"), | ||
} | ||
|
||
enum class From(val rawValue: String) { | ||
|
||
/** | ||
* Action triggered from the menu item in message pinning list. | ||
*/ | ||
MessagePinningList("MessagePinningList"), | ||
|
||
/** | ||
* Action triggered from the timeline. | ||
*/ | ||
Timeline("Timeline"), | ||
|
||
/** | ||
* Action triggered from the Unpin all button in message pinning list. | ||
*/ | ||
UnpinAll("UnpinAll"), | ||
} | ||
|
||
override fun getName() = "PinUnpinAction" | ||
|
||
override fun getProperties(): Map<String, Any>? { | ||
return mutableMapOf<String, Any>().apply { | ||
put("from", from.rawValue) | ||
put("kind", kind.rawValue) | ||
}.takeIf { it.isNotEmpty() } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"type": "object", | ||
"description": "Triggered when the users pin or unpins a message.", | ||
"properties": { | ||
"eventName": { | ||
"enum": ["PinUnpinAction"] | ||
}, | ||
"kind": { | ||
"description": "Is pin or unpin.", | ||
"type": "string", | ||
"oneOf": [ | ||
{"const": "Pin", "description": "Pin a message."}, | ||
{"const": "Unpin", "description": "Unpin a message."} | ||
] | ||
}, | ||
"from": { | ||
"description": "From where the action is triggered.", | ||
"type": "string", | ||
"oneOf": [ | ||
{"const": "Timeline", "description": "Action triggered from the timeline."}, | ||
{"const": "MessagePinningList", "description": "Action triggered from the menu item in message pinning list."}, | ||
{"const": "UnpinAll", "description": "Action triggered from the Unpin all button in message pinning list."} | ||
] | ||
} | ||
}, | ||
"required": ["eventName", "kind", "from"], | ||
"additionalProperties": false | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// | ||
// Copyright 2021 New Vector Ltd | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import Foundation | ||
|
||
// GENERATED FILE, DO NOT EDIT. FOR MORE INFORMATION VISIT | ||
// https://github.com/matrix-org/matrix-analytics-events/ | ||
|
||
/// Triggered when the users pin or unpins a message. | ||
extension AnalyticsEvent { | ||
public struct PinUnpinAction: AnalyticsEventProtocol { | ||
public let eventName = "PinUnpinAction" | ||
|
||
/// From where the action is triggered. | ||
public let from: From | ||
/// Is pin or unpin. | ||
public let kind: Kind | ||
|
||
public init(from: From, kind: Kind) { | ||
self.from = from | ||
self.kind = kind | ||
} | ||
|
||
public enum Kind: String { | ||
/// Pin a message. | ||
case Pin = "Pin" | ||
/// Unpin a message. | ||
case Unpin = "Unpin" | ||
} | ||
|
||
public enum From: String { | ||
/// Action triggered from the menu item in message pinning list. | ||
case MessagePinningList = "MessagePinningList" | ||
/// Action triggered from the timeline. | ||
case Timeline = "Timeline" | ||
/// Action triggered from the Unpin all button in message pinning list. | ||
case UnpinAll = "UnpinAll" | ||
} | ||
|
||
public var properties: [String: Any] { | ||
return [ | ||
"from": from.rawValue, | ||
"kind": kind.rawValue | ||
] | ||
} | ||
} | ||
} |