Skip to content

Commit

Permalink
Merge pull request #265 from syphon-org/bugfix/various-issues-1
Browse files Browse the repository at this point in the history
[fixes] Various Issues Batch
  • Loading branch information
ereio authored Jun 26, 2021
2 parents 0aaf740 + 06ba040 commit 60cd728
Show file tree
Hide file tree
Showing 186 changed files with 2,269 additions and 2,625 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": "2.0.6",
"flutterSdkVersion": "2.2.2",
"flavors": {}
}
23 changes: 12 additions & 11 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
## Changes
### Types
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Refactoring (fix or feature that would cause existing functionality to not work as expected)
- [ ] Breaking change (non-breaking change which improves code quality - QA thoroughly)

### 🔮 Features
### 🔒 Security
### 🛠 Performance
### 🐛 Fixes
### 📐 Refactoring
### Changes

### Media (if applicable)
#### 🔮 Features
#### 🔒 Security
#### 🛠 Performance
#### 🐛 Fixes
#### 📐 Refactoring

### Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
### Media (if applicable)

### QA

Expand Down
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ linter:
avoid_escaping_inner_quotes: false
prefer_for_elements_to_map_fromIterable: false # that syntax is challenging, will change if becomes standard
prefer_conditional_assignment: false
sized_box_for_whitespace: false

# Enabled
prefer_single_quotes: true
Expand Down
8 changes: 5 additions & 3 deletions assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"title-view-invite": "Invite",
"title-view-preferences-chat": "Chats",
"title-view-privacy": "Privacy",
"title-view-homeserver-search": "Find Your Homeserve",
"title-view-homeserver-search": "Find Your Homeserver",
"title-view-profile": "Set up Your Profile",
"title-dialog-delete-keys": "Confirm Deleting Keys",
"title-dialog-encryption": "Encrypt Chat?",
Expand All @@ -25,6 +25,7 @@
"title-dialog-terms-alpha": "Confirm Open Alpha Terms Of Service",
"title-dialog-email-requirement": "Email requirement",
"title-dialog-email-requirement-verified": "Email verification",
"title-confirm-password": "Confirm Password",
"label-search-homeservers": "Search for homeservers...",
"label-search-users": "Search for users...",
"label-search-users-results": "Matched Users",
Expand Down Expand Up @@ -58,11 +59,12 @@
"list-item-settings-sms": "SMS and MMS",
"list-item-settings-logout": "Logout",
"alert-restart-app-effect": "You'll need to close and restart the app for this to take affect",
"alert-invite-user-unknown": "This user doens't appear to exist within matrix, but you can attempt to invite them anyway.\n\nMake sure you have the correct name before trying.",
"alert-invite-user-unknown": "This user doesn't appear to exist within matrix, but you can attempt to invite them anyway.\n\nMake sure you have the correct name before trying.",
"alert-feature-in-progress": "🛠 This feature is coming soon",
"alert-message-failed": "Message Failed To Send",
"alert-homeserver-invalid": "This server failed the 'well-known' check, make sure the server is configured correctly",
"prompt-homeserver-select": "Select you username homeserver",
"prompt-homeserver-select": "Select your username and homeserver",
"prompt-confirm-deactivate": "Enter your password below to confirm deactivation",
"content-intro-section-one": "{} works by using an encrypted \nand decentralized protocol \ncalled ",
"content-intro-section-two": "Matrix enables you to message others",
"content-intro-section-two-part-two": "\nprivately and control ",
Expand Down
6 changes: 4 additions & 2 deletions assets/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"title-dialog-terms-alpha": "Подтвердить Условия пользования Открытой Альфы",
"title-dialog-email-requirement": "Email требуется",
"title-dialog-email-requirement-verified": "Email верификация",
"title-confirm-password": "подтвердите пароль",
"label-search-homeservers": "Поиск домашних серверов...",
"label-search-users": "Поиск пользователей...",
"label-search-users-results": "Найденные Пользователи",
Expand All @@ -50,11 +51,12 @@
"button-text-new-user": "Не имеешь юзернейм?",
"button-text-login": "Войти",
"button-text-signup": "Create One",
"alert-invite-user-unknown": "This user doens't appear to exist within matrix, but you can attempt to invite them anyway.\n\nMake sure you have the correct name before trying.",
"alert-invite-user-unknown": "This user doesn't appear to exist within matrix, but you can attempt to invite them anyway.\n\nMake sure you have the correct name before trying.",
"alert-feature-in-progress": "🛠 Эта функция будет скоро",
"alert-message-failed": "Message Failed To Send",
"alert-homeserver-invalid": "This server failed the 'well-known' check, make sure the server is configured correctly",
"prompt-homeserver-select": "Select you username homeserver",
"prompt-homeserver-select": "Select your username and homeserver",
"prompt-confirm-deactivate": "Enter your password below to confirm deactivation",
"content-intro-section-one": "{} works by using an encrypted \nand decentralized protocol \ncalled ",
"content-intro-section-two": "Matrix enables you to message others",
"content-intro-section-two-part-two": "\nprivately and control ",
Expand Down
2 changes: 1 addition & 1 deletion lib/cache/codec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'dart:typed_data';
import 'package:encrypt/encrypt.dart';

const IV_LENGTH = 16;
const IV_LENGTH_BASE_64 = (IV_LENGTH + (IV_LENGTH / 2));
const IV_LENGTH_BASE_64 = IV_LENGTH + (IV_LENGTH / 2);

/// Random bytes generator
Uint8List _generateIV(int length) {
Expand Down
29 changes: 29 additions & 0 deletions lib/cache/middleware.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import 'package:redux/redux.dart';
import 'package:syphon/global/print.dart';
import 'package:syphon/store/auth/actions.dart';
import 'package:syphon/store/crypto/actions.dart';
import 'package:syphon/store/index.dart';
import 'package:syphon/store/rooms/actions.dart';

///
/// Cache Middleware
///
/// Saves store data to cold storage based
/// on which redux actions are fired.
///
bool cacheMiddleware(Store<AppState> store, dynamic action) {
switch (action.runtimeType) {
case SetRoom:
case RemoveRoom:
case SetOlmAccount:
case SetOlmAccountBackup:
case SetDeviceKeysOwned:
case SetUser:
case ResetCrypto:
case ResetUser:
printInfo('[initStore] persistor saving from ${action.runtimeType}');
return true;
default:
return false;
}
}
4 changes: 0 additions & 4 deletions lib/cache/serializer.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
// Dart imports:
import 'dart:convert';
import 'dart:typed_data';

// Flutter imports:
import 'package:flutter/foundation.dart';

// Package imports:
import 'package:redux_persist/redux_persist.dart';
import 'package:sembast/sembast.dart';
import 'package:syphon/cache/index.dart';
import 'package:syphon/cache/threadables.dart';
import 'package:syphon/global/print.dart';

// Project imports:
import 'package:syphon/store/crypto/state.dart';
import 'package:syphon/store/events/ephemeral/m.read/model.dart';
import 'package:syphon/store/events/messages/model.dart';
Expand Down
2 changes: 0 additions & 2 deletions lib/cache/threadables.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import 'dart:convert';
import 'dart:async';

import 'package:encrypt/encrypt.dart';
import 'package:syphon/cache/codec.dart';
import 'package:syphon/global/print.dart';

Future<String> encryptJsonBackground(Map params) async {
String json = params['json'];
Expand Down
4 changes: 0 additions & 4 deletions lib/global/algos.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Dart imports:
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:syphon/global/print.dart';

List<int> fibonacci(int n) {
Expand Down
12 changes: 7 additions & 5 deletions lib/global/colours.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flutter imports:
import 'package:flutter/material.dart';

/// British localization because
Expand All @@ -11,12 +10,15 @@ class Colours {

static const greyEnabled = 0xffFAFAFA;
static const greyDisabled = 0xffD8D8D8;
static const greyDark = 0xff4D5767;
static const greyBubble = 0xffEEEEEE;

static const blackDefault = 0xff121212;
static const greyDefault = 0xFF9E9E9E; // Colors.grey[500]
static const greyLight = 0xFFE0E0E0; // Colors.grey[300]
static const greyLightest = 0xFFEEEEEE; // Colors.grey[200]
static const greyDark = 0xFF616161; // Colors.grey[700]
static const greyDarkest = 0xFF303030; // Colors.grey[850]

static const blackFull = 0xff000000;
static const greyDefault = 0xFF9E9E9E;
static const blackDefault = 0xff121212;
static const whiteDefault = 0xffFEFEFE;

// Material colors at shades of 700
Expand Down
1 change: 0 additions & 1 deletion lib/global/dimensions.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Flutter imports:
import 'package:flutter/material.dart';

class Dimensions {
Expand Down
42 changes: 35 additions & 7 deletions lib/global/formatters.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Package imports:
import 'package:intl/intl.dart';

// @again_guy:matrix.org -> again_ereio
Expand All @@ -21,12 +20,41 @@ String formatLanguageCode(String? language) {
}
}

// @again_guy:matrix.org -> ER
String formatSenderInitials(String sender) {
final formattedSender = formatSender(sender).toUpperCase();
return formattedSender.length < 2
? formattedSender
: formattedSender.substring(0, 2);
// @again_guy:matrix.org -> AG
// a -> A
String formatInitials(String? word) {
final wordUppercase = (word ?? '').toUpperCase();
return wordUppercase.length > 1 ? wordUppercase.substring(0, 2) : wordUppercase;
}

String formatInitialsLong(String? fullword) {
// -> ?
if (fullword == null || fullword.isEmpty) {
return '?';
}

final word = fullword.replaceAll('@', '');

if (word.isEmpty) {
return '?';
}

// example words -> EW
if (word.length > 2 && word.contains(' ') && word.split(' ')[1].isNotEmpty) {
final words = word.split(' ');
final wordOne = words.elementAt(0);
final wordTwo = words.elementAt(1);

var initials = '';
initials = wordOne.isEmpty ? initials : initials + wordOne.substring(0, 1);
initials = wordTwo.isEmpty ? initials : initials + wordTwo.substring(0, 1);

return initials.toUpperCase();
}

final initials = word.length > 1 ? word.substring(0, 2) : word.substring(0, 1);

return initials.toUpperCase();
}

String formatTimestampFull({
Expand Down
1 change: 0 additions & 1 deletion lib/global/libs/https.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Package imports:
import 'package:http/http.dart' as http;

var httpClient;
Expand Down
9 changes: 5 additions & 4 deletions lib/global/libs/jack/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ import 'dart:convert';
import 'package:http/http.dart' as http;

/// Jack API
///
///
/// Eventually will be a library of non-authenticated
/// functions that will search or scrape for matrix
/// servers for Syphon
///
///
class JackApi {
static const List<String> endpoints = [
'https://www.hello-matrix.net/public_servers.php?format=json&only_public=true&show_from=United+States+(Denver)',
];

/// Fetch Public Homeservers (hello matrix)
///
///
/// Returns an array of homeseerver objects
static Future<dynamic> fetchPublicServers() async {
static Future<List<dynamic>> fetchPublicServers() async {
final String url = endpoints.elementAt(0);

final response = await http.get(Uri.parse(url));
Expand Down
Loading

0 comments on commit 60cd728

Please sign in to comment.