-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: added alternative route to fetch screen name for automatic track…
…ing (#92)
- Loading branch information
Showing
10 changed files
with
33 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,4 +40,3 @@ interface Action<T : Any> { | |
fun onResult(result: Result<T>) | ||
} | ||
} | ||
|
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 |
---|---|---|
|
@@ -39,4 +39,3 @@ public interface Call<T : Any> { | |
public fun onResult(result: Result<T>) | ||
} | ||
} | ||
|
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 |
---|---|---|
|
@@ -46,7 +46,5 @@ abstract class ActionUtils { | |
override fun cancel() {} | ||
} | ||
} | ||
|
||
} | ||
|
||
} |
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
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 |
---|---|---|
|
@@ -78,4 +78,3 @@ class CustomerIOPushReceiver : BroadcastReceiver() { | |
} | ||
} | ||
} | ||
|
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
9 changes: 9 additions & 0 deletions
9
sdk/src/main/java/io/customer/sdk/extensions/StringExtensions.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,9 @@ | ||
package io.customer.sdk.extensions | ||
|
||
fun String.getScreenNameFromActivity(): String { | ||
val regex = Regex( | ||
pattern = "Activity|ListActivity|FragmentActivity|DialogActivity", | ||
option = RegexOption.IGNORE_CASE | ||
) | ||
return this.replace(regex, "") | ||
} |
18 changes: 18 additions & 0 deletions
18
sdk/src/test/java/io/customer/sdk/extensions/StringExtensionsTest.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,18 @@ | ||
package io.customer.sdk.extensions | ||
|
||
import org.amshove.kluent.shouldBeEqualTo | ||
import org.junit.Test | ||
|
||
internal class StringExtensionsTest { | ||
|
||
@Test | ||
fun verify_activityScreenFormatting_expectFormattedScreenName() { | ||
|
||
"HomeActivity".getScreenNameFromActivity() shouldBeEqualTo "Home" | ||
"ActivityHome".getScreenNameFromActivity() shouldBeEqualTo "Home" | ||
"ActivityHomeActivity".getScreenNameFromActivity() shouldBeEqualTo "Home" | ||
"ItemsListActivity".getScreenNameFromActivity() shouldBeEqualTo "Items" | ||
"ItemsDialogActivity".getScreenNameFromActivity() shouldBeEqualTo "Items" | ||
"MapFragmentActivity".getScreenNameFromActivity() shouldBeEqualTo "Map" | ||
} | ||
} |