This repository has been archived by the owner on Sep 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Android] Fix missing link action updates in compose library (#804)
- Loading branch information
1 parent
6c0e129
commit a75603d
Showing
15 changed files
with
180 additions
and
26 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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
29 changes: 29 additions & 0 deletions
29
...ompose/src/androidTest/java/io/element/android/wysiwyg/compose/testutils/EditorActions.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,29 @@ | ||
package io.element.android.wysiwyg.compose.testutils | ||
|
||
import android.view.View | ||
import androidx.appcompat.widget.AppCompatEditText | ||
import androidx.test.espresso.UiController | ||
import androidx.test.espresso.ViewAction | ||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed | ||
import org.hamcrest.Matcher | ||
|
||
object Editor { | ||
class SetSelection( | ||
private val start: Int, | ||
private val end: Int, | ||
) : ViewAction { | ||
override fun getConstraints(): Matcher<View> = isDisplayed() | ||
|
||
override fun getDescription(): String = "Set selection to $start, $end" | ||
|
||
override fun perform(uiController: UiController?, view: View?) { | ||
val editor = view as? AppCompatEditText ?: return | ||
editor.setSelection(start, end) | ||
} | ||
} | ||
|
||
} | ||
|
||
object EditorActions { | ||
fun setSelection(start: Int, end: Int) = Editor.SetSelection(start, end) | ||
} |
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
13 changes: 13 additions & 0 deletions
13
...id/library/src/main/java/io/element/android/wysiwyg/internal/view/models/LinkActionExt.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,13 @@ | ||
package io.element.android.wysiwyg.internal.view.models | ||
|
||
|
||
import io.element.android.wysiwyg.view.models.LinkAction | ||
import uniffi.wysiwyg_composer.LinkAction as InternalLinkAction | ||
|
||
internal fun InternalLinkAction.toApiModel(): LinkAction? = | ||
when (this) { | ||
is InternalLinkAction.Edit -> LinkAction.SetLink(currentUrl = url) | ||
is InternalLinkAction.Create -> LinkAction.SetLink(currentUrl = null) | ||
is InternalLinkAction.CreateWithText -> LinkAction.InsertLink | ||
is InternalLinkAction.Disabled -> null | ||
} |
Oops, something went wrong.