Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Commit

Permalink
fix(trackers): myanimelist not being updated when anilist is not logg…
Browse files Browse the repository at this point in the history
…ed in
  • Loading branch information
zyrouge committed Oct 19, 2021
1 parent 6f3f19d commit 93ddcb2
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 42 deletions.
83 changes: 43 additions & 40 deletions lib/components/trackers/auth_page.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:async';
import 'package:flutter/material.dart';
import '../../../../plugins/helpers/assets.dart';
import '../../../../plugins/helpers/logger.dart';
import '../../../../plugins/helpers/stateful_holder.dart';
import '../../../../plugins/helpers/ui.dart';
Expand All @@ -9,12 +8,14 @@ import '../../../../plugins/translator/translator.dart';
class AuthPage extends StatefulWidget {
const AuthPage({
required final this.title,
required final this.logo,
required final this.authenticate,
required final this.logger,
final Key? key,
}) : super(key: key);

final String title;
final String logo;
final Future<void> Function() authenticate;
final Logger logger;

Expand Down Expand Up @@ -79,51 +80,53 @@ class _AuthPageState extends State<AuthPage> with DidLoadStater {
appBar: AppBar(
title: Text(widget.title),
),
body: Padding(
padding: EdgeInsets.symmetric(
vertical: remToPx(1),
horizontal: remToPx(1.25),
),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
DecoratedBox(
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.9),
shape: BoxShape.circle,
body: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.symmetric(
vertical: remToPx(1),
horizontal: remToPx(1.25),
),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
DecoratedBox(
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.9),
shape: BoxShape.circle,
),
child: Padding(
padding: EdgeInsets.all(remToPx(1)),
child: Image.asset(
widget.logo,
width: MediaQuery.of(context).size.width >
ResponsiveSizes.md
? remToPx(7)
: remToPx(5),
),
),
),
child: Padding(
padding: EdgeInsets.all(remToPx(1)),
child: Image.asset(
Assets.anilistLogo,
width:
MediaQuery.of(context).size.width > ResponsiveSizes.md
? remToPx(7)
: remToPx(5),
SizedBox(
height: remToPx(2),
),
if (!status.hasEnded) ...<Widget>[
const CircularProgressIndicator(),
SizedBox(
height: remToPx(1),
),
],
RichText(
text: TextSpan(
children: status.value,
style: Theme.of(context).textTheme.subtitle1,
),
textAlign: TextAlign.center,
),
),
SizedBox(
height: remToPx(2),
),
if (!status.hasEnded) ...<Widget>[
const CircularProgressIndicator(),
SizedBox(
height: remToPx(1),
height: remToPx(2),
),
],
RichText(
text: TextSpan(
children: status.value,
style: Theme.of(context).textTheme.subtitle1,
),
textAlign: TextAlign.center,
),
SizedBox(
height: remToPx(2),
),
],
),
),
),
),
Expand Down
6 changes: 4 additions & 2 deletions lib/pages/anime_page/watch_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,15 @@ class WatchPageState extends State<WatchPage>
AppState.settings.current.animeTrackerWatchPercent) {
final int? episode = int.tryParse(widget.episode.episode);

if (episode != null && !hasSynced) {
// TODO: Uncomment this
if (episode != null /* && !hasSynced */) {
hasSynced = true;

final AnimeProgress progress = AnimeProgress(episodes: episode);

for (final TrackerProvider<AnimeProgress> provider in animeProviders) {
if (provider.isEnabled(widget.title, widget.extractor.id)) {
if (provider.isLoggedIn() &&
provider.isEnabled(widget.title, widget.extractor.id)) {
final ResolvedTrackerItem? item =
await provider.getComputed(widget.title, widget.extractor.id);

Expand Down

0 comments on commit 93ddcb2

Please sign in to comment.