Skip to content

Commit

Permalink
Merge pull request #99 from matrix-org/bma/kotlinProject
Browse files Browse the repository at this point in the history
Kotlin project
  • Loading branch information
bmarty committed Mar 27, 2024
2 parents 18c93bb + 89ec522 commit 8c6db7a
Show file tree
Hide file tree
Showing 37 changed files with 69 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/kotlin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ jobs:
- name: Build for Kotlin
uses: gradle/gradle-build-action@v2
with:
arguments: build
arguments: build detekt
build-root-directory: kotlin
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ node_modules/
build

# File generated by Intellij
/local.properties
/.idea
local.properties
.idea
17 changes: 0 additions & 17 deletions kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,16 @@

plugins {
id "org.jetbrains.kotlin.jvm" version "1.8.20"
id 'java-library'
id 'maven-publish'
}

repositories {
mavenCentral()
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

sourceSets {
main {
java {
srcDir '../types/kotlin2'
srcDir '../base_types/kotlin'
}
}
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
groupId = 'im.vector.app.features.analytics.plan'
artifactId = 'analytics-events'
version = '0.5.0'
Expand Down
15 changes: 15 additions & 0 deletions kotlin/detekt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Default rules: https://github.com/detekt/detekt/blob/main/detekt-core/src/main/resources/default-detekt-config.yml

style:
DataClassContainsFunctions:
active: false

comments:
EndOfSentenceFormat:
active: true
UndocumentedPublicClass:
active: false
UndocumentedPublicFunction:
active: false
UndocumentedPublicProperty:
active: false
29 changes: 29 additions & 0 deletions kotlin/lib/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2024 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.
*/

plugins {
id 'kotlin'
id "io.gitlab.arturbosch.detekt" version "1.22.0"
}

repositories {
mavenCentral()
}

detekt {
allRules = true
config = files("../detekt.yml")
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ data class Error(
*/
val isFederated: Boolean? = null,
/**
* true if the current user is using matrix.org
* true if the current user is using matrix.org.
*/
val isMatrixDotOrg: Boolean? = null,
val name: Name,
/**
* UTDs can be permanent or temporary. If temporary, this field will
* contain the time it took to decrypt the message in milliseconds. If
* permanent should be -1
* permanent should be -1.
*/
val timeToDecryptMillis: Int? = null,
/**
Expand All @@ -65,7 +65,7 @@ data class Error(
*/
val userTrustsOwnIdentity: Boolean? = null,
/**
* true if that unable to decrypt error was visible to the user
* true if that unable to decrypt error was visible to the user.
*/
val wasVisibleToUser: Boolean? = null,
) : VectorAnalyticsEvent {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ data class PollCreation(

enum class Action {
/**
* Newly created poll
* Newly created poll.
*/
Create,

/**
* Edit of an existing poll
* Edit of an existing poll.
*/
Edit,
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ package im.vector.app.features.analytics.plan
*/
data class SuperProperties(
/**
* Used by web to identify the platform (Web Platform/Electron Platform)
* Used by web to identify the platform (Web Platform/Electron
* Platform).
*/
val appPlatform: String? = null,
/**
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions kotlin/settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
rootProject.name = 'analytics-events'

include ':lib'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"prepublishOnly": "yarn build:ts",
"build": "yarn build:ts && yarn build:swift && yarn build:kt2",
"build:ts": "./scripts/build-typescript.sh",
"build:kt2": "cd stub-generator && poetry run python -m matrix_analytics_stub_generator -l kotlin -o ../types/kotlin2 -i ../schemas",
"build:kt2": "cd stub-generator && poetry run python -m matrix_analytics_stub_generator -l kotlin -o ../kotlin/lib/src/main/java/im/vector/app/features/analytics/plan -i ../schemas",
"build:swift": "cd stub-generator && poetry run python -m matrix_analytics_stub_generator -l swift -o ../types/swift -i ../schemas && cp ../base_types/swift/* ../types/swift/",
"build:html": "cd stub-generator && poetry run python -m matrix_analytics_stub_generator -l html -o ../types/html -i ../schemas"
}
Expand Down
6 changes: 3 additions & 3 deletions schemas/Error.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"type": "string"
},
"timeToDecryptMillis": {
"description": "UTDs can be permanent or temporary. If temporary, this field will contain the time it took to decrypt the message in milliseconds. If permanent should be -1",
"description": "UTDs can be permanent or temporary. If temporary, this field will contain the time it took to decrypt the message in milliseconds. If permanent should be -1.",
"type": "integer"
},
"cryptoSDK": {
Expand Down Expand Up @@ -62,15 +62,15 @@
"type": "boolean"
},
"isMatrixDotOrg": {
"description": "true if the current user is using matrix.org",
"description": "true if the current user is using matrix.org.",
"type": "boolean"
},
"isFederated": {
"description": "true if userDomain != senderDomain.",
"type": "boolean"
},
"wasVisibleToUser": {
"description": "true if that unable to decrypt error was visible to the user",
"description": "true if that unable to decrypt error was visible to the user.",
"type": "boolean"
}
},
Expand Down
4 changes: 2 additions & 2 deletions schemas/PollCreation.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"description": "Whether this poll has been created or edited.",
"type": "string",
"oneOf": [
{"const": "Create", "description": "Newly created poll"},
{"const": "Edit", "description": "Edit of an existing poll"}
{"const": "Create", "description": "Newly created poll."},
{"const": "Edit", "description": "Edit of an existing poll."}
]
},
"isUndisclosed": {
Expand Down
2 changes: 1 addition & 1 deletion schemas/SuperProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"type": "string"
},
"appPlatform": {
"description": "Used by web to identify the platform (Web Platform/Electron Platform)",
"description": "Used by web to identify the platform (Web Platform/Electron Platform).",
"type": "string"
}
},
Expand Down
6 changes: 3 additions & 3 deletions types/swift/Error.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ extension AnalyticsEvent {
public let eventLocalAgeMillis: Int?
/// true if userDomain != senderDomain.
public let isFederated: Bool?
/// true if the current user is using matrix.org
/// true if the current user is using matrix.org.
public let isMatrixDotOrg: Bool?
public let name: Name
/// UTDs can be permanent or temporary. If temporary, this field will contain the time it took to decrypt the message in milliseconds. If permanent should be -1
/// UTDs can be permanent or temporary. If temporary, this field will contain the time it took to decrypt the message in milliseconds. If permanent should be -1.
public let timeToDecryptMillis: Int?
/// true if the current user trusts their own identity (verified session) at time of decryption.
public let userTrustsOwnIdentity: Bool?
/// true if that unable to decrypt error was visible to the user
/// true if that unable to decrypt error was visible to the user.
public let wasVisibleToUser: Bool?

public init(context: String?, cryptoModule: CryptoModule?, cryptoSDK: CryptoSDK?, domain: Domain, eventLocalAgeMillis: Int?, isFederated: Bool?, isMatrixDotOrg: Bool?, name: Name, timeToDecryptMillis: Int?, userTrustsOwnIdentity: Bool?, wasVisibleToUser: Bool?) {
Expand Down
4 changes: 2 additions & 2 deletions types/swift/PollCreation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ extension AnalyticsEvent {
}

public enum Action: String {
/// Newly created poll
/// Newly created poll.
case Create
/// Edit of an existing poll
/// Edit of an existing poll.
case Edit
}

Expand Down
2 changes: 1 addition & 1 deletion types/swift/SuperProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Foundation
extension AnalyticsEvent {
public struct SuperProperties {

/// Used by web to identify the platform (Web Platform/Electron Platform)
/// Used by web to identify the platform (Web Platform/Electron Platform).
public let appPlatform: String?
/// Which crypto backend is the client currently using.
public let cryptoSDK: CryptoSDK?
Expand Down

0 comments on commit 8c6db7a

Please sign in to comment.