Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/tchap_v1.0.46'
Browse files Browse the repository at this point in the history
  • Loading branch information
giomfo committed Sep 26, 2020
2 parents 2666bb4 + 5f66b77 commit 21405e4
Show file tree
Hide file tree
Showing 22 changed files with 184 additions and 136 deletions.
14 changes: 14 additions & 0 deletions TCHAP_CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
Changes in Tchap 1.0.46 (2020-09-26)
===================================================

Improvements:
* Update matrix-sdk.aar libs - Revision: 3d3c42c5a55bcc4e80d268a6eace93eb1dfc0247 [3d3c42c5a]
Note: targetSdkVersion has been updated in matrix-sdk to Android 10 (API 29).
* Simplify the notifications handling #605

Bug Fixes:
* LoginActivity: block the UI when the loading wheel is running
* java.lang.NullPointerException (RoomViewHolder.java:197) #611
* matrix-sdk: Tchap crashes when it checks user presence #603
* matrix-sdk: Fix a crash on the crypto code (potentially a race condition)

Changes in Tchap 1.0.45 (2020-08-14)
===================================================

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ buildscript {

// global properties used in sub modules
ext {
versionCodeProp = 69
versionNameProp = "1.0.45"
versionCodeProp = 71
versionNameProp = "1.0.46"
versionBuild = System.getenv("BUILD_NUMBER") as Integer ?: 0
buildNumberProp = "${versionBuild}"
}
Expand Down
Binary file modified vector/libs/matrix-sdk-core.aar
Binary file not shown.
Binary file modified vector/libs/matrix-sdk-crypto.aar
Binary file not shown.
Binary file modified vector/libs/matrix-sdk.aar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ class NotificationTroubleshootTestManagerFactory {
mgr.addTest(TestAccountSettings(fragment, session))
}
mgr.addTest(TestDeviceSettings(fragment))
if (session != null) {
mgr.addTest(TestBingRulesSettings(fragment, session))
}
// Tchap: comment the test on the bing rules, because we remove the advanced settings
// screen on Android app.
// if (session != null) {
// mgr.addTest(TestBingRulesSettings(fragment, session))
// }
mgr.addTest(TestPlayServices(fragment))
mgr.addTest(TestFirebaseToken(fragment))
mgr.addTest(TestTokenRegistration(fragment))
Expand Down
19 changes: 11 additions & 8 deletions vector/src/main/java/im/vector/activity/VectorRoomActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3661,13 +3661,6 @@ void onStartCallClick() {
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(R.string.ok, null)
.show();
} else if (WidgetManagerProvider.INSTANCE.getWidgetManager(this) == null) {
// display the dialog with the info text
new AlertDialog.Builder(this)
.setMessage(R.string.integration_manager_not_configured)
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(R.string.ok, null)
.show();
} else if (isUserAllowedToStartConfCall()) {
if (mRoom.getNumberOfMembers() > 2) {
new AlertDialog.Builder(this)
Expand All @@ -3678,7 +3671,17 @@ void onStartCallClick() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (PreferencesManager.useJitsiConfCall(VectorRoomActivity.this)) {
startJitsiCall(true);
if (WidgetManagerProvider.INSTANCE.getWidgetManager(VectorRoomActivity.this) == null) {
//if (Matrix.getWidgetManager(VectorRoomActivity.this) == null) {
// display the dialog with the info text
new AlertDialog.Builder(VectorRoomActivity.this)
.setMessage(R.string.integration_manager_not_configured)
.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(R.string.ok, null)
.show();
} else {
startJitsiCall(true);
}
} else {
displayVideoCallIpDialog();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ class VectorSettingsActivity : MXCActionBarActivity(),
val oFragment = when (pref.key) {
PreferencesManager.SETTINGS_NOTIFICATION_TROUBLESHOOT_PREFERENCE_KEY ->
VectorSettingsNotificationsTroubleshootFragment.newInstance(session.myUserId)
PreferencesManager.SETTINGS_NOTIFICATION_ADVANCED_PREFERENCE_KEY ->
VectorSettingsAdvancedNotificationPreferenceFragment.newInstance(session.myUserId)
// PreferencesManager.SETTINGS_NOTIFICATION_ADVANCED_PREFERENCE_KEY ->
// VectorSettingsAdvancedNotificationPreferenceFragment.newInstance(session.myUserId)
// PreferencesManager.SETTINGS_DISCOVERY_PREFERENCE_KEY,
// PreferencesManager.SETTINGS_IDENTITY_SERVER_PREFERENCE_KEY ->
// VectorSettingsDiscoveryFragment.newInstance(session.myUserId)
Expand Down
35 changes: 28 additions & 7 deletions vector/src/main/java/im/vector/adapters/RoomViewHolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import org.matrix.androidsdk.data.RoomTag;
import org.matrix.androidsdk.data.store.IMXStore;
import org.matrix.androidsdk.core.BingRulesManager;
import org.matrix.androidsdk.rest.model.User;

import java.util.Set;

import butterknife.BindView;
Expand Down Expand Up @@ -193,8 +195,14 @@ public void populateViews(final Context context,
}

if (null != vSenderDisplayName && null != roomSummary.getLatestReceivedEvent()) {
String senderName = session.getDataHandler().getUser(roomSummary.getLatestReceivedEvent().getSender()).displayname;
String userNameWithoutDomain = DinsicUtils.getNameFromDisplayName(senderName);
String userNameWithoutDomain;
String senderId = roomSummary.getLatestReceivedEvent().getSender();
User sender = session.getDataHandler().getUser(senderId);
if (null != sender && null != sender.displayname) {
userNameWithoutDomain = DinsicUtils.getNameFromDisplayName(sender.displayname);
} else {
userNameWithoutDomain = DinsicUtils.computeDisplayNameFromUserId(senderId);
}
vSenderDisplayName.setText(userNameWithoutDomain);
vSenderDisplayName.setVisibility(View.VISIBLE);
}
Expand Down Expand Up @@ -280,11 +288,24 @@ public void onClick(View v) {
}

BingRulesManager.RoomNotificationState roomNotificationState = session.getDataHandler().getBingRulesManager().getRoomNotificationState(room.getRoomId());
if (null != vRoomNotificationMute) {
if (roomNotificationState.equals(BingRulesManager.RoomNotificationState.MUTE)) {
vRoomNotificationMute.setVisibility(View.VISIBLE);
} else {
vRoomNotificationMute.setVisibility(View.GONE);
if (null != vRoomNotificationMute && null != roomNotificationState) {
switch (roomNotificationState) {
case ALL_MESSAGES_NOISY:
case ALL_MESSAGES:
vRoomNotificationMute.setVisibility(View.GONE);
break;
case MENTIONS_ONLY:
if (room.isDirect()) {
// Tchap: This mode is not suggested anymore for the direct chats
// We consider people will not mention the other member in 1:1.
// The room is considered mute.
vRoomNotificationMute.setVisibility(View.VISIBLE);
} else {
vRoomNotificationMute.setVisibility(View.GONE);
}
break;
case MUTE:
vRoomNotificationMute.setVisibility(View.VISIBLE);
}
}

Expand Down
2 changes: 2 additions & 0 deletions vector/src/main/java/im/vector/contacts/ContactsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ public void onSuccess(final String accountId) {
public void onSuccess(User user) {
Log.d(LOG_TAG, "retrieve the presence of " + mxid.mMatrixId + " :" + user);
mxid.mUser = user;
//user coming from API no longer contains his id. we must add it to him.
mxid.mUser.user_id = mxid.mMatrixId;
onContactPresenceUpdate(contact, mxid);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1080,14 +1080,22 @@ private void updatePreferenceUiValues() {
}

if (null != mRoomNotificationsPreference) {
String stateValue = BingRulesManager.RoomNotificationState.MUTE.name();
BingRulesManager.RoomNotificationState state = mSession.getDataHandler().getBingRulesManager().getRoomNotificationState(mRoom.getRoomId());

if (state != null) {
mRoomNotificationsPreference.setValue(state.name());
} else {
// Should not happen
mRoomNotificationsPreference.setValue(BingRulesManager.RoomNotificationState.MUTE.name());
switch (state) {
case ALL_MESSAGES_NOISY:
case ALL_MESSAGES:
// Tchap: We don't distinguish these 2 modes
// All the room notifications are noisy by default in the bing rules
stateValue = BingRulesManager.RoomNotificationState.ALL_MESSAGES.name();
break;
case MENTIONS_ONLY:
case MUTE:
stateValue = state.name();
}
}
mRoomNotificationsPreference.setValue(stateValue);
}

// update the room tag preference
Expand Down Expand Up @@ -1298,9 +1306,7 @@ private void onRoomNotificationsPreferenceChanged() {
String value = mRoomNotificationsPreference.getValue();
BingRulesManager.RoomNotificationState updatedState;

if (TextUtils.equals(value, BingRulesManager.RoomNotificationState.ALL_MESSAGES_NOISY.name())) {
updatedState = BingRulesManager.RoomNotificationState.ALL_MESSAGES_NOISY;
} else if (TextUtils.equals(value, BingRulesManager.RoomNotificationState.ALL_MESSAGES.name())) {
if (TextUtils.equals(value, BingRulesManager.RoomNotificationState.ALL_MESSAGES.name())) {
updatedState = BingRulesManager.RoomNotificationState.ALL_MESSAGES;
} else if (TextUtils.equals(value, BingRulesManager.RoomNotificationState.MENTIONS_ONLY.name())) {
updatedState = BingRulesManager.RoomNotificationState.MENTIONS_ONLY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class VectorSettingsNotificationsTroubleshootFragment : VectorBaseFragment() {

override fun onResume() {
super.onResume()
(activity as? MXCActionBarActivity)?.supportActionBar?.setTitle(R.string.settings_notification_troubleshoot)
(activity as? MXCActionBarActivity)?.supportActionBar?.setTitle(R.string.settings_notification_troubleshoot_title)
}

override fun onAttach(context: Context?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3255,7 +3255,6 @@ class VectorSettingsPreferencesFragment : PreferenceFragmentCompat(), SharedPref

// preference name <-> rule Id
private var mPrefKeyToBingRuleId = mapOf(
PreferencesManager.SETTINGS_ENABLE_ALL_NOTIF_PREFERENCE_KEY to BingRule.RULE_ID_DISABLE_ALL,
PreferencesManager.SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY to DUMMY_RULE,
PreferencesManager.SETTINGS_TURN_SCREEN_ON_PREFERENCE_KEY to DUMMY_RULE
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ public class PreferencesManager {

// notifications
public static final String SETTINGS_NOTIFICATIONS_KEY = "SETTINGS_NOTIFICATIONS_KEY";
public static final String SETTINGS_ENABLE_ALL_NOTIF_PREFERENCE_KEY = "SETTINGS_ENABLE_ALL_NOTIF_PREFERENCE_KEY";
public static final String SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY = "SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY";
public static final String SETTINGS_TURN_SCREEN_ON_PREFERENCE_KEY = "SETTINGS_TURN_SCREEN_ON_PREFERENCE_KEY";
public static final String SETTINGS_SYSTEM_CALL_NOTIFICATION_PREFERENCE_KEY = "SETTINGS_SYSTEM_CALL_NOTIFICATION_PREFERENCE_KEY";
Expand Down
58 changes: 34 additions & 24 deletions vector/src/main/java/im/vector/util/RoomUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -573,26 +573,43 @@ public boolean onMenuItemClick(final MenuItem item) {
item.setIcon(R.drawable.ic_material_transparent);
}

BingRulesManager.RoomNotificationState state = session.getDataHandler().getBingRulesManager().getRoomNotificationState(room.getRoomId());

if (BingRulesManager.RoomNotificationState.ALL_MESSAGES_NOISY != state) {
item = popup.getMenu().findItem(R.id.ic_action_notifications_noisy);
item.setIcon(R.drawable.ic_material_transparent);
}

if (BingRulesManager.RoomNotificationState.ALL_MESSAGES != state) {
item = popup.getMenu().findItem(R.id.ic_action_notifications_all_message);
item.setIcon(R.drawable.ic_material_transparent);
}

if (BingRulesManager.RoomNotificationState.MENTIONS_ONLY != state) {
if (room.isDirect()) {
// Tchap: The "mention only" mode is not suggested anymore for the direct chats
// We consider people will not mention the other member in 1:1.
item = popup.getMenu().findItem(R.id.ic_action_notifications_mention_only);
item.setIcon(R.drawable.ic_material_transparent);
item.setVisible(false);
}

if (BingRulesManager.RoomNotificationState.MUTE != state) {
item = popup.getMenu().findItem(R.id.ic_action_notifications_mute);
item.setIcon(R.drawable.ic_material_transparent);
BingRulesManager.RoomNotificationState state = session.getDataHandler().getBingRulesManager().getRoomNotificationState(room.getRoomId());
if (state != null) {
switch (state) {
case ALL_MESSAGES_NOISY:
case ALL_MESSAGES:
// Tchap: We don't distinguish these 2 modes
// All the room notifications are noisy by default in the bing rules
item = popup.getMenu().findItem(R.id.ic_action_notifications_mention_only);
item.setIcon(R.drawable.ic_material_transparent);
item = popup.getMenu().findItem(R.id.ic_action_notifications_mute);
item.setIcon(R.drawable.ic_material_transparent);
break;
case MENTIONS_ONLY:
item = popup.getMenu().findItem(R.id.ic_action_notifications_all_message);
item.setIcon(R.drawable.ic_material_transparent);
if (room.isDirect()) {
// The room is considered mute.
item = popup.getMenu().findItem(R.id.ic_action_notifications_mention_only);
item.setIcon(R.drawable.ic_material_transparent);
} else {
item = popup.getMenu().findItem(R.id.ic_action_notifications_mute);
item.setIcon(R.drawable.ic_material_transparent);
}
break;
case MUTE:
item = popup.getMenu().findItem(R.id.ic_action_notifications_all_message);
item.setIcon(R.drawable.ic_material_transparent);
item = popup.getMenu().findItem(R.id.ic_action_notifications_mention_only);
item.setIcon(R.drawable.ic_material_transparent);
}
}

// TODO LazyLoading, current user may be null
Expand Down Expand Up @@ -620,13 +637,6 @@ public boolean onMenuItemClick(final MenuItem item) {
}
break;
}
case R.id.ic_action_notifications_noisy:
moreActionListener.onUpdateRoomNotificationsState(session,
room.getRoomId(), BingRulesManager.RoomNotificationState.ALL_MESSAGES_NOISY);
if (null != notificationMuteView) {
notificationMuteView.setVisibility(View.GONE);
}
break;

case R.id.ic_action_notifications_all_message:
moreActionListener.onUpdateRoomNotificationsState(session,
Expand Down
2 changes: 2 additions & 0 deletions vector/src/main/res/layout/activity_tchap_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
android:id="@+id/flow_ui_mask_login"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
android:visibility="gone">

<ProgressBar
Expand Down
5 changes: 0 additions & 5 deletions vector/src/main/res/menu/vector_home_room_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
android:icon="@drawable/ic_pin"
android:title="@string/room_settings_pin" />

<item
android:id="@+id/ic_action_notifications_noisy"
android:icon="@drawable/ic_material_done"
android:title="@string/room_settings_all_messages_noisy" />

<item
android:id="@+id/ic_action_notifications_all_message"
android:icon="@drawable/ic_material_done"
Expand Down
Loading

0 comments on commit 21405e4

Please sign in to comment.