Merge branch 'dev' of https://github.com/loki-project/session-android into backup-restore

This commit is contained in:
Anton Chekulaev 2020-11-05 11:28:22 +11:00
commit 3311cd0958
7 changed files with 43 additions and 29 deletions

View File

@ -192,7 +192,7 @@ dependencies {
testImplementation 'org.robolectric:shadows-multidex:4.2'
}
def canonicalVersionCode = 116
def canonicalVersionCode = 118
def canonicalVersionName = "1.6.3"
def postFixSize = 10

View File

@ -14,7 +14,7 @@
android:background="?android:dividerHorizontal"
android:elevation="1dp" />
<org.thoughtcrime.securesms.loki.views.TapJackingProofEditText
<EditText
style="@style/SessionEditText"
android:id="@+id/publicKeyEditText"
android:layout_width="match_parent"

View File

@ -176,6 +176,22 @@
android:gravity="center"
android:text="@string/activity_settings_devices_button_title" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="?android:dividerHorizontal" />
<TextView
android:id="@+id/sendInvitationButton"
android:layout_width="match_parent"
android:layout_height="@dimen/setting_button_height"
android:background="@drawable/setting_button_background"
android:textColor="@color/text"
android:textSize="@dimen/medium_font_size"
android:textStyle="bold"
android:gravity="center"
android:text="Invite" />
<View
android:id="@+id/seedButtonTopSeparator"
android:layout_width="match_parent"

View File

@ -13,7 +13,7 @@
android:background="?android:dividerHorizontal"
android:elevation="1dp" />
<org.thoughtcrime.securesms.loki.views.TapJackingProofEditText
<EditText
style="@style/SmallSessionEditText"
android:id="@+id/publicKeyEditText"
android:layout_width="match_parent"

View File

@ -330,6 +330,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
private AttachmentTypeSelector attachmentTypeSelector;
private AttachmentManager attachmentManager;
private AudioRecorder audioRecorder;
private Handler audioHandler;
private Runnable stopRecordingTask;
private BroadcastReceiver securityUpdateReceiver;
private Stub<MediaKeyboard> emojiDrawerStub;
protected HidingLinearLayout quickAttachmentToggle;
@ -2579,6 +2581,10 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
audioRecorder.startRecording();
audioHandler = new Handler();
stopRecordingTask = () -> inputPanel.onRecordReleased();
audioHandler.postDelayed(stopRecordingTask, 60000);
}
@Override
@ -2588,6 +2594,9 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
@Override
public void onRecorderFinished() {
if (audioHandler != null && stopRecordingTask != null) {
audioHandler.removeCallbacks(stopRecordingTask);
}
updateToggleButtonState();
Vibrator vibrator = ServiceUtil.getVibrator(this);
vibrator.vibrate(20);
@ -2629,6 +2638,9 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
@Override
public void onRecorderCanceled() {
if (audioHandler != null && stopRecordingTask != null) {
audioHandler.removeCallbacks(stopRecordingTask);
}
updateToggleButtonState();
Vibrator vibrator = ServiceUtil.getVibrator(this);
vibrator.vibrate(50);

View File

@ -96,6 +96,7 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
notificationsButton.setOnClickListener { showNotificationSettings() }
chatsButton.setOnClickListener { showChatSettings() }
// linkedDevicesButton.setOnClickListener { showLinkedDevices() }
sendInvitationButton.setOnClickListener { sendInvitation() }
seedButton.setOnClickListener { showSeed() }
clearAllDataButton.setOnClickListener { clearAllData() }
versionTextView.text = String.format(getString(R.string.version_s), "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})")
@ -292,6 +293,15 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
push(intent)
}
private fun sendInvitation() {
val intent = Intent()
intent.action = Intent.ACTION_SEND
val invitation = "Hey, I've been using Session to chat with complete privacy and security. Come join me! Download it at https://getsession.org/. My Session ID is $hexEncodedPublicKey!"
intent.putExtra(Intent.EXTRA_TEXT, invitation)
intent.type = "text/plain"
startActivity(intent)
}
private fun showSeed() {
SeedDialog().show(supportFragmentManager, "Recovery Phrase Dialog")
}

View File

@ -66,33 +66,9 @@ class UserView : LinearLayout {
val threadID = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(user)
MentionManagerUtilities.populateUserPublicKeyCacheIfNeeded(threadID, context) // FIXME: This is a bad place to do this
val address = user.address.serialize()
if (user.isGroupRecipient) {
if ("Session Public Chat" == user.name || user.address.isRSSFeed) {
profilePictureView.publicKey = ""
profilePictureView.displayName = null
profilePictureView.additionalPublicKey = null
profilePictureView.isRSSFeed = true
} else {
val threadID = GroupManager.getThreadIDFromGroupID(address, context)
val users = MentionsManager.shared.userPublicKeyCache[threadID]?.toList() ?: listOf()
val randomUsers = users.sorted() // Sort to provide a level of stability
val pk = randomUsers.getOrNull(0) ?: ""
profilePictureView.publicKey = pk
profilePictureView.displayName = getUserDisplayName(pk)
val apk = randomUsers.getOrNull(1) ?: ""
profilePictureView.additionalPublicKey = apk
profilePictureView.additionalDisplayName = getUserDisplayName(apk)
profilePictureView.isRSSFeed = false
}
} else {
profilePictureView.publicKey = address
profilePictureView.displayName = getUserDisplayName(address)
profilePictureView.additionalPublicKey = null
profilePictureView.isRSSFeed = false
}
actionIndicatorImageView.setImageResource(R.drawable.ic_baseline_edit_24)
profilePictureView.glide = glide
profilePictureView.update()
profilePictureView.update(user, threadID)
actionIndicatorImageView.setImageResource(R.drawable.ic_baseline_edit_24)
nameTextView.text = if (user.isGroupRecipient) user.name else getUserDisplayName(address)
when (actionIndicator) {
ActionIndicator.None -> {