copied src from mohemm cs

MOHEMM-Q3-DEV-LATEST
umasoodch 4 years ago
parent a7b7b28cf1
commit 1ac6483d67

@ -1,29 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<plugin id="com.huawei.cordovahmsgmscheckplugin" version="1.0.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>CordovaHMSGMSCheckPlugin</name>
<js-module name="CordovaHMSGMSCheckPlugin" src="www/CordovaHMSGMSCheckPlugin.js">
<clobbers target="cordova.plugins.CordovaHMSGMSCheckPlugin" />
</js-module>
<platform name="android">
<!-- hook for add maven repositories and agc plugin-->
<hook src="scripts/android/after_plugin_install.js" type="after_plugin_install" />
<hook src="scripts/android/before_plugin_uninstall.js" type="before_plugin_uninstall" />
<framework custom="true" src="src/android/build.gradle" type="gradleReference" />
<!-- Account Kit dependency-->
<framework src="com.huawei.hms:base:5.0.4.301" />
<!-- <framework src="com.google.android.gms:play-services-base:17.2.1" /> -->
<config-file parent="/*" target="res/xml/config.xml">
<feature name="CordovaHMSGMSCheckPlugin">
<param name="android-package"
value="com.huawei.cordovahmsgmscheckplugin.CordovaHMSGMSCheckPlugin" />
</feature>
</config-file>
<config-file parent="/*" target="AndroidManifest.xml"></config-file>
<source-file src="src/android/CordovaHMSGMSCheckPlugin.java"
target-dir="src/com/huawei/cordovahmsgmscheckplugin" />
</platform>
<!-- Script help to copy agconnect-services.json to right places-->
<hook src="scripts/after_prepare.js" type="after_prepare" />
</plugin>

@ -1,37 +0,0 @@
#!/usr/bin/env node
"use strict";
/**
* This hook makes sure projects using [cordova-plugin-firebase](https://github.com/arnesson/cordova-plugin-firebase)
* will build properly and have the required key files copied to the proper destinations when the app is build on Ionic Cloud using the package command.
* Credits: https://github.com/arnesson.
*/
var fs = require("fs");
var path = require("path");
var utilities = require("./lib/utilities");
var config = fs.readFileSync("config.xml").toString();
var name = utilities.getValue(config, "name");
var ANDROID_DIR = "platforms/android";
var PLATFORM = {
ANDROID: {
dest: [ANDROID_DIR + "/app/agconnect-services.json"],
src: ["agconnect-services.json"],
},
};
module.exports = function (context) {
//get platform from the context supplied by cordova
var platforms = context.opts.platforms;
// Copy key files to their platform specific folders
if (
platforms.indexOf("android") !== -1 &&
utilities.directoryExists(ANDROID_DIR)
) {
console.log("Preparing HMS GMS Check Kit on Android");
// utilities.copyKey(PLATFORM.ANDROID);
}
};

@ -1,9 +0,0 @@
var helper = require('./helper');
module.exports = function(context) {
// Modify the Gradle build file to add a task that will upload the debug symbols
// at build time.
helper.restoreRootBuildGradle();
helper.modifyRootBuildGradle();
};

@ -1,7 +0,0 @@
var helper = require('./helper');
module.exports = function(context) {
// Remove the Gradle modifications that were added when the plugin was installed.
helper.restoreRootBuildGradle();
};

@ -1,131 +0,0 @@
var fs = require("fs");
var path = require("path");
function rootBuildGradleExists() {
var target = path.join("platforms", "android", "build.gradle");
return fs.existsSync(target);
}
/*
* Helper function to read the build.gradle that sits at the root of the project
*/
function readRootBuildGradle() {
var target = path.join("platforms", "android", "build.gradle");
return fs.readFileSync(target, "utf-8");
}
/*
* Added a dependency on 'com.google.gms' based on the position of the know 'com.android.tools.build' dependency in the build.gradle
*/
function addDependencies(buildGradle) {
// find the known line to match
var match = buildGradle.match(
/^(\s*)classpath 'com.android.tools.build(.*)/m
);
var whitespace = match[1];
// modify the line to add the necessary dependencies
var agcDependency =
whitespace + "classpath 'com.huawei.agconnect:agcp:1.2.0.300'";
var modifiedLine = match[0] + "\n" + agcDependency;
// modify the actual line
return buildGradle.replace(
/^(\s*)classpath 'com.android.tools.build(.*)/m,
modifiedLine
);
}
/*
* Add 'google()' and Crashlytics to the repository repo list
*/
function addRepos(buildGradle) {
// find the known line to match
var match = buildGradle.match(/^(\s*)jcenter\(\)/m);
var whitespace = match[1];
// modify the line to add the necessary repo
var huaweiMavenRepo =
whitespace + "maven { url 'http://developer.huawei.com/repo/' }";
var modifiedLine = match[0] + "\n" + huaweiMavenRepo;
// modify the actual line
buildGradle = buildGradle.replace(/^(\s*)jcenter\(\)/m, modifiedLine);
// update the all projects grouping
var allProjectsIndex = buildGradle.indexOf("allprojects");
if (allProjectsIndex > 0) {
// split the string on allprojects because jcenter is in both groups and we need to modify the 2nd instance
var firstHalfOfFile = buildGradle.substring(0, allProjectsIndex);
var secondHalfOfFile = buildGradle.substring(allProjectsIndex);
// Add google() to the allprojects section of the string
match = secondHalfOfFile.match(/^(\s*)jcenter\(\)/m);
var huaweiMavenRepo =
whitespace + "maven { url 'http://developer.huawei.com/repo/' }";
modifiedLine = match[0] + "\n" + huaweiMavenRepo;
// modify the part of the string that is after 'allprojects'
secondHalfOfFile = secondHalfOfFile.replace(
/^(\s*)jcenter\(\)/m,
modifiedLine
);
// recombine the modified line
buildGradle = firstHalfOfFile + secondHalfOfFile;
} else {
// this should not happen, but if it does, we should try to add the dependency to the buildscript
match = buildGradle.match(/^(\s*)jcenter\(\)/m);
var huaweiMavenRepo =
whitespace + "maven { url 'http://developer.huawei.com/repo/' }";
modifiedLine = match[0] + "\n" + huaweiMavenRepo;
// modify the part of the string that is after 'allprojects'
buildGradle = buildGradle.replace(/^(\s*)jcenter\(\)/m, modifiedLine);
}
return buildGradle;
}
/*
* Helper function to write to the build.gradle that sits at the root of the project
*/
function writeRootBuildGradle(contents) {
var target = path.join("platforms", "android", "build.gradle");
fs.writeFileSync(target, contents);
}
module.exports = {
modifyRootBuildGradle: function () {
// be defensive and don't crash if the file doesn't exist
if (!rootBuildGradleExists) {
return;
}
var buildGradle = readRootBuildGradle();
// Add Google Play Services Dependency
buildGradle = addDependencies(buildGradle);
// Add Google's Maven Repo
buildGradle = addRepos(buildGradle);
writeRootBuildGradle(buildGradle);
},
restoreRootBuildGradle: function () {
// be defensive and don't crash if the file doesn't exist
if (!rootBuildGradleExists) {
return;
}
var buildGradle = readRootBuildGradle();
// remove any lines we added
buildGradle = buildGradle.replace(
/(?:^|\r?\n)(.*)com.huawei.cordovahmsgmscheckplugin*?(?=$|\r?\n)/g,
""
);
writeRootBuildGradle(buildGradle);
},
};

@ -1,93 +0,0 @@
/**
* Utilities and shared functionality for the build hooks.
*/
var fs = require("fs");
var path = require("path");
fs.ensureDirSync = function (dir) {
if (!fs.existsSync(dir)) {
dir.split(path.sep).reduce(function (currentPath, folder) {
currentPath += folder + path.sep;
if (!fs.existsSync(currentPath)) {
fs.mkdirSync(currentPath);
}
return currentPath;
}, "");
}
};
module.exports = {
/**
* Used to get the name of the application as defined in the config.xml.
*
* @param {object} context - The Cordova context.
* @returns {string} The value of the name element in config.xml.
*/
getAppName: function (context) {
var ConfigParser = context.requireCordovaModule("cordova-lib").configparser;
var config = new ConfigParser("config.xml");
return config.name();
},
/**
* The ID of the plugin; this should match the ID in plugin.xml.
*/
getPluginId: function () {
return "com.huawei.cordovahmsgmscheckplugin";
},
copyKey: function (platform) {
for (var i = 0; i < platform.src.length; i++) {
var file = platform.src[i];
if (this.fileExists(file)) {
try {
var contents = fs.readFileSync(file).toString();
try {
platform.dest.forEach(function (destinationPath) {
var folder = destinationPath.substring(
0,
destinationPath.lastIndexOf("/")
);
fs.ensureDirSync(folder);
fs.writeFileSync(destinationPath, contents);
});
} catch (e) {
// skip
}
} catch (err) {
console.log(err);
}
break;
}
}
},
getValue: function (config, name) {
var value = config.match(
new RegExp("<" + name + "(.*?)>(.*?)</" + name + ">", "i")
);
if (value && value[2]) {
return value[2];
} else {
return null;
}
},
fileExists: function (path) {
try {
return fs.statSync(path).isFile();
} catch (e) {
return false;
}
},
directoryExists: function (path) {
try {
return fs.statSync(path).isDirectory();
} catch (e) {
return false;
}
},
};

@ -1,88 +0,0 @@
package com.huawei.cordovahmsgmscheckplugin;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.huawei.hms.api.HuaweiApiAvailability;
// import com.google.android.gms.common.GoogleApiAvailability;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaInterfaceImpl;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CallbackContext;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/**
* This class echoes a string called from JavaScript.
*/
public class CordovaHMSGMSCheckPlugin extends CordovaPlugin {
private static final String TAG = CordovaHMSGMSCheckPlugin.class.getSimpleName();
private CallbackContext mCallbackContext;
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
switch (action) {
case "isHmsAvailable":
mCallbackContext = callbackContext;
cordova.getThreadPool().execute(this::isHmsAvailable);
return true;
case "isGmsAvailable":
// mCallbackContext = callbackContext;
// cordova.getThreadPool().execute(this::isGmsAvailable);
return false;
}
return false;
}
private void isHmsAvailable() {
boolean isAvailable = false;
Context context = cordova.getContext();
if (null != cordova.getContext()) {
int result = HuaweiApiAvailability.getInstance().isHuaweiMobileServicesAvailable(context);
isAvailable = (com.huawei.hms.api.ConnectionResult.SUCCESS == result);
}
Log.i("Cordova", "isHmsAvailable: " + isAvailable);
String msg = "false";
if(isAvailable){
msg = "true";
}
outputCallbackContext(0, msg);
}
// private void isGmsAvailable() {
// boolean isAvailable = false;
// Context context = cordova.getContext();
// if (null != context) {
// int result = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
// isAvailable = (com.google.android.gms.common.ConnectionResult.SUCCESS == result);
// }
// Log.i("Cordova", "isGmsAvailable: " + isAvailable);
// String msg = "false";
// if(isAvailable){
// msg = "true";
// }
// outputCallbackContext(0, msg);
// }
/**
* @param type 0-success,1-error
* @param msg message
*/
private void outputCallbackContext(int type, String msg) {
if (mCallbackContext != null) {
switch (type) {
case 0:
mCallbackContext.success(msg);
break;
case 1:
mCallbackContext.error(msg);
break;
}
}
}
}

@ -1,29 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
// huawei maven
maven { url 'http://developer.huawei.com/repo/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
// classpath 'com.huawei.agconnect:agcp:1.2.0.300'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
// huawei maven
maven { url 'http://developer.huawei.com/repo/' }
}
}
cdvPluginPostBuildExtras.add({
apply plugin: 'com.huawei.agconnect'
})

@ -1,29 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<plugin xmlns:android="http://schemas.android.com/apk/res/android" id="com.huawei.cordovahmslocationplugin"
version="1.0.0"
xmlns="http://apache.org/cordova/ns/plugins/1.0">
<name>CordovaHMSLocationPlugin</name>
<js-module name="CordovaHMSLocationPlugin" src="www/CordovaHMSLocationPlugin.js">
<clobbers target="cordova.plugins.CordovaHMSLocationPlugin" />
</js-module>
<platform name="android">
<!-- hook for add maven repositories and agc plugin-->
<hook src="scripts/android/after_plugin_install.js" type="after_plugin_install" />
<hook src="scripts/android/before_plugin_uninstall.js" type="before_plugin_uninstall" />
<framework custom="true" src="src/android/build.gradle" type="gradleReference" />
<!-- Location Kit dependency-->
<framework src="com.huawei.hms:location:4.0.0.300" />
<config-file parent="/*" target="res/xml/config.xml">
<feature name="CordovaHMSLocationPlugin">
<param name="android-package"
value="com.huawei.cordovahmslocationplugin.CordovaHMSLocationPlugin" />
</feature>
</config-file>
<config-file parent="/*" target="AndroidManifest.xml"></config-file>
<source-file src="src/android/CordovaHMSLocationPlugin.java"
target-dir="src/com/huawei/cordovahmslocationplugin" />
</platform>
<!-- Script help to copy agconnect-services.json to right places-->
<hook src="scripts/after_prepare.js" type="after_prepare" />
</plugin>

@ -1,38 +0,0 @@
#!/usr/bin/env node
'use strict';
/**
* This hook makes sure projects using [cordova-plugin-firebase](https://github.com/arnesson/cordova-plugin-firebase)
* will build properly and have the required key files copied to the proper destinations when the app is build on Ionic Cloud using the package command.
* Credits: https://github.com/arnesson.
*/
var fs = require('fs');
var path = require('path');
var utilities = require("./lib/utilities");
var config = fs.readFileSync('config.xml').toString();
var name = utilities.getValue(config, 'name');
var ANDROID_DIR = 'platforms/android';
var PLATFORM = {
ANDROID: {
dest: [
ANDROID_DIR + '/app/agconnect-services.json'
],
src: [
'agconnect-services.json'
],
}
};
module.exports = function (context) {
//get platform from the context supplied by cordova
var platforms = context.opts.platforms;
// Copy key files to their platform specific folders
if (platforms.indexOf('android') !== -1 && utilities.directoryExists(ANDROID_DIR)) {
console.log('Preparing HMS Location Kit on Android');
utilities.copyKey(PLATFORM.ANDROID);
}
};

@ -1,9 +0,0 @@
var helper = require('./helper');
module.exports = function(context) {
// Modify the Gradle build file to add a task that will upload the debug symbols
// at build time.
helper.restoreRootBuildGradle();
helper.modifyRootBuildGradle();
};

@ -1,7 +0,0 @@
var helper = require('./helper');
module.exports = function(context) {
// Remove the Gradle modifications that were added when the plugin was installed.
helper.restoreRootBuildGradle();
};

@ -1,117 +0,0 @@
var fs = require("fs");
var path = require("path");
function rootBuildGradleExists() {
var target = path.join("platforms", "android", "build.gradle");
return fs.existsSync(target);
}
/*
* Helper function to read the build.gradle that sits at the root of the project
*/
function readRootBuildGradle() {
var target = path.join("platforms", "android", "build.gradle");
return fs.readFileSync(target, "utf-8");
}
/*
* Added a dependency on 'com.google.gms' based on the position of the know 'com.android.tools.build' dependency in the build.gradle
*/
function addDependencies(buildGradle) {
// find the known line to match
var match = buildGradle.match(/^(\s*)classpath 'com.android.tools.build(.*)/m);
var whitespace = match[1];
// modify the line to add the necessary dependencies
var agcDependency = whitespace + 'classpath \'com.huawei.agconnect:agcp:1.2.0.300\''
var modifiedLine = match[0] + '\n' + agcDependency;
// modify the actual line
return buildGradle.replace(/^(\s*)classpath 'com.android.tools.build(.*)/m, modifiedLine);
}
/*
* Add 'google()' and Crashlytics to the repository repo list
*/
function addRepos(buildGradle) {
// find the known line to match
var match = buildGradle.match(/^(\s*)jcenter\(\)/m);
var whitespace = match[1];
// modify the line to add the necessary repo
var huaweiMavenRepo = whitespace + 'maven { url \'http://developer.huawei.com/repo/\' }'
var modifiedLine = match[0] + '\n' + huaweiMavenRepo;
// modify the actual line
buildGradle = buildGradle.replace(/^(\s*)jcenter\(\)/m, modifiedLine);
// update the all projects grouping
var allProjectsIndex = buildGradle.indexOf('allprojects');
if (allProjectsIndex > 0) {
// split the string on allprojects because jcenter is in both groups and we need to modify the 2nd instance
var firstHalfOfFile = buildGradle.substring(0, allProjectsIndex);
var secondHalfOfFile = buildGradle.substring(allProjectsIndex);
// Add google() to the allprojects section of the string
match = secondHalfOfFile.match(/^(\s*)jcenter\(\)/m);
var huaweiMavenRepo = whitespace + 'maven { url \'http://developer.huawei.com/repo/\' }'
modifiedLine = match[0] + '\n' + huaweiMavenRepo;
// modify the part of the string that is after 'allprojects'
secondHalfOfFile = secondHalfOfFile.replace(/^(\s*)jcenter\(\)/m, modifiedLine);
// recombine the modified line
buildGradle = firstHalfOfFile + secondHalfOfFile;
} else {
// this should not happen, but if it does, we should try to add the dependency to the buildscript
match = buildGradle.match(/^(\s*)jcenter\(\)/m);
var huaweiMavenRepo = whitespace + 'maven { url \'http://developer.huawei.com/repo/\' }'
modifiedLine = match[0] + '\n' + huaweiMavenRepo;
// modify the part of the string that is after 'allprojects'
buildGradle = buildGradle.replace(/^(\s*)jcenter\(\)/m, modifiedLine);
}
return buildGradle;
}
/*
* Helper function to write to the build.gradle that sits at the root of the project
*/
function writeRootBuildGradle(contents) {
var target = path.join("platforms", "android", "build.gradle");
fs.writeFileSync(target, contents);
}
module.exports = {
modifyRootBuildGradle: function() {
// be defensive and don't crash if the file doesn't exist
if (!rootBuildGradleExists) {
return;
}
var buildGradle = readRootBuildGradle();
// Add Google Play Services Dependency
buildGradle = addDependencies(buildGradle);
// Add Google's Maven Repo
buildGradle = addRepos(buildGradle);
writeRootBuildGradle(buildGradle);
},
restoreRootBuildGradle: function() {
// be defensive and don't crash if the file doesn't exist
if (!rootBuildGradleExists) {
return;
}
var buildGradle = readRootBuildGradle();
// remove any lines we added
buildGradle = buildGradle.replace(/(?:^|\r?\n)(.*)com.huawei.cordovahmspushplugin*?(?=$|\r?\n)/g, '');
writeRootBuildGradle(buildGradle);
}
};

@ -1,88 +0,0 @@
/**
* Utilities and shared functionality for the build hooks.
*/
var fs = require('fs');
var path = require("path");
fs.ensureDirSync = function (dir) {
if (!fs.existsSync(dir)) {
dir.split(path.sep).reduce(function (currentPath, folder) {
currentPath += folder + path.sep;
if (!fs.existsSync(currentPath)) {
fs.mkdirSync(currentPath);
}
return currentPath;
}, '');
}
};
module.exports = {
/**
* Used to get the name of the application as defined in the config.xml.
*
* @param {object} context - The Cordova context.
* @returns {string} The value of the name element in config.xml.
*/
getAppName: function (context) {
var ConfigParser = context.requireCordovaModule("cordova-lib").configparser;
var config = new ConfigParser("config.xml");
return config.name();
},
/**
* The ID of the plugin; this should match the ID in plugin.xml.
*/
getPluginId: function () {
return "com.huawei.cordovahmspushplugin";
},
copyKey: function (platform) {
for (var i = 0; i < platform.src.length; i++) {
var file = platform.src[i];
if (this.fileExists(file)) {
try {
var contents = fs.readFileSync(file).toString();
try {
platform.dest.forEach(function (destinationPath) {
var folder = destinationPath.substring(0, destinationPath.lastIndexOf('/'));
fs.ensureDirSync(folder);
fs.writeFileSync(destinationPath, contents);
});
} catch (e) {
// skip
}
} catch (err) {
console.log(err);
}
break;
}
}
},
getValue: function (config, name) {
var value = config.match(new RegExp('<' + name + '(.*?)>(.*?)</' + name + '>', 'i'));
if (value && value[2]) {
return value[2]
} else {
return null
}
},
fileExists: function (path) {
try {
return fs.statSync(path).isFile();
} catch (e) {
return false;
}
},
directoryExists: function (path) {
try {
return fs.statSync(path).isDirectory();
} catch (e) {
return false;
}
}
};

@ -1,186 +0,0 @@
package com.huawei.cordovahmslocationplugin;
import android.Manifest;
import android.content.IntentSender;
import android.location.Location;
import android.os.Build;
import android.os.Looper;
import android.util.Log;
import com.huawei.hms.common.ApiException;
import com.huawei.hms.common.ResolvableApiException;
import com.huawei.hms.location.FusedLocationProviderClient;
import com.huawei.hms.location.LocationCallback;
import com.huawei.hms.location.LocationRequest;
import com.huawei.hms.location.LocationResult;
import com.huawei.hms.location.LocationServices;
import com.huawei.hms.location.LocationSettingsRequest;
import com.huawei.hms.location.LocationSettingsStatusCodes;
import com.huawei.hms.location.SettingsClient;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.PluginResult;
import org.json.JSONArray;
import org.json.JSONException;
/**
*
*/
// https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-References-V1/data-types-0000001056511617-V1#section2512153819346
public class CordovaHMSLocationPlugin extends CordovaPlugin {
private static final String TAG = CordovaHMSLocationPlugin.class.getSimpleName();
private FusedLocationProviderClient fusedLocationProviderClient;
private LocationRequest mLocationRequest;
private LocationCallback mLocationCallback;
private CallbackContext mCallbackContext;
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
requestPermission();
if (fusedLocationProviderClient == null) {
fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(cordova.getContext());
}
switch (action) {
case "requestLocation":
this.setLocationRequest();
this.setLocationCallback();
this.checkLocationSetting(callbackContext);
return true;
case "removeLocation":
this.stopLocation();
return true;
case "getLastlocation":
this.getLastlocation(callbackContext);
return true;
default:
return false;
}
}
private void returnLocation(Location location) {
if (mCallbackContext != null) {
Log.d(TAG, "returnLocation");
String message = location.getLatitude() + "," + location.getLongitude() + "," + location.isFromMockProvider();
PluginResult result = new PluginResult(PluginResult.Status.OK, message);
result.setKeepCallback(true);
mCallbackContext.sendPluginResult(result);
}
}
private void getLastlocation(CallbackContext callbackContext) {
fusedLocationProviderClient.getLastLocation().addOnSuccessListener(location -> {
Log.d(TAG, "getLastlocation success");
if (location == null) {
return;
}
// Location对象的处理逻辑
String message = location.getLatitude() + "," + location.getLongitude();
callbackContext.success(message);
}).addOnFailureListener(e -> {
// 异常处理逻辑
callbackContext.error("getLastlocation fail");
});
}
private void stopLocation() {
if (fusedLocationProviderClient == null) {
Log.d(TAG, "fusedLocationProviderClient is null");
return;
}
// 注意停止位置更新时mLocationCallback必须与requestLocationUpdates方法中的LocationCallback参数为同一对象。
fusedLocationProviderClient.removeLocationUpdates(mLocationCallback)
.addOnSuccessListener(aVoid -> {
// 停止位置更新成功
Log.d(TAG, "stop success");
mCallbackContext = null;
})
.addOnFailureListener(e -> {
// 停止位置更新失败
Log.d(TAG, "stop fail");
});
}
private void setLocationCallback() {
mLocationCallback = new LocationCallback() {
@Override
public void onLocationResult(LocationResult locationResult) {
if (locationResult != null) {
//处理位置回调结果
if (mLocationCallback != null) {
Log.d(TAG, "onLocationResult");
Location location = locationResult.getLocations().get(0);
returnLocation(location);
}
}
}
};
}
private void setLocationRequest() {
mLocationRequest = new LocationRequest();
// 设置位置更新的间隔(毫秒为单位)
mLocationRequest.setInterval(10000);
// mLocationRequest.setNumUpdates(1);
// 设置权重
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
}
private void checkLocationSetting(CallbackContext callbackContext) {
SettingsClient settingsClient = LocationServices.getSettingsClient(cordova.getContext());
LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder();
builder.addLocationRequest(mLocationRequest);
LocationSettingsRequest locationSettingsRequest = builder.build();
// 检查设备定位设置
settingsClient.checkLocationSettings(locationSettingsRequest)
.addOnSuccessListener(locationSettingsResponse -> {
// 设置满足定位条件,再发起位置请求
fusedLocationProviderClient
.requestLocationUpdates(mLocationRequest, mLocationCallback, Looper.getMainLooper())
.addOnSuccessListener(aVoid -> {
// 接口调用成功的处理
Log.d(TAG, "request success");
mCallbackContext = callbackContext;
});
})
.addOnFailureListener(e -> {
// 设置不满足定位条件
int statusCode = ((ApiException) e).getStatusCode();
switch (statusCode) {
case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
try {
ResolvableApiException rae = (ResolvableApiException) e;
// 调用startResolutionForResult可以弹窗提示用户打开相应权限
rae.startResolutionForResult(cordova.getActivity(), 0);
} catch (IntentSender.SendIntentException sie) {
Log.d(TAG, sie.getMessage());
}
break;
}
});
}
private void requestPermission() {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
Log.i(TAG, "sdk < 29 Q");
if (!cordova.hasPermission(Manifest.permission.ACCESS_FINE_LOCATION)
|| !cordova.hasPermission(Manifest.permission.ACCESS_COARSE_LOCATION)) {
String[] strings =
{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION};
cordova.requestPermissions(this, 1, strings);
}
} else {
if (!cordova.hasPermission(Manifest.permission.ACCESS_FINE_LOCATION)
|| !cordova.hasPermission(Manifest.permission.ACCESS_COARSE_LOCATION)
|| !cordova.hasPermission("android.permission.ACCESS_BACKGROUND_LOCATION")) {
String[] strings = {android.Manifest.permission.ACCESS_FINE_LOCATION,
android.Manifest.permission.ACCESS_COARSE_LOCATION,
"android.permission.ACCESS_BACKGROUND_LOCATION"};
cordova.requestPermissions(this, 2, strings);
}
}
}
}

@ -1,29 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
// huawei maven
maven { url 'http://developer.huawei.com/repo/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.huawei.agconnect:agcp:1.2.0.300'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
// huawei maven
maven { url 'http://developer.huawei.com/repo/' }
}
}
cdvPluginPostBuildExtras.add({
apply plugin: 'com.huawei.agconnect'
})

@ -1,38 +0,0 @@
<?xml version='1.0' encoding='utf-8'?><!-- Plugin Id and Version-->
<plugin xmlns:android="http://schemas.android.com/apk/res/android"
id="com.huawei.cordovahmspushplugin" version="1.0.0"
xmlns="http://apache.org/cordova/ns/plugins/1.0">
<js-module name="CordovaHMSPushPlugin" src="www/CordovaHMSPushPlugin.js">
<clobbers target="cordova.plugins.CordovaHMSPushPlugin" />
</js-module>
<!-- Plugin Name -->
<name>CordovaHMSPushPlugin</name>
<platform name="android">
<!-- hook for add maven repositories and agc plugin-->
<hook src="scripts/android/after_plugin_install.js" type="after_plugin_install" />
<hook src="scripts/android/before_plugin_uninstall.js" type="before_plugin_uninstall" />
<framework custom="true" src="src/android/build.gradle" type="gradleReference" />
<!-- Push Kit dependency-->
<framework src="com.huawei.hms:push:4.0.0.300" />
<config-file parent="/*" target="res/xml/config.xml">
<feature name="CordovaHMSPushPlugin">
<param name="android-package"
value="com.huawei.cordovahmspushplugin.CordovaHMSPushPlugin" />
</feature>
</config-file>
<config-file parent="/manifest/application" target="AndroidManifest.xml">
<service android:exported="false" android:name="com.huawei.cordovahmspushplugin.MessageService">
<intent-filter>
<action android:name="com.huawei.push.action.MESSAGING_EVENT" />
</intent-filter>
</service>
</config-file>
<source-file src="src/android/CordovaHMSPushPlugin.java"
target-dir="src/com/huawei/cordovahmspushplugin" />
<source-file src="src/android/MessageService.java"
target-dir="src/com/huawei/cordovahmspushplugin" />
</platform>
<!-- Script help to copy agconnect-services.json to right places-->
<hook src="scripts/after_prepare.js" type="after_prepare" />
</plugin>

@ -1,38 +0,0 @@
#!/usr/bin/env node
'use strict';
/**
* This hook makes sure projects using [cordova-plugin-firebase](https://github.com/arnesson/cordova-plugin-firebase)
* will build properly and have the required key files copied to the proper destinations when the app is build on Ionic Cloud using the package command.
* Credits: https://github.com/arnesson.
*/
var fs = require('fs');
var path = require('path');
var utilities = require("./lib/utilities");
var config = fs.readFileSync('config.xml').toString();
var name = utilities.getValue(config, 'name');
var ANDROID_DIR = 'platforms/android';
var PLATFORM = {
ANDROID: {
dest: [
ANDROID_DIR + '/app/agconnect-services.json'
],
src: [
'agconnect-services.json'
],
}
};
module.exports = function (context) {
//get platform from the context supplied by cordova
var platforms = context.opts.platforms;
// Copy key files to their platform specific folders
if (platforms.indexOf('android') !== -1 && utilities.directoryExists(ANDROID_DIR)) {
console.log('Preparing HMS Push Kit on Android');
utilities.copyKey(PLATFORM.ANDROID);
}
};

@ -1,9 +0,0 @@
var helper = require('./helper');
module.exports = function(context) {
// Modify the Gradle build file to add a task that will upload the debug symbols
// at build time.
helper.restoreRootBuildGradle();
helper.modifyRootBuildGradle();
};

@ -1,7 +0,0 @@
var helper = require('./helper');
module.exports = function(context) {
// Remove the Gradle modifications that were added when the plugin was installed.
helper.restoreRootBuildGradle();
};

@ -1,117 +0,0 @@
var fs = require("fs");
var path = require("path");
function rootBuildGradleExists() {
var target = path.join("platforms", "android", "build.gradle");
return fs.existsSync(target);
}
/*
* Helper function to read the build.gradle that sits at the root of the project
*/
function readRootBuildGradle() {
var target = path.join("platforms", "android", "build.gradle");
return fs.readFileSync(target, "utf-8");
}
/*
* Added a dependency on 'com.google.gms' based on the position of the know 'com.android.tools.build' dependency in the build.gradle
*/
function addDependencies(buildGradle) {
// find the known line to match
var match = buildGradle.match(/^(\s*)classpath 'com.android.tools.build(.*)/m);
var whitespace = match[1];
// modify the line to add the necessary dependencies
var agcDependency = whitespace + 'classpath \'com.huawei.agconnect:agcp:1.2.0.300\''
var modifiedLine = match[0] + '\n' + agcDependency;
// modify the actual line
return buildGradle.replace(/^(\s*)classpath 'com.android.tools.build(.*)/m, modifiedLine);
}
/*
* Add 'google()' and Crashlytics to the repository repo list
*/
function addRepos(buildGradle) {
// find the known line to match
var match = buildGradle.match(/^(\s*)jcenter\(\)/m);
var whitespace = match[1];
// modify the line to add the necessary repo
var huaweiMavenRepo = whitespace + 'maven { url \'http://developer.huawei.com/repo/\' }'
var modifiedLine = match[0] + '\n' + huaweiMavenRepo;
// modify the actual line
buildGradle = buildGradle.replace(/^(\s*)jcenter\(\)/m, modifiedLine);
// update the all projects grouping
var allProjectsIndex = buildGradle.indexOf('allprojects');
if (allProjectsIndex > 0) {
// split the string on allprojects because jcenter is in both groups and we need to modify the 2nd instance
var firstHalfOfFile = buildGradle.substring(0, allProjectsIndex);
var secondHalfOfFile = buildGradle.substring(allProjectsIndex);
// Add google() to the allprojects section of the string
match = secondHalfOfFile.match(/^(\s*)jcenter\(\)/m);
var huaweiMavenRepo = whitespace + 'maven { url \'http://developer.huawei.com/repo/\' }'
modifiedLine = match[0] + '\n' + huaweiMavenRepo;
// modify the part of the string that is after 'allprojects'
secondHalfOfFile = secondHalfOfFile.replace(/^(\s*)jcenter\(\)/m, modifiedLine);
// recombine the modified line
buildGradle = firstHalfOfFile + secondHalfOfFile;
} else {
// this should not happen, but if it does, we should try to add the dependency to the buildscript
match = buildGradle.match(/^(\s*)jcenter\(\)/m);
var huaweiMavenRepo = whitespace + 'maven { url \'http://developer.huawei.com/repo/\' }'
modifiedLine = match[0] + '\n' + huaweiMavenRepo;
// modify the part of the string that is after 'allprojects'
buildGradle = buildGradle.replace(/^(\s*)jcenter\(\)/m, modifiedLine);
}
return buildGradle;
}
/*
* Helper function to write to the build.gradle that sits at the root of the project
*/
function writeRootBuildGradle(contents) {
var target = path.join("platforms", "android", "build.gradle");
fs.writeFileSync(target, contents);
}
module.exports = {
modifyRootBuildGradle: function() {
// be defensive and don't crash if the file doesn't exist
if (!rootBuildGradleExists) {
return;
}
var buildGradle = readRootBuildGradle();
// Add Google Play Services Dependency
buildGradle = addDependencies(buildGradle);
// Add Google's Maven Repo
buildGradle = addRepos(buildGradle);
writeRootBuildGradle(buildGradle);
},
restoreRootBuildGradle: function() {
// be defensive and don't crash if the file doesn't exist
if (!rootBuildGradleExists) {
return;
}
var buildGradle = readRootBuildGradle();
// remove any lines we added
buildGradle = buildGradle.replace(/(?:^|\r?\n)(.*)com.huawei.cordovahmspushplugin*?(?=$|\r?\n)/g, '');
writeRootBuildGradle(buildGradle);
}
};

@ -1,88 +0,0 @@
/**
* Utilities and shared functionality for the build hooks.
*/
var fs = require('fs');
var path = require("path");
fs.ensureDirSync = function (dir) {
if (!fs.existsSync(dir)) {
dir.split(path.sep).reduce(function (currentPath, folder) {
currentPath += folder + path.sep;
if (!fs.existsSync(currentPath)) {
fs.mkdirSync(currentPath);
}
return currentPath;
}, '');
}
};
module.exports = {
/**
* Used to get the name of the application as defined in the config.xml.
*
* @param {object} context - The Cordova context.
* @returns {string} The value of the name element in config.xml.
*/
getAppName: function (context) {
var ConfigParser = context.requireCordovaModule("cordova-lib").configparser;
var config = new ConfigParser("config.xml");
return config.name();
},
/**
* The ID of the plugin; this should match the ID in plugin.xml.
*/
getPluginId: function () {
return "com.huawei.cordovahmspushplugin";
},
copyKey: function (platform) {
for (var i = 0; i < platform.src.length; i++) {
var file = platform.src[i];
if (this.fileExists(file)) {
try {
var contents = fs.readFileSync(file).toString();
try {
platform.dest.forEach(function (destinationPath) {
var folder = destinationPath.substring(0, destinationPath.lastIndexOf('/'));
fs.ensureDirSync(folder);
fs.writeFileSync(destinationPath, contents);
});
} catch (e) {
// skip
}
} catch (err) {
console.log(err);
}
break;
}
}
},
getValue: function (config, name) {
var value = config.match(new RegExp('<' + name + '(.*?)>(.*?)</' + name + '>', 'i'));
if (value && value[2]) {
return value[2]
} else {
return null
}
},
fileExists: function (path) {
try {
return fs.statSync(path).isFile();
} catch (e) {
return false;
}
},
directoryExists: function (path) {
try {
return fs.statSync(path).isDirectory();
} catch (e) {
return false;
}
}
};

@ -1,112 +0,0 @@
package com.huawei.cordovahmspushplugin;
import android.text.TextUtils;
import android.util.Log;
import com.huawei.agconnect.config.AGConnectServicesConfig;
import com.huawei.hms.aaid.HmsInstanceId;
import com.huawei.hms.push.HmsMessaging;
import com.huawei.hmf.tasks.OnCompleteListener;
import com.huawei.hmf.tasks.Task;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.PluginResult;
import org.json.JSONArray;
import org.json.JSONException;
/**
* This class echoes a string called from JavaScript.
*/
public class CordovaHMSPushPlugin extends CordovaPlugin {
private static final String TAG = CordovaHMSPushPlugin.class.getSimpleName();
private static CallbackContext mCallbackContext;
private static CallbackContext mTokenCallback;
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
switch (action) {
case "getToken":
this.getToken(callbackContext);
return true;
case "getMessageCallback":
Log.d(TAG, "getMessageCallback");
mCallbackContext = callbackContext;
return true;
case "subscribeTopic":
Log.d(TAG, "subscribeTopic");
try {
String topic = args.getString(0);
this.subscribeTopic(topic, callbackContext);
} catch (JSONException e) {
return true;
}
return true;
default:
return false;
}
}
public static void returnMessage(String message) {
if (mCallbackContext != null) {
Log.d(TAG, "returnMessage");
PluginResult result = new PluginResult(PluginResult.Status.OK, message);
result.setKeepCallback(true);
mCallbackContext.sendPluginResult(result);
}
}
public static void returnToken(String token) {
if (mTokenCallback != null) {
mTokenCallback.success(token);
mTokenCallback = null;
}
}
/**
* get push token
*/
private void getToken(CallbackContext callbackContext) {
Log.i(TAG, "get token: begin");
try {
String appId = AGConnectServicesConfig.fromContext(cordova.getContext()).getString("client/app_id");
String pushToken = HmsInstanceId.getInstance(cordova.getContext()).getToken(appId, "HCM");
if (!TextUtils.isEmpty(pushToken)) {
Log.i(TAG, "get token:" + pushToken);
callbackContext.success(pushToken);
}else {
mTokenCallback = callbackContext;
}
} catch (Exception e) {
Log.e(TAG, "getToken Failed, " + e);
callbackContext.error("getToken Failed, error : " + e.getMessage());
}
}
public void subscribeTopic(String topic, final CallbackContext callBack) {
// callBack.success("user subscribe to topic named as: "+ topic);
if (topic == null || topic.toString().equals("")) {
callBack.error("topic is empty!");
return;
}
try {
HmsMessaging.getInstance(cordova.getContext()).subscribe(topic).
addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(Task<Void> task) {
if (task.isSuccessful()) {
callBack.success("user subscribe to topic: "+ topic);
} else {
callBack.error("getToken Failed, error : " + task.getException().getMessage());
}
}
});
} catch (Exception e) {
callBack.error("getToken Failed, error : " + e.getMessage());
}
}
}

@ -1,32 +0,0 @@
package com.huawei.cordovahmspushplugin;
import com.huawei.cordovahmspushplugin.CordovaHMSPushPlugin;
import com.huawei.hms.push.HmsMessageService;
import com.huawei.hms.push.RemoteMessage;
import android.util.Log;
public class MessageService extends HmsMessageService {
private static final String TAG = MessageService.class.getSimpleName();
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
Log.d(TAG, "onMessageReceived");
if (remoteMessage != null) {
String message = remoteMessage.getData();
Log.d(TAG, message);
CordovaHMSPushPlugin.returnMessage(message);
}
}
@Override
public void onNewToken(String s) {
super.onNewToken(s);
if (s != null) {
Log.d(TAG, "token:" + s);
CordovaHMSPushPlugin.returnToken(s);
}
}
}

@ -1,29 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
// huawei maven
maven { url 'http://developer.huawei.com/repo/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.huawei.agconnect:agcp:1.2.0.300'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
// huawei maven
maven { url 'http://developer.huawei.com/repo/' }
}
}
cdvPluginPostBuildExtras.add({
apply plugin: 'com.huawei.agconnect'
})

@ -8,6 +8,7 @@ const routes: Routes = [
path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule' path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule'
}, },
{ path: 'home', loadChildren: './home/home.module#HomePageModule' }, { path: 'home', loadChildren: './home/home.module#HomePageModule' },
{ path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' }, { path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' },
{ path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' }, { path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' },
{ path: 'accrual-balances', loadChildren: './accrual-balances/accrual-balances.module#AccrualBalancesPageModule' }, { path: 'accrual-balances', loadChildren: './accrual-balances/accrual-balances.module#AccrualBalancesPageModule' },
@ -29,7 +30,9 @@ const routes: Routes = [
{ path: 'reports', loadChildren: './reports/reports.module#ReportsPageModule' }, { path: 'reports', loadChildren: './reports/reports.module#ReportsPageModule' },
{ path: 'termination', loadChildren: './termination/termination.module#TerminationPageModule' }, { path: 'termination', loadChildren: './termination/termination.module#TerminationPageModule' },
{ path: 'pending-transaction', loadChildren: './pending-transaction/pending-transaction.module#PendingTransactionPageModule' } { path: 'pending-transaction', loadChildren: './pending-transaction/pending-transaction.module#PendingTransactionPageModule' },
{ path: 'notification-center', loadChildren: './notification-center/notification-center.module#NotificationCenterPageModule' }

@ -1,25 +1,26 @@
.header-toolbar{ .header-toolbar {
--background: linear-gradient(45deg, #3ac1f1 0%, #19a163 36%, #19a163 59%, #1a586d 100%); --background: linear-gradient(45deg, #3ac1f1 0%, #19a163 36%, #19a163 59%, #1a586d 100%);
} }
.btnBack{ .btnBack {
background: transparent; background: transparent;
} }
ion-img{ ion-img {
width: 180px; width: 180px;
height: 180px; height: 180px;
background:transparent; background: transparent;
} }
h1{ h1 {
font-size: 28px !important; font-size: 28px !important;
} }
span{ span {
font-weight: bold; font-weight: bold;
} }
.button-login{
.button-login {
--background: var(--newgreen) !important; --background: var(--newgreen) !important;
background: var(--newgreen) !important; background: var(--newgreen) !important;
@ -39,7 +40,7 @@ span{
display: block; display: block;
} }
.sms_code{ .sms_code {
margin: 0px; margin: 0px;
text-align: center; text-align: center;
} }
@ -57,12 +58,13 @@ ion-input {
transition: all .2s ease-in-out; transition: all .2s ease-in-out;
border-radius: 3px; border-radius: 3px;
display: inline-block; display: inline-block;
&:focus { &:focus {
border-color:var(--ion-color-secondary) !important; border-color: var(--ion-color-secondary) !important;
box-shadow: 0 0 5px var(--ion-color-secondary) !important inset; box-shadow: 0 0 5px var(--ion-color-secondary) !important;
} }
&::selection { &::selection {
background: transparent; background: transparent;
} }
} }

@ -60,18 +60,18 @@
<ion-card *ngIf="item.isOpen" (click)="closeAnnouncement(item)" style="margin: 0px;"> <ion-card *ngIf="item.isOpen" (click)="closeAnnouncement(item)" style="margin: 0px;">
<ion-card-header style="background: transparent;"> <ion-card-header style="background: transparent;">
<ion-card-title style="font-size: 20px; margin: 5px;" *ngIf="direction === 'en'">{{detialData.title_EN}} <br> <ion-card-title style="font-size: 20px; margin: 10px;" *ngIf="direction === 'en'">{{detailData.title_EN}} <br>
<p style="font-size: 12px; color: gray;">{{detialData.date}}</p> <p style="font-size: 12px; color: gray;">{{detailData.date}}</p>
</ion-card-title> </ion-card-title>
<ion-card-title style="font-size: 20px; margin: 5px;" *ngIf="direction === 'ar'">{{detialData.title_AR}} <br> <ion-card-title style="font-size: 20px; margin:10px;" *ngIf="direction === 'ar'">{{detailData.title_AR}} <br>
<p style="font-size: 12px; color: gray;">{{detialData.date}}</p> <p style="font-size: 12px; color: gray;">{{detailData.date}}</p>
</ion-card-title> </ion-card-title>
<img *ngIf='detialData.img' [src]="detialData.img" class="image-center"> <img *ngIf='detailData.img' [src]="detailData.img" class="image-center">
<div *ngIf='!detialData.img'></div> <div *ngIf='!detailData.img'></div>
</ion-card-header> </ion-card-header>
<ion-card-content> <ion-card-content>
<p *ngIf="direction === 'en'"><span [innerHTML]="detialData.body_EN"></span></p> <p *ngIf="direction === 'en'"><span [innerHTML]="detailData.body_EN"></span></p>
<p *ngIf="direction === 'ar'"><span [innerHTML]="detialData.body_AR"></span></p> <p *ngIf="direction === 'ar'"><span [innerHTML]="detailData.body_AR"></span></p>
</ion-card-content> </ion-card-content>
</ion-card> </ion-card>
</div> </div>

@ -5,6 +5,7 @@
margin-right: auto; margin-right: auto;
height: 190px; height: 190px;
} }
.main-card-image { .main-card-image {
width: 100%; width: 100%;
display: block; display: block;
@ -13,6 +14,7 @@
position: absolute; position: absolute;
height: 100%; height: 100%;
} }
.text-style { .text-style {
margin: 5px; margin: 5px;
} }
@ -21,19 +23,19 @@
// border: 1px solid lightgray; // border: 1px solid lightgray;
// border-radius: 30px; // border-radius: 30px;
} }
.class-dev-open {
} .class-dev-open {}
.class-item-open { .class-item-open {
border: 1px solid lightgray; border: 1px solid lightgray;
border-radius: 30px; border-radius: 30px;
height: 100px; height: 100px;
} }
.class-item-close {
} .class-item-close {}
.image-item-en { .image-item-en {
padding-left: 5px; padding: 5px;
width: 100px; width: 100px;
min-height: 100px; min-height: 100px;
border: 5px solid white; border: 5px solid white;
@ -42,8 +44,9 @@
border-right: 0px; border-right: 0px;
object-fit: cover; object-fit: cover;
} }
.image-item-ar { .image-item-ar {
padding-right: 5px; padding: 5px;
width: 100px; width: 100px;
min-height: 100px; min-height: 100px;
border: 5px solid white; border: 5px solid white;
@ -66,11 +69,13 @@
opacity: 1; opacity: 1;
padding-bottom: 5px; padding-bottom: 5px;
} }
.item-list-p-title { .item-list-p-title {
font: normal normal medium 11px/16px Poppins; font: normal normal medium 11px/16px Poppins;
letter-spacing: -0.44px; letter-spacing: -0.44px;
color: #535353; color: #535353;
} }
.item-list-date-title { .item-list-date-title {
font: normal normal 600 10px/16px Poppins; font: normal normal 600 10px/16px Poppins;
letter-spacing: -0.4px; letter-spacing: -0.4px;
@ -83,11 +88,13 @@
color: #ffffff; color: #ffffff;
white-space: break-spaces; white-space: break-spaces;
} }
.item-list-first-p { .item-list-first-p {
font: normal normal normal 12px/17px Poppins; font: normal normal normal 12px/17px Poppins;
letter-spacing: -0.12px; letter-spacing: -0.12px;
color: #ffffff; color: #ffffff;
} }
.item-list-first-date { .item-list-first-date {
text-align: left; text-align: left;
font: normal normal bold 8px/23px Poppins; font: normal normal bold 8px/23px Poppins;
@ -101,6 +108,7 @@
color: #2b353e; color: #2b353e;
margin-bottom: -34px; margin-bottom: -34px;
} }
.card-style-p { .card-style-p {
font: normal normal medium 13px/18px Poppins; font: normal normal medium 13px/18px Poppins;
letter-spacing: -0.52px; letter-spacing: -0.52px;
@ -118,18 +126,20 @@
position: relative; position: relative;
min-height: 283px; min-height: 283px;
} }
.main-card-item-list-style { .main-card-item-list-style {
position: absolute; position: absolute;
bottom: 0px; bottom: 0px;
--background: transparent; --background: transparent;
} }
.main-card-label-stle{
.main-card-label-stle {
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
width: 237px; width: 237px;
} }
.main-card-label-style-all{ .main-card-label-style-all {
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
width: 200px; width: 200px;

@ -22,14 +22,15 @@ export class AnnouncementComponent implements OnInit {
public pageSize = 1; public pageSize = 1;
public pageLength = 0; public pageLength = 0;
public lengthCounter = 5; public lengthCounter = 5;
public detialData: { public detailData: {
id: number, id: number,
title_EN: string, title_EN: string,
title_AR: string, title_AR: string,
body_EN: string, body_EN: string,
body_AR: string, body_AR: string,
img?: string, img?: string,
date: Date}; date: Date
};
constructor( constructor(
public announcementService: AnnouncementService, public announcementService: AnnouncementService,
@ -63,21 +64,21 @@ export class AnnouncementComponent implements OnInit {
this.common.stopLoading(); this.common.stopLoading();
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
holdData = JSON.parse(result.Mohemm_ITG_ResponseItem); holdData = JSON.parse(result.Mohemm_ITG_ResponseItem);
data = JSON.parse(holdData.result.data)[0]; data = holdData.result.data[0];
console.log(data); console.log(data);
this.detialData = { this.detailData = {
id: data.rowID, id: data.rowID,
title_EN: data.Title_EN, title_EN: data.titleEn,
title_AR: data.Title_AR, title_AR: data.titleAr,
body_EN: data.Body_EN, body_EN: data.descriptionEn,
body_AR: data.Body_AR, body_AR: data.descriptionAr,
date: data.created, date: data.created,
img: data.Banner_Image img: data.imageContent
}; };
element.isOpen = !element.isOpen; element.isOpen = !element.isOpen;
// this.common.stopLoading(); // this.common.stopLoading();
} }
console.log(this.detialData); console.log(this.detailData);
}); });
} else { } else {
element.isOpen = false; element.isOpen = false;
@ -86,7 +87,7 @@ export class AnnouncementComponent implements OnInit {
} }
closeAnnouncement(item){ closeAnnouncement(item) {
item.isOpen = false; item.isOpen = false;
} }
@ -97,24 +98,24 @@ export class AnnouncementComponent implements OnInit {
this.common.stopLoading(); this.common.stopLoading();
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
holdData = JSON.parse(result.Mohemm_ITG_ResponseItem); holdData = JSON.parse(result.Mohemm_ITG_ResponseItem);
this.listOfAnnouncement = JSON.parse(holdData.result.data); this.listOfAnnouncement = holdData.result.data;
this.pageLength = this.listOfAnnouncement[0].TotalItems; this.pageLength = this.listOfAnnouncement[0].TotalItems;
for (let i = 0; i < this.listOfAnnouncement.length; i++) { for (let i = 0; i < this.listOfAnnouncement.length; i++) {
this.listOfAnnouncement[i].Title_EN = this.listOfAnnouncement[i].Title_EN; this.listOfAnnouncement[i].Title_EN = this.listOfAnnouncement[i].titleEn;
this.listOfAnnouncement[i].Title_AR = this.listOfAnnouncement[i].Title_AR; this.listOfAnnouncement[i].Title_AR = this.listOfAnnouncement[i].titleAr;
this.listOfAnnouncement[i].EmailBody_EN = this.listOfAnnouncement[i].EmailBody_EN; this.listOfAnnouncement[i].EmailBody_EN = this.listOfAnnouncement[i].descriptionEn;
this.listOfAnnouncement[i].EmailBody_AR = this.listOfAnnouncement[i].EmailBody_AR; this.listOfAnnouncement[i].EmailBody_AR = this.listOfAnnouncement[i].descriptionAr;
this.arr[i] = { this.arr[i] = {
id: this.listOfAnnouncement[i].rowID, id: this.listOfAnnouncement[i].rowID,
title_EN: this.listOfAnnouncement[i].Title_EN, title_EN: this.listOfAnnouncement[i].titleEn,
title_AR: this.listOfAnnouncement[i].Title_AR, title_AR: this.listOfAnnouncement[i].titleAr,
body_EN: this.listOfAnnouncement[i].EmailBody_EN, body_EN: this.listOfAnnouncement[i].descriptionEn,
body_AR: this.listOfAnnouncement[i].EmailBody_AR, body_AR: this.listOfAnnouncement[i].descriptionAr,
date: this.listOfAnnouncement[i].created, date: this.listOfAnnouncement[i].created,
img: this.listOfAnnouncement[i].Banner_Image, img: this.listOfAnnouncement[i].imageContent,
isopen: false isopen: false
}; };
if ( i < this.numberOfListLength){ if (i < this.numberOfListLength) {
this.announcementList.push(this.arr[i]); this.announcementList.push(this.arr[i]);
} }
this.arrList.push(this.arr[i]); this.arrList.push(this.arr[i]);

@ -26,11 +26,11 @@ export class HMGUtils {
this.devicePermissionsService.requestLocationAutherization().then( async granted => { this.devicePermissionsService.requestLocationAutherization().then( async granted => {
if(granted == true) { if(granted == true) {
if (this.platform.is('android')) { if (this.platform.is('android')) {
if ((await this.isHuaweiDevice())) { // if ((await this.isHuaweiDevice())) {
this.getHMSLocation(callBack); // this.getHMSLocation(callBack);
} else { // } else {
this.getGMSLocation(callBack); this.getGMSLocation(callBack);
} // }
} else { } else {
this.getIOSLocation(callBack); this.getIOSLocation(callBack);
} }
@ -42,60 +42,60 @@ export class HMGUtils {
} }
async isHuaweiDevice(): Promise<boolean> { // async isHuaweiDevice(): Promise<boolean> {
const result: any = await new Promise((resolve, reject) => { // const result: any = await new Promise((resolve, reject) => {
cordova.plugins.CordovaHMSGMSCheckPlugin.isHmsAvailable( // cordova.plugins.CordovaHMSGMSCheckPlugin.isHmsAvailable(
"index.js", // "index.js",
(_res) => { // (_res) => {
const hmsAvailable = _res === "true"; // const hmsAvailable = _res === "true";
resolve(hmsAvailable); // resolve(hmsAvailable);
}, // },
(_err) => { // (_err) => {
reject({ "status": false, "error": JSON.stringify(_err) }); // reject({ "status": false, "error": JSON.stringify(_err) });
this.common.presentAlert(this.ts.trPK('general', 'huawei-hms-gms-error')); // this.common.presentAlert(this.ts.trPK('general', 'huawei-hms-gms-error'));
} // }
); // );
}); // });
return result; // return result;
} // }
private getHMSLocation(callBack: Function) { // private getHMSLocation(callBack: Function) {
try { // try {
cordova.plugins.CordovaHMSLocationPlugin.requestLocation( // cordova.plugins.CordovaHMSLocationPlugin.requestLocation(
"index.js", // "index.js",
(_res) => { // (_res) => {
console.log("Huawei Location Success: [Stop Getting]"); // console.log("Huawei Location Success: [Stop Getting]");
cordova.plugins.CordovaHMSLocationPlugin.removeLocation("", (_res) => { }, (_err) => { }); // cordova.plugins.CordovaHMSLocationPlugin.removeLocation("", (_res) => { }, (_err) => { });
const location = _res.split(',') // const location = _res.split(',')
console.log(location); // console.log(location);
if (location.length == 3) { // if (location.length == 3) {
let mock = false; // let mock = false;
const lat = Number(_res.split(',')[0]); // const lat = Number(_res.split(',')[0]);
const long = Number(_res.split(',')[1]); // const long = Number(_res.split(',')[1]);
const mockValue = _res.split(',')[2]; // const mockValue = _res.split(',')[2];
// if (mockValue == 'true') { // // if (mockValue == 'true') {
// mock = true; // // mock = true;
// // } else {
// // mock = false;
// // }
// callBack({"latitude":lat, "longitude":long, "isfake":mock})
// } else { // } else {
// mock = false; // this.common.presentAlert(this.ts.trPK('general', 'invalid-huawei-location'));
// } // }
callBack({"latitude":lat, "longitude":long, "isfake":mock}) // },
} else { // (_err) => {
this.common.presentAlert(this.ts.trPK('general', 'invalid-huawei-location')); // console.log("Huawei Location [Getting Error]: " + JSON.stringify(_err));
} // this.common.presentAlert(this.ts.trPK('general', 'invalid-huawei-location'));
}, // }
(_err) => { // );
console.log("Huawei Location [Getting Error]: " + JSON.stringify(_err));
this.common.presentAlert(this.ts.trPK('general', 'invalid-huawei-location'));
}
);
} catch (_err) { // } catch (_err) {
console.log("Huawei Location Plugin [Error]: " + + JSON.stringify(_err)); // console.log("Huawei Location Plugin [Error]: " + + JSON.stringify(_err));
this.common.presentAlert(this.ts.trPK('general', 'huawei-plugin-issue')); // this.common.presentAlert(this.ts.trPK('general', 'huawei-plugin-issue'));
} // }
} // }
private getGMSLocation(callBack: Function) { private getGMSLocation(callBack: Function) {
this.backgroundGeolocation.getCurrentLocation({ timeout: 10000, enableHighAccuracy: true, maximumAge: 3000 }).then((resp) => { this.backgroundGeolocation.getCurrentLocation({ timeout: 10000, enableHighAccuracy: true, maximumAge: 3000 }).then((resp) => {

@ -146,7 +146,7 @@ export class AuthenticationService {
mobileType = 'android'; mobileType = 'android';
} }
request.VersionID = 3.7; request.VersionID = 3.7;
request.Channel = 33; request.Channel = 31;
request.LanguageID = TranslatorService.getCurrentLanguageCode(); request.LanguageID = TranslatorService.getCurrentLanguageCode();
request.MobileType = mobileType; request.MobileType = mobileType;
@ -228,7 +228,7 @@ export class AuthenticationService {
public login(request: LoginRequest, onError: any, errorLabel: string): Observable<Response> { public login(request: LoginRequest, onError: any, errorLabel: string): Observable<Response> {
this.setPublicFields(request); this.setPublicFields(request);
request.P_APP_VERSION = "HMG"; request.P_APP_VERSION = "CS";
return this.con.post(AuthenticationService.login, request, onError, errorLabel); return this.con.post(AuthenticationService.login, request, onError, errorLabel);
} }
@ -485,7 +485,7 @@ export class AuthenticationService {
public checkUserAuthentication(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string) public checkUserAuthentication(request: CheckUserAuthenticationRequest, onError: any, errorLabel: string)
: Observable<CheckUserAuthenticationResponse> { : Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request); this.setPublicFields(request);
request.P_APP_VERSION = "HMG"; request.P_APP_VERSION = "CS";
return this.con.post(AuthenticationService.userChecking, request, onError, errorLabel); return this.con.post(AuthenticationService.userChecking, request, onError, errorLabel);
} }

@ -1430,7 +1430,9 @@ export class CommonService {
public openLogin() { public openLogin() {
this.nav.navigateRoot(['/authentication/login']); this.nav.navigateRoot(['/authentication/login']);
} }
public openNotificationCenter() {
this.nav.navigateRoot(['/notification-center']);
}
public openUserForgot() { public openUserForgot() {
this.nav.navigateForward(['/authentication/checkuser']); this.nav.navigateForward(['/authentication/checkuser']);
} }

@ -45,7 +45,7 @@ export class PushService {
this.processStartReceivingWithFirebase(); this.processStartReceivingWithFirebase();
} }
}); });
} }
private processNotification(data: any) { private processNotification(data: any) {
@ -67,7 +67,7 @@ export class PushService {
this.sharedService.setSharedData(notification, NotificationModel.SHARED_DATA); this.sharedService.setSharedData(notification, NotificationModel.SHARED_DATA);
} else if (type === NotificationModel.TYPE_CONFERENCE) { } else if (type === NotificationModel.TYPE_CONFERENCE) {
const session = data.additionalData.sessionId; const session = data.additionalData.sessionId;
this.sharedService.setSharedData( new SessionModel(session) , SessionModel.SHARED_DATA); this.sharedService.setSharedData(new SessionModel(session), SessionModel.SHARED_DATA);
} else { } else {
if (type === NotificationModel.TYPE_VIDEO) { if (type === NotificationModel.TYPE_VIDEO) {
notification.MessageType = 'video'; notification.MessageType = 'video';
@ -144,6 +144,18 @@ export class PushService {
this.cs.setDeviceToken(token); //last way to set the device Token to get it through getDeviceToken this.cs.setDeviceToken(token); //last way to set the device Token to get it through getDeviceToken
this.registerInBackend(token); this.registerInBackend(token);
}).catch(error => console.error('Error getting token', error)); }).catch(error => console.error('Error getting token', error));
this.firebasex.onMessageReceived().subscribe(data => {
console.log("onMessageReceived");
console.log(data);
this.firebasex.clearAllNotifications();
if (data.notification_type == 3) {
this.cs.sharedService.setSharedData(data, NotificationModel.SHARED_DATA);
this.cs.openNotificationCenter();
}
});
} }
public onPushReceived(payload: any) { public onPushReceived(payload: any) {

@ -35,7 +35,7 @@ export class HrRequestFormComponent implements OnInit {
public searchKeySelect = 'Complaints'; public searchKeySelect = 'Complaints';
myColor: string = 'secondary'; myColor: string = 'secondary';
public showRequestDetails = false; public showRequestDetails = false;
public proID = "HMG" public proID = "CS"
public inquiry: string; public inquiry: string;
public HR: string; public HR: string;
public complaints: string; public complaints: string;

@ -0,0 +1,29 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { NotificationCenterPage } from './notification-center.page';
import { DetailComponent } from './notification-detail/detail.component';
import { HmgCommonModule } from '../hmg-common/hmg-common.module';
const routes: Routes = [
{
path: '',
component: DetailComponent
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
HmgCommonModule,
RouterModule.forChild(routes)
],
declarations: [NotificationCenterPage, DetailComponent]
})
export class NotificationCenterPageModule { }

@ -0,0 +1,6 @@
<ion-content>
<ion-router-outlet></ion-router-outlet>
</ion-content>

@ -0,0 +1,27 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NotificationCenterPage } from './notification-center.page';
describe('NotificationCenterPage', () => {
let component: NotificationCenterPage;
let fixture: ComponentFixture<NotificationCenterPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ NotificationCenterPage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(NotificationCenterPage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-notification-center',
templateUrl: './notification-center.page.html',
styleUrls: ['./notification-center.page.scss'],
})
export class NotificationCenterPage implements OnInit {
constructor() { }
ngOnInit() {
}
}

@ -0,0 +1,21 @@
<ion-content class="item-background" padding>
<div class="close-icon">
<img src="assets/imgs/close.svg" (click)="backLogin()" />
</div>
<ion-grid>
<ion-row class="ion-justify-content-center">
<ion-col [size]="11">
<p>{{data.image_Text}}</p>
</ion-col>
</ion-row>
<ion-row class="ion-justify-content-center">
<ion-col [size]="11">
<img [src]="data.image_URL" class="full-width">
</ion-col>
</ion-row>
</ion-grid>
<page-trailer></page-trailer>
</ion-content>

@ -0,0 +1,84 @@
.vertical_space {
height: 0.5cm;
width: 100%;
}
.title {
font-size: 0.38cm;
font-weight: bold;
}
.info-icon ion-icon {
font-size: 90px;
margin: 10px auto;
display: block;
margin-bottom: 0;
color: var(--ion-color-danger);
}
.info-icon h1 {
margin: auto;
font-size: 22px;
text-align: center;
margin-top: 10%;
}
.info-icon {
padding: 20px;
background: #fff;
margin: 20px;
margin-top: 15%;
border-radius: 15px;
}
.info-icon .line {
width: 100%;
height: 1px;
background: #ccddcc;
margin: 15px auto;
}
.info-icon .instruction p {
display: block;
margin: 0px;
margin-top: 7%;
color: #000;
text-align: center;
}
.info-icon b {
bottom: 11px;
margin: 18px;
color: var(--ion-color-danger);
}
.instruction b {
color: var(--ion-color-danger);
font-weight: bolder;
}
.stop-icon {
display: flex;
margin: 10px auto;
width: 45%;
margin-top: 40px;
}
p.otherwise {
font-size: 20px !important;
}
.close-icon {
position: relative;
height: 60px;
padding: 10px;
}
.close-icon img {
height: 35px;
width: 35px;
right: 0;
position: absolute;
}

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DetailComponent } from './detail.component';
describe('DetailComponent', () => {
let component: DetailComponent;
let fixture: ComponentFixture<DetailComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DetailComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DetailComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,42 @@
import { Component, OnInit } from '@angular/core';
import { NotificationModel } from 'src/app/hmg-common/services/push/models/notification.model';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
// import { NotificationsCenterService } from '../service/notifications-center.service';
import { Route, Router, ActivatedRoute, ActivationEnd } from '@angular/router';
import { SafeResourceUrl, DomSanitizer } from '@angular/platform-browser';
@Component({
selector: 'app-detail',
templateUrl: './detail.component.html',
styleUrls: ['./detail.component.scss']
})
export class DetailComponent implements OnInit {
public notification: NotificationModel;
public video_link: string;
public trustedVideoUrl: SafeResourceUrl;
public direction: any;
public data: any;
constructor(
public cs: CommonService,
public ts: TranslatorService,
public sharedData: SharedDataService,
// public notifyService: NotificationsCenterService,
public router: Router,
private domSanitizer: DomSanitizer,
public route: ActivatedRoute
) {
}
ngOnInit() {
this.direction = TranslatorService.getCurrentDirection();
this.data = this.sharedData.getSharedData(NotificationModel.SHARED_DATA, true);
}
backLogin() {
this.cs.openLogin();
}
}

@ -202,13 +202,18 @@
<ion-slide> <ion-slide>
<ng-container *ngIf="activeSegment === 'action-history'"> <ng-container *ngIf="activeSegment === 'action-history'">
<ion-col size="12" *ngIf="showActionHistoryLoading">
<p>{{'worklist, loading'| translate}} <img style="width: 3%;"
src="../assets/icon/progress-loading.gif" /></p>
</ion-col>
<ion-card class="cardContent" style="width: 100%;"> <ion-card class="cardContent" style="width: 100%;">
<ion-card-content> <ion-card-content>
<div class="noDataDiv" [hidden]="actionHistoryRes && actionHistoryRes.length > 0"> <div class="noDataDiv" *ngIf = "actionHistoryRes && actionHistoryRes.length === 0 && !showActionHistoryLoading">
<p>{{ 'general, empty' | translate}}</p> <p>{{ 'general, empty' | translate}}</p>
</div> </div>
<div *ngIf="actionHistoryRes && actionHistoryRes.length > 0 "> <div *ngIf="actionHistoryRes && actionHistoryRes.length > 0 && !showActionHistoryLoading ">
<ion-list class="notification-list "> <ion-list class="notification-list ">
<div class="timeline"> <div class="timeline">
<ion-item *ngFor="let actionHistory of actionHistoryRes"> <ion-item *ngFor="let actionHistory of actionHistoryRes">

@ -129,8 +129,8 @@ export class WorklistMainIcComponent implements OnInit {
reqInfo_label: any; reqInfo_label: any;
closeDis: boolean = false; closeDis: boolean = false;
selectedFilter: string; selectedFilter: string;
;
close_label: any; close_label: any;
public showActionHistoryLoading = true;
constructor( constructor(
public common: CommonService, public common: CommonService,
@ -875,6 +875,7 @@ export class WorklistMainIcComponent implements OnInit {
} }
handleWorkListActionHistoryResult(result) { handleWorkListActionHistoryResult(result) {
this.showActionHistoryLoading = false;
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
if (this.common.hasData(result.GetActionHistoryList)) { if (this.common.hasData(result.GetActionHistoryList)) {
this.actionHistoryRes = result.GetActionHistoryList; this.actionHistoryRes = result.GetActionHistoryList;

@ -437,13 +437,19 @@
<ion-slide> <ion-slide>
<ng-container *ngIf="activeSegment === 'action-history'"> <ng-container *ngIf="activeSegment === 'action-history'">
<ion-col size="12" *ngIf="showActionHistoryLoading">
<p>{{'worklist, loading'| translate}} <img style="width: 3%;"
src="../assets/icon/progress-loading.gif" /></p>
</ion-col>
<ion-card class="cardContent" style="width: 100%;"> <ion-card class="cardContent" style="width: 100%;">
<ion-card-content> <ion-card-content>
<div class="noDataDiv" [hidden]="actionHistoryRes && actionHistoryRes.length > 0"> <div class="noDataDiv" *ngIf = "actionHistoryRes && actionHistoryRes.length === 0 && !showActionHistoryLoading">
<p>{{ 'general, empty' | translate}}</p> <p>{{ 'general, empty' | translate}}</p>
</div> </div>
<div *ngIf="actionHistoryRes && actionHistoryRes.length > 0 ">
<div *ngIf="actionHistoryRes && actionHistoryRes.length > 0 && !showActionHistoryLoading ">
<ion-list class="notification-list "> <ion-list class="notification-list ">
<div class="timeline"> <div class="timeline">
<ion-item *ngFor="let actionHistory of actionHistoryRes"> <ion-item *ngFor="let actionHistory of actionHistoryRes">

@ -118,6 +118,7 @@ export class WorklistMainMRComponent implements OnInit {
close_label: any; close_label: any;
closeDis: boolean = false; closeDis: boolean = false;
selectedFilter: string; selectedFilter: string;
public showActionHistoryLoading = true;
constructor( constructor(
@ -809,6 +810,7 @@ export class WorklistMainMRComponent implements OnInit {
} }
handleWorkListActionHistoryResult(result) { handleWorkListActionHistoryResult(result) {
this.showActionHistoryLoading = false;
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
if (this.common.hasData(result.GetActionHistoryList)) { if (this.common.hasData(result.GetActionHistoryList)) {
this.actionHistoryRes = result.GetActionHistoryList; this.actionHistoryRes = result.GetActionHistoryList;

@ -170,13 +170,19 @@
<ion-slide> <ion-slide>
<ng-container *ngIf="activeSegment === 'action-history'"> <ng-container *ngIf="activeSegment === 'action-history'">
<ion-col size="12" *ngIf="showActionHistoryLoading">
<p>{{'worklist, loading'| translate}} <img style="width: 3%;"
src="../assets/icon/progress-loading.gif" /></p>
</ion-col>
<ion-card class="cardContent" style="width: 100%;"> <ion-card class="cardContent" style="width: 100%;">
<ion-card-content> <ion-card-content>
<div class="noDataDiv" [hidden]="actionHistoryRes && actionHistoryRes.length > 0"> <div class="noDataDiv" *ngIf = "actionHistoryRes && actionHistoryRes.length === 0 && !showActionHistoryLoading">
<p>{{ 'general, empty' | translate}}</p> <p>{{ 'general, empty' | translate}}</p>
</div> </div>
<div *ngIf="actionHistoryRes && actionHistoryRes.length > 0 ">
<div *ngIf="actionHistoryRes && actionHistoryRes.length > 0 && !showActionHistoryLoading ">
<ion-list class="notification-list "> <ion-list class="notification-list ">
<div class="timeline"> <div class="timeline">
<ion-item *ngFor="let actionHistory of actionHistoryRes"> <ion-item *ngFor="let actionHistory of actionHistoryRes">

@ -129,8 +129,9 @@ export class WorklistMainPoComponent implements OnInit {
reqInfo_label: any; reqInfo_label: any;
closeDis: boolean = false; closeDis: boolean = false;
selectedFilter: string; selectedFilter: string;
;
close_label: any; close_label: any;
public showActionHistoryLoading = true;
constructor( constructor(
public common: CommonService, public common: CommonService,
@ -851,6 +852,7 @@ export class WorklistMainPoComponent implements OnInit {
} }
handleWorkListActionHistoryResult(result) { handleWorkListActionHistoryResult(result) {
this.showActionHistoryLoading = false;
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
if (this.common.hasData(result.GetActionHistoryList)) { if (this.common.hasData(result.GetActionHistoryList)) {
this.actionHistoryRes = result.GetActionHistoryList; this.actionHistoryRes = result.GetActionHistoryList;

@ -200,13 +200,17 @@
<ion-slide> <ion-slide>
<ng-container *ngIf="activeSegment === 'action-history'"> <ng-container *ngIf="activeSegment === 'action-history'">
<ion-col size="12" *ngIf="showActionHistoryLoading">
<p>{{'worklist, loading'| translate}} <img style="width: 3%;"
src="../assets/icon/progress-loading.gif" /></p>
</ion-col>
<ion-card class="cardContent" style="width: 100%;"> <ion-card class="cardContent" style="width: 100%;">
<ion-card-content> <ion-card-content>
<div class="noDataDiv" *ngIf = "actionHistoryRes && actionHistoryRes.length === 0 && !showActionHistoryLoading">
<div class="noDataDiv" [hidden]="actionHistoryRes && actionHistoryRes.length > 0">
<p>{{ 'general, empty' | translate}}</p> <p>{{ 'general, empty' | translate}}</p>
</div> </div>
<div *ngIf="actionHistoryRes && actionHistoryRes.length > 0 "> <div *ngIf="actionHistoryRes && actionHistoryRes.length > 0 && !showActionHistoryLoading">
<ion-list class="notification-list "> <ion-list class="notification-list ">
<div class="timeline"> <div class="timeline">
<ion-item *ngFor="let actionHistory of actionHistoryRes"> <ion-item *ngFor="let actionHistory of actionHistoryRes">

@ -115,6 +115,7 @@ export class WorklistMainPRComponent implements OnInit {
close_label: any; close_label: any;
closeDis: boolean = false; closeDis: boolean = false;
selectedFilter: any; selectedFilter: any;
public showActionHistoryLoading = true;
constructor( constructor(
@ -836,6 +837,7 @@ export class WorklistMainPRComponent implements OnInit {
} }
handleWorkListActionHistoryResult(result) { handleWorkListActionHistoryResult(result) {
this.showActionHistoryLoading = false;
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
if (this.common.hasData(result.GetActionHistoryList)) { if (this.common.hasData(result.GetActionHistoryList)) {
this.actionHistoryRes = result.GetActionHistoryList; this.actionHistoryRes = result.GetActionHistoryList;

@ -624,14 +624,18 @@
</ion-slide> </ion-slide>
<ion-slide> <ion-slide>
<ng-container *ngIf="activeSegment === 'action-history'"> <ng-container *ngIf="activeSegment === 'action-history'">
<ion-col size="12" *ngIf="showActionHistoryLoading">
<p>{{'worklist, loading'| translate}} <img style="width: 3%;"
src="../assets/icon/progress-loading.gif" /></p>
</ion-col>
<ion-card class="cardContent action-history" style="width: 100%;"> <ion-card class="cardContent action-history" style="width: 100%;">
<ion-card-content> <ion-card-content>
<div class="noDataDiv" [hidden]="actionHistoryRes && actionHistoryRes.length > 0"> <div class="noDataDiv" *ngIf = "actionHistoryRes && actionHistoryRes.length === 0 && !showActionHistoryLoading">
<p>{{ 'general, empty' | translate}}</p> <p>{{ 'general, empty' | translate}}</p>
</div> </div>
<div *ngIf="actionHistoryRes && actionHistoryRes.length > 0 "> <div *ngIf="actionHistoryRes && actionHistoryRes.length > 0 && !showActionHistoryLoading ">
<ion-list class="notification-list "> <ion-list class="notification-list ">
<div class="timeline"> <div class="timeline">
<ion-item *ngFor="let actionHistory of actionHistoryRes"> <ion-item *ngFor="let actionHistory of actionHistoryRes">

@ -111,6 +111,7 @@ export class WorklistMainComponent implements OnInit {
public selectedFilter: string; public selectedFilter: string;
public arr_hr_req_only = []; public arr_hr_req_only = [];
public showInformation = true; public showInformation = true;
public showActionHistoryLoading = true;
constructor( constructor(
@ -1000,6 +1001,7 @@ export class WorklistMainComponent implements OnInit {
} }
handleWorkListActionHistoryResult(result) { handleWorkListActionHistoryResult(result) {
this.showActionHistoryLoading = false;
console.log("1" + this.IsReachEnd); console.log("1" + this.IsReachEnd);
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
if (this.common.hasData(result.GetActionHistoryList)) { if (this.common.hasData(result.GetActionHistoryList)) {
@ -1290,7 +1292,7 @@ export class WorklistMainComponent implements OnInit {
showLoading(notificationList) { showLoading(notificationList) {
if (notificationList.length < 0) { if (notificationList.length < 0) {
return true; return true;
} else if (notificationList === []) { } else if (notificationList.length == 0) {
return false; return false;
} else { return true; } } else { return true; }
} }

@ -54,22 +54,22 @@
<ion-card class="offers-discount-card"> <ion-card class="offers-discount-card">
<ion-card-header> <ion-card-header>
<!-- <img [src]="item.Banner_Image" /> --> <!-- <img [src]="item.Banner_Image" /> -->
<div class="header-img" [ngStyle]="{'background-image': 'url(' + item.Banner_Image + ')'}"></div> <div class="header-img" [ngStyle]="{'background-image': 'url(' + item.banner_Image + ')'}"></div>
<ion-card-title *ngIf='direction === "ltr"'>{{item.Title}}</ion-card-title> <ion-card-title *ngIf='direction === "ltr"'>{{item.titleEn}}</ion-card-title>
<ion-card-title *ngIf='direction === "rtl"'>{{item.Title_AR}}</ion-card-title> <ion-card-title *ngIf='direction === "rtl"'>{{item.titleAr}}</ion-card-title>
</ion-card-header> </ion-card-header>
<ion-card-content> <ion-card-content>
<div *ngIf='direction === "ltr"' style="min-height: 60px; max-height: 100%;" [innerHTML]="getDotted(item.Description)"></div> <div *ngIf='direction === "ltr"' style="min-height: 60px; max-height: 100%;" [innerHTML]="getDotted(item.descriptionEn)"></div>
<div *ngIf='direction === "rtl"' style="min-height: 60px; max-height: 100%;" [innerHTML]="getDotted(item.Description_AR)"></div> <div *ngIf='direction === "rtl"' style="min-height: 60px; max-height: 100%;" [innerHTML]="getDotted(item.descriptionAr)"></div>
<div class="dark offers-title"> <div class="dark offers-title">
{{item.Discount}} {{item.discountDescription}}
</div> </div>
<ion-row [class]="checkDate(item['End Date']) ==true ? 'green' : 'red'"> <ion-row [class]="checkDate(item.endDate) ==true ? 'green' : 'red'">
<ion-col size="10" *ngIf="checkDate(item['End Date']) ==true"> <ion-col size="10" *ngIf="checkDate(item.endDate) ==true">
<p class="offer-valid">{{ts.trPK('general','offer-valid')}}</p> <p class="offer-valid">{{ts.trPK('general','offer-valid')}}</p>
</ion-col> </ion-col>
<ion-col size="10" *ngIf="checkDate(item['End Date']) ==false"> <ion-col size="10" *ngIf="checkDate(item.endDate) ==false">
<p class="offer-valid"> {{ts.trPK('general','expired')}}</p> <p class="offer-valid"> {{ts.trPK('general','expired')}}</p>
</ion-col> </ion-col>
<ion-col size="2"> <ion-col size="2">

@ -113,8 +113,7 @@ export class HomeComponent implements AfterViewInit {
displayOffers(data) { displayOffers(data) {
if (data['data']) { if (data['data']) {
var parseJSON = data['data']; var offers = data['data'];
var offers = JSON.parse(parseJSON);
console.log(offers); console.log(offers);
this.offersData = this.filterActiveItems(offers); this.offersData = this.filterActiveItems(offers);
console.log(this.offersData); console.log(this.offersData);
@ -123,7 +122,7 @@ export class HomeComponent implements AfterViewInit {
} }
filterActiveItems(offers) { filterActiveItems(offers) {
return offers.filter((res) => { return offers.filter((res) => {
return res['IsActive'] == 'True'; return res.isActive == true;
}); });
} }
filterOffers(key) { filterOffers(key) {

@ -14,22 +14,22 @@
<!-- <div class="header-img-main" [ngStyle]="{'background-image': 'url(' + details.Banner_Image + ')'}" ></div> <!-- <div class="header-img-main" [ngStyle]="{'background-image': 'url(' + details.Banner_Image + ')'}" ></div>
--> -->
<image-modal size="big" fontsize="1cm" <image-modal size="big" fontsize="1cm"
[src]="details.Banner_Image"> [src]="details.banner_Image">
</image-modal> </image-modal>
<ion-card-title *ngIf="direction =='ltr'">{{details.Title}}</ion-card-title> <ion-card-title *ngIf="direction =='ltr'">{{details.titleEn}}</ion-card-title>
<ion-card-title *ngIf="direction =='rtl'">{{details.Title_AR}}</ion-card-title> <ion-card-title *ngIf="direction =='rtl'">{{details.titleAr}}</ion-card-title>
</ion-card-header> </ion-card-header>
<ion-card-content> <ion-card-content>
<div *ngIf="direction =='ltr'" [innerHTML]="details.Description"> </div> <div *ngIf="direction =='ltr'" [innerHTML]="details.descriptionEn"> </div>
<div *ngIf="direction =='rtl'" [innerHTML]="details.Description_AR"> </div> <div *ngIf="direction =='rtl'" [innerHTML]="details.descriptionAr"> </div>
<div class="content-bottom"> <div class="content-bottom">
<ion-row [class]="checkDate(details['End Date']) ==true ? 'green' : 'red'"> <ion-row [class]="checkDate(details.endDate) ==true ? 'green' : 'red'">
<ion-col size="10" *ngIf="checkDate(details['End Date']) ==true"> <ion-col size="10" *ngIf="checkDate(details.endDate) ==true">
<p class="offer-valid">{{ts.trPK('general','offer-valid')}}</p> <p class="offer-valid">{{ts.trPK('general','offer-valid')}}</p>
</ion-col> </ion-col>
<ion-col size="10" *ngIf="checkDate(details['End Date']) ==false"> <ion-col size="10" *ngIf="checkDate(details.endDate) ==false">
<p class="offer-valid"> {{ts.trPK('general','expired')}}</p> <p class="offer-valid"> {{ts.trPK('general','expired')}}</p>
</ion-col> </ion-col>
@ -69,23 +69,25 @@
<ion-col size="6" *ngFor="let item of related" (click)="openRelated(item)"> <ion-col size="6" *ngFor="let item of related" (click)="openRelated(item)">
<ion-card class="related-card"> <ion-card class="related-card">
<ion-card-header> <ion-card-header>
<div class="header-img" [ngStyle]="{'background-image': 'url(' + item.Banner_Image + ')'}" ></div> <div class="header-img" [ngStyle]="{'background-image': 'url(' + item.banner_Image + ')'}" ></div>
<ion-card-title>{{item.Title}}</ion-card-title> <ion-card-title *ngIf="direction =='ltr'">{{item.titleEn}}</ion-card-title>
<ion-card-title *ngIf="direction =='rtl'">{{item.titleAr}}</ion-card-title>
</ion-card-header> </ion-card-header>
<ion-card-content> <ion-card-content>
<div [innerHTML]="getDotted(item.Description)" class='description'></div> <div *ngIf="direction =='ltr'" [innerHTML]="getDotted(item.descriptionEn)"> </div>
<div *ngIf="direction =='rtl'" [innerHTML]="getDotted(item.descriptionAr)"> </div>
<div class="dark offers-title"> <div class="dark offers-title">
{{item.Discount}} {{item.discountDescription}}
</div> </div>
<ion-row [class]="checkDate(item['End Date']) ==true ? 'green' : 'red'"> <ion-row [class]="checkDate(item.endDate) ==true ? 'green' : 'red'">
<ion-col size="10" *ngIf="checkDate(item['End Date']) ==true"> <ion-col size="10" *ngIf="checkDate(item.endDate) ==true">
<p class="offer-valid">{{ts.trPK('general','offer-valid')}}</p> <p class="offer-valid">{{ts.trPK('general','offer-valid')}}</p>
</ion-col> </ion-col>
<ion-col size="10" *ngIf="checkDate(item['End Date']) ==false"> <ion-col size="10" *ngIf="checkDate(item.endDate) ==false">
<p class="offer-valid"> {{ts.trPK('general','expired')}}</p> <p class="offer-valid"> {{ts.trPK('general','expired')}}</p>
</ion-col> </ion-col>
<ion-col size="2" > <ion-col size="2" >

@ -25,7 +25,7 @@ export class OfferDetailsComponent implements OnInit {
} }
getDotted(temp) { getDotted(temp) {
temp = this.stripHtml(temp); temp = this.stripHtml(temp);
return temp.substring(0, 100) + " ..."; return temp.substring(0, 40) + " ...";
} }
stripHtml(html) { stripHtml(html) {
var temporalDivElement = document.createElement("div"); var temporalDivElement = document.createElement("div");

@ -32,7 +32,7 @@ export class OfferDiscountService {
request['EmployeeNumber'] = request.UserName; request['EmployeeNumber'] = request.UserName;
request['ItgIsActive'] = true; request['ItgIsActive'] = true;
request['ItgPageSize'] = 10; request['ItgPageSize'] = 10;
request['ItgPageNo'] = pageNo; request['ItgPageNo'] = pageNo ? pageNo : 1;
if (catId) { if (catId) {
request['ItgCategoryID'] = categoryId; request['ItgCategoryID'] = categoryId;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -1,6 +0,0 @@
-----BEGIN PRIVATE KEY-----
MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQg+oBl9YdOiMRXfQZe
nIe6tR1tojoOvvcohNJmJtH+SsagCgYIKoZIzj0DAQehRANCAATDY9E82MAgMI/g
bKF1t4zLHJ1Yt9uoOnedNYsfyZLhh3l3ZyXRj02uDXz04AsNbNFjkLJXPc4xY9ad
+A4rY70x
-----END PRIVATE KEY-----
Loading…
Cancel
Save