01-02-1403 / Rhmn / release test 3.
This commit is contained in:
parent
c6e07bbb2e
commit
6520dc89c5
|
|
@ -10,7 +10,6 @@ import com.squareup.picasso.MemoryPolicy
|
||||||
import com.squareup.picasso.NetworkPolicy
|
import com.squareup.picasso.NetworkPolicy
|
||||||
import com.squareup.picasso.Picasso
|
import com.squareup.picasso.Picasso
|
||||||
import com.squareup.picasso.Transformation
|
import com.squareup.picasso.Transformation
|
||||||
import es.antonborri.home_widget.HomeWidgetBackgroundIntent
|
|
||||||
import es.antonborri.home_widget.HomeWidgetLaunchIntent
|
import es.antonborri.home_widget.HomeWidgetLaunchIntent
|
||||||
import es.antonborri.home_widget.HomeWidgetProvider
|
import es.antonborri.home_widget.HomeWidgetProvider
|
||||||
import java.lang.Exception
|
import java.lang.Exception
|
||||||
|
|
@ -108,29 +107,36 @@ class FavWidget : HomeWidgetProvider() {
|
||||||
|
|
||||||
|
|
||||||
// Pending intent to update counter on button click
|
// Pending intent to update counter on button click
|
||||||
val settingIntent = HomeWidgetBackgroundIntent.getBroadcast(
|
val settingIntent = HomeWidgetLaunchIntent.getActivity(
|
||||||
context,
|
context,
|
||||||
|
MainActivity::class.java,
|
||||||
Uri.parse("myAppWidget://setting"),
|
Uri.parse("myAppWidget://setting"),
|
||||||
|
|
||||||
)
|
)
|
||||||
setOnClickPendingIntent(R.id.setting_btn, settingIntent)
|
setOnClickPendingIntent(R.id.setting_btn, settingIntent)
|
||||||
|
|
||||||
val rowFirst = HomeWidgetBackgroundIntent.getBroadcast(
|
val rowFirst = HomeWidgetLaunchIntent.getActivity(
|
||||||
context,
|
context,
|
||||||
|
MainActivity::class.java,
|
||||||
|
|
||||||
Uri.parse("myAppWidget://rowFirst"),
|
Uri.parse("myAppWidget://rowFirst"),
|
||||||
|
|
||||||
)
|
)
|
||||||
setOnClickPendingIntent(R.id.first_row, rowFirst)
|
setOnClickPendingIntent(R.id.first_row, rowFirst)
|
||||||
|
|
||||||
val rowMiddle = HomeWidgetBackgroundIntent.getBroadcast(
|
val rowMiddle = HomeWidgetLaunchIntent.getActivity(
|
||||||
context,
|
context,
|
||||||
|
MainActivity::class.java,
|
||||||
|
|
||||||
Uri.parse("myAppWidget://rowMiddle"),
|
Uri.parse("myAppWidget://rowMiddle"),
|
||||||
|
|
||||||
)
|
)
|
||||||
setOnClickPendingIntent(R.id.middle_row, rowMiddle)
|
setOnClickPendingIntent(R.id.middle_row, rowMiddle)
|
||||||
|
|
||||||
val rowLast = HomeWidgetBackgroundIntent.getBroadcast(
|
val rowLast = HomeWidgetLaunchIntent.getActivity(
|
||||||
context,
|
context,
|
||||||
|
MainActivity::class.java,
|
||||||
|
|
||||||
Uri.parse("myAppWidget://rowLast"),
|
Uri.parse("myAppWidget://rowLast"),
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -49,16 +49,22 @@ Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
AwsomeNotificationHandler().alarm();
|
// AwsomeNotificationHandler().alarm();
|
||||||
AwsomeNotificationHandler().show(message);
|
AwsomeNotificationHandler().show(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
try {
|
try {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
FirebaseNotificationHandler().initial();
|
|
||||||
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
|
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
|
||||||
|
FirebaseMessaging.onMessage.listen(
|
||||||
|
(RemoteMessage message) => AwsomeNotificationHandler().show(message));
|
||||||
|
|
||||||
|
//ignore: deprecated_member_use
|
||||||
|
HomeWidget.registerBackgroundCallback(backgroundCallback);
|
||||||
HomeWidget.registerInteractivityCallback(backgroundCallback);
|
HomeWidget.registerInteractivityCallback(backgroundCallback);
|
||||||
|
AwsomeNotificationHandler().alarm();
|
||||||
|
FirebaseNotificationHandler().initial();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrintStack();
|
debugPrintStack();
|
||||||
}
|
}
|
||||||
|
|
@ -74,6 +80,7 @@ Future<void> backgroundCallback(Uri? uri) async {
|
||||||
);
|
);
|
||||||
await intent.launch();
|
await intent.launch();
|
||||||
HomeWidget.saveWidgetData("uri", uri!.host);
|
HomeWidget.saveWidgetData("uri", uri!.host);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Didvan extends StatefulWidget {
|
class Didvan extends StatefulWidget {
|
||||||
|
|
@ -102,10 +109,14 @@ class _DidvanState extends State<Didvan> with WidgetsBindingObserver {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeAppLifecycleState(AppLifecycleState state) async {
|
void didChangeAppLifecycleState(AppLifecycleState state) async {
|
||||||
|
HomeWidget.widgetClicked.listen((event) {
|
||||||
|
print("${event!.host}--------------------------------------------------------------");
|
||||||
|
});
|
||||||
if (state == AppLifecycleState.paused) {
|
if (state == AppLifecycleState.paused) {
|
||||||
b = false;
|
b = false;
|
||||||
}
|
}
|
||||||
if (state == AppLifecycleState.resumed) {
|
if (state == AppLifecycleState.resumed) {
|
||||||
|
|
||||||
await HomeWidget.getWidgetData<String>('uri', defaultValue: "")
|
await HomeWidget.getWidgetData<String>('uri', defaultValue: "")
|
||||||
.then((value) async {
|
.then((value) async {
|
||||||
if (value!.isNotEmpty) {
|
if (value!.isNotEmpty) {
|
||||||
|
|
@ -186,11 +197,18 @@ class _DidvanState extends State<Didvan> with WidgetsBindingObserver {
|
||||||
'id': data.id,
|
'id': data.id,
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
|
case "podcast":
|
||||||
|
route = Routes.podcasts;
|
||||||
|
args = {
|
||||||
|
'type': 'podcast',
|
||||||
|
'id': data.id,
|
||||||
|
};
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (data.link!.startsWith('http')) {
|
if (data.link!.startsWith('http')) {
|
||||||
launchUrlString(
|
launchUrlString(
|
||||||
'${data.link}?accessToken=${RequestService.token}',
|
'${data.link}',
|
||||||
mode: LaunchMode.inAppWebView,
|
mode: LaunchMode.inAppWebView,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import '../network/request_helper.dart';
|
||||||
|
|
||||||
class HomeWidgetRepository {
|
class HomeWidgetRepository {
|
||||||
Future<void> fetchWidget() async {
|
Future<void> fetchWidget() async {
|
||||||
if (RequestService.token != null && RequestService.token.isNotEmpty) {
|
|
||||||
final service = RequestService(
|
final service = RequestService(
|
||||||
RequestHelper.widgetNews(),
|
RequestHelper.widgetNews(),
|
||||||
);
|
);
|
||||||
|
|
@ -17,15 +16,14 @@ class HomeWidgetRepository {
|
||||||
final favourites = service.data('content');
|
final favourites = service.data('content');
|
||||||
HomeWidget.saveWidgetData("token", RequestService.token.toString());
|
HomeWidget.saveWidgetData("token", RequestService.token.toString());
|
||||||
for (var i = 0; i < favourites.length; i++) {
|
for (var i = 0; i < favourites.length; i++) {
|
||||||
HomeWidget.saveWidgetData("id${i + 1}",
|
HomeWidget.saveWidgetData(
|
||||||
WidgetResponse.fromJson(favourites[i]).id.toString());
|
"id${i + 1}", WidgetResponse.fromJson(favourites[i]).id.toString());
|
||||||
HomeWidget.saveWidgetData("title${i + 1}",
|
HomeWidget.saveWidgetData("title${i + 1}",
|
||||||
WidgetResponse.fromJson(favourites[i]).title.toString());
|
WidgetResponse.fromJson(favourites[i]).title.toString());
|
||||||
HomeWidget.saveWidgetData(
|
HomeWidget.saveWidgetData(
|
||||||
"createdAt${i + 1}",
|
"createdAt${i + 1}",
|
||||||
DateTime.parse(WidgetResponse.fromJson(favourites[i])
|
DateTime.parse(
|
||||||
.createdAt
|
WidgetResponse.fromJson(favourites[i]).createdAt.toString())
|
||||||
.toString())
|
|
||||||
.toPersianDateStr());
|
.toPersianDateStr());
|
||||||
HomeWidget.saveWidgetData("type${i + 1}",
|
HomeWidget.saveWidgetData("type${i + 1}",
|
||||||
WidgetResponse.fromJson(favourites[i]).type.toString());
|
WidgetResponse.fromJson(favourites[i]).type.toString());
|
||||||
|
|
@ -42,5 +40,4 @@ class HomeWidgetRepository {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
import 'package:didvan/services/storage/storage.dart';
|
import 'package:didvan/services/storage/storage.dart';
|
||||||
|
import 'package:home_widget/home_widget.dart';
|
||||||
|
|
||||||
// ignore: depend_on_referenced_packages
|
// ignore: depend_on_referenced_packages
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import 'package:awesome_notifications/awesome_notifications.dart';
|
import 'package:awesome_notifications/awesome_notifications.dart';
|
||||||
import 'package:didvan/main.dart';
|
import 'package:didvan/main.dart';
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
|
@ -95,13 +94,13 @@ class NotificationController {
|
||||||
} else {
|
} else {
|
||||||
if (data.link!.startsWith('http')) {
|
if (data.link!.startsWith('http')) {
|
||||||
launchUrlString(
|
launchUrlString(
|
||||||
'${data.link}?accessToken=${RequestService.token}',
|
'${data.link}',
|
||||||
mode: LaunchMode.inAppWebView,
|
mode: LaunchMode.inAppWebView,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (route.isNotEmpty) {
|
if (route.isNotEmpty) {
|
||||||
navigatorKey.currentState!.pushNamedIfNotCurrent(route, arguments: args);
|
navigatorKey.currentState!.pushNamed(route, arguments: args);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MyApp.navigatorKey.currentState?.pushNamedAndRemoveUntil('/notification-page',
|
// MyApp.navigatorKey.currentState?.pushNamedAndRemoveUntil('/notification-page',
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import 'package:awesome_notifications/awesome_notifications.dart';
|
import 'package:awesome_notifications/awesome_notifications.dart';
|
||||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:home_widget/home_widget.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
import '../../../models/notification_message.dart';
|
import '../../../models/notification_message.dart';
|
||||||
|
|
@ -37,7 +38,7 @@ class AwsomeNotificationHandler {
|
||||||
// channelGroupKey: 'basic_channel_group',
|
// channelGroupKey: 'basic_channel_group',
|
||||||
// channelGroupName: 'Basic group')
|
// channelGroupName: 'Basic group')
|
||||||
// ],
|
// ],
|
||||||
debug: false);
|
debug: true);
|
||||||
|
|
||||||
initialAction = await AwesomeNotifications()
|
initialAction = await AwesomeNotifications()
|
||||||
.getInitialNotificationAction(removeFromActionEvents: false);
|
.getInitialNotificationAction(removeFromActionEvents: false);
|
||||||
|
|
@ -96,8 +97,8 @@ class AwsomeNotificationHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
showNotificationTypeNews(NotificationMessage message) async {
|
showNotificationTypeNews(NotificationMessage message) async {
|
||||||
DateTime time = await _getTime();
|
DateTime? time = await _getTime();
|
||||||
|
if (time == null) {
|
||||||
AwesomeNotifications().createNotification(
|
AwesomeNotifications().createNotification(
|
||||||
content: NotificationContent(
|
content: NotificationContent(
|
||||||
id: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
id: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||||
|
|
@ -109,17 +110,45 @@ class AwsomeNotificationHandler {
|
||||||
largeIcon: message.image.toString(),
|
largeIcon: message.image.toString(),
|
||||||
payload: message.toPayload(),
|
payload: message.toPayload(),
|
||||||
color: const Color(0xFF007EA7)),
|
color: const Color(0xFF007EA7)),
|
||||||
schedule: time.year != null
|
);
|
||||||
? null
|
} else {
|
||||||
: NotificationCalendar(
|
AwesomeNotifications().createNotification(
|
||||||
|
content: NotificationContent(
|
||||||
|
id: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||||
|
channelKey: 'alerts',
|
||||||
|
actionType: ActionType.Default,
|
||||||
|
title: "\u200f ${message.title} \u200f",
|
||||||
|
// body: message.body.toString(),
|
||||||
|
notificationLayout: NotificationLayout.Default,
|
||||||
|
largeIcon: message.image.toString(),
|
||||||
|
payload: message.toPayload(),
|
||||||
|
color: const Color(0xFF007EA7)),
|
||||||
|
schedule: NotificationCalendar(
|
||||||
hour: time.hour,
|
hour: time.hour,
|
||||||
minute: time.minute,
|
minute: time.minute,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
showNotificationTypeMessage(NotificationMessage message) async {
|
showNotificationTypeMessage(NotificationMessage message) async {
|
||||||
DateTime time = await _getTime();
|
DateTime? time = await _getTime();
|
||||||
|
|
||||||
|
if (time == null) {
|
||||||
|
AwesomeNotifications().createNotification(
|
||||||
|
content: NotificationContent(
|
||||||
|
id: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||||
|
channelKey: 'alerts',
|
||||||
|
actionType: ActionType.Default,
|
||||||
|
body:
|
||||||
|
"<b>${message.title.toString()}</b> ${message.body.toString()}",
|
||||||
|
largeIcon: message.photo.toString(),
|
||||||
|
roundedLargeIcon: true,
|
||||||
|
bigPicture: message.image.toString(),
|
||||||
|
payload: message.toPayload(),
|
||||||
|
notificationLayout: NotificationLayout.BigPicture,
|
||||||
|
color: const Color(0xFF007EA7)),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
AwesomeNotifications().createNotification(
|
AwesomeNotifications().createNotification(
|
||||||
content: NotificationContent(
|
content: NotificationContent(
|
||||||
id: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
id: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||||
|
|
@ -138,7 +167,9 @@ class AwsomeNotificationHandler {
|
||||||
: NotificationCalendar(
|
: NotificationCalendar(
|
||||||
hour: time.hour,
|
hour: time.hour,
|
||||||
minute: time.minute,
|
minute: time.minute,
|
||||||
)
|
));
|
||||||
|
}
|
||||||
|
|
||||||
// actionButtons: [
|
// actionButtons: [
|
||||||
// NotificationActionButton(
|
// NotificationActionButton(
|
||||||
// key: 'REPLY',
|
// key: 'REPLY',
|
||||||
|
|
@ -151,7 +182,6 @@ class AwsomeNotificationHandler {
|
||||||
// actionType: ActionType.DismissAction,
|
// actionType: ActionType.DismissAction,
|
||||||
// isDangerousOption: true)
|
// isDangerousOption: true)
|
||||||
// ]
|
// ]
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
showNotificationTypeEmoji(NotificationMessage message) async {
|
showNotificationTypeEmoji(NotificationMessage message) async {
|
||||||
|
|
@ -174,10 +204,16 @@ class AwsomeNotificationHandler {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<DateTime> _getTime() async {
|
Future<DateTime?> _getTime() async {
|
||||||
final service = RequestService(
|
await HomeWidget.getWidgetData<String>('token', defaultValue: "")
|
||||||
RequestHelper.notificationTime(),
|
.then((value) async {
|
||||||
);
|
final service = RequestService(RequestHelper.notificationTime(),
|
||||||
|
useAutherization: false,
|
||||||
|
requestHeaders: {
|
||||||
|
"accept": "*/*",
|
||||||
|
"Content-Type": "application/json; charset=UTF-8",
|
||||||
|
'Authorization': 'Bearer $value'
|
||||||
|
});
|
||||||
await service.httpGet();
|
await service.httpGet();
|
||||||
if (service.isSuccess) {
|
if (service.isSuccess) {
|
||||||
final time = service.data('time');
|
final time = service.data('time');
|
||||||
|
|
@ -190,13 +226,34 @@ class AwsomeNotificationHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
} else {
|
|
||||||
return DateTime.now();
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
showNotificationScheduled(NotificationMessage message) async {
|
showNotificationScheduled(NotificationMessage message) async {
|
||||||
DateTime time = await _getTime();
|
DateTime? time = await _getTime();
|
||||||
|
if (time == null) {
|
||||||
|
AwesomeNotifications().createNotification(
|
||||||
|
content: NotificationContent(
|
||||||
|
id: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||||
|
channelKey: 'alerts',
|
||||||
|
title: 'Emojis are awes'
|
||||||
|
'ome too! ${Emojis.animals_lady_beetle}${Emojis.activites_balloon}${Emojis.emotion_red_heart}',
|
||||||
|
body:
|
||||||
|
'Simple body with a bunch of Emojis! ${Emojis.transport_police_car} ${Emojis.animals_dog} ${Emojis.flag_UnitedStates} ${Emojis.person_baby}',
|
||||||
|
largeIcon:
|
||||||
|
'https://cdn.britannica.com/72/232772-050-4E3D86CC/mind-blown-emoji-head-exploding-emoticon.jpg',
|
||||||
|
notificationLayout: NotificationLayout.BigPicture,
|
||||||
|
wakeUpScreen: true,
|
||||||
|
category: NotificationCategory.Alarm,
|
||||||
|
payload: {
|
||||||
|
'title': 'Notification Title',
|
||||||
|
'body': 'Notification Body',
|
||||||
|
'image': 'path/to/smallImage.png', // Path to small image
|
||||||
|
'largeImage': 'path/to/largeImage.png', // Path to large image
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
AwesomeNotifications().createNotification(
|
AwesomeNotifications().createNotification(
|
||||||
content: NotificationContent(
|
content: NotificationContent(
|
||||||
id: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
id: DateTime.now().millisecondsSinceEpoch ~/ 1000,
|
||||||
|
|
@ -222,4 +279,5 @@ class AwsomeNotificationHandler {
|
||||||
// timezone: await AwesomeNotifications().getLocalTimeZoneIdentifier()
|
// timezone: await AwesomeNotifications().getLocalTimeZoneIdentifier()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,47 +59,6 @@ class FirebaseNotificationHandler {
|
||||||
// _firebaseMessagingBackgroundHandler);
|
// _firebaseMessagingBackgroundHandler);
|
||||||
|
|
||||||
// Listening for incoming messages while the app is in the foreground
|
// Listening for incoming messages while the app is in the foreground
|
||||||
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
|
||||||
/* if (message.notification!.title != null &&
|
|
||||||
message.notification!.body != null) {
|
|
||||||
final notificationData = message.data;
|
|
||||||
final screen = notificationData['screen'];
|
|
||||||
|
|
||||||
// Showing an alert dialog when a notification is received (Foreground state)
|
|
||||||
// showDialog(
|
|
||||||
// context: context,
|
|
||||||
// barrierDismissible: false,
|
|
||||||
// builder: (BuildContext context) {
|
|
||||||
// return WillPopScope(
|
|
||||||
// onWillPop: () async => false,
|
|
||||||
// child: AlertDialog(
|
|
||||||
// title: Text(message.notification!.title!),
|
|
||||||
// content: Text(message.notification!.body!),
|
|
||||||
// actions: [
|
|
||||||
// if (notificationData.containsKey('screen'))
|
|
||||||
// TextButton(
|
|
||||||
// onPressed: () {
|
|
||||||
// Navigator.pop(context);
|
|
||||||
// Navigator.of(context).pushNamed(screen);
|
|
||||||
// },
|
|
||||||
// child: const Text('Open Screen'),
|
|
||||||
// ),
|
|
||||||
// TextButton(
|
|
||||||
// onPressed: () => Navigator.of(context).pop(),
|
|
||||||
// child: const Text('Dismiss'),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
}*/
|
|
||||||
// LocalNotificationService.initialize();
|
|
||||||
// LocalNotificationService.showBigPictureNotification();
|
|
||||||
// LocalNotificationService.display(message);
|
|
||||||
AwsomeNotificationHandler().alarm();
|
|
||||||
AwsomeNotificationHandler().show(message);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Handling the initial message received when the app is launched from dead (killed state)
|
// Handling the initial message received when the app is launched from dead (killed state)
|
||||||
// When the app is killed and a new notification arrives when user clicks on it
|
// When the app is killed and a new notification arrives when user clicks on it
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import 'package:didvan/providers/user.dart';
|
||||||
import 'package:didvan/services/network/request.dart';
|
import 'package:didvan/services/network/request.dart';
|
||||||
import 'package:didvan/services/network/request_helper.dart';
|
import 'package:didvan/services/network/request_helper.dart';
|
||||||
import 'package:didvan/utils/action_sheet.dart';
|
import 'package:didvan/utils/action_sheet.dart';
|
||||||
|
import 'package:home_widget/home_widget.dart';
|
||||||
|
|
||||||
class AuthenticationState extends CoreProvier {
|
class AuthenticationState extends CoreProvier {
|
||||||
int _currentPageIndex = 0;
|
int _currentPageIndex = 0;
|
||||||
|
|
@ -50,6 +51,7 @@ class AuthenticationState extends CoreProvier {
|
||||||
appState = AppState.idle;
|
appState = AppState.idle;
|
||||||
await userProvider.setAndGetToken(newToken: token);
|
await userProvider.setAndGetToken(newToken: token);
|
||||||
RequestService.token = token;
|
RequestService.token = token;
|
||||||
|
HomeWidget.saveWidgetData("token", token.toString());
|
||||||
await userProvider.getUserInfo();
|
await userProvider.getUserInfo();
|
||||||
return token;
|
return token;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue