Merge branch 'master' into mirza_hmg_wifi_phase_1
# Conflicts: # assets/langs/ar-SA.json # assets/langs/en-US.json # lib/generated/codegen_loader.g.dart # lib/generated/locale_keys.g.dart # lib/ui/login/login_screen.dart # lib/widgets/mark_attendance_widget.dartmirza_hmg_wifi_phase_1
commit
ab68388504
@ -0,0 +1,57 @@
|
||||
{
|
||||
"agcgw_all":{
|
||||
"CN":"connect-drcn.dbankcloud.cn",
|
||||
"CN_back":"connect-drcn.hispace.hicloud.com",
|
||||
"DE":"connect-dre.dbankcloud.cn",
|
||||
"DE_back":"connect-dre.hispace.hicloud.com",
|
||||
"RU":"connect-drru.hispace.dbankcloud.ru",
|
||||
"RU_back":"connect-drru.hispace.dbankcloud.cn",
|
||||
"SG":"connect-dra.dbankcloud.cn",
|
||||
"SG_back":"connect-dra.hispace.hicloud.com"
|
||||
},
|
||||
"websocketgw_all":{
|
||||
"CN":"connect-ws-drcn.hispace.dbankcloud.cn",
|
||||
"CN_back":"connect-ws-drcn.hispace.dbankcloud.com",
|
||||
"DE":"connect-ws-dre.hispace.dbankcloud.cn",
|
||||
"DE_back":"connect-ws-dre.hispace.dbankcloud.com",
|
||||
"RU":"connect-ws-drru.hispace.dbankcloud.ru",
|
||||
"RU_back":"connect-ws-drru.hispace.dbankcloud.cn",
|
||||
"SG":"connect-ws-dra.hispace.dbankcloud.cn",
|
||||
"SG_back":"connect-ws-dra.hispace.dbankcloud.com"
|
||||
},
|
||||
"client":{
|
||||
"cp_id":"2640966000002322881",
|
||||
"product_id":"737518067793559971",
|
||||
"client_id":"715996003571874624",
|
||||
"client_secret":"B5B89A56A53847C6BB9D216A8747E75952760DF9A8232239D8744CD847A8FFDA",
|
||||
"project_id":"737518067793559971",
|
||||
"app_id":"104737117",
|
||||
"api_key":"DAEDACKDrYgyco9mjPV9ZUjCSh1kCr/GBV0nseHH0z2mnxlZ41RksOKmyTi+PUTwmGEPK+VxCup4F9oUf4VbDnCsjB7aNBShYcjR+g==",
|
||||
"package_name":"hmg.cloudSolutions.mohem"
|
||||
},
|
||||
"oauth_client":{
|
||||
"client_id":"104737117",
|
||||
"client_type":1
|
||||
},
|
||||
"app_info":{
|
||||
"app_id":"104737117",
|
||||
"package_name":"hmg.cloudSolutions.mohem"
|
||||
},
|
||||
"configuration_version":"3.0",
|
||||
"appInfos":[
|
||||
{
|
||||
"package_name":"hmg.cloudSolutions.mohem",
|
||||
"client":{
|
||||
"app_id":"104737117"
|
||||
},
|
||||
"app_info":{
|
||||
"package_name":"hmg.cloudSolutions.mohem",
|
||||
"app_id":"104737117"
|
||||
},
|
||||
"oauth_client":{
|
||||
"client_type":1,
|
||||
"client_id":"104737117"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,21 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:just_audio/just_audio.dart';
|
||||
|
||||
class MyCustomStream extends StreamAudioSource {
|
||||
final Uint8List bytes;
|
||||
|
||||
MyCustomStream(this.bytes);
|
||||
|
||||
@override
|
||||
Future<StreamAudioResponse> request([int? start, int? end]) async {
|
||||
start ??= 0;
|
||||
end ??= bytes.length;
|
||||
return StreamAudioResponse(
|
||||
sourceLength: bytes.length,
|
||||
contentLength: end - start,
|
||||
offset: start,
|
||||
stream: Stream.value(bytes.sublist(start, end)),
|
||||
contentType: 'audio/aac',
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
class GetPRActionHistoryList {
|
||||
String? aCTION;
|
||||
String? aCTIONCODE;
|
||||
String? aPPROVALDATE;
|
||||
String? eMAILADDRESS;
|
||||
String? eMPLOYEEIMAGE;
|
||||
int? fROMROWNUM;
|
||||
String? nAME;
|
||||
String? nOTE;
|
||||
int? nOOFROWS;
|
||||
String? pOSITIONTITLE;
|
||||
int? rOWNUM;
|
||||
int? sEQUENCE;
|
||||
int? tOROWNUM;
|
||||
Null? uSERNAME;
|
||||
|
||||
GetPRActionHistoryList(
|
||||
{this.aCTION,
|
||||
this.aCTIONCODE,
|
||||
this.aPPROVALDATE,
|
||||
this.eMAILADDRESS,
|
||||
this.eMPLOYEEIMAGE,
|
||||
this.fROMROWNUM,
|
||||
this.nAME,
|
||||
this.nOTE,
|
||||
this.nOOFROWS,
|
||||
this.pOSITIONTITLE,
|
||||
this.rOWNUM,
|
||||
this.sEQUENCE,
|
||||
this.tOROWNUM,
|
||||
this.uSERNAME});
|
||||
|
||||
GetPRActionHistoryList.fromJson(Map<String, dynamic> json) {
|
||||
aCTION = json['ACTION'];
|
||||
aCTIONCODE = json['ACTION_CODE'];
|
||||
aPPROVALDATE = json['APPROVAL_DATE'];
|
||||
eMAILADDRESS = json['EMAIL_ADDRESS'];
|
||||
eMPLOYEEIMAGE = json['EMPLOYEE_IMAGE'];
|
||||
fROMROWNUM = json['FROM_ROW_NUM'];
|
||||
nAME = json['NAME'];
|
||||
nOTE = json['NOTE'];
|
||||
nOOFROWS = json['NO_OF_ROWS'];
|
||||
pOSITIONTITLE = json['POSITION_TITLE'];
|
||||
rOWNUM = json['ROW_NUM'];
|
||||
sEQUENCE = json['SEQUENCE'];
|
||||
tOROWNUM = json['TO_ROW_NUM'];
|
||||
uSERNAME = json['USER_NAME'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['ACTION'] = this.aCTION;
|
||||
data['ACTION_CODE'] = this.aCTIONCODE;
|
||||
data['APPROVAL_DATE'] = this.aPPROVALDATE;
|
||||
data['EMAIL_ADDRESS'] = this.eMAILADDRESS;
|
||||
data['EMPLOYEE_IMAGE'] = this.eMPLOYEEIMAGE;
|
||||
data['FROM_ROW_NUM'] = this.fROMROWNUM;
|
||||
data['NAME'] = this.nAME;
|
||||
data['NOTE'] = this.nOTE;
|
||||
data['NO_OF_ROWS'] = this.nOOFROWS;
|
||||
data['POSITION_TITLE'] = this.pOSITIONTITLE;
|
||||
data['ROW_NUM'] = this.rOWNUM;
|
||||
data['SEQUENCE'] = this.sEQUENCE;
|
||||
data['TO_ROW_NUM'] = this.tOROWNUM;
|
||||
data['USER_NAME'] = this.uSERNAME;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,125 @@
|
||||
class GetPRInformationList {
|
||||
List<PRHeader>? pRHeader;
|
||||
List<PRLines>? pRLines;
|
||||
String? pCURRENCYCODE;
|
||||
|
||||
GetPRInformationList({this.pRHeader, this.pRLines, this.pCURRENCYCODE});
|
||||
|
||||
GetPRInformationList.fromJson(Map<String, dynamic> json) {
|
||||
if (json['PRHeader'] != null) {
|
||||
pRHeader = <PRHeader>[];
|
||||
json['PRHeader'].forEach((v) {
|
||||
pRHeader!.add(new PRHeader.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['PRLines'] != null) {
|
||||
pRLines = <PRLines>[];
|
||||
json['PRLines'].forEach((v) {
|
||||
pRLines!.add(new PRLines.fromJson(v));
|
||||
});
|
||||
}
|
||||
pCURRENCYCODE = json['P_CURRENCY_CODE'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this.pRHeader != null) {
|
||||
data['PRHeader'] = this.pRHeader!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this.pRLines != null) {
|
||||
data['PRLines'] = this.pRLines!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['P_CURRENCY_CODE'] = this.pCURRENCYCODE;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class PRHeader {
|
||||
String? dESCRIPTION;
|
||||
String? pRNUMBER;
|
||||
String? rEQUISITIONTOTAL;
|
||||
String? tAXTOTAL;
|
||||
|
||||
PRHeader({this.dESCRIPTION, this.pRNUMBER, this.rEQUISITIONTOTAL, this.tAXTOTAL});
|
||||
|
||||
PRHeader.fromJson(Map<String, dynamic> json) {
|
||||
dESCRIPTION = json['DESCRIPTION'];
|
||||
pRNUMBER = json['PR_NUMBER'];
|
||||
rEQUISITIONTOTAL = json['REQUISITION_TOTAL'];
|
||||
tAXTOTAL = json['TAX_TOTAL'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['DESCRIPTION'] = this.dESCRIPTION;
|
||||
data['PR_NUMBER'] = this.pRNUMBER;
|
||||
data['REQUISITION_TOTAL'] = this.rEQUISITIONTOTAL;
|
||||
data['TAX_TOTAL'] = this.tAXTOTAL;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class PRLines {
|
||||
String? cOSTCENTER;
|
||||
String? dESCRIPTION;
|
||||
int? fROMROWNUM;
|
||||
int? iTEMAMU;
|
||||
String? iTEMCODE;
|
||||
int? lINEAMOUNT;
|
||||
int? lINENUM;
|
||||
int? nOOFROWS;
|
||||
int? qUANTITY;
|
||||
int? rOWNUM;
|
||||
int? tOROWNUM;
|
||||
int? uNITPRICE;
|
||||
String? uOM;
|
||||
|
||||
PRLines(
|
||||
{this.cOSTCENTER,
|
||||
this.dESCRIPTION,
|
||||
this.fROMROWNUM,
|
||||
this.iTEMAMU,
|
||||
this.iTEMCODE,
|
||||
this.lINEAMOUNT,
|
||||
this.lINENUM,
|
||||
this.nOOFROWS,
|
||||
this.qUANTITY,
|
||||
this.rOWNUM,
|
||||
this.tOROWNUM,
|
||||
this.uNITPRICE,
|
||||
this.uOM});
|
||||
|
||||
PRLines.fromJson(Map<String, dynamic> json) {
|
||||
cOSTCENTER = json['COST_CENTER'];
|
||||
dESCRIPTION = json['DESCRIPTION'];
|
||||
fROMROWNUM = json['FROM_ROW_NUM'];
|
||||
iTEMAMU = json['ITEM_AMU'];
|
||||
iTEMCODE = json['ITEM_CODE'];
|
||||
lINEAMOUNT = json['LINE_AMOUNT'];
|
||||
lINENUM = json['LINE_NUM'];
|
||||
nOOFROWS = json['NO_OF_ROWS'];
|
||||
qUANTITY = json['QUANTITY'];
|
||||
rOWNUM = json['ROW_NUM'];
|
||||
tOROWNUM = json['TO_ROW_NUM'];
|
||||
uNITPRICE = json['UNIT_PRICE'];
|
||||
uOM = json['UOM'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['COST_CENTER'] = this.cOSTCENTER;
|
||||
data['DESCRIPTION'] = this.dESCRIPTION;
|
||||
data['FROM_ROW_NUM'] = this.fROMROWNUM;
|
||||
data['ITEM_AMU'] = this.iTEMAMU;
|
||||
data['ITEM_CODE'] = this.iTEMCODE;
|
||||
data['LINE_AMOUNT'] = this.lINEAMOUNT;
|
||||
data['LINE_NUM'] = this.lINENUM;
|
||||
data['NO_OF_ROWS'] = this.nOOFROWS;
|
||||
data['QUANTITY'] = this.qUANTITY;
|
||||
data['ROW_NUM'] = this.rOWNUM;
|
||||
data['TO_ROW_NUM'] = this.tOROWNUM;
|
||||
data['UNIT_PRICE'] = this.uNITPRICE;
|
||||
data['UOM'] = this.uOM;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,148 @@
|
||||
class SurveyModel {
|
||||
int? surveyId;
|
||||
String? referenceNo;
|
||||
String? title;
|
||||
String? description;
|
||||
List<Questions>? questions;
|
||||
bool? isActive;
|
||||
Null? pageSize;
|
||||
Null? pageNo;
|
||||
Null? languageId;
|
||||
|
||||
SurveyModel({this.surveyId, this.referenceNo, this.title, this.description, this.questions, this.isActive, this.pageSize, this.pageNo, this.languageId});
|
||||
|
||||
SurveyModel.fromJson(Map<String, dynamic> json) {
|
||||
surveyId = json['surveyId'];
|
||||
referenceNo = json['referenceNo'];
|
||||
title = json['title'];
|
||||
description = json['description'];
|
||||
if (json['questions'] != null) {
|
||||
questions = <Questions>[];
|
||||
json['questions'].forEach((v) {
|
||||
questions!.add(new Questions.fromJson(v));
|
||||
});
|
||||
}
|
||||
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['surveyId'] = this.surveyId;
|
||||
data['referenceNo'] = this.referenceNo;
|
||||
data['title'] = this.title;
|
||||
data['description'] = this.description;
|
||||
if (this.questions != null) {
|
||||
data['questions'] = this.questions!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['isActive'] = this.isActive;
|
||||
data['pageSize'] = this.pageSize;
|
||||
data['pageNo'] = this.pageNo;
|
||||
data['languageId'] = this.languageId;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Questions {
|
||||
int? questionId;
|
||||
String? title;
|
||||
bool? isRequired;
|
||||
String? type;
|
||||
int? sequenceNo;
|
||||
Null? surveyId;
|
||||
List<Options>? options;
|
||||
Null? rspPercentage;
|
||||
Null? isActive;
|
||||
Null? pageSize;
|
||||
Null? pageNo;
|
||||
Null? languageId;
|
||||
|
||||
Questions({this.questionId, this.title, this.isRequired, this.type, this.sequenceNo, this.surveyId, this.options, this.rspPercentage, this.isActive, this.pageSize, this.pageNo, this.languageId});
|
||||
|
||||
Questions.fromJson(Map<String, dynamic> json) {
|
||||
questionId = json['questionId'];
|
||||
title = json['title'];
|
||||
isRequired = json['isRequired'];
|
||||
type = json['type'];
|
||||
sequenceNo = json['sequenceNo'];
|
||||
surveyId = json['surveyId'];
|
||||
if (json['options'] != null) {
|
||||
options = <Options>[];
|
||||
json['options'].forEach((v) {
|
||||
options!.add(new Options.fromJson(v));
|
||||
});
|
||||
}
|
||||
rspPercentage = json['rspPercentage'];
|
||||
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['questionId'] = this.questionId;
|
||||
data['title'] = this.title;
|
||||
data['isRequired'] = this.isRequired;
|
||||
data['type'] = this.type;
|
||||
data['sequenceNo'] = this.sequenceNo;
|
||||
data['surveyId'] = this.surveyId;
|
||||
if (this.options != null) {
|
||||
data['options'] = this.options!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['rspPercentage'] = this.rspPercentage;
|
||||
data['isActive'] = this.isActive;
|
||||
data['pageSize'] = this.pageSize;
|
||||
data['pageNo'] = this.pageNo;
|
||||
data['languageId'] = this.languageId;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Options {
|
||||
int? optionId;
|
||||
String? title;
|
||||
bool? isCommentsRequired;
|
||||
int? sequenceNo;
|
||||
int? questionId;
|
||||
Null? rspPercentage;
|
||||
Null? count;
|
||||
Null? isActive;
|
||||
Null? pageSize;
|
||||
Null? pageNo;
|
||||
Null? languageId;
|
||||
|
||||
Options({this.optionId, this.title, this.isCommentsRequired, this.sequenceNo, this.questionId, this.rspPercentage, this.count, this.isActive, this.pageSize, this.pageNo, this.languageId});
|
||||
|
||||
Options.fromJson(Map<String, dynamic> json) {
|
||||
optionId = json['optionId'];
|
||||
title = json['title'];
|
||||
isCommentsRequired = json['isCommentsRequired'];
|
||||
sequenceNo = json['sequenceNo'];
|
||||
questionId = json['questionId'];
|
||||
rspPercentage = json['rspPercentage'];
|
||||
count = json['count'];
|
||||
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['optionId'] = this.optionId;
|
||||
data['title'] = this.title;
|
||||
data['isCommentsRequired'] = this.isCommentsRequired;
|
||||
data['sequenceNo'] = this.sequenceNo;
|
||||
data['questionId'] = this.questionId;
|
||||
data['rspPercentage'] = this.rspPercentage;
|
||||
data['count'] = this.count;
|
||||
data['isActive'] = this.isActive;
|
||||
data['pageSize'] = this.pageSize;
|
||||
data['pageNo'] = this.pageNo;
|
||||
data['languageId'] = this.languageId;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,187 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_webrtc/flutter_webrtc.dart';
|
||||
import 'package:mohem_flutter_app/ui/landing/dashboard_screen.dart';
|
||||
|
||||
class ChatCallProvider with ChangeNotifier, DiagnosticableTreeMixin {
|
||||
///////////////////// Web RTC Video Calling //////////////////////
|
||||
// Video Call
|
||||
late RTCPeerConnection _peerConnection;
|
||||
RTCVideoRenderer _localVideoRenderer = RTCVideoRenderer();
|
||||
final RTCVideoRenderer _remoteRenderer = RTCVideoRenderer();
|
||||
|
||||
MediaStream? _localStream;
|
||||
MediaStream? _remoteStream;
|
||||
|
||||
void initCallListeners() {
|
||||
chatHubConnection.on("OnCallAcceptedAsync", onCallAcceptedAsync);
|
||||
chatHubConnection.on("OnIceCandidateAsync", onIceCandidateAsync);
|
||||
chatHubConnection.on("OnOfferAsync", onOfferAsync);
|
||||
chatHubConnection.on("OnAnswerOffer", onAnswerOffer);
|
||||
chatHubConnection.on("OnHangUpAsync", onHangUpAsync);
|
||||
chatHubConnection.on("OnCallDeclinedAsync", onCallDeclinedAsync);
|
||||
}
|
||||
|
||||
//Video Constraints
|
||||
var videoConstraints = {
|
||||
"video": {
|
||||
"mandatory": {
|
||||
"width": {"min": 320},
|
||||
"height": {"min": 180}
|
||||
},
|
||||
"optional": [
|
||||
{
|
||||
"width": {"max": 1280}
|
||||
},
|
||||
{"frameRate": 25},
|
||||
{"facingMode": "user"}
|
||||
]
|
||||
},
|
||||
"frameRate": 25,
|
||||
"width": 420, //420,//640,//1280,
|
||||
"height": 240 //240//480//720
|
||||
};
|
||||
|
||||
// Audio Constraints
|
||||
var audioConstraints = {
|
||||
"sampleRate": 8000,
|
||||
"sampleSize": 16,
|
||||
"channelCount": 2,
|
||||
"echoCancellation": true,
|
||||
"audio": true,
|
||||
};
|
||||
|
||||
Future<RTCPeerConnection> _createPeerConnection() async {
|
||||
// {"url": "stun:stun.l.google.com:19302"},
|
||||
Map<String, dynamic> configuration = {
|
||||
"iceServers": [
|
||||
{"urls": 'stun:15.185.116.59:3478'},
|
||||
{"urls": "turn:15.185.116.59:3479", "username": "admin", "credential": "admin"}
|
||||
]
|
||||
};
|
||||
|
||||
Map<String, dynamic> offerSdpConstraints = {
|
||||
"mandatory": {
|
||||
"OfferToReceiveAudio": true,
|
||||
"OfferToReceiveVideo": true,
|
||||
},
|
||||
"optional": [],
|
||||
};
|
||||
|
||||
RTCPeerConnection pc = await createPeerConnection(configuration, offerSdpConstraints);
|
||||
// if (pc != null) print(pc);
|
||||
//pc.addStream(widget.localStream);
|
||||
|
||||
pc.onIceCandidate = (e) {
|
||||
if (e.candidate != null) {
|
||||
print(json.encode({
|
||||
'candidate': e.candidate.toString(),
|
||||
'sdpMid': e.sdpMid.toString(),
|
||||
'sdpMlineIndex': e.sdpMLineIndex,
|
||||
}));
|
||||
}
|
||||
};
|
||||
pc.onIceConnectionState = (e) {
|
||||
print(e);
|
||||
};
|
||||
pc.onAddStream = (stream) {
|
||||
print('addStream: ' + stream.id);
|
||||
_remoteRenderer.srcObject = stream;
|
||||
};
|
||||
return pc;
|
||||
}
|
||||
|
||||
void init() {
|
||||
initRenderers();
|
||||
_createPeerConnection().then((pc) {
|
||||
_peerConnection = pc;
|
||||
// _setRemoteDescription(widget.info);
|
||||
});
|
||||
}
|
||||
|
||||
void initRenderers() {
|
||||
_localVideoRenderer.initialize();
|
||||
_remoteRenderer.initialize();
|
||||
initLocalCamera();
|
||||
}
|
||||
|
||||
void initLocalCamera() async {
|
||||
_localStream = await navigator.mediaDevices.getUserMedia({'video': true, 'audio': true});
|
||||
_localVideoRenderer.srcObject = _localStream;
|
||||
// _localVideoRenderer.srcObject = await navigator.mediaDevices
|
||||
// .getUserMedia({'video': true, 'audio': true});
|
||||
print('this source Object');
|
||||
print('this suarce ${_localVideoRenderer.srcObject != null}');
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void startCall({required String callType}) {}
|
||||
|
||||
void endCall() {}
|
||||
|
||||
void checkCall(Map<String, dynamic> message) {
|
||||
switch (message["callStatus"]) {
|
||||
case 'connected':
|
||||
{}
|
||||
break;
|
||||
case 'offer':
|
||||
{}
|
||||
break;
|
||||
case 'accept':
|
||||
{}
|
||||
break;
|
||||
case 'candidate':
|
||||
{}
|
||||
break;
|
||||
case 'bye':
|
||||
{}
|
||||
break;
|
||||
case 'leave':
|
||||
{}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//// Listeners Methods ////
|
||||
|
||||
void onCallAcceptedAsync(List<Object?>? params) {}
|
||||
|
||||
void onIceCandidateAsync(List<Object?>? params) {}
|
||||
|
||||
void onOfferAsync(List<Object?>? params) {}
|
||||
|
||||
void onAnswerOffer(List<Object?>? params) {}
|
||||
|
||||
void onHangUpAsync(List<Object?>? params) {}
|
||||
|
||||
void onCallDeclinedAsync(List<Object?>? params) {}
|
||||
|
||||
//// Invoke Methods
|
||||
|
||||
Future<void> invoke({required String invokeMethod, required String currentUserID, required String targetUserID, bool isVideoCall = false, var data}) async {
|
||||
List<Object> args = [];
|
||||
if (invokeMethod == "answerCallAsync") {
|
||||
args = [currentUserID, targetUserID];
|
||||
} else if (invokeMethod == "CallUserAsync") {
|
||||
args = [currentUserID, targetUserID, isVideoCall];
|
||||
} else if (invokeMethod == "IceCandidateAsync") {
|
||||
args = [targetUserID, data];
|
||||
} else if (invokeMethod == "OfferAsync") {
|
||||
args = [targetUserID, data];
|
||||
} else if (invokeMethod == "AnswerOfferAsync") {
|
||||
args = [targetUserID, data];
|
||||
//json In Data
|
||||
}
|
||||
await chatHubConnection.invoke(invokeMethod, args: args);
|
||||
}
|
||||
|
||||
void stopListeners() async {
|
||||
chatHubConnection.off('OnCallDeclinedAsync');
|
||||
chatHubConnection.off('OnCallAcceptedAsync');
|
||||
chatHubConnection.off('OnIceCandidateAsync');
|
||||
chatHubConnection.off('OnAnswerOffer');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
class CustomAutoDirection extends StatefulWidget {
|
||||
final String text;
|
||||
final Widget child;
|
||||
final void Function(bool isRTL)? onDirectionChange;
|
||||
|
||||
const CustomAutoDirection({Key? key, required this.text, required this.child, this.onDirectionChange}) : super(key: key);
|
||||
|
||||
@override
|
||||
_CustomAutoDirectionState createState() => _CustomAutoDirectionState();
|
||||
}
|
||||
|
||||
class _CustomAutoDirectionState extends State<CustomAutoDirection> {
|
||||
late String text;
|
||||
late Widget childWidget;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
text = widget.text;
|
||||
childWidget = widget.child;
|
||||
return Directionality(textDirection: isRTL(text) ? TextDirection.rtl : TextDirection.ltr, child: childWidget);
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(CustomAutoDirection oldWidget) {
|
||||
if (isRTL(oldWidget.text) != isRTL(widget.text)) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => widget.onDirectionChange?.call(isRTL(widget.text)));
|
||||
}
|
||||
super.didUpdateWidget(oldWidget);
|
||||
}
|
||||
|
||||
bool isRTL(String text) {
|
||||
if (text.isEmpty) return Directionality.of(context) == TextDirection.rtl;
|
||||
return intl.Bidi.detectRtlDirectionality(text);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,166 @@
|
||||
import 'package:easy_localization/src/public_ext.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mohem_flutter_app/api/login_api_client.dart';
|
||||
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
||||
import 'package:mohem_flutter_app/classes/colors.dart';
|
||||
import 'package:mohem_flutter_app/classes/utils.dart';
|
||||
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
||||
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
||||
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
||||
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
||||
import 'package:mohem_flutter_app/models/generic_response_model.dart';
|
||||
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
|
||||
import 'package:mohem_flutter_app/widgets/input_widget.dart';
|
||||
|
||||
class ChangeItgAdPasswordScreen extends StatefulWidget {
|
||||
ChangeItgAdPasswordScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ChangeItgAdPasswordScreenState createState() {
|
||||
return _ChangeItgAdPasswordScreenState();
|
||||
}
|
||||
}
|
||||
|
||||
class _ChangeItgAdPasswordScreenState extends State<ChangeItgAdPasswordScreen> {
|
||||
TextEditingController password = TextEditingController();
|
||||
TextEditingController confirmPassword = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void setNewPassword() async {
|
||||
Utils.showLoading(context);
|
||||
try {
|
||||
GenericResponseModel response = await LoginApiClient().changePasswordFromActiveDirectorySession(password.text, AppState().memberInformationList!.eMPLOYEEEMAILADDRESS!);
|
||||
Utils.hideLoading(context);
|
||||
if ((response.messageStatus ?? 0) == 1) {
|
||||
Utils.showToast(LocaleKeys.passwordChangedSuccessfully.tr());
|
||||
Navigator.pop(context);
|
||||
}
|
||||
} catch (ex) {
|
||||
Utils.hideLoading(context);
|
||||
Utils.handleException(ex, context, (msg) {
|
||||
Utils.confirmDialog(context, msg);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
ListView(
|
||||
padding: const EdgeInsets.all(21),
|
||||
children: [
|
||||
LocaleKeys.changePassword.tr().toText24(isBold: true),
|
||||
LocaleKeys.typeYourNewActiveDirectoryPasswordBelow.tr().toText16(),
|
||||
16.height,
|
||||
InputWidget(
|
||||
LocaleKeys.password.tr(),
|
||||
"**********",
|
||||
password,
|
||||
onChange: (value) {
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
12.height,
|
||||
InputWidget(
|
||||
LocaleKeys.confirmPassword.tr(),
|
||||
"**********",
|
||||
confirmPassword,
|
||||
isTextIsPassword: true,
|
||||
onChange: (value) {
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
16.height,
|
||||
passwordConstraintsUI(LocaleKeys.doNotUseRecentPassword.tr(), true),
|
||||
8.height,
|
||||
passwordConstraintsUI(LocaleKeys.atLeastOneLowercase.tr(), checkRegEx(r'[a-z]')),
|
||||
// 8.height,
|
||||
// passwordConstraintsUI(LocaleKeys.atLeastOneUppercase.tr(), checkRegEx(r'[A-Z]')),
|
||||
8.height,
|
||||
passwordConstraintsUI(LocaleKeys.atLeastOneNumeric.tr(), checkRegEx(r'[0-9]')),
|
||||
8.height,
|
||||
passwordConstraintsUI(LocaleKeys.minimum8Characters.tr(), password.text.length >= 8),
|
||||
8.height,
|
||||
passwordConstraintsUI(LocaleKeys.doNotAddRepeatingLetters.tr(), checkRepeatedChars(password.text)),
|
||||
// 8.height,
|
||||
// passwordConstraintsUI(LocaleKeys.itShouldContainSpecialCharacter.tr(), checkRegEx(r'[!@#$%^&*(),.?":{}|<>]')),
|
||||
8.height,
|
||||
passwordConstraintsUI(LocaleKeys.confirmPasswordMustMatch.tr(), password.text.isNotEmpty && password.text == confirmPassword.text),
|
||||
],
|
||||
).expanded,
|
||||
DefaultButton(LocaleKeys.changePassword.tr(), (!isPasswordCompliant(password.text, 8)) ? null : setNewPassword).insideContainer
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
bool checkRegEx(String pattern) {
|
||||
return RegExp(pattern).hasMatch(password.text);
|
||||
}
|
||||
|
||||
String recentPassword = "";
|
||||
|
||||
bool isPasswordCompliant(String? password, int minLength) {
|
||||
if (password == null || password.isEmpty) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// bool hasUppercase = password.contains(RegExp(r'[A-Z]'));
|
||||
bool hasDigits = password.contains(RegExp(r'[0-9]'));
|
||||
bool hasLowercase = password.contains(RegExp(r'[a-z]'));
|
||||
// bool hasSpecialCharacters = password.contains(RegExp(r'[!@#$%^&*(),.?":{}|<>]'));
|
||||
bool hasMinLength = password.length >= minLength;
|
||||
bool isMatched = password == confirmPassword.text;
|
||||
|
||||
return hasDigits && hasLowercase && hasMinLength && isMatched && checkRepeatedChars(password);
|
||||
}
|
||||
|
||||
bool checkRepeatedChars(String password) {
|
||||
bool isNonRepeatedLetters = true;
|
||||
if (password.length > 2) {
|
||||
for (int i = 0; i < password.length; i++) {
|
||||
String char = password[i];
|
||||
try {
|
||||
if (char == password[i + 1]) {
|
||||
isNonRepeatedLetters = false;
|
||||
break;
|
||||
}
|
||||
} catch (ex) {}
|
||||
}
|
||||
}
|
||||
return isNonRepeatedLetters;
|
||||
}
|
||||
|
||||
Widget passwordConstraintsUI(String description, bool check) {
|
||||
return Row(
|
||||
children: [
|
||||
4.width,
|
||||
SizedBox(
|
||||
width: 12,
|
||||
height: 12,
|
||||
child: Checkbox(fillColor: MaterialStateProperty.all(MyColors.gradiantEndColor), shape: const CircleBorder(), value: check, onChanged: null),
|
||||
),
|
||||
8.width,
|
||||
description.toText14()
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue