Compare commits
No commits in common. 'master' and 'localization_aamir' have entirely different histories.
master
...
localizati
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,5 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="13" height="9.688" viewBox="0 0 13 9.688">
|
|
||||||
<g id="Group" transform="translate(6 17.688) rotate(180)">
|
|
||||||
<path id="Vector" d="M13,4.844a.781.781,0,0,1-.781.781H2.674L5.414,8.352a.781.781,0,0,1-1.1,1.108L.23,5.4h0a.782.782,0,0,1,0-1.106h0L4.312.227a.781.781,0,0,1,1.1,1.108L2.674,4.062h9.545A.781.781,0,0,1,13,4.844Z" transform="translate(-7 8)"/>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 411 B |
Binary file not shown.
|
Before Width: | Height: | Size: 3.0 KiB |
@ -1,13 +1,135 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:mc_common_app/theme/app_theme.dart';
|
||||||
import 'package:logger/logger.dart';
|
import 'package:logger/logger.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:provider/single_child_widget.dart';
|
||||||
|
import 'package:sizer/sizer.dart';
|
||||||
|
|
||||||
|
//testing push
|
||||||
|
final navigatorKey = GlobalKey<NavigatorState>();
|
||||||
|
|
||||||
|
Logger logger = Logger(
|
||||||
|
// printer: PrettyPrinter(lineLength: 0, methodCount: 0,),
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
Logger logger = Logger(printer: PrettyPrinter(printEmojis: false, colors: true, printTime: false));
|
class MyHttpOverrides extends HttpOverrides {
|
||||||
|
@override
|
||||||
|
HttpClient createHttpClient(SecurityContext? context) {
|
||||||
|
return super.createHttpClient(context)..badCertificateCallback = (X509Certificate cert, String host, int port) => true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool disableThingsForQA = true;
|
Future<void> main() async {
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
// Language Tile in Settings
|
await EasyLocalization.ensureInitialized();
|
||||||
|
// AppState().setPostParamsInitConfig();
|
||||||
|
HttpOverrides.global = MyHttpOverrides();
|
||||||
|
|
||||||
|
runApp(
|
||||||
|
EasyLocalization(
|
||||||
|
supportedLocales: const <Locale>[
|
||||||
|
Locale('en', 'US'),
|
||||||
|
Locale('ar', 'SA'),
|
||||||
|
],
|
||||||
|
path: 'resources',
|
||||||
|
// assetLoader: const CodegenLoader(),
|
||||||
|
child: MultiProvider(
|
||||||
|
providers: const <SingleChildWidget>[
|
||||||
|
// ChangeNotifierProvider<LoginProviderModel>(
|
||||||
|
// create: (_) => LoginProviderModel(),
|
||||||
|
// ),
|
||||||
|
],
|
||||||
|
child: const MyApp(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// todo terminal command to genertate translation files
|
// todo terminal command to genertate translation files
|
||||||
// flutter pub run easy_localization:generate --source-dir ./assets/langs
|
// flutter pub run easy_localization:generate --source-dir ./assets/langs
|
||||||
// todo terminal command to genertate translation keys
|
// todo terminal command to genertate translation keys
|
||||||
// flutter pub run easy_localization:generate --source-dir ./assets/langs -f keys -o locale_keys.g.dart
|
// flutter pub run easy_localization:generate --source-dir ./assets/langs -f keys -o locale_keys.g.dart
|
||||||
// command to generate languages data from json
|
// command to generate languages data from json
|
||||||
|
|
||||||
|
class MyApp extends StatelessWidget {
|
||||||
|
const MyApp({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return LayoutBuilder(builder: (context, constraints) {
|
||||||
|
return Sizer(
|
||||||
|
builder: (
|
||||||
|
BuildContext context,
|
||||||
|
Orientation orientation,
|
||||||
|
DeviceType deviceType,
|
||||||
|
) {
|
||||||
|
List<LocalizationsDelegate<dynamic>> delegates = context.localizationDelegates;
|
||||||
|
// AppState().setPostParamsModel(
|
||||||
|
// PostParamsModel(
|
||||||
|
// languageID: EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2,
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
return MaterialApp(
|
||||||
|
// key: navigatorKey,
|
||||||
|
navigatorKey: navigatorKey,
|
||||||
|
theme: AppTheme.getTheme(
|
||||||
|
isArabic: EasyLocalization.of(context)?.locale.languageCode == "ar",
|
||||||
|
),
|
||||||
|
debugShowCheckedModeBanner: false,
|
||||||
|
localizationsDelegates: delegates,
|
||||||
|
supportedLocales: context.supportedLocales,
|
||||||
|
locale: context.locale,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// class MyApp extends StatelessWidget {
|
||||||
|
// MyApp({super.key}) {
|
||||||
|
// AppDependencies.addDependencies();
|
||||||
|
// AppState = Injector.appInstance.get<AppState>();
|
||||||
|
// // AppState.setPostParamsInitConfig();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @override
|
||||||
|
// Widget build(BuildContext context) {
|
||||||
|
// return LayoutBuilder(builder: (context, constraints) {
|
||||||
|
// return Sizer(
|
||||||
|
// builder: (
|
||||||
|
// BuildContext context,
|
||||||
|
// Orientation orientation,
|
||||||
|
// DeviceType deviceType,
|
||||||
|
// ) {
|
||||||
|
// SizeConfig().init(constraints, orientation);
|
||||||
|
// List<LocalizationsDelegate<dynamic>> delegates = context.localizationDelegates;
|
||||||
|
// // AppState().setPostParamsModel(
|
||||||
|
// // PostParamsModel(
|
||||||
|
// // languageID: EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2,
|
||||||
|
// // ),
|
||||||
|
// // );
|
||||||
|
// return MaterialApp(
|
||||||
|
// // key: navigatorKey,
|
||||||
|
// navigatorKey: navigatorKey,
|
||||||
|
// theme: AppTheme.getTheme(
|
||||||
|
// EasyLocalization.of(context)?.locale.languageCode == "ar",
|
||||||
|
// ),
|
||||||
|
// debugShowCheckedModeBanner: false,
|
||||||
|
// localizationsDelegates: delegates,
|
||||||
|
// supportedLocales: context.supportedLocales,
|
||||||
|
// locale: context.locale,
|
||||||
|
// initialRoute: AppRoutes.initialPage,
|
||||||
|
// routes: AppRoutes.routes,
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|||||||
@ -1,45 +0,0 @@
|
|||||||
class AppointmentBasicDetailsModel {
|
|
||||||
int? serviceSlotID;
|
|
||||||
String? slotDate;
|
|
||||||
String? startTime;
|
|
||||||
String? endTime;
|
|
||||||
int? appointmentStatusID;
|
|
||||||
String? appointmentStatusText;
|
|
||||||
int? serviceProviderID;
|
|
||||||
int? customerID;
|
|
||||||
|
|
||||||
AppointmentBasicDetailsModel({
|
|
||||||
this.serviceSlotID,
|
|
||||||
this.slotDate,
|
|
||||||
this.startTime,
|
|
||||||
this.endTime,
|
|
||||||
this.appointmentStatusID,
|
|
||||||
this.appointmentStatusText,
|
|
||||||
this.serviceProviderID,
|
|
||||||
this.customerID,
|
|
||||||
});
|
|
||||||
|
|
||||||
AppointmentBasicDetailsModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
serviceSlotID = json['serviceSlotID'];
|
|
||||||
slotDate = json['slotDate'];
|
|
||||||
startTime = json['startTime'];
|
|
||||||
endTime = json['endTime'];
|
|
||||||
appointmentStatusID = json['appointmentStatusID'];
|
|
||||||
appointmentStatusText = json['appointmentStatusText'];
|
|
||||||
serviceProviderID = json['serviceProviderID'];
|
|
||||||
customerID = json['customerID'];
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
|
||||||
data['serviceSlotID'] = serviceSlotID;
|
|
||||||
data['slotDate'] = slotDate;
|
|
||||||
data['startTime'] = startTime;
|
|
||||||
data['endTime'] = endTime;
|
|
||||||
data['appointmentStatusID'] = appointmentStatusID;
|
|
||||||
data['appointmentStatusText'] = appointmentStatusText;
|
|
||||||
data['serviceProviderID'] = serviceProviderID;
|
|
||||||
data['customerID'] = customerID;
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
class BuyersChatForAdsModel {
|
|
||||||
int? id;
|
|
||||||
String? buyerUserID;
|
|
||||||
String? buyerName;
|
|
||||||
int? adsID;
|
|
||||||
int? unReadMessagesCount;
|
|
||||||
String? lastMessage;
|
|
||||||
String? lastMessageDateTime;
|
|
||||||
|
|
||||||
BuyersChatForAdsModel({this.id, this.buyerUserID, this.buyerName, this.adsID});
|
|
||||||
|
|
||||||
BuyersChatForAdsModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
id = json['id'];
|
|
||||||
buyerUserID = json['buyerUserID'];
|
|
||||||
buyerName = json['buyerName'];
|
|
||||||
adsID = json['adsID'];
|
|
||||||
unReadMessagesCount = json['unReadCount'];
|
|
||||||
lastMessage = json['lastMessage'];
|
|
||||||
lastMessageDateTime = json['lastMessageDateTime'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final mResponse = mResponseFromJson(jsonString);
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
MResponse mResponseFromJson(String str) => MResponse.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String mResponseToJson(MResponse data) => json.encode(data.toJson());
|
||||||
|
|
||||||
|
class MResponse {
|
||||||
|
MResponse({
|
||||||
|
this.totalItemsCount,
|
||||||
|
this.messageStatus,
|
||||||
|
this.message,
|
||||||
|
this.data,
|
||||||
|
});
|
||||||
|
|
||||||
|
int? totalItemsCount;
|
||||||
|
int? messageStatus;
|
||||||
|
String? message;
|
||||||
|
dynamic data;
|
||||||
|
|
||||||
|
factory MResponse.fromJson(Map<String, dynamic> json) => MResponse(
|
||||||
|
totalItemsCount: json["totalItemsCount"],
|
||||||
|
messageStatus: json["messageStatus"],
|
||||||
|
message: json["message"],
|
||||||
|
data: json["data"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"totalItemsCount": totalItemsCount,
|
||||||
|
"messageStatus": messageStatus,
|
||||||
|
"message": message,
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -1,36 +0,0 @@
|
|||||||
class BranchRatingModel {
|
|
||||||
int? id;
|
|
||||||
String? title;
|
|
||||||
String? review;
|
|
||||||
int? ratNo;
|
|
||||||
int? serviceProviderBranchID;
|
|
||||||
String? serviceProviderBranchName;
|
|
||||||
int? customerID;
|
|
||||||
String? customerName;
|
|
||||||
|
|
||||||
BranchRatingModel({this.id, this.title, this.review, this.ratNo, this.serviceProviderBranchID, this.serviceProviderBranchName, this.customerID, this.customerName});
|
|
||||||
|
|
||||||
BranchRatingModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
id = json['id'];
|
|
||||||
title = json['title'];
|
|
||||||
review = json['review'];
|
|
||||||
ratNo = json['ratNo'];
|
|
||||||
serviceProviderBranchID = json['serviceProviderBranchID'];
|
|
||||||
serviceProviderBranchName = json['serviceProviderBranchName'];
|
|
||||||
customerID = json['customerID'];
|
|
||||||
customerName = json['customerName'];
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
|
||||||
data['id'] = id;
|
|
||||||
data['title'] = title;
|
|
||||||
data['review'] = review;
|
|
||||||
data['ratNo'] = ratNo;
|
|
||||||
data['serviceProviderBranchID'] = serviceProviderBranchID;
|
|
||||||
data['serviceProviderBranchName'] = serviceProviderBranchName;
|
|
||||||
data['customerID'] = customerID;
|
|
||||||
data['customerName'] = customerName;
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
class ProviderContactInfoModel {
|
|
||||||
int? id;
|
|
||||||
int? providerID;
|
|
||||||
String? name;
|
|
||||||
int? allDocStatus;
|
|
||||||
String? companyName;
|
|
||||||
String? companyDescription;
|
|
||||||
int? countryID;
|
|
||||||
String? countryName;
|
|
||||||
String? userID;
|
|
||||||
String? memberSince;
|
|
||||||
String? mobile;
|
|
||||||
String? whatsApp;
|
|
||||||
String? email;
|
|
||||||
|
|
||||||
ProviderContactInfoModel({
|
|
||||||
this.id,
|
|
||||||
this.providerID,
|
|
||||||
this.name,
|
|
||||||
this.allDocStatus,
|
|
||||||
this.companyName,
|
|
||||||
this.companyDescription,
|
|
||||||
this.countryID,
|
|
||||||
this.countryName,
|
|
||||||
this.userID,
|
|
||||||
this.memberSince,
|
|
||||||
this.mobile,
|
|
||||||
this.whatsApp,
|
|
||||||
this.email,
|
|
||||||
});
|
|
||||||
|
|
||||||
ProviderContactInfoModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
id = json['id'];
|
|
||||||
providerID = json['providerID'];
|
|
||||||
name = json['name'];
|
|
||||||
allDocStatus = json['allDocStatus'];
|
|
||||||
companyName = json['companyName'];
|
|
||||||
companyDescription = json['companyDescription'];
|
|
||||||
countryID = json['countryID'];
|
|
||||||
countryName = json['countryName'];
|
|
||||||
userID = json['userID'];
|
|
||||||
memberSince = json['memberSince'];
|
|
||||||
mobile = json['mobile'];
|
|
||||||
whatsApp = json['whatsApp'];
|
|
||||||
email = json['email'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,60 +0,0 @@
|
|||||||
class OffersUnreadChatModel {
|
|
||||||
final int reqTotal;
|
|
||||||
final List<OffersUnreadChatDataModel> reqChatUnread;
|
|
||||||
|
|
||||||
OffersUnreadChatModel({
|
|
||||||
required this.reqTotal,
|
|
||||||
required this.reqChatUnread,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory OffersUnreadChatModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
return OffersUnreadChatModel(
|
|
||||||
reqTotal: json['total'],
|
|
||||||
reqChatUnread: (json['reqChatCountData'] as List).map((e) => OffersUnreadChatDataModel.fromJson(e)).toList(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class OffersUnreadChatDataModel {
|
|
||||||
String reqTitle;
|
|
||||||
int reqTotal;
|
|
||||||
int requestID;
|
|
||||||
String senderUserID;
|
|
||||||
int unreadMessagesCount;
|
|
||||||
String lastChatTime;
|
|
||||||
String lastChatText;
|
|
||||||
String customerName;
|
|
||||||
|
|
||||||
OffersUnreadChatDataModel({
|
|
||||||
required this.reqTitle,
|
|
||||||
required this.reqTotal,
|
|
||||||
required this.requestID,
|
|
||||||
required this.senderUserID,
|
|
||||||
required this.unreadMessagesCount,
|
|
||||||
required this.lastChatTime,
|
|
||||||
required this.lastChatText,
|
|
||||||
required this.customerName,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory OffersUnreadChatDataModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
return OffersUnreadChatDataModel(
|
|
||||||
reqTitle: json['reqTitle'],
|
|
||||||
reqTotal: json['reqTotal'],
|
|
||||||
requestID: json['requestID'],
|
|
||||||
senderUserID: json['senderUserID'],
|
|
||||||
unreadMessagesCount: json['unreadMessagesCount'],
|
|
||||||
lastChatTime: json['lastChatTime'],
|
|
||||||
lastChatText: json['lastChatText'],
|
|
||||||
customerName: json['customerName'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// "reqTitle": "Spare_Parts / Ford / Edge / 2016",
|
|
||||||
// I/flutter (16941): │ "reqTotal": 1,
|
|
||||||
// I/flutter (16941): │ "requestID": 145,
|
|
||||||
// I/flutter (16941): │ "senderUserID": "b56bc6bd-e45c-4644-b7c4-08dd02460895",
|
|
||||||
// I/flutter (16941): │ "unreadMessagesCount": 0,
|
|
||||||
// I/flutter (16941): │ "lastChatTime": "2025-02-12T10:33:42.1433333",
|
|
||||||
// I/flutter (16941): │ "lastChatText": "I am accepting this offer.",
|
|
||||||
// I/flutter (16941): │ "customerName": "Faiz 100"
|
|
||||||
@ -1,158 +0,0 @@
|
|||||||
import 'package:mc_common_app/extensions/string_extensions.dart';
|
|
||||||
import 'package:mc_common_app/utils/enums.dart';
|
|
||||||
|
|
||||||
class ProviderOffersChatsModel {
|
|
||||||
int? id;
|
|
||||||
int? requestID;
|
|
||||||
int? serviceProviderID;
|
|
||||||
ServiceProviderModel? serviceProvider;
|
|
||||||
int? offerStatus;
|
|
||||||
RequestOfferStatusEnum? requestOfferStatusEnum;
|
|
||||||
String? offerStatusText;
|
|
||||||
String? comment;
|
|
||||||
String? customerName;
|
|
||||||
double? price;
|
|
||||||
String? serviceItem;
|
|
||||||
String? offeredItemCreatedBy;
|
|
||||||
String? offeredItemCreatedByName;
|
|
||||||
String? offeredItemCreatedOn;
|
|
||||||
String? reqOfferImages;
|
|
||||||
bool? isDeliveryAvailable;
|
|
||||||
String? createdOn;
|
|
||||||
|
|
||||||
ProviderOffersChatsModel({
|
|
||||||
this.id,
|
|
||||||
this.requestID,
|
|
||||||
this.serviceProviderID,
|
|
||||||
this.serviceProvider,
|
|
||||||
this.offerStatus,
|
|
||||||
this.requestOfferStatusEnum,
|
|
||||||
this.offerStatusText,
|
|
||||||
this.comment,
|
|
||||||
this.customerName,
|
|
||||||
this.price,
|
|
||||||
this.serviceItem,
|
|
||||||
this.offeredItemCreatedBy,
|
|
||||||
this.offeredItemCreatedByName,
|
|
||||||
this.offeredItemCreatedOn,
|
|
||||||
this.reqOfferImages,
|
|
||||||
this.isDeliveryAvailable,
|
|
||||||
this.createdOn,
|
|
||||||
});
|
|
||||||
|
|
||||||
ProviderOffersChatsModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
id = json['id'];
|
|
||||||
requestID = json['requestID'];
|
|
||||||
serviceProviderID = json['serviceProviderID'];
|
|
||||||
serviceProvider = json['serviceProvider'] != null ? ServiceProviderModel.fromJson(json['serviceProvider']) : null;
|
|
||||||
offerStatus = json['offerStatus'];
|
|
||||||
requestOfferStatusEnum = ((json['offerStatus']) as int).toRequestOfferStatusEnum();
|
|
||||||
offerStatusText = json['offerStatusText'];
|
|
||||||
comment = json['comment'];
|
|
||||||
customerName = json['customerName'];
|
|
||||||
price = json['price'];
|
|
||||||
serviceItem = json['serviceItem'];
|
|
||||||
offeredItemCreatedBy = json['offeredItemCreatedBy'];
|
|
||||||
offeredItemCreatedByName = json['offeredItemCreatedByName'];
|
|
||||||
offeredItemCreatedOn = json['offeredItemCreatedOn'];
|
|
||||||
reqOfferImages = json['reqOfferImages'];
|
|
||||||
isDeliveryAvailable = json['isDeliveryAvailable'];
|
|
||||||
createdOn = json['createdOn'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ServiceProviderModel {
|
|
||||||
int? providerId;
|
|
||||||
String? providerGUID;
|
|
||||||
String? firstName;
|
|
||||||
String? lastName;
|
|
||||||
String? name;
|
|
||||||
int? gender;
|
|
||||||
String? genderName;
|
|
||||||
String? mobileNo;
|
|
||||||
String? email;
|
|
||||||
bool? isEmailVerified;
|
|
||||||
bool? isCompleted;
|
|
||||||
int? city;
|
|
||||||
String? cityName;
|
|
||||||
int? country;
|
|
||||||
String? countryName;
|
|
||||||
int? accountStatus;
|
|
||||||
String? accountStatusText;
|
|
||||||
int? activityStatus;
|
|
||||||
String? activityStatusText;
|
|
||||||
String? bankName;
|
|
||||||
String? iBanNo;
|
|
||||||
bool? isActive;
|
|
||||||
String? subscriptionDate;
|
|
||||||
String? createdOn;
|
|
||||||
String? companyName;
|
|
||||||
String? currency;
|
|
||||||
String? branch;
|
|
||||||
bool? isChatted;
|
|
||||||
bool? isDealership;
|
|
||||||
|
|
||||||
ServiceProviderModel({
|
|
||||||
this.providerId,
|
|
||||||
this.providerGUID,
|
|
||||||
this.firstName,
|
|
||||||
this.lastName,
|
|
||||||
this.name,
|
|
||||||
this.gender,
|
|
||||||
this.genderName,
|
|
||||||
this.mobileNo,
|
|
||||||
this.email,
|
|
||||||
this.isEmailVerified,
|
|
||||||
this.isCompleted,
|
|
||||||
this.city,
|
|
||||||
this.cityName,
|
|
||||||
this.country,
|
|
||||||
this.countryName,
|
|
||||||
this.accountStatus,
|
|
||||||
this.accountStatusText,
|
|
||||||
this.activityStatus,
|
|
||||||
this.activityStatusText,
|
|
||||||
this.bankName,
|
|
||||||
this.iBanNo,
|
|
||||||
this.isActive,
|
|
||||||
this.subscriptionDate,
|
|
||||||
this.createdOn,
|
|
||||||
this.companyName,
|
|
||||||
this.currency,
|
|
||||||
this.branch,
|
|
||||||
this.isChatted,
|
|
||||||
this.isDealership,
|
|
||||||
});
|
|
||||||
|
|
||||||
ServiceProviderModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
providerId = json['providerId'];
|
|
||||||
providerGUID = json['providerGUID'];
|
|
||||||
firstName = json['firstName'];
|
|
||||||
lastName = json['lastName'];
|
|
||||||
name = json['name'];
|
|
||||||
gender = json['gender'];
|
|
||||||
genderName = json['genderName'];
|
|
||||||
mobileNo = json['mobileNo'];
|
|
||||||
email = json['email'];
|
|
||||||
isEmailVerified = json['isEmailVerfied'];
|
|
||||||
isCompleted = json['isCompleted'];
|
|
||||||
city = json['city'];
|
|
||||||
cityName = json['cityName'];
|
|
||||||
country = json['country'];
|
|
||||||
countryName = json['countryName'];
|
|
||||||
accountStatus = json['accountStatus'];
|
|
||||||
accountStatusText = json['accountStatusText'];
|
|
||||||
activityStatus = json['activityStatus'];
|
|
||||||
activityStatusText = json['activityStatusText'];
|
|
||||||
bankName = json['bankName'];
|
|
||||||
iBanNo = json['iBanNo'];
|
|
||||||
isActive = json['isActive'];
|
|
||||||
subscriptionDate = json['subscriptionDate'];
|
|
||||||
createdOn = json['createdOn'];
|
|
||||||
companyName = json['companyName'];
|
|
||||||
currency = json['currency'];
|
|
||||||
branch = json['branch'];
|
|
||||||
isChatted = json['isChatted'];
|
|
||||||
isDealership = json['isDealership'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
import 'package:mc_common_app/view_models/ad_view_model.dart';
|
|
||||||
|
|
||||||
class AppInfoModel {
|
|
||||||
int? id;
|
|
||||||
String? header;
|
|
||||||
String? content;
|
|
||||||
bool? isActive;
|
|
||||||
int? channel;
|
|
||||||
List<ImageModel>? images;
|
|
||||||
|
|
||||||
AppInfoModel({this.id, this.header, this.content, this.isActive, this.channel, this.images});
|
|
||||||
|
|
||||||
AppInfoModel.fromJson(Map<String, dynamic> json, {bool isForTermsAndCondition = false}) {
|
|
||||||
String imagesKey = "appInfoImages";
|
|
||||||
if (isForTermsAndCondition) {
|
|
||||||
imagesKey = "termAndConditionImages";
|
|
||||||
}
|
|
||||||
id = json['id'];
|
|
||||||
header = json['header'];
|
|
||||||
content = json['content'];
|
|
||||||
isActive = json['isActive'];
|
|
||||||
channel = json['channel'];
|
|
||||||
if (json[imagesKey] != null) {
|
|
||||||
images = <ImageModel>[];
|
|
||||||
json[imagesKey].forEach((v) {
|
|
||||||
images!.add(ImageModel.fromJson(v));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
class AppInvitationHistoryModel {
|
|
||||||
int? id;
|
|
||||||
int? customerID;
|
|
||||||
int? channelID;
|
|
||||||
int? appInvitationEnumID;
|
|
||||||
int? noOfInvites;
|
|
||||||
String? comments;
|
|
||||||
|
|
||||||
AppInvitationHistoryModel({
|
|
||||||
this.id,
|
|
||||||
this.customerID,
|
|
||||||
this.channelID,
|
|
||||||
this.appInvitationEnumID,
|
|
||||||
this.noOfInvites,
|
|
||||||
this.comments,
|
|
||||||
});
|
|
||||||
|
|
||||||
AppInvitationHistoryModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
id = json['id'];
|
|
||||||
customerID = json['customerID'];
|
|
||||||
channelID = json['channelID'];
|
|
||||||
appInvitationEnumID = json['appInvitationEnumID'];
|
|
||||||
noOfInvites = json['noofInvites'];
|
|
||||||
comments = json['comments'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
import 'package:mc_common_app/view_models/ad_view_model.dart';
|
|
||||||
|
|
||||||
class ContactInfoModel {
|
|
||||||
int? id;
|
|
||||||
String? companyName;
|
|
||||||
String? mobileNo;
|
|
||||||
String? phoneNo;
|
|
||||||
String? email;
|
|
||||||
String? address;
|
|
||||||
String? latitude;
|
|
||||||
String? longitude;
|
|
||||||
int? channel;
|
|
||||||
bool? isActive;
|
|
||||||
List<ImageModel>? contactInfoImages;
|
|
||||||
|
|
||||||
ContactInfoModel({this.id, this.companyName, this.mobileNo, this.phoneNo, this.email, this.address, this.latitude, this.longitude, this.channel, this.isActive, this.contactInfoImages});
|
|
||||||
|
|
||||||
ContactInfoModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
id = json['id'];
|
|
||||||
companyName = json['companyName'];
|
|
||||||
mobileNo = json['mobileNo'];
|
|
||||||
phoneNo = json['phoneNo'];
|
|
||||||
email = json['email'];
|
|
||||||
address = json['address'];
|
|
||||||
latitude = json['latitude'];
|
|
||||||
longitude = json['longitude'];
|
|
||||||
channel = json['channel'];
|
|
||||||
isActive = json['isActive'];
|
|
||||||
if (json['contactInfoImages'] != null) {
|
|
||||||
contactInfoImages = <ImageModel>[];
|
|
||||||
json['contactInfoImages'].forEach((v) {
|
|
||||||
contactInfoImages!.add(ImageModel.fromJson(v));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
class FAQsModel {
|
|
||||||
int? id;
|
|
||||||
String? question;
|
|
||||||
String? answer;
|
|
||||||
int? sequenceNo;
|
|
||||||
bool? isActive;
|
|
||||||
int? channel;
|
|
||||||
bool? isCollapsed;
|
|
||||||
|
|
||||||
FAQsModel({this.id, this.question, this.answer, this.sequenceNo, this.isActive, this.channel, this.isCollapsed});
|
|
||||||
|
|
||||||
FAQsModel.fromJson(Map<String, dynamic> json) {
|
|
||||||
id = json['id'];
|
|
||||||
question = json['question'];
|
|
||||||
answer = json['answer'];
|
|
||||||
sequenceNo = json['sequenceNo'];
|
|
||||||
isActive = json['isActive'];
|
|
||||||
channel = json['channel'];
|
|
||||||
isCollapsed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
|
||||||
data['id'] = id;
|
|
||||||
data['question'] = question;
|
|
||||||
data['answer'] = answer;
|
|
||||||
data['sequenceNo'] = sequenceNo;
|
|
||||||
data['isActive'] = isActive;
|
|
||||||
data['channel'] = channel;
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,83 +0,0 @@
|
|||||||
import 'package:mc_common_app/extensions/string_extensions.dart';
|
|
||||||
import 'package:mc_common_app/utils/enums.dart';
|
|
||||||
|
|
||||||
class ShippingRequestModel {
|
|
||||||
int? id;
|
|
||||||
int? requestID;
|
|
||||||
Request? request;
|
|
||||||
int? pickupOrshippingStatus;
|
|
||||||
ShippingRequestStatusEnum? shippingStatusEnum;
|
|
||||||
SelfPickupRequestStatusEnum? selfPickupRequestStatusEnum;
|
|
||||||
String? deliveredorCollectedOn;
|
|
||||||
String? comment;
|
|
||||||
String? createdOn;
|
|
||||||
int? customerID;
|
|
||||||
String? customerName;
|
|
||||||
int? vehicleTypeID;
|
|
||||||
String? vehicleType;
|
|
||||||
|
|
||||||
ShippingRequestModel({
|
|
||||||
this.id,
|
|
||||||
this.requestID,
|
|
||||||
this.request,
|
|
||||||
this.pickupOrshippingStatus,
|
|
||||||
this.deliveredorCollectedOn,
|
|
||||||
this.comment,
|
|
||||||
this.createdOn,
|
|
||||||
this.customerID,
|
|
||||||
this.customerName,
|
|
||||||
this.vehicleTypeID,
|
|
||||||
this.vehicleType,
|
|
||||||
});
|
|
||||||
|
|
||||||
ShippingRequestModel.fromJsonShipping(Map<String, dynamic> json, bool isForShipping) {
|
|
||||||
id = json['id'];
|
|
||||||
requestID = json['requestID'];
|
|
||||||
request = json['request'] != null ? Request.fromJson(json['request']) : null;
|
|
||||||
pickupOrshippingStatus = isForShipping ? json['shippingStatus'] : json['selfPickUpStatus'];
|
|
||||||
shippingStatusEnum = isForShipping ? (json['shippingStatus'] != null ? (json['shippingStatus'] as int).toShippingStatusEnum() : ShippingRequestStatusEnum.initiated) : null;
|
|
||||||
selfPickupRequestStatusEnum =
|
|
||||||
isForShipping ? null : (json['selfPickUpStatus'] != null ? (json['selfPickUpStatus'] as int).toSelfPickupStatusEnum() : SelfPickupRequestStatusEnum.preparingToCollect);
|
|
||||||
deliveredorCollectedOn = isForShipping ? json['deliveredOn'] : json['collectedOn'];
|
|
||||||
comment = json['comment'];
|
|
||||||
createdOn = json['createdOn'];
|
|
||||||
customerID = json['customerID'];
|
|
||||||
customerName = json['customerName'];
|
|
||||||
vehicleTypeID = json['vehicleTypeID'];
|
|
||||||
vehicleType = json['vehicleType'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Request {
|
|
||||||
int? requestType;
|
|
||||||
String? brand;
|
|
||||||
String? model;
|
|
||||||
int? year;
|
|
||||||
bool? isNew;
|
|
||||||
String? description;
|
|
||||||
double? price;
|
|
||||||
|
|
||||||
Request({this.requestType, this.brand, this.model, this.year, this.isNew, this.description, this.price});
|
|
||||||
|
|
||||||
Request.fromJson(Map<String, dynamic> json) {
|
|
||||||
requestType = json['requestType'];
|
|
||||||
brand = json['brand'];
|
|
||||||
model = json['model'];
|
|
||||||
year = json['year'];
|
|
||||||
isNew = json['isNew'];
|
|
||||||
description = json['description'];
|
|
||||||
price = json['price'];
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
|
||||||
data['requestType'] = requestType;
|
|
||||||
data['brand'] = brand;
|
|
||||||
data['model'] = model;
|
|
||||||
data['year'] = year;
|
|
||||||
data['isNew'] = isNew;
|
|
||||||
data['description'] = description;
|
|
||||||
data['price'] = price;
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,214 +0,0 @@
|
|||||||
import 'package:easy_localization/easy_localization.dart';
|
|
||||||
import 'package:mc_common_app/api/api_client.dart';
|
|
||||||
import 'package:mc_common_app/classes/app_state.dart';
|
|
||||||
import 'package:mc_common_app/classes/consts.dart';
|
|
||||||
import 'package:mc_common_app/config/dependency_injection.dart';
|
|
||||||
import 'package:mc_common_app/generated/locale_keys.g.dart';
|
|
||||||
import 'package:mc_common_app/models/general_models/generic_resp_model.dart';
|
|
||||||
import 'package:mc_common_app/models/setting_utils_models/app_info_model.dart';
|
|
||||||
import 'package:mc_common_app/models/setting_utils_models/app_invitation_history_model.dart';
|
|
||||||
import 'package:mc_common_app/models/setting_utils_models/contact_infos_model.dart';
|
|
||||||
import 'package:mc_common_app/models/setting_utils_models/faqs_model.dart';
|
|
||||||
import 'package:mc_common_app/utils/enums.dart';
|
|
||||||
import 'package:mc_common_app/utils/utils.dart';
|
|
||||||
|
|
||||||
abstract class SettingOptionsRepo {
|
|
||||||
Future<List<FAQsModel>> getAllFaqs();
|
|
||||||
|
|
||||||
Future<List<ContactInfoModel>> getAllContactInfos();
|
|
||||||
|
|
||||||
Future<List<AppInfoModel>> getAppInfoList();
|
|
||||||
|
|
||||||
Future<List<AppInfoModel>> getTermsAndConditions();
|
|
||||||
|
|
||||||
Future<GenericRespModel> appInvitationCreate({required int channelId, required String message});
|
|
||||||
|
|
||||||
Future<List<AppInvitationHistoryModel>> getAppInvitationsHistory();
|
|
||||||
}
|
|
||||||
|
|
||||||
class SettingOptionsRepoImp extends SettingOptionsRepo {
|
|
||||||
ApiClient apiClient = injector.get<ApiClient>();
|
|
||||||
AppState appState = injector.get<AppState>();
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<List<FAQsModel>> getAllFaqs() async {
|
|
||||||
int channel = 0;
|
|
||||||
|
|
||||||
if (AppState().currentAppType == AppType.provider) {
|
|
||||||
channel = 2;
|
|
||||||
} else {
|
|
||||||
channel = 3;
|
|
||||||
}
|
|
||||||
final params = {
|
|
||||||
"Channel": channel.toString(),
|
|
||||||
};
|
|
||||||
|
|
||||||
String token = appState.getUser.data!.accessToken ?? "";
|
|
||||||
|
|
||||||
GenericRespModel genericRespModel = await injector.get<ApiClient>().getJsonForObject(
|
|
||||||
(json) => GenericRespModel.fromJson(json),
|
|
||||||
ApiConsts.getAllFAQs,
|
|
||||||
token: token,
|
|
||||||
queryParameters: params,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (genericRespModel.messageStatus != 1 || genericRespModel.data == null) {
|
|
||||||
Utils.showToast(genericRespModel.message ?? LocaleKeys.somethingWrong.tr());
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
List<FAQsModel> list = List.generate(genericRespModel.data.length, (index) => FAQsModel.fromJson(genericRespModel.data[index]));
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<List<ContactInfoModel>> getAllContactInfos() async {
|
|
||||||
int channel = 0;
|
|
||||||
|
|
||||||
if (AppState().currentAppType == AppType.provider) {
|
|
||||||
channel = 2;
|
|
||||||
} else {
|
|
||||||
channel = 3;
|
|
||||||
}
|
|
||||||
final params = {"Channel": channel.toString()};
|
|
||||||
|
|
||||||
String token = appState.getUser.data!.accessToken ?? "";
|
|
||||||
|
|
||||||
GenericRespModel genericRespModel = await injector.get<ApiClient>().getJsonForObject(
|
|
||||||
(json) => GenericRespModel.fromJson(json),
|
|
||||||
ApiConsts.getContactInfo,
|
|
||||||
queryParameters: params,
|
|
||||||
token: token,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (genericRespModel.messageStatus != 1 || genericRespModel.data == null) {
|
|
||||||
Utils.showToast(genericRespModel.message ?? LocaleKeys.somethingWrong.tr());
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ContactInfoModel> list = List.generate(genericRespModel.data.length, (index) => ContactInfoModel.fromJson(genericRespModel.data[index]));
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<List<AppInfoModel>> getAppInfoList() async {
|
|
||||||
String token = appState.getUser.data!.accessToken ?? "";
|
|
||||||
|
|
||||||
int channel = 0;
|
|
||||||
|
|
||||||
if (AppState().currentAppType == AppType.provider) {
|
|
||||||
channel = 2;
|
|
||||||
} else {
|
|
||||||
channel = 3;
|
|
||||||
}
|
|
||||||
final params = {
|
|
||||||
"Channel": channel.toString(),
|
|
||||||
};
|
|
||||||
|
|
||||||
GenericRespModel genericRespModel = await injector.get<ApiClient>().getJsonForObject(
|
|
||||||
(json) => GenericRespModel.fromJson(json),
|
|
||||||
ApiConsts.getAppInfo,
|
|
||||||
token: token,
|
|
||||||
queryParameters: params,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (genericRespModel.messageStatus != 1 || genericRespModel.data == null) {
|
|
||||||
Utils.showToast(genericRespModel.message ?? LocaleKeys.somethingWrong.tr());
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
List<AppInfoModel> list = List.generate(genericRespModel.data.length, (index) => AppInfoModel.fromJson(genericRespModel.data[index]));
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<List<AppInfoModel>> getTermsAndConditions() async {
|
|
||||||
String token = appState.getUser.data!.accessToken ?? "";
|
|
||||||
|
|
||||||
int channel = 0;
|
|
||||||
|
|
||||||
if (AppState().currentAppType == AppType.provider) {
|
|
||||||
channel = 2;
|
|
||||||
} else {
|
|
||||||
channel = 3;
|
|
||||||
}
|
|
||||||
final params = {
|
|
||||||
"Channel": channel.toString(),
|
|
||||||
};
|
|
||||||
|
|
||||||
GenericRespModel genericRespModel = await injector.get<ApiClient>().getJsonForObject(
|
|
||||||
(json) => GenericRespModel.fromJson(json),
|
|
||||||
ApiConsts.getTermsAndConditions,
|
|
||||||
token: token,
|
|
||||||
queryParameters: params,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (genericRespModel.messageStatus != 1 || genericRespModel.data == null) {
|
|
||||||
Utils.showToast(genericRespModel.message ?? LocaleKeys.somethingWrong.tr());
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
List<AppInfoModel> list = List.generate(genericRespModel.data.length, (index) => AppInfoModel.fromJson(genericRespModel.data[index], isForTermsAndCondition: true));
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<GenericRespModel> appInvitationCreate({required int channelId, required String message}) async {
|
|
||||||
String token = appState.getUser.data!.accessToken ?? "";
|
|
||||||
|
|
||||||
final params = {
|
|
||||||
"appInvitationEnumID": channelId.toString(),
|
|
||||||
"comments": message,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (AppState().currentAppType == AppType.customer) {
|
|
||||||
params.addAll({
|
|
||||||
"customerID": (appState.getUser.data!.userInfo!.customerId ?? "0").toString(),
|
|
||||||
"channelID": "3",
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
params.addAll({
|
|
||||||
"providerID": (appState.getUser.data!.userInfo!.providerId ?? "0").toString(),
|
|
||||||
"channelID": "2",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
GenericRespModel genericRespModel = await injector.get<ApiClient>().postJsonForObject(
|
|
||||||
(json) => GenericRespModel.fromJson(json),
|
|
||||||
ApiConsts.createAppInvitation,
|
|
||||||
token: token,
|
|
||||||
params,
|
|
||||||
);
|
|
||||||
return genericRespModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<List<AppInvitationHistoryModel>> getAppInvitationsHistory() async {
|
|
||||||
final params = {
|
|
||||||
"CustomerID": (appState.getUser.data!.userInfo!.customerId ?? "0").toString(),
|
|
||||||
"ChannelID": "3",
|
|
||||||
};
|
|
||||||
|
|
||||||
String token = appState.getUser.data!.accessToken ?? "";
|
|
||||||
|
|
||||||
GenericRespModel genericRespModel = await injector.get<ApiClient>().getJsonForObject(
|
|
||||||
(json) => GenericRespModel.fromJson(json),
|
|
||||||
ApiConsts.getAppInvitationHistory,
|
|
||||||
queryParameters: params,
|
|
||||||
token: token,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (genericRespModel.messageStatus != 1 || genericRespModel.data == null) {
|
|
||||||
Utils.showToast(genericRespModel.message ?? LocaleKeys.somethingWrong.tr());
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
List<AppInvitationHistoryModel> list = List.generate(genericRespModel.data.length, (index) => AppInvitationHistoryModel.fromJson(genericRespModel.data[index]));
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,125 +0,0 @@
|
|||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
|
||||||
import 'package:mc_common_app/api/api_client.dart';
|
|
||||||
import 'package:mc_common_app/classes/app_state.dart';
|
|
||||||
import 'package:mc_common_app/classes/consts.dart';
|
|
||||||
import 'package:mc_common_app/config/dependency_injection.dart';
|
|
||||||
import 'package:mc_common_app/extensions/string_extensions.dart';
|
|
||||||
import 'package:mc_common_app/generated/locale_keys.g.dart';
|
|
||||||
import 'package:mc_common_app/models/general_models/generic_resp_model.dart';
|
|
||||||
import 'package:mc_common_app/models/shipping_models/shipping_status_model.dart';
|
|
||||||
|
|
||||||
import 'package:mc_common_app/utils/enums.dart';
|
|
||||||
import 'package:mc_common_app/utils/utils.dart';
|
|
||||||
|
|
||||||
abstract class ShippingRepo {
|
|
||||||
Future<List<ShippingRequestModel>> getSelfPickupRequestListByStatus({SelfPickupRequestStatusEnum? selfPickupRequestStatus, int? requestId});
|
|
||||||
|
|
||||||
Future<List<ShippingRequestModel>> getShippingRequestListByStatus({ShippingRequestStatusEnum? shippingStatusEnum, int? requestId});
|
|
||||||
|
|
||||||
Future<GenericRespModel> updateShippingRequestStatus({required ShippingRequestStatusEnum shippingStatusEnum, required int shippingRequestId, String? comment});
|
|
||||||
|
|
||||||
Future<GenericRespModel> updateSelfPickupRequestStatus({required SelfPickupRequestStatusEnum selfPickupStatusEnum, required int shippingRequestId, String? comment});
|
|
||||||
}
|
|
||||||
|
|
||||||
class ShippingRepoImp extends ShippingRepo {
|
|
||||||
ApiClient apiClient = injector.get<ApiClient>();
|
|
||||||
AppState appState = injector.get<AppState>();
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<List<ShippingRequestModel>> getShippingRequestListByStatus({ShippingRequestStatusEnum? shippingStatusEnum, int? requestId}) async {
|
|
||||||
String token = appState.getUser.data!.accessToken ?? "";
|
|
||||||
Map queryParameters = {
|
|
||||||
"requestID": "${requestId ?? 0}",
|
|
||||||
"shippingStatus": "${shippingStatusEnum != null ? shippingStatusEnum.getIdFromShippingStatusEnum() : -1}", // -1 to get all requests
|
|
||||||
};
|
|
||||||
|
|
||||||
GenericRespModel genericRespModel = await apiClient.postJsonForObject(
|
|
||||||
(json) => GenericRespModel.fromJson(json),
|
|
||||||
ApiConsts.shippingRequestStatusGet,
|
|
||||||
queryParameters,
|
|
||||||
token: token,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (genericRespModel.messageStatus != 1 || genericRespModel.data == null) {
|
|
||||||
Utils.showToast(genericRespModel.message ?? LocaleKeys.somethingWrong.tr());
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ShippingRequestModel> list = List.generate(genericRespModel.data.length, (index) => ShippingRequestModel.fromJsonShipping(genericRespModel.data[index], true));
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<List<ShippingRequestModel>> getSelfPickupRequestListByStatus({SelfPickupRequestStatusEnum? selfPickupRequestStatus, int? requestId}) async {
|
|
||||||
String token = appState.getUser.data!.accessToken ?? "";
|
|
||||||
Map queryParameters = {
|
|
||||||
"requestID": "${requestId ?? 0}",
|
|
||||||
"selfPickUpStatus": "${selfPickupRequestStatus != null ? selfPickupRequestStatus.getIdFromSelfPickupStatusEnum() : -1}", // -1 to get all requests
|
|
||||||
};
|
|
||||||
|
|
||||||
GenericRespModel genericRespModel = await apiClient.postJsonForObject(
|
|
||||||
(json) => GenericRespModel.fromJson(json),
|
|
||||||
ApiConsts.selfPickupRequestStatusGet,
|
|
||||||
queryParameters,
|
|
||||||
token: token,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (genericRespModel.messageStatus != 1 || genericRespModel.data == null) {
|
|
||||||
Utils.showToast(genericRespModel.message ?? LocaleKeys.somethingWrong.tr());
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ShippingRequestModel> list = List.generate(genericRespModel.data.length, (index) => ShippingRequestModel.fromJsonShipping(genericRespModel.data[index], false));
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<GenericRespModel> updateShippingRequestStatus({required ShippingRequestStatusEnum shippingStatusEnum, required int shippingRequestId, String? comment}) async {
|
|
||||||
String token = appState.getUser.data!.accessToken ?? "";
|
|
||||||
Map<String, String> queryParameters = {
|
|
||||||
"id": "$shippingRequestId",
|
|
||||||
"shippingStatus": "${shippingStatusEnum.getIdFromShippingStatusEnum()}",
|
|
||||||
"comment": comment ?? "",
|
|
||||||
};
|
|
||||||
|
|
||||||
GenericRespModel genericRespModel = await apiClient.postJsonForObject(
|
|
||||||
(json) => GenericRespModel.fromJson(json),
|
|
||||||
ApiConsts.shippingRequestStatusUpdate,
|
|
||||||
queryParameters,
|
|
||||||
token: token,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (genericRespModel.messageStatus != 1 || genericRespModel.data == null) {
|
|
||||||
Utils.showToast(genericRespModel.message ?? LocaleKeys.somethingWrong.tr());
|
|
||||||
}
|
|
||||||
|
|
||||||
return genericRespModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<GenericRespModel> updateSelfPickupRequestStatus({required SelfPickupRequestStatusEnum selfPickupStatusEnum, required int shippingRequestId, String? comment}) async {
|
|
||||||
String token = appState.getUser.data!.accessToken ?? "";
|
|
||||||
Map<String, String> queryParameters = {
|
|
||||||
"id": "$shippingRequestId",
|
|
||||||
"selfPickUpStatus": "${selfPickupStatusEnum.getIdFromSelfPickupStatusEnum()}",
|
|
||||||
"comment": comment ?? "",
|
|
||||||
};
|
|
||||||
|
|
||||||
GenericRespModel genericRespModel = await apiClient.postJsonForObject(
|
|
||||||
(json) => GenericRespModel.fromJson(json),
|
|
||||||
ApiConsts.selfPickupRequestStatusUpdate,
|
|
||||||
queryParameters,
|
|
||||||
token: token,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (genericRespModel.messageStatus != 1 || genericRespModel.data == null) {
|
|
||||||
Utils.showToast(genericRespModel.message ?? LocaleKeys.somethingWrong.tr());
|
|
||||||
}
|
|
||||||
|
|
||||||
return genericRespModel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,115 +0,0 @@
|
|||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:firebase_core/firebase_core.dart';
|
|
||||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
|
||||||
import 'package:mc_common_app/classes/app_state.dart';
|
|
||||||
import 'package:mc_common_app/main.dart';
|
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
|
||||||
|
|
||||||
abstract class FirebaseMessagingService {
|
|
||||||
Future<String> getFirebaseToken();
|
|
||||||
|
|
||||||
Future<void> initializeNotifications();
|
|
||||||
}
|
|
||||||
|
|
||||||
class FirebaseMessagingServiceImp implements FirebaseMessagingService {
|
|
||||||
final FlutterLocalNotificationsPlugin flutterLocalNotifications;
|
|
||||||
final FirebaseMessaging firebaseMessaging;
|
|
||||||
|
|
||||||
FirebaseMessagingServiceImp({required this.firebaseMessaging, required this.flutterLocalNotifications});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<String> getFirebaseToken() async => await firebaseMessaging.getToken() ?? "";
|
|
||||||
|
|
||||||
Future<void> requestPermissions() async {
|
|
||||||
if (Platform.isIOS) {
|
|
||||||
await flutterLocalNotifications.resolvePlatformSpecificImplementation<IOSFlutterLocalNotificationsPlugin>()?.requestPermissions(alert: true, badge: true, sound: true);
|
|
||||||
} else if (Platform.isAndroid) {
|
|
||||||
AndroidFlutterLocalNotificationsPlugin? androidImplementation = flutterLocalNotifications.resolvePlatformSpecificImplementation<AndroidFlutterLocalNotificationsPlugin>();
|
|
||||||
bool? granted = await androidImplementation?.requestNotificationsPermission();
|
|
||||||
if (granted == false) {
|
|
||||||
await Permission.notification.request();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> initializeNotifications() async {
|
|
||||||
await requestPermissions();
|
|
||||||
AppState().setDeviceToken = await getFirebaseToken();
|
|
||||||
AppState().setDeviceType = Platform.isAndroid ? "1" : "2";
|
|
||||||
await Permission.notification.isDenied.then((bool value) {
|
|
||||||
if (value) {
|
|
||||||
Permission.notification.request();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// initialise the plugin. app_icon needs to be a added as a drawable resource to the Android head project
|
|
||||||
const AndroidInitializationSettings initializationSettingsAndroid = AndroidInitializationSettings('ic_launcher');
|
|
||||||
DarwinInitializationSettings initializationSettingsDarwin = const DarwinInitializationSettings(
|
|
||||||
requestAlertPermission: true,
|
|
||||||
requestBadgePermission: true,
|
|
||||||
requestCriticalPermission: true,
|
|
||||||
requestProvisionalPermission: true,
|
|
||||||
requestSoundPermission: true,
|
|
||||||
defaultPresentAlert: true,
|
|
||||||
defaultPresentBadge: true,
|
|
||||||
defaultPresentBanner: true,
|
|
||||||
defaultPresentList: true,
|
|
||||||
defaultPresentSound: true,
|
|
||||||
);
|
|
||||||
final InitializationSettings initializationSettings = InitializationSettings(android: initializationSettingsAndroid, iOS: initializationSettingsDarwin);
|
|
||||||
await flutterLocalNotifications.initialize(initializationSettings, onDidReceiveNotificationResponse: (notificationResponse) {}, );
|
|
||||||
|
|
||||||
RemoteMessage? initialMessage = await FirebaseMessaging.instance.getInitialMessage();
|
|
||||||
|
|
||||||
if (initialMessage != null) _handleNotification(initialMessage);
|
|
||||||
|
|
||||||
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
|
||||||
if (message.notification != null) _handleNotification(message);
|
|
||||||
});
|
|
||||||
|
|
||||||
FirebaseMessaging.onMessageOpenedApp.listen(_handleNotification);
|
|
||||||
|
|
||||||
FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler);
|
|
||||||
|
|
||||||
FirebaseMessaging.instance.onTokenRefresh.listen((String token) async {
|
|
||||||
AppState().setDeviceToken = token;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void _onDidReceiveLocalNotification(int id, String? title, String? body, String? payload) async {
|
|
||||||
logger.i(body);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _handleNotification(RemoteMessage message) async {
|
|
||||||
logger.i(message.notification!.title);
|
|
||||||
logger.i(message.notification!.body);
|
|
||||||
|
|
||||||
displayNotification(title: message.notification!.title ?? '', body: message.notification!.body ?? '');
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> displayNotification({required String title, required String body}) async {
|
|
||||||
const AndroidNotificationDetails androidNotificationDetails = AndroidNotificationDetails(
|
|
||||||
"0",
|
|
||||||
'mowater',
|
|
||||||
channelDescription: 'mowater_notifications',
|
|
||||||
importance: Importance.max,
|
|
||||||
priority: Priority.high,
|
|
||||||
ticker: 'ticker',
|
|
||||||
);
|
|
||||||
|
|
||||||
const DarwinNotificationDetails iOSPlatformChannelSpecifics = DarwinNotificationDetails(threadIdentifier: 'thread_id');
|
|
||||||
const NotificationDetails notificationDetails = NotificationDetails(android: androidNotificationDetails, iOS: iOSPlatformChannelSpecifics);
|
|
||||||
await flutterLocalNotifications.show(0, title, body, notificationDetails, payload: 'item x');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@pragma('vm:entry-point')
|
|
||||||
Future<dynamic> backgroundMessageHandler(RemoteMessage message) async {
|
|
||||||
await Firebase.initializeApp();
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue