-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Conversations and Profile Views are reported individually
- Loading branch information
Showing
4 changed files
with
92 additions
and
7 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
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
27 changes: 27 additions & 0 deletions
27
core/analytics-enabled/src/main/kotlin/com/wire/android/feature/analytics/StringExt.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,27 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2025 Wire Swiss GmbH | ||
* | ||
* 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.wire.android.feature.analytics | ||
|
||
/** | ||
* Converts a snake_case string to camelCase. | ||
*/ | ||
fun String.convertToCamelCase(): String { | ||
return this | ||
.split('_') | ||
.joinToString("") { it.replaceFirstChar { char -> char.uppercase() } } | ||
} |
49 changes: 49 additions & 0 deletions
49
core/analytics-enabled/src/test/kotlin/com/wire/android/feature/analytics/StringExtTest.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,49 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2025 Wire Swiss GmbH | ||
* | ||
* 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.wire.android.feature.analytics | ||
|
||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
|
||
class StringExtTest { | ||
|
||
@Test | ||
fun `given single word string when converted then same string`() { | ||
assertEquals("Username", "username".convertToCamelCase()) | ||
} | ||
|
||
@Test | ||
fun `given string with multiple underscores when converted then camel case string`() { | ||
assertEquals("ThisIsATestCase", ("this_is_a_test_case").convertToCamelCase()) | ||
} | ||
|
||
@Test | ||
fun `given empty string when converted then empty string`() { | ||
assertEquals("", ("").convertToCamelCase()) | ||
} | ||
|
||
@Test | ||
fun `given string with leading and trailing underscores when converted then camel case string`() { | ||
assertEquals("LeadingAndTrailing", ("_leading_and_trailing_").convertToCamelCase()) | ||
} | ||
|
||
@Test | ||
fun `given string with numbers when converted then camel case string`() { | ||
assertEquals("User123Name", ("user_123_name").convertToCamelCase()) | ||
} | ||
} |