Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions Auth/schemas/com.infomaniak.core.auth.room.UserDatabase/9.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"formatVersion": 1,
"database": {
"version": 9,
"identityHash": "ffb48c9c7cbe144e782f7a50645505d8",
"identityHash": "d2186f80b68b770c4f4081c454b43377",
"entities": [
{
"tableName": "User",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `displayName` TEXT, `firstname` TEXT NOT NULL, `lastname` TEXT NOT NULL, `email` TEXT NOT NULL, `avatar` TEXT, `card` TEXT, `login` TEXT NOT NULL, `isStaff` INTEGER NOT NULL DEFAULT false, `organizations` TEXT NOT NULL, `preferences_security_score` INTEGER DEFAULT 0, `preferences_security_dateLastChangedPassword` INTEGER DEFAULT 0, `preferences_organizationPreference_currentOrganizationId` INTEGER NOT NULL DEFAULT 0, `accessToken` TEXT NOT NULL, `refreshToken` TEXT, `tokenType` TEXT NOT NULL, `expiresIn` INTEGER NOT NULL, `userId` INTEGER NOT NULL, `scope` TEXT, `expiresAt` INTEGER, `isTemporary` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`id`))",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `displayName` TEXT, `firstname` TEXT NOT NULL, `lastname` TEXT NOT NULL, `email` TEXT NOT NULL, `avatar` TEXT, `phones` TEXT, `card` TEXT, `login` TEXT NOT NULL, `isStaff` INTEGER NOT NULL DEFAULT false, `organizations` TEXT NOT NULL, `preferences_security_score` INTEGER DEFAULT 0, `preferences_security_dateLastChangedPassword` INTEGER DEFAULT 0, `preferences_organizationPreference_currentOrganizationId` INTEGER NOT NULL DEFAULT 0, `accessToken` TEXT NOT NULL, `refreshToken` TEXT, `tokenType` TEXT NOT NULL, `expiresIn` INTEGER NOT NULL, `userId` INTEGER NOT NULL, `scope` TEXT, `expiresAt` INTEGER, `isTemporary` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
Expand Down Expand Up @@ -42,6 +42,11 @@
"columnName": "avatar",
"affinity": "TEXT"
},
{
"fieldPath": "phones",
"columnName": "phones",
"affinity": "TEXT"
},
{
"fieldPath": "card",
"columnName": "card",
Expand Down Expand Up @@ -165,7 +170,7 @@
],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'ffb48c9c7cbe144e782f7a50645505d8')"
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'd2186f80b68b770c4f4081c454b43377')"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ abstract class ApiRepositoryCore {
okHttpClient: OkHttpClient,
withSecurity: Boolean = false,
): ApiResponse<User> {
val with = if (withSecurity) "&with=security" else ""
val with = "&with=" + (if (withSecurity) "security," else "") + "phones"

val url = "${ApiRoutesCore.getUserProfile()}$with"
return ApiController.callApi(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ data class User(
val lastname: String,
val email: String,
val avatar: String?,
@SerializedName("card") @SerialName("card")
val phones: List<Phone>? = null,
val card: Card? = null,
val login: String,
@ColumnInfo(defaultValue = "false")
Expand Down
12 changes: 12 additions & 0 deletions Auth/src/main/kotlin/com/infomaniak/core/auth/room/UserDatabase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import com.google.gson.reflect.TypeToken
import com.infomaniak.core.auth.models.CurrentUserId
import com.infomaniak.core.auth.models.OrganizationAccount
import com.infomaniak.core.auth.models.user.Card
import com.infomaniak.core.auth.models.user.Phone
import com.infomaniak.core.auth.models.user.User
import splitties.init.appCtx

Expand Down Expand Up @@ -94,6 +95,7 @@ class UserConverter {

private val organizationAccountsType = object : TypeToken<ArrayList<OrganizationAccount>>() {}.type
private val cardType = object : TypeToken<Card>() {}.type
private val phonesType = object : TypeToken<List<Phone>>() {}.type

@TypeConverter
fun organizationsToJson(organizationAccounts: ArrayList<OrganizationAccount>): String {
Expand All @@ -114,4 +116,14 @@ class UserConverter {
fun toCard(json: String?): Card? {
return json?.let { gson.fromJson(it, cardType) }
}

@TypeConverter
fun phonesToJson(phones: List<Phone>?): String? {
return phones?.let { gson.toJson(it, phonesType) }
}

@TypeConverter
fun toPhones(json: String?): List<Phone>? {
return json?.let { gson.fromJson(it, phonesType) }
}
}
1 change: 1 addition & 0 deletions Ui/Compose/ContactCard/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dependencies {
implementation(project(":Ui:View:PrimaryPalette"))
implementation(project(":Ui:Compose:Margin"))
implementation(project(":Network"))
implementation(project(":Matomo"))

implementation(platform(core.compose.bom))
api(core.compose.runtime)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Infomaniak Core - Android
* Copyright (C) 2026 Infomaniak Network SA
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.infomaniak.core.ui.compose.contactcard

import com.infomaniak.core.matomo.Matomo

object ContactCardMatomo {
private const val CONTACT_CARD_CATEGORY = "contactCard"

private var matomoInstance: Matomo? = null

fun init(matomo: Matomo) {
matomoInstance = matomo
}

fun trackEvent(name: String) {
matomoInstance?.trackEvent(CONTACT_CARD_CATEGORY, name)
}

fun trackScreen(screenName: String) {
matomoInstance?.trackScreen(path = screenName, title = screenName)
}
}
Loading
Loading