mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Formats entire project
This commit is contained in:
parent
7f3e72b9cb
commit
de899bbb18
@ -37,7 +37,7 @@ interface ImageLoaderTarget {
|
||||
}
|
||||
|
||||
internal class DefaultImageLoaderTarget(val holder: AnimatedImageViewHolder, private val contextView: ImageView) :
|
||||
ImageLoaderTarget {
|
||||
ImageLoaderTarget {
|
||||
override fun contextView(): ImageView {
|
||||
return contextView
|
||||
}
|
||||
|
@ -27,9 +27,9 @@ import com.airbnb.mvrx.Mavericks
|
||||
class JSonViewerDialog : DialogFragment() {
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
return inflater.inflate(R.layout.fragment_dialog_jv, container, false)
|
||||
}
|
||||
@ -39,15 +39,15 @@ class JSonViewerDialog : DialogFragment() {
|
||||
val args: JSonViewerFragmentArgs = arguments?.getParcelable(Mavericks.KEY_ARG) ?: return
|
||||
if (savedInstanceState == null) {
|
||||
childFragmentManager.beginTransaction()
|
||||
.replace(
|
||||
R.id.fragmentContainer, JSonViewerFragment.newInstance(
|
||||
args.jsonString,
|
||||
args.defaultOpenDepth,
|
||||
true,
|
||||
args.styleProvider
|
||||
.replace(
|
||||
R.id.fragmentContainer, JSonViewerFragment.newInstance(
|
||||
args.jsonString,
|
||||
args.defaultOpenDepth,
|
||||
true,
|
||||
args.styleProvider
|
||||
)
|
||||
)
|
||||
.commitNow()
|
||||
)
|
||||
.commitNow()
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,13 +63,13 @@ class JSonViewerDialog : DialogFragment() {
|
||||
|
||||
companion object {
|
||||
fun newInstance(
|
||||
jsonString: String,
|
||||
initialOpenDepth: Int = -1,
|
||||
styleProvider: JSonViewerStyleProvider? = null
|
||||
jsonString: String,
|
||||
initialOpenDepth: Int = -1,
|
||||
styleProvider: JSonViewerStyleProvider? = null
|
||||
): JSonViewerDialog {
|
||||
val args = Bundle()
|
||||
val parcelableArgs =
|
||||
JSonViewerFragmentArgs(jsonString, initialOpenDepth, false, styleProvider)
|
||||
JSonViewerFragmentArgs(jsonString, initialOpenDepth, false, styleProvider)
|
||||
args.putParcelable(Mavericks.KEY_ARG, parcelableArgs)
|
||||
return JSonViewerDialog().apply { arguments = args }
|
||||
}
|
||||
|
@ -32,10 +32,10 @@ import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
internal data class JSonViewerFragmentArgs(
|
||||
val jsonString: String,
|
||||
val defaultOpenDepth: Int,
|
||||
val wrap: Boolean,
|
||||
val styleProvider: JSonViewerStyleProvider?
|
||||
val jsonString: String,
|
||||
val defaultOpenDepth: Int,
|
||||
val wrap: Boolean,
|
||||
val styleProvider: JSonViewerStyleProvider?
|
||||
) : Parcelable
|
||||
|
||||
class JSonViewerFragment : Fragment(), MavericksView {
|
||||
@ -49,20 +49,20 @@ class JSonViewerFragment : Fragment(), MavericksView {
|
||||
private lateinit var recyclerView: EpoxyRecyclerView
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
val args: JSonViewerFragmentArgs? = arguments?.getParcelable(Mavericks.KEY_ARG)
|
||||
val inflate =
|
||||
if (args?.wrap == true) {
|
||||
inflater.inflate(R.layout.fragment_jv_recycler_view_wrap, container, false)
|
||||
} else {
|
||||
inflater.inflate(R.layout.fragment_jv_recycler_view, container, false)
|
||||
}
|
||||
if (args?.wrap == true) {
|
||||
inflater.inflate(R.layout.fragment_jv_recycler_view_wrap, container, false)
|
||||
} else {
|
||||
inflater.inflate(R.layout.fragment_jv_recycler_view, container, false)
|
||||
}
|
||||
recyclerView = inflate.findViewById(R.id.jvRecyclerView)
|
||||
recyclerView.layoutManager =
|
||||
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
||||
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
||||
recyclerView.setController(epoxyController)
|
||||
epoxyController.setStyle(args?.styleProvider)
|
||||
registerForContextMenu(recyclerView)
|
||||
@ -79,21 +79,21 @@ class JSonViewerFragment : Fragment(), MavericksView {
|
||||
|
||||
companion object {
|
||||
fun newInstance(
|
||||
jsonString: String,
|
||||
initialOpenDepth: Int = -1,
|
||||
wrap: Boolean = false,
|
||||
styleProvider: JSonViewerStyleProvider? = null
|
||||
jsonString: String,
|
||||
initialOpenDepth: Int = -1,
|
||||
wrap: Boolean = false,
|
||||
styleProvider: JSonViewerStyleProvider? = null
|
||||
): JSonViewerFragment {
|
||||
return JSonViewerFragment().apply {
|
||||
arguments = Bundle().apply {
|
||||
putParcelable(
|
||||
Mavericks.KEY_ARG,
|
||||
JSonViewerFragmentArgs(
|
||||
jsonString,
|
||||
initialOpenDepth,
|
||||
wrap,
|
||||
styleProvider
|
||||
)
|
||||
Mavericks.KEY_ARG,
|
||||
JSonViewerFragmentArgs(
|
||||
jsonString,
|
||||
initialOpenDepth,
|
||||
wrap,
|
||||
styleProvider
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ internal interface Composed {
|
||||
}
|
||||
|
||||
internal class JSonViewerObject(key: String?, index: Int?, jObject: JSONObject) :
|
||||
JSonViewerModel(key, index, jObject),
|
||||
Composed {
|
||||
JSonViewerModel(key, index, jObject),
|
||||
Composed {
|
||||
|
||||
var keys = LinkedHashMap<String, JSonViewerModel>()
|
||||
|
||||
@ -41,7 +41,7 @@ internal class JSonViewerObject(key: String?, index: Int?, jObject: JSONObject)
|
||||
}
|
||||
|
||||
internal class JSonViewerArray(key: String?, index: Int?, jObject: JSONArray) :
|
||||
JSonViewerModel(key, index, jObject), Composed {
|
||||
JSonViewerModel(key, index, jObject), Composed {
|
||||
var items = ArrayList<JSonViewerModel>()
|
||||
|
||||
override fun addChild(model: JSonViewerModel) {
|
||||
@ -50,7 +50,7 @@ internal class JSonViewerArray(key: String?, index: Int?, jObject: JSONArray) :
|
||||
}
|
||||
|
||||
internal class JSonViewerLeaf(key: String?, index: Int?, val stringRes: String, val type: JSONType) :
|
||||
JSonViewerModel(key, index, stringRes)
|
||||
JSonViewerModel(key, index, stringRes)
|
||||
|
||||
internal enum class JSONType {
|
||||
STRING,
|
||||
@ -75,41 +75,41 @@ internal object ModelParser {
|
||||
when (obj) {
|
||||
is JSONObject -> {
|
||||
val objectComposed = JSonViewerObject(key, index, obj)
|
||||
.apply { isExpanded = initialOpenDepth == -1 || depth <= initialOpenDepth }
|
||||
.apply { isExpanded = initialOpenDepth == -1 || depth <= initialOpenDepth }
|
||||
objectComposed.depth = depth
|
||||
obj.keys().forEach {
|
||||
eval(objectComposed, it, null, obj.get(it), depth + 1, initialOpenDepth)
|
||||
}
|
||||
parent.addChild(objectComposed)
|
||||
}
|
||||
is JSONArray -> {
|
||||
is JSONArray -> {
|
||||
val objectComposed = JSonViewerArray(key, index, obj)
|
||||
.apply { isExpanded = initialOpenDepth == -1 || depth <= initialOpenDepth }
|
||||
.apply { isExpanded = initialOpenDepth == -1 || depth <= initialOpenDepth }
|
||||
objectComposed.depth = depth
|
||||
for (i in 0 until obj.length()) {
|
||||
eval(objectComposed, null, i, obj[i], depth + 1, initialOpenDepth)
|
||||
}
|
||||
parent.addChild(objectComposed)
|
||||
}
|
||||
is String -> {
|
||||
JSonViewerLeaf(key, index, obj, JSONType.STRING).let {
|
||||
is String -> {
|
||||
JSonViewerLeaf(key, index, obj, JSONType.STRING).let {
|
||||
it.depth = depth
|
||||
parent.addChild(it)
|
||||
}
|
||||
}
|
||||
is Number -> {
|
||||
is Number -> {
|
||||
JSonViewerLeaf(key, index, obj.toString(), JSONType.NUMBER).let {
|
||||
it.depth = depth
|
||||
parent.addChild(it)
|
||||
}
|
||||
}
|
||||
is Boolean -> {
|
||||
is Boolean -> {
|
||||
JSonViewerLeaf(key, index, obj.toString(), JSONType.BOOLEAN).let {
|
||||
it.depth = depth
|
||||
parent.addChild(it)
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
else -> {
|
||||
if (obj == JSONObject.NULL) {
|
||||
JSonViewerLeaf(key, index, "null", JSONType.NULL).let {
|
||||
it.depth = depth
|
||||
|
@ -24,22 +24,22 @@ import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class JSonViewerStyleProvider(
|
||||
@ColorInt val keyColor: Int,
|
||||
@ColorInt val stringColor: Int,
|
||||
@ColorInt val booleanColor: Int,
|
||||
@ColorInt val numberColor: Int,
|
||||
@ColorInt val baseColor: Int,
|
||||
@ColorInt val secondaryColor: Int
|
||||
@ColorInt val keyColor: Int,
|
||||
@ColorInt val stringColor: Int,
|
||||
@ColorInt val booleanColor: Int,
|
||||
@ColorInt val numberColor: Int,
|
||||
@ColorInt val baseColor: Int,
|
||||
@ColorInt val secondaryColor: Int
|
||||
) : Parcelable {
|
||||
|
||||
companion object {
|
||||
fun default(context: Context) = JSonViewerStyleProvider(
|
||||
keyColor = ContextCompat.getColor(context, R.color.key_color),
|
||||
stringColor = ContextCompat.getColor(context, R.color.string_color),
|
||||
booleanColor = ContextCompat.getColor(context, R.color.bool_color),
|
||||
numberColor = ContextCompat.getColor(context, R.color.number_color),
|
||||
baseColor = ContextCompat.getColor(context, R.color.base_color),
|
||||
secondaryColor = ContextCompat.getColor(context, R.color.secondary_color)
|
||||
keyColor = ContextCompat.getColor(context, R.color.key_color),
|
||||
stringColor = ContextCompat.getColor(context, R.color.string_color),
|
||||
booleanColor = ContextCompat.getColor(context, R.color.bool_color),
|
||||
numberColor = ContextCompat.getColor(context, R.color.number_color),
|
||||
baseColor = ContextCompat.getColor(context, R.color.base_color),
|
||||
secondaryColor = ContextCompat.getColor(context, R.color.secondary_color)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -28,11 +28,11 @@ import com.airbnb.mvrx.ViewModelContext
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
internal data class JSonViewerState(
|
||||
val root: Async<JSonViewerObject> = Uninitialized
|
||||
val root: Async<JSonViewerObject> = Uninitialized
|
||||
) : MavericksState
|
||||
|
||||
internal class JSonViewerViewModel(initialState: JSonViewerState) :
|
||||
MavericksViewModel<JSonViewerState>(initialState) {
|
||||
MavericksViewModel<JSonViewerState>(initialState) {
|
||||
|
||||
fun setJsonSource(json: String, initialOpenDepth: Int) {
|
||||
setState {
|
||||
@ -43,14 +43,14 @@ internal class JSonViewerViewModel(initialState: JSonViewerState) :
|
||||
ModelParser.fromJsonString(json, initialOpenDepth).let {
|
||||
setState {
|
||||
copy(
|
||||
root = Success(it)
|
||||
root = Success(it)
|
||||
)
|
||||
}
|
||||
}
|
||||
} catch (error: Throwable) {
|
||||
setState {
|
||||
copy(
|
||||
root = Fail(error)
|
||||
root = Fail(error)
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -64,7 +64,7 @@ internal class JSonViewerViewModel(initialState: JSonViewerState) :
|
||||
val arg: JSonViewerFragmentArgs = viewModelContext.args()
|
||||
return try {
|
||||
JSonViewerState(
|
||||
Success(ModelParser.fromJsonString(arg.jsonString, arg.defaultOpenDepth))
|
||||
Success(ModelParser.fromJsonString(arg.jsonString, arg.defaultOpenDepth))
|
||||
)
|
||||
} catch (failure: Throwable) {
|
||||
JSonViewerState(Fail(failure))
|
||||
|
@ -22,9 +22,9 @@ import android.util.TypedValue
|
||||
internal object Utils {
|
||||
fun dpToPx(dp: Int, context: Context): Int {
|
||||
return TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
dp.toFloat(),
|
||||
context.resources.displayMetrics
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
dp.toFloat(),
|
||||
context.resources.displayMetrics
|
||||
).toInt()
|
||||
}
|
||||
}
|
||||
|
@ -71,14 +71,14 @@ internal abstract class ValueItem : EpoxyModelWithHolder<ValueItem.Holder>() {
|
||||
}
|
||||
|
||||
override fun onCreateContextMenu(
|
||||
menu: ContextMenu?,
|
||||
v: View?,
|
||||
menuInfo: ContextMenu.ContextMenuInfo?
|
||||
menu: ContextMenu?,
|
||||
v: View?,
|
||||
menuInfo: ContextMenu.ContextMenuInfo?
|
||||
) {
|
||||
if (copyValue != null) {
|
||||
val menuItem = menu?.add(R.string.copy_value)
|
||||
val clipService =
|
||||
v?.context?.getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager
|
||||
v?.context?.getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager
|
||||
menuItem?.setOnMenuItemClickListener {
|
||||
clipService?.setPrimaryClip(ClipData.newPlainText("", copyValue))
|
||||
true
|
||||
|
@ -31,15 +31,15 @@ class MultiPicker<T> {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun <T> get(type: MultiPicker<T>): T {
|
||||
return when (type) {
|
||||
IMAGE -> ImagePicker() as T
|
||||
VIDEO -> VideoPicker() as T
|
||||
MEDIA -> MediaPicker() as T
|
||||
FILE -> FilePicker() as T
|
||||
AUDIO -> AudioPicker() as T
|
||||
CONTACT -> ContactPicker() as T
|
||||
CAMERA -> CameraPicker() as T
|
||||
CAMERA_VIDEO -> CameraVideoPicker() as T
|
||||
else -> throw IllegalArgumentException("Unsupported type $type")
|
||||
IMAGE -> ImagePicker() as T
|
||||
VIDEO -> VideoPicker() as T
|
||||
MEDIA -> MediaPicker() as T
|
||||
FILE -> FilePicker() as T
|
||||
AUDIO -> AudioPicker() as T
|
||||
CONTACT -> ContactPicker() as T
|
||||
CAMERA -> CameraPicker() as T
|
||||
CAMERA_VIDEO -> CameraVideoPicker() as T
|
||||
else -> throw IllegalArgumentException("Unsupported type $type")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -108,12 +108,14 @@ class FlowRoom(private val room: Room) {
|
||||
room.getAllThreadSummaries()
|
||||
}
|
||||
}
|
||||
|
||||
fun liveThreadList(): Flow<List<ThreadRootEvent>> {
|
||||
return room.getAllThreadsLive().asFlow()
|
||||
.startWith(room.coroutineDispatchers.io) {
|
||||
room.getAllThreads()
|
||||
}
|
||||
}
|
||||
|
||||
fun liveLocalUnreadThreadList(): Flow<List<ThreadRootEvent>> {
|
||||
return room.getMarkedThreadNotificationsLive().asFlow()
|
||||
.startWith(room.coroutineDispatchers.io) {
|
||||
|
@ -110,11 +110,13 @@ class XSigningTest : InstrumentedTest {
|
||||
}
|
||||
}, it)
|
||||
}
|
||||
testHelper.doSync<Unit> { bobSession.cryptoService().crossSigningService().initializeCrossSigning(object : UserInteractiveAuthInterceptor {
|
||||
override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation<UIABaseAuth>) {
|
||||
promise.resume(bobAuthParams)
|
||||
}
|
||||
}, it) }
|
||||
testHelper.doSync<Unit> {
|
||||
bobSession.cryptoService().crossSigningService().initializeCrossSigning(object : UserInteractiveAuthInterceptor {
|
||||
override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation<UIABaseAuth>) {
|
||||
promise.resume(bobAuthParams)
|
||||
}
|
||||
}, it)
|
||||
}
|
||||
|
||||
// Check that alice can see bob keys
|
||||
testHelper.doSync<MXUsersDevicesMap<CryptoDeviceInfo>> { aliceSession.cryptoService().downloadKeys(listOf(bobSession.myUserId), true, it) }
|
||||
@ -149,16 +151,20 @@ class XSigningTest : InstrumentedTest {
|
||||
password = TestConstants.PASSWORD
|
||||
)
|
||||
|
||||
testHelper.doSync<Unit> { aliceSession.cryptoService().crossSigningService().initializeCrossSigning(object : UserInteractiveAuthInterceptor {
|
||||
override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation<UIABaseAuth>) {
|
||||
promise.resume(aliceAuthParams)
|
||||
}
|
||||
}, it) }
|
||||
testHelper.doSync<Unit> { bobSession.cryptoService().crossSigningService().initializeCrossSigning(object : UserInteractiveAuthInterceptor {
|
||||
override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation<UIABaseAuth>) {
|
||||
promise.resume(bobAuthParams)
|
||||
}
|
||||
}, it) }
|
||||
testHelper.doSync<Unit> {
|
||||
aliceSession.cryptoService().crossSigningService().initializeCrossSigning(object : UserInteractiveAuthInterceptor {
|
||||
override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation<UIABaseAuth>) {
|
||||
promise.resume(aliceAuthParams)
|
||||
}
|
||||
}, it)
|
||||
}
|
||||
testHelper.doSync<Unit> {
|
||||
bobSession.cryptoService().crossSigningService().initializeCrossSigning(object : UserInteractiveAuthInterceptor {
|
||||
override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation<UIABaseAuth>) {
|
||||
promise.resume(bobAuthParams)
|
||||
}
|
||||
}, it)
|
||||
}
|
||||
|
||||
// Check that alice can see bob keys
|
||||
val bobUserId = bobSession.myUserId
|
||||
|
@ -155,8 +155,8 @@ class VerificationTest : InstrumentedTest {
|
||||
bobSupportedMethods: List<VerificationMethod>,
|
||||
expectedResultForAlice: ExpectedResult,
|
||||
expectedResultForBob: ExpectedResult) {
|
||||
val testHelper = CommonTestHelper(context())
|
||||
val cryptoTestHelper = CryptoTestHelper(testHelper)
|
||||
val testHelper = CommonTestHelper(context())
|
||||
val cryptoTestHelper = CryptoTestHelper(testHelper)
|
||||
val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
|
||||
|
||||
val aliceSession = cryptoTestData.firstSession
|
||||
|
@ -37,7 +37,7 @@ import javax.inject.Inject
|
||||
*/
|
||||
@MatrixScope
|
||||
internal class CurlLoggingInterceptor @Inject constructor() :
|
||||
Interceptor {
|
||||
Interceptor {
|
||||
|
||||
/**
|
||||
* Set any additional curl command options (see 'curl --help').
|
||||
|
@ -45,9 +45,9 @@ interface FileService {
|
||||
* Result will be a decrypted file, stored in the cache folder. url parameter will be used to create unique filename to avoid name collision.
|
||||
*/
|
||||
suspend fun downloadFile(fileName: String,
|
||||
mimeType: String?,
|
||||
url: String?,
|
||||
elementToDecrypt: ElementToDecrypt?): File
|
||||
mimeType: String?,
|
||||
url: String?,
|
||||
elementToDecrypt: ElementToDecrypt?): File
|
||||
|
||||
suspend fun downloadFile(messageContent: MessageWithAttachmentContent): File =
|
||||
downloadFile(
|
||||
|
@ -43,6 +43,7 @@ interface SyncStatusService {
|
||||
val rooms: Int,
|
||||
val toDevice: Int
|
||||
) : IncrementalSyncStatus()
|
||||
|
||||
object IncrementalSyncError : IncrementalSyncStatus()
|
||||
object IncrementalSyncDone : IncrementalSyncStatus()
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ object MatrixLinkify {
|
||||
MatrixPatterns.isRoomId(url) ||
|
||||
MatrixPatterns.isGroupId(url) ||
|
||||
MatrixPatterns.isEventId(url)) {
|
||||
url = PermalinkService.MATRIX_TO_URL_BASE + url
|
||||
url = PermalinkService.MATRIX_TO_URL_BASE + url
|
||||
}
|
||||
val span = MatrixPermalinkSpan(url, callback)
|
||||
spannable.setSpan(span, startPos, endPos, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
|
@ -35,21 +35,21 @@ sealed class PermalinkData {
|
||||
|
||||
/**
|
||||
* &room_name=Team2
|
||||
&room_avatar_url=mxc:
|
||||
&inviter_name=bob
|
||||
&room_avatar_url=mxc:
|
||||
&inviter_name=bob
|
||||
*/
|
||||
@Parcelize
|
||||
data class RoomEmailInviteLink(
|
||||
val roomId: String,
|
||||
val email: String,
|
||||
val signUrl: String,
|
||||
val roomName: String?,
|
||||
val roomAvatarUrl: String?,
|
||||
val inviterName: String?,
|
||||
val identityServer: String,
|
||||
val token: String,
|
||||
val privateKey: String,
|
||||
val roomType: String?
|
||||
val roomId: String,
|
||||
val email: String,
|
||||
val signUrl: String,
|
||||
val roomName: String?,
|
||||
val roomAvatarUrl: String?,
|
||||
val inviterName: String?,
|
||||
val identityServer: String,
|
||||
val token: String,
|
||||
val privateKey: String,
|
||||
val roomType: String?
|
||||
) : PermalinkData(), Parcelable
|
||||
|
||||
data class UserLink(val userId: String) : PermalinkData()
|
||||
|
@ -36,10 +36,10 @@ data class RoomJoinRulesContent(
|
||||
@Json(name = "allow") val allowList: List<RoomJoinRulesAllowEntry>? = null
|
||||
) {
|
||||
val joinRules: RoomJoinRules? = when (_joinRules) {
|
||||
"public" -> RoomJoinRules.PUBLIC
|
||||
"invite" -> RoomJoinRules.INVITE
|
||||
"knock" -> RoomJoinRules.KNOCK
|
||||
"private" -> RoomJoinRules.PRIVATE
|
||||
"public" -> RoomJoinRules.PUBLIC
|
||||
"invite" -> RoomJoinRules.INVITE
|
||||
"knock" -> RoomJoinRules.KNOCK
|
||||
"private" -> RoomJoinRules.PRIVATE
|
||||
"restricted" -> RoomJoinRules.RESTRICTED
|
||||
else -> {
|
||||
Timber.w("Invalid value for RoomJoinRules: `$_joinRules`")
|
||||
|
@ -44,7 +44,7 @@ data class CallAnswerContent(
|
||||
* Capability advertisement.
|
||||
*/
|
||||
@Json(name = "capabilities") val capabilities: CallCapabilities? = null
|
||||
) : CallSignalingContent {
|
||||
) : CallSignalingContent {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Answer(
|
||||
|
@ -55,7 +55,7 @@ data class CallInviteContent(
|
||||
*/
|
||||
@Json(name = "capabilities") val capabilities: CallCapabilities? = null
|
||||
|
||||
) : CallSignalingContent {
|
||||
) : CallSignalingContent {
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Offer(
|
||||
/**
|
||||
|
@ -47,7 +47,7 @@ data class CallNegotiateContent(
|
||||
*/
|
||||
@Json(name = "version") override val version: String?
|
||||
|
||||
) : CallSignalingContent {
|
||||
) : CallSignalingContent {
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Description(
|
||||
/**
|
||||
|
@ -61,7 +61,7 @@ data class CallReplacesContent(
|
||||
* Required. The version of the VoIP specification this messages adheres to.
|
||||
*/
|
||||
@Json(name = "version") override val version: String?
|
||||
) : CallSignalingContent {
|
||||
) : CallSignalingContent {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class TargetUser(
|
||||
|
@ -52,5 +52,5 @@ data class FileInfo(
|
||||
* Get the url of the encrypted thumbnail or of the thumbnail
|
||||
*/
|
||||
fun FileInfo.getThumbnailUrl(): String? {
|
||||
return thumbnailFile?.url ?: thumbnailUrl
|
||||
return thumbnailFile?.url ?: thumbnailUrl
|
||||
}
|
||||
|
@ -62,5 +62,5 @@ data class ImageInfo(
|
||||
* Get the url of the encrypted thumbnail or of the thumbnail
|
||||
*/
|
||||
fun ImageInfo.getThumbnailUrl(): String? {
|
||||
return thumbnailFile?.url ?: thumbnailUrl
|
||||
return thumbnailFile?.url ?: thumbnailUrl
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import org.matrix.android.sdk.internal.crypto.verification.VerificationInfoReque
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class MessageVerificationRequestContent(
|
||||
@Json(name = MessageContent.MSG_TYPE_JSON_KEY)override val msgType: String = MessageType.MSGTYPE_VERIFICATION_REQUEST,
|
||||
@Json(name = MessageContent.MSG_TYPE_JSON_KEY) override val msgType: String = MessageType.MSGTYPE_VERIFICATION_REQUEST,
|
||||
@Json(name = "body") override val body: String,
|
||||
@Json(name = "from_device") override val fromDevice: String?,
|
||||
@Json(name = "methods") override val methods: List<String>,
|
||||
|
@ -27,7 +27,7 @@ data class MessageVideoContent(
|
||||
/**
|
||||
* Required. Must be 'm.video'.
|
||||
*/
|
||||
@Json(name = MessageContent.MSG_TYPE_JSON_KEY)override val msgType: String,
|
||||
@Json(name = MessageContent.MSG_TYPE_JSON_KEY) override val msgType: String,
|
||||
|
||||
/**
|
||||
* Required. A description of the video e.g. 'Gangnam style', or some kind of content description for accessibility e.g. 'video attachment'.
|
||||
|
@ -67,5 +67,5 @@ data class VideoInfo(
|
||||
* Get the url of the encrypted thumbnail or of the thumbnail
|
||||
*/
|
||||
fun VideoInfo.getThumbnailUrl(): String? {
|
||||
return thumbnailFile?.url ?: thumbnailUrl
|
||||
return thumbnailFile?.url ?: thumbnailUrl
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ sealed class SharedSecretStorageError(message: String?) : Throwable(message) {
|
||||
data class UnsupportedAlgorithm(val algorithm: String) : SharedSecretStorageError("Unknown algorithm $algorithm")
|
||||
data class SecretNotEncrypted(val secretName: String) : SharedSecretStorageError("Missing content for secret $secretName")
|
||||
data class SecretNotEncryptedWithKey(val secretName: String, val keyId: String) :
|
||||
SharedSecretStorageError("Missing content for secret $secretName with key $keyId")
|
||||
SharedSecretStorageError("Missing content for secret $secretName with key $keyId")
|
||||
|
||||
object BadKeyFormat : SharedSecretStorageError("Bad Key Format")
|
||||
object ParsingError : SharedSecretStorageError("parsing Error")
|
||||
|
@ -68,7 +68,7 @@ interface SpaceService {
|
||||
suggestedOnly: Boolean? = null,
|
||||
limit: Int? = null,
|
||||
from: String? = null,
|
||||
// when paginating, pass back the m.space.child state events
|
||||
// when paginating, pass back the m.space.child state events
|
||||
knownStateList: List<Event>? = null): SpaceHierarchyData
|
||||
|
||||
/**
|
||||
|
@ -37,7 +37,7 @@ import org.matrix.android.sdk.internal.worker.SessionWorkerParams
|
||||
import javax.inject.Inject
|
||||
|
||||
internal class CancelGossipRequestWorker(context: Context, params: WorkerParameters, sessionManager: SessionManager) :
|
||||
SessionSafeCoroutineWorker<CancelGossipRequestWorker.Params>(context, params, sessionManager, Params::class.java) {
|
||||
SessionSafeCoroutineWorker<CancelGossipRequestWorker.Params>(context, params, sessionManager, Params::class.java) {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
internal data class Params(
|
||||
|
@ -48,7 +48,7 @@ internal class CryptoSessionInfoProvider @Inject constructor(
|
||||
/**
|
||||
* @param allActive if true return joined as well as invited, if false, only joined
|
||||
*/
|
||||
fun getRoomUserIds(roomId: String, allActive: Boolean): List<String> {
|
||||
fun getRoomUserIds(roomId: String, allActive: Boolean): List<String> {
|
||||
var userIds: List<String> = emptyList()
|
||||
monarchy.doWithRealm { realm ->
|
||||
userIds = if (allActive) {
|
||||
|
@ -75,15 +75,15 @@ internal class InboundGroupSessionStore @Inject constructor(
|
||||
|
||||
@Synchronized
|
||||
fun getInboundGroupSession(sessionId: String, senderKey: String): InboundGroupSessionHolder? {
|
||||
val known = sessionCache[CacheKey(sessionId, senderKey)]
|
||||
Timber.tag(loggerTag.value).v("## Inbound: getInboundGroupSession $sessionId in cache ${known != null}")
|
||||
return known
|
||||
?: store.getInboundGroupSession(sessionId, senderKey)?.also {
|
||||
Timber.tag(loggerTag.value).v("## Inbound: getInboundGroupSession cache populate ${it.roomId}")
|
||||
sessionCache.put(CacheKey(sessionId, senderKey), InboundGroupSessionHolder(it))
|
||||
}?.let {
|
||||
InboundGroupSessionHolder(it)
|
||||
}
|
||||
val known = sessionCache[CacheKey(sessionId, senderKey)]
|
||||
Timber.tag(loggerTag.value).v("## Inbound: getInboundGroupSession $sessionId in cache ${known != null}")
|
||||
return known
|
||||
?: store.getInboundGroupSession(sessionId, senderKey)?.also {
|
||||
Timber.tag(loggerTag.value).v("## Inbound: getInboundGroupSession cache populate ${it.roomId}")
|
||||
sessionCache.put(CacheKey(sessionId, senderKey), InboundGroupSessionHolder(it))
|
||||
}?.let {
|
||||
InboundGroupSessionHolder(it)
|
||||
}
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
|
@ -116,7 +116,7 @@ internal class IncomingGossipingRequestManager @Inject constructor(
|
||||
Timber.i("## CRYPTO | GOSSIP onGossipingRequestEvent received type ${event.type} from user:${event.senderId}, content:$roomKeyShare")
|
||||
// val ageLocalTs = event.unsignedData?.age?.let { System.currentTimeMillis() - it }
|
||||
when (roomKeyShare?.action) {
|
||||
GossipingToDeviceObject.ACTION_SHARE_REQUEST -> {
|
||||
GossipingToDeviceObject.ACTION_SHARE_REQUEST -> {
|
||||
if (event.getClearType() == EventType.REQUEST_SECRET) {
|
||||
IncomingSecretShareRequest.fromEvent(event)?.let {
|
||||
if (event.senderId == credentials.userId && it.deviceId == credentials.deviceId) {
|
||||
@ -346,7 +346,7 @@ internal class IncomingGossipingRequestManager @Inject constructor(
|
||||
val isDeviceLocallyVerified = cryptoStore.getUserDevice(userId, deviceId)?.trustLevel?.isLocallyVerified()
|
||||
|
||||
when (secretName) {
|
||||
MASTER_KEY_SSSS_NAME -> cryptoStore.getCrossSigningPrivateKeys()?.master
|
||||
MASTER_KEY_SSSS_NAME -> cryptoStore.getCrossSigningPrivateKeys()?.master
|
||||
SELF_SIGNING_KEY_SSSS_NAME -> cryptoStore.getCrossSigningPrivateKeys()?.selfSigned
|
||||
USER_SIGNING_KEY_SSSS_NAME -> cryptoStore.getCrossSigningPrivateKeys()?.user
|
||||
KEYBACKUP_SECRET_SSSS_NAME -> cryptoStore.getKeyBackupRecoveryKeyInfo()?.recoveryKey
|
||||
|
@ -41,7 +41,7 @@ import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
internal class SendGossipRequestWorker(context: Context, params: WorkerParameters, sessionManager: SessionManager) :
|
||||
SessionSafeCoroutineWorker<SendGossipRequestWorker.Params>(context, params, sessionManager, Params::class.java) {
|
||||
SessionSafeCoroutineWorker<SendGossipRequestWorker.Params>(context, params, sessionManager, Params::class.java) {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
internal data class Params(
|
||||
|
@ -33,7 +33,7 @@ internal class MXOlmEncryption(
|
||||
private val messageEncrypter: MessageEncrypter,
|
||||
private val deviceListManager: DeviceListManager,
|
||||
private val ensureOlmSessionsForUsersAction: EnsureOlmSessionsForUsersAction) :
|
||||
IMXEncrypting {
|
||||
IMXEncrypting {
|
||||
|
||||
override suspend fun encryptEventContent(eventContent: Content, eventType: String, userIds: List<String>): Content {
|
||||
// pick the list of recipients based on the membership list.
|
||||
|
@ -174,7 +174,7 @@ internal class DefaultSharedSecretStorageService @Inject constructor(
|
||||
throw SharedSecretStorageError.UnknownAlgorithm(key.keyInfo.content.algorithm ?: "")
|
||||
}
|
||||
}
|
||||
is KeyInfoResult.Error -> throw key.error
|
||||
is KeyInfoResult.Error -> throw key.error
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,8 @@ internal open class CryptoRoomEntity(
|
||||
// a security to ensure that a room will never revert to not encrypted
|
||||
// even if a new state event with empty encryption, or state is reset somehow
|
||||
var wasEncryptedOnce: Boolean? = false
|
||||
) :
|
||||
RealmObject() {
|
||||
) :
|
||||
RealmObject() {
|
||||
|
||||
companion object
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ internal open class OlmInboundGroupSessionEntity(
|
||||
var olmInboundGroupSessionData: String? = null,
|
||||
// Indicate if the key has been backed up to the homeserver
|
||||
var backedUp: Boolean = false) :
|
||||
RealmObject() {
|
||||
RealmObject() {
|
||||
|
||||
fun getInboundGroupSession(): OlmInboundGroupSessionWrapper2? {
|
||||
return try {
|
||||
|
@ -30,7 +30,7 @@ internal open class OlmSessionEntity(@PrimaryKey var primaryKey: String = "",
|
||||
var deviceKey: String? = null,
|
||||
var olmSessionData: String? = null,
|
||||
var lastReceivedMessageTs: Long = 0) :
|
||||
RealmObject() {
|
||||
RealmObject() {
|
||||
|
||||
fun getOlmSession(): OlmSession? {
|
||||
return deserializeFromRealm(olmSessionData)
|
||||
|
@ -35,7 +35,7 @@ import javax.inject.Inject
|
||||
* Possible next worker : None
|
||||
*/
|
||||
internal class SendVerificationMessageWorker(context: Context, params: WorkerParameters, sessionManager: SessionManager) :
|
||||
SessionSafeCoroutineWorker<SendVerificationMessageWorker.Params>(context, params, sessionManager, Params::class.java) {
|
||||
SessionSafeCoroutineWorker<SendVerificationMessageWorker.Params>(context, params, sessionManager, Params::class.java) {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
internal data class Params(
|
||||
|
@ -296,13 +296,13 @@ internal class VerificationTransportRoomMessage(
|
||||
messageAuthenticationCode: String,
|
||||
shortAuthenticationStrings: List<String>): VerificationInfoAccept =
|
||||
MessageVerificationAcceptContent.create(
|
||||
tid,
|
||||
keyAgreementProtocol,
|
||||
hash,
|
||||
commitment,
|
||||
messageAuthenticationCode,
|
||||
shortAuthenticationStrings
|
||||
)
|
||||
tid,
|
||||
keyAgreementProtocol,
|
||||
hash,
|
||||
commitment,
|
||||
messageAuthenticationCode,
|
||||
shortAuthenticationStrings
|
||||
)
|
||||
|
||||
override fun createKey(tid: String, pubKey: String): VerificationInfoKey = MessageVerificationKeyContent.create(tid, pubKey)
|
||||
|
||||
|
@ -32,7 +32,7 @@ import javax.inject.Inject
|
||||
|
||||
internal class EventInsertLiveObserver @Inject constructor(@SessionDatabase realmConfiguration: RealmConfiguration,
|
||||
private val processors: Set<@JvmSuppressWildcards EventInsertLiveProcessor>) :
|
||||
RealmLiveEntityObserver<EventInsertEntity>(realmConfiguration) {
|
||||
RealmLiveEntityObserver<EventInsertEntity>(realmConfiguration) {
|
||||
|
||||
override val query = Monarchy.Query {
|
||||
it.where(EventInsertEntity::class.java).equalTo(EventInsertEntityFields.CAN_BE_PROCESSED, true)
|
||||
|
@ -35,7 +35,7 @@ import java.util.concurrent.atomic.AtomicReference
|
||||
internal interface LiveEntityObserver : SessionLifecycleObserver
|
||||
|
||||
internal abstract class RealmLiveEntityObserver<T : RealmObject>(protected val realmConfiguration: RealmConfiguration) :
|
||||
LiveEntityObserver, RealmChangeListener<RealmResults<T>> {
|
||||
LiveEntityObserver, RealmChangeListener<RealmResults<T>> {
|
||||
|
||||
private companion object {
|
||||
val BACKGROUND_HANDLER = createBackgroundHandler("LIVE_ENTITY_BACKGROUND")
|
||||
|
@ -33,7 +33,7 @@ import kotlin.concurrent.getOrSet
|
||||
*/
|
||||
@SessionScope
|
||||
internal class RealmSessionProvider @Inject constructor(@SessionDatabase private val monarchy: Monarchy) :
|
||||
SessionLifecycleObserver {
|
||||
SessionLifecycleObserver {
|
||||
|
||||
private val realmThreadLocal = ThreadLocal<Realm>()
|
||||
|
||||
|
@ -22,7 +22,7 @@ import org.matrix.android.sdk.internal.util.Normalizer
|
||||
import org.matrix.android.sdk.internal.util.database.RealmMigrator
|
||||
|
||||
internal class MigrateSessionTo019(realm: DynamicRealm,
|
||||
private val normalizer: Normalizer) : RealmMigrator(realm, 19) {
|
||||
private val normalizer: Normalizer) : RealmMigrator(realm, 19) {
|
||||
|
||||
override fun doMigrate(realm: DynamicRealm) {
|
||||
realm.schema.get("RoomSummaryEntity")
|
||||
|
@ -24,19 +24,20 @@ import io.realm.annotations.LinkingObjects
|
||||
import org.matrix.android.sdk.internal.extensions.assertIsManaged
|
||||
import org.matrix.android.sdk.internal.extensions.clearWith
|
||||
|
||||
internal open class ChunkEntity(@Index var prevToken: String? = null,
|
||||
internal open class ChunkEntity(
|
||||
@Index var prevToken: String? = null,
|
||||
// Because of gaps we can have several chunks with nextToken == null
|
||||
@Index var nextToken: String? = null,
|
||||
var prevChunk: ChunkEntity? = null,
|
||||
var nextChunk: ChunkEntity? = null,
|
||||
var stateEvents: RealmList<EventEntity> = RealmList(),
|
||||
var timelineEvents: RealmList<TimelineEventEntity> = RealmList(),
|
||||
@Index var nextToken: String? = null,
|
||||
var prevChunk: ChunkEntity? = null,
|
||||
var nextChunk: ChunkEntity? = null,
|
||||
var stateEvents: RealmList<EventEntity> = RealmList(),
|
||||
var timelineEvents: RealmList<TimelineEventEntity> = RealmList(),
|
||||
// Only one chunk will have isLastForward == true
|
||||
@Index var isLastForward: Boolean = false,
|
||||
@Index var isLastBackward: Boolean = false,
|
||||
@Index var isLastForward: Boolean = false,
|
||||
@Index var isLastBackward: Boolean = false,
|
||||
// Threads
|
||||
@Index var rootThreadEventId: String? = null,
|
||||
@Index var isLastForwardThread: Boolean = false,
|
||||
@Index var rootThreadEventId: String? = null,
|
||||
@Index var isLastForwardThread: Boolean = false,
|
||||
) : RealmObject() {
|
||||
|
||||
fun identifier() = "${prevToken}_$nextToken"
|
||||
|
@ -25,7 +25,7 @@ import org.matrix.android.sdk.api.session.room.model.Membership
|
||||
* Then GetGroupDataTask is called regularly to fetch group information from the homeserver.
|
||||
*/
|
||||
internal open class GroupEntity(@PrimaryKey var groupId: String = "") :
|
||||
RealmObject() {
|
||||
RealmObject() {
|
||||
|
||||
private var membershipStr: String = Membership.NONE.name
|
||||
var membership: Membership
|
||||
|
@ -48,8 +48,10 @@ internal open class RoomEntity(@PrimaryKey var roomId: String = "",
|
||||
set(value) {
|
||||
membersLoadStatusStr = value.name
|
||||
}
|
||||
|
||||
companion object
|
||||
}
|
||||
|
||||
internal fun RoomEntity.removeThreadSummaryIfNeeded(eventId: String) {
|
||||
assertIsManaged()
|
||||
threadSummaries.findRootOrLatest(eventId)?.let {
|
||||
|
@ -32,8 +32,8 @@ internal open class TimelineEventEntity(var localId: Long = 0,
|
||||
var isUniqueDisplayName: Boolean = false,
|
||||
var senderAvatar: String? = null,
|
||||
var senderMembershipEventId: String? = null,
|
||||
// ownedByThreadChunk indicates that the current TimelineEventEntity belongs
|
||||
// to a thread chunk and is a temporarily event.
|
||||
// ownedByThreadChunk indicates that the current TimelineEventEntity belongs
|
||||
// to a thread chunk and is a temporarily event.
|
||||
var ownedByThreadChunk: Boolean = false,
|
||||
var readReceipts: ReadReceiptsSummaryEntity? = null
|
||||
) : RealmObject() {
|
||||
|
@ -56,18 +56,21 @@ internal fun ChunkEntity.Companion.findLastForwardChunkOfRoom(realm: Realm, room
|
||||
.equalTo(ChunkEntityFields.IS_LAST_FORWARD, true)
|
||||
.findFirst()
|
||||
}
|
||||
|
||||
internal fun ChunkEntity.Companion.findLastForwardChunkOfThread(realm: Realm, roomId: String, rootThreadEventId: String): ChunkEntity? {
|
||||
return where(realm, roomId)
|
||||
.equalTo(ChunkEntityFields.ROOT_THREAD_EVENT_ID, rootThreadEventId)
|
||||
.equalTo(ChunkEntityFields.IS_LAST_FORWARD_THREAD, true)
|
||||
.findFirst()
|
||||
}
|
||||
|
||||
internal fun ChunkEntity.Companion.findEventInThreadChunk(realm: Realm, roomId: String, event: String): ChunkEntity? {
|
||||
return where(realm, roomId)
|
||||
.`in`(ChunkEntityFields.TIMELINE_EVENTS.EVENT_ID, arrayListOf(event).toTypedArray())
|
||||
.equalTo(ChunkEntityFields.IS_LAST_FORWARD_THREAD, true)
|
||||
.findFirst()
|
||||
}
|
||||
|
||||
internal fun ChunkEntity.Companion.findAllIncludingEvents(realm: Realm, eventIds: List<String>): RealmResults<ChunkEntity> {
|
||||
return realm.where<ChunkEntity>()
|
||||
.`in`(ChunkEntityFields.TIMELINE_EVENTS.EVENT_ID, eventIds.toTypedArray())
|
||||
|
@ -39,9 +39,11 @@ internal fun ThreadSummaryEntity.Companion.getOrCreate(realm: Realm, roomId: Str
|
||||
this.rootThreadEventId = rootThreadEventId
|
||||
}
|
||||
}
|
||||
|
||||
internal fun ThreadSummaryEntity.Companion.getOrNull(realm: Realm, roomId: String, rootThreadEventId: String): ThreadSummaryEntity? {
|
||||
return where(realm, roomId, rootThreadEventId).findFirst()
|
||||
}
|
||||
|
||||
internal fun RealmList<ThreadSummaryEntity>.find(rootThreadEventId: String): ThreadSummaryEntity? {
|
||||
return this.where()
|
||||
.equalTo(ThreadSummaryEntityFields.ROOT_THREAD_EVENT_ID, rootThreadEventId)
|
||||
|
@ -44,7 +44,7 @@ internal interface NetworkConnectivityChecker {
|
||||
internal class DefaultNetworkConnectivityChecker @Inject constructor(private val homeServerPinger: HomeServerPinger,
|
||||
private val backgroundDetectionObserver: BackgroundDetectionObserver,
|
||||
private val networkCallbackStrategy: NetworkCallbackStrategy) :
|
||||
NetworkConnectivityChecker {
|
||||
NetworkConnectivityChecker {
|
||||
|
||||
private val hasInternetAccess = AtomicBoolean(true)
|
||||
private val listeners = Collections.synchronizedSet(LinkedHashSet<NetworkConnectivityChecker.Listener>())
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
package org.matrix.android.sdk.internal.network
|
||||
|
||||
import org.matrix.android.sdk.internal.network.executeRequest as internalExecuteRequest
|
||||
|
||||
internal interface RequestExecutor {
|
||||
|
@ -123,7 +123,7 @@ internal class DefaultFileService @Inject constructor(
|
||||
val resolvedUrl = contentUrlResolver.resolveForDownload(url, elementToDecrypt) ?: throw IllegalArgumentException("url is null")
|
||||
|
||||
val request = when (resolvedUrl) {
|
||||
is ContentUrlResolver.ResolvedMethod.GET -> {
|
||||
is ContentUrlResolver.ResolvedMethod.GET -> {
|
||||
Request.Builder()
|
||||
.url(resolvedUrl.url)
|
||||
.header(DOWNLOAD_PROGRESS_INTERCEPTOR_HEADER, url)
|
||||
|
@ -30,7 +30,7 @@ private val loggerTag = LoggerTag("CallEventProcessor", LoggerTag.VOIP)
|
||||
|
||||
@SessionScope
|
||||
internal class CallEventProcessor @Inject constructor(private val callSignalingHandler: CallSignalingHandler) :
|
||||
EventInsertLiveProcessor {
|
||||
EventInsertLiveProcessor {
|
||||
|
||||
private val allowedTypes = listOf(
|
||||
EventType.CALL_ANSWER,
|
||||
|
@ -148,8 +148,8 @@ internal class FileUploader @Inject constructor(
|
||||
.post(requestBody)
|
||||
.build()
|
||||
|
||||
return withContext(coroutineDispatchers.io) {
|
||||
okHttpClient.newCall(request).awaitResponse().use { response ->
|
||||
return withContext(coroutineDispatchers.io) {
|
||||
okHttpClient.newCall(request).awaitResponse().use { response ->
|
||||
if (!response.isSuccessful) {
|
||||
throw response.toFailure(globalErrorReceiver)
|
||||
} else {
|
||||
|
@ -68,16 +68,16 @@ internal class ImageCompressor @Inject constructor(
|
||||
val orientation = exifInfo.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL)
|
||||
val matrix = Matrix()
|
||||
when (orientation) {
|
||||
ExifInterface.ORIENTATION_ROTATE_270 -> matrix.postRotate(270f)
|
||||
ExifInterface.ORIENTATION_ROTATE_180 -> matrix.postRotate(180f)
|
||||
ExifInterface.ORIENTATION_ROTATE_90 -> matrix.postRotate(90f)
|
||||
ExifInterface.ORIENTATION_ROTATE_270 -> matrix.postRotate(270f)
|
||||
ExifInterface.ORIENTATION_ROTATE_180 -> matrix.postRotate(180f)
|
||||
ExifInterface.ORIENTATION_ROTATE_90 -> matrix.postRotate(90f)
|
||||
ExifInterface.ORIENTATION_FLIP_HORIZONTAL -> matrix.preScale(-1f, 1f)
|
||||
ExifInterface.ORIENTATION_FLIP_VERTICAL -> matrix.preScale(1f, -1f)
|
||||
ExifInterface.ORIENTATION_TRANSPOSE -> {
|
||||
ExifInterface.ORIENTATION_FLIP_VERTICAL -> matrix.preScale(1f, -1f)
|
||||
ExifInterface.ORIENTATION_TRANSPOSE -> {
|
||||
matrix.preRotate(-90f)
|
||||
matrix.preScale(-1f, 1f)
|
||||
}
|
||||
ExifInterface.ORIENTATION_TRANSVERSE -> {
|
||||
ExifInterface.ORIENTATION_TRANSVERSE -> {
|
||||
matrix.preRotate(90f)
|
||||
matrix.preScale(-1f, 1f)
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import javax.inject.Inject
|
||||
|
||||
@SessionScope
|
||||
internal class DefaultSyncStatusService @Inject constructor() :
|
||||
SyncStatusService,
|
||||
SyncStatusService,
|
||||
ProgressReporter {
|
||||
|
||||
private val status = MutableLiveData<SyncStatusService.Status>()
|
||||
|
@ -59,7 +59,7 @@ internal class IntegrationManager @Inject constructor(matrixConfiguration: Matri
|
||||
private val updateUserAccountDataTask: UpdateUserAccountDataTask,
|
||||
private val accountDataDataSource: UserAccountDataDataSource,
|
||||
private val widgetFactory: WidgetFactory) :
|
||||
SessionLifecycleObserver {
|
||||
SessionLifecycleObserver {
|
||||
|
||||
private val currentConfigs = ArrayList<IntegrationManagerConfig>()
|
||||
private val lifecycleOwner: LifecycleOwner = LifecycleOwner { lifecycleRegistry }
|
||||
|
@ -26,7 +26,7 @@ import org.matrix.android.sdk.internal.worker.SessionWorkerParams
|
||||
import javax.inject.Inject
|
||||
|
||||
internal class AddPusherWorker(context: Context, params: WorkerParameters, sessionManager: SessionManager) :
|
||||
SessionSafeCoroutineWorker<AddPusherWorker.Params>(context, params, sessionManager, Params::class.java) {
|
||||
SessionSafeCoroutineWorker<AddPusherWorker.Params>(context, params, sessionManager, Params::class.java) {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
internal data class Params(
|
||||
|
@ -38,18 +38,18 @@ internal class DefaultUpdatePushRuleActionsTask @Inject constructor(
|
||||
) : UpdatePushRuleActionsTask {
|
||||
|
||||
override suspend fun execute(params: UpdatePushRuleActionsTask.Params) {
|
||||
executeRequest(globalErrorReceiver) {
|
||||
pushRulesApi.updateEnableRuleStatus(
|
||||
params.kind.value,
|
||||
params.ruleId,
|
||||
EnabledBody(params.enable)
|
||||
)
|
||||
}
|
||||
if (params.actions != null) {
|
||||
val body = mapOf("actions" to params.actions.toJson())
|
||||
executeRequest(globalErrorReceiver) {
|
||||
pushRulesApi.updateEnableRuleStatus(
|
||||
params.kind.value,
|
||||
params.ruleId,
|
||||
EnabledBody(params.enable)
|
||||
)
|
||||
}
|
||||
if (params.actions != null) {
|
||||
val body = mapOf("actions" to params.actions.toJson())
|
||||
executeRequest(globalErrorReceiver) {
|
||||
pushRulesApi.updateRuleActions(params.kind.value, params.ruleId, body)
|
||||
}
|
||||
pushRulesApi.updateRuleActions(params.kind.value, params.ruleId, body)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ internal class DefaultGetRoomIdByAliasTask @Inject constructor(
|
||||
} else if (!params.searchOnServer) {
|
||||
Optional.from(null)
|
||||
} else {
|
||||
val description = tryOrNull("## Failed to get roomId from alias") {
|
||||
val description = tryOrNull("## Failed to get roomId from alias") {
|
||||
executeRequest(globalErrorReceiver) {
|
||||
directoryAPI.getRoomIdByAlias(params.roomAlias)
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ import org.matrix.android.sdk.internal.di.SessionDatabase
|
||||
internal class DefaultRoomPushRuleService @AssistedInject constructor(@Assisted private val roomId: String,
|
||||
private val setRoomNotificationStateTask: SetRoomNotificationStateTask,
|
||||
@SessionDatabase private val monarchy: Monarchy) :
|
||||
RoomPushRuleService {
|
||||
RoomPushRuleService {
|
||||
|
||||
@AssistedFactory
|
||||
interface Factory {
|
||||
|
@ -38,7 +38,7 @@ internal interface SetRoomNotificationStateTask : Task<SetRoomNotificationStateT
|
||||
internal class DefaultSetRoomNotificationStateTask @Inject constructor(@SessionDatabase private val monarchy: Monarchy,
|
||||
private val removePushRuleTask: RemovePushRuleTask,
|
||||
private val addPushRuleTask: AddPushRuleTask) :
|
||||
SetRoomNotificationStateTask {
|
||||
SetRoomNotificationStateTask {
|
||||
|
||||
override suspend fun execute(params: SetRoomNotificationStateTask.Params) {
|
||||
val currentRoomPushRule = Realm.getInstance(monarchy.realmConfiguration).use {
|
||||
|
@ -39,7 +39,7 @@ import javax.inject.Inject
|
||||
* Possible next worker : None, but it will post new work to send events, encrypted or not
|
||||
*/
|
||||
internal class MultipleEventSendingDispatcherWorker(context: Context, params: WorkerParameters, sessionManager: SessionManager) :
|
||||
SessionSafeCoroutineWorker<MultipleEventSendingDispatcherWorker.Params>(context, params, sessionManager, Params::class.java) {
|
||||
SessionSafeCoroutineWorker<MultipleEventSendingDispatcherWorker.Params>(context, params, sessionManager, Params::class.java) {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
internal data class Params(
|
||||
@ -76,10 +76,10 @@ internal class MultipleEventSendingDispatcherWorker(context: Context, params: Wo
|
||||
params.localEchoIds.forEach { localEchoIds ->
|
||||
val roomId = localEchoIds.roomId
|
||||
val eventId = localEchoIds.eventId
|
||||
localEchoRepository.updateSendState(eventId, roomId, SendState.SENDING)
|
||||
Timber.v("## SendEvent: [${System.currentTimeMillis()}] Schedule send event $eventId")
|
||||
val sendWork = createSendEventWork(params.sessionId, eventId, true)
|
||||
timelineSendEventWorkCommon.postWork(roomId, sendWork)
|
||||
localEchoRepository.updateSendState(eventId, roomId, SendState.SENDING)
|
||||
Timber.v("## SendEvent: [${System.currentTimeMillis()}] Schedule send event $eventId")
|
||||
val sendWork = createSendEventWork(params.sessionId, eventId, true)
|
||||
timelineSendEventWorkCommon.postWork(roomId, sendWork)
|
||||
}
|
||||
|
||||
return Result.success()
|
||||
|
@ -34,7 +34,7 @@ import javax.inject.Inject
|
||||
* Possible next worker : None
|
||||
*/
|
||||
internal class RedactEventWorker(context: Context, params: WorkerParameters, sessionManager: SessionManager) :
|
||||
SessionSafeCoroutineWorker<RedactEventWorker.Params>(context, params, sessionManager, Params::class.java) {
|
||||
SessionSafeCoroutineWorker<RedactEventWorker.Params>(context, params, sessionManager, Params::class.java) {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
internal data class Params(
|
||||
|
@ -40,7 +40,7 @@ import javax.inject.Inject
|
||||
* Possible next worker : None
|
||||
*/
|
||||
internal class SendEventWorker(context: Context, params: WorkerParameters, sessionManager: SessionManager) :
|
||||
SessionSafeCoroutineWorker<SendEventWorker.Params>(context, params, sessionManager, Params::class.java) {
|
||||
SessionSafeCoroutineWorker<SendEventWorker.Params>(context, params, sessionManager, Params::class.java) {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
internal data class Params(
|
||||
|
@ -74,7 +74,7 @@ internal class QueueMemento @Inject constructor(context: Context,
|
||||
encrypt = task.encrypt,
|
||||
order = order
|
||||
)
|
||||
is RedactQueuedTask -> RedactEventTaskInfo(
|
||||
is RedactQueuedTask -> RedactEventTaskInfo(
|
||||
redactionLocalEcho = task.redactionLocalEchoId,
|
||||
order = order
|
||||
)
|
||||
@ -92,7 +92,7 @@ internal class QueueMemento @Inject constructor(context: Context,
|
||||
?.forEach { info ->
|
||||
try {
|
||||
when (info) {
|
||||
is SendEventTaskInfo -> {
|
||||
is SendEventTaskInfo -> {
|
||||
localEchoRepository.getUpToDateEcho(info.localEchoId)?.let {
|
||||
if (it.sendState.isSending() && it.eventId != null && it.roomId != null) {
|
||||
localEchoRepository.updateSendState(it.eventId, it.roomId, SendState.UNSENT)
|
||||
|
@ -51,7 +51,7 @@ internal fun JsonDict.toSafePowerLevelsContentDict(): JsonDict {
|
||||
usersDefault = content.usersDefault,
|
||||
users = content.users,
|
||||
stateDefault = content.stateDefault,
|
||||
notifications = content.notifications?.mapValues { content.notificationLevel(it.key) }
|
||||
notifications = content.notifications?.mapValues { content.notificationLevel(it.key) }
|
||||
)
|
||||
}
|
||||
?.toContent()
|
||||
|
@ -101,11 +101,11 @@ internal class Graph {
|
||||
// it's a candidate
|
||||
destination = it.destination
|
||||
}
|
||||
inPath -> {
|
||||
inPath -> {
|
||||
// Cycle!!
|
||||
backwardEdges.add(it)
|
||||
}
|
||||
completed -> {
|
||||
completed -> {
|
||||
// dead end
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ internal class LiveTimelineEvent(private val monarchy: Monarchy,
|
||||
private val timelineEventMapper: TimelineEventMapper,
|
||||
private val roomId: String,
|
||||
private val eventId: String) :
|
||||
MediatorLiveData<Optional<TimelineEvent>>() {
|
||||
MediatorLiveData<Optional<TimelineEvent>>() {
|
||||
|
||||
init {
|
||||
buildAndObserveQuery()
|
||||
|
@ -49,22 +49,23 @@ import java.util.concurrent.atomic.AtomicBoolean
|
||||
* It does mainly listen to the db timeline events.
|
||||
* It also triggers pagination to the server when needed, or dispatch to the prev or next chunk if any.
|
||||
*/
|
||||
internal class TimelineChunk(private val chunkEntity: ChunkEntity,
|
||||
private val timelineSettings: TimelineSettings,
|
||||
private val roomId: String,
|
||||
private val timelineId: String,
|
||||
private val fetchThreadTimelineTask: FetchThreadTimelineTask,
|
||||
private val eventDecryptor: TimelineEventDecryptor,
|
||||
private val paginationTask: PaginationTask,
|
||||
private val realmConfiguration: RealmConfiguration,
|
||||
private val fetchTokenAndPaginateTask: FetchTokenAndPaginateTask,
|
||||
private val timelineEventMapper: TimelineEventMapper,
|
||||
private val uiEchoManager: UIEchoManager?,
|
||||
private val threadsAwarenessHandler: ThreadsAwarenessHandler,
|
||||
private val lightweightSettingsStorage: LightweightSettingsStorage,
|
||||
private val initialEventId: String?,
|
||||
private val onBuiltEvents: (Boolean) -> Unit,
|
||||
private val onEventsDeleted: () -> Unit,
|
||||
internal class TimelineChunk(
|
||||
private val chunkEntity: ChunkEntity,
|
||||
private val timelineSettings: TimelineSettings,
|
||||
private val roomId: String,
|
||||
private val timelineId: String,
|
||||
private val fetchThreadTimelineTask: FetchThreadTimelineTask,
|
||||
private val eventDecryptor: TimelineEventDecryptor,
|
||||
private val paginationTask: PaginationTask,
|
||||
private val realmConfiguration: RealmConfiguration,
|
||||
private val fetchTokenAndPaginateTask: FetchTokenAndPaginateTask,
|
||||
private val timelineEventMapper: TimelineEventMapper,
|
||||
private val uiEchoManager: UIEchoManager?,
|
||||
private val threadsAwarenessHandler: ThreadsAwarenessHandler,
|
||||
private val lightweightSettingsStorage: LightweightSettingsStorage,
|
||||
private val initialEventId: String?,
|
||||
private val onBuiltEvents: (Boolean) -> Unit,
|
||||
private val onEventsDeleted: () -> Unit,
|
||||
) {
|
||||
|
||||
private val isLastForward = AtomicBoolean(chunkEntity.isLastForward)
|
||||
|
@ -87,7 +87,7 @@ internal class DefaultSearchTask @Inject constructor(
|
||||
results = searchCategories.roomEvents?.results?.map { searchResponseItem ->
|
||||
|
||||
val localThreadEventDetails = localTimelineEvents
|
||||
?.firstOrNull { it.eventId == searchResponseItem.event.eventId }
|
||||
?.firstOrNull { it.eventId == searchResponseItem.event.eventId }
|
||||
?.root
|
||||
?.asDomain()
|
||||
?.threadDetails
|
||||
|
@ -34,11 +34,12 @@ internal enum class SyncPresence(val value: String) {
|
||||
companion object {
|
||||
fun from(presenceEnum: PresenceEnum): SyncPresence {
|
||||
return when (presenceEnum) {
|
||||
PresenceEnum.ONLINE -> Online
|
||||
PresenceEnum.OFFLINE -> Offline
|
||||
PresenceEnum.ONLINE -> Online
|
||||
PresenceEnum.OFFLINE -> Offline
|
||||
PresenceEnum.UNAVAILABLE -> Unavailable
|
||||
}
|
||||
}
|
||||
|
||||
fun from(s: String?): SyncPresence? = values().find { it.value == s }
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ internal class DefaultSyncTask @Inject constructor(
|
||||
val nbToDevice = syncResponse.toDevice?.events.orEmpty().size
|
||||
val nextBatch = syncResponse.nextBatch
|
||||
Timber.tag(loggerTag.value).d(
|
||||
"Incremental sync request parsing, $nbRooms room(s) $nbToDevice toDevice(s). Got nextBatch: $nextBatch"
|
||||
"Incremental sync request parsing, $nbRooms room(s) $nbToDevice toDevice(s). Got nextBatch: $nextBatch"
|
||||
)
|
||||
defaultSyncStatusService.setStatus(SyncStatusService.Status.IncrementalSyncParsing(
|
||||
rooms = nbRooms,
|
||||
|
@ -42,7 +42,7 @@ private const val DEFAULT_DELAY_MILLIS = 30_000L
|
||||
* Possible next worker : None
|
||||
*/
|
||||
internal class SyncWorker(context: Context, workerParameters: WorkerParameters, sessionManager: SessionManager) :
|
||||
SessionSafeCoroutineWorker<SyncWorker.Params>(context, workerParameters, sessionManager, Params::class.java) {
|
||||
SessionSafeCoroutineWorker<SyncWorker.Params>(context, workerParameters, sessionManager, Params::class.java) {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
internal data class Params(
|
||||
|
@ -23,7 +23,7 @@ import javax.inject.Inject
|
||||
|
||||
internal class DefaultThirdPartyService @Inject constructor(private val getThirdPartyProtocolTask: GetThirdPartyProtocolsTask,
|
||||
private val getThirdPartyUserTask: GetThirdPartyUserTask) :
|
||||
ThirdPartyService {
|
||||
ThirdPartyService {
|
||||
|
||||
override suspend fun getThirdPartyProtocols(): Map<String, ThirdPartyProtocol> {
|
||||
return getThirdPartyProtocolTask.execute(Unit)
|
||||
|
@ -29,7 +29,7 @@ import javax.inject.Inject
|
||||
|
||||
internal class DefaultWidgetPostAPIMediator @Inject constructor(private val moshi: Moshi,
|
||||
private val widgetPostMessageAPIProvider: WidgetPostMessageAPIProvider) :
|
||||
WidgetPostAPIMediator {
|
||||
WidgetPostAPIMediator {
|
||||
|
||||
private val jsonAdapter = moshi.adapter<JsonDict>(JSON_DICT_PARAMETERIZED_TYPE)
|
||||
|
||||
|
@ -29,7 +29,7 @@ import javax.inject.Provider
|
||||
internal class DefaultWidgetService @Inject constructor(private val widgetManager: WidgetManager,
|
||||
private val widgetURLFormatter: WidgetURLFormatter,
|
||||
private val widgetPostAPIMediator: Provider<WidgetPostAPIMediator>) :
|
||||
WidgetService {
|
||||
WidgetService {
|
||||
|
||||
override fun getWidgetURLFormatter(): WidgetURLFormatter {
|
||||
return widgetURLFormatter
|
||||
@ -52,7 +52,7 @@ internal class DefaultWidgetService @Inject constructor(private val widgetManage
|
||||
return widgetManager.getWidgetComputedUrl(widget, isLightTheme)
|
||||
}
|
||||
|
||||
override fun getRoomWidgetsLive(
|
||||
override fun getRoomWidgetsLive(
|
||||
roomId: String,
|
||||
widgetId: QueryStringValue,
|
||||
widgetTypes: Set<String>?,
|
||||
|
@ -52,7 +52,7 @@ internal class WidgetManager @Inject constructor(private val integrationManager:
|
||||
private val widgetFactory: WidgetFactory,
|
||||
@UserId private val userId: String) :
|
||||
|
||||
IntegrationManagerService.Listener, SessionLifecycleObserver {
|
||||
IntegrationManagerService.Listener, SessionLifecycleObserver {
|
||||
|
||||
private val lifecycleOwner: LifecycleOwner = LifecycleOwner { lifecycleRegistry }
|
||||
private val lifecycleRegistry: LifecycleRegistry = LifecycleRegistry(lifecycleOwner)
|
||||
|
@ -21,7 +21,7 @@ import io.realm.RealmObjectSchema
|
||||
import timber.log.Timber
|
||||
|
||||
internal abstract class RealmMigrator(private val realm: DynamicRealm,
|
||||
private val targetSchemaVersion: Int) {
|
||||
private val targetSchemaVersion: Int) {
|
||||
fun perform() {
|
||||
Timber.d("Migrate ${realm.configuration.realmFileName} to $targetSchemaVersion")
|
||||
doMigrate(realm)
|
||||
|
@ -20,6 +20,6 @@ import android.os.Build
|
||||
import javax.inject.Inject
|
||||
|
||||
internal class DefaultBuildVersionSdkIntProvider @Inject constructor() :
|
||||
BuildVersionSdkIntProvider {
|
||||
BuildVersionSdkIntProvider {
|
||||
override fun get() = Build.VERSION.SDK_INT
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ import androidx.work.Worker
|
||||
import androidx.work.WorkerParameters
|
||||
|
||||
internal class AlwaysSuccessfulWorker(context: Context, params: WorkerParameters) :
|
||||
Worker(context, params) {
|
||||
Worker(context, params) {
|
||||
|
||||
override fun doWork(): Result {
|
||||
return Result.success()
|
||||
|
@ -93,7 +93,7 @@ internal class MatrixWorkerFactory @Inject constructor(private val sessionManage
|
||||
class CheckFactoryWorker(context: Context,
|
||||
workerParameters: WorkerParameters,
|
||||
private val isCreatedByMatrixWorkerFactory: Boolean) :
|
||||
CoroutineWorker(context, workerParameters) {
|
||||
CoroutineWorker(context, workerParameters) {
|
||||
|
||||
// Called by WorkManager if there is no MatrixWorkerFactory
|
||||
constructor(context: Context, workerParameters: WorkerParameters) : this(context,
|
||||
|
@ -27,7 +27,7 @@ import javax.inject.Inject
|
||||
*/
|
||||
@MatrixScope
|
||||
internal class CurlLoggingInterceptor @Inject constructor() :
|
||||
Interceptor {
|
||||
Interceptor {
|
||||
|
||||
@Throws(IOException::class)
|
||||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
|
@ -198,7 +198,7 @@ fun activityIdlingResource(activityClass: Class<*>): IdlingResource {
|
||||
println("*** [$name] onActivityLifecycleChanged callback: $callback")
|
||||
callback?.onTransitionToIdle()
|
||||
}
|
||||
else -> {
|
||||
else -> {
|
||||
// do nothing, we're blocking until the activity resumes
|
||||
}
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ class MessageMenuRobot(
|
||||
clickOn(R.string.reply_in_thread)
|
||||
autoClosed = true
|
||||
}
|
||||
|
||||
fun viewInRoom() {
|
||||
clickOn(R.string.view_in_room)
|
||||
autoClosed = true
|
||||
|
@ -52,7 +52,7 @@ class SettingsRobot {
|
||||
clickOnAndGoBack(R.string.settings_security_and_privacy) { block(SettingsSecurityRobot()) }
|
||||
}
|
||||
|
||||
fun labs(shouldGoBack: Boolean = true, block: () -> Unit = {}) {
|
||||
fun labs(shouldGoBack: Boolean = true, block: () -> Unit = {}) {
|
||||
if (shouldGoBack) {
|
||||
clickOnAndGoBack(R.string.room_settings_labs_pref_title) { block() }
|
||||
} else {
|
||||
|
@ -32,6 +32,7 @@ abstract class SasEmojiItem : VectorEpoxyModel<SasEmojiItem.Holder>() {
|
||||
|
||||
@EpoxyAttribute
|
||||
var index: Int = 0
|
||||
|
||||
@EpoxyAttribute
|
||||
lateinit var emojiRepresentation: EmojiRepresentation
|
||||
|
||||
|
@ -28,7 +28,7 @@ import javax.inject.Inject
|
||||
*/
|
||||
class TestAutoStartBoot @Inject constructor(private val vectorPreferences: VectorPreferences,
|
||||
private val stringProvider: StringProvider) :
|
||||
TroubleshootTest(R.string.settings_troubleshoot_test_service_boot_title) {
|
||||
TroubleshootTest(R.string.settings_troubleshoot_test_service_boot_title) {
|
||||
|
||||
override fun perform(activityResultLauncher: ActivityResultLauncher<Intent>) {
|
||||
if (vectorPreferences.autoStartOnBoot()) {
|
||||
|
@ -28,7 +28,7 @@ import javax.inject.Inject
|
||||
|
||||
class TestBackgroundRestrictions @Inject constructor(private val context: FragmentActivity,
|
||||
private val stringProvider: StringProvider) :
|
||||
TroubleshootTest(R.string.settings_troubleshoot_test_bg_restricted_title) {
|
||||
TroubleshootTest(R.string.settings_troubleshoot_test_bg_restricted_title) {
|
||||
|
||||
override fun perform(activityResultLauncher: ActivityResultLauncher<Intent>) {
|
||||
context.getSystemService<ConnectivityManager>()!!.apply {
|
||||
|
@ -29,10 +29,10 @@ class OnApplicationUpgradeOrRebootReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
Timber.v("## onReceive() ${intent.action}")
|
||||
val singletonEntryPoint = context.singletonEntryPoint()
|
||||
BackgroundSyncStarter.start(
|
||||
context,
|
||||
singletonEntryPoint.vectorPreferences(),
|
||||
singletonEntryPoint.activeSessionHolder()
|
||||
)
|
||||
BackgroundSyncStarter.start(
|
||||
context,
|
||||
singletonEntryPoint.vectorPreferences(),
|
||||
singletonEntryPoint.activeSessionHolder()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import javax.inject.Inject
|
||||
*/
|
||||
class TestPlayServices @Inject constructor(private val context: FragmentActivity,
|
||||
private val stringProvider: StringProvider) :
|
||||
TroubleshootTest(R.string.settings_troubleshoot_test_play_services_title) {
|
||||
TroubleshootTest(R.string.settings_troubleshoot_test_play_services_title) {
|
||||
|
||||
override fun perform(activityResultLauncher: ActivityResultLauncher<Intent>) {
|
||||
val apiAvailability = GoogleApiAvailability.getInstance()
|
||||
|
@ -41,7 +41,7 @@ class TestPushFromPushGateway @Inject constructor(private val context: FragmentA
|
||||
private val errorFormatter: ErrorFormatter,
|
||||
private val pushersManager: PushersManager,
|
||||
private val activeSessionHolder: ActiveSessionHolder) :
|
||||
TroubleshootTest(R.string.settings_troubleshoot_test_push_loop_title) {
|
||||
TroubleshootTest(R.string.settings_troubleshoot_test_push_loop_title) {
|
||||
|
||||
private var action: Job? = null
|
||||
private var pushReceived: Boolean = false
|
||||
|
@ -37,7 +37,7 @@ class TestTokenRegistration @Inject constructor(private val context: FragmentAct
|
||||
private val stringProvider: StringProvider,
|
||||
private val pushersManager: PushersManager,
|
||||
private val activeSessionHolder: ActiveSessionHolder) :
|
||||
TroubleshootTest(R.string.settings_troubleshoot_test_token_registration_title) {
|
||||
TroubleshootTest(R.string.settings_troubleshoot_test_token_registration_title) {
|
||||
|
||||
override fun perform(activityResultLauncher: ActivityResultLauncher<Intent>) {
|
||||
// Check if we have a registered pusher for this token
|
||||
|
@ -34,7 +34,7 @@ data class E2EMessageDetected(
|
||||
val senderDeviceId: String,
|
||||
val senderKey: String,
|
||||
val sessionId: String
|
||||
) {
|
||||
) {
|
||||
|
||||
companion object {
|
||||
fun fromEvent(event: Event, roomId: String): E2EMessageDetected {
|
||||
@ -109,9 +109,9 @@ class UISIDetector : LiveEventListener {
|
||||
timer.schedule(timeoutTask, timeoutMillis)
|
||||
}
|
||||
|
||||
override fun onLiveEvent(roomId: String, event: Event) { }
|
||||
override fun onLiveEvent(roomId: String, event: Event) {}
|
||||
|
||||
override fun onPaginatedEvent(roomId: String, event: Event) { }
|
||||
override fun onPaginatedEvent(roomId: String, event: Event) {}
|
||||
|
||||
private fun trackerId(eventId: String, roomId: String): String = "$roomId-$eventId"
|
||||
|
||||
|
@ -24,7 +24,7 @@ import javax.inject.Inject
|
||||
|
||||
class DefaultDateFormatterProvider @Inject constructor(private val context: Context,
|
||||
private val localeProvider: LocaleProvider) :
|
||||
DateFormatterProvider {
|
||||
DateFormatterProvider {
|
||||
|
||||
override val dateWithMonthFormatter: DateTimeFormatter by lazy {
|
||||
val pattern = DateFormat.getBestDateTimePattern(localeProvider.current(), "d MMMMM")
|
||||
|
@ -45,7 +45,7 @@ import dagger.hilt.components.SingletonComponent
|
||||
inline fun <reified VM : MavericksViewModel<S>, S : MavericksState> hiltMavericksViewModelFactory() = HiltMavericksViewModelFactory<VM, S>(VM::class.java)
|
||||
|
||||
class HiltMavericksViewModelFactory<VM : MavericksViewModel<S>, S : MavericksState>(
|
||||
private val viewModelClass: Class<out MavericksViewModel<S>>
|
||||
private val viewModelClass: Class<out MavericksViewModel<S>>
|
||||
) : MavericksViewModelFactory<VM, S> {
|
||||
|
||||
override fun create(viewModelContext: ViewModelContext, state: S): VM {
|
||||
|
@ -35,7 +35,7 @@ class ExportKeysDialog {
|
||||
val textWatcher = object : SimpleTextWatcher() {
|
||||
override fun afterTextChanged(s: Editable) {
|
||||
when {
|
||||
views.exportDialogEt.text.isNullOrEmpty() -> {
|
||||
views.exportDialogEt.text.isNullOrEmpty() -> {
|
||||
views.exportDialogSubmit.isEnabled = false
|
||||
views.exportDialogTilConfirm.error = null
|
||||
}
|
||||
@ -43,7 +43,7 @@ class ExportKeysDialog {
|
||||
views.exportDialogSubmit.isEnabled = true
|
||||
views.exportDialogTilConfirm.error = null
|
||||
}
|
||||
else -> {
|
||||
else -> {
|
||||
views.exportDialogSubmit.isEnabled = false
|
||||
views.exportDialogTilConfirm.error = activity.getString(R.string.passphrase_passphrase_does_not_match)
|
||||
}
|
||||
|
@ -74,8 +74,8 @@ fun Session.cannotLogoutSafely(): Boolean {
|
||||
return hasUnsavedKeys() ||
|
||||
// has local cross signing keys
|
||||
(cryptoService().crossSigningService().allPrivateKeysKnown() &&
|
||||
// That are not backed up
|
||||
!sharedSecretStorageService.isRecoverySetup())
|
||||
// That are not backed up
|
||||
!sharedSecretStorageService.isRecoverySetup())
|
||||
}
|
||||
|
||||
fun Session.vectorStore(context: Context) = VectorSessionStore(context, myUserId)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user