Skip to content

Commit

Permalink
Merge branch 'dev' into fix/quote-reply-appbar
Browse files Browse the repository at this point in the history
  • Loading branch information
ereio committed Sep 11, 2022
2 parents da1454c + 4de04fd commit 00ed15d
Show file tree
Hide file tree
Showing 39 changed files with 963 additions and 846 deletions.
2 changes: 1 addition & 1 deletion .fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"flutterSdkVersion": "3.0.2",
"flutterSdkVersion": "3.0.5",
"flavors": {}
}
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ android/app/.cxx/*
# Ignore generated files
android/.*

# ignore olm import for macos
macos/olm

# ignore flutter pod spec
Flutter.podspec

Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "windows/olm"]
path = windows/olm
url = https://gitlab.matrix.org/matrix-org/olm.git
[submodule "android/olm"]
path = android/olm
url = https://gitlab.matrix.org/matrix-org/olm.git
35 changes: 33 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
{
"editor.tabSize": 2,
"dart.lineLength": 110,
"[dart]": {
"editor.formatOnSave": true
}
"editor.formatOnSave": true,
"editor.rulers": [110],

// // Disables built-in highlighting of words that match your selection. Without
// // this, all instances of the selected text will be highlighted, interfering
// // with Dart's ability to highlight only exact references to the selected variable.
// "editor.selectionHighlight": false,

// // By default, VS Code prevents code completion from popping open when in
// // "snippet mode" (editing placeholders in inserted code). Setting this option
// // to `false` stops that and allows completion to open as normal, as if you
// // weren't in a snippet placeholder.
// "editor.suggest.snippetsPreventQuickSuggestions": false,

// // By default, VS Code will pre-select the most recently used item from code
// // completion. This is usually not the most relevant item.
// //
// // "first" will always select top item
// // "recentlyUsedByPrefix" will filter the recently used items based on the
// // text immediately preceding where completion was invoked.
// "editor.suggestSelection": "first",

// // Allows pressing <TAB> to complete snippets such as `for` even when the
// // completion list is not visible.
// "editor.tabCompletion": "onlySnippets",

// // By default, VS Code will populate code completion with words found in the
// // current file when a language service does not provide its own completions.
// // This results in code completion suggesting words when editing comments and
// // strings. This setting will prevent that.
// "editor.wordBasedSuggestions": false,
}
}
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ linter:
empty_catches: false
avoid_dynamic_calls: false
prefer_constructors_over_static_methods: false
curly_braces_in_flow_control_structures: true
# sort_constructors_first: true
# always_put_required_named_parameters_first: true
# always_specify_types: true
Expand Down
6 changes: 3 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 31
compileSdkVersion 33

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -45,7 +45,7 @@ android {
defaultConfig {
applicationId "org.tether.tether"
minSdkVersion 18
targetSdkVersion 31
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
Expand Down Expand Up @@ -77,7 +77,7 @@ android {
// Encapsulates your CMake build configurations.
cmake {
// Provides a relative path to your CMake build script.
path "../../ios/olm/CMakeLists.txt"
path "../olm/CMakeLists.txt"
version "3.10.2"
}
}
Expand Down
1 change: 1 addition & 0 deletions android/olm
Submodule olm added at 983e78
2 changes: 2 additions & 0 deletions assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"title-dialog-enter-screen-lock-pin": "Enter your current screen lock pin",
"title-dialog-enter-new-screen-lock-pin": "Enter your new screen lock pin",
"title-dialog-verify-new-screen-lock-pin": "Enter your pin again to verify",
"title-dialog-photo-permission": "Permission Required",
"subtitle-proxy-use-proxy": "This will force all traffic leaving Syphon to do so via a proxy",
"subtitle-proxy-use-basic-authentication": "Provide username and password to authenticate with a proxy",
"subtitle-settings-sync-interval": "Amount of time in seconds the app wait\nbetween syncing",
Expand Down Expand Up @@ -266,6 +267,7 @@
"content-dialog-devices-delete": "You will have to sign in again on these devices if you remove them.",
"content-dialog-devices-key-export": "Are you sure you want to export this device's encryption key? It may make it available to others if you're not careful!",
"content-dialog-device-rename": "Enter the new public display name for this device.",
"content-dialog-photo-permission": "Photos Permission is needed to access the gallery. Would you like to continue to the app settings?",
"content-notification-background": "Background connection enabled",
"content-signup-email-requirement": "This homeserver requires an email for registration. Your email will be visible to whoever or whatever is in control of the homeserver. Make sure you trust this homeserver before submitting this information",
"content-signup-email-verification": "This homeserver requires a verified email to complete registration. You'll need to click the link in the email address to continue. Make sure you trust this homeserver before clicking the verification link.",
Expand Down
13 changes: 13 additions & 0 deletions docs/faq-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ In order to cross-sign/verify your Syphon session, with the Element client:
1. Click on your name (if you're in a large room, you may have to search)
1. Click on the untrusted session ![](images/syphon_not_trusted.png)
1. Click "Manually Verify By Text" ![](images/verify.png)
1. Compare the text between the two devices, and **only** accept if they match

n.b. Interactive cross-signing is [roadmapped](https://syphon.org/roadmap) as part of the `0.3.0` release.

Expand All @@ -59,3 +60,15 @@ Like most features in Syphon, notifications are disabled by default.
### ...Send Read Receipts?

Like most features in Syphon, Read Receipts are disabled by default and must be enabled in the Settings.

### ...Decrypt past messages?

- Export your keys from Element:
- Settings > Security & Privacy > Cryptography
- Export E2E room keys (this will generate element-keys.txt)
- Send element-key.txt to your phone
- Import the keys to Syphon:
- Settings > Privacy & Security > Encryption Keys
- Import Keys (select element-keys.txt)

n.b. Key sharing is [roadmapped](https://syphon.org/roadmap) as part of the `0.3.0` release.
6 changes: 3 additions & 3 deletions docs/styleguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Note these are also, as most things in software, largely based on subjective opi
The primary goal of this document is not to impose arbitrary restrictions, but to make writing and maintaining Syphon *simple, accessible, and fun*. We want everyone to be able to meaningfully contribute to the code base no matter your skill level. Let us know what else we can do to continue futher this goal! :)


### Akways define UI elements outside the ViewModel
### Always define UI elements outside the ViewModel

- DO
- `DO`

```dart
Expand Down Expand Up @@ -43,7 +43,7 @@ class IntroSettingsScreen extends StatelessWidget {
}
```

- DON'T
- `DONT`

```dart
Expand Down
12 changes: 11 additions & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down Expand Up @@ -40,5 +40,15 @@ end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
# You can remove unused permissions here
# for more infomation: https://github.com/BaseflowIT/flutter-permission-handler/blob/master/permission_handler/ios/Classes/PermissionHandlerEnums.h
# e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.photos
'PERMISSION_PHOTOS=1',
]
end
end
end
6 changes: 5 additions & 1 deletion lib/cache/middleware.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:syphon/store/auth/context/actions.dart';
import 'package:syphon/store/crypto/actions.dart';
import 'package:syphon/store/crypto/keys/actions.dart';
import 'package:syphon/store/crypto/sessions/actions.dart';
import 'package:syphon/store/events/actions.dart';
import 'package:syphon/store/index.dart';
import 'package:syphon/store/rooms/actions.dart';
import 'package:syphon/store/sync/actions.dart';
Expand All @@ -22,6 +23,8 @@ bool cacheMiddleware(Store<AppState> store, dynamic action) {
case UpdateRoom:
case SetRoom:
case RemoveRoom:
case DeleteMessage:
case DeleteOutboxMessage:
case SetOlmAccountBackup:
case SetDeviceKeysOwned:
case AddKeySession:
Expand All @@ -33,7 +36,8 @@ bool cacheMiddleware(Store<AppState> store, dynamic action) {
log.info('[initStore] persistor saving from ${action.runtimeType}');
return true;
case SetSynced:
return ((action as SetSynced).synced ?? false) && !store.state.syncStore.synced;
return ((action as SetSynced).synced ?? false) &&
!store.state.syncStore.synced;
default:
return false;
}
Expand Down
25 changes: 17 additions & 8 deletions lib/global/libs/matrix/rooms.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:convert';

import 'package:syphon/global/https.dart';
import 'package:syphon/global/print.dart';
import 'package:syphon/global/values.dart';
import 'package:syphon/store/rooms/room/model.dart';
import 'package:syphon/store/settings/proxy-settings/model.dart';
Expand Down Expand Up @@ -132,7 +133,8 @@ abstract class Rooms {
String? accessToken,
String? roomId,
}) async {
final String url = '$protocol$homeserver/_matrix/client/r0/rooms/$roomId/joined_members';
final String url =
'$protocol$homeserver/_matrix/client/r0/rooms/$roomId/joined_members';

final Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
Expand All @@ -152,7 +154,8 @@ abstract class Rooms {
String? accessToken,
String? userId,
}) async {
final String url = '$protocol$homeserver/_matrix/client/r0/user/$userId/account_data/m.direct';
final String url =
'$protocol$homeserver/_matrix/client/r0/user/$userId/account_data/m.direct';

final Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
Expand Down Expand Up @@ -272,7 +275,8 @@ abstract class Rooms {
String? accessToken,
String? roomId,
}) async {
final String url = '$protocol$homeserver/_matrix/client/r0/rooms/$roomId/leave';
final String url =
'$protocol$homeserver/_matrix/client/r0/rooms/$roomId/leave';

final Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
Expand Down Expand Up @@ -308,7 +312,8 @@ abstract class Rooms {
String? accessToken,
String? roomId,
}) async {
final String url = '$protocol$homeserver/_matrix/client/r0/rooms/$roomId/forget';
final String url =
'$protocol$homeserver/_matrix/client/r0/rooms/$roomId/forget';

final Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
Expand Down Expand Up @@ -341,7 +346,8 @@ abstract class Rooms {
String? accessToken,
String? roomAlias,
}) async {
final String url = '$protocol$homeserver/_matrix/client/r0/directory/room/$roomAlias';
final String url =
'$protocol$homeserver/_matrix/client/r0/directory/room/$roomAlias';

final Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
Expand Down Expand Up @@ -372,7 +378,8 @@ abstract class Rooms {
bool lazyLoading = false,
Map? filters,
}) async {
final String url = '$protocol$homeserver/_matrix/client/r0/user/$userId/filter';
final String url =
'$protocol$homeserver/_matrix/client/r0/user/$userId/filter';

final Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
Expand Down Expand Up @@ -411,7 +418,8 @@ abstract class Rooms {
String? filterId,
String? userId,
}) async {
final String url = '$protocol$homeserver/_matrix/client/r0/user/$userId/filter/$filterId';
final String url =
'$protocol$homeserver/_matrix/client/r0/user/$userId/filter/$filterId';

final Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
Expand Down Expand Up @@ -440,7 +448,8 @@ abstract class Rooms {
String? accessToken,
String? roomId,
}) async {
final String url = '$protocol$homeserver/_matrix/client/r0/rooms/$roomId/aliases';
final String url =
'$protocol$homeserver/_matrix/client/r0/rooms/$roomId/aliases';

final Map<String, String> headers = {
'Authorization': 'Bearer $accessToken',
Expand Down
1 change: 1 addition & 0 deletions lib/global/print.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ class log {
static threaded(String content, {String? title}) => _printThreaded(content, title: title);
static release(String content, {String? title}) => _printRelease(content, title: title);
static json(Map? json) => _printJson(json);
static jsonDebug(Map? json) => _printJson(json);
}
4 changes: 4 additions & 0 deletions lib/global/strings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ class Strings {
tr('title-dialog-enter-new-screen-lock-pin');
static final titleDialogVerifyNewScreenLockPin =
tr('title-dialog-verify-new-screen-lock-pin');
static final titleDialogPhotoPermission =
tr('title-dialog-photo-permission');


// Subtitles
static final subtitleUseProxyServer = tr('subtitle-proxy-use-proxy');
Expand Down Expand Up @@ -397,6 +400,7 @@ class Strings {
static final contentRenameDevice = tr('content-dialog-device-rename');
static final contentKeyExportWarning =
tr('content-dialog-devices-key-export');
static final contentPhotoPermission = tr('content-dialog-photo-permission');
static final contentEmailRequirement = tr('content-signup-email-requirement');
static final contentEmailVerification =
tr('content-signup-email-verification');
Expand Down
8 changes: 7 additions & 1 deletion lib/global/values.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ class Values {
// ignore: non_constant_identifier_names
const bool DEBUG_MODE = !kReleaseMode;
const bool SHOW_BORDERS = false;
const bool DEBUG_PAYLOADS_MODE = false;
const bool DEBUG_OLM_MODE = false;

class SupportedLanguages {
static const defaultLang = 'en';
Expand Down Expand Up @@ -98,6 +100,7 @@ class SupportedLanguages {
'ru',
'si',
'sk',
'tok',
'tr',
'uk'
];
Expand Down Expand Up @@ -160,7 +163,9 @@ const isoLangs = {
'da': {'name': 'Danish', 'nativeName': 'dansk'},
'dv': {'name': 'Divehi; Dhivehi; Maldivian;', 'nativeName': 'ދިވެހި'},
'nl': {'name': 'Dutch', 'nativeName': 'Nederlands, Vlaams'},
'en': {'name': 'English', 'nativeName': 'English'},
'en': {'name': 'English (USA)', 'nativeName': 'English (USA)'},
'en-gb': {'name': 'English (England)', 'nativeName': 'English (England)'},
'en-Shaw': {'name': 'English (Shavian)', 'nativeName': '𐑖𐑱𐑝𐑾𐑯'},
'eo': {'name': 'Esperanto', 'nativeName': 'Esperanto'},
'et': {'name': 'Estonian', 'nativeName': 'eesti, eesti keel'},
'ee': {'name': 'Ewe', 'nativeName': 'Eʋegbe'},
Expand Down Expand Up @@ -299,6 +304,7 @@ const isoLangs = {
'tl': {'name': 'Tagalog', 'nativeName': 'Wikang Tagalog, ᜏᜒᜃᜅ᜔ ᜆᜄᜎᜓᜄ᜔'},
'tn': {'name': 'Tswana', 'nativeName': 'Setswana'},
'to': {'name': 'Tonga (Tonga Islands)', 'nativeName': 'faka Tonga'},
'tok': {'name': 'Toki Pona', 'nativeName': 'toki pona'},
'tr': {'name': 'Turkish', 'nativeName': 'Türkçe'},
'ts': {'name': 'Tsonga', 'nativeName': 'Xitsonga'},
'tt': {'name': 'Tatar', 'nativeName': 'татарча, tatarça, تاتارچا‎'},
Expand Down
4 changes: 3 additions & 1 deletion lib/storage/middleware/save-storage-middleware.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,11 @@ saveStorageMiddleware(StorageDatabase? storage) {
saveRooms({room.id: room}, storage: storage);
break;
case DeleteMessage:
case DeleteOutboxMessage:
saveMessages([action.message], storage: storage);
break;
case DeleteOutboxMessage:
deleteMessages([action.message], storage: storage);
break;
case AddMessages:
final _action = action as AddMessages;
saveMessages(_action.messages, storage: storage);
Expand Down
1 change: 0 additions & 1 deletion lib/store/auth/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ Device generateDeviceId({String salt = ''}) {
deviceId: deviceIdHash,
displayName: Values.appDisplayName,
);
log.json({'device': device});

return device;
} catch (error) {
Expand Down
Loading

0 comments on commit 00ed15d

Please sign in to comment.