🐛 Fix and optimize something
This commit is contained in:
parent
92354eee34
commit
a303f5c30c
@ -477,7 +477,7 @@
|
|||||||
DEVELOPMENT_TEAM = W7HPZ53V6B;
|
DEVELOPMENT_TEAM = W7HPZ53V6B;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = SolarAgent;
|
INFOPLIST_KEY_CFBundleDisplayName = Solian;
|
||||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
@ -666,7 +666,7 @@
|
|||||||
DEVELOPMENT_TEAM = W7HPZ53V6B;
|
DEVELOPMENT_TEAM = W7HPZ53V6B;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = SolarAgent;
|
INFOPLIST_KEY_CFBundleDisplayName = Solian;
|
||||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
@ -693,7 +693,7 @@
|
|||||||
DEVELOPMENT_TEAM = W7HPZ53V6B;
|
DEVELOPMENT_TEAM = W7HPZ53V6B;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = SolarAgent;
|
INFOPLIST_KEY_CFBundleDisplayName = Solian;
|
||||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking";
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
|
@ -27,6 +27,7 @@ class AuthGuard {
|
|||||||
static const profileKey = "profiles";
|
static const profileKey = "profiles";
|
||||||
|
|
||||||
oauth2.Client? client;
|
oauth2.Client? client;
|
||||||
|
DateTime? lastRefreshedAt;
|
||||||
|
|
||||||
Future<bool> pickClient() async {
|
Future<bool> pickClient() async {
|
||||||
if (await storage.containsKey(key: storageKey)) {
|
if (await storage.containsKey(key: storageKey)) {
|
||||||
@ -110,7 +111,13 @@ class AuthGuard {
|
|||||||
const storage = FlutterSecureStorage();
|
const storage = FlutterSecureStorage();
|
||||||
if (await storage.containsKey(key: storageKey)) {
|
if (await storage.containsKey(key: storageKey)) {
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
|
if (lastRefreshedAt == null ||
|
||||||
|
lastRefreshedAt!
|
||||||
|
.add(const Duration(minutes: 3))
|
||||||
|
.isAfter(DateTime.now())) {
|
||||||
await refreshToken();
|
await refreshToken();
|
||||||
|
lastRefreshedAt = DateTime.now();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -74,8 +74,18 @@ class _ReactionListState extends State<ReactionList> {
|
|||||||
);
|
);
|
||||||
if (res.statusCode == 201) {
|
if (res.statusCode == 201) {
|
||||||
widget.onReact(symbol, 1);
|
widget.onReact(symbol, 1);
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(
|
||||||
|
content: Text("Your reaction has been added onto this post."),
|
||||||
|
),
|
||||||
|
);
|
||||||
} else if (res.statusCode == 204) {
|
} else if (res.statusCode == 204) {
|
||||||
widget.onReact(symbol, -1);
|
widget.onReact(symbol, -1);
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(
|
||||||
|
content: Text("Your reaction has been removed from this post."),
|
||||||
|
),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
var message = utf8.decode(res.bodyBytes);
|
var message = utf8.decode(res.bodyBytes);
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
@ -105,10 +115,7 @@ class _ReactionListState extends State<ReactionList> {
|
|||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
'Reactions',
|
'Reactions',
|
||||||
style: Theme
|
style: Theme.of(context).textTheme.headlineSmall,
|
||||||
.of(context)
|
|
||||||
.textTheme
|
|
||||||
.headlineSmall,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
@ -150,8 +157,7 @@ class _ReactionListState extends State<ReactionList> {
|
|||||||
padding: const EdgeInsets.symmetric(horizontal: 6.0),
|
padding: const EdgeInsets.symmetric(horizontal: 6.0),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
"${ReactionList.emojis[element.key]!['icon']} x${element
|
"${ReactionList.emojis[element.key]!['icon']} x${element.value.toString()}",
|
||||||
.value.toString()}",
|
|
||||||
),
|
),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
":${element.key}:",
|
":${element.key}:",
|
||||||
|
Reference in New Issue
Block a user