1.2.4 is ready

This commit is contained in:
dan63047 2023-10-10 23:20:27 +03:00
parent 51e8362859
commit 6e1473c6fb
16 changed files with 45 additions and 32 deletions

View File

@ -25,7 +25,7 @@ void main() async {
databaseFactory = databaseFactoryFfi; databaseFactory = databaseFactoryFfi;
} }
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
if (!Platform.isAndroid && !Platform.isIOS){ if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS){
await WindowManager.instance.ensureInitialized(); await WindowManager.instance.ensureInitialized();
windowManager.waitUntilReadyToShow().then((_) async { windowManager.waitUntilReadyToShow().then((_) async {
await windowManager.setTitle('Tetra Stats'); await windowManager.setTitle('Tetra Stats');

View File

@ -57,7 +57,7 @@ class TetrioService extends DB {
final Map<String, List<News>> _newsCache = {}; final Map<String, List<News>> _newsCache = {};
final Map<String, Map<String, double?>> _topTRcache = {}; final Map<String, Map<String, double?>> _topTRcache = {};
final Map<String, TetraLeagueAlphaStream> _tlStreamsCache = {}; // i'm trying to respect oskware api It should look something like {"cached_until": TetrioPlayer} final Map<String, TetraLeagueAlphaStream> _tlStreamsCache = {}; // i'm trying to respect oskware api It should look something like {"cached_until": TetrioPlayer}
final client = UserAgentClient("package info thingy: ${packageInfo.version} (Tetra Stats v1.2.4 dev build)", http.Client()); final client = UserAgentClient("Tetra Stats v${packageInfo.version} (dm @dan63047 if someone abuse that software)", http.Client());
static final TetrioService _shared = TetrioService._sharedInstance(); static final TetrioService _shared = TetrioService._sharedInstance();
factory TetrioService() => _shared; factory TetrioService() => _shared;
late final StreamController<Map<String, List<TetrioPlayer>>> _tetrioStreamController; late final StreamController<Map<String, List<TetrioPlayer>>> _tetrioStreamController;

View File

@ -1,5 +1,6 @@
import 'dart:io'; import 'dart:io';
import 'package:fl_chart/fl_chart.dart'; import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:tetra_stats/data_objects/tetrio.dart'; import 'package:tetra_stats/data_objects/tetrio.dart';
@ -31,7 +32,7 @@ class CalcState extends State<CalcView> {
@override @override
void initState() { void initState() {
_scrollController = ScrollController(); _scrollController = ScrollController();
if (!Platform.isAndroid && !Platform.isIOS){ if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS){
windowManager.getTitle().then((value) => oldWindowTitle = value); windowManager.getTitle().then((value) => oldWindowTitle = value);
windowManager.setTitle("Tetra Stats: ${t.statsCalc}"); windowManager.setTitle("Tetra Stats: ${t.statsCalc}");
} }
@ -40,7 +41,7 @@ class CalcState extends State<CalcView> {
@override @override
void dispose() { void dispose() {
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle); if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
super.dispose(); super.dispose();
} }

View File

@ -44,7 +44,7 @@ class CompareState extends State<CompareView> {
fetchGreenSide(widget.greenSide[0].userId); fetchGreenSide(widget.greenSide[0].userId);
if (widget.redSide[0] != null) fetchRedSide(widget.redSide[0].userId); if (widget.redSide[0] != null) fetchRedSide(widget.redSide[0].userId);
_scrollController = ScrollController(); _scrollController = ScrollController();
if (!Platform.isAndroid && !Platform.isIOS){ if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS){
windowManager.getTitle().then((value) => oldWindowTitle = value); windowManager.getTitle().then((value) => oldWindowTitle = value);
} }
super.initState(); super.initState();
@ -56,7 +56,7 @@ class CompareState extends State<CompareView> {
greenSideMode = Mode.player; greenSideMode = Mode.player;
theRedSide = [null, null, null]; theRedSide = [null, null, null];
redSideMode = Mode.player; redSideMode = Mode.player;
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle); if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
super.dispose(); super.dispose();
} }

View File

@ -135,7 +135,7 @@ class _MainState extends State<MainView> with SingleTickerProviderStateMixin {
} }
_searchFor = me.userId; _searchFor = me.userId;
setState((){_titleNickname = me.username;}); setState((){_titleNickname = me.username;});
if (!Platform.isAndroid && !Platform.isIOS) await windowManager.setTitle(widget.title); if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS) await windowManager.setTitle(widget.title);
late List<dynamic> requests; late List<dynamic> requests;
late TetraLeagueAlphaStream tlStream; late TetraLeagueAlphaStream tlStream;
late Map<String, dynamic> records; late Map<String, dynamic> records;

View File

@ -1,4 +1,5 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:tetra_stats/services/tetrio_crud.dart'; import 'package:tetra_stats/services/tetrio_crud.dart';
@ -23,7 +24,7 @@ class MatchesState extends State<MatchesView> {
@override @override
void initState() { void initState() {
if (!Platform.isAndroid && !Platform.isIOS){ if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS){
windowManager.getTitle().then((value) => oldWindowTitle = value); windowManager.getTitle().then((value) => oldWindowTitle = value);
windowManager.setTitle("Tetra Stats: ${t.matchesViewTitle(nickname: widget.username)}"); windowManager.setTitle("Tetra Stats: ${t.matchesViewTitle(nickname: widget.username)}");
} }
@ -32,7 +33,7 @@ class MatchesState extends State<MatchesView> {
@override @override
void dispose(){ void dispose(){
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle); if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
super.dispose(); super.dispose();
} }

View File

@ -1,5 +1,6 @@
import 'dart:io'; import 'dart:io';
import 'package:fl_chart/fl_chart.dart'; import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:tetra_stats/data_objects/tetrio.dart'; import 'package:tetra_stats/data_objects/tetrio.dart';
@ -33,7 +34,7 @@ class RankState extends State<RankView> with SingleTickerProviderStateMixin {
void initState() { void initState() {
_scrollController = ScrollController(); _scrollController = ScrollController();
_tabController = TabController(length: 6, vsync: this); _tabController = TabController(length: 6, vsync: this);
if (!Platform.isAndroid && !Platform.isIOS){ if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS){
windowManager.getTitle().then((value) => oldWindowTitle = value); windowManager.getTitle().then((value) => oldWindowTitle = value);
windowManager.setTitle("Tetra Stats: ${widget.rank[1]["everyone"] ? t.everyoneAverages : t.rankAverages(rank: widget.rank[0].rank.toUpperCase())}"); windowManager.setTitle("Tetra Stats: ${widget.rank[1]["everyone"] ? t.everyoneAverages : t.rankAverages(rank: widget.rank[0].rank.toUpperCase())}");
} }
@ -44,7 +45,7 @@ class RankState extends State<RankView> with SingleTickerProviderStateMixin {
void dispose() { void dispose() {
_tabController.dispose(); _tabController.dispose();
_scrollController.dispose(); _scrollController.dispose();
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle); if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
super.dispose(); super.dispose();
} }

View File

@ -1,4 +1,5 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:tetra_stats/gen/strings.g.dart'; import 'package:tetra_stats/gen/strings.g.dart';
@ -24,7 +25,7 @@ class RanksAverages extends State<RankAveragesView> {
averages = value.averages; averages = value.averages;
setState(() {}); setState(() {});
}); });
if (!Platform.isAndroid && !Platform.isIOS){ if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS){
windowManager.getTitle().then((value) => oldWindowTitle = value); windowManager.getTitle().then((value) => oldWindowTitle = value);
windowManager.setTitle("Tetra Stats: ${t.rankAveragesViewTitle}"); windowManager.setTitle("Tetra Stats: ${t.rankAveragesViewTitle}");
} }
@ -33,7 +34,7 @@ class RanksAverages extends State<RankAveragesView> {
@override @override
void dispose() { void dispose() {
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle); if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
super.dispose(); super.dispose();
} }

View File

@ -29,7 +29,7 @@ class SettingsState extends State<SettingsView> {
@override @override
void initState() { void initState() {
if (!Platform.isAndroid && !Platform.isIOS){ if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS){
windowManager.getTitle().then((value) => oldWindowTitle = value); windowManager.getTitle().then((value) => oldWindowTitle = value);
windowManager.setTitle("Tetra Stats: ${t.settings}"); windowManager.setTitle("Tetra Stats: ${t.settings}");
} }
@ -39,7 +39,7 @@ class SettingsState extends State<SettingsView> {
@override @override
void dispose(){ void dispose(){
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle); if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
super.dispose(); super.dispose();
} }

View File

@ -1,4 +1,5 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:tetra_stats/data_objects/tetrio.dart'; import 'package:tetra_stats/data_objects/tetrio.dart';
@ -25,7 +26,7 @@ class StateState extends State<StateView> {
@override @override
void initState() { void initState() {
_scrollController = ScrollController(); _scrollController = ScrollController();
if (!Platform.isAndroid && !Platform.isIOS){ if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS){
windowManager.getTitle().then((value) => oldWindowTitle = value); windowManager.getTitle().then((value) => oldWindowTitle = value);
windowManager.setTitle("Tetra Stats: ${t.stateViewTitle(nickname: widget.state.username.toUpperCase(), date: dateFormat.format(widget.state.state))}"); windowManager.setTitle("Tetra Stats: ${t.stateViewTitle(nickname: widget.state.username.toUpperCase(), date: dateFormat.format(widget.state.state))}");
} }
@ -35,7 +36,7 @@ class StateState extends State<StateView> {
@override @override
void dispose() { void dispose() {
_scrollController.dispose(); _scrollController.dispose();
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle); if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
super.dispose(); super.dispose();
} }

View File

@ -1,4 +1,5 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:tetra_stats/data_objects/tetrio.dart'; import 'package:tetra_stats/data_objects/tetrio.dart';
@ -20,7 +21,7 @@ late String oldWindowTitle;
class StatesState extends State<StatesView> { class StatesState extends State<StatesView> {
@override @override
void initState() { void initState() {
if (!Platform.isAndroid && !Platform.isIOS){ if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS){
windowManager.getTitle().then((value) => oldWindowTitle = value); windowManager.getTitle().then((value) => oldWindowTitle = value);
windowManager.setTitle("Tetra Stats: ${t.statesViewTitle(number: widget.states.length, nickname: widget.states.last.username.toUpperCase())}"); windowManager.setTitle("Tetra Stats: ${t.statesViewTitle(number: widget.states.length, nickname: widget.states.last.username.toUpperCase())}");
} }
@ -29,7 +30,7 @@ class StatesState extends State<StatesView> {
@override @override
void dispose() { void dispose() {
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle); if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
super.dispose(); super.dispose();
} }

View File

@ -1,4 +1,5 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:tetra_stats/data_objects/tetrio.dart'; import 'package:tetra_stats/data_objects/tetrio.dart';
@ -27,16 +28,13 @@ class TLLeaderboardView extends StatefulWidget {
class TLLeaderboardState extends State<TLLeaderboardView> { class TLLeaderboardState extends State<TLLeaderboardView> {
@override @override
void initState() { void initState() {
if (!Platform.isAndroid && !Platform.isIOS){ if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS) windowManager.getTitle().then((value) => oldWindowTitle = value);
windowManager.getTitle().then((value) => oldWindowTitle = value);
windowManager.setTitle("Tetra Stats: ${t.tlLeaderboard}");
}
super.initState(); super.initState();
} }
@override @override
void dispose() { void dispose() {
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle); if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
super.dispose(); super.dispose();
} }
@ -75,6 +73,7 @@ class TLLeaderboardState extends State<TLLeaderboardView> {
return const Center(child: Text('Fetching...')); return const Center(child: Text('Fetching...'));
case ConnectionState.done: case ConnectionState.done:
final allPlayers = snapshot.data?.getStatRanking(snapshot.data!.leaderboard, sortBy, reversed: reversed, country: country); final allPlayers = snapshot.data?.getStatRanking(snapshot.data!.leaderboard, sortBy, reversed: reversed, country: country);
if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS) windowManager.setTitle("Tetra Stats: ${t.tlLeaderboard} - ${t.players(n: allPlayers!.length)}");
return NestedScrollView( return NestedScrollView(
headerSliverBuilder: (context, value) { headerSliverBuilder: (context, value) {
String howManyPlayers(int numberOfPlayers) => Intl.plural( String howManyPlayers(int numberOfPlayers) => Intl.plural(

View File

@ -1,5 +1,6 @@
import 'dart:io'; import 'dart:io';
import 'package:fl_chart/fl_chart.dart'; import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:tetra_stats/data_objects/tetrio.dart'; import 'package:tetra_stats/data_objects/tetrio.dart';
@ -30,7 +31,7 @@ class TlMatchResultState extends State<TlMatchResultView> {
_scrollController = ScrollController(); _scrollController = ScrollController();
rounds = [DropdownMenuItem(value: -1, child: Text(t.match))]; rounds = [DropdownMenuItem(value: -1, child: Text(t.match))];
rounds.addAll([for (int i = 0; i < widget.record.endContext.first.secondaryTracking.length; i++) DropdownMenuItem(value: i, child: Text(t.roundNumber(n: i+1)))]); rounds.addAll([for (int i = 0; i < widget.record.endContext.first.secondaryTracking.length; i++) DropdownMenuItem(value: i, child: Text(t.roundNumber(n: i+1)))]);
if (!Platform.isAndroid && !Platform.isIOS){ if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS){
windowManager.getTitle().then((value) => oldWindowTitle = value); windowManager.getTitle().then((value) => oldWindowTitle = value);
windowManager.setTitle("Tetra Stats: ${widget.record.endContext.firstWhere((element) => element.userId == widget.initPlayerId).username.toUpperCase()} ${t.vs} ${widget.record.endContext.firstWhere((element) => element.userId != widget.initPlayerId).username.toUpperCase()} ${t.inTLmatch} ${dateFormat.format(widget.record.timestamp)}"); windowManager.setTitle("Tetra Stats: ${widget.record.endContext.firstWhere((element) => element.userId == widget.initPlayerId).username.toUpperCase()} ${t.vs} ${widget.record.endContext.firstWhere((element) => element.userId != widget.initPlayerId).username.toUpperCase()} ${t.inTLmatch} ${dateFormat.format(widget.record.timestamp)}");
} }
@ -40,7 +41,7 @@ class TlMatchResultState extends State<TlMatchResultView> {
@override @override
void dispose(){ void dispose(){
roundSelector = -1; roundSelector = -1;
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle); if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
super.dispose(); super.dispose();
} }

View File

@ -1,4 +1,5 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:tetra_stats/data_objects/tetrio.dart'; import 'package:tetra_stats/data_objects/tetrio.dart';
@ -20,7 +21,7 @@ class TrackedPlayersView extends StatefulWidget {
class TrackedPlayersState extends State<TrackedPlayersView> { class TrackedPlayersState extends State<TrackedPlayersView> {
@override @override
void initState() { void initState() {
if (!Platform.isAndroid && !Platform.isIOS){ if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS){
windowManager.getTitle().then((value) => oldWindowTitle = value); windowManager.getTitle().then((value) => oldWindowTitle = value);
windowManager.setTitle("Tetra Stats: ${t.trackedPlayersViewTitle}"); windowManager.setTitle("Tetra Stats: ${t.trackedPlayersViewTitle}");
} }
@ -29,7 +30,7 @@ class TrackedPlayersState extends State<TrackedPlayersView> {
@override @override
void dispose() { void dispose() {
if (!Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle); if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS) windowManager.setTitle(oldWindowTitle);
super.dispose(); super.dispose();
} }

View File

@ -55,10 +55,16 @@ class TLThingy extends StatelessWidget {
Colors.green Colors.green
), ),
), ),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text( Text(
"${t.top} ${f2.format(tl.percentile * 100)}% (${tl.percentileRank.toUpperCase()})${tl.bestRank != "z" ? "${t.topRank}: ${tl.bestRank.toUpperCase()}" : ""}${topTR != null ? " (${f2.format(topTR)} TR)" : ""} Glicko: ${f2.format(tl.glicko!)}±${f2.format(tl.rd!)}${tl.decaying ? '${t.decaying}' : ''}", "${t.top} ${f2.format(tl.percentile * 100)}% (${tl.percentileRank.toUpperCase()})${tl.bestRank != "z" ? "${t.topRank}: ${tl.bestRank.toUpperCase()}" : ""}${topTR != null ? " (${f2.format(topTR)} TR)" : ""} Glicko: ${f2.format(tl.glicko!)}±${f2.format(tl.rd!)}",
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
if (tl.decaying) Icon(Icons.trending_up, color: tl.rd! > 98 ? Colors.red : Colors.yellow,)
],
),
], ],
), ),
], ],

View File

@ -2,7 +2,7 @@ name: tetra_stats
description: Track your and other player stats in TETR.IO description: Track your and other player stats in TETR.IO
publish_to: 'none' publish_to: 'none'
version: 1.2.3+11 version: 1.2.4+12
environment: environment:
sdk: '>=2.19.6 <3.0.0' sdk: '>=2.19.6 <3.0.0'