Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Pattle
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
71
Issues
71
List
Boards
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pattle
Pattle
Commits
b3905c4e
Verified
Commit
b3905c4e
authored
Jul 04, 2019
by
Wilko Manger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle room upgrades
parent
8bd943e4
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
113 additions
and
38 deletions
+113
-38
lib/src/ui/main/chat/chat_bloc.dart
lib/src/ui/main/chat/chat_bloc.dart
+4
-1
lib/src/ui/main/chat/widgets/bubble.dart
lib/src/ui/main/chat/widgets/bubble.dart
+8
-0
lib/src/ui/main/chat/widgets/state/creation_bubble.dart
lib/src/ui/main/chat/widgets/state/creation_bubble.dart
+6
-15
lib/src/ui/main/chat/widgets/state/member_bubble.dart
lib/src/ui/main/chat/widgets/state/member_bubble.dart
+6
-17
lib/src/ui/main/chat/widgets/state/state_bubble.dart
lib/src/ui/main/chat/widgets/state/state_bubble.dart
+19
-1
lib/src/ui/main/chat/widgets/state/upgrade_bubble.dart
lib/src/ui/main/chat/widgets/state/upgrade_bubble.dart
+57
-0
lib/src/ui/main/overview/chat_overview_bloc.dart
lib/src/ui/main/overview/chat_overview_bloc.dart
+5
-0
lib/src/ui/resources/localizations.dart
lib/src/ui/resources/localizations.dart
+4
-0
pubspec.lock
pubspec.lock
+2
-2
pubspec.yaml
pubspec.yaml
+2
-2
No files found.
lib/src/ui/main/chat/chat_bloc.dart
View file @
b3905c4e
...
...
@@ -101,10 +101,13 @@ class ChatBloc {
}
}
shouldIgnore
=
shouldIgnore
||
shouldIgnore
|=
event
is
JoinEvent
&&
event
is
!
DisplayNameChangeEvent
&&
room
.
creator
.
isIdenticalTo
(
event
.
content
.
subject
);
// Don't show creation events in rooms that are replacements
shouldIgnore
|=
event
is
RoomCreationEvent
&&
room
.
isReplacement
;
if
(
ignoredEvents
.
contains
(
event
.
runtimeType
)
||
shouldIgnore
)
{
continue
;
}
...
...
lib/src/ui/main/chat/widgets/bubble.dart
View file @
b3905c4e
...
...
@@ -18,6 +18,7 @@
import
'package:flutter/material.dart'
;
import
'package:matrix_sdk/matrix_sdk.dart'
;
import
'package:pattle/src/ui/main/chat/widgets/state/creation_bubble.dart'
;
import
'package:pattle/src/ui/main/chat/widgets/state/upgrade_bubble.dart'
;
import
'package:pattle/src/ui/main/models/chat_item.dart'
;
import
'image_bubble.dart'
;
...
...
@@ -94,6 +95,13 @@ abstract class Bubble extends Item {
nextItem:
nextItem
,
isMine:
isMine
,
);
}
else
if
(
item
.
event
is
RoomUpgradeEvent
)
{
return
UpgradeBubble
(
item:
item
,
previousItem:
previousItem
,
nextItem:
nextItem
,
isMine:
isMine
,
);
}
else
{
return
null
;
}
...
...
lib/src/ui/main/chat/widgets/state/creation_bubble.dart
View file @
b3905c4e
...
...
@@ -44,23 +44,14 @@ class CreationBubble extends StateBubble {
isMine:
isMine
);
@protected
@override
Widget
buildContent
(
BuildContext
context
)
{
// Keep default body1 font size so it is a bit smaller
// since it is less important than a message
// size 14
return
RichText
(
textAlign:
TextAlign
.
center
,
text:
TextSpan
(
style:
Theme
.
of
(
context
).
textTheme
.
body1
,
children:
l
(
context
).
createdThisGroup
(
TextSpan
(
text:
displayNameOf
(
event
.
room
.
creator
),
style:
TextStyle
(
fontWeight:
FontWeight
.
w600
)
))
List
<
TextSpan
>
buildContentSpans
(
BuildContext
context
)
=>
l
(
context
).
createdThisGroup
(
TextSpan
(
text:
displayNameOf
(
event
.
room
.
creator
),
style:
defaultEmphasisTextStyle
)
);
}
}
\ No newline at end of file
lib/src/ui/main/chat/widgets/state/member_bubble.dart
View file @
b3905c4e
...
...
@@ -46,22 +46,11 @@ class MemberBubble extends StateBubble {
isMine:
isMine
);
@protected
@override
Widget
buildContent
(
BuildContext
context
)
{
// Keep default body1 font size so it is a bit smaller
// since it is less important than a message
// size 14
return
RichText
(
textAlign:
TextAlign
.
center
,
text:
TextSpan
(
style:
Theme
.
of
(
context
).
textTheme
.
body1
,
children:
spanFor
(
context
,
event
,
style:
TextStyle
(
fontWeight:
FontWeight
.
w600
)
)
)
);
}
@protected
List
<
TextSpan
>
buildContentSpans
(
BuildContext
context
)
=>
spanFor
(
context
,
event
,
style:
defaultEmphasisTextStyle
);
}
\ No newline at end of file
lib/src/ui/main/chat/widgets/state/state_bubble.dart
View file @
b3905c4e
...
...
@@ -43,8 +43,26 @@ abstract class StateBubble extends Bubble {
isMine:
isMine
);
TextStyle
defaultTextStyle
(
BuildContext
context
)
=>
Theme
.
of
(
context
).
textTheme
.
body1
;
TextStyle
get
defaultEmphasisTextStyle
=>
TextStyle
(
fontWeight:
FontWeight
.
w600
);
@protected
Widget
buildContent
(
BuildContext
context
);
List
<
TextSpan
>
buildContentSpans
(
BuildContext
context
);
@protected
Widget
buildContent
(
BuildContext
context
)
{
return
RichText
(
textAlign:
TextAlign
.
center
,
text:
TextSpan
(
style:
defaultTextStyle
(
context
),
children:
buildContentSpans
(
context
)
)
);
}
@override
Widget
build
(
BuildContext
context
)
{
...
...
lib/src/ui/main/chat/widgets/state/upgrade_bubble.dart
0 → 100644
View file @
b3905c4e
// Copyright (C) 2019 Wilko Manger
// Copyright (C) 2019 Mathieu Velten (FLA signed)
//
// This file is part of Pattle.
//
// Pattle is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Pattle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Pattle. If not, see <https://www.gnu.org/licenses/>.
import
'package:flutter/material.dart'
;
import
'package:matrix_sdk/matrix_sdk.dart'
;
import
'package:pattle/src/ui/main/models/chat_item.dart'
;
import
'package:pattle/src/ui/resources/localizations.dart'
;
import
'package:pattle/src/ui/util/user.dart'
;
import
'state_bubble.dart'
;
class
UpgradeBubble
extends
StateBubble
{
@override
final
RoomUpgradeEvent
event
;
UpgradeBubble
({
@required
ChatEvent
item
,
@required
ChatItem
previousItem
,
@required
ChatItem
nextItem
,
@required
bool
isMine
})
:
event
=
item
.
event
,
super
(
item:
item
,
previousItem:
previousItem
,
nextItem:
nextItem
,
isMine:
isMine
);
@protected
@override
List
<
TextSpan
>
buildContentSpans
(
BuildContext
context
)
=>
l
(
context
).
upgradedThisGroup
(
TextSpan
(
text:
displayNameOf
(
event
.
sender
),
style:
defaultEmphasisTextStyle
)
);
}
\ No newline at end of file
lib/src/ui/main/overview/chat_overview_bloc.dart
View file @
b3905c4e
...
...
@@ -36,6 +36,11 @@ class ChatOverviewBloc {
// Get all rooms and push them as a single list
await
for
(
Room
room
in
_user
.
rooms
.
get
())
{
// Don't show rooms that have been upgraded
if
(
room
.
isUpgraded
)
{
continue
;
}
final
ignoredEvents
=
ignoredEventsOf
(
room
,
isOverview:
true
);
// TODO: Add optional filter argument to up to call
...
...
lib/src/ui/resources/localizations.dart
View file @
b3905c4e
...
...
@@ -86,6 +86,10 @@ class Strings {
List
<
TextSpan
>
createdThisGroup
(
TextSpan
name
)
=>
[
name
,
TextSpan
(
text:
' created this group'
)];
// Room upgrade event
List
<
TextSpan
>
upgradedThisGroup
(
TextSpan
name
)
=>
[
name
,
TextSpan
(
text:
' upgraded this group'
)];
// Member change events
List
<
TextSpan
>
changedTheirNameTo
(
TextSpan
oldName
,
TextSpan
newName
)
=>
[
oldName
,
TextSpan
(
text:
' changed their name to '
),
newName
];
...
...
pubspec.lock
View file @
b3905c4e
...
...
@@ -213,14 +213,14 @@ packages:
name: matrix_sdk
url: "https://pub.dartlang.org"
source: hosted
version: "0.1
6.3
"
version: "0.1
7.1
"
matrix_sdk_sqflite:
dependency: "direct main"
description:
name: matrix_sdk_sqflite
url: "https://pub.dartlang.org"
source: hosted
version: "0.1
2
.0"
version: "0.1
3
.0"
meta:
dependency: transitive
description:
...
...
pubspec.yaml
View file @
b3905c4e
...
...
@@ -12,8 +12,8 @@ dependencies:
injector
:
^1.0.6
matrix_sdk
:
^0.1
6.3
matrix_sdk_sqflite
:
^0.1
2
.0
matrix_sdk
:
^0.1
7.1
matrix_sdk_sqflite
:
^0.1
3
.0
rxdart
:
^0.21.0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment