Skip to content

Commit

Permalink
Merge pull request #251 from syphon-org/0.1.8+1/bugfix-batch
Browse files Browse the repository at this point in the history
[bugfix] Bugfix Batch 0.1.8+1
  • Loading branch information
ereio authored Jun 1, 2021
2 parents c23a030 + abbd840 commit 6bc8fa4
Show file tree
Hide file tree
Showing 127 changed files with 3,572 additions and 2,595 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
- [ ] Encrypted Chat
- [ ] Group Chats
- [ ] Profile Changes
- [ ] Themeing Changes
- [ ] Theming Changes
- [ ] Force Kill and Restart

### Final Checklist
Expand Down
7 changes: 7 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ analyzer:
linter:
rules:
# Disabled
file_names: false
type_annotate_public_apis: false
avoid_classes_with_only_static_members: false
always_declare_return_types: false # can be explicit in declaration
constant_identifier_names: false
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

# Enabled
prefer_single_quotes: true
Expand All @@ -25,3 +29,6 @@ linter:
# TODO:
prefer_const_constructors: false
lines_longer_than_80_chars: false
avoid_redundant_argument_values: false
prefer_typing_uninitialized_variables: false
empty_catches: false
18 changes: 0 additions & 18 deletions ios/Flutter/Flutter.podspec

This file was deleted.

14 changes: 9 additions & 5 deletions lib/global/algos.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,27 @@ List<int> fibonacci(int n) {
}

void printJson(Map? jsonMap) {
JsonEncoder encoder = new JsonEncoder.withIndent(' ');
String prettyEvent = encoder.convert(jsonMap);
final JsonEncoder encoder = JsonEncoder.withIndent(' ');
final String prettyEvent = encoder.convert(jsonMap);
debugPrint(prettyEvent, wrapWidth: 2048);
}

// time functions by wrapping them here - needs testing
Future<void> timeWrapper(
Future timeWrapper(
Future<dynamic> Function() function, {
String name = 'Anonymous',
}) async {
Stopwatch stopwatch = new Stopwatch()..start();
final Stopwatch stopwatch = Stopwatch()..start();

dynamic result = await function();
final dynamic result = await function();

final stoptime = stopwatch.elapsed;

printDebug('[$name TIMER] ${function.runtimeType} $stoptime');

return result;
}

String enumToString(dynamic enumItem) {
return enumItem.toString().split('.')[1];
}
8 changes: 3 additions & 5 deletions lib/global/colours.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// Flutter imports:
import 'package:flutter/material.dart';

/**
* British localization because
* google monopolized the namespaces
*/
/// British localization because
/// google monopolized the namespaces
class Colours {
static const cyanSyphon = 0xff34C7B5;
static const cyanSyphonAlpha = 0xAA34C7B5;
Expand Down Expand Up @@ -32,7 +30,7 @@ class Colours {

static Color hashedColor(String? string) {
final hashable = string ?? '123';
int hash = hashable.codeUnits.reduce((value, element) => value + element);
final int hash = hashable.codeUnits.reduce((value, element) => value + element);
return Colours.chatColors[hash % Colours.chatColors.length];
}

Expand Down
10 changes: 5 additions & 5 deletions lib/global/formatters.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ String formatLanguageCode(String? language) {

// @again_guy:matrix.org -> ER
String formatSenderInitials(String sender) {
var formattedSender = formatSender(sender).toUpperCase();
final formattedSender = formatSender(sender).toUpperCase();
return formattedSender.length < 2
? formattedSender
: formattedSender.substring(0, 2);
}

String formatTimestampFull({
int? lastUpdateMillis,
int lastUpdateMillis = 0,
bool showTime = false,
String? timeFormat,
}) {
if (lastUpdateMillis == null || lastUpdateMillis == 0) return '';
if (lastUpdateMillis == 0) return '';

final timestamp = DateTime.fromMillisecondsSinceEpoch(lastUpdateMillis);
final hourFormat = timeFormat == '24hr' ? 'H:mm' : 'h:mm';
Expand All @@ -46,13 +46,13 @@ String formatTimestampFull({

// 1237597223894 -> 30m, now, etc
String formatTimestamp({
int? lastUpdateMillis = 0,
int lastUpdateMillis = 0,
bool showTime = false,
String timeFormat = '24hr',
}) {
if (lastUpdateMillis == 0) return '';

final timestamp = DateTime.fromMillisecondsSinceEpoch(lastUpdateMillis!);
final timestamp = DateTime.fromMillisecondsSinceEpoch(lastUpdateMillis);
final sinceLastUpdate = DateTime.now().difference(timestamp);
final hourFormat = timeFormat == '24hr' ? 'H:mm' : 'h:mm';

Expand Down
24 changes: 10 additions & 14 deletions lib/global/libs/jack/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,21 @@ 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
*
*/
/// 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
*/
/// Fetch Public Homeservers (hello matrix)
///
/// Returns an array of homeseerver objects
static Future<dynamic> fetchPublicServers() async {
String url = endpoints.elementAt(0);
final String url = endpoints.elementAt(0);

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

Expand Down
Loading

0 comments on commit 6bc8fa4

Please sign in to comment.