Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sai Srinivas
Pulse Application
Commits
feeb6477
Commit
feeb6477
authored
Oct 13, 2025
by
Sai Srinivas
Browse files
Notification Redirection
parent
f96fa9c8
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/Screens/home_screen.dart
View file @
feeb6477
...
...
@@ -14,6 +14,8 @@ import 'package:pulse/utils/customSnackBar.dart';
import
'package:flutter_svg/svg.dart'
;
import
'package:flutter_inappwebview/flutter_inappwebview.dart'
;
import
'../utils/SharedpreferencesService.dart'
;
class
HomeScreen
extends
StatefulWidget
{
final
String
sessionId
;
final
String
staffId
;
...
...
@@ -42,6 +44,7 @@ class _HomeScreenState extends State<HomeScreen> {
bool
_isLoading
=
false
;
bool
_isRefreshing
=
false
;
PullToRefreshController
?
_pullToRefreshController
;
final
_prefs
=
SharedPreferencesService
.
instance
;
// Responsive sizing variables
late
double
_screenHeight
;
...
...
@@ -58,6 +61,8 @@ class _HomeScreenState extends State<HomeScreen> {
HapticFeedback
.
lightImpact
();
_initConnectivity
();
_initializePullToRefresh
();
final
sessionId
=
_prefs
.
getString
(
"sessionId"
);
final
staffId
=
_prefs
.
getString
(
"staffId"
);
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
final
provider
=
Provider
.
of
<
ProfileProvider
>(
context
,
listen:
false
);
...
...
@@ -75,6 +80,7 @@ class _HomeScreenState extends State<HomeScreen> {
);
}
});
}
void
_initializePullToRefresh
()
{
...
...
lib/main.dart
View file @
feeb6477
...
...
@@ -12,7 +12,7 @@ import 'package:pulse/Notifier/theme_provider.dart';
import
'package:pulse/Notifier/ProfileProvider.dart'
;
import
'package:pulse/Notifier/webProvider.dart'
;
import
'package:flutter_inappwebview/flutter_inappwebview.dart'
;
import
'package:pulse/utils/SharedpreferencesService.dart'
;
import
'Screens/home_screen.dart'
;
// Needed to navigate outside BuildContext
...
...
@@ -112,7 +112,8 @@ Future<void> main() async {
// notification while app is in background
FirebaseMessaging
.
onMessageOpenedApp
.
listen
((
RemoteMessage
message
)
{
print
(
" Notification clicked:
${message.data}
"
);
print
(
"🔥🔥🔥🔥🔥 Notification clicked:
${message.data}
"
);
NotificationHandler
.
handle
(
message
.
data
);
});
InAppWebViewController
.
setWebContentsDebuggingEnabled
(
true
);
...
...
@@ -137,6 +138,7 @@ class MyApp extends StatelessWidget {
return
MaterialApp
(
debugShowCheckedModeBanner:
false
,
title:
'Web Grid Pulse'
,
navigatorKey:
navigatorKey
,
theme:
themeProvider
.
isDark
?
ThemeData
.
dark
()
:
ThemeData
.
light
().
copyWith
(
...
...
@@ -152,21 +154,26 @@ class MyApp extends StatelessWidget {
class
NotificationHandler
{
static
void
handle
(
Map
<
String
,
dynamic
>
data
)
{
static
Future
<
void
>
handle
(
Map
<
String
,
dynamic
>
data
)
async
{
final
type
=
data
[
'type'
];
final
value
=
data
[
'type_value'
];
final
notifId
=
data
[
'notification_id'
];
final
prefs
=
SharedPreferencesService
.
instance
;
final
sessionId
=
await
prefs
.
getString
(
"sessionId"
);
final
staffId
=
await
prefs
.
getString
(
"staffId"
);
debugPrint
(
"✅ Direct session restore
$sessionId
"
);
debugPrint
(
"✅ Direct staff restore
$staffId
"
);
debugPrint
(
"🔗 Handling Notification:"
);
debugPrint
(
"type=
$type
, value=
$value
, id=
$notifId
"
);
// Decide what to do based on the type
if
(
type
==
'
web
'
&&
value
!=
null
)
{
if
(
type
==
'
url
'
&&
value
!=
null
)
{
navigatorKey
.
currentState
?.
push
(
MaterialPageRoute
(
builder:
(
_
)
=>
HomeScreen
(
sessionId:
''
,
staffId:
''
,
sessionId:
sessionId
.
toString
()
,
staffId:
staffId
.
toString
()
,
notificationUrl:
value
,
),
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment