Skip to content

Commit

Permalink
Fix app + QoL
Browse files Browse the repository at this point in the history
  • Loading branch information
atomic-junky committed Aug 30, 2024
1 parent 56a5e13 commit e1fd9b6
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 25 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def flutterVersionName = localProperties.getProperty('flutter.versionName', '1.0
android {
namespace "fr.catsuka.app"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
ndkVersion "26.1.10909125"

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
5 changes: 3 additions & 2 deletions lib/api/news.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ Future<NewsObject> fetchNews(String link) async {
if (response.statusCode != 200) {
return NewsObject.empty();
}

var document = parse(response.body);

dom.Element content = document.querySelectorAll('div.zoneintro')[0];
dom.Element content = document.querySelectorAll('div.zoneintro').last;
String title = content.querySelector('div.newsinfos_desktop > a > b')!.text;
String subtitle =
content.querySelector('div.newsinfos_desktop > span.txtnoir17')!.text;
Expand All @@ -22,6 +22,7 @@ Future<NewsObject> fetchNews(String link) async {
dom.Element newsContainer =
content.getElementsByClassName("txtnoir14").first;


return NewsObject(
title: title,
subtitle: subtitle,
Expand Down
2 changes: 1 addition & 1 deletion lib/api/short.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Future<BreveObject> fetchBreve(String link) async {

var document = parse(response.body);

dom.Element content = document.querySelectorAll('div.zoneintro')[0];
dom.Element content = document.querySelectorAll('div.zoneintro').last;
String title = content
.querySelector('div.cadremenudroitgrisclair > div > a > b')!
.text;
Expand Down
4 changes: 2 additions & 2 deletions lib/components/news.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
// import 'package:get/get.dart';

import 'package:html_unescape/html_unescape.dart';
import 'package:flutter_svg/flutter_svg.dart';
Expand Down Expand Up @@ -95,7 +95,7 @@ class NewsWidget extends StatelessWidget {
),
TextButton(
onPressed: () {
Get.toNamed('/news', arguments: [link, date]);
// Get.toNamed('/news', arguments: [link, date]);
},
style: const ButtonStyle(
backgroundColor:
Expand Down
1 change: 0 additions & 1 deletion lib/components/post_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class PostTypeTag extends StatelessWidget {
offset: const Offset(-1, 0),
child: SvgPicture.asset(
"assets/images/orange_triangle.svg",
height: 26.0,
),
),
],
Expand Down
4 changes: 2 additions & 2 deletions lib/components/short.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
// import 'package:get/get.dart';

import 'package:html_unescape/html_unescape.dart';
import 'package:flutter_svg/flutter_svg.dart';
Expand Down Expand Up @@ -64,7 +64,7 @@ class ShortWidget extends StatelessWidget {
),
TextButton(
onPressed: () {
Get.toNamed('/breve', arguments: [link, date]);
// Get.toNamed('/breve', arguments: [link, date]);
},
style: const ButtonStyle(
backgroundColor:
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/breve.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:catsuka/api/short.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
// import 'package:flutter_svg/svg.dart';

import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
import 'package:url_launcher/url_launcher.dart';
// import 'package:url_launcher/url_launcher.dart';

import '../components/read_on_website_button.dart';
import '../utils/tools.dart';
Expand Down
31 changes: 21 additions & 10 deletions lib/screens/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:xml2json/xml2json.dart';
import 'dart:convert';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:jiffy/jiffy.dart';
import 'package:get/get.dart';

import '../components/short.dart';
import '../components/news.dart';
Expand Down Expand Up @@ -129,27 +130,37 @@ class _Home extends State<Home> {
await Jiffy.setLocale('fr');
String date = jiffy.format(pattern: 'EEEE, dd MMMM HH[h]mm');
date = date[0].toUpperCase() + date.substring(1);
String link = item['link'];

Widget postWidget;
String linkPage = "news";

if (item["title"].indexOf('(Brève)') == -1) {
news.add(
NewsWidget(
postWidget = NewsWidget(
title: item["title"],
description: item["description"],
imageUrl: str.substring(startIndex + start.length, endIndex).trim(),
date: date,
link: item["link"],
),
);
link: link,
);
} else {
news.add(
ShortWidget(
postWidget = ShortWidget(
title: item["title"].replaceAll('(Brève)', '').trim(),
imageUrl: str.substring(startIndex + start.length, endIndex).trim(),
date: date,
link: item["link"],
),
);
link: link,
);

linkPage = "breve";
}

news.add(
GestureDetector(
onTap: () {
Get.toNamed('/$linkPage', arguments: <String>[link, date]);
},
child: postWidget,)
);
}
news.add(
Center(
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/news.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:catsuka/api/news.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
// import 'package:flutter_svg/svg.dart';

import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';

Expand Down
4 changes: 2 additions & 2 deletions lib/screens/video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ class _Video extends State<Video> {
// Date
await Jiffy.setLocale('en');
final jiffy = Jiffy.parse(
item["pubDate"].substring(5, 16),
pattern: 'dd MMMM yyyy',
item["pubDate"].substring(5, 25),
pattern: 'dd MMM yyyy hh:mm:ss',
);

await Jiffy.setLocale('fr');
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/update_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Future<bool> checkForUpdate() async {
String latestVersion = await fetchLatestVersion();
String currentVersion = packageInfo.version;

return false;

return latestVersion != currentVersion;
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'github' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.2.1
version: 1.2.3

environment:
sdk: '>=3.0.6 <4.0.0'
Expand Down

0 comments on commit e1fd9b6

Please sign in to comment.