This commit is contained in:
Inex Code 2020-10-29 09:49:45 +00:00
commit 8959e4bbe0
38 changed files with 933 additions and 1042 deletions

View File

@ -152,12 +152,10 @@ upload_to_fdroid_repo:
- chmod 700 ~/.ssh - chmod 700 ~/.ssh
- ssh-keyscan -t rsa fdroid.nordgedanken.dev >> ~/.ssh/known_hosts - ssh-keyscan -t rsa fdroid.nordgedanken.dev >> ~/.ssh/known_hosts
script: script:
- mkdir -p upload
- cp build/android/* upload/
- cd build/android/ - cd build/android/
- export UPDATE_VERSION=$(pcregrep -o1 'version:\\s([0-9]*\\.[0-9]*\\.[0-9]*)\\+[0-9]*' pubspec.yaml) && mv app-release.apk "${UPDATE_VERSION}.apk" - export UPDATE_VERSION=$(pcregrep -o1 'version:\\s([0-9]*\\.[0-9]*\\.[0-9]*)\\+[0-9]*' ../../pubspec.yaml) && mv app-release.apk "${UPDATE_VERSION}.apk"
- rsync -rav -e ssh ./ fluffy@fdroid.nordgedanken.dev:/fdroid/repo - rsync -rav -e ssh ./ fluffy@fdroid.nordgedanken.dev:/fdroid/repo
- ssh fluffy@fdroid.nordgedanken.dev "cd fdroid && mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc && fdroid update" - ssh fluffy@fdroid.nordgedanken.dev "cd fdroid && fdroid update"
needs: ["build_android_apk"] needs: ["build_android_apk"]
only: only:
- tags - tags
@ -196,6 +194,29 @@ build_linux:
- build/linux/release/bundle/ - build/linux/release/bundle/
only: only:
- main - main
snap:edge:
stage: publish
image: "cibuilds/snapcraft:core18"
only:
- main
script:
## Manually install the flutter-dev snap, so we can use the flutter extension
- 'curl -L $(curl -H "X-Ubuntu-Series: 16" "https://api.snapcraft.io/api/v1/snaps/details/flutter?channel=latest/stable" | jq ".download_url" -r) --output flutter.snap'
- sudo mkdir -p /snap/flutter
- sudo unsquashfs -d /snap/flutter/current flutter.snap
- rm -f flutter.snap
- sudo ln -sf /snap/flutter/current/flutter.sh /snap/bin/flutter
- sudo ln -sf /snap/flutter/current/env.sh /snap/bin/env.sh
- snapcraft
- echo $SNAPCRAFT_LOGIN_FILE | base64 --decode --ignore-garbage > snapcraft.login
- snapcraft login --with snapcraft.login
- snapcraft push --release=edge *.snap
- snapcraft logout
artifacts:
paths:
- './*.snap'
when: on_success
snap:publish: snap:publish:
stage: publish stage: publish

View File

@ -1,4 +1,16 @@
# Version 0.20.0 - 2020-??-?? # Version 0.21.0 - 2020-10-28
### Features
- New user viewer
- Add code syntax highlighting in messages
- Updated translations: Thanks to all helpers
### Changes
- Stories feature removed
### Fixes
- Fixes sentry
- Fixes Android download
- Minor fixes
# Version 0.20.0 - 2020-10-23
### Features ### Features
- Added translations: Arabic - Added translations: Arabic
- Add ability to enable / disable emotes globally - Add ability to enable / disable emotes globally
@ -18,6 +30,7 @@
- Show device name in account information correctly - Show device name in account information correctly
- Fix tapping on aliases / room pills not always working - Fix tapping on aliases / room pills not always working
- Link clicking in web not always working - Link clicking in web not always working
- Return message input field to previous state after editing message - Thanks @inexcode
# Version 0.19.0 - 2020-09-21 # Version 0.19.0 - 2020-09-21
### Features ### Features

View File

@ -54,11 +54,6 @@ cd FurryChat
sudo apt install ninja-build sudo apt install ninja-build
``` ```
* Outcomment the Google Services plugin at the end of the file `android/app/build.gradle`:
```
// apply plugin: "com.google.gms.google-services"
```
* Build with: `flutter build apk` * Build with: `flutter build apk`
### iOS / iPadOS ### iOS / iPadOS

View File

@ -32,7 +32,7 @@ if (keystorePropertiesFile.exists()) {
} }
android { android {
compileSdkVersion 28 compileSdkVersion 30
sourceSets { sourceSets {
main.java.srcDirs += 'src/main/kotlin' main.java.srcDirs += 'src/main/kotlin'
@ -44,8 +44,8 @@ android {
defaultConfig { defaultConfig {
applicationId "dev.inex.furrychat" applicationId "dev.inex.furrychat"
minSdkVersion 18 minSdkVersion 21
targetSdkVersion 28 targetSdkVersion 30
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@ -87,4 +87,4 @@ dependencies {
implementation "net.zetetic:android-database-sqlcipher:4.4.0" // needed for moor_ffi w/ sqlcipher implementation "net.zetetic:android-database-sqlcipher:4.4.0" // needed for moor_ffi w/ sqlcipher
} }
apply plugin: "com.google.gms.google-services" apply plugin: 'com.google.gms.google-services'

View File

@ -1,48 +1,43 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 22.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <!-- Generator: Adobe Illustrator 22.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 181.4 181.9" style="enable-background:new 0 0 181.4 181.9;" xml:space="preserve"> viewBox="0 0 181.4 181.9" style="enable-background:new 0 0 181.4 181.9;" xml:space="preserve">
<style type="text/css"> <style type="text/css">
.st0{fill:url(#SVGID_1_);} .st0{fill:url(#SVGID_1_);}
.st1{fill:#F094BE;} .st1{fill:#F094BE;}
.st2{fill:#4D3F92;} .st2{fill:#4D3F92;}
.st3{fill:#FFFFFF;} .st3{fill:#FFFFFF;}
</style> </style>
<g id="Capa_1"> <g id="Capa_1">
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="90.891" y1="0.2799" x2="90.891" y2="181.8763"> <rect x="0" y="0" style="color:#FFFFFF" width="181.4" height="181.9" class="st3"/>
<stop offset="0" style="stop-color:#F6BFD9"/> </g>
<stop offset="0.9951" style="stop-color:#F3A8CA"/> <g id="Capa_2">
</linearGradient> <g>
<rect x="0.1" y="0.3" class="st0" width="181.6" height="181.6"/> <path class="st2" d="M151.6,95.1c1.5-0.3,2.8-1,3.8-2c4-5.3,0.8-11.8-4.5-12.6c-0.8,0-1.5-0.8-1.5-1.5c0-0.3,0-0.5,0-0.5
<path class="st1" d="M181.7,37.6v144.3H0.1v-37.3c0,0,2-1.4,5.5-3.8C36,119.6,181.7,19.2,181.7,37.6z"/> c0.8-0.8,1.5-1.8,2.5-3.3c8.1-10.8,11.8-50.6,3.8-53.7c-9.8-3.3-29.7,6.3-38.3,17.4c-0.5-0.3-1-1-1-1.8c0.3-3-1.3-5.5-3.5-6.8
</g> c-4.5-2.3-8.8,0-10.6,3.3c-0.5,0.8-1.3,1.3-2,1c-0.8,0-1.5-0.8-1.5-1.5c-0.5-2.5-2-4.5-4.3-5.5c-4.8-2-9.8,0.8-10.6,5.3
<g id="Capa_2"> c-0.3,0.8-0.8,1.5-1.5,1.5c-0.8,0.3-1.5-0.3-2-1c-1.5-2.3-4-3.8-6.5-3.8c-4,0-7.6,3.3-7.8,7.3v0.3v0.3c0,0.8-0.5,1.5-1,1.8h-0.3
<g> c-8.3-10.8-28.5-20.7-38.5-17.4c-8.1,2.8-4.3,42.6,4,53.4c1.5,2,2.8,3.5,3.8,4.5c-0.3,0.8-1,1.5-1.8,1.5c-1.3,0-2.5,0.5-3.5,1.3
<path class="st2" d="M151.6,95.1c1.5-0.3,2.8-1,3.8-2c4-5.3,0.8-11.8-4.5-12.6c-0.8,0-1.5-0.8-1.5-1.5c0-0.3,0-0.5,0-0.5 c-5.3,5-2.3,12.1,3,13.4c0.8,0.3,1.5,1,1.5,1.8c0,0.8-0.5,1.8-1.3,2c-1,0.5-2,1-2.8,2c-4,5.8,0,12.3,5.5,12.3
c0.8-0.8,1.5-1.8,2.5-3.3c8.1-10.8,11.8-50.6,3.8-53.7c-9.8-3.3-29.7,6.3-38.3,17.4c-0.5-0.3-1-1-1-1.8c0.3-3-1.3-5.5-3.5-6.8 c0.8,0,1.5,0.5,1.8,1.3c0.3,0.8,0.3,1.5-0.5,2c-1.5,1.5-2.3,3.5-2,5.5c0.3,2.8,2,5.3,4.8,6.5c1.5,0.8,3,0.8,4.5,0.5
c-4.5-2.3-8.8,0-10.6,3.3c-0.5,0.8-1.3,1.3-2,1c-0.8,0-1.5-0.8-1.5-1.5c-0.5-2.5-2-4.5-4.3-5.5c-4.8-2-9.8,0.8-10.6,5.3 c0.8-0.3,1.5,0,2,0.8c0.5,0.5,0.5,1.5,0.3,2c-0.8,1.5-1,3.3-0.5,5c0.8,2.8,2.8,4.8,5.5,5.5c2.5,0.5,4.3-0.3,5.5-0.8
c-0.3,0.8-0.8,1.5-1.5,1.5c-0.8,0.3-1.5-0.3-2-1c-1.5-2.3-4-3.8-6.5-3.8c-4,0-7.6,3.3-7.8,7.3v0.3v0.3c0,0.8-0.5,1.5-1,1.8h-0.3 c0.5-0.3-3.3,9.1-6,15.4c-0.8,2,1.3,4.3,3.5,3.3c8.3-3.8,22.2-10.3,22.2-9.8c0.5,5.3,6.5,9.1,12.3,5.3c1.3-0.8,2-2.3,2.3-3.5
c-8.3-10.8-28.5-20.7-38.5-17.4c-8.1,2.8-4.3,42.6,4,53.4c1.5,2,2.8,3.5,3.8,4.5c-0.3,0.8-1,1.5-1.8,1.5c-1.3,0-2.5,0.5-3.5,1.3 c0.3-0.8,1-1.5,2-1.5c1,0,1.8,0.5,2,1.5c0.3,1.3,0.8,2.3,1.8,3c5.8,4.5,12.3,0.8,12.8-4.8c0-0.8,0.5-1.5,1.3-1.8
c-5.3,5-2.3,12.1,3,13.4c0.8,0.3,1.5,1,1.5,1.8c0,0.8-0.5,1.8-1.3,2c-1,0.5-2,1-2.8,2c-4,5.8,0,12.3,5.5,12.3 c0.8-0.3,1.5,0,2,0.5c1.5,1.5,3.3,2.5,5.3,2.5l0,0c2.5,0,5-1.3,6.5-3.8c1-1.5,1.3-3,1-5c0-0.8,0.3-1.5,0.8-2c0.5-0.5,1.5-0.5,2,0
c0.8,0,1.5,0.5,1.8,1.3c0.3,0.8,0.3,1.5-0.5,2c-1.5,1.5-2.3,3.5-2,5.5c0.3,2.8,2,5.3,4.8,6.5c1.5,0.8,3,0.8,4.5,0.5 c1.5,0.8,3.3,1.3,5,0.8c2.8-0.5,5-2.8,5.8-5.3c0.5-1.8,0.3-3.5-0.5-5.3c-0.3-0.8-0.3-1.5,0.3-2s1.3-0.8,2-0.8
c0.8-0.3,1.5,0,2,0.8c0.5,0.5,0.5,1.5,0.3,2c-0.8,1.5-1,3.3-0.5,5c0.8,2.8,2.8,4.8,5.5,5.5c2.5,0.5,4.3-0.3,5.5-0.8 c1.8,0.3,3.3,0.3,4.8-0.5c2.3-1,3.8-3,4.3-5.5c0.5-2.5-0.3-4.8-2-6.5c-0.5-0.5-0.8-1.3-0.5-2s1-1.3,1.8-1.3c1.8,0,3.8-0.5,5-2
c0.5-0.3-3.3,9.1-6,15.4c-0.8,2,1.3,4.3,3.5,3.3c8.3-3.8,22.2-10.3,22.2-9.8c0.5,5.3,6.5,9.1,12.3,5.3c1.3-0.8,2-2.3,2.3-3.5 c4.3-4.5,2.3-10.6-2.5-12.6c-0.8-0.3-1.3-1-1.3-2C150.1,95.8,150.8,95.1,151.6,95.1z"/>
c0.3-0.8,1-1.5,2-1.5c1,0,1.8,0.5,2,1.5c0.3,1.3,0.8,2.3,1.8,3c5.8,4.5,12.3,0.8,12.8-4.8c0-0.8,0.5-1.5,1.3-1.8 <path class="st3" d="M131.4,42.2c0.5,1.5,0.5,3,0,4.5c-0.3,0.8,0,1.5,0.5,2s1.3,0.8,2,0.5c1-0.5,2-0.5,3-0.5c2.3,0,4.3,1,5.8,3
c0.8-0.3,1.5,0,2,0.5c1.5,1.5,3.3,2.5,5.3,2.5l0,0c2.5,0,5-1.3,6.5-3.8c1-1.5,1.3-3,1-5c0-0.8,0.3-1.5,0.8-2c0.5-0.5,1.5-0.5,2,0 c1,1.3,1.8,3,1.5,4.8c0,1.5-0.5,2.8-1.3,4c-0.5,0.5-0.5,1.5,0,2c0.3,0.3,0.5,0.8,1,0.8c1-0.3,2-1,2.8-2c4.5-6.3,5.3-26.2,0.8-27.7
c1.5,0.8,3.3,1.3,5,0.8c2.8-0.5,5-2.8,5.8-5.3c0.5-1.8,0.3-3.5-0.5-5.3c-0.3-0.8-0.3-1.5,0.3-2s1.3-0.8,2-0.8 c-4.5-1.5-12.3,1.5-17.9,6C130.7,40.1,131.2,40.9,131.4,42.2z"/>
c1.8,0.3,3.3,0.3,4.8-0.5c2.3-1,3.8-3,4.3-5.5c0.5-2.5-0.3-4.8-2-6.5c-0.5-0.5-0.8-1.3-0.5-2s1-1.3,1.8-1.3c1.8,0,3.8-0.5,5-2 <path class="st3" d="M39,63.6c0.3-0.3,0.5-0.5,0.8-0.8c0.5-0.8,0.3-1.5,0-2C38.5,59,38.2,57,38.5,55c0.5-2.8,2.8-5,5.5-5.8
c4.3-4.5,2.3-10.6-2.5-12.6c-0.8-0.3-1.3-1-1.3-2C150.1,95.8,150.8,95.1,151.6,95.1z"/> c1.5-0.5,3-0.3,4.5,0.3c0.8,0.3,1.5,0,2-0.5c0.5-0.5,0.8-1.3,0.5-2c-0.5-1.5-0.5-3,0-4.5c0.3-1,0.8-2,1.5-2.8
<path class="st3" d="M131.4,42.2c0.5,1.5,0.5,3,0,4.5c-0.3,0.8,0,1.5,0.5,2s1.3,0.8,2,0.5c1-0.5,2-0.5,3-0.5c2.3,0,4.3,1,5.8,3 c-5.5-4.5-13.9-7.8-18.4-6.3S30.4,54.8,35,61.1C36,62.6,37.2,63.3,39,63.6z"/>
c1,1.3,1.8,3,1.5,4.8c0,1.5-0.5,2.8-1.3,4c-0.5,0.5-0.5,1.5,0,2c0.3,0.3,0.5,0.8,1,0.8c1-0.3,2-1,2.8-2c4.5-6.3,5.3-26.2,0.8-27.7 <g>
c-4.5-1.5-12.3,1.5-17.9,6C130.7,40.1,131.2,40.9,131.4,42.2z"/> <circle class="st3" cx="60.9" cy="94.6" r="9.3"/>
<path class="st3" d="M39,63.6c0.3-0.3,0.5-0.5,0.8-0.8c0.5-0.8,0.3-1.5,0-2C38.5,59,38.2,57,38.5,55c0.5-2.8,2.8-5,5.5-5.8 <path class="st3" d="M100.7,94.6c0,5.3-4.3,9.3-9.3,9.3c-5.3,0-9.3-4.3-9.3-9.3S100.7,89.3,100.7,94.6z"/>
c1.5-0.5,3-0.3,4.5,0.3c0.8,0.3,1.5,0,2-0.5c0.5-0.5,0.8-1.3,0.5-2c-0.5-1.5-0.5-3,0-4.5c0.3-1,0.8-2,1.5-2.8 <circle class="st3" cx="121.6" cy="94.6" r="9.3"/>
c-5.5-4.5-13.9-7.8-18.4-6.3S30.4,54.8,35,61.1C36,62.6,37.2,63.3,39,63.6z"/> </g>
<g> </g>
<circle class="st3" cx="60.9" cy="94.6" r="9.3"/> </g>
<path class="st3" d="M100.7,94.6c0,5.3-4.3,9.3-9.3,9.3c-5.3,0-9.3-4.3-9.3-9.3S100.7,89.3,100.7,94.6z"/> </svg>
<circle class="st3" cx="121.6" cy="94.6" r="9.3"/>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -45,10 +45,12 @@ class Avatar extends StatelessWidget {
), ),
); );
final noPic = mxContent == null || mxContent.toString().isEmpty; final noPic = mxContent == null || mxContent.toString().isEmpty;
final borderRadius = BorderRadius.circular(size / 2);
return InkWell( return InkWell(
onTap: onTap, onTap: onTap,
borderRadius: borderRadius,
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(size / 2), borderRadius: borderRadius,
child: Container( child: Container(
width: size, width: size,
height: size, height: size,
@ -68,6 +70,11 @@ class Avatar extends StatelessWidget {
textWidget, textWidget,
], ],
), ),
errorWidget: (c, s, d) => Stack(
children: [
textWidget,
],
),
), ),
), ),
), ),

View File

@ -19,7 +19,7 @@ class SendFileDialog extends StatefulWidget {
class _SendFileDialogState extends State<SendFileDialog> { class _SendFileDialogState extends State<SendFileDialog> {
bool origImage = false; bool origImage = false;
bool _isSending = false;
Future<void> _send() async { Future<void> _send() async {
var file = widget.file; var file = widget.file;
if (file is MatrixImageFile && !origImage) { if (file is MatrixImageFile && !origImage) {
@ -82,10 +82,16 @@ class _SendFileDialogState extends State<SendFileDialog> {
), ),
FlatButton( FlatButton(
child: Text(L10n.of(context).send), child: Text(L10n.of(context).send),
onPressed: () async { onPressed: _isSending
await SimpleDialogs(context).tryRequestWithLoadingDialog(_send()); ? null
await Navigator.of(context).pop(); : () async {
}, setState(() {
_isSending = true;
});
await SimpleDialogs(context)
.tryRequestWithLoadingDialog(_send());
await Navigator.of(context).pop();
},
), ),
], ],
); );

View File

@ -33,6 +33,8 @@ class HtmlMessage extends StatelessWidget {
// there is no need to pre-validate the html, as we validate it while rendering // there is no need to pre-validate the html, as we validate it while rendering
final matrix = Matrix.of(context);
final themeData = Theme.of(context); final themeData = Theme.of(context);
return Html( return Html(
data: renderHtml, data: renderHtml,
@ -50,12 +52,18 @@ class HtmlMessage extends StatelessWidget {
getMxcUrl: (String mxc, double width, double height) { getMxcUrl: (String mxc, double width, double height) {
final ratio = MediaQuery.of(context).devicePixelRatio; final ratio = MediaQuery.of(context).devicePixelRatio;
return Uri.parse(mxc)?.getThumbnail( return Uri.parse(mxc)?.getThumbnail(
Matrix.of(context).client, matrix.client,
width: (width ?? 800) * ratio, width: (width ?? 800) * ratio,
height: (height ?? 800) * ratio, height: (height ?? 800) * ratio,
method: ThumbnailMethod.scale, method: ThumbnailMethod.scale,
); );
}, },
setCodeLanguage: (String key, String value) async {
await matrix.store.setItem('code_language.$key', value);
},
getCodeLanguage: (String key) async {
return await matrix.store.getItem('code_language.$key');
},
getPillInfo: (String identifier) async { getPillInfo: (String identifier) async {
if (room == null) { if (room == null) {
return null; return null;

View File

@ -7,60 +7,13 @@ import '../../views/chat.dart';
import '../avatar.dart'; import '../avatar.dart';
import '../dialogs/simple_dialogs.dart'; import '../dialogs/simple_dialogs.dart';
import '../matrix.dart'; import '../matrix.dart';
import '../user_bottom_sheet.dart';
class ParticipantListItem extends StatelessWidget { class ParticipantListItem extends StatelessWidget {
final User user; final User user;
const ParticipantListItem(this.user); const ParticipantListItem(this.user);
void participantAction(BuildContext context, String action) async {
switch (action) {
case 'ban':
if (await SimpleDialogs(context).askConfirmation()) {
await SimpleDialogs(context).tryRequestWithLoadingDialog(user.ban());
}
break;
case 'unban':
if (await SimpleDialogs(context).askConfirmation()) {
await SimpleDialogs(context)
.tryRequestWithLoadingDialog(user.unban());
}
break;
case 'kick':
if (await SimpleDialogs(context).askConfirmation()) {
await SimpleDialogs(context).tryRequestWithLoadingDialog(user.kick());
}
break;
case 'admin':
if (await SimpleDialogs(context).askConfirmation()) {
await SimpleDialogs(context)
.tryRequestWithLoadingDialog(user.setPower(100));
}
break;
case 'moderator':
if (await SimpleDialogs(context).askConfirmation()) {
await SimpleDialogs(context)
.tryRequestWithLoadingDialog(user.setPower(50));
}
break;
case 'user':
if (await SimpleDialogs(context).askConfirmation()) {
await SimpleDialogs(context)
.tryRequestWithLoadingDialog(user.setPower(0));
}
break;
case 'message':
final roomId = await user.startDirectChat();
await Navigator.of(context).pushAndRemoveUntil(
AppRoute.defaultRoute(
context,
ChatView(roomId),
),
(Route r) => r.isFirst);
break;
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var membershipBatch = <Membership, String>{ var membershipBatch = <Membership, String>{
@ -74,87 +27,43 @@ class ParticipantListItem extends StatelessWidget {
: user.powerLevel >= 50 : user.powerLevel >= 50
? L10n.of(context).moderator ? L10n.of(context).moderator
: ''; : '';
var items = <PopupMenuEntry<String>>[];
if (user.id != Matrix.of(context).client.userID) { return ListTile(
items.add( onTap: () => showModalBottomSheet(
PopupMenuItem( context: context,
child: Text(L10n.of(context).sendAMessage), value: 'message'), builder: (context) => UserBottomSheet(
); user: user,
}
if (user.canChangePowerLevel &&
user.room.ownPowerLevel == 100 &&
user.powerLevel != 100) {
items.add(
PopupMenuItem(
child: Text(L10n.of(context).makeAnAdmin), value: 'admin'),
);
}
if (user.canChangePowerLevel &&
user.room.ownPowerLevel >= 50 &&
user.powerLevel != 50) {
items.add(
PopupMenuItem(
child: Text(L10n.of(context).makeAModerator), value: 'moderator'),
);
}
if (user.canChangePowerLevel && user.powerLevel != 0) {
items.add(
PopupMenuItem(
child: Text(L10n.of(context).revokeAllPermissions), value: 'user'),
);
}
if (user.canKick) {
items.add(
PopupMenuItem(
child: Text(L10n.of(context).kickFromChat), value: 'kick'),
);
}
if (user.canBan && user.membership != Membership.ban) {
items.add(
PopupMenuItem(child: Text(L10n.of(context).banFromChat), value: 'ban'),
);
} else if (user.canBan && user.membership == Membership.ban) {
items.add(
PopupMenuItem(
child: Text(L10n.of(context).removeExile), value: 'unban'),
);
}
return PopupMenuButton(
onSelected: (action) => participantAction(context, action),
itemBuilder: (c) => items,
child: ListTile(
title: Row(
children: <Widget>[
Text(user.calcDisplayname()),
permissionBatch.isEmpty
? Container()
: Container(
padding: EdgeInsets.all(4),
margin: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
color: Theme.of(context).secondaryHeaderColor,
borderRadius: BorderRadius.circular(8),
),
child: Center(child: Text(permissionBatch)),
),
membershipBatch[user.membership].isEmpty
? Container()
: Container(
padding: EdgeInsets.all(4),
margin: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
color: Theme.of(context).secondaryHeaderColor,
borderRadius: BorderRadius.circular(8),
),
child:
Center(child: Text(membershipBatch[user.membership])),
),
],
), ),
subtitle: Text(user.id),
leading: Avatar(user.avatarUrl, user.calcDisplayname()),
), ),
title: Row(
children: <Widget>[
Text(user.calcDisplayname()),
permissionBatch.isEmpty
? Container()
: Container(
padding: EdgeInsets.all(4),
margin: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
color: Theme.of(context).secondaryHeaderColor,
borderRadius: BorderRadius.circular(8),
),
child: Center(child: Text(permissionBatch)),
),
membershipBatch[user.membership].isEmpty
? Container()
: Container(
padding: EdgeInsets.all(4),
margin: EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
color: Theme.of(context).secondaryHeaderColor,
borderRadius: BorderRadius.circular(8),
),
child: Center(child: Text(membershipBatch[user.membership])),
),
],
),
subtitle: Text(user.id),
leading: Avatar(user.avatarUrl, user.calcDisplayname()),
); );
} }
} }

View File

@ -1,84 +0,0 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:flutter/material.dart';
import '../../utils/user_status.dart';
import '../../views/status_view.dart';
import '../avatar.dart';
import '../matrix.dart';
class StatusListItem extends StatelessWidget {
final UserStatus status;
const StatusListItem(this.status, {Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
final client = Matrix.of(context).client;
return FutureBuilder<Profile>(
future: client.getProfileFromUserId(status.userId),
builder: (context, snapshot) {
final profile =
snapshot.data ?? Profile(status.userId.localpart, null);
return InkWell(
borderRadius: BorderRadius.circular(8),
onTap: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => StatusView(
status: status,
avatarUrl: profile.avatarUrl,
displayname: profile.displayname,
),
),
),
child: Container(
width: 76,
child: Column(
children: <Widget>[
SizedBox(height: 10),
Container(
child: Stack(
children: [
Avatar(profile.avatarUrl, profile.displayname),
Positioned(
bottom: 0,
right: 0,
child: Container(
width: 10,
height: 10,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.green,
),
),
),
],
),
decoration: BoxDecoration(
border: Border.all(
width: 1,
color: Theme.of(context).primaryColor,
),
borderRadius: BorderRadius.circular(80),
),
padding: EdgeInsets.all(2),
),
Padding(
padding:
const EdgeInsets.only(left: 6.0, top: 0.0, right: 6.0),
child: Text(
profile.displayname.trim().split(' ').first,
overflow: TextOverflow.clip,
maxLines: 1,
style: TextStyle(
color: Theme.of(context).textTheme.bodyText2.color,
fontSize: 13,
),
),
),
],
),
),
);
});
}
}

View File

@ -82,8 +82,7 @@ class MatrixState extends State<Matrix> {
void clean() async { void clean() async {
if (!kIsWeb) return; if (!kIsWeb) return;
final storage = await getLocalStorage(); await store.deleteItem(widget.clientName);
await storage.deleteItem(widget.clientName);
} }
void _initWithStore() async { void _initWithStore() async {
@ -93,7 +92,6 @@ class MatrixState extends State<Matrix> {
await client.connect(); await client.connect();
final firstLoginState = await initLoginState; final firstLoginState = await initLoginState;
if (firstLoginState == LoginState.logged) { if (firstLoginState == LoginState.logged) {
_cleanUpUserStatus(userStatuses);
if (PlatformInfos.isMobile) { if (PlatformInfos.isMobile) {
await FirebaseController.setupFirebase( await FirebaseController.setupFirebase(
this, this,
@ -124,7 +122,6 @@ class MatrixState extends State<Matrix> {
StreamSubscription onNotification; StreamSubscription onNotification;
StreamSubscription<html.Event> onFocusSub; StreamSubscription<html.Event> onFocusSub;
StreamSubscription<html.Event> onBlurSub; StreamSubscription<html.Event> onBlurSub;
StreamSubscription onPresenceSub;
void onJitsiCall(EventUpdate eventUpdate) { void onJitsiCall(EventUpdate eventUpdate) {
final event = Event.fromJson( final event = Event.fromJson(
@ -247,12 +244,9 @@ class MatrixState extends State<Matrix> {
importantStateEvents: <String>{ importantStateEvents: <String>{
'im.ponies.room_emotes', // we want emotes to work properly 'im.ponies.room_emotes', // we want emotes to work properly
}); });
onPresenceSub ??= client.onPresence.stream
.where((p) => p.isUserStatus)
.listen(_storeUserStatus);
onJitsiCallSub ??= client.onEvent.stream onJitsiCallSub ??= client.onEvent.stream
.where((e) => .where((e) =>
e.type == 'timeline' && e.type == EventUpdateType.timeline &&
e.eventType == 'm.room.message' && e.eventType == 'm.room.message' &&
e.content['content']['msgtype'] == Matrix.callNamespace && e.content['content']['msgtype'] == Matrix.callNamespace &&
e.content['sender'] != client.userID) e.content['sender'] != client.userID)
@ -331,7 +325,7 @@ class MatrixState extends State<Matrix> {
html.Notification.requestPermission(); html.Notification.requestPermission();
onNotification ??= client.onEvent.stream onNotification ??= client.onEvent.stream
.where((e) => .where((e) =>
e.type == 'timeline' && e.type == EventUpdateType.timeline &&
[EventTypes.Message, EventTypes.Sticker, EventTypes.Encrypted] [EventTypes.Message, EventTypes.Sticker, EventTypes.Encrypted]
.contains(e.eventType) && .contains(e.eventType) &&
e.content['sender'] != client.userID) e.content['sender'] != client.userID)
@ -341,64 +335,11 @@ class MatrixState extends State<Matrix> {
super.initState(); super.initState();
} }
List<UserStatus> get userStatuses {
try {
return (client.accountData[userStatusesType].content['user_statuses']
as List)
.map((json) => UserStatus.fromJson(json))
.toList();
} catch (_) {}
return [];
}
void _storeUserStatus(Presence presence) {
final tmpUserStatuses = List<UserStatus>.from(userStatuses);
final currentStatusIndex =
userStatuses.indexWhere((u) => u.userId == presence.senderId);
final newUserStatus = UserStatus()
..receivedAt = DateTime.now().millisecondsSinceEpoch
..statusMsg = presence.presence.statusMsg
..userId = presence.senderId;
if (currentStatusIndex == -1) {
tmpUserStatuses.add(newUserStatus);
} else if (tmpUserStatuses[currentStatusIndex].statusMsg !=
presence.presence.statusMsg) {
if (presence.presence.statusMsg.trim().isEmpty) {
tmpUserStatuses.removeAt(currentStatusIndex);
} else {
tmpUserStatuses[currentStatusIndex] = newUserStatus;
}
} else {
return;
}
_cleanUpUserStatus(tmpUserStatuses);
}
void _cleanUpUserStatus(List<UserStatus> tmpUserStatuses) {
final now = DateTime.now().millisecondsSinceEpoch;
tmpUserStatuses
.removeWhere((u) => (now - u.receivedAt) > (1000 * 60 * 60 * 24));
tmpUserStatuses.sort((a, b) => b.receivedAt.compareTo(a.receivedAt));
if (tmpUserStatuses.length > 40) {
tmpUserStatuses.removeRange(40, tmpUserStatuses.length);
}
if (tmpUserStatuses != userStatuses) {
client.setAccountData(
client.userID,
userStatusesType,
{
'user_statuses': tmpUserStatuses.map((i) => i.toJson()).toList(),
},
);
}
}
@override @override
void dispose() { void dispose() {
onRoomKeyRequestSub?.cancel(); onRoomKeyRequestSub?.cancel();
onKeyVerificationRequestSub?.cancel(); onKeyVerificationRequestSub?.cancel();
onJitsiCallSub?.cancel(); onJitsiCallSub?.cancel();
onPresenceSub?.cancel();
onNotification?.cancel(); onNotification?.cancel();
onFocusSub?.cancel(); onFocusSub?.cancel();
onBlurSub?.cancel(); onBlurSub?.cancel();

View File

@ -175,7 +175,7 @@ class ThemeSwitcherWidgetState extends State<ThemeSwitcherWidget> {
BuildContext context; BuildContext context;
Future loadSelection(MatrixState matrix) async { Future loadSelection(MatrixState matrix) async {
String item = await matrix.store.getItem('theme') ?? 'system'; var item = await matrix.store.getItem('theme') ?? 'system';
selectedTheme = Themes.values.firstWhere( selectedTheme = Themes.values.firstWhere(
(e) => e.toString() == 'Themes.' + item, (e) => e.toString() == 'Themes.' + item,
orElse: () => Themes.system); orElse: () => Themes.system);

View File

@ -0,0 +1,188 @@
import 'dart:math';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/adaptive_page_layout.dart';
import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/utils/fluffy_share.dart';
import 'package:fluffychat/views/chat.dart';
import 'package:flutter/material.dart';
import 'content_banner.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import '../utils/presence_extension.dart';
import 'dialogs/simple_dialogs.dart';
import 'matrix.dart';
class UserBottomSheet extends StatelessWidget {
final User user;
final Function onMention;
const UserBottomSheet({Key key, @required this.user, this.onMention})
: super(key: key);
void participantAction(BuildContext context, String action) async {
switch (action) {
case 'mention':
Navigator.of(context).pop();
onMention();
break;
case 'ban':
if (await SimpleDialogs(context).askConfirmation()) {
await SimpleDialogs(context).tryRequestWithLoadingDialog(user.ban());
}
break;
case 'unban':
if (await SimpleDialogs(context).askConfirmation()) {
await SimpleDialogs(context)
.tryRequestWithLoadingDialog(user.unban());
}
break;
case 'kick':
if (await SimpleDialogs(context).askConfirmation()) {
await SimpleDialogs(context).tryRequestWithLoadingDialog(user.kick());
}
break;
case 'admin':
if (await SimpleDialogs(context).askConfirmation()) {
await SimpleDialogs(context)
.tryRequestWithLoadingDialog(user.setPower(100));
}
break;
case 'moderator':
if (await SimpleDialogs(context).askConfirmation()) {
await SimpleDialogs(context)
.tryRequestWithLoadingDialog(user.setPower(50));
}
break;
case 'user':
if (await SimpleDialogs(context).askConfirmation()) {
await SimpleDialogs(context)
.tryRequestWithLoadingDialog(user.setPower(0));
}
break;
case 'message':
final roomId = await user.startDirectChat();
await Navigator.of(context).pushAndRemoveUntil(
AppRoute.defaultRoute(
context,
ChatView(roomId),
),
(Route r) => r.isFirst);
break;
}
}
@override
Widget build(BuildContext context) {
final presence = Matrix.of(context).client.presences[user.id];
var items = <PopupMenuEntry<String>>[];
if (onMention != null) {
items.add(
PopupMenuItem(child: Text(L10n.of(context).mention), value: 'mention'),
);
}
if (user.id != Matrix.of(context).client.userID) {
items.add(
PopupMenuItem(
child: Text(L10n.of(context).sendAMessage), value: 'message'),
);
}
if (user.canChangePowerLevel &&
user.room.ownPowerLevel == 100 &&
user.powerLevel != 100) {
items.add(
PopupMenuItem(
child: Text(L10n.of(context).makeAnAdmin), value: 'admin'),
);
}
if (user.canChangePowerLevel &&
user.room.ownPowerLevel >= 50 &&
user.powerLevel != 50) {
items.add(
PopupMenuItem(
child: Text(L10n.of(context).makeAModerator), value: 'moderator'),
);
}
if (user.canChangePowerLevel && user.powerLevel != 0) {
items.add(
PopupMenuItem(
child: Text(L10n.of(context).revokeAllPermissions), value: 'user'),
);
}
if (user.canKick) {
items.add(
PopupMenuItem(
child: Text(L10n.of(context).kickFromChat), value: 'kick'),
);
}
if (user.canBan && user.membership != Membership.ban) {
items.add(
PopupMenuItem(child: Text(L10n.of(context).banFromChat), value: 'ban'),
);
} else if (user.canBan && user.membership == Membership.ban) {
items.add(
PopupMenuItem(
child: Text(L10n.of(context).removeExile), value: 'unban'),
);
}
return Center(
child: Container(
width: min(MediaQuery.of(context).size.width,
AdaptivePageLayout.defaultMinWidth * 1.5),
child: SafeArea(
child: Material(
elevation: 4,
child: Scaffold(
extendBodyBehindAppBar: true,
appBar: AppBar(
elevation: 0,
backgroundColor:
Theme.of(context).scaffoldBackgroundColor.withOpacity(0.5),
leading: IconButton(
icon: Icon(Icons.arrow_downward_outlined),
onPressed: Navigator.of(context).pop,
),
title: Text(user.calcDisplayname()),
actions: [
if (user.id != Matrix.of(context).client.userID)
PopupMenuButton(
itemBuilder: (_) => items,
onSelected: (action) =>
participantAction(context, action),
),
],
),
body: Column(
children: [
Expanded(
child: ContentBanner(
user.avatarUrl,
defaultIcon: Icons.person_outline,
),
),
ListTile(
title: Text(L10n.of(context).username),
subtitle: Text(user.id),
trailing: Icon(Icons.share),
onTap: () => FluffyShare.share(user.id, context),
),
if (presence != null)
ListTile(
title: Text(presence.getLocalizedStatusMessage(context)),
subtitle:
Text(presence.getLocalizedLastActiveAgo(context)),
trailing: Icon(Icons.circle,
color: presence.presence.currentlyActive
? Colors.green
: Colors.grey),
),
],
),
),
),
),
),
);
}
}

View File

@ -920,6 +920,11 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"mention": "Mention",
"@mention": {
"type": "text",
"placeholders": {}
},
"messageWillBeRemovedWarning": "Message will be removed for all participants", "messageWillBeRemovedWarning": "Message will be removed for all participants",
"@messageWillBeRemovedWarning": { "@messageWillBeRemovedWarning": {
"type": "text", "type": "text",
@ -1017,6 +1022,21 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"online": "Online",
"@online": {
"type": "text",
"placeholders": {}
},
"offline": "Offline",
"@offline": {
"type": "text",
"placeholders": {}
},
"unavailable": "Unavailable",
"@unavailable": {
"type": "text",
"placeholders": {}
},
"onlineKeyBackupEnabled": "Online Key Backup is enabled", "onlineKeyBackupEnabled": "Online Key Backup is enabled",
"@onlineKeyBackupEnabled": { "@onlineKeyBackupEnabled": {
"type": "text", "type": "text",

1
lib/l10n/intl_eo.arb Normal file
View File

@ -0,0 +1 @@
{}

View File

@ -461,5 +461,122 @@
"@askSSSSCache": { "@askSSSSCache": {
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
},
"enterAUsername": "Inserisci un username",
"@enterAUsername": {
"type": "text",
"placeholders": {}
},
"enterAGroupName": "Inserisci un nome del gruppo",
"@enterAGroupName": {
"type": "text",
"placeholders": {}
},
"endedTheCall": "{senderName} è entrato in chiamata",
"@endedTheCall": {
"type": "text",
"placeholders": {
"senderName": {}
}
},
"end2endEncryptionSettings": "Impostazioni crittografia end-to-end",
"@end2endEncryptionSettings": {
"type": "text",
"placeholders": {}
},
"encryptionNotEnabled": "Crittografia non abilitata",
"@encryptionNotEnabled": {
"type": "text",
"placeholders": {}
},
"encryptionAlgorithm": "Algoritmo crittografia",
"@encryptionAlgorithm": {
"type": "text",
"placeholders": {}
},
"encryption": "Crittografia",
"@encryption": {
"type": "text",
"placeholders": {}
},
"enableEncryptionWarning": "Non potrai disabilitare la crittografia in futuro. Sei sicuro?",
"@enableEncryptionWarning": {
"type": "text",
"placeholders": {}
},
"enableEmotesGlobally": "Abilita i pacchetti emotes globalmente",
"@enableEmotesGlobally": {
"type": "text",
"placeholders": {}
},
"emptyChat": "Chat vuota",
"@emptyChat": {
"type": "text",
"placeholders": {}
},
"emotePacks": "Pacchetti emotes della stanza",
"@emotePacks": {
"type": "text",
"placeholders": {}
},
"emoteInvalid": "Shortcode emote invalido!",
"@emoteInvalid": {
"type": "text",
"placeholders": {}
},
"emoteExists": "L'emote già esiste!",
"@emoteExists": {
"type": "text",
"placeholders": {}
},
"emoteWarnNeedToPick": "Devi scegliere uno shortcode emote e aggiungere un immagine!",
"@emoteWarnNeedToPick": {
"type": "text",
"placeholders": {}
},
"emoteShortcode": "Shortcode Emotes",
"@emoteShortcode": {
"type": "text",
"placeholders": {}
},
"emoteSettings": "Impostazioni Emotes",
"@emoteSettings": {
"type": "text",
"placeholders": {}
},
"editDisplayname": "Modifica nominativo",
"@editDisplayname": {
"type": "text",
"placeholders": {}
},
"downloadFile": "Scarica file",
"@downloadFile": {
"type": "text",
"placeholders": {}
},
"displaynameHasBeenChanged": "Il nominativo è stato cambiato",
"@displaynameHasBeenChanged": {
"type": "text",
"placeholders": {}
},
"discardPicture": "Rimuovi immagine",
"@discardPicture": {
"type": "text",
"placeholders": {}
},
"devices": "Dispositivi",
"@devices": {
"type": "text",
"placeholders": {}
},
"device": "Dispositivo",
"@device": {
"type": "text",
"placeholders": {}
},
"deny": "Declina",
"@deny": {
"type": "text",
"placeholders": {}
} }
} }

View File

@ -1733,7 +1733,7 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"deactivateAccountWarning": "Это деактивирует вашу учётную запись пользователя. Это не может быть отменено! Вы уверены?", "deactivateAccountWarning": "Это деактивирует вашу учётную запись пользователя. Данное действие не может быть отменено! Вы уверены?",
"@deactivateAccountWarning": { "@deactivateAccountWarning": {
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
@ -1743,12 +1743,12 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"enableEmotesGlobally": "Включить набор эмоджи глобально", "enableEmotesGlobally": "Включить набор эмодзи глобально",
"@enableEmotesGlobally": { "@enableEmotesGlobally": {
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"emotePacks": "Наборы эмоджи для комнаты", "emotePacks": "Наборы эмодзи для комнаты",
"@emotePacks": { "@emotePacks": {
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}

View File

@ -137,7 +137,7 @@
"targetName": {} "targetName": {}
} }
}, },
"blockDevice": "Cihazı Engelle", "blockDevice": "Aygıtı Engelle",
"@blockDevice": { "@blockDevice": {
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
@ -323,12 +323,12 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"compareEmojiMatch": "Karşılaştırın ve aşağıdaki emojilerin diğer cihazdakilerle eşleştiğinden emin olun:", "compareEmojiMatch": "Karşılaştırın ve aşağıdaki emojilerin diğer aygıttaki emojilerle eşleştiğinden emin olun:",
"@compareEmojiMatch": { "@compareEmojiMatch": {
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"compareNumbersMatch": "Karşılaştırın ve aşağıdaki numaraların diğer cihazdakilerle eşleştiğinden emin olun:", "compareNumbersMatch": "Karşılaştırın ve aşağıdaki numaraların diğer aygıttaki numaralarla eşleştiğinden emin olun:",
"@compareNumbersMatch": { "@compareNumbersMatch": {
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
@ -474,12 +474,12 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"device": "Cihaz", "device": "Aygıt",
"@device": { "@device": {
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"devices": "Cihazlar", "devices": "Aygıtlar",
"@devices": { "@devices": {
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
@ -727,7 +727,7 @@
"link": {} "link": {}
} }
}, },
"isDeviceKeyCorrect": "Aşağıdaki cihaz anahtarı doğru mu?", "isDeviceKeyCorrect": "Aşağıdaki aygıt anahtarı doğru mu?",
"@isDeviceKeyCorrect": { "@isDeviceKeyCorrect": {
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
@ -983,7 +983,7 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"participatingUserDevices": "Katılan kullanıcı cihazları", "participatingUserDevices": "Katılan kullanıcı aygıtları",
"@participatingUserDevices": { "@participatingUserDevices": {
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
@ -1069,7 +1069,7 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"removeAllOtherDevices": "Diğer tüm cihazları kaldır", "removeAllOtherDevices": "Diğer tüm aygıtları kaldır",
"@removeAllOtherDevices": { "@removeAllOtherDevices": {
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
@ -1081,7 +1081,7 @@
"username": {} "username": {}
} }
}, },
"removeDevice": "Cihazı kaldır", "removeDevice": "Aygıtı kaldır",
"@removeDevice": { "@removeDevice": {
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
@ -1355,12 +1355,12 @@
"targetName": {} "targetName": {}
} }
}, },
"unblockDevice": "Cihazın Engellemesini Kaldır", "unblockDevice": "Aygıtın Engellemesini Kaldır",
"@unblockDevice": { "@unblockDevice": {
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"unknownDevice": "Bilinmeyen cihaz", "unknownDevice": "Bilinmeyen aygıt",
"@unknownDevice": { "@unknownDevice": {
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
@ -1718,7 +1718,7 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"changeDeviceName": "Cihaz adını değiştir", "changeDeviceName": "Aygıt adını değiştir",
"@changeDeviceName": { "@changeDeviceName": {
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}

98
lib/l10n/intl_vi.arb Normal file
View File

@ -0,0 +1,98 @@
{
"blockDevice": "Thiết bị bị chặn",
"@blockDevice": {
"type": "text",
"placeholders": {}
},
"askSSSSCache": "Vui lòng nhập cụm mật khẩu hoặc khóa khôi phục để lưu khóa vào bộ nhớ cache.",
"@askSSSSCache": {
"type": "text",
"placeholders": {}
},
"areYouSure": "Bạn chắc chứ?",
"@areYouSure": {
"type": "text",
"placeholders": {}
},
"areGuestsAllowedToJoin": "Khách vãng lai có được tham gia không",
"@areGuestsAllowedToJoin": {
"type": "text",
"placeholders": {}
},
"archivedRoom": "Phòng hội thảo đã lưu trữ",
"@archivedRoom": {
"type": "text",
"placeholders": {}
},
"archive": "Lưu trữ",
"@archive": {
"type": "text",
"placeholders": {}
},
"anyoneCanJoin": "Mọi người đều có thể gia nhập",
"@anyoneCanJoin": {
"type": "text",
"placeholders": {}
},
"answeredTheCall": "{senderName} đã trả lời cuộc gọi",
"@answeredTheCall": {
"type": "text",
"placeholders": {
"senderName": {}
}
},
"alreadyHaveAnAccount": "Bạn đã có tài khoản?",
"@alreadyHaveAnAccount": {
"type": "text",
"placeholders": {}
},
"alias": "bí danh",
"@alias": {
"type": "text",
"placeholders": {}
},
"admin": "Quản trị viên",
"@admin": {
"type": "text",
"placeholders": {}
},
"addGroupDescription": "Thêm mô tả cho nhóm",
"@addGroupDescription": {
"type": "text",
"placeholders": {}
},
"activatedEndToEndEncryption": "{username} đã kích hoạt mã hóa đầu cuối 2 chiều",
"@activatedEndToEndEncryption": {
"type": "text",
"placeholders": {
"username": {}
}
},
"accountInformation": "Thông tin tài khoản",
"@accountInformation": {
"type": "text",
"placeholders": {}
},
"account": "Tài khoản",
"@account": {
"type": "text",
"placeholders": {}
},
"acceptedTheInvitation": "{username} đã đồng ý lời mời",
"@acceptedTheInvitation": {
"type": "text",
"placeholders": {
"username": {}
}
},
"accept": "Đồng ý",
"@accept": {
"type": "text",
"placeholders": {}
},
"about": "Giới thiệu",
"@about": {
"type": "text",
"placeholders": {}
}
}

View File

@ -1,27 +1,12 @@
import 'dart:async'; import '../famedlysdk.dart';
import 'dart:convert'; import './platform_infos.dart';
import 'dart:core';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:localstorage/localstorage.dart'; import 'package:localstorage/localstorage.dart';
import 'package:olm/olm.dart' as olm; // needed for migration
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:random_string/random_string.dart'; import 'dart:async';
import 'dart:core';
import './database/shared.dart'; import './database/shared.dart';
import 'platform_infos.dart'; import 'package:random_string/random_string.dart';
Future<LocalStorage> getLocalStorage() async {
final directory = PlatformInfos.isBetaDesktop
? await getApplicationSupportDirectory()
: (PlatformInfos.isWeb ? null : await getApplicationDocumentsDirectory());
final localStorage = LocalStorage('LocalStorage', directory?.path);
await localStorage.ready;
return localStorage;
}
Future<Database> getDatabase(Client client) async { Future<Database> getDatabase(Client client) async {
while (_generateDatabaseLock) { while (_generateDatabaseLock) {
@ -32,9 +17,9 @@ Future<Database> getDatabase(Client client) async {
if (_db != null) return _db; if (_db != null) return _db;
final store = Store(); final store = Store();
var password = await store.getItem('database-password'); var password = await store.getItem('database-password');
var needMigration = false; var newPassword = false;
if (password == null || password.isEmpty) { if (password == null || password.isEmpty) {
needMigration = true; newPassword = true;
password = randomString(255); password = randomString(255);
} }
_db = await constructDb( _db = await constructDb(
@ -42,11 +27,7 @@ Future<Database> getDatabase(Client client) async {
filename: 'moor.sqlite', filename: 'moor.sqlite',
password: password, password: password,
); );
// Check if database is open: if (newPassword) {
debugPrint((await _db.customSelect('SELECT 1').get()).toString());
if (needMigration) {
debugPrint('[Moor] Start migration');
await migrate(client.clientName, _db, store);
await store.setItem('database-password', password); await store.setItem('database-password', password);
} }
return _db; return _db;
@ -58,239 +39,54 @@ Future<Database> getDatabase(Client client) async {
Database _db; Database _db;
bool _generateDatabaseLock = false; bool _generateDatabaseLock = false;
Future<void> migrate(String clientName, Database db, Store store) async {
debugPrint('[Store] attempting old migration to moor...');
final oldKeys = await store.getAllItems();
if (oldKeys == null || oldKeys.isEmpty) {
debugPrint('[Store] empty store!');
return; // we are done!
}
final credentialsStr = oldKeys[clientName];
if (credentialsStr == null || credentialsStr.isEmpty) {
debugPrint('[Store] no credentials found!');
return; // no credentials
}
final Map<String, dynamic> credentials = json.decode(credentialsStr);
if (!credentials.containsKey('homeserver') ||
!credentials.containsKey('token') ||
!credentials.containsKey('userID')) {
debugPrint('[Store] invalid credentials!');
return; // invalid old store, we are done, too!
}
var clientId = 0;
final oldClient = await db.getClient(clientName);
if (oldClient == null) {
clientId = await db.insertClient(
clientName,
credentials['homeserver'],
credentials['token'],
credentials['userID'],
credentials['deviceID'],
credentials['deviceName'],
null,
credentials['olmAccount'],
);
} else {
clientId = oldClient.clientId;
await db.updateClient(
credentials['homeserver'],
credentials['token'],
credentials['userID'],
credentials['deviceID'],
credentials['deviceName'],
null,
credentials['olmAccount'],
clientId,
);
}
await db.clearCache(clientId);
debugPrint('[Store] Inserted/updated client, clientId = ${clientId}');
await db.transaction(() async {
// alright, we stored / updated the client and have the account ID, time to import everything else!
// user_device_keys and user_device_keys_key
debugPrint('[Store] Migrating user device keys...');
final deviceKeysListString = oldKeys['${clientName}.user_device_keys'];
if (deviceKeysListString != null && deviceKeysListString.isNotEmpty) {
Map<String, dynamic> rawUserDeviceKeys =
json.decode(deviceKeysListString);
for (final entry in rawUserDeviceKeys.entries) {
final map = entry.value;
await db.storeUserDeviceKeysInfo(
clientId, map['user_id'], map['outdated']);
for (final rawKey in map['device_keys'].entries) {
final jsonVaue = rawKey.value;
await db.storeUserDeviceKey(
clientId,
jsonVaue['user_id'],
jsonVaue['device_id'],
json.encode(jsonVaue),
jsonVaue['verified'],
jsonVaue['blocked']);
}
}
}
for (final entry in oldKeys.entries) {
final key = entry.key;
final value = entry.value;
if (value == null || value.isEmpty) {
continue;
}
// olm_sessions
final olmSessionsMatch =
RegExp(r'^\/clients\/([^\/]+)\/olm-sessions$').firstMatch(key);
if (olmSessionsMatch != null) {
if (olmSessionsMatch[1] != credentials['deviceID']) {
continue;
}
debugPrint('[Store] migrating olm sessions...');
final identityKey = json.decode(value);
for (final olmKey in identityKey.entries) {
final identKey = olmKey.key;
final sessions = olmKey.value;
for (final pickle in sessions) {
var sess = olm.Session();
sess.unpickle(credentials['userID'], pickle);
await db.storeOlmSession(
clientId, identKey, sess.session_id(), pickle, null);
sess?.free();
}
}
}
// outbound_group_sessions
final outboundGroupSessionsMatch = RegExp(
r'^\/clients\/([^\/]+)\/rooms\/([^\/]+)\/outbound_group_session$')
.firstMatch(key);
if (outboundGroupSessionsMatch != null) {
if (outboundGroupSessionsMatch[1] != credentials['deviceID']) {
continue;
}
final pickle = value;
final roomId = outboundGroupSessionsMatch[2];
debugPrint(
'[Store] Migrating outbound group sessions for room ${roomId}...');
final devicesString = oldKeys[
'/clients/${outboundGroupSessionsMatch[1]}/rooms/${roomId}/outbound_group_session_devices'];
var devices = <String>[];
if (devicesString != null) {
devices = List<String>.from(json.decode(devicesString));
}
await db.storeOutboundGroupSession(
clientId,
roomId,
pickle,
json.encode(devices),
DateTime.now().millisecondsSinceEpoch,
0,
);
}
// session_keys
final sessionKeysMatch =
RegExp(r'^\/clients\/([^\/]+)\/rooms\/([^\/]+)\/session_keys$')
.firstMatch(key);
if (sessionKeysMatch != null) {
if (sessionKeysMatch[1] != credentials['deviceID']) {
continue;
}
final roomId = sessionKeysMatch[2];
debugPrint('[Store] Migrating session keys for room ${roomId}...');
final map = json.decode(value);
for (final entry in map.entries) {
await db.storeInboundGroupSession(
clientId,
roomId,
entry.key,
entry.value['inboundGroupSession'],
json.encode(entry.value['content']),
json.encode(entry.value['indexes']),
null,
null);
}
}
}
});
}
// see https://github.com/mogol/flutter_secure_storage/issues/161#issuecomment-704578453
class AsyncMutex {
Completer<void> _completer;
Future<void> lock() async {
while (_completer != null) {
await _completer.future;
}
_completer = Completer<void>();
}
void unlock() {
assert(_completer != null);
final completer = _completer;
_completer = null;
completer.complete();
}
}
class Store { class Store {
final LocalStorage storage; LocalStorage storage;
final FlutterSecureStorage secureStorage; final FlutterSecureStorage secureStorage;
static final _mutex = AsyncMutex();
Store() Store()
: storage = LocalStorage('LocalStorage'), : secureStorage = PlatformInfos.isMobile ? FlutterSecureStorage() : null;
secureStorage = PlatformInfos.isMobile ? FlutterSecureStorage() : null;
Future<dynamic> getItem(String key) async { Future<void> _setupLocalStorage() async {
if (!PlatformInfos.isMobile) { if (storage == null) {
final directory = PlatformInfos.isBetaDesktop
? await getApplicationSupportDirectory()
: (PlatformInfos.isWeb
? null
: await getApplicationDocumentsDirectory());
storage = LocalStorage('LocalStorage', directory?.path);
await storage.ready; await storage.ready;
}
}
Future<String> getItem(String key) async {
if (!PlatformInfos.isMobile) {
await _setupLocalStorage();
try { try {
return await storage.getItem(key); return await storage.getItem(key)?.toString();
} catch (_) { } catch (_) {
return null; return null;
} }
} }
try { try {
await _mutex.lock();
return await secureStorage.read(key: key); return await secureStorage.read(key: key);
} catch (_) { } catch (_) {
return null; return null;
} finally {
_mutex.unlock();
} }
} }
Future<void> setItem(String key, String value) async { Future<void> setItem(String key, String value) async {
if (!PlatformInfos.isMobile) { if (!PlatformInfos.isMobile) {
await storage.ready; await _setupLocalStorage();
return await storage.setItem(key, value); return await storage.setItem(key, value);
} }
if (value == null) { return await secureStorage.write(key: key, value: value);
return await secureStorage.delete(key: key);
} else {
try {
await _mutex.lock();
return await secureStorage.write(key: key, value: value);
} finally {
_mutex.unlock();
}
}
} }
Future<Map<String, dynamic>> getAllItems() async { Future<void> deleteItem(String key) async {
if (!PlatformInfos.isMobile) { if (!PlatformInfos.isMobile) {
try { await _setupLocalStorage();
final rawStorage = await getLocalstorage('LocalStorage'); return await storage.deleteItem(key);
return json.decode(rawStorage);
} catch (_) {
return {};
}
}
try {
await _mutex.lock();
return await secureStorage.readAll();
} catch (_) {
return {};
} finally {
_mutex.unlock();
} }
return await secureStorage.delete(key: key);
} }
} }

View File

@ -130,7 +130,9 @@ abstract class FirebaseController {
var initializationSettingsIOS = IOSInitializationSettings( var initializationSettingsIOS = IOSInitializationSettings(
onDidReceiveLocalNotification: (i, a, b, c) => null); onDidReceiveLocalNotification: (i, a, b, c) => null);
var initializationSettings = InitializationSettings( var initializationSettings = InitializationSettings(
android: initializationSettingsAndroid, iOS: initializationSettingsIOS); android: initializationSettingsAndroid,
iOS: initializationSettingsIOS,
);
await _flutterLocalNotificationsPlugin.initialize(initializationSettings, await _flutterLocalNotificationsPlugin.initialize(initializationSettings,
onSelectNotification: goToRoom); onSelectNotification: goToRoom);
@ -266,8 +268,9 @@ abstract class FirebaseController {
ticker: i18n.newMessageInFluffyChat); ticker: i18n.newMessageInFluffyChat);
var iOSPlatformChannelSpecifics = IOSNotificationDetails(); var iOSPlatformChannelSpecifics = IOSNotificationDetails();
var platformChannelSpecifics = NotificationDetails( var platformChannelSpecifics = NotificationDetails(
android: androidPlatformChannelSpecifics, android: androidPlatformChannelSpecifics,
iOS: iOSPlatformChannelSpecifics); iOS: iOSPlatformChannelSpecifics,
);
await _flutterLocalNotificationsPlugin.show( await _flutterLocalNotificationsPlugin.show(
0, 0,
room.getLocalizedDisplayname(MatrixLocals(i18n)), room.getLocalizedDisplayname(MatrixLocals(i18n)),
@ -297,8 +300,9 @@ abstract class FirebaseController {
AndroidInitializationSettings('notifications_icon'); AndroidInitializationSettings('notifications_icon');
var initializationSettingsIOS = IOSInitializationSettings(); var initializationSettingsIOS = IOSInitializationSettings();
var initializationSettings = InitializationSettings( var initializationSettings = InitializationSettings(
android: initializationSettingsAndroid, android: initializationSettingsAndroid,
iOS: initializationSettingsIOS); iOS: initializationSettingsIOS,
);
await flutterLocalNotificationsPlugin.initialize(initializationSettings); await flutterLocalNotificationsPlugin.initialize(initializationSettings);
// FIXME unable to init without context currently https://github.com/flutter/flutter/issues/67092 // FIXME unable to init without context currently https://github.com/flutter/flutter/issues/67092
@ -324,8 +328,9 @@ abstract class FirebaseController {
importance: Importance.max, priority: Priority.high); importance: Importance.max, priority: Priority.high);
var iOSPlatformChannelSpecifics = IOSNotificationDetails(); var iOSPlatformChannelSpecifics = IOSNotificationDetails();
var platformChannelSpecifics = NotificationDetails( var platformChannelSpecifics = NotificationDetails(
android: androidPlatformChannelSpecifics, android: androidPlatformChannelSpecifics,
iOS: iOSPlatformChannelSpecifics); iOS: iOSPlatformChannelSpecifics,
);
final title = l10n.unreadChats(unread.toString()); final title = l10n.unreadChats(unread.toString());
await flutterLocalNotificationsPlugin.show( await flutterLocalNotificationsPlugin.show(
1, title, l10n.openAppToReadMessages, platformChannelSpecifics, 1, title, l10n.openAppToReadMessages, platformChannelSpecifics,

View File

@ -0,0 +1,19 @@
import 'package:bot_toast/bot_toast.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:share/share.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
abstract class FluffyShare {
static Future<void> share(String text, BuildContext context) async {
if (PlatformInfos.isMobile) {
return Share.share(text);
}
await Clipboard.setData(
ClipboardData(text: text),
);
BotToast.showText(text: L10n.of(context).copiedToClipboard);
return;
}
}

View File

@ -1,11 +1,14 @@
import 'dart:io'; import 'dart:io';
import 'package:famedlysdk/famedlysdk.dart'; import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:open_file/open_file.dart'; import 'package:open_file/open_file.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:universal_html/prefer_universal/html.dart' as html; import 'package:universal_html/prefer_universal/html.dart' as html;
import 'package:mime_type/mime_type.dart'; import 'package:mime_type/mime_type.dart';
import 'package:downloads_path_provider_28/downloads_path_provider_28.dart';
import 'package:permission_handler/permission_handler.dart';
extension MatrixFileExtension on MatrixFile { extension MatrixFileExtension on MatrixFile {
void open() async { void open() async {
@ -24,9 +27,12 @@ extension MatrixFileExtension on MatrixFile {
element.click(); element.click();
element.remove(); element.remove();
} else { } else {
final downloadsDir = Platform.isAndroid if (!(await Permission.storage.request()).isGranted) return;
? (await getExternalStorageDirectory()) final downloadsDir = PlatformInfos.isDesktop
: (await getApplicationDocumentsDirectory()); ? (await getDownloadsDirectory())
: Platform.isAndroid
? (await DownloadsPathProvider.downloadsDirectory)
: (await getApplicationDocumentsDirectory());
final file = File(downloadsDir.path + '/' + name.split('/').last); final file = File(downloadsDir.path + '/' + name.split('/').last);
file.writeAsBytesSync(bytes); file.writeAsBytesSync(bytes);

View File

@ -11,5 +11,8 @@ abstract class PlatformInfos {
static bool get isBetaDesktop => static bool get isBetaDesktop =>
!kIsWeb && (Platform.isWindows || Platform.isLinux); !kIsWeb && (Platform.isWindows || Platform.isLinux);
static bool get isDesktop =>
!kIsWeb && (Platform.isLinux || Platform.isWindows || Platform.isMacOS);
static bool get usesTouchscreen => !isMobile; static bool get usesTouchscreen => !isMobile;
} }

View File

@ -4,21 +4,37 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'date_time_extension.dart'; import 'date_time_extension.dart';
extension on PresenceType {
String getLocalized(BuildContext context) {
switch (this) {
case PresenceType.online:
return L10n.of(context).online;
case PresenceType.unavailable:
return L10n.of(context).unavailable;
case PresenceType.offline:
default:
return L10n.of(context).offline;
}
}
}
extension PresenceExtension on Presence { extension PresenceExtension on Presence {
bool get isUserStatus => presence?.statusMsg?.isNotEmpty ?? false; String getLocalizedLastActiveAgo(BuildContext context) {
if (presence.lastActiveAgo != null && presence.lastActiveAgo != 0) {
return L10n.of(context).lastActiveAgo(DateTime.fromMillisecondsSinceEpoch(
DateTime.now().millisecondsSinceEpoch - presence.lastActiveAgo)
.localizedTimeShort(context));
}
return L10n.of(context).lastSeenLongTimeAgo;
}
String getLocalizedStatusMessage(BuildContext context) { String getLocalizedStatusMessage(BuildContext context) {
if (presence.statusMsg?.isNotEmpty ?? false) { if (presence.statusMsg?.isNotEmpty ?? false) {
return presence.statusMsg; return presence.statusMsg;
} }
if (presence.lastActiveAgo != null ?? presence.lastActiveAgo != 0) { if (presence.currentlyActive ?? false) {
return L10n.of(context).lastActiveAgo(
DateTime.fromMillisecondsSinceEpoch(presence.lastActiveAgo)
.localizedTimeShort(context));
}
if (presence.currentlyActive) {
return L10n.of(context).currentlyActive; return L10n.of(context).currentlyActive;
} }
return L10n.of(context).lastSeenLongTimeAgo; return presence.presence.getLocalized(context);
} }
} }

View File

@ -1,21 +0,0 @@
class UserStatus {
String statusMsg;
String userId;
int receivedAt;
UserStatus();
UserStatus.fromJson(Map<String, dynamic> json) {
statusMsg = json['status_msg'];
userId = json['user_id'];
receivedAt = json['received_at'];
}
Map<String, dynamic> toJson() {
final data = <String, dynamic>{};
data['status_msg'] = statusMsg;
data['user_id'] = userId;
data['received_at'] = receivedAt;
return data;
}
}

View File

@ -25,6 +25,7 @@ import '../components/encryption_button.dart';
import '../components/input_bar.dart'; import '../components/input_bar.dart';
import '../components/list_items/message.dart'; import '../components/list_items/message.dart';
import '../components/matrix.dart'; import '../components/matrix.dart';
import '../components/user_bottom_sheet.dart';
import '../components/reply_content.dart'; import '../components/reply_content.dart';
import '../config/app_emojis.dart'; import '../config/app_emojis.dart';
import '../utils/app_route.dart'; import '../utils/app_route.dart';
@ -604,16 +605,22 @@ class _ChatState extends State<_Chat> {
return ListTile( return ListTile(
leading: Avatar(room.avatar, room.displayname), leading: Avatar(room.avatar, room.displayname),
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
onTap: room.isDirectChat && room.directChatPresence == null onTap: room.isDirectChat
? null ? () => showModalBottomSheet(
: room.isDirectChat context: context,
? null builder: (context) => UserBottomSheet(
: () => Navigator.of(context).push( user: room
AppRoute.defaultRoute( .getUserByMXIDSync(room.directChatMatrixID),
context, onMention: () => sendController.text +=
ChatDetails(room), ' ${room.directChatMatrixID}',
), ),
), )
: () => Navigator.of(context).push(
AppRoute.defaultRoute(
context,
ChatDetails(room),
),
),
title: Text( title: Text(
room.getLocalizedDisplayname( room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context))), MatrixLocals(L10n.of(context))),
@ -801,10 +808,17 @@ class _ChatState extends State<_Chat> {
onSwipe: (direction) => _handleSwipe( onSwipe: (direction) => _handleSwipe(
direction, filteredEvents[i - 1]), direction, filteredEvents[i - 1]),
child: Message(filteredEvents[i - 1], child: Message(filteredEvents[i - 1],
onAvatarTab: (Event event) { onAvatarTab: (Event event) =>
sendController.text += showModalBottomSheet(
' ${event.senderId}'; context: context,
}, builder: (context) =>
UserBottomSheet(
user: event.sender,
onMention: () =>
sendController.text +=
' ${event.senderId}',
),
),
onSelect: (Event event) { onSelect: (Event event) {
if (!event.redacted) { if (!event.redacted) {
if (selectedEvents if (selectedEvents

View File

@ -7,7 +7,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:receive_sharing_intent/receive_sharing_intent.dart'; import 'package:receive_sharing_intent/receive_sharing_intent.dart';
import 'package:share/share.dart';
import '../components/adaptive_page_layout.dart'; import '../components/adaptive_page_layout.dart';
import '../components/avatar.dart'; import '../components/avatar.dart';
@ -19,6 +18,7 @@ import '../components/list_items/status_list_item.dart';
import '../components/matrix.dart'; import '../components/matrix.dart';
import '../utils/app_route.dart'; import '../utils/app_route.dart';
import '../utils/matrix_file_extension.dart'; import '../utils/matrix_file_extension.dart';
import '../utils/fluffy_share.dart';
import '../utils/platform_infos.dart'; import '../utils/platform_infos.dart';
import '../utils/url_launcher.dart'; import '../utils/url_launcher.dart';
import 'archive.dart'; import 'archive.dart';
@ -198,29 +198,23 @@ class _ChatListState extends State<ChatList> {
); );
} }
void _setStatus(BuildContext context, {bool fromDrawer = false}) async { void _setStatus(BuildContext context) async {
if (fromDrawer) Navigator.of(context).pop(); Navigator.of(context).pop();
final ownProfile = await SimpleDialogs(context) final statusMsg = await SimpleDialogs(context).enterText(
.tryRequestWithLoadingDialog(Matrix.of(context).client.ownProfile); titleText: L10n.of(context).setStatus,
String composeText; labelText: L10n.of(context).setStatus,
if (Matrix.of(context).shareContent != null && hintText: L10n.of(context).statusExampleMessage,
Matrix.of(context).shareContent['msgtype'] == 'm.text') { multiLine: true,
composeText = Matrix.of(context).shareContent['body']; );
Matrix.of(context).shareContent = null; if (statusMsg?.isEmpty ?? true) return;
} final client = Matrix.of(context).client;
if (ownProfile is Profile) { await SimpleDialogs(context).tryRequestWithLoadingDialog(
await Navigator.of(context).push( client.sendPresence(
MaterialPageRoute( client.userID,
builder: (_) => StatusView( PresenceType.online,
composeMode: true, statusMsg: statusMsg,
avatarUrl: ownProfile.avatarUrl, ),
displayname: ownProfile.displayname ?? );
Matrix.of(context).client.userID.localpart,
composeText: composeText,
),
),
);
}
return; return;
} }
@ -302,8 +296,7 @@ class _ChatListState extends State<ChatList> {
ListTile( ListTile(
leading: Icon(Icons.edit), leading: Icon(Icons.edit),
title: Text(L10n.of(context).setStatus), title: Text(L10n.of(context).setStatus),
onTap: () => onTap: () => _setStatus(context),
_setStatus(context, fromDrawer: true),
), ),
Divider(height: 1), Divider(height: 1),
ListTile( ListTile(
@ -338,9 +331,11 @@ class _ChatListState extends State<ChatList> {
title: Text(L10n.of(context).inviteContact), title: Text(L10n.of(context).inviteContact),
onTap: () { onTap: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
Share.share(L10n.of(context).inviteText( FluffyShare.share(
Matrix.of(context).client.userID, L10n.of(context).inviteText(
'https://matrix.to/#/${Matrix.of(context).client.userID}')); Matrix.of(context).client.userID,
'https://matrix.to/#/${Matrix.of(context).client.userID}'),
context);
}, },
), ),
], ],
@ -422,31 +417,14 @@ class _ChatListState extends State<ChatList> {
), ),
floatingActionButton: AdaptivePageLayout.columnMode(context) floatingActionButton: AdaptivePageLayout.columnMode(context)
? null ? null
: Column( : FloatingActionButton(
mainAxisSize: MainAxisSize.min, child: Icon(Icons.add),
children: [ backgroundColor: Theme.of(context).primaryColor,
FloatingActionButton( onPressed: () => Navigator.of(context)
heroTag: null, .pushAndRemoveUntil(
child: Icon( AppRoute.defaultRoute(
Icons.edit, context, NewPrivateChatView()),
color: Theme.of(context).primaryColor, (r) => r.isFirst),
),
elevation: 1,
backgroundColor:
Theme.of(context).secondaryHeaderColor,
onPressed: () => _setStatus(context),
),
SizedBox(height: 16.0),
FloatingActionButton(
child: Icon(Icons.add),
backgroundColor: Theme.of(context).primaryColor,
onPressed: () => Navigator.of(context)
.pushAndRemoveUntil(
AppRoute.defaultRoute(
context, NewPrivateChatView()),
(r) => r.isFirst),
),
],
), ),
body: Column( body: Column(
children: [ children: [
@ -506,94 +484,28 @@ class _ChatListState extends State<ChatList> {
final totalCount = final totalCount =
rooms.length + publicRoomsCount; rooms.length + publicRoomsCount;
return ListView.separated( return ListView.separated(
controller: _scrollController, controller: _scrollController,
separatorBuilder: (BuildContext context, separatorBuilder: (BuildContext context,
int i) => int i) =>
i == totalCount - publicRoomsCount i == totalCount - publicRoomsCount
? ListTile( ? ListTile(
title: Text( title: Text(
L10n.of(context) L10n.of(context)
.publicRooms + .publicRooms +
':', ':',
style: TextStyle( style: TextStyle(
fontWeight: fontWeight:
FontWeight.bold, FontWeight.bold,
color: Theme.of(context) color: Theme.of(context)
.primaryColor, .primaryColor,
),
), ),
) ),
: Container(), )
itemCount: totalCount + 1, : Container(),
itemBuilder: itemCount: totalCount,
(BuildContext context, int i) { itemBuilder: (BuildContext context,
if (i == 0) { int i) =>
final displayPresences = i < rooms.length
selectMode != SelectMode.share;
final displayShareStatus =
selectMode ==
SelectMode.share &&
Matrix.of(context)
.shareContent[
'msgtype'] ==
'm.text';
return Column(
mainAxisSize: MainAxisSize.min,
children: [
AnimatedContainer(
duration: Duration(
milliseconds: 300),
height: displayPresences
? 78
: displayShareStatus
? 56
: 0,
child: displayPresences
? ListView.builder(
scrollDirection:
Axis.horizontal,
itemCount:
Matrix.of(context)
.userStatuses
.length,
itemBuilder: (BuildContext
context,
int i) =>
StatusListItem(Matrix
.of(context)
.userStatuses[i]),
)
: displayShareStatus
? ListTile(
leading:
CircleAvatar(
radius: Avatar
.defaultSize /
2,
backgroundColor:
Theme.of(
context)
.secondaryHeaderColor,
child: Icon(
Icons.edit,
color: Theme.of(
context)
.primaryColor,
),
),
title: Text(L10n.of(
context)
.setStatus),
onTap: () =>
_setStatus(
context))
: null,
),
],
);
}
i--;
return i < rooms.length
? ChatListItem( ? ChatListItem(
rooms[i], rooms[i],
selected: _selectedRoomIds selected: _selectedRoomIds
@ -614,8 +526,9 @@ class _ChatListState extends State<ChatList> {
) )
: PublicRoomListItem( : PublicRoomListItem(
publicRoomsResponse publicRoomsResponse
.chunk[i - rooms.length]); .chunk[i - rooms.length],
}); ),
);
} else { } else {
return Center( return Center(
child: CircularProgressIndicator(), child: CircularProgressIndicator(),

View File

@ -76,6 +76,11 @@ class _HomeserverPickerState extends State<HomeserverPicker> {
} }
} }
Future<bool> checkHomeserver(dynamic homeserver, Client client) async {
await client.checkHomeserver(homeserver);
return true;
}
@override @override
void initState() { void initState() {
super.initState(); super.initState();

View File

@ -123,7 +123,7 @@ class _LoginState extends State<Login> {
if ((newDomain?.isNotEmpty ?? false) && if ((newDomain?.isNotEmpty ?? false) &&
newDomain != Matrix.of(context).client.homeserver.toString()) { newDomain != Matrix.of(context).client.homeserver.toString()) {
await SimpleDialogs(context).tryRequestWithErrorToast( await SimpleDialogs(context).tryRequestWithErrorToast(
Matrix.of(context).client.checkServer(newDomain)); Matrix.of(context).client.checkHomeserver(newDomain));
setState(() => usernameError = null); setState(() => usernameError = null);
} }
newWellknown = wellKnownInformations; newWellknown = wellKnownInformations;

View File

@ -4,13 +4,13 @@ import 'package:famedlysdk/famedlysdk.dart';
import 'package:famedlysdk/matrix_api.dart'; import 'package:famedlysdk/matrix_api.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:share/share.dart';
import '../components/adaptive_page_layout.dart'; import '../components/adaptive_page_layout.dart';
import '../components/avatar.dart'; import '../components/avatar.dart';
import '../components/dialogs/simple_dialogs.dart'; import '../components/dialogs/simple_dialogs.dart';
import '../components/matrix.dart'; import '../components/matrix.dart';
import '../utils/app_route.dart'; import '../utils/app_route.dart';
import '../utils/fluffy_share.dart';
import 'chat.dart'; import 'chat.dart';
import 'chat_list.dart'; import 'chat_list.dart';
@ -204,9 +204,10 @@ class _NewPrivateChatState extends State<_NewPrivateChat> {
Icons.share, Icons.share,
size: 16, size: 16,
), ),
onTap: () => Share.share(L10n.of(context).inviteText( onTap: () => FluffyShare.share(
Matrix.of(context).client.userID, L10n.of(context).inviteText(Matrix.of(context).client.userID,
'https://matrix.to/#/${Matrix.of(context).client.userID}')), 'https://matrix.to/#/${Matrix.of(context).client.userID}'),
context),
title: Text( title: Text(
'${L10n.of(context).yourOwnUsername}:', '${L10n.of(context).yourOwnUsername}:',
style: TextStyle( style: TextStyle(

View File

@ -1,186 +0,0 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix_link_text/link_text.dart';
import '../components/avatar.dart';
import '../components/dialogs/simple_dialogs.dart';
import '../components/matrix.dart';
import '../utils/app_route.dart';
import '../utils/string_color.dart';
import '../utils/url_launcher.dart';
import '../utils/user_status.dart';
import 'chat.dart';
class StatusView extends StatelessWidget {
final Uri avatarUrl;
final String displayname;
final UserStatus status;
final bool composeMode;
final String composeText;
final TextEditingController _composeController;
StatusView({
this.composeMode = false,
this.status,
this.avatarUrl,
this.displayname,
this.composeText,
Key key,
}) : _composeController = TextEditingController(text: composeText),
super(key: key);
void _sendMessageAction(BuildContext context) async {
final roomId = await User(
status.userId,
room: Room(id: '', client: Matrix.of(context).client),
).startDirectChat();
await Navigator.of(context).pushAndRemoveUntil(
AppRoute.defaultRoute(
context,
ChatView(roomId),
),
(Route r) => r.isFirst);
}
void _setStatusAction(BuildContext context) async {
if (_composeController.text.isEmpty) return;
await SimpleDialogs(context).tryRequestWithLoadingDialog(
Matrix.of(context).client.sendPresence(
Matrix.of(context).client.userID, PresenceType.online,
statusMsg: _composeController.text),
);
await Navigator.of(context).popUntil((Route r) => r.isFirst);
}
void _removeStatusAction(BuildContext context) async {
final success = await SimpleDialogs(context).tryRequestWithLoadingDialog(
Matrix.of(context).client.sendPresence(
Matrix.of(context).client.userID,
PresenceType.online,
statusMsg:
' ', // Send this empty String make sure that all other devices will get an update
),
);
if (success == false) return;
await Navigator.of(context).popUntil((Route r) => r.isFirst);
}
@override
Widget build(BuildContext context) {
if (composeMode == false && status == null) {
throw ('If composeMode is null then the presence must be not null!');
}
final padding = const EdgeInsets.only(
top: 16.0,
right: 16.0,
left: 16.0,
bottom: 64.0,
);
return Scaffold(
backgroundColor: displayname.color,
extendBody: true,
appBar: AppBar(
titleSpacing: 0.0,
brightness: Brightness.dark,
leading: IconButton(
icon: Icon(
Icons.close,
color: Colors.white,
),
onPressed: Navigator.of(context).pop,
),
backgroundColor: Colors.transparent,
elevation: 1,
title: ListTile(
contentPadding: EdgeInsets.zero,
leading: Avatar(avatarUrl, displayname),
title: Text(
displayname,
style: TextStyle(color: Colors.white),
),
subtitle: Text(
status?.userId ?? Matrix.of(context).client.userID,
maxLines: 1,
style: TextStyle(color: Colors.white),
),
),
actions:
!composeMode && status.userId == Matrix.of(context).client.userID
? [
IconButton(
icon: Icon(Icons.archive),
onPressed: () => _removeStatusAction(context),
color: Colors.white,
),
]
: null,
),
body: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
displayname.color,
Theme.of(context).primaryColor,
displayname.color,
],
),
),
child: composeMode
? Padding(
padding: padding,
child: TextField(
controller: _composeController,
autofocus: true,
minLines: 1,
maxLines: 20,
style: TextStyle(
fontSize: 30,
color: Colors.white,
),
textAlign: TextAlign.center,
decoration: InputDecoration(
border: InputBorder.none,
),
),
)
: ListView(
shrinkWrap: true,
padding: padding,
children: [
LinkText(
text: status.statusMsg,
textAlign: TextAlign.center,
textStyle: TextStyle(
fontSize: 30,
color: Colors.white,
),
linkStyle: TextStyle(
fontSize: 30,
color: Colors.white70,
decoration: TextDecoration.underline,
),
onLinkTap: (url) => UrlLauncher(context, url).launchUrl(),
),
],
),
),
floatingActionButton:
!composeMode && status.userId == Matrix.of(context).client.userID
? null
: FloatingActionButton.extended(
backgroundColor: Theme.of(context).primaryColor,
icon: Icon(composeMode ? Icons.edit : Icons.message_outlined),
label: Text(composeMode
? L10n.of(context).setStatus
: L10n.of(context).sendAMessage),
onPressed: () => composeMode
? _setStatusAction(context)
: _sendMessageAction(context),
),
);
}
}

View File

@ -1,10 +1,6 @@
#include "my_application.h" #include "my_application.h"
int main(int argc, char** argv) { int main(int argc, char** argv) {
// Only X11 is currently supported.
// Wayland support is being developed: https://github.com/flutter/flutter/issues/57932.
gdk_set_allowed_backends("x11");
g_autoptr(MyApplication) app = my_application_new(); g_autoptr(MyApplication) app = my_application_new();
return g_application_run(G_APPLICATION(app), argc, argv); return g_application_run(G_APPLICATION(app), argc, argv);
} }

View File

@ -168,7 +168,14 @@ packages:
name: cupertino_icons name: cupertino_icons
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.3" version: "1.0.0"
dapackages:
dependency: "direct dev"
description:
name: dapackages
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
dart_style: dart_style:
dependency: transitive dependency: transitive
description: description:
@ -183,6 +190,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.0.3" version: "0.0.3"
downloads_path_provider_28:
dependency: "direct main"
description:
name: downloads_path_provider_28
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
encrypt: encrypt:
dependency: transitive dependency: transitive
description: description:
@ -226,7 +240,7 @@ packages:
name: file_chooser name: file_chooser
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.5" version: "0.1.6"
file_picker: file_picker:
dependency: transitive dependency: transitive
description: description:
@ -295,6 +309,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
flutter_highlight:
dependency: transitive
description:
name: flutter_highlight
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.0"
flutter_keyboard_visibility: flutter_keyboard_visibility:
dependency: transitive dependency: transitive
description: description:
@ -315,7 +336,7 @@ packages:
name: flutter_local_notifications name: flutter_local_notifications
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.1" version: "3.0.1"
flutter_local_notifications_platform_interface: flutter_local_notifications_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -334,7 +355,7 @@ packages:
name: flutter_matrix_html name: flutter_matrix_html
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.9" version: "0.1.10"
flutter_olm: flutter_olm:
dependency: "direct main" dependency: "direct main"
description: description:
@ -394,6 +415,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
highlight:
dependency: transitive
description:
name: highlight
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.0"
html: html:
dependency: transitive dependency: transitive
description: description:
@ -526,7 +554,7 @@ packages:
name: matrix_link_text name: matrix_link_text
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.1" version: "0.3.2"
meta: meta:
dependency: transitive dependency: transitive
description: description:
@ -554,7 +582,7 @@ packages:
name: moor name: moor
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.3.1" version: "3.4.0"
native_imaging: native_imaging:
dependency: "direct main" dependency: "direct main"
description: description:
@ -605,7 +633,7 @@ packages:
name: open_file name: open_file
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.1" version: "3.0.3"
package_config: package_config:
dependency: transitive dependency: transitive
description: description:
@ -640,7 +668,7 @@ packages:
name: path_provider name: path_provider
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.6.21" version: "1.6.22"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
@ -676,6 +704,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.10.0-nullsafety.1" version: "1.10.0-nullsafety.1"
permission_handler:
dependency: "direct main"
description:
name: permission_handler
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.1+1"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
petitparser: petitparser:
dependency: transitive dependency: transitive
description: description:
@ -773,7 +815,7 @@ packages:
name: share name: share
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.5+3" version: "0.6.5+4"
shelf: shelf:
dependency: transitive dependency: transitive
description: description:
@ -834,7 +876,7 @@ packages:
name: sqflite name: sqflite
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.1+1" version: "1.3.2"
sqflite_common: sqflite_common:
dependency: transitive dependency: transitive
description: description:
@ -925,7 +967,7 @@ packages:
name: timezone name: timezone
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.5.7" version: "0.5.9"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -960,7 +1002,7 @@ packages:
name: url_launcher name: url_launcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.7.5" version: "5.7.8"
url_launcher_linux: url_launcher_linux:
dependency: transitive dependency: transitive
description: description:
@ -981,14 +1023,14 @@ packages:
name: url_launcher_platform_interface name: url_launcher_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.8" version: "1.0.9"
url_launcher_web: url_launcher_web:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_web name: url_launcher_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.4+1" version: "0.1.5"
url_launcher_windows: url_launcher_windows:
dependency: transitive dependency: transitive
description: description:
@ -1044,7 +1086,7 @@ packages:
name: webview_flutter name: webview_flutter
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.24" version: "1.0.5"
win32: win32:
dependency: transitive dependency: transitive
description: description:
@ -1081,5 +1123,5 @@ packages:
source: hosted source: hosted
version: "0.1.2" version: "0.1.2"
sdks: sdks:
dart: ">=2.10.0-110 <=2.11.0-161.0.dev" dart: ">=2.10.2 <2.11.0"
flutter: ">=1.20.0 <2.0.0" flutter: ">=1.22.2 <2.0.0"

View File

@ -22,7 +22,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2 cupertino_icons: ^1.0.0
famedlysdk: famedlysdk:
git: git:
@ -30,41 +30,43 @@ dependencies:
ref: yiffed ref: yiffed
# path: ../famedlysdk # path: ../famedlysdk
localstorage: ^3.0.1+4 localstorage: ^3.0.3+6
file_picker_cross: ^4.2.2 file_picker_cross: 4.2.2
image_picker: ^0.6.7+11 image_picker: ^0.6.7+12
url_launcher: ^5.7.2 url_launcher: ^5.7.8
cached_network_image: ^2.3.3 cached_network_image: ^2.3.3
firebase_messaging: ^7.0.2 firebase_messaging: ^7.0.3
flutter_local_notifications: ^2.0.0+1 flutter_local_notifications: ^3.0.1
# desktop_notifications: ^0.0.0-dev.4 // Currently blocked by: https://github.com/canonical/desktop_notifications.dart/issues/5 # desktop_notifications: ^0.0.0-dev.4 // Currently blocked by: https://github.com/canonical/desktop_notifications.dart/issues/5
matrix_link_text: ^0.3.1 matrix_link_text: ^0.3.2
path_provider: ^1.5.1 path_provider: ^1.6.22
webview_flutter: ^0.3.19+9 downloads_path_provider_28: ^0.1.0
share: ^0.6.3+5 permission_handler: ^5.0.1+1
flutter_secure_storage: ^3.3.4 webview_flutter: ^1.0.5
http: ^0.12.0+4 share: ^0.6.5+4
universal_html: ^1.1.12 flutter_secure_storage: ^3.3.5
receive_sharing_intent: ^1.3.3 http: ^0.12.2
flutter_slidable: ^0.5.4 universal_html: ^1.2.3
receive_sharing_intent: ^1.4.1
flutter_slidable: ^0.5.7
photo_view: ^0.10.2 photo_view: ^0.10.2
flutter_sound: ^2.1.1 flutter_sound: 2.1.1
open_file: ^3.0.1 open_file: ^3.0.3
mime_type: ^0.3.0 mime_type: ^0.3.2
bot_toast: ^3.0.0 bot_toast: ^3.0.4
flutter_matrix_html: ^0.1.9 flutter_matrix_html: ^0.1.10
moor: ^3.3.1 moor: ^3.4.0
sqlite3_flutter_libs: ^0.2.0 sqlite3_flutter_libs: ^0.2.0
sqlite3: ^0.1.4 sqlite3: ^0.1.7
random_string: ^2.0.1 random_string: ^2.1.0
flutter_typeahead: ^1.8.1 flutter_typeahead: ^1.8.8
flutter_olm: ^1.0.1 flutter_olm: ^1.0.1
intl: ^0.16.1 intl: ^0.16.1
intl_translation: ^0.17.9 intl_translation: ^0.17.10+1
circular_check_box: ^1.0.4 circular_check_box: ^1.0.4
flutter_localizations: flutter_localizations:
sdk: flutter sdk: flutter
sqflite: ^1.1.7 # Still used to obtain the database location sqflite: ^1.3.2 # Still used to obtain the database location
native_imaging: native_imaging:
git: git:
url: https://gitlab.com/famedly/libraries/native_imaging.git url: https://gitlab.com/famedly/libraries/native_imaging.git
@ -78,7 +80,8 @@ dev_dependencies:
sdk: flutter sdk: flutter
flutter_launcher_icons: "^0.7.4" flutter_launcher_icons: "^0.7.4"
pedantic: ^1.9.0 pedantic: ^1.9.2
dapackages: ^1.3.0
flutter_icons: flutter_icons:
android: "launcher_icon" android: "launcher_icon"

9
snap/gui/fluffychat.desktop Executable file
View File

@ -0,0 +1,9 @@
[Desktop Entry]
Name=FluffyChat
GenericName=Matrix Client
Comment=Chat with your friends
Exec=fluffychat
Icon=${SNAP}/meta/gui/fluffychat.png
Terminal=false
Type=Application
Categories=Network;Chat;InstantMessaging;

BIN
snap/gui/fluffychat.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -1,6 +1,6 @@
name: fluffychat name: fluffychat
base: core18 base: core18
version: script version: git
summary: Open. Nonprofit. Cute ♥ summary: Open. Nonprofit. Cute ♥
description: | description: |
FluffyChat - Chat with your friends FluffyChat - Chat with your friends
@ -23,28 +23,63 @@ description: |
Microblog: https://metalhead.club/@krille Microblog: https://metalhead.club/@krille
grade: devel grade: devel
confinement: strict
icon: assets/logo.png icon: assets/logo.png
confinement: devmode
parts: parts:
olm: # FIXME olm:
plugin: cmake
source: https://gitlab.matrix.org/matrix-org/olm.git source: https://gitlab.matrix.org/matrix-org/olm.git
source-type: git source-type: git
source-tag: 3.2.1 source-tag: 3.2.1
plugin: cmake
build-packages: build-packages:
- build-essential - g++
override-build: |
cd /root/parts/olm/src
cmake . -Bbuild
cmake --build build
fluffychat: fluffychat:
after: [olm] plugin: flutter
plugin: dump source: .
source: ./build/linux/release/bundle flutter-target: lib/main.dart
stage-packages: stage-packages:
- libsqlite3-dev - libsqlite3-dev
- libatk-bridge2.0-0
- libatk1.0-0
- libatspi2.0-0
- libcairo-gobject2
- libcairo2
- libdatrie1
- libegl1
- libepoxy0
- libfontconfig1
- libfreetype6
- libgdk-pixbuf2.0-0
- libglvnd0
- libgraphite2-3
- libgtk-3-0
- libharfbuzz0b
- libpango-1.0-0
- libpangocairo-1.0-0
- libpangoft2-1.0-0
- libpixman-1-0
- libpng16-16
- libthai0
- libwayland-client0
- libwayland-cursor0
- libwayland-egl1
- libx11-6
- libxau6
- libxcb-render0
- libxcb-shm0
- libxcb1
- libxcomposite1
- libxcursor1
- libxdamage1
- libxdmcp6
- libxext6
- libxfixes3
- libxi6
- libxinerama1
- libxkbcommon0
- libxrandr2
- libxrender1
slots: slots:
dbus-svc: dbus-svc:
interface: dbus interface: dbus
@ -55,7 +90,7 @@ apps:
fluffychat: fluffychat:
command: fluffychat command: fluffychat
extensions: extensions:
- gnome-3-28 - flutter-dev
plugs: plugs:
- network - network
- home - home