Merge branch 'production' into show-all-activity-sessions
This commit is contained in:
commit
34da43a116
6 changed files with 34 additions and 24 deletions
|
|
@ -196,6 +196,7 @@ abstract class AppConfig {
|
|||
static String errorSubscriptionId = "pangea_subscription_error";
|
||||
|
||||
static double volume = 1.0;
|
||||
static bool showedActivityMenu = false;
|
||||
// Pangea#
|
||||
|
||||
static void loadFromJson(Map<String, dynamic> json) {
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ abstract class SettingKeys {
|
|||
'chat.fluffy.display_navigation_rail';
|
||||
// #Pangea
|
||||
static const String volume = 'pangea.volume';
|
||||
static const String showedActivityMenu =
|
||||
'pangea.showed_activity_menu_tutorial';
|
||||
// Pangea#
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2246,6 +2246,13 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
|
||||
bool showActivityDropdown = false;
|
||||
void setShowDropdown(bool show) async {
|
||||
if (show && !AppConfig.showedActivityMenu) {
|
||||
AppConfig.showedActivityMenu = true;
|
||||
Matrix.of(context).store.setBool(
|
||||
SettingKeys.showedActivityMenu,
|
||||
AppConfig.showedActivityMenu,
|
||||
);
|
||||
}
|
||||
setState(() => showActivityDropdown = show);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,37 +67,33 @@ class _ActivityStatsButtonState extends State<ActivityStatsButton> {
|
|||
Client get _client => widget.controller.room.client;
|
||||
|
||||
bool get _shouldShowInstructions {
|
||||
if (InstructionsEnum.activityStatsMenu.isToggledOff ||
|
||||
MatrixState.pAnyState.isOverlayOpen(
|
||||
RegExp(r"^word-zoom-card-.*$"),
|
||||
) ||
|
||||
if (AppConfig.showedActivityMenu ||
|
||||
InstructionsEnum.activityStatsMenu.isToggledOff ||
|
||||
MatrixState.pAnyState.isOverlayOpen(RegExp(r"^word-zoom-card-.*$")) ||
|
||||
widget.controller.timeline == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// if someone has finished the activity, enable the tooltip
|
||||
final userID = Matrix.of(context).client.userID!;
|
||||
final activityRoles =
|
||||
widget.controller.room.activityRoles?.roles.values.toList() ?? [];
|
||||
if (activityRoles.any((r) => r.isFinished)) {
|
||||
return true;
|
||||
widget.controller.room.activityRoles?.roles.values ?? [];
|
||||
final finishedRoles = activityRoles.where((r) => r.isFinished);
|
||||
|
||||
if (finishedRoles.isNotEmpty) {
|
||||
return !finishedRoles.any((r) => r.userId == userID);
|
||||
}
|
||||
|
||||
// otherwise, if no one has finished, only show if the user has sent >= 3 messages
|
||||
int count = 0;
|
||||
for (final event in widget.controller.timeline!.events) {
|
||||
if (event.senderId == _client.userID &&
|
||||
event.type == EventTypes.Message &&
|
||||
[
|
||||
MessageTypes.Text,
|
||||
MessageTypes.Audio,
|
||||
].contains(event.messageType)) {
|
||||
count++;
|
||||
}
|
||||
final count = widget.controller.timeline!.events
|
||||
.where(
|
||||
(event) =>
|
||||
event.senderId == userID &&
|
||||
event.type == EventTypes.Message &&
|
||||
{MessageTypes.Text, MessageTypes.Audio}
|
||||
.contains(event.messageType),
|
||||
)
|
||||
.length;
|
||||
|
||||
if (count >= 3) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return count >= 3;
|
||||
}
|
||||
|
||||
int get _xpCount =>
|
||||
|
|
|
|||
|
|
@ -541,6 +541,10 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||
|
||||
// #Pangea
|
||||
AppConfig.volume = store.getDouble(SettingKeys.volume) ?? AppConfig.volume;
|
||||
|
||||
AppConfig.showedActivityMenu =
|
||||
store.getBool(SettingKeys.showedActivityMenu) ??
|
||||
AppConfig.showedActivityMenu;
|
||||
// Pangea#
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ description: Learn a language while texting your friends.
|
|||
# Pangea#
|
||||
publish_to: none
|
||||
# On version bump also increase the build number for F-Droid
|
||||
version: 4.1.15+8
|
||||
version: 4.1.15+9
|
||||
|
||||
environment:
|
||||
sdk: ">=3.0.0 <4.0.0"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue