Merge branch 'master' into faiz_cs
commit
f72f49c719
@ -1,59 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
|
||||||
|
|
||||||
// |--> Push Notification Background
|
|
||||||
Future<dynamic> backgroundMessageHandler(message) async {
|
|
||||||
print("Firebase backgroundMessageHandler!!!");
|
|
||||||
}
|
|
||||||
|
|
||||||
class PushNotificationHandler {
|
|
||||||
final BuildContext context;
|
|
||||||
static PushNotificationHandler? _instance;
|
|
||||||
|
|
||||||
PushNotificationHandler(this.context) {
|
|
||||||
PushNotificationHandler._instance = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PushNotificationHandler getInstance() => _instance!;
|
|
||||||
|
|
||||||
void init() async {
|
|
||||||
FirebaseMessaging.onMessage.listen((RemoteMessage message) async {
|
|
||||||
if (Platform.isIOS) {
|
|
||||||
await Future.delayed(Duration(milliseconds: 3000)).then((value) {
|
|
||||||
newMessage(message);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
newMessage(message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) async {
|
|
||||||
if (Platform.isIOS) {
|
|
||||||
await Future.delayed(Duration(milliseconds: 3000)).then((value) {
|
|
||||||
newMessage(message);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
newMessage(message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
FirebaseMessaging.instance.onTokenRefresh.listen((fcm_token) {
|
|
||||||
print("Push Notification onTokenRefresh: " + fcm_token);
|
|
||||||
AppState().setDeviceToken = fcm_token;
|
|
||||||
});
|
|
||||||
|
|
||||||
FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
void newMessage(RemoteMessage remoteMessage) async {
|
|
||||||
print("Remote Message: " + remoteMessage.data.toString());
|
|
||||||
if (remoteMessage.data.isEmpty) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,96 +1,192 @@
|
|||||||
class OffersListModel {
|
class OffersListModel {
|
||||||
String? title;
|
int? offersDiscountId;
|
||||||
String? titleAR;
|
String? titleEn;
|
||||||
String? description;
|
String? titleAr;
|
||||||
String? descriptionAR;
|
String? descriptionEn;
|
||||||
|
String? descriptionAr;
|
||||||
String? startDate;
|
String? startDate;
|
||||||
String? endDate;
|
String? endDate;
|
||||||
String? logo;
|
int? categoryId;
|
||||||
String? bannerImage;
|
|
||||||
String? discount;
|
|
||||||
String? rowID;
|
|
||||||
String? categoryNameEn;
|
String? categoryNameEn;
|
||||||
String? categoryNameAr;
|
String? categoryNameAr;
|
||||||
String? categoryID;
|
String? discount;
|
||||||
String? isHasLocation;
|
String? location;
|
||||||
|
int? statusId;
|
||||||
|
String? statusTitle;
|
||||||
|
bool? isHasLocation;
|
||||||
|
String? discountDescription;
|
||||||
|
String? websiteUrl;
|
||||||
|
bool? bookMarked;
|
||||||
|
bool? isHotDeal;
|
||||||
|
List<OffersDiscountImageColl>? offersDiscountImageColl;
|
||||||
|
dynamic locationList;
|
||||||
String? created;
|
String? created;
|
||||||
String? publishedDesc;
|
String? bannerImage;
|
||||||
String? published;
|
String? logo;
|
||||||
String? expireAfter;
|
bool? isActive;
|
||||||
String? status;
|
int? pageSize;
|
||||||
String? isActive;
|
int? pageNo;
|
||||||
String? totalItems;
|
int? languageId;
|
||||||
|
|
||||||
OffersListModel(
|
OffersListModel(
|
||||||
{this.title,
|
{this.offersDiscountId,
|
||||||
this.titleAR,
|
this.titleEn,
|
||||||
this.description,
|
this.titleAr,
|
||||||
this.descriptionAR,
|
this.descriptionEn,
|
||||||
this.startDate,
|
this.descriptionAr,
|
||||||
this.endDate,
|
this.startDate,
|
||||||
this.logo,
|
this.endDate,
|
||||||
this.bannerImage,
|
this.categoryId,
|
||||||
this.discount,
|
this.categoryNameEn,
|
||||||
this.rowID,
|
this.categoryNameAr,
|
||||||
this.categoryNameEn,
|
this.discount,
|
||||||
this.categoryNameAr,
|
this.location,
|
||||||
this.categoryID,
|
this.statusId,
|
||||||
this.isHasLocation,
|
this.statusTitle,
|
||||||
this.created,
|
this.isHasLocation,
|
||||||
this.publishedDesc,
|
this.discountDescription,
|
||||||
this.published,
|
this.websiteUrl,
|
||||||
this.expireAfter,
|
this.bookMarked,
|
||||||
this.status,
|
this.isHotDeal,
|
||||||
this.isActive,
|
this.offersDiscountImageColl,
|
||||||
this.totalItems});
|
this.locationList,
|
||||||
|
this.created,
|
||||||
|
this.bannerImage,
|
||||||
|
this.logo,
|
||||||
|
this.isActive,
|
||||||
|
this.pageSize,
|
||||||
|
this.pageNo,
|
||||||
|
this.languageId});
|
||||||
|
|
||||||
OffersListModel.fromJson(Map<String, dynamic> json) {
|
OffersListModel.fromJson(Map<String, dynamic> json) {
|
||||||
title = json['Title'];
|
offersDiscountId = json['offersDiscountId'];
|
||||||
titleAR = json['Title_AR'];
|
titleEn = json['titleEn'];
|
||||||
description = json['Description'];
|
titleAr = json['titleAr'];
|
||||||
descriptionAR = json['Description_AR'];
|
descriptionEn = json['descriptionEn'];
|
||||||
startDate = json['Start Date'];
|
descriptionAr = json['descriptionAr'];
|
||||||
endDate = json['End Date'];
|
startDate = json['startDate'];
|
||||||
logo = json['Logo'];
|
endDate = json['endDate'];
|
||||||
bannerImage = json['Banner_Image'];
|
categoryId = json['categoryId'];
|
||||||
discount = json['Discount'];
|
|
||||||
rowID = json['rowID'];
|
|
||||||
categoryNameEn = json['categoryName_en'];
|
categoryNameEn = json['categoryName_en'];
|
||||||
categoryNameAr = json['categoryName_ar'];
|
categoryNameAr = json['categoryName_ar'];
|
||||||
categoryID = json['categoryID'];
|
discount = json['discount'];
|
||||||
isHasLocation = json['IsHasLocation'];
|
location = json['location'];
|
||||||
|
statusId = json['statusId'];
|
||||||
|
statusTitle = json['statusTitle'];
|
||||||
|
isHasLocation = json['isHasLocation'];
|
||||||
|
discountDescription = json['discountDescription'];
|
||||||
|
websiteUrl = json['websiteUrl'];
|
||||||
|
bookMarked = json['bookMarked'];
|
||||||
|
isHotDeal = json['isHotDeal'];
|
||||||
|
if (json['offersDiscountImageColl'] != null) {
|
||||||
|
offersDiscountImageColl = <OffersDiscountImageColl>[];
|
||||||
|
json['offersDiscountImageColl'].forEach((v) {
|
||||||
|
offersDiscountImageColl!.add(new OffersDiscountImageColl.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
locationList = json['locationList'];
|
||||||
created = json['created'];
|
created = json['created'];
|
||||||
publishedDesc = json['PublishedDesc'];
|
bannerImage = json['banner_Image'];
|
||||||
published = json['Published'];
|
logo = json['logo'];
|
||||||
expireAfter = json['ExpireAfter'];
|
isActive = json['isActive'];
|
||||||
status = json['Status'];
|
pageSize = json['pageSize'];
|
||||||
isActive = json['IsActive'];
|
pageNo = json['pageNo'];
|
||||||
totalItems = json['TotalItems'];
|
languageId = json['languageId'];
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
Map<String, dynamic> data = new Map<String, dynamic>();
|
Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
data['Title'] = this.title;
|
data['offersDiscountId'] = this.offersDiscountId;
|
||||||
data['Title_AR'] = this.titleAR;
|
data['titleEn'] = this.titleEn;
|
||||||
data['Description'] = this.description;
|
data['titleAr'] = this.titleAr;
|
||||||
data['Description_AR'] = this.descriptionAR;
|
data['descriptionEn'] = this.descriptionEn;
|
||||||
data['Start Date'] = this.startDate;
|
data['descriptionAr'] = this.descriptionAr;
|
||||||
data['End Date'] = this.endDate;
|
data['startDate'] = this.startDate;
|
||||||
data['Logo'] = this.logo;
|
data['endDate'] = this.endDate;
|
||||||
data['Banner_Image'] = this.bannerImage;
|
data['categoryId'] = this.categoryId;
|
||||||
data['Discount'] = this.discount;
|
|
||||||
data['rowID'] = this.rowID;
|
|
||||||
data['categoryName_en'] = this.categoryNameEn;
|
data['categoryName_en'] = this.categoryNameEn;
|
||||||
data['categoryName_ar'] = this.categoryNameAr;
|
data['categoryName_ar'] = this.categoryNameAr;
|
||||||
data['categoryID'] = this.categoryID;
|
data['discount'] = this.discount;
|
||||||
data['IsHasLocation'] = this.isHasLocation;
|
data['location'] = this.location;
|
||||||
|
data['statusId'] = this.statusId;
|
||||||
|
data['statusTitle'] = this.statusTitle;
|
||||||
|
data['isHasLocation'] = this.isHasLocation;
|
||||||
|
data['discountDescription'] = this.discountDescription;
|
||||||
|
data['websiteUrl'] = this.websiteUrl;
|
||||||
|
data['bookMarked'] = this.bookMarked;
|
||||||
|
data['isHotDeal'] = this.isHotDeal;
|
||||||
|
if (this.offersDiscountImageColl != null) {
|
||||||
|
data['offersDiscountImageColl'] = this.offersDiscountImageColl!.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
data['locationList'] = this.locationList;
|
||||||
data['created'] = this.created;
|
data['created'] = this.created;
|
||||||
data['PublishedDesc'] = this.publishedDesc;
|
data['banner_Image'] = this.bannerImage;
|
||||||
data['Published'] = this.published;
|
data['logo'] = this.logo;
|
||||||
data['ExpireAfter'] = this.expireAfter;
|
data['isActive'] = this.isActive;
|
||||||
data['Status'] = this.status;
|
data['pageSize'] = this.pageSize;
|
||||||
data['IsActive'] = this.isActive;
|
data['pageNo'] = this.pageNo;
|
||||||
data['TotalItems'] = this.totalItems;
|
data['languageId'] = this.languageId;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class OffersDiscountImageColl {
|
||||||
|
int? imageAttachmentId;
|
||||||
|
String? fileName;
|
||||||
|
String? contentType;
|
||||||
|
String? attachFileStream;
|
||||||
|
String? base64String;
|
||||||
|
int? referenceItemId;
|
||||||
|
String? filePath;
|
||||||
|
String? imageTag;
|
||||||
|
bool? isActive;
|
||||||
|
int? pageSize;
|
||||||
|
int? pageNo;
|
||||||
|
int? languageId;
|
||||||
|
|
||||||
|
OffersDiscountImageColl(
|
||||||
|
{this.imageAttachmentId,
|
||||||
|
this.fileName,
|
||||||
|
this.contentType,
|
||||||
|
this.attachFileStream,
|
||||||
|
this.base64String,
|
||||||
|
this.referenceItemId,
|
||||||
|
this.filePath,
|
||||||
|
this.imageTag,
|
||||||
|
this.isActive,
|
||||||
|
this.pageSize,
|
||||||
|
this.pageNo,
|
||||||
|
this.languageId});
|
||||||
|
|
||||||
|
OffersDiscountImageColl.fromJson(Map<String, dynamic> json) {
|
||||||
|
imageAttachmentId = json['imageAttachmentId'];
|
||||||
|
fileName = json['fileName'];
|
||||||
|
contentType = json['contentType'];
|
||||||
|
attachFileStream = json['attachFileStream'];
|
||||||
|
base64String = json['base64String'];
|
||||||
|
referenceItemId = json['referenceItemId'];
|
||||||
|
filePath = json['filePath'];
|
||||||
|
imageTag = json['imageTag'];
|
||||||
|
isActive = json['isActive'];
|
||||||
|
pageSize = json['pageSize'];
|
||||||
|
pageNo = json['pageNo'];
|
||||||
|
languageId = json['languageId'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['imageAttachmentId'] = this.imageAttachmentId;
|
||||||
|
data['fileName'] = this.fileName;
|
||||||
|
data['contentType'] = this.contentType;
|
||||||
|
data['attachFileStream'] = this.attachFileStream;
|
||||||
|
data['base64String'] = this.base64String;
|
||||||
|
data['referenceItemId'] = this.referenceItemId;
|
||||||
|
data['filePath'] = this.filePath;
|
||||||
|
data['imageTag'] = this.imageTag;
|
||||||
|
data['isActive'] = this.isActive;
|
||||||
|
data['pageSize'] = this.pageSize;
|
||||||
|
data['pageNo'] = this.pageNo;
|
||||||
|
data['languageId'] = this.languageId;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue