mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-12 10:03:39 +00:00
Merge branch 'dev' into open-group-profile-pictures
This commit is contained in:
commit
404ea7d347
@ -181,8 +181,8 @@ dependencies {
|
||||
testImplementation 'org.robolectric:shadows-multidex:4.2'
|
||||
}
|
||||
|
||||
def canonicalVersionCode = 110
|
||||
def canonicalVersionName = "1.6.1"
|
||||
def canonicalVersionCode = 115
|
||||
def canonicalVersionName = "1.6.2"
|
||||
|
||||
def postFixSize = 10
|
||||
def abiPostFix = ['armeabi-v7a' : 1,
|
||||
|
@ -34,12 +34,15 @@
|
||||
style="@style/SessionEditText"
|
||||
android:id="@+id/mnemonicEditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="28dp"
|
||||
android:paddingBottom="28dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginRight="@dimen/very_large_spacing"
|
||||
android:paddingTop="0dp"
|
||||
android:paddingBottom="0dp"
|
||||
android:gravity="center_vertical"
|
||||
android:inputType="textMultiLine"
|
||||
android:maxLines="2"
|
||||
android:hint="@string/activity_restore_seed_edit_text_hint" />
|
||||
|
||||
<View
|
||||
|
@ -34,10 +34,15 @@
|
||||
style="@style/SmallSessionEditText"
|
||||
android:id="@+id/mnemonicEditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="@dimen/very_large_spacing"
|
||||
android:paddingTop="0dp"
|
||||
android:paddingBottom="0dp"
|
||||
android:gravity="center_vertical"
|
||||
android:inputType="textMultiLine"
|
||||
android:maxLines="2"
|
||||
android:hint="@string/activity_restore_seed_edit_text_hint" />
|
||||
|
||||
<View
|
||||
|
@ -82,7 +82,7 @@ class PathActivity : PassphraseRequiredActionBarActivity() {
|
||||
|
||||
private fun update(isAnimated: Boolean) {
|
||||
pathRowsContainer.removeAllViews()
|
||||
if (OnionRequestAPI.paths.count() >= OnionRequestAPI.pathCount) {
|
||||
if (OnionRequestAPI.paths.isNotEmpty()) {
|
||||
val path = OnionRequestAPI.paths.firstOrNull() ?: return finish()
|
||||
val dotAnimationRepeatInterval = path.count().toLong() * 1000 + 1000
|
||||
val pathRows = path.mapIndexed { index, snode ->
|
||||
|
@ -50,6 +50,8 @@ class BackgroundPollJob private constructor(parameters: Parameters) : BaseJob(pa
|
||||
Log.d("Loki", "Performing background poll.")
|
||||
val userPublicKey = TextSecurePreferences.getLocalNumber(context)
|
||||
val promises = mutableListOf<Promise<Unit, Exception>>()
|
||||
if (!TextSecurePreferences.isUsingFCM(context)) {
|
||||
Log.d("Loki", "Not using FCM; polling for contacts and closed groups.")
|
||||
val promise = SnodeAPI.shared.getMessages(userPublicKey).map { envelopes ->
|
||||
envelopes.forEach {
|
||||
PushContentReceiveJob(context).processEnvelope(SignalServiceEnvelope(it), false)
|
||||
@ -57,6 +59,7 @@ class BackgroundPollJob private constructor(parameters: Parameters) : BaseJob(pa
|
||||
}
|
||||
promises.add(promise)
|
||||
promises.addAll(ClosedGroupPoller.shared.pollOnce())
|
||||
}
|
||||
val openGroups = DatabaseFactory.getLokiThreadDatabase(context).getAllPublicChats().map { it.value }
|
||||
for (openGroup in openGroups) {
|
||||
val poller = PublicChatPoller(context, openGroup)
|
||||
|
@ -27,8 +27,8 @@ class PublicChatManager(private val context: Context) {
|
||||
var areAllCaughtUp = true
|
||||
refreshChatsAndPollers()
|
||||
for ((threadID, chat) in chats) {
|
||||
val poller = pollers[threadID] ?: PublicChatPoller(context, chat)
|
||||
areAllCaughtUp = areAllCaughtUp && poller.isCaughtUp
|
||||
val poller = pollers[threadID]
|
||||
areAllCaughtUp = if (poller != null) areAllCaughtUp && poller.isCaughtUp else true
|
||||
}
|
||||
return areAllCaughtUp
|
||||
}
|
||||
|
@ -117,6 +117,30 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(
|
||||
database.insertOrUpdate(snodePoolTable, row, "${Companion.dummyKey} = ?", wrap("dummy_key"))
|
||||
}
|
||||
|
||||
override fun setOnionRequestPaths(newValue: List<List<Snode>>) {
|
||||
// FIXME: This approach assumes either 1 or 2 paths of length 3 each. We should do better than this.
|
||||
val database = databaseHelper.writableDatabase
|
||||
fun set(indexPath: String, snode: Snode) {
|
||||
var snodeAsString = "${snode.address}-${snode.port}"
|
||||
val keySet = snode.publicKeySet
|
||||
if (keySet != null) {
|
||||
snodeAsString += "-${keySet.ed25519Key}-${keySet.x25519Key}"
|
||||
}
|
||||
val row = wrap(mapOf( Companion.indexPath to indexPath, Companion.snode to snodeAsString ))
|
||||
database.insertOrUpdate(onionRequestPathTable, row, "${Companion.indexPath} = ?", wrap(indexPath))
|
||||
}
|
||||
Log.d("Loki", "Persisting onion request paths to database.")
|
||||
clearOnionRequestPaths()
|
||||
if (newValue.count() < 1) { return }
|
||||
val path0 = newValue[0]
|
||||
if (path0.count() != 3) { return }
|
||||
set("0-0", path0[0]); set("0-1", path0[1]); set("0-2", path0[2])
|
||||
if (newValue.count() < 2) { return }
|
||||
val path1 = newValue[1]
|
||||
if (path1.count() != 3) { return }
|
||||
set("1-0", path1[0]); set("1-1", path1[1]); set("1-2", path1[2])
|
||||
}
|
||||
|
||||
override fun getOnionRequestPaths(): List<List<Snode>> {
|
||||
val database = databaseHelper.readableDatabase
|
||||
fun get(indexPath: String): Snode? {
|
||||
@ -134,10 +158,16 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(
|
||||
}
|
||||
}
|
||||
}
|
||||
val path0Snode0 = get("0-0") ?: return listOf(); val path0Snode1 = get("0-1") ?: return listOf()
|
||||
val path0Snode2 = get("0-2") ?: return listOf(); val path1Snode0 = get("1-0") ?: return listOf()
|
||||
val path1Snode1 = get("1-1") ?: return listOf(); val path1Snode2 = get("1-2") ?: return listOf()
|
||||
return listOf( listOf( path0Snode0, path0Snode1, path0Snode2 ), listOf( path1Snode0, path1Snode1, path1Snode2 ) )
|
||||
val result = mutableListOf<List<Snode>>()
|
||||
val path0Snode0 = get("0-0"); val path0Snode1 = get("0-1"); val path0Snode2 = get("0-2")
|
||||
if (path0Snode0 != null && path0Snode1 != null && path0Snode2 != null) {
|
||||
result.add(listOf( path0Snode0, path0Snode1, path0Snode2 ))
|
||||
}
|
||||
val path1Snode0 = get("1-0"); val path1Snode1 = get("1-1"); val path1Snode2 = get("1-2")
|
||||
if (path1Snode0 != null && path1Snode1 != null && path1Snode2 != null) {
|
||||
result.add(listOf( path1Snode0, path1Snode1, path1Snode2 ))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
override fun clearOnionRequestPaths() {
|
||||
@ -150,28 +180,6 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(
|
||||
delete("1-1"); delete("1-2")
|
||||
}
|
||||
|
||||
override fun setOnionRequestPaths(newValue: List<List<Snode>>) {
|
||||
// TODO: Make this work with arbitrary paths
|
||||
if (newValue.count() != 2) { return }
|
||||
val path0 = newValue[0]
|
||||
val path1 = newValue[1]
|
||||
if (path0.count() != 3 || path1.count() != 3) { return }
|
||||
Log.d("Loki", "Persisting onion request paths to database.")
|
||||
val database = databaseHelper.writableDatabase
|
||||
fun set(indexPath: String, snode: Snode) {
|
||||
var snodeAsString = "${snode.address}-${snode.port}"
|
||||
val keySet = snode.publicKeySet
|
||||
if (keySet != null) {
|
||||
snodeAsString += "-${keySet.ed25519Key}-${keySet.x25519Key}"
|
||||
}
|
||||
val row = wrap(mapOf( Companion.indexPath to indexPath, Companion.snode to snodeAsString ))
|
||||
database.insertOrUpdate(onionRequestPathTable, row, "${Companion.indexPath} = ?", wrap(indexPath))
|
||||
}
|
||||
set("0-0", path0[0]); set("0-1", path0[1])
|
||||
set("0-2", path0[2]); set("1-0", path1[0])
|
||||
set("1-1", path1[1]); set("1-2", path1[2])
|
||||
}
|
||||
|
||||
override fun getSwarm(publicKey: String): Set<Snode>? {
|
||||
val database = databaseHelper.readableDatabase
|
||||
return database.get(swarmTable, "${Companion.swarmPublicKey} = ?", wrap(publicKey)) { cursor ->
|
||||
|
@ -18,8 +18,8 @@ class FakeChatView : ScrollView {
|
||||
|
||||
// region Settings
|
||||
private val spacing = context.resources.getDimension(R.dimen.medium_spacing)
|
||||
private val startDelay: Long = 2000
|
||||
private val delayBetweenMessages: Long = 3000
|
||||
private val startDelay: Long = 1000
|
||||
private val delayBetweenMessages: Long = 1500
|
||||
private val animationDuration: Long = 400
|
||||
// endregion
|
||||
|
||||
|
@ -85,7 +85,7 @@ class PathStatusView : View {
|
||||
private fun handlePathsBuiltEvent() { update() }
|
||||
|
||||
private fun update() {
|
||||
if (OnionRequestAPI.paths.count() >= OnionRequestAPI.pathCount) {
|
||||
if (OnionRequestAPI.paths.isNotEmpty()) {
|
||||
setBackgroundResource(R.drawable.accent_dot)
|
||||
mainColor = resources.getColorWithID(R.color.accent, context.theme)
|
||||
sessionShadowColor = resources.getColorWithID(R.color.accent, context.theme)
|
||||
|
Loading…
x
Reference in New Issue
Block a user