mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-28 20:45:17 +00:00
feat: add shortened hex for session IDs throughout, replace nullable getName with null in underlying contacts for individual contacts, build shared lib with release mode, remove todo, fix broken unit test
This commit is contained in:
parent
15db31004f
commit
2e673901ba
@ -1018,7 +1018,6 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
} else {
|
} else {
|
||||||
binding.placeholderText.setText(textResource)
|
binding.placeholderText.setText(textResource)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ import android.graphics.Typeface
|
|||||||
import android.graphics.drawable.ColorDrawable
|
import android.graphics.drawable.ColorDrawable
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
@ -128,7 +127,7 @@ class ConversationView : LinearLayout {
|
|||||||
return if (recipient.isLocalNumber) {
|
return if (recipient.isLocalNumber) {
|
||||||
context.getString(R.string.note_to_self)
|
context.getString(R.string.note_to_self)
|
||||||
} else {
|
} else {
|
||||||
recipient.name // Internally uses the Contact API
|
recipient.toShortString() // Internally uses the Contact API
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
android:title="@string/preferences_app_protection__screen_lock"
|
android:title="@string/preferences_app_protection__screen_lock"
|
||||||
android:summary="@string/preferences_app_protection__lock_signal_access_with_android_screen_lock_or_fingerprint" />
|
android:summary="@string/preferences_app_protection__lock_signal_access_with_android_screen_lock_or_fingerprint" />
|
||||||
|
|
||||||
<!-- TODO: check figure out what is needed for this -->
|
|
||||||
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="pref_screen_security"
|
android:key="pref_screen_security"
|
||||||
|
@ -122,7 +122,8 @@ class InstrumentedTests {
|
|||||||
nickname = "Nickname 3",
|
nickname = "Nickname 3",
|
||||||
approved = true,
|
approved = true,
|
||||||
blocked = true,
|
blocked = true,
|
||||||
profilePicture = UserPic("http://example.com/huge.bmp", "qwertyuio01234567890123456789012".encodeToByteArray())
|
profilePicture = UserPic("http://example.com/huge.bmp", "qwertyuio01234567890123456789012".encodeToByteArray()),
|
||||||
|
expiryMode = ExpiryMode.NONE
|
||||||
)
|
)
|
||||||
contacts2.set(third)
|
contacts2.set(third)
|
||||||
assertTrue(contacts.needsPush())
|
assertTrue(contacts.needsPush())
|
||||||
@ -261,7 +262,6 @@ class InstrumentedTests {
|
|||||||
userProfile.confirmPushed(conf.seqNo, "fakehash2")
|
userProfile.confirmPushed(conf.seqNo, "fakehash2")
|
||||||
newConf.confirmPushed(conf2.seqNo, "fakehash3")
|
newConf.confirmPushed(conf2.seqNo, "fakehash3")
|
||||||
|
|
||||||
userProfile.dump()
|
|
||||||
userProfile.dump()
|
userProfile.dump()
|
||||||
|
|
||||||
assertFalse(conf.config.contentEquals(conf2.config))
|
assertFalse(conf.config.contentEquals(conf2.config))
|
||||||
@ -285,18 +285,18 @@ class InstrumentedTests {
|
|||||||
|
|
||||||
newConf.confirmPushed(newSeqMerge.seqNo, "fakehash5")
|
newConf.confirmPushed(newSeqMerge.seqNo, "fakehash5")
|
||||||
|
|
||||||
assertEquals("Nibbler", newConf.getName())
|
assertEquals("Raz", newConf.getName())
|
||||||
assertEquals(4, newSeqMerge.seqNo)
|
assertEquals(3, newSeqMerge.seqNo)
|
||||||
|
|
||||||
// userProfile device polls and merges
|
// userProfile device polls and merges
|
||||||
userProfile.merge("fakehash5" to newSeqMerge.config)
|
userProfile.merge("fakehash5" to newSeqMerge.config)
|
||||||
|
|
||||||
val userConfigMerge = userProfile.push()
|
val userConfigMerge = userProfile.push()
|
||||||
|
|
||||||
assertEquals(4, userConfigMerge.seqNo)
|
assertEquals(3, userConfigMerge.seqNo)
|
||||||
|
|
||||||
assertEquals("Nibbler", newConf.getName())
|
assertEquals("Raz", newConf.getName())
|
||||||
assertEquals("Nibbler", userProfile.getName())
|
assertEquals("Raz", userProfile.getName())
|
||||||
|
|
||||||
userProfile.free()
|
userProfile.free()
|
||||||
newConf.free()
|
newConf.free()
|
||||||
|
@ -14,7 +14,7 @@ set(CMAKE_CXX_STANDARD 17)
|
|||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
set(CMAKE_BUILD_TYPE Debug)
|
set(CMAKE_BUILD_TYPE Release)
|
||||||
|
|
||||||
# Creates and names a library, sets it as either STATIC
|
# Creates and names a library, sets it as either STATIC
|
||||||
# or SHARED, and provides the relative paths to its source code.
|
# or SHARED, and provides the relative paths to its source code.
|
||||||
|
@ -325,7 +325,7 @@ public class Recipient implements RecipientModifiedListener {
|
|||||||
return contact.displayName(Contact.ContactContext.REGULAR);
|
return contact.displayName(Contact.ContactContext.REGULAR);
|
||||||
} else {
|
} else {
|
||||||
Contact contact = storage.getContactWithSessionID(sessionID);
|
Contact contact = storage.getContactWithSessionID(sessionID);
|
||||||
if (contact == null) { return sessionID; }
|
if (contact == null) { return null; }
|
||||||
return contact.displayName(Contact.ContactContext.REGULAR);
|
return contact.displayName(Contact.ContactContext.REGULAR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -483,7 +483,13 @@ public class Recipient implements RecipientModifiedListener {
|
|||||||
|
|
||||||
public synchronized String toShortString() {
|
public synchronized String toShortString() {
|
||||||
String name = getName();
|
String name = getName();
|
||||||
return (name != null ? name : address.serialize());
|
if (name != null) return name;
|
||||||
|
String sessionId = address.serialize();
|
||||||
|
if (sessionId.length() < 4) return sessionId; // so substrings don't throw out of bounds exceptions
|
||||||
|
int takeAmount = 4;
|
||||||
|
String start = sessionId.substring(0, takeAmount);
|
||||||
|
String end = sessionId.substring(sessionId.length()-takeAmount);
|
||||||
|
return start+"..."+end;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized @NonNull Drawable getFallbackContactPhotoDrawable(Context context, boolean inverted) {
|
public synchronized @NonNull Drawable getFallbackContactPhotoDrawable(Context context, boolean inverted) {
|
||||||
|
Loading…
Reference in New Issue
Block a user