From 10b43a5ff654fbdba000ba16720bdbd04f2a25e2 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Tue, 31 Aug 2021 21:37:11 -0400 Subject: [PATCH 01/17] linux: exec cwtch instead of keeping sh process --- linux/cwtch | 2 +- linux/cwtch.home.sh | 2 +- linux/cwtch.sys.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/linux/cwtch b/linux/cwtch index 89dffb63..28f613a4 100755 --- a/linux/cwtch +++ b/linux/cwtch @@ -1,3 +1,3 @@ #!/bin/sh -env LD_LIBRARY_PATH=./lib/ ./lib/cwtch \ No newline at end of file +exec env LD_LIBRARY_PATH=./lib/ ./lib/cwtch diff --git a/linux/cwtch.home.sh b/linux/cwtch.home.sh index 4e081cbe..44f55253 100755 --- a/linux/cwtch.home.sh +++ b/linux/cwtch.home.sh @@ -1,3 +1,3 @@ #!/bin/sh -env LD_LIBRARY_PATH=~/.local/lib/cwtch/ ~/.local/lib/cwtch/cwtch \ No newline at end of file +exec env LD_LIBRARY_PATH=~/.local/lib/cwtch/ ~/.local/lib/cwtch/cwtch diff --git a/linux/cwtch.sys.sh b/linux/cwtch.sys.sh index bec6bcc5..8a927666 100755 --- a/linux/cwtch.sys.sh +++ b/linux/cwtch.sys.sh @@ -1,3 +1,3 @@ #!/bin/sh -env LD_LIBRARY_PATH=/usr/lib/cwtch /usr/lib/cwtch/cwtch \ No newline at end of file +exec env LD_LIBRARY_PATH=/usr/lib/cwtch /usr/lib/cwtch/cwtch From 13f76d18613319441a79425f505812c284e96d7d Mon Sep 17 00:00:00 2001 From: fyne Date: Sat, 4 Sep 2021 11:42:13 +0100 Subject: [PATCH 02/17] Attempt to fix #166 Add better checks --- lib/cwtch/ffi.dart | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/cwtch/ffi.dart b/lib/cwtch/ffi.dart index 82de6c74..bd8462d3 100644 --- a/lib/cwtch/ffi.dart +++ b/lib/cwtch/ffi.dart @@ -115,10 +115,19 @@ class CwtchFfi implements Cwtch { bundledTor = "Tor\\Tor\\tor.exe"; } else if (Platform.isMacOS) { cwtchDir = envVars['CWTCH_HOME'] ?? path.join(envVars['HOME']!, "Library/Application Support/Cwtch"); - if (await File("Cwtch.app/Contents/MacOS/Tor/tor.real").exists()) { - bundledTor = "Cwtch.app/Contents/MacOS/Tor/tor.real"; + if (await File("/Applications/Cwtch.app/Contents/MacOS/Tor/tor.real").exists()) { + bundledTor = "/Applications/Cwtch.app/Contents/MacOS/Tor/tor.real"; } else if (await File("/Volumes/Cwtch/Cwtch.app/Contents/MacOS/Tor/tor.real").exists()) { bundledTor = "/Volumes/Cwtch/Cwtch.app/Contents/MacOS/Tor/tor.real"; + } else { + var splitPath = path.split(dirname(Platform.script.path)); + if (splitPath[0] == "/" && splitPath[1] == "Applications"){ + var appName = splitPath[2]; + print("We're running in /Applications in a non standard app name: $appName"); + if (await File("/Applications/$appName/Contents/MacOS/Tor/tor.real").exists()) { + bundledTor = "/Applications/$appName/Contents/MacOS/Tor/tor.real"; + } + } } } From b53f43d946e2afad4f8af1b81f2e11943ed18a25 Mon Sep 17 00:00:00 2001 From: fyne Date: Sat, 4 Sep 2021 14:41:01 +0100 Subject: [PATCH 03/17] Allow the fallback to the Tor Browser tor.real --- lib/cwtch/ffi.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/cwtch/ffi.dart b/lib/cwtch/ffi.dart index bd8462d3..43f2aa32 100644 --- a/lib/cwtch/ffi.dart +++ b/lib/cwtch/ffi.dart @@ -119,6 +119,9 @@ class CwtchFfi implements Cwtch { bundledTor = "/Applications/Cwtch.app/Contents/MacOS/Tor/tor.real"; } else if (await File("/Volumes/Cwtch/Cwtch.app/Contents/MacOS/Tor/tor.real").exists()) { bundledTor = "/Volumes/Cwtch/Cwtch.app/Contents/MacOS/Tor/tor.real"; + } else if (await File("/Applications/Tor Browser.app/Contents/MacOS/Tor/tor.real").exists()) { + bundledTor = "/Applications/Tor Browser.app/Contents/MacOS/Tor/tor.real"; + print("We couldn't find Tor in the Cwtch app directory, however we can fall back to the Tor Browser binary"); } else { var splitPath = path.split(dirname(Platform.script.path)); if (splitPath[0] == "/" && splitPath[1] == "Applications"){ From be0c4f4d644a23f5f5753818a8136d5f40607607 Mon Sep 17 00:00:00 2001 From: fyne Date: Sat, 4 Sep 2021 18:48:49 +0100 Subject: [PATCH 04/17] Leave the Cwtch.app local path in --- lib/cwtch/ffi.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/cwtch/ffi.dart b/lib/cwtch/ffi.dart index 43f2aa32..8ab357c9 100644 --- a/lib/cwtch/ffi.dart +++ b/lib/cwtch/ffi.dart @@ -115,7 +115,9 @@ class CwtchFfi implements Cwtch { bundledTor = "Tor\\Tor\\tor.exe"; } else if (Platform.isMacOS) { cwtchDir = envVars['CWTCH_HOME'] ?? path.join(envVars['HOME']!, "Library/Application Support/Cwtch"); - if (await File("/Applications/Cwtch.app/Contents/MacOS/Tor/tor.real").exists()) { + if (await File("Cwtch.app/Contents/MacOS/Tor/tor.real").exists()) { + bundledTor = "Cwtch.app/Contents/MacOS/Tor/tor.real"; + } else if (await File("/Applications/Cwtch.app/Contents/MacOS/Tor/tor.real").exists()) { bundledTor = "/Applications/Cwtch.app/Contents/MacOS/Tor/tor.real"; } else if (await File("/Volumes/Cwtch/Cwtch.app/Contents/MacOS/Tor/tor.real").exists()) { bundledTor = "/Volumes/Cwtch/Cwtch.app/Contents/MacOS/Tor/tor.real"; From 47510be6450f3f41d2b526cef16722f9636eaf38 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Tue, 7 Sep 2021 17:41:49 -0700 Subject: [PATCH 05/17] drone checkout from forked repo --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index f84cb7b9..16d80bb3 100644 --- a/.drone.yml +++ b/.drone.yml @@ -20,7 +20,7 @@ steps: # force by pass of ssh host key check, less secure - ssh-keyscan -H git.openprivacy.ca >> ~/.ssh/known_hosts # use Drone ssh var instead of hardcode to allow forks to build (gogs@git.openprivacy.ca:cwtch.im/cwtch-ui.git) - - git clone $DRONE_GIT_SSH_URL . + - git clone gogs@git.openprivacy.ca:$DRONE_REPO.git . - git checkout $DRONE_COMMIT - name: fetch @@ -187,7 +187,7 @@ steps: - git init # -o UserKnownHostsFile=../known_hosts - git config core.sshCommand 'ssh -o StrictHostKeyChecking=no -i ../id_rsa' - - git remote add origin $Env:DRONE_GIT_SSH_URL + - git remote add origin gogs@git.openprivacy.ca:$Env:DRONE_REPO.git - git pull origin trunk - git fetch --tags - git checkout $Env:DRONE_COMMIT From cafac4aa19f6df6751267999b51810375bf740e5 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 8 Sep 2021 09:56:40 -0700 Subject: [PATCH 06/17] drone checkout from forked repo --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 16d80bb3..e8dd2ffd 100644 --- a/.drone.yml +++ b/.drone.yml @@ -154,7 +154,7 @@ volumes: temp: {} trigger: - repo: cwtch.im/cwtch-ui + #repo: cwtch.im/cwtch-ui # allow forks to build? branch: trunk event: - push @@ -271,7 +271,7 @@ steps: - scp -r -o StrictHostKeyChecking=no -i id_rsa deploy\\* buildfiles@build.openprivacy.ca:/home/buildfiles/buildfiles/ trigger: - repo: cwtch.im/cwtch-ui + # repo: cwtch.im/cwtch-ui # allow forks to build? branch: trunk event: - push From 34793ca4591ec091f5a34476744d87c7643ab481 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Tue, 7 Sep 2021 23:09:07 -0400 Subject: [PATCH 07/17] gitignore more libcwtch/tor binaries --- .gitignore | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index d513c8e7..c2dfc6e5 100644 --- a/.gitignore +++ b/.gitignore @@ -40,8 +40,10 @@ app.*.symbols # Obfuscation related app.*.map.json -libCwtch.so +linux/tor +linux/libCwtch.so android/cwtch/cwtch.aar +android/app/src/main/jniLibs/*/libtor.so coverage test/failures -.gradle \ No newline at end of file +.gradle From d85aac0a130a81592485673d71d5c2ae85e2e970 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Wed, 1 Sep 2021 20:33:46 -0400 Subject: [PATCH 08/17] readme: clarify build instructions --- README.md | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5115e5a1..e0c38d3e 100644 --- a/README.md +++ b/README.md @@ -18,29 +18,43 @@ This README covers build instructions, for information on Cwtch itself please go Cwtch processes the following environment variables: - `CWTCH_HOME=` overrides the default storage path of `~/.cwtch` with what ever you choose -- `LOG_FILE=` will reroute all of libcwtch-go's logging to the specified file instead of the console +- `LOG_FILE=` will reroute all of libcwtch-go's logging to the specified file instead of the console - `LOG_LEVEL=debug` will set the log level to debug instead of info ## Building ### Getting Started -First you will need a valid [flutter sdk installation](https://flutter.dev/docs/get-started/install) -and run `flutter pub get` to fetch dependencies. - +First you will need a valid [flutter sdk installation](https://flutter.dev/docs/get-started/install). You will probably want to disable Analytics on the Flutter Tool: `flutter config --no-analytics` +This project uses the flutter `dev` channel, which you will need to switch to: `flutter channel dev; flutter upgrade`. + +Once flutter is set up, run `flutter pub get` from this project folder to fetch dependencies. + +By default a development version is built, which loads profiles from `$CWTCH_HOME/dev/`. +To build a release version and load normal profiles, add something like the +following to the `flutter build` commands below: +``` +--dart-define BUILD_VER="`git describe --tags --abbrev=1`" --dart-define BUILD_DATE="`date +%G-%m-%d-%H-%M`" +``` + ### Building on Linux (for Linux) -- run `fetch-libcwtch-go.sh`libCwtch-go to fetch a prebuild version of `libCwtch-go.so` go to `./linux`. Include `./linux` in `LD_LIBRARY_PATH` -- run `fetch-tor.sh` and/or ensure that `tor` is in `$PATH` -- run `flutter run -d linux` +- copy `libCwtch-go.so` to `linux/`, or run `fetch-libcwtch-go.sh` to download it +- set `LD_LIBRARY_PATH="$PWD/linux"` +- copy a `tor` binary to `linux/` or run `fetch-tor.sh` to download one +- run `flutter config --enable-linux-desktop` if you've never done so before +- optional: launch cwtch-ui directly by running `flutter run -d linux` +- to build cwtch-ui, run `flutter build linux` +- to package the build, run `linux/package-release.sh` ### Building on Windows (for Windows) -- run `fetch-libcwtch-go.ps1` to fetch a prebuild version of `libCwtch.dll` +- copy `libCwtch.dll` to `windows/`, or run `fetch-libcwtch-go.ps1` to download it - run `fetch-tor-win.ps1` to fetch Tor for windows -- run `flutter run -d windows` +- optional: launch cwtch-ui directly by running `flutter run -d windows` +- to build cwtch-ui, run `flutter build windows` ### Building on Linux/Windows (for Android) @@ -49,7 +63,7 @@ You will probably want to disable Analytics on the Flutter Tool: `flutter config ### Building on MacOS -- Navigate to https://git.openprivacy.ca/cwtch.im/libcwtch-go/releases and download the latest libCwtch.dylib into this folder +- Navigate to https://git.openprivacy.ca/cwtch.im/libcwtch-go/releases and download the latest libCwtch.dylib into this folder - Download and install Tor Browser (it's currently the only way to get tor for macos) - `flutter build macos` - `./macos/package-release.sh` From 7de7e36e99eb3a315c454f51c4cd56b3dd94bea1 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Fri, 10 Sep 2021 16:34:43 -0700 Subject: [PATCH 10/17] macos: handle shutdown & first release run copy dev profile if none --- README.md | 11 ++++------- build-release.sh | 20 ++++++++++++++++++++ lib/cwtch/ffi.dart | 15 +++++++++++++++ lib/main.dart | 2 +- 4 files changed, 40 insertions(+), 8 deletions(-) create mode 100755 build-release.sh diff --git a/README.md b/README.md index e0c38d3e..da93bdd1 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This README covers build instructions, for information on Cwtch itself please go - `install.home.sh` installs the app into your home directory - `install.sys.sh` as root to install system wide - or run out of the unziped directory -- MacOS: Cwtch.dmg coming soon... +- MacOS: Available from [https://cwtch.im/download/](https://cwtch.im/download/) as a .dmg ## Running @@ -32,12 +32,9 @@ This project uses the flutter `dev` channel, which you will need to switch to: ` Once flutter is set up, run `flutter pub get` from this project folder to fetch dependencies. -By default a development version is built, which loads profiles from `$CWTCH_HOME/dev/`. -To build a release version and load normal profiles, add something like the -following to the `flutter build` commands below: -``` ---dart-define BUILD_VER="`git describe --tags --abbrev=1`" --dart-define BUILD_DATE="`date +%G-%m-%d-%H-%M`" -``` +By default a development version is built, which loads profiles from `$CWTCH_HOME/dev/`. This is so that you can build +and test development builds with alternative profiles while running a release/stable version of Cwtch uninterrupted. +To build a release version and load normal profiles, use `build-release.sh X` instead of `flutter build X` ### Building on Linux (for Linux) diff --git a/build-release.sh b/build-release.sh new file mode 100755 index 00000000..dc3077da --- /dev/null +++ b/build-release.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +if [ -z "$1" ]; then + echo "build-release.sh [android|linux|macos|windows]" + exit 1 +fi + +if [ -f "VERSION" ]; then + VERSION=`cat VERSION` +else + VERSION=`git describe --tags --abbrev=1` +fi + +if [ -f "BUILDDATE" ]; then + BUILDDATE=`cat BUILDDATE` +else + BUILDDATE=`date +%G-%m-%d-%H-%M` +fi + +flutter build $1 --dart-define BUILD_VER=$VERSION --dart-define BUILD_DATE=$BUILDDATE \ No newline at end of file diff --git a/lib/cwtch/ffi.dart b/lib/cwtch/ffi.dart index 8ab357c9..e34915df 100644 --- a/lib/cwtch/ffi.dart +++ b/lib/cwtch/ffi.dart @@ -136,6 +136,21 @@ class CwtchFfi implements Cwtch { } } + // the first Cwtch MacOS release (1.2) accidently was a dev build + // we need to temporarily remedy this for a release or two then delete + // if macOs and release build and no profile and is dev profile + // copy dev profile to release profile + if (Platform.isMacOS && EnvironmentConfig.BUILD_VER != dev_version) { + var devProfileExists = await Directory(path.join(cwtchDir, "dev", "profiles")).exists(); + var releaseProfileExists = await Directory(path.join(cwtchDir, "profiles")).exists(); + if (devProfileExists && !releaseProfileExists) { + print("MacOS one time dev -> release profile migration..."); + await Process.run("cp", ["-r", "-p", path.join(cwtchDir, "dev", "profiles"), cwtchDir]); + await Process.run("cp", ["-r", "-p", path.join(cwtchDir, "dev", "SALT"), cwtchDir]); + await Process.run("cp", ["-r", "-p", path.join(cwtchDir, "dev", "ui.globals"), cwtchDir]); + } + } + if (EnvironmentConfig.BUILD_VER == dev_version) { cwtchDir = path.join(cwtchDir, "dev"); } diff --git a/lib/main.dart b/lib/main.dart index fac0c74e..c0c56d69 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -156,7 +156,7 @@ class FlwtchState extends State { Future.delayed(Duration(seconds: 2)).then((value) { if (Platform.isAndroid) { SystemNavigator.pop(); - } else if (Platform.isLinux || Platform.isWindows) { + } else if (Platform.isLinux || Platform.isWindows || Platform.isMacOS) { print("Exiting..."); exit(0); } From 34da2bea355052f1444cdb958d160960fa1eb643 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Tue, 14 Sep 2021 09:05:07 -0700 Subject: [PATCH 11/17] streamer mode --- lib/l10n/intl_de.arb | 4 +++- lib/l10n/intl_en.arb | 4 +++- lib/l10n/intl_es.arb | 4 +++- lib/l10n/intl_fr.arb | 4 +++- lib/l10n/intl_it.arb | 4 +++- lib/l10n/intl_pl.arb | 4 +++- lib/l10n/intl_pt.arb | 4 +++- lib/settings.dart | 9 ++++++++- lib/views/globalsettingsview.dart | 13 +++++++++++++ lib/widgets/contactrow.dart | 6 ++++-- lib/widgets/profilerow.dart | 14 ++++++++------ 11 files changed, 54 insertions(+), 16 deletions(-) diff --git a/lib/l10n/intl_de.arb b/lib/l10n/intl_de.arb index 31060f4e..292d45fd 100644 --- a/lib/l10n/intl_de.arb +++ b/lib/l10n/intl_de.arb @@ -1,6 +1,8 @@ { "@@locale": "de", - "@@last_modified": "2021-08-29T18:35:41+02:00", + "@@last_modified": "2021-09-14T02:24:48+02:00", + "descriptionStreamerMode": "If turned on, this option makes the app more visually private for steaming or presenting with, for example, hiding profile and contact onions", + "streamerModeLabel": "Streamer\/Presentation Mode", "archiveConversation": "Archive this Conversation", "profileOnionLabel": "Senden Sie diese Adresse an Peers, mit denen Sie sich verbinden möchten", "addPeerTab": "Einen anderen Nutzer hinzufügen", diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 53e4971d..66870b78 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -1,6 +1,8 @@ { "@@locale": "en", - "@@last_modified": "2021-08-29T18:35:41+02:00", + "@@last_modified": "2021-09-14T02:24:48+02:00", + "descriptionStreamerMode": "If turned on, this option makes the app more visually private for steaming or presenting with, for example, hiding profile and contact onions", + "streamerModeLabel": "Streamer\/Presentation Mode", "archiveConversation": "Archive this Conversation", "profileOnionLabel": "Send this address to people you want to connect with", "addPeerTab": "Add a contact", diff --git a/lib/l10n/intl_es.arb b/lib/l10n/intl_es.arb index 02922d43..6879c5ac 100644 --- a/lib/l10n/intl_es.arb +++ b/lib/l10n/intl_es.arb @@ -1,6 +1,8 @@ { "@@locale": "es", - "@@last_modified": "2021-08-29T18:35:41+02:00", + "@@last_modified": "2021-09-14T02:24:48+02:00", + "descriptionStreamerMode": "If turned on, this option makes the app more visually private for steaming or presenting with, for example, hiding profile and contact onions", + "streamerModeLabel": "Streamer\/Presentation Mode", "archiveConversation": "Archive this Conversation", "profileOnionLabel": "Envía esta dirección a los contactos con los que quieras conectarte", "addPeerTab": "Agregar Contacto", diff --git a/lib/l10n/intl_fr.arb b/lib/l10n/intl_fr.arb index 764feeb4..e1d3415e 100644 --- a/lib/l10n/intl_fr.arb +++ b/lib/l10n/intl_fr.arb @@ -1,6 +1,8 @@ { "@@locale": "fr", - "@@last_modified": "2021-08-29T18:35:41+02:00", + "@@last_modified": "2021-09-14T02:24:48+02:00", + "descriptionStreamerMode": "If turned on, this option makes the app more visually private for steaming or presenting with, for example, hiding profile and contact onions", + "streamerModeLabel": "Streamer\/Presentation Mode", "archiveConversation": "Archiver cette conversation", "profileOnionLabel": "Envoyez cette adresse aux personnes avec lesquelles vous souhaitez entrer en contact.", "addPeerTab": "Ajouter un contact", diff --git a/lib/l10n/intl_it.arb b/lib/l10n/intl_it.arb index 3ae0cbf8..c0c1fdd0 100644 --- a/lib/l10n/intl_it.arb +++ b/lib/l10n/intl_it.arb @@ -1,6 +1,8 @@ { "@@locale": "it", - "@@last_modified": "2021-08-29T18:35:41+02:00", + "@@last_modified": "2021-09-14T02:24:48+02:00", + "descriptionStreamerMode": "If turned on, this option makes the app more visually private for steaming or presenting with, for example, hiding profile and contact onions", + "streamerModeLabel": "Streamer\/Presentation Mode", "archiveConversation": "Archive this Conversation", "profileOnionLabel": "Inviare questo indirizzo ai peer con cui si desidera connettersi", "addPeerTab": "Aggiungi un peer", diff --git a/lib/l10n/intl_pl.arb b/lib/l10n/intl_pl.arb index 4fec7193..8f069bc0 100644 --- a/lib/l10n/intl_pl.arb +++ b/lib/l10n/intl_pl.arb @@ -1,6 +1,8 @@ { "@@locale": "pl", - "@@last_modified": "2021-08-29T18:35:41+02:00", + "@@last_modified": "2021-09-14T02:24:48+02:00", + "descriptionStreamerMode": "If turned on, this option makes the app more visually private for steaming or presenting with, for example, hiding profile and contact onions", + "streamerModeLabel": "Streamer\/Presentation Mode", "archiveConversation": "Archive this Conversation", "profileOnionLabel": "Send this address to contacts you want to connect with", "addPeerTab": "Add a contact", diff --git a/lib/l10n/intl_pt.arb b/lib/l10n/intl_pt.arb index b52abf99..2c3d6cf9 100644 --- a/lib/l10n/intl_pt.arb +++ b/lib/l10n/intl_pt.arb @@ -1,6 +1,8 @@ { "@@locale": "pt", - "@@last_modified": "2021-08-29T18:35:41+02:00", + "@@last_modified": "2021-09-14T02:24:48+02:00", + "descriptionStreamerMode": "If turned on, this option makes the app more visually private for steaming or presenting with, for example, hiding profile and contact onions", + "streamerModeLabel": "Streamer\/Presentation Mode", "archiveConversation": "Archive this Conversation", "profileOnionLabel": "Send this address to contacts you want to connect with", "addPeerTab": "Add a contact", diff --git a/lib/settings.dart b/lib/settings.dart index df42b083..291e8719 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -31,6 +31,7 @@ class Settings extends ChangeNotifier { DualpaneMode _uiColumnModeLandscape = DualpaneMode.CopyPortrait; bool blockUnknownConnections = false; + bool streamerMode = false; /// Set the dark theme. void setDark() { @@ -74,8 +75,8 @@ class Settings extends ChangeNotifier { // Set Locale and notify listeners switchLocale(Locale(settings["Locale"])); - // Decide whether to enable Experiments blockUnknownConnections = settings["BlockUnknownConnections"]; + streamerMode = settings["StreamerMode"]; // Decide whether to enable Experiments experimentsEnabled = settings["ExperimentsEnabled"]; @@ -105,6 +106,11 @@ class Settings extends ChangeNotifier { notifyListeners(); } + setStreamerMode(bool newSteamerMode) { + streamerMode = newSteamerMode; + notifyListeners(); + } + /// Block Unknown Connections will autoblock connections if they authenticate with public key not in our contacts list. /// This is one of the best tools we have to combat abuse, while it isn't ideal it does allow a user to curate their contacts /// list without being bothered by spurious requests (either permanently, or as a short term measure). @@ -227,6 +233,7 @@ class Settings extends ChangeNotifier { "Theme": themeString, "PreviousPid": -1, "BlockUnknownConnections": blockUnknownConnections, + "StreamerMode": streamerMode, "ExperimentsEnabled": this.experimentsEnabled, "Experiments": experiments, "StateRootPane": 0, diff --git a/lib/views/globalsettingsview.dart b/lib/views/globalsettingsview.dart index ce655ed3..fa7b1619 100644 --- a/lib/views/globalsettingsview.dart +++ b/lib/views/globalsettingsview.dart @@ -137,6 +137,19 @@ class _GlobalSettingsViewState extends State { inactiveTrackColor: settings.theme.defaultButtonDisabledColor(), secondary: Icon(CwtchIcons.block_unknown, color: settings.current().mainTextColor()), ), + SwitchListTile( + title: Text(AppLocalizations.of(context)!.streamerModeLabel, style: TextStyle(color: settings.current().mainTextColor())), + subtitle: Text(AppLocalizations.of(context)!.descriptionStreamerMode), + value: settings.streamerMode, + onChanged: (bool value) { + settings.setStreamerMode(value); + // Save Settings... + saveSettings(context); + }, + activeTrackColor: settings.theme.defaultButtonActiveColor(), + inactiveTrackColor: settings.theme.defaultButtonDisabledColor(), + secondary: Icon(CwtchIcons.block_unknown, color: settings.current().mainTextColor()), + ), SwitchListTile( title: Text(AppLocalizations.of(context)!.experimentsEnabled, style: TextStyle(color: settings.current().mainTextColor())), subtitle: Text(AppLocalizations.of(context)!.descriptionExperiments), diff --git a/lib/widgets/contactrow.dart b/lib/widgets/contactrow.dart index 140e3703..9514e0ec 100644 --- a/lib/widgets/contactrow.dart +++ b/lib/widgets/contactrow.dart @@ -65,9 +65,11 @@ class _ContactRowState extends State { child: LinearProgressIndicator( color: Provider.of(context).theme.defaultButtonActiveColor(), )), - Text(contact.onion, + Visibility( + visible: !Provider.of(context).streamerMode, + child: Text(contact.onion, style: TextStyle(color: contact.isBlocked ? Provider.of(context).theme.portraitBlockedTextColor() : Provider.of(context).theme.mainTextColor())), - ], + )], ))), Padding( padding: const EdgeInsets.all(5.0), diff --git a/lib/widgets/profilerow.dart b/lib/widgets/profilerow.dart index 0c987820..3782195e 100644 --- a/lib/widgets/profilerow.dart +++ b/lib/widgets/profilerow.dart @@ -46,12 +46,14 @@ class _ProfileRowState extends State { softWrap: true, overflow: TextOverflow.ellipsis, ), - ExcludeSemantics( - child: Text( - profile.onion, - softWrap: true, - overflow: TextOverflow.ellipsis, - )) + Visibility( + visible: !Provider.of(context).streamerMode, + child: ExcludeSemantics( + child: Text( + profile.onion, + softWrap: true, + overflow: TextOverflow.ellipsis, + ))) ], )), IconButton( From ac619cd514e3841af2650828bf68f73a3440790f Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Tue, 14 Sep 2021 13:48:25 -0700 Subject: [PATCH 12/17] make settings null safer --- lib/settings.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/settings.dart b/lib/settings.dart index 291e8719..fa2d965a 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -75,11 +75,11 @@ class Settings extends ChangeNotifier { // Set Locale and notify listeners switchLocale(Locale(settings["Locale"])); - blockUnknownConnections = settings["BlockUnknownConnections"]; - streamerMode = settings["StreamerMode"]; + blockUnknownConnections = settings["BlockUnknownConnections"] ?? false; + streamerMode = settings["StreamerMode"] ?? false; // Decide whether to enable Experiments - experimentsEnabled = settings["ExperimentsEnabled"]; + experimentsEnabled = settings["ExperimentsEnabled"] ?? false; // Set the internal experiments map. Casting from the Map that we get from JSON experiments = new HashMap.from(settings["Experiments"]); From be2de14d65d92927a2bf7a8acee7478b62be2fcd Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Tue, 14 Sep 2021 14:00:21 -0700 Subject: [PATCH 13/17] make settings null safer, l10n --- LIBCWTCH-GO.version | 2 +- lib/l10n/intl_de.arb | 4 ++-- lib/l10n/intl_en.arb | 4 ++-- lib/l10n/intl_es.arb | 4 ++-- lib/l10n/intl_fr.arb | 6 +++--- lib/l10n/intl_it.arb | 4 ++-- lib/l10n/intl_pl.arb | 4 ++-- lib/l10n/intl_pt.arb | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/LIBCWTCH-GO.version b/LIBCWTCH-GO.version index f5ff63c0..5e60f32c 100644 --- a/LIBCWTCH-GO.version +++ b/LIBCWTCH-GO.version @@ -1 +1 @@ -v1.2.1-2021-08-30-22-14 \ No newline at end of file +v1.2.1-2-ga8e7bba-2021-09-14-21-04 diff --git a/lib/l10n/intl_de.arb b/lib/l10n/intl_de.arb index 292d45fd..caf5fd94 100644 --- a/lib/l10n/intl_de.arb +++ b/lib/l10n/intl_de.arb @@ -1,7 +1,7 @@ { "@@locale": "de", - "@@last_modified": "2021-09-14T02:24:48+02:00", - "descriptionStreamerMode": "If turned on, this option makes the app more visually private for steaming or presenting with, for example, hiding profile and contact onions", + "@@last_modified": "2021-09-14T22:34:57+02:00", + "descriptionStreamerMode": "If turned on, this option makes the app more visually private for streaming or presenting with, for example, hiding profile and contact onions", "streamerModeLabel": "Streamer\/Presentation Mode", "archiveConversation": "Archive this Conversation", "profileOnionLabel": "Senden Sie diese Adresse an Peers, mit denen Sie sich verbinden möchten", diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 66870b78..389e91cf 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -1,7 +1,7 @@ { "@@locale": "en", - "@@last_modified": "2021-09-14T02:24:48+02:00", - "descriptionStreamerMode": "If turned on, this option makes the app more visually private for steaming or presenting with, for example, hiding profile and contact onions", + "@@last_modified": "2021-09-14T22:34:57+02:00", + "descriptionStreamerMode": "If turned on, this option makes the app more visually private for streaming or presenting with, for example, hiding profile and contact onions", "streamerModeLabel": "Streamer\/Presentation Mode", "archiveConversation": "Archive this Conversation", "profileOnionLabel": "Send this address to people you want to connect with", diff --git a/lib/l10n/intl_es.arb b/lib/l10n/intl_es.arb index 6879c5ac..a3c80388 100644 --- a/lib/l10n/intl_es.arb +++ b/lib/l10n/intl_es.arb @@ -1,7 +1,7 @@ { "@@locale": "es", - "@@last_modified": "2021-09-14T02:24:48+02:00", - "descriptionStreamerMode": "If turned on, this option makes the app more visually private for steaming or presenting with, for example, hiding profile and contact onions", + "@@last_modified": "2021-09-14T22:34:57+02:00", + "descriptionStreamerMode": "If turned on, this option makes the app more visually private for streaming or presenting with, for example, hiding profile and contact onions", "streamerModeLabel": "Streamer\/Presentation Mode", "archiveConversation": "Archive this Conversation", "profileOnionLabel": "Envía esta dirección a los contactos con los que quieras conectarte", diff --git a/lib/l10n/intl_fr.arb b/lib/l10n/intl_fr.arb index e1d3415e..6bc3fb27 100644 --- a/lib/l10n/intl_fr.arb +++ b/lib/l10n/intl_fr.arb @@ -1,8 +1,8 @@ { "@@locale": "fr", - "@@last_modified": "2021-09-14T02:24:48+02:00", - "descriptionStreamerMode": "If turned on, this option makes the app more visually private for steaming or presenting with, for example, hiding profile and contact onions", - "streamerModeLabel": "Streamer\/Presentation Mode", + "@@last_modified": "2021-09-14T22:34:57+02:00", + "descriptionStreamerMode": "Si elle est activée, cette option donne un rendu visuel plus privé à l'application pour la diffusion ou la présentation, par exemple en masquant les profils et les contacts.", + "streamerModeLabel": "Mode Streamer\/Présentation", "archiveConversation": "Archiver cette conversation", "profileOnionLabel": "Envoyez cette adresse aux personnes avec lesquelles vous souhaitez entrer en contact.", "addPeerTab": "Ajouter un contact", diff --git a/lib/l10n/intl_it.arb b/lib/l10n/intl_it.arb index c0c1fdd0..a7348ca0 100644 --- a/lib/l10n/intl_it.arb +++ b/lib/l10n/intl_it.arb @@ -1,7 +1,7 @@ { "@@locale": "it", - "@@last_modified": "2021-09-14T02:24:48+02:00", - "descriptionStreamerMode": "If turned on, this option makes the app more visually private for steaming or presenting with, for example, hiding profile and contact onions", + "@@last_modified": "2021-09-14T22:34:57+02:00", + "descriptionStreamerMode": "If turned on, this option makes the app more visually private for streaming or presenting with, for example, hiding profile and contact onions", "streamerModeLabel": "Streamer\/Presentation Mode", "archiveConversation": "Archive this Conversation", "profileOnionLabel": "Inviare questo indirizzo ai peer con cui si desidera connettersi", diff --git a/lib/l10n/intl_pl.arb b/lib/l10n/intl_pl.arb index 8f069bc0..13756057 100644 --- a/lib/l10n/intl_pl.arb +++ b/lib/l10n/intl_pl.arb @@ -1,7 +1,7 @@ { "@@locale": "pl", - "@@last_modified": "2021-09-14T02:24:48+02:00", - "descriptionStreamerMode": "If turned on, this option makes the app more visually private for steaming or presenting with, for example, hiding profile and contact onions", + "@@last_modified": "2021-09-14T22:34:57+02:00", + "descriptionStreamerMode": "If turned on, this option makes the app more visually private for streaming or presenting with, for example, hiding profile and contact onions", "streamerModeLabel": "Streamer\/Presentation Mode", "archiveConversation": "Archive this Conversation", "profileOnionLabel": "Send this address to contacts you want to connect with", diff --git a/lib/l10n/intl_pt.arb b/lib/l10n/intl_pt.arb index 2c3d6cf9..6851374b 100644 --- a/lib/l10n/intl_pt.arb +++ b/lib/l10n/intl_pt.arb @@ -1,7 +1,7 @@ { "@@locale": "pt", - "@@last_modified": "2021-09-14T02:24:48+02:00", - "descriptionStreamerMode": "If turned on, this option makes the app more visually private for steaming or presenting with, for example, hiding profile and contact onions", + "@@last_modified": "2021-09-14T22:34:57+02:00", + "descriptionStreamerMode": "If turned on, this option makes the app more visually private for streaming or presenting with, for example, hiding profile and contact onions", "streamerModeLabel": "Streamer\/Presentation Mode", "archiveConversation": "Archive this Conversation", "profileOnionLabel": "Send this address to contacts you want to connect with", From c1aee0d128252bffc37ec7332c9b8d535a22cd3f Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Fri, 17 Sep 2021 13:38:10 -0700 Subject: [PATCH 14/17] Fix #163 Also make quoted messages nicer --- lib/cwtch/ffi.dart | 9 ++-- lib/model.dart | 38 +++++++++------- lib/views/contactsview.dart | 1 + lib/views/globalsettingsview.dart | 2 +- lib/views/groupsettingsview.dart | 9 ++-- lib/views/messageview.dart | 33 ++++++++------ lib/widgets/contactrow.dart | 11 ++--- lib/widgets/messagelist.dart | 72 +++++++++++++++---------------- lib/widgets/messagerow.dart | 7 ++- lib/widgets/profilerow.dart | 12 +++--- 10 files changed, 105 insertions(+), 89 deletions(-) diff --git a/lib/cwtch/ffi.dart b/lib/cwtch/ffi.dart index e34915df..4bbee290 100644 --- a/lib/cwtch/ffi.dart +++ b/lib/cwtch/ffi.dart @@ -98,7 +98,7 @@ class CwtchFfi implements Cwtch { Map envVars = Platform.environment; String cwtchDir = ""; if (Platform.isLinux) { - cwtchDir = envVars['CWTCH_HOME'] ?? path.join(envVars['HOME']!, ".cwtch"); + cwtchDir = envVars['CWTCH_HOME'] ?? path.join(envVars['HOME']!, ".cwtch"); if (await File("linux/tor").exists()) { bundledTor = "linux/tor"; } else if (await File("lib/tor").exists()) { @@ -126,7 +126,7 @@ class CwtchFfi implements Cwtch { print("We couldn't find Tor in the Cwtch app directory, however we can fall back to the Tor Browser binary"); } else { var splitPath = path.split(dirname(Platform.script.path)); - if (splitPath[0] == "/" && splitPath[1] == "Applications"){ + if (splitPath[0] == "/" && splitPath[1] == "Applications") { var appName = splitPath[2]; print("We're running in /Applications in a non standard app name: $appName"); if (await File("/Applications/$appName/Contents/MacOS/Tor/tor.real").exists()) { @@ -138,8 +138,8 @@ class CwtchFfi implements Cwtch { // the first Cwtch MacOS release (1.2) accidently was a dev build // we need to temporarily remedy this for a release or two then delete - // if macOs and release build and no profile and is dev profile - // copy dev profile to release profile + // if macOs and release build and no profile and is dev profile + // copy dev profile to release profile if (Platform.isMacOS && EnvironmentConfig.BUILD_VER != dev_version) { var devProfileExists = await Directory(path.join(cwtchDir, "dev", "profiles")).exists(); var releaseProfileExists = await Directory(path.join(cwtchDir, "profiles")).exists(); @@ -448,7 +448,6 @@ class CwtchFfi implements Cwtch { malloc.free(u2); } - @override // ignore: non_constant_identifier_names void UpdateMessageFlags(String profile, String handle, int index, int flags) { diff --git a/lib/model.dart b/lib/model.dart index 603fd0bb..d63fe3c3 100644 --- a/lib/model.dart +++ b/lib/model.dart @@ -31,6 +31,7 @@ class AppState extends ChangeNotifier { String? _selectedProfile; String? _selectedConversation; int _initialScrollIndex = 0; + int _hoveredIndex = -1; int? _selectedIndex; bool _unreadMessagesBelow = false; @@ -62,6 +63,14 @@ class AppState extends ChangeNotifier { notifyListeners(); } + // Never use this for message lookup - can be a non-indexed value + // e.g. -1 + int get hoveredIndex => _hoveredIndex; + set hoveredIndex(int newVal) { + this._hoveredIndex = newVal; + notifyListeners(); + } + bool get unreadMessagesBelow => _unreadMessagesBelow; set unreadMessagesBelow(bool newVal) { this._unreadMessagesBelow = newVal; @@ -381,21 +390,18 @@ class ContactInfoState extends ChangeNotifier { String? _server; late bool _archived; - ContactInfoState( - this.profileOnion, - this.onion, { - nickname = "", - isGroup = false, - authorization = ContactAuthorization.unknown, - status = "", - imagePath = "", - savePeerHistory = "DeleteHistoryConfirmed", - numMessages = 0, - numUnread = 0, - lastMessageTime, - server, - archived = false - }) { + ContactInfoState(this.profileOnion, this.onion, + {nickname = "", + isGroup = false, + authorization = ContactAuthorization.unknown, + status = "", + imagePath = "", + savePeerHistory = "DeleteHistoryConfirmed", + numMessages = 0, + numUnread = 0, + lastMessageTime, + server, + archived = false}) { this._nickname = nickname; this._isGroup = isGroup; this._authorization = authorization; @@ -421,8 +427,8 @@ class ContactInfoState extends ChangeNotifier { this._archived = archived; notifyListeners(); } - bool get isArchived => this._archived; + bool get isArchived => this._archived; set savePeerHistory(String newVal) { this._savePeerHistory = newVal; diff --git a/lib/views/contactsview.dart b/lib/views/contactsview.dart index 297fc0d5..f1caeb6d 100644 --- a/lib/views/contactsview.dart +++ b/lib/views/contactsview.dart @@ -30,6 +30,7 @@ void selectConversation(BuildContext context, String handle) { Provider.of(context, listen: false).initialScrollIndex = initialIndex; Provider.of(context, listen: false).selectedConversation = handle; Provider.of(context, listen: false).selectedIndex = null; + Provider.of(context, listen: false).hoveredIndex = -1; // if in singlepane mode, push to the stack var isLandscape = Provider.of(context, listen: false).isLandscape(context); if (Provider.of(context, listen: false).uiColumns(isLandscape).length == 1) _pushMessageView(context, handle); diff --git a/lib/views/globalsettingsview.dart b/lib/views/globalsettingsview.dart index fa7b1619..7c330ea9 100644 --- a/lib/views/globalsettingsview.dart +++ b/lib/views/globalsettingsview.dart @@ -142,7 +142,7 @@ class _GlobalSettingsViewState extends State { subtitle: Text(AppLocalizations.of(context)!.descriptionStreamerMode), value: settings.streamerMode, onChanged: (bool value) { - settings.setStreamerMode(value); + settings.setStreamerMode(value); // Save Settings... saveSettings(context); }, diff --git a/lib/views/groupsettingsview.dart b/lib/views/groupsettingsview.dart index 6d5acfe9..72afb5d2 100644 --- a/lib/views/groupsettingsview.dart +++ b/lib/views/groupsettingsview.dart @@ -162,11 +162,12 @@ class _GroupSettingsViewState extends State { onPressed: () { showAlertDialog(context); }, - style: ButtonStyle ( - backgroundColor: MaterialStateProperty.all(Colors.transparent) - ), + style: ButtonStyle(backgroundColor: MaterialStateProperty.all(Colors.transparent)), icon: Icon(CwtchIcons.leave_group), - label: Text(AppLocalizations.of(context)!.leaveGroup, style: TextStyle(decoration: TextDecoration.underline),), + label: Text( + AppLocalizations.of(context)!.leaveGroup, + style: TextStyle(decoration: TextDecoration.underline), + ), )) ]) ]) diff --git a/lib/views/messageview.dart b/lib/views/messageview.dart index 625608bc..034c7d68 100644 --- a/lib/views/messageview.dart +++ b/lib/views/messageview.dart @@ -257,18 +257,27 @@ class _MessageViewState extends State { color: message.getMetadata().senderHandle != Provider.of(context).selectedProfile ? Provider.of(context).theme.messageFromOtherBackgroundColor() : Provider.of(context).theme.messageFromMeBackgroundColor(), - child: Wrap(runAlignment: WrapAlignment.spaceEvenly, alignment: WrapAlignment.spaceEvenly, runSpacing: 1.0, crossAxisAlignment: WrapCrossAlignment.center, children: [ - Center(widthFactor: 1, child: Padding(padding: EdgeInsets.all(10.0), child: Icon(Icons.reply, size: 32))), - Center(widthFactor: 1.0, child: message.getPreviewWidget(context)), - Center( - widthFactor: 1.0, - child: IconButton( - icon: Icon(Icons.highlight_remove), - tooltip: AppLocalizations.of(context)!.tooltipRemoveThisQuotedMessage, - onPressed: () { - Provider.of(context, listen: false).selectedIndex = null; - }, - )) + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Stack(children: [ + Align( + alignment: Alignment.topRight, + child: IconButton( + icon: Icon(Icons.highlight_remove), + tooltip: AppLocalizations.of(context)!.tooltipRemoveThisQuotedMessage, + onPressed: () { + Provider.of(context, listen: false).selectedIndex = null; + }, + )), + Align( + alignment: Alignment.topLeft, + child: Padding(padding: EdgeInsets.all(2.0), child: Icon(Icons.reply)), + ) + ]), + Wrap( + runAlignment: WrapAlignment.spaceEvenly, + alignment: WrapAlignment.center, + runSpacing: 1.0, + children: [Center(widthFactor: 1.0, child: Padding(padding: EdgeInsets.all(10.0), child: message.getPreviewWidget(context)))]), ])); } else { return MessageLoadingBubble(); diff --git a/lib/widgets/contactrow.dart b/lib/widgets/contactrow.dart index 9514e0ec..6a50008a 100644 --- a/lib/widgets/contactrow.dart +++ b/lib/widgets/contactrow.dart @@ -65,11 +65,12 @@ class _ContactRowState extends State { child: LinearProgressIndicator( color: Provider.of(context).theme.defaultButtonActiveColor(), )), - Visibility( - visible: !Provider.of(context).streamerMode, - child: Text(contact.onion, - style: TextStyle(color: contact.isBlocked ? Provider.of(context).theme.portraitBlockedTextColor() : Provider.of(context).theme.mainTextColor())), - )], + Visibility( + visible: !Provider.of(context).streamerMode, + child: Text(contact.onion, + style: TextStyle(color: contact.isBlocked ? Provider.of(context).theme.portraitBlockedTextColor() : Provider.of(context).theme.mainTextColor())), + ) + ], ))), Padding( padding: const EdgeInsets.all(5.0), diff --git a/lib/widgets/messagelist.dart b/lib/widgets/messagelist.dart index 0605352b..a6a8353d 100644 --- a/lib/widgets/messagelist.dart +++ b/lib/widgets/messagelist.dart @@ -56,44 +56,44 @@ class _MessageListState extends State { Text("")), ))), Expanded( - child: Container( - // Only show broken heart is the contact is offline... - decoration: BoxDecoration( - image: Provider.of(outerContext).isOnline() - ? null - : DecorationImage( - fit: BoxFit.scaleDown, - alignment: Alignment.center, - image: AssetImage("assets/core/negative_heart_512px.png"), - colorFilter: ColorFilter.mode(Provider.of(context).theme.hilightElementTextColor(), BlendMode.srcIn))), - // Don't load messages for syncing server... - child: loadMessages - ? ScrollablePositionedList.builder( - itemPositionsListener: widget.scrollListener, - itemScrollController: widget.scrollController, - initialScrollIndex: Provider.of(outerContext, listen: false).initialScrollIndex, - itemCount: Provider.of(outerContext).totalMessages, - reverse: true, // NOTE: There seems to be a bug in flutter that corrects the mouse wheel scroll, but not the drag direction... - itemBuilder: (itemBuilderContext, index) { - var profileOnion = Provider.of(outerContext, listen: false).onion; - var contactHandle = Provider.of(outerContext, listen: false).onion; - var messageIndex = Provider.of(outerContext).totalMessages - index - 1; + child: Container( + // Only show broken heart is the contact is offline... + decoration: BoxDecoration( + image: Provider.of(outerContext).isOnline() + ? null + : DecorationImage( + fit: BoxFit.scaleDown, + alignment: Alignment.center, + image: AssetImage("assets/core/negative_heart_512px.png"), + colorFilter: ColorFilter.mode(Provider.of(context).theme.hilightElementTextColor(), BlendMode.srcIn))), + // Don't load messages for syncing server... + child: loadMessages + ? ScrollablePositionedList.builder( + itemPositionsListener: widget.scrollListener, + itemScrollController: widget.scrollController, + initialScrollIndex: Provider.of(outerContext, listen: false).initialScrollIndex, + itemCount: Provider.of(outerContext).totalMessages, + reverse: true, // NOTE: There seems to be a bug in flutter that corrects the mouse wheel scroll, but not the drag direction... + itemBuilder: (itemBuilderContext, index) { + var profileOnion = Provider.of(outerContext, listen: false).onion; + var contactHandle = Provider.of(outerContext, listen: false).onion; + var messageIndex = Provider.of(outerContext).totalMessages - index - 1; - return FutureBuilder( - future: messageHandler(outerContext, profileOnion, contactHandle, messageIndex), - builder: (context, snapshot) { - if (snapshot.hasData) { - var message = snapshot.data as Message; - // Already includes MessageRow,, - return message.getWidget(context); - } else { - return MessageLoadingBubble(); - } - }, - ); + return FutureBuilder( + future: messageHandler(outerContext, profileOnion, contactHandle, messageIndex), + builder: (context, snapshot) { + if (snapshot.hasData) { + var message = snapshot.data as Message; + // Already includes MessageRow,, + return message.getWidget(context); + } else { + return MessageLoadingBubble(); + } }, - ) - : null)) + ); + }, + ) + : null)) ]))); } } diff --git a/lib/widgets/messagerow.dart b/lib/widgets/messagerow.dart index 2084cca5..69e97a00 100644 --- a/lib/widgets/messagerow.dart +++ b/lib/widgets/messagerow.dart @@ -22,7 +22,6 @@ class MessageRow extends StatefulWidget { } class MessageRowState extends State with SingleTickerProviderStateMixin { - bool showMenu = false; bool showBlockedMessage = false; late AnimationController _controller; late Animation _animation; @@ -70,7 +69,7 @@ class MessageRowState extends State with SingleTickerProviderStateMi } Widget wdgIcons = Visibility( - visible: this.showMenu, + visible: Provider.of(context).hoveredIndex == Provider.of(context).messageIndex, maintainSize: true, maintainAnimation: true, maintainState: true, @@ -164,12 +163,12 @@ class MessageRowState extends State with SingleTickerProviderStateMi // For desktop... onHover: (event) { setState(() { - this.showMenu = true; + Provider.of(context, listen: false).hoveredIndex = Provider.of(context).messageIndex; }); }, onExit: (event) { setState(() { - this.showMenu = false; + Provider.of(context, listen: false).hoveredIndex = -1; }); }, child: GestureDetector( diff --git a/lib/widgets/profilerow.dart b/lib/widgets/profilerow.dart index 3782195e..9d43997f 100644 --- a/lib/widgets/profilerow.dart +++ b/lib/widgets/profilerow.dart @@ -47,13 +47,13 @@ class _ProfileRowState extends State { overflow: TextOverflow.ellipsis, ), Visibility( - visible: !Provider.of(context).streamerMode, + visible: !Provider.of(context).streamerMode, child: ExcludeSemantics( - child: Text( - profile.onion, - softWrap: true, - overflow: TextOverflow.ellipsis, - ))) + child: Text( + profile.onion, + softWrap: true, + overflow: TextOverflow.ellipsis, + ))) ], )), IconButton( From 539b93836aa77646b38b9434ba60f2e7e3b7d77a Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 21 Sep 2021 13:31:11 -0700 Subject: [PATCH 15/17] Light Theme Fixes #162 --- lib/cwtch/cwtchNotifier.dart | 2 ++ lib/opaque.dart | 11 +++++++---- lib/views/messageview.dart | 2 +- lib/views/profilemgrview.dart | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/cwtch/cwtchNotifier.dart b/lib/cwtch/cwtchNotifier.dart index 93024c76..96c7e547 100644 --- a/lib/cwtch/cwtchNotifier.dart +++ b/lib/cwtch/cwtchNotifier.dart @@ -307,6 +307,8 @@ class CwtchNotifier { if (profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"]) != null) { profileCN.getProfile(data["ProfileOnion"])?.contactList.getContact(data["RemotePeer"])!.isArchived = data["Data"] == "true"; } + } else if (data["Key"] == "LastKnowSignature") { + // group syncing information that isn't relevant to the UI... } else { EnvironmentConfig.debugLog("unhandled set peer attribute event: ${data['Key']}"); } diff --git a/lib/opaque.dart b/lib/opaque.dart index 882aecac..fc984217 100644 --- a/lib/opaque.dart +++ b/lib/opaque.dart @@ -630,7 +630,7 @@ class OpaqueLight extends OpaqueThemeType { static final Color whitePurple = Color(0xFFFFFDFF); static final Color softPurple = Color(0xFFFDF3FC); static final Color purple = Color(0xFFDFB9DE); - static final Color brightPurple = Color(0xFF760388); + static final Color brightPurple = Color(0xFFD1B0E0); static final Color darkPurple = Color(0xFF350052); static final Color greyPurple = Color(0xFF775F84); static final Color pink = Color(0xFFE85DA1); @@ -900,11 +900,11 @@ class OpaqueLight extends OpaqueThemeType { } Color messageFromMeBackgroundColor() { - return darkPurple; + return brightPurple; } Color messageFromMeTextColor() { - return whitePurple; + return mainTextColor(); } Color messageFromOtherBackgroundColor() { @@ -948,11 +948,14 @@ ThemeData mkThemeData(Settings opaque) { backgroundColor: opaque.current().backgroundMainColor(), highlightColor: opaque.current().hilightElementTextColor(), iconTheme: IconThemeData( - color: opaque.current().mainTextColor(), + color: opaque.current().toolbarIconColor(), ), cardColor: opaque.current().backgroundMainColor(), appBarTheme: AppBarTheme( backgroundColor: opaque.current().backgroundPaneColor(), + iconTheme: IconThemeData( + color: opaque.current().mainTextColor(), + ), titleTextStyle: TextStyle( color: opaque.current().mainTextColor(), ), diff --git a/lib/views/messageview.dart b/lib/views/messageview.dart index 034c7d68..f550287d 100644 --- a/lib/views/messageview.dart +++ b/lib/views/messageview.dart @@ -236,7 +236,7 @@ class _MessageViewState extends State { focusedBorder: InputBorder.none, enabled: true, suffixIcon: ElevatedButton( - child: Icon(CwtchIcons.send_24px, size: 24, color: Provider.of(context).theme.mainTextColor()), + child: Icon(CwtchIcons.send_24px, size: 24, color: Provider.of(context).theme.defaultButtonTextColor()), onPressed: isOffline ? null : _sendMessage, ))), )))), diff --git a/lib/views/profilemgrview.dart b/lib/views/profilemgrview.dart index 8e4aa65e..33f62340 100644 --- a/lib/views/profilemgrview.dart +++ b/lib/views/profilemgrview.dart @@ -51,6 +51,7 @@ class _ProfileMgrViewState extends State { Icon( CwtchIcons.cwtch_knott, size: 36, + color: settings.theme.mainTextColor(), ), SizedBox( width: 10, From e7c6bb145a66caa5523a4e716f29a61af5ae4ccb Mon Sep 17 00:00:00 2001 From: erinn Date: Tue, 21 Sep 2021 14:45:31 -0700 Subject: [PATCH 16/17] l10n updates --- lib/l10n/intl_de.arb | 13 ++++++++++++- lib/l10n/intl_en.arb | 13 ++++++++++++- lib/l10n/intl_es.arb | 13 ++++++++++++- lib/l10n/intl_fr.arb | 13 ++++++++++++- lib/l10n/intl_it.arb | 13 ++++++++++++- lib/l10n/intl_pt.arb | 13 ++++++++++++- 6 files changed, 72 insertions(+), 6 deletions(-) diff --git a/lib/l10n/intl_de.arb b/lib/l10n/intl_de.arb index caf5fd94..e8d93349 100644 --- a/lib/l10n/intl_de.arb +++ b/lib/l10n/intl_de.arb @@ -1,6 +1,17 @@ { "@@locale": "de", - "@@last_modified": "2021-09-14T22:34:57+02:00", + "@@last_modified": "2021-09-21T23:09:19+02:00", + "descriptionFileSharing": "The file sharing experiment allows you to send and receive files from Cwtch contacts and groups. Note that sharing a file with a group will result in members of that group connecting with you directly over Cwtch to download it.", + "settingFileSharing": "File Sharing", + "tooltipSendFile": "Send File", + "messageFileOffered": "Contact is offering to send you a file", + "messageFileSent": "You sent a file", + "messageEnableFileSharing": "Enable the file sharing experiment to view this message.", + "labelFilesize": "Size", + "labelFilename": "Filename", + "downloadFileButton": "Download", + "openFolderButton": "Open Folder", + "retrievingManifestMessage": "Retrieving file information...", "descriptionStreamerMode": "If turned on, this option makes the app more visually private for streaming or presenting with, for example, hiding profile and contact onions", "streamerModeLabel": "Streamer\/Presentation Mode", "archiveConversation": "Archive this Conversation", diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 389e91cf..d36736f1 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -1,6 +1,17 @@ { "@@locale": "en", - "@@last_modified": "2021-09-14T22:34:57+02:00", + "@@last_modified": "2021-09-21T23:09:19+02:00", + "descriptionFileSharing": "The file sharing experiment allows you to send and receive files from Cwtch contacts and groups. Note that sharing a file with a group will result in members of that group connecting with you directly over Cwtch to download it.", + "settingFileSharing": "File Sharing", + "tooltipSendFile": "Send File", + "messageFileOffered": "Contact is offering to send you a file", + "messageFileSent": "You sent a file", + "messageEnableFileSharing": "Enable the file sharing experiment to view this message.", + "labelFilesize": "Size", + "labelFilename": "Filename", + "downloadFileButton": "Download", + "openFolderButton": "Open Folder", + "retrievingManifestMessage": "Retrieving file information...", "descriptionStreamerMode": "If turned on, this option makes the app more visually private for streaming or presenting with, for example, hiding profile and contact onions", "streamerModeLabel": "Streamer\/Presentation Mode", "archiveConversation": "Archive this Conversation", diff --git a/lib/l10n/intl_es.arb b/lib/l10n/intl_es.arb index a3c80388..449a7d18 100644 --- a/lib/l10n/intl_es.arb +++ b/lib/l10n/intl_es.arb @@ -1,6 +1,17 @@ { "@@locale": "es", - "@@last_modified": "2021-09-14T22:34:57+02:00", + "@@last_modified": "2021-09-21T23:09:19+02:00", + "descriptionFileSharing": "The file sharing experiment allows you to send and receive files from Cwtch contacts and groups. Note that sharing a file with a group will result in members of that group connecting with you directly over Cwtch to download it.", + "settingFileSharing": "File Sharing", + "tooltipSendFile": "Send File", + "messageFileOffered": "Contact is offering to send you a file", + "messageFileSent": "You sent a file", + "messageEnableFileSharing": "Enable the file sharing experiment to view this message.", + "labelFilesize": "Size", + "labelFilename": "Filename", + "downloadFileButton": "Download", + "openFolderButton": "Open Folder", + "retrievingManifestMessage": "Retrieving file information...", "descriptionStreamerMode": "If turned on, this option makes the app more visually private for streaming or presenting with, for example, hiding profile and contact onions", "streamerModeLabel": "Streamer\/Presentation Mode", "archiveConversation": "Archive this Conversation", diff --git a/lib/l10n/intl_fr.arb b/lib/l10n/intl_fr.arb index 6bc3fb27..a6a1ea5d 100644 --- a/lib/l10n/intl_fr.arb +++ b/lib/l10n/intl_fr.arb @@ -1,6 +1,17 @@ { "@@locale": "fr", - "@@last_modified": "2021-09-14T22:34:57+02:00", + "@@last_modified": "2021-09-21T23:09:19+02:00", + "descriptionFileSharing": "The file sharing experiment allows you to send and receive files from Cwtch contacts and groups. Note that sharing a file with a group will result in members of that group connecting with you directly over Cwtch to download it.", + "settingFileSharing": "File Sharing", + "tooltipSendFile": "Send File", + "messageFileOffered": "Contact is offering to send you a file", + "messageFileSent": "You sent a file", + "messageEnableFileSharing": "Enable the file sharing experiment to view this message.", + "labelFilesize": "Size", + "labelFilename": "Filename", + "downloadFileButton": "Download", + "openFolderButton": "Open Folder", + "retrievingManifestMessage": "Retrieving file information...", "descriptionStreamerMode": "Si elle est activée, cette option donne un rendu visuel plus privé à l'application pour la diffusion ou la présentation, par exemple en masquant les profils et les contacts.", "streamerModeLabel": "Mode Streamer\/Présentation", "archiveConversation": "Archiver cette conversation", diff --git a/lib/l10n/intl_it.arb b/lib/l10n/intl_it.arb index a7348ca0..51fe624d 100644 --- a/lib/l10n/intl_it.arb +++ b/lib/l10n/intl_it.arb @@ -1,6 +1,17 @@ { "@@locale": "it", - "@@last_modified": "2021-09-14T22:34:57+02:00", + "@@last_modified": "2021-09-21T23:09:19+02:00", + "descriptionFileSharing": "The file sharing experiment allows you to send and receive files from Cwtch contacts and groups. Note that sharing a file with a group will result in members of that group connecting with you directly over Cwtch to download it.", + "settingFileSharing": "File Sharing", + "tooltipSendFile": "Send File", + "messageFileOffered": "Contact is offering to send you a file", + "messageFileSent": "You sent a file", + "messageEnableFileSharing": "Enable the file sharing experiment to view this message.", + "labelFilesize": "Size", + "labelFilename": "Filename", + "downloadFileButton": "Download", + "openFolderButton": "Open Folder", + "retrievingManifestMessage": "Retrieving file information...", "descriptionStreamerMode": "If turned on, this option makes the app more visually private for streaming or presenting with, for example, hiding profile and contact onions", "streamerModeLabel": "Streamer\/Presentation Mode", "archiveConversation": "Archive this Conversation", diff --git a/lib/l10n/intl_pt.arb b/lib/l10n/intl_pt.arb index 6851374b..3c16f8cc 100644 --- a/lib/l10n/intl_pt.arb +++ b/lib/l10n/intl_pt.arb @@ -1,6 +1,17 @@ { "@@locale": "pt", - "@@last_modified": "2021-09-14T22:34:57+02:00", + "@@last_modified": "2021-09-21T23:09:19+02:00", + "descriptionFileSharing": "The file sharing experiment allows you to send and receive files from Cwtch contacts and groups. Note that sharing a file with a group will result in members of that group connecting with you directly over Cwtch to download it.", + "settingFileSharing": "File Sharing", + "tooltipSendFile": "Send File", + "messageFileOffered": "Contact is offering to send you a file", + "messageFileSent": "You sent a file", + "messageEnableFileSharing": "Enable the file sharing experiment to view this message.", + "labelFilesize": "Size", + "labelFilename": "Filename", + "downloadFileButton": "Download", + "openFolderButton": "Open Folder", + "retrievingManifestMessage": "Retrieving file information...", "descriptionStreamerMode": "If turned on, this option makes the app more visually private for streaming or presenting with, for example, hiding profile and contact onions", "streamerModeLabel": "Streamer\/Presentation Mode", "archiveConversation": "Archive this Conversation", From 4f614b69fd7831e491346476c326ecc87704e073 Mon Sep 17 00:00:00 2001 From: erinn Date: Tue, 21 Sep 2021 14:47:31 -0700 Subject: [PATCH 17/17] l10n updates --- lib/l10n/intl_pl.arb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/l10n/intl_pl.arb b/lib/l10n/intl_pl.arb index 13756057..84a5523f 100644 --- a/lib/l10n/intl_pl.arb +++ b/lib/l10n/intl_pl.arb @@ -1,6 +1,17 @@ { "@@locale": "pl", - "@@last_modified": "2021-09-14T22:34:57+02:00", + "@@last_modified": "2021-09-21T23:09:19+02:00", + "descriptionFileSharing": "The file sharing experiment allows you to send and receive files from Cwtch contacts and groups. Note that sharing a file with a group will result in members of that group connecting with you directly over Cwtch to download it.", + "settingFileSharing": "File Sharing", + "tooltipSendFile": "Send File", + "messageFileOffered": "Contact is offering to send you a file", + "messageFileSent": "You sent a file", + "messageEnableFileSharing": "Enable the file sharing experiment to view this message.", + "labelFilesize": "Size", + "labelFilename": "Filename", + "downloadFileButton": "Download", + "openFolderButton": "Open Folder", + "retrievingManifestMessage": "Retrieving file information...", "descriptionStreamerMode": "If turned on, this option makes the app more visually private for streaming or presenting with, for example, hiding profile and contact onions", "streamerModeLabel": "Streamer\/Presentation Mode", "archiveConversation": "Archive this Conversation",