Skip to content

Commit

Permalink
Merge branch 'release/2.12.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
yostyle committed Jul 22, 2024
2 parents 0e8ad26 + 32147e7 commit fe41cb0
Show file tree
Hide file tree
Showing 53 changed files with 837 additions and 205 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
java-version: '17'
- uses: gradle/gradle-build-action@v2
with:
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
Expand Down
14 changes: 14 additions & 0 deletions ELEMENT_CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
Changes in Element v1.6.18 (2024-06-25)
=======================================

Bugfixes 🐛
----------
- Fix redacted events not grouped correctly when hidden events are inserted between. ([#8840](https://github.com/element-hq/element-android/issues/8840))
- Element-Android session doesn't encrypt for a dehydrated device ([#8842](https://github.com/element-hq/element-android/issues/8842))
- Intercept only links from `element.io` well known hosts. The previous behaviour broke OIDC login in Element X. ([#8894](https://github.com/element-hq/element-android/issues/8894))

Other changes
-------------
- Posthog | report platform code for EA ([#8839](https://github.com/element-hq/element-android/issues/8839))


Changes in Element v1.6.16 (2024-05-29)
=======================================

Expand Down
12 changes: 12 additions & 0 deletions TCHAP_CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
Changes in Tchap 2.12.0 (2024-07-22)
====================================

Features ✨
----------
- Forcer la génération du code de récupération et la sauvegarde automatique. ([#988](https://github.com/tchapgouv/tchap-android/issues/988))

Improvements 🙌
--------------
- Rebase against Element-Android v1.6.18 ([#1074](https://github.com/tchapgouv/tchap-android/issues/1074))
- Mise à jour du style quand un utilisateur est mentionné. ([#1075](https://github.com/tchapgouv/tchap-android/issues/1075))

Changes in Tchap 2.11.11 (2024-06-24)
=====================================

Expand Down
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ ext.libs = [
],
element : [
'opusencoder' : "io.element.android:opusencoder:1.1.0",
'wysiwyg' : "io.element.android:wysiwyg:2.35.0"
'wysiwyg' : "io.element.android:wysiwyg:2.37.3"
],
squareup : [
'moshi' : "com.squareup.moshi:moshi:$moshi",
Expand Down
2 changes: 2 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/40106180.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Main changes in this version: Bugfixes.
Full changelog: https://github.com/element-hq/element-android/releases
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dk.ilios.realmfieldnames.RealmFieldNamesProcessor,aggregating
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dk.ilios.realmfieldnames.RealmFieldNamesProcessor
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package dk.ilios.realmfieldnames

import java.util.TreeMap

/**
* Class responsible for keeping track of the metadata for each Realm model class.
*/
class ClassData(val packageName: String?, val simpleClassName: String, val libraryClass: Boolean = false) {

val fields = TreeMap<String, String?>() // <fieldName, linkedType or null>

fun addField(field: String, linkedType: String?) {
fields.put(field, linkedType)
}

val qualifiedClassName: String
get() {
if (packageName != null && !packageName.isEmpty()) {
return packageName + "." + simpleClassName
} else {
return simpleClassName
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package dk.ilios.realmfieldnames

import java.util.Locale

/**
* Class for encapsulating the rules for converting between the field name in the Realm model class
* and the matching name in the "&lt;class&gt;Fields" class.
*/
class FieldNameFormatter {

@JvmOverloads
fun format(fieldName: String?, locale: Locale = Locale.US): String {
if (fieldName == null || fieldName == "") {
return ""
}

// Normalize word separator chars
val normalizedFieldName: String = fieldName.replace('-', '_')

// Iterate field name using the following rules
// lowerCase m followed by upperCase anything is considered hungarian notation
// lowercase char followed by uppercase char is considered camel case
// Two uppercase chars following each other is considered non-standard camelcase
// _ and - are treated as word separators
val result = StringBuilder(normalizedFieldName.length)

if (normalizedFieldName.codePointCount(0, normalizedFieldName.length) == 1) {
result.append(normalizedFieldName)
} else {
var previousCodepoint: Int?
var currentCodepoint: Int? = null
val length = normalizedFieldName.length
var offset = 0
while (offset < length) {
previousCodepoint = currentCodepoint
currentCodepoint = normalizedFieldName.codePointAt(offset)

if (previousCodepoint != null) {
if (Character.isUpperCase(currentCodepoint) &&
!Character.isUpperCase(previousCodepoint) &&
previousCodepoint === 'm'.code as Int? &&
result.length == 1
) {
// Hungarian notation starting with: mX
result.delete(0, 1)
result.appendCodePoint(currentCodepoint)
} else if (Character.isUpperCase(currentCodepoint) && Character.isUpperCase(previousCodepoint)) {
// InvalidCamelCase: XXYx (should have been xxYx)
if (offset + Character.charCount(currentCodepoint) < normalizedFieldName.length) {
val nextCodePoint = normalizedFieldName.codePointAt(offset + Character.charCount(currentCodepoint))
if (Character.isLowerCase(nextCodePoint)) {
result.append("_")
}
}
result.appendCodePoint(currentCodepoint)
} else if (currentCodepoint === '-'.code as Int? || currentCodepoint === '_'.code as Int?) {
// Word-separator: x-x or x_x
result.append("_")
} else if (Character.isUpperCase(currentCodepoint) && !Character.isUpperCase(previousCodepoint) && Character.isLetterOrDigit(
previousCodepoint
)) {
// camelCase: xX
result.append("_")
result.appendCodePoint(currentCodepoint)
} else {
// Unknown type
result.appendCodePoint(currentCodepoint)
}
} else {
// Only triggered for first code point
result.appendCodePoint(currentCodepoint)
}
offset += Character.charCount(currentCodepoint)
}
}

return result.toString().uppercase(locale)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package dk.ilios.realmfieldnames

import com.squareup.javapoet.FieldSpec
import com.squareup.javapoet.JavaFile
import com.squareup.javapoet.TypeSpec
import java.io.IOException
import javax.annotation.processing.Filer
import javax.lang.model.element.Modifier

/**
* Class responsible for creating the final output files.
*/
class FileGenerator(private val filer: Filer) {
private val formatter: FieldNameFormatter

init {
this.formatter = FieldNameFormatter()
}

/**
* Generates all the "&lt;class&gt;Fields" fields with field name references.
* @param fileData Files to create.
* *
* @return `true` if the files where generated, `false` if not.
*/
fun generate(fileData: Set<ClassData>): Boolean {
return fileData
.filter { !it.libraryClass }
.all { generateFile(it, fileData) }
}

private fun generateFile(classData: ClassData, classPool: Set<ClassData>): Boolean {
val fileBuilder = TypeSpec.classBuilder(classData.simpleClassName + "Fields")
.addModifiers(Modifier.PUBLIC, Modifier.FINAL)
.addJavadoc("This class enumerate all queryable fields in {@link \$L.\$L}\n",
classData.packageName, classData.simpleClassName)

// Add a static field reference to each queryable field in the Realm model class
classData.fields.forEach { fieldName, value ->
if (value != null) {
// Add linked field names (only up to depth 1)
for (data in classPool) {
if (data.qualifiedClassName == value) {
val linkedTypeSpec = TypeSpec.classBuilder(formatter.format(fieldName))
.addModifiers(Modifier.PUBLIC, Modifier.FINAL, Modifier.STATIC)
val linkedClassFields = data.fields
addField(linkedTypeSpec, "$", fieldName)
for (linkedFieldName in linkedClassFields.keys) {
addField(linkedTypeSpec, linkedFieldName, fieldName + "." + linkedFieldName)
}
fileBuilder.addType(linkedTypeSpec.build())
}
}
} else {
// Add normal field name
addField(fileBuilder, fieldName, fieldName)
}
}

val javaFile = JavaFile.builder(classData.packageName, fileBuilder.build()).build()
try {
javaFile.writeTo(filer)
return true
} catch (e: IOException) {
// e.printStackTrace()
return false
}
}

private fun addField(fileBuilder: TypeSpec.Builder, fieldName: String, fieldNameValue: String) {
val field = FieldSpec.builder(String::class.java, formatter.format(fieldName))
.addModifiers(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL)
.initializer("\$S", fieldNameValue)
.build()
fileBuilder.addField(field)
}
}
Loading

0 comments on commit fe41cb0

Please sign in to comment.