Skip to content

Commit

Permalink
Update: main_page.dart
Browse files Browse the repository at this point in the history
  • Loading branch information
happycastle114 committed Nov 4, 2024
1 parent 06a1c9d commit 7b5f676
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions lib/pages/main_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:otlplus/constants/text_styles.dart';
Expand Down Expand Up @@ -49,28 +51,37 @@ class _MainPageState extends State<MainPage> {
final cookies = await cookieManager.getCookies('https://otl.sparcs.org');
for (var cookie in cookies) {
if (cookie.name == 'refreshToken') {
WidgetKit.setItem(
'refreshToken', cookie.value, 'group.org.sparcs.otl');
WidgetKit.reloadAllTimelines();
if (Platform.isIOS) {
WidgetKit.setItem(
'refreshToken', cookie.value, 'group.org.sparcs.otl');
WidgetKit.reloadAllTimelines();

Check warning on line 57 in lib/pages/main_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/main_page.dart#L54-L57

Added lines #L54 - L57 were not covered by tests
}
}

if (cookie.name == 'csrftoken') {
WidgetKit.setItem('csrftoken', cookie.value, 'group.org.sparcs.otl');
WidgetKit.reloadAllTimelines();
if (Platform.isIOS) {
WidgetKit.setItem(
'csrftoken', cookie.value, 'group.org.sparcs.otl');
WidgetKit.reloadAllTimelines();

Check warning on line 65 in lib/pages/main_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/main_page.dart#L62-L65

Added lines #L62 - L65 were not covered by tests
}
}

if (cookie.name == 'accessToken') {
WidgetKit.setItem(
'accessToken', cookie.value, 'group.org.sparcs.otl');
WidgetKit.reloadAllTimelines();
if (Platform.isIOS) {
WidgetKit.setItem(
'accessToken', cookie.value, 'group.org.sparcs.otl');
WidgetKit.reloadAllTimelines();

Check warning on line 73 in lib/pages/main_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/main_page.dart#L70-L73

Added lines #L70 - L73 were not covered by tests
}
}
}
final infoModel = InfoModel();
await infoModel.getInfo();
if (infoModel.hasData) {
WidgetKit.setItem(
'uid', infoModel.user.id.toString(), 'group.org.sparcs.otl');
WidgetKit.reloadAllTimelines();
if (Platform.isIOS) {
WidgetKit.setItem(
'uid', infoModel.user.id.toString(), 'group.org.sparcs.otl');
WidgetKit.reloadAllTimelines();

Check warning on line 83 in lib/pages/main_page.dart

View check run for this annotation

Codecov / codecov/patch

lib/pages/main_page.dart#L80-L83

Added lines #L80 - L83 were not covered by tests
}
}
} catch (exception) {
print(exception);
Expand Down

0 comments on commit 7b5f676

Please sign in to comment.