Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AccountAssociationsScreen extends ConsumerStatefulWidget {
ConsumerState<AccountAssociationsScreen> createState() => _AccountAssociationsScreenState();
}

class _AccountAssociationsScreenState extends ConsumerState<AccountAssociationsScreen> {
class _AccountAssociationsScreenState extends ConsumerState<AccountAssociationsScreen> with WidgetsBindingObserver {
final TaskmasterService _taskmasterService = TaskmasterService();

final _ethAddress = TextEditingController();
Expand Down Expand Up @@ -92,7 +92,7 @@ class _AccountAssociationsScreenState extends ConsumerState<AccountAssociationsS
final oauthRequest = await _taskmasterService.generateAssociateXLink();
final Uri url = Uri.parse(oauthRequest.url);

launchUrl(url, mode: LaunchMode.externalApplication);
launchUrl(url, mode: LaunchMode.inAppBrowserView);
} catch (e) {
print('Failed associating X account: $e');

Expand All @@ -111,6 +111,33 @@ class _AccountAssociationsScreenState extends ConsumerState<AccountAssociationsS
ref.invalidate(accountAssociationsProvider);
}

@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
}

@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}

@override
void didChangeAppLifecycleState(AppLifecycleState state) {
switch (state) {
case AppLifecycleState.paused:
case AppLifecycleState.inactive:
case AppLifecycleState.hidden:
case AppLifecycleState.detached:
break;

case AppLifecycleState.resumed:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats nice haha

ref.invalidate(accountAssociationsProvider);
break;
}
}

@override
Widget build(BuildContext context) {
final associationsAsync = ref.watch(accountAssociationsProvider);
Expand Down