Skip to content

Commit

Permalink
Add: iOS Platform handling
Browse files Browse the repository at this point in the history
  • Loading branch information
happycastle114 committed Nov 4, 2024
1 parent bf49e6e commit 3dd5e2f
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();
}
}

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();
}
}

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();
}
}
}
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();
}
}
} catch (exception) {
print(exception);
Expand Down

0 comments on commit 3dd5e2f

Please sign in to comment.