|
|
@@ -9,11 +9,13 @@ import 'package:telnow_mobile_new/src/utils/C.dart';
|
|
|
import 'package:telnow_mobile_new/src/utils/U.dart';
|
|
|
import 'package:telnow_mobile_new/src/utils/cache_manager.dart';
|
|
|
import 'package:telnow_mobile_new/src/utils/provider.dart';
|
|
|
+import 'package:telnow_mobile_new/src/utils/ui_service.dart';
|
|
|
|
|
|
class HomeFunction{
|
|
|
final SharedPreferencesManager sharedPreferencesManager = locator<SharedPreferencesManager>();
|
|
|
final ApiAuthProvider apiAuthProvider = ApiAuthProvider();
|
|
|
final JwtToken token = JwtToken();
|
|
|
+ final BuildContext context = UIService.context!;
|
|
|
|
|
|
getProfileData(BuildContext context)async{
|
|
|
if (!Provider.of<ServiceModule>(context, listen: false).initialized()) {
|
|
|
@@ -25,7 +27,7 @@ class HomeFunction{
|
|
|
}catch(e){}
|
|
|
|
|
|
try{
|
|
|
- var res = await token.getUserData(context);
|
|
|
+ var res = await token.getUserData();
|
|
|
if(res != null){
|
|
|
Provider.of<UserModule>(context, listen: false).setList(res);
|
|
|
Provider.of<UserModule>(context, listen: false).setProfile(res['_profile']['data']);
|
|
|
@@ -79,7 +81,7 @@ class HomeFunction{
|
|
|
}
|
|
|
}
|
|
|
if(profile['specialOffer'] != null && profile['specialOffer']['show'] == true) getSpecialOffer(context);
|
|
|
- if(profile['frequentlyRequested'] != null && profile['frequentlyRequested']['show'] == true) getFrequentlyRequested(context);
|
|
|
+ if(profile['frequentlyRequested'] != null && profile['frequentlyRequested']['show'] == true) getFrequentlyRequested();
|
|
|
if(profile['banner'] != null && profile['banner']['show'] == true) getBanner(context);
|
|
|
if(profile['quickAction'] != null && profile['quickAction']['show'] == true) getQuickAction(context);
|
|
|
getUnreadMessages(context);
|
|
|
@@ -197,7 +199,7 @@ class HomeFunction{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- getFrequentlyRequested(BuildContext context) async {
|
|
|
+ getFrequentlyRequested() async {
|
|
|
try {
|
|
|
var url = '/api/requestHistories/search/frequently/request/' + Provider.of<ServiceModule>(context, listen: false).scoopeValue();
|
|
|
|
|
|
@@ -216,7 +218,7 @@ class HomeFunction{
|
|
|
}
|
|
|
}
|
|
|
} catch (e) {
|
|
|
- print(e.toString());
|
|
|
+ debugPrint(e.toString());
|
|
|
Provider.of<ServiceModule>(context, listen: false).setData([]);
|
|
|
}
|
|
|
}
|
|
|
@@ -331,7 +333,7 @@ class HomeFunction{
|
|
|
}
|
|
|
}
|
|
|
if(profile['specialOffer'] != null && profile['specialOffer']['show'] == true) getSpecialOffer(context);
|
|
|
- if(profile['frequentlyRequested'] != null && profile['frequentlyRequested']['show'] == true) getFrequentlyRequested(context);
|
|
|
+ if(profile['frequentlyRequested'] != null && profile['frequentlyRequested']['show'] == true) getFrequentlyRequested();
|
|
|
if(profile['banner'] != null && profile['banner']['show'] == true) getBanner(context);
|
|
|
if(profile['quickAction'] != null && profile['quickAction']['show'] == true) getQuickAction(context);
|
|
|
getUnreadMessages(context);
|