pushed for new release
parent
f997ac8812
commit
1d832ba36d
@ -0,0 +1,29 @@
|
||||
<?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>
|
||||
@ -0,0 +1,37 @@
|
||||
#!/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);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,9 @@
|
||||
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();
|
||||
};
|
||||
@ -0,0 +1,7 @@
|
||||
var helper = require('./helper');
|
||||
|
||||
module.exports = function(context) {
|
||||
|
||||
// Remove the Gradle modifications that were added when the plugin was installed.
|
||||
helper.restoreRootBuildGradle();
|
||||
};
|
||||
@ -0,0 +1,131 @@
|
||||
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);
|
||||
},
|
||||
};
|
||||
@ -0,0 +1,93 @@
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
},
|
||||
};
|
||||
@ -0,0 +1,88 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
// 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'
|
||||
})
|
||||
@ -0,0 +1,29 @@
|
||||
<?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>
|
||||
@ -0,0 +1,38 @@
|
||||
#!/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);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,9 @@
|
||||
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();
|
||||
};
|
||||
@ -0,0 +1,7 @@
|
||||
var helper = require('./helper');
|
||||
|
||||
module.exports = function(context) {
|
||||
|
||||
// Remove the Gradle modifications that were added when the plugin was installed.
|
||||
helper.restoreRootBuildGradle();
|
||||
};
|
||||
@ -0,0 +1,117 @@
|
||||
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);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,88 @@
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,29 @@
|
||||
// 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'
|
||||
})
|
||||
@ -0,0 +1,38 @@
|
||||
<?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>
|
||||
@ -0,0 +1,38 @@
|
||||
#!/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);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,9 @@
|
||||
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();
|
||||
};
|
||||
@ -0,0 +1,7 @@
|
||||
var helper = require('./helper');
|
||||
|
||||
module.exports = function(context) {
|
||||
|
||||
// Remove the Gradle modifications that were added when the plugin was installed.
|
||||
helper.restoreRootBuildGradle();
|
||||
};
|
||||
@ -0,0 +1,117 @@
|
||||
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);
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,88 @@
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,112 @@
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
// 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,33 +1,42 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
|
||||
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', redirectTo: 'authentication/login', pathMatch: 'full' },
|
||||
{
|
||||
path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule'},
|
||||
{ path: 'home', loadChildren: './home/home.module#HomePageModule' },
|
||||
{ path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' },
|
||||
{ path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' },
|
||||
{ path: 'accrual-balances', loadChildren: './accrual-balances/accrual-balances.module#AccrualBalancesPageModule' },
|
||||
{ path: 'my-team', loadChildren: './my-team/my-team.module#MyTeamPageModule' },
|
||||
{ path: 'attendance', loadChildren: './attendance/attendance.module#AttendancePageModule' },
|
||||
{ path: 'eit', loadChildren: './eit/eit.module#EITPageModule' },
|
||||
{ path: 'absence', loadChildren: './absence/absence.module#AbsencePageModule' },
|
||||
{ path: 'notification', loadChildren: './notification/notification.module#NotificationPageModule' },
|
||||
{ path: 'my-specialist', loadChildren: './my-specialist/my-specialist.module#MySpecialistPageModule' },
|
||||
{ path: 'my-subordinate', loadChildren: './my-subordinate/my-subordinate.module#MySubordinatePageModule' },
|
||||
{ path: 'time-card', loadChildren: './time-card/time-card.module#TimeCardPageModule' },
|
||||
{ path: 'payslip', loadChildren: './payslip/payslip.module#PayslipPageModule' },
{ path: 'attendance-tracking', loadChildren: './attendance-tracking/attendance-tracking.module#AttendanceTrackingPageModule' }
|
||||
import { NgModule } from '@angular/core';
|
||||
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
|
||||
|
||||
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
/*RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules}),*/
|
||||
RouterModule.forRoot(routes),
|
||||
],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AppRoutingModule { }
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', redirectTo: 'authentication/login', pathMatch: 'full' },
|
||||
{
|
||||
path: 'authentication', loadChildren: './authentication/authentication.module#AuthenticationPageModule'
|
||||
},
|
||||
{ path: 'home', loadChildren: './home/home.module#HomePageModule' },
|
||||
{ path: 'profile', loadChildren: './profile/profile.module#ProfilePageModule' },
|
||||
{ path: 'vacation-rule', loadChildren: './vacation-rule/vacation-rule.module#VacationRulePageModule' },
|
||||
{ path: 'accrual-balances', loadChildren: './accrual-balances/accrual-balances.module#AccrualBalancesPageModule' },
|
||||
{ path: 'my-team', loadChildren: './my-team/my-team.module#MyTeamPageModule' },
|
||||
{ path: 'attendance', loadChildren: './attendance/attendance.module#AttendancePageModule' },
|
||||
{ path: 'eit', loadChildren: './eit/eit.module#EITPageModule' },
|
||||
{ path: 'absence', loadChildren: './absence/absence.module#AbsencePageModule' },
|
||||
{ path: 'notification', loadChildren: './notification/notification.module#NotificationPageModule' },
|
||||
{ path: 'my-specialist', loadChildren: './my-specialist/my-specialist.module#MySpecialistPageModule' },
|
||||
{ path: 'my-subordinate', loadChildren: './my-subordinate/my-subordinate.module#MySubordinatePageModule' },
|
||||
{ path: 'time-card', loadChildren: './time-card/time-card.module#TimeCardPageModule' },
|
||||
{ path: 'payslip', loadChildren: './payslip/payslip.module#PayslipPageModule' },
|
||||
{ path: 'attendance-tracking', loadChildren: './attendance-tracking/attendance-tracking.module#AttendanceTrackingPageModule' },
|
||||
{ path: 'itemforsale', loadChildren: './itemforsale/itemforsale.module#ItemforsalePageModule' },
|
||||
{ path: 'offersdiscount', loadChildren: './offersdiscount/offersdiscount.module#OffersdiscountPageModule' },
|
||||
{ path: 'mowadhafi', loadChildren: './mowadhafi/mowadhafi.module#MowadhafiPageModule' },
|
||||
{ path: 'erm-channel', loadChildren: './erm-channel/erm-channel.module#ErmChannelPageModule' },
|
||||
{ path: 'backend-integrations', loadChildren: './backend-integrations/backend-integrations.module#BackendIntegrationsPageModule' }
|
||||
|
||||
|
||||
|
||||
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
/*RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules}),*/
|
||||
RouterModule.forRoot(routes),
|
||||
],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AppRoutingModule { }
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AppUpdateComponent } from './app-update.component';
|
||||
|
||||
describe('AppUpdateComponent', () => {
|
||||
let component: AppUpdateComponent;
|
||||
let fixture: ComponentFixture<AppUpdateComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AppUpdateComponent ],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AppUpdateComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,24 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'app-app-update',
|
||||
templateUrl: './app-update.component.html',
|
||||
styleUrls: ['./app-update.component.scss'],
|
||||
})
|
||||
export class AppUpdateComponent implements OnInit {
|
||||
@Input() msg: string;
|
||||
|
||||
constructor(public modalController: ModalController) { }
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
dismiss() {
|
||||
// using the injected ModalController this page
|
||||
// can "dismiss" itself and optionally pass back data
|
||||
this.modalController.dismiss({
|
||||
'dismissed': true
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,111 @@
|
||||
<ion-content dir="ltr" *ngIf="userInfo.company_type == 'CS'">
|
||||
<ion-grid class="card-size">
|
||||
<ion-row>
|
||||
<ion-col size='6'>
|
||||
<img class="logo-img-style" [src]='userInfo.company_logo' alt="https://hmgwebservices.com/images/Moheem/CS.jpg"/>
|
||||
</ion-col>
|
||||
<ion-col size='6'>
|
||||
<img class="qr-style" [src]="userInfo.qr"/>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col size='6'>
|
||||
<ion-label>
|
||||
<h1 class='font-text-style' style="font-size: 25px !important; width: 400px;">{{userInfo.name_en}}</h1>
|
||||
</ion-label>
|
||||
</ion-col>
|
||||
<ion-col size='6'>
|
||||
<ion-label>
|
||||
<h1 class='font-text-style name-ar-style'>{{userInfo.name_ar}}</h1>
|
||||
</ion-label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-label>
|
||||
<h5 class='font-text-style'>{{userInfo.job_en}}</h5>
|
||||
</ion-label>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-label>
|
||||
<h5 class='font-text-style' style="position: relative; left: 398px; text-align: end;">{{userInfo.ar}}</h5>
|
||||
</ion-label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-label>
|
||||
<h5 class='font-text-style'>{{userInfo.mobile}}</h5>
|
||||
</ion-label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-label>
|
||||
<h5 class='font-text-style'>{{userInfo.email}}</h5>
|
||||
</ion-label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-label>
|
||||
<h5 class='font-text-style'>{{userInfo.company_url}}</h5>
|
||||
</ion-label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
</ion-content>
|
||||
|
||||
<!-- <ion-footer>
|
||||
<div class="centerDiv" style="margin-top: 20px !important;">
|
||||
<ion-button class="button-login" (click)="dismiss()"><b>{{ts.trPK('general','close')}}</b></ion-button>
|
||||
</div>
|
||||
</ion-footer> -->
|
||||
|
||||
<ion-content dir="ltr" *ngIf="userInfo.company_type != 'CS'">
|
||||
<ion-grid class="cs-card-size">
|
||||
<ion-row>
|
||||
<ion-col style="padding-left: 315px;">
|
||||
<img class="logo-img-hmg-style" [alt]='userInfo.company_logo' src="../assets/icon/HMG_LOGO.png"/>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<img class="qr-img-hmg-style" [src]="userInfo.qr"/>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<ion-label>
|
||||
<h1 class='font-text-style' style="font-size: 25px !important; width: 400px;">{{userInfo.name_en}}</h1>
|
||||
</ion-label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-label>
|
||||
<h5 class='font-text-style'>{{userInfo.job_en}}</h5>
|
||||
</ion-label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-label>
|
||||
<h5 class='font-text-style'>{{userInfo.mobile}}</h5>
|
||||
</ion-label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-label>
|
||||
<h5 class='font-text-style'>{{userInfo.email}}</h5>
|
||||
</ion-label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-label>
|
||||
<h5 class='font-text-style'>{{userInfo.company_url}}</h5>
|
||||
</ion-label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
</ion-content>
|
||||
@ -0,0 +1,233 @@
|
||||
.button-login{
|
||||
--background: #c1272d !important;
|
||||
background: #c1272d !important;
|
||||
white-space: normal;
|
||||
color: var(--light);
|
||||
text-transform: capitalize;
|
||||
min-height: 1.0cm;
|
||||
--border-radius: 33px !important;
|
||||
border-radius: 33px !important;
|
||||
--min-height: 1.6cm !important;
|
||||
width: 315px;
|
||||
}
|
||||
|
||||
|
||||
@media only screen and (max-device-height: 640px) {
|
||||
.digital-id-image-size{
|
||||
width: 70% !important;
|
||||
height: 160% !important;
|
||||
bottom: 0% !important;
|
||||
position: absolute !important;
|
||||
border: 1px solid #e6e6e6 !important;
|
||||
border-radius: 20px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.digital-id-image-size{
|
||||
width: 70%;height: 180%; ; bottom: 0%; position: absolute; border: 1px solid #e6e6e6; border-radius: 20px;
|
||||
}
|
||||
|
||||
.font-text-style{
|
||||
font-family: 'WorkSans-Bold';
|
||||
color: black;
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 400px)and (min-height:800px) and (max-height: 900px) {
|
||||
// CS
|
||||
.card-size{
|
||||
transform: rotate(90deg) !important;
|
||||
padding: 10px !important;
|
||||
padding-right: 0px !important;
|
||||
}
|
||||
.qr-style{
|
||||
left: 410px !important;
|
||||
}
|
||||
.name-ar-style{
|
||||
left: 320px !important;
|
||||
}
|
||||
// HMG
|
||||
.logo-img-hmg-style{
|
||||
left: 360px !important;
|
||||
}
|
||||
.qr-img-hmg-style{
|
||||
left: 580px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 400px) and (min-height:700px) and (max-height: 799px){
|
||||
// CS
|
||||
.card-size{
|
||||
transform: rotate(90deg) !important;
|
||||
padding: 10px !important;
|
||||
padding-right: 0px !important;
|
||||
}
|
||||
.qr-style{
|
||||
left: 324px !important;
|
||||
}
|
||||
.name-ar-style{
|
||||
left: 230px !important;
|
||||
}
|
||||
|
||||
// HMG
|
||||
.logo-img-hmg-style{
|
||||
left: 275px !important;
|
||||
}
|
||||
.qr-img-hmg-style{
|
||||
left: 495px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 325px) and (max-width:399px) and (max-height: 812px){
|
||||
// CS
|
||||
.card-size{
|
||||
transform: rotate(90deg) !important;
|
||||
padding: 5px !important;
|
||||
padding-right: 0px !important;
|
||||
}
|
||||
.qr-style{
|
||||
left: 400px !important;
|
||||
}
|
||||
.name-ar-style{
|
||||
left: 310px !important;
|
||||
}
|
||||
// HMG
|
||||
.logo-img-hmg-style{
|
||||
left: 360px !important;
|
||||
}
|
||||
.qr-img-hmg-style{
|
||||
left: 550px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 325px) and (max-width:399px) and (max-height: 700px){
|
||||
.card-size{
|
||||
transform: rotate(90deg) !important;
|
||||
padding: 5px !important;
|
||||
padding-right: 0px !important;
|
||||
}
|
||||
.qr-style{
|
||||
left: 280px !important;
|
||||
}
|
||||
.name-ar-style{
|
||||
left: 190px !important;
|
||||
}
|
||||
// HMG
|
||||
.logo-img-hmg-style{
|
||||
left: 360px !important;
|
||||
}
|
||||
.qr-img-hmg-style{
|
||||
left: 550px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 325px) and (max-width:399px) and (max-height: 699px){
|
||||
.card-size{
|
||||
transform: rotate(90deg) !important;
|
||||
padding: 5px !important;
|
||||
padding-right: 0px !important;
|
||||
}
|
||||
.qr-style{
|
||||
left: 280px !important;
|
||||
}
|
||||
.name-ar-style{
|
||||
left: 190px !important;
|
||||
}
|
||||
// HMG
|
||||
.logo-img-hmg-style{
|
||||
left: 245px !important;
|
||||
}
|
||||
.qr-img-hmg-style{
|
||||
left: 430px !important;
|
||||
}
|
||||
}
|
||||
@media screen and (min-width: 1px) and (max-width:320px) {
|
||||
.card-size{
|
||||
transform: rotate(90deg) !important;
|
||||
position: relative;
|
||||
bottom: 30px;
|
||||
left: 26px;
|
||||
}
|
||||
.qr-style{
|
||||
width: 80px !important;
|
||||
margin-top: 50px !important;
|
||||
position: relative !important;
|
||||
left: 265px !important;
|
||||
}
|
||||
.name-ar-style{
|
||||
font-size: 15px !important;
|
||||
position: relative !important;
|
||||
left: 130px !important;
|
||||
text-align: end !important;
|
||||
padding: 10px !important;
|
||||
width: 225px !important;
|
||||
}
|
||||
.logo-img-style{
|
||||
width: 80px !important;
|
||||
margin-top: 50px !important;
|
||||
}
|
||||
|
||||
// HMG
|
||||
.logo-img-hmg-style{
|
||||
width: 380px !important;
|
||||
position: fixed !important;
|
||||
left: 200px !important;
|
||||
height: 81px !important;
|
||||
bottom: 205px !important;
|
||||
}
|
||||
.qr-img-hmg-style{
|
||||
width: 105px !important;
|
||||
margin-top: 0px !important;
|
||||
position: relative !important;
|
||||
left: 390px !important;
|
||||
top: 160px !important;
|
||||
}
|
||||
.cs-card-size{
|
||||
padding: 15px !important;
|
||||
padding-top: 0px !important;
|
||||
padding-left: 1px !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.card-size{
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
.qr-style{
|
||||
width: 130px;
|
||||
margin-top: 0px;
|
||||
position: relative;
|
||||
left: 410px;
|
||||
}
|
||||
.name-ar-style{
|
||||
font-size: 25px;
|
||||
position: relative;
|
||||
left: 314px;
|
||||
text-align: end;
|
||||
padding: 10px;
|
||||
width: 225px;
|
||||
}
|
||||
.logo-img-style{
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.logo-img-hmg-style{
|
||||
width: 380px;
|
||||
position: fixed;
|
||||
left: 340;
|
||||
height: 81px;
|
||||
}
|
||||
|
||||
.qr-img-hmg-style{
|
||||
width: 130px;
|
||||
margin-top: 0px;
|
||||
position: relative;
|
||||
left: 560px;
|
||||
top: 160px;
|
||||
}
|
||||
|
||||
.cs-card-size{
|
||||
transform: rotate(90deg);
|
||||
padding: 25px;
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { BusinessCardComponent } from './business-card.component';
|
||||
|
||||
describe('BusinessCardComponent', () => {
|
||||
let component: BusinessCardComponent;
|
||||
let fixture: ComponentFixture<BusinessCardComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ BusinessCardComponent ],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(BusinessCardComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,32 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
||||
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-business-card',
|
||||
templateUrl: './business-card.component.html',
|
||||
styleUrls: ['./business-card.component.scss'],
|
||||
})
|
||||
export class BusinessCardComponent implements OnInit {
|
||||
|
||||
@Input() userInfo: any;
|
||||
public userJobName: any;
|
||||
constructor(
|
||||
public modalCtrl: ModalController,
|
||||
public ts: TranslatorService,
|
||||
public common: CommonService
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
console.log(this.userInfo);
|
||||
}
|
||||
|
||||
|
||||
dismiss() {
|
||||
this.modalCtrl.dismiss({
|
||||
'dismissed': true
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
<app-generic-header
|
||||
showBack="true"
|
||||
[headerText]="'login,announcement' | translate">
|
||||
</app-generic-header>
|
||||
|
||||
<ion-content style="--background:#F4F4F4;">
|
||||
<ion-searchbar mode='md' (ionInput)="filterList($event)" style="--background: white; margin-top: 10px; padding-bottom: 20px;"></ion-searchbar>
|
||||
<ion-list style="background: #f4f4f4; margin-top: -8px !important;">
|
||||
<div *ngFor="let item of announcementList; let i = index"
|
||||
[ngClass]="item.Open ? 'class-dev-close': 'class-dev-open'"
|
||||
style="margin: 15px; background: white; border-radius: 10px;">
|
||||
<!-- <ion-card *ngIf="i === 0 && !item.isOpen" (click)="toggleAnnouncement(item)" class="main-card-style">
|
||||
<img [src]="item.img" class="main-card-image">
|
||||
<ion-item class="main-card-item-list-style">
|
||||
<ion-label class="main-card-label-style-all">
|
||||
<p class="text-style item-list-first-date">{{item.date}}</p>
|
||||
<h2 class="text-style item-list-first-h" *ngIf="direction === 'en'">{{item.title_EN}}</h2>
|
||||
<h2 class="text-style item-list-first-h" *ngIf="direction === 'ar'">{{item.title_AR}}</h2>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
</ion-card>
|
||||
|
||||
<ion-card *ngIf="i === 0 && item.isOpen" (click)="toggleAnnouncement(item)" style="margin: 0px; background: white;">
|
||||
<ion-card-header style="background: transparent;">
|
||||
<ion-card-title *ngIf="direction === 'en'"><h2 class="card-style-h">{{item.title_EN}}</h2><br>
|
||||
<p class="card-style-date">{{item.date}}</p>
|
||||
</ion-card-title>
|
||||
<ion-card-title *ngIf="direction === 'ar'" class="card-style-h">{{item.title_AR}} <br>
|
||||
<p class="card-style-date">{{item.date}}</p>
|
||||
</ion-card-title>
|
||||
<img [src]="item.img" class="image-center">
|
||||
</ion-card-header>
|
||||
<ion-card-content>
|
||||
<p *ngIf="direction === 'en'" class="card-style-p"><span [innerHTML]="item.body_EN"></span></p>
|
||||
<p *ngIf="direction === 'ar'" class="card-style-p">{{item.body_AR}}</p>
|
||||
</ion-card-content>
|
||||
</ion-card> -->
|
||||
|
||||
<ion-item no-padding *ngIf="!item.isOpen && item.img" (click)="toggleAnnouncement(item)" lines='none' class="announcement-items">
|
||||
<img [src]="item.img" [ngClass]="direction === 'en'? 'image-item-en': 'image-item-ar' ">
|
||||
<ion-label style="margin: 5px; margin-top: -20px;">
|
||||
<h2 class="item-list-h" *ngIf="direction === 'en'">{{item.title_EN}}</h2>
|
||||
<!-- <p class="item-list-p-title" *ngIf="direction === 'en'"><span [innerHTML]="item.body_EN"></span></p> -->
|
||||
|
||||
<h2 class="item-list-h" *ngIf="direction === 'ar'">{{item.title_AR}}</h2>
|
||||
<!-- <p class="item-list-p-title" *ngIf="direction === 'ar'">{{item.body_AR}}</p> -->
|
||||
<p class="item-list-date-title">{{item.date}}</p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
<ion-item *ngIf="!item.isOpen && !item.img" (click)="toggleAnnouncement(item)" lines='none' class="announcement-items">
|
||||
<ion-label style="margin: 10px;">
|
||||
<h2 class="item-list-h" *ngIf="direction === 'en'">{{item.title_EN}}</h2>
|
||||
<p class="item-list-p-title" *ngIf="direction === 'en'"><span [innerHTML]="item.body_EN"></span></p>
|
||||
|
||||
<h2 class="item-list-h" *ngIf="direction === 'ar'">{{item.title_AR}}</h2>
|
||||
<p class="item-list-p-title" *ngIf="direction === 'ar'"><span [innerHTML]="item.body_AR"></span></p>
|
||||
<p class="item-list-date-title">{{item.date}}</p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
|
||||
<ion-card *ngIf="item.isOpen" (click)="closeAnnouncement(item)" style="margin: 0px;">
|
||||
<ion-card-header style="background: transparent;">
|
||||
<ion-card-title style="font-size: 20px; margin: 5px;" *ngIf="direction === 'en'">{{detialData.title_EN}} <br>
|
||||
<p style="font-size: 12px; color: gray;">{{detialData.date}}</p>
|
||||
</ion-card-title>
|
||||
<ion-card-title style="font-size: 20px; margin: 5px;" *ngIf="direction === 'ar'">{{detialData.title_AR}} <br>
|
||||
<p style="font-size: 12px; color: gray;">{{detialData.date}}</p>
|
||||
</ion-card-title>
|
||||
<img *ngIf='detialData.img' [src]="detialData.img" class="image-center">
|
||||
<div *ngIf='!detialData.img'></div>
|
||||
</ion-card-header>
|
||||
<ion-card-content>
|
||||
<p *ngIf="direction === 'en'"><span [innerHTML]="detialData.body_EN"></span></p>
|
||||
<p *ngIf="direction === 'ar'"><span [innerHTML]="detialData.body_AR"></span></p>
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
</div>
|
||||
</ion-list>
|
||||
|
||||
<ion-infinite-scroll threshold="100px" (ionInfinite)="loadData($event)">
|
||||
<ion-infinite-scroll-content
|
||||
loadingSpinner="bubbles"
|
||||
loadingText="Loading more data...">
|
||||
</ion-infinite-scroll-content>
|
||||
</ion-infinite-scroll>
|
||||
</ion-content>
|
||||
|
||||
<!-- <ion-footer>
|
||||
<ion-button (click)="loadData($event)"><ion-label><p>more</p></ion-label></ion-button>
|
||||
</ion-footer> -->
|
||||
@ -0,0 +1,140 @@
|
||||
.image-center {
|
||||
width: 100%;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
height: 190px;
|
||||
}
|
||||
.main-card-image {
|
||||
width: 100%;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
}
|
||||
.text-style {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.class-dev-close {
|
||||
// border: 1px solid lightgray;
|
||||
// border-radius: 30px;
|
||||
}
|
||||
.class-dev-open {
|
||||
}
|
||||
|
||||
.class-item-open {
|
||||
border: 1px solid lightgray;
|
||||
border-radius: 30px;
|
||||
height: 100px;
|
||||
}
|
||||
.class-item-close {
|
||||
}
|
||||
|
||||
.image-item-en {
|
||||
padding-left: 5px;
|
||||
width: 100px;
|
||||
min-height: 100px;
|
||||
border: 5px solid white;
|
||||
border-radius: 11px;
|
||||
border-left: 0px;
|
||||
border-right: 0px;
|
||||
object-fit: cover;
|
||||
}
|
||||
.image-item-ar {
|
||||
padding-right: 5px;
|
||||
width: 100px;
|
||||
min-height: 100px;
|
||||
border: 5px solid white;
|
||||
border-radius: 11px;
|
||||
border-left: 0px;
|
||||
border-right: 0px;
|
||||
}
|
||||
|
||||
.announcement-items {
|
||||
border: 1px solid #00000029;
|
||||
border-radius: 10px;
|
||||
height: 100px;
|
||||
box-shadow: 0px 0px 5px #00000000;
|
||||
}
|
||||
|
||||
.item-list-h {
|
||||
font: normal normal 600 14px/11px Poppins;
|
||||
letter-spacing: -0.56px;
|
||||
color: #2b353e;
|
||||
opacity: 1;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.item-list-p-title {
|
||||
font: normal normal medium 11px/16px Poppins;
|
||||
letter-spacing: -0.44px;
|
||||
color: #535353;
|
||||
}
|
||||
.item-list-date-title {
|
||||
font: normal normal 600 10px/16px Poppins;
|
||||
letter-spacing: -0.4px;
|
||||
color: #7c7c7c;
|
||||
}
|
||||
|
||||
.item-list-first-h {
|
||||
font: normal normal bold 23px/24px Poppins;
|
||||
letter-spacing: -0.3px;
|
||||
color: #ffffff;
|
||||
white-space: break-spaces;
|
||||
}
|
||||
.item-list-first-p {
|
||||
font: normal normal normal 12px/17px Poppins;
|
||||
letter-spacing: -0.12px;
|
||||
color: #ffffff;
|
||||
}
|
||||
.item-list-first-date {
|
||||
text-align: left;
|
||||
font: normal normal bold 8px/23px Poppins;
|
||||
letter-spacing: 0px;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.card-style-h {
|
||||
font: normal normal 600 20px/22px Poppins;
|
||||
letter-spacing: -0.8px;
|
||||
color: #2b353e;
|
||||
margin-bottom: -34px;
|
||||
}
|
||||
.card-style-p {
|
||||
font: normal normal medium 13px/18px Poppins;
|
||||
letter-spacing: -0.52px;
|
||||
color: #535353;
|
||||
}
|
||||
|
||||
.card-style-date {
|
||||
font: normal normal 600 12px/18px Poppins;
|
||||
letter-spacing: -0.48px;
|
||||
color: #7c7c7c;
|
||||
}
|
||||
|
||||
.main-card-style {
|
||||
margin: 0px;
|
||||
position: relative;
|
||||
min-height: 283px;
|
||||
}
|
||||
.main-card-item-list-style {
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
--background: transparent;
|
||||
}
|
||||
.main-card-label-stle{
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
width: 237px;
|
||||
}
|
||||
|
||||
.main-card-label-style-all{
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.item-native {
|
||||
padding-left: 5px !important;
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AnnouncementComponent } from './announcement.component';
|
||||
|
||||
describe('AnnouncementComponent', () => {
|
||||
let component: AnnouncementComponent;
|
||||
let fixture: ComponentFixture<AnnouncementComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AnnouncementComponent ],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AnnouncementComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,147 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { detachEmbeddedView } from '@angular/core/src/view';
|
||||
import { AnnouncementService } from 'src/app/hmg-common/services/announcement-services/announcement.service';
|
||||
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
||||
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
|
||||
import { IonInfiniteScroll } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'app-announcement',
|
||||
templateUrl: './announcement.component.html',
|
||||
styleUrls: ['./announcement.component.scss'],
|
||||
})
|
||||
export class AnnouncementComponent implements OnInit {
|
||||
public arr: { id: number, title_EN: string, title_AR: string, body_EN: string, body_AR: string, img?: string, date: Date, isopen: boolean }[] = [];
|
||||
public arrList = [];
|
||||
public listOfAnnouncement;
|
||||
direction: string;
|
||||
public announcementList = [];
|
||||
public numberOfListLength = 10;
|
||||
public announcememntCounter = this.numberOfListLength;
|
||||
@ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;
|
||||
public pageSize = 1;
|
||||
public pageLength = 0;
|
||||
public lengthCounter = 5;
|
||||
public detialData: {
|
||||
id: number,
|
||||
title_EN: string,
|
||||
title_AR: string,
|
||||
body_EN: string,
|
||||
body_AR: string,
|
||||
img?: string,
|
||||
date: Date};
|
||||
|
||||
constructor(
|
||||
public announcementService: AnnouncementService,
|
||||
public translate: TranslatorService,
|
||||
public common: CommonService
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.common.startLoading();
|
||||
this.direction = TranslatorService.getCurrentLanguageName();
|
||||
this.getAnnouncementListService();
|
||||
}
|
||||
|
||||
filterList(event) {
|
||||
const val = event.target.value;
|
||||
if (val === '') {
|
||||
this.announcementList = this.arrList;
|
||||
}
|
||||
this.announcementList = this.arrList.filter((item) => {
|
||||
return (item.title_EN.toLowerCase().indexOf(val.toLowerCase()) > -1);
|
||||
});
|
||||
}
|
||||
|
||||
toggleAnnouncement(item) {
|
||||
this.common.startLoading();
|
||||
let holdData;
|
||||
let data;
|
||||
this.announcementList.forEach(element => {
|
||||
if (element.id === item.id) {
|
||||
this.announcementService.getAnnouncementListService(this.pageSize, item.id).subscribe((result: any) => {
|
||||
this.common.stopLoading();
|
||||
if (this.common.validResponse(result)) {
|
||||
holdData = JSON.parse(result.Mohemm_ITG_ResponseItem);
|
||||
data = JSON.parse(holdData.result.data)[0];
|
||||
console.log(data);
|
||||
this.detialData = {
|
||||
id: data.rowID,
|
||||
title_EN: data.Title_EN,
|
||||
title_AR: data.Title_AR,
|
||||
body_EN: data.Body_EN,
|
||||
body_AR: data.Body_AR,
|
||||
date: data.created,
|
||||
img: data.Banner_Image
|
||||
};
|
||||
element.isOpen = !element.isOpen;
|
||||
// this.common.stopLoading();
|
||||
}
|
||||
console.log(this.detialData);
|
||||
});
|
||||
} else {
|
||||
element.isOpen = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
closeAnnouncement(item){
|
||||
item.isOpen = false;
|
||||
}
|
||||
|
||||
getAnnouncementListService() {
|
||||
// this.common.startLoading();
|
||||
let holdData;
|
||||
this.announcementService.getAnnouncementListService(this.pageSize).subscribe((result: any) => {
|
||||
this.common.stopLoading();
|
||||
if (this.common.validResponse(result)) {
|
||||
holdData = JSON.parse(result.Mohemm_ITG_ResponseItem);
|
||||
this.listOfAnnouncement = JSON.parse(holdData.result.data);
|
||||
this.pageLength = this.listOfAnnouncement[0].TotalItems;
|
||||
for (let i = 0; i < this.listOfAnnouncement.length; i++) {
|
||||
this.listOfAnnouncement[i].Title_EN = this.listOfAnnouncement[i].Title_EN;
|
||||
this.listOfAnnouncement[i].Title_AR = this.listOfAnnouncement[i].Title_AR;
|
||||
this.listOfAnnouncement[i].EmailBody_EN = this.listOfAnnouncement[i].EmailBody_EN;
|
||||
this.listOfAnnouncement[i].EmailBody_AR = this.listOfAnnouncement[i].EmailBody_AR;
|
||||
this.arr[i] = {
|
||||
id: this.listOfAnnouncement[i].rowID,
|
||||
title_EN: this.listOfAnnouncement[i].Title_EN,
|
||||
title_AR: this.listOfAnnouncement[i].Title_AR,
|
||||
body_EN: this.listOfAnnouncement[i].EmailBody_EN,
|
||||
body_AR: this.listOfAnnouncement[i].EmailBody_AR,
|
||||
date: this.listOfAnnouncement[i].created,
|
||||
img: this.listOfAnnouncement[i].Banner_Image,
|
||||
isopen: false
|
||||
};
|
||||
if ( i < this.numberOfListLength){
|
||||
this.announcementList.push(this.arr[i]);
|
||||
}
|
||||
this.arrList.push(this.arr[i]);
|
||||
}
|
||||
}
|
||||
// this.common.stopLoading();
|
||||
});
|
||||
}
|
||||
|
||||
loadData(event) {
|
||||
// let counter = this.numberOfListLength + this.announcememntCounter;
|
||||
setTimeout(() => {
|
||||
event.target.complete();
|
||||
// for(let i = this.announcememntCounter; i < counter; i++) {
|
||||
// if(this.arrList[i]) {
|
||||
// this.announcementList.push(this.arrList[i]);
|
||||
// this.announcememntCounter ++;
|
||||
// }
|
||||
// }
|
||||
this.pageSize += 1;
|
||||
if (this.lengthCounter >= this.pageLength) {
|
||||
event.target.disabled = true;
|
||||
} else {
|
||||
this.getAnnouncementListService();
|
||||
}
|
||||
this.lengthCounter += 5;
|
||||
}, 500);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
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 { HmgCommonModule } from '../hmg-common/hmg-common.module';
|
||||
|
||||
import { BackendIntegrationsPage } from './backend-integrations.page';
|
||||
import { AnnouncementComponent } from './announcement/announcement.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: BackendIntegrationsPage,
|
||||
children: [
|
||||
{
|
||||
path: 'announcement',
|
||||
component: AnnouncementComponent
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
HmgCommonModule,
|
||||
RouterModule.forChild(routes)
|
||||
],
|
||||
declarations: [BackendIntegrationsPage, AnnouncementComponent]
|
||||
})
|
||||
export class BackendIntegrationsPageModule {}
|
||||
@ -0,0 +1,3 @@
|
||||
<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 { BackendIntegrationsPage } from './backend-integrations.page';
|
||||
|
||||
describe('BackendIntegrationsPage', () => {
|
||||
let component: BackendIntegrationsPage;
|
||||
let fixture: ComponentFixture<BackendIntegrationsPage>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ BackendIntegrationsPage ],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(BackendIntegrationsPage);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-backend-integrations',
|
||||
templateUrl: './backend-integrations.page.html',
|
||||
styleUrls: ['./backend-integrations.page.scss'],
|
||||
})
|
||||
export class BackendIntegrationsPage implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
|
||||
import { EitTransactionModel } from './eit.transaction.model';
|
||||
|
||||
export class EitAddressRequest {
|
||||
public static SHARED_DATA = 'eit-request';
|
||||
public P_MENU_TYPE: string;
|
||||
public P_SELECTED_EMPLOYEE_NUMBER: string;
|
||||
public P_FUNCTION_NAME: string;
|
||||
public P_SELECTED_RESP_ID: Number;
|
||||
P_DESC_FLEX_CONTEXT_CODE: string;
|
||||
EITTransactionTBL: EitTransactionModel[];
|
||||
P_COUNTRY_CODE: string;
|
||||
P_EFFECTIVE_DATE: string;
|
||||
P_ACTION: string;
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
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 { IonicRatingModule } from 'ionic4-rating';
|
||||
import { ErmChannelPage } from './erm-channel.page';
|
||||
import { HomeComponent } from './home/home.component';
|
||||
import { SurveyComponent } from './survey/survey.component';
|
||||
import { HmgCommonModule } from '../hmg-common/hmg-common.module';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: ErmChannelPage,
|
||||
children: [
|
||||
{
|
||||
path: 'home',
|
||||
component: HomeComponent
|
||||
},
|
||||
{
|
||||
path: 'survey',
|
||||
component: SurveyComponent
|
||||
},
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
IonicRatingModule,
|
||||
HmgCommonModule,
|
||||
RouterModule.forChild(routes)
|
||||
],
|
||||
declarations: [ErmChannelPage, HomeComponent, SurveyComponent]
|
||||
})
|
||||
export class ErmChannelPageModule { }
|
||||
@ -0,0 +1,4 @@
|
||||
|
||||
<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 { ErmChannelPage } from './erm-channel.page';
|
||||
|
||||
describe('ErmChannelPage', () => {
|
||||
let component: ErmChannelPage;
|
||||
let fixture: ComponentFixture<ErmChannelPage>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ErmChannelPage ],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ErmChannelPage);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-erm-channel',
|
||||
templateUrl: './erm-channel.page.html',
|
||||
styleUrls: ['./erm-channel.page.scss'],
|
||||
})
|
||||
export class ErmChannelPage implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
<div class="full-ads" >
|
||||
|
||||
<img [src]="advertisement.base64String" *ngIf="advertisement.contentType =='image/jpeg'"/>
|
||||
|
||||
<video style="width: 100%; position: absolute; bottom: 45%;" autoplay="autoplay" *ngIf="advertisement.contentType =='video/mp4'" controls>
|
||||
<source type="video/mp4" [src]="advertisement.base64String">
|
||||
</video>
|
||||
|
||||
<!-- <div class="skip-btn" (click)="skip()" *ngIf="isSkip ==true">{{ts.trPK('worklistMain','skip')}}</div> -->
|
||||
|
||||
<div class="info-container">
|
||||
<div class="seconds" *ngIf="isSkip ==false">{{setTime}}</div>
|
||||
<div *ngIf="setTime ==0">
|
||||
<ion-icon name="thumbs-down" class="red" (click)="setView('Dislike')"></ion-icon>
|
||||
<img src="../../../assets/imgs/light-bulb.svg" style="width: 70px; padding: 15px;" (click)="setView('Info')">
|
||||
<ion-icon name="thumbs-up" class="green" (click)="setView('Like')"></ion-icon>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1,48 @@
|
||||
.full-ads{
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-size: cover;
|
||||
}
|
||||
.skip-btn{
|
||||
position: absolute;
|
||||
background: black;
|
||||
color: #fff;
|
||||
margin: 10px;
|
||||
right: 10px;
|
||||
padding: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.info-container {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
bottom: 10%;
|
||||
position: absolute;
|
||||
}
|
||||
.info-container ion-icon{
|
||||
margin: 10px;
|
||||
font-size: 32px;
|
||||
padding: 10px;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
}
|
||||
.red{
|
||||
background: #ff5757;
|
||||
|
||||
color: #fff;
|
||||
}
|
||||
.green{
|
||||
background: #23f172;
|
||||
|
||||
color: #fff;
|
||||
}
|
||||
.white{
|
||||
background: #fff;
|
||||
|
||||
color: #000;
|
||||
}
|
||||
.seconds{
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HomeComponent } from './home.component';
|
||||
|
||||
describe('HomeComponent', () => {
|
||||
let component: HomeComponent;
|
||||
let fixture: ComponentFixture<HomeComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ HomeComponent ],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HomeComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,68 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { NavController } from '@ionic/angular';
|
||||
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
|
||||
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
templateUrl: './home.component.html',
|
||||
styleUrls: ['./home.component.scss'],
|
||||
})
|
||||
export class HomeComponent implements OnInit {
|
||||
isSkip: boolean = false;
|
||||
setTime: number = 5;
|
||||
advertisement: any;
|
||||
data: any;
|
||||
constructor(public nav: NavController, public cs: CommonService, public sanitizer: DomSanitizer, public authService: AuthenticationService, public ts: TranslatorService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.data = this.cs.sharedService.getSharedData(
|
||||
AuthenticationService.ADS_DATA,
|
||||
false
|
||||
);
|
||||
this.advertisement = this.data.result.data.advertisement.viewAttachFileColl[0];
|
||||
this.setTime = this.data.result.data.advertisement.durationInSeconds;
|
||||
this.setTimer();
|
||||
}
|
||||
skip() {
|
||||
this.nav.pop();
|
||||
CommonService.SKIP = true;
|
||||
}
|
||||
setTimer() {
|
||||
setTimeout(() => {
|
||||
this.setTime--;
|
||||
if (this.setTime == 0) {
|
||||
this.isSkip = true;
|
||||
} else {
|
||||
this.setTimer();
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
setView(status) {
|
||||
// var request =
|
||||
// {
|
||||
// "ItgSurveyId": data.serviceId, "ItgNotificationMasterId": data.notificationMasterId, "ItgComments": this.note, "ItgQuestionResponses": [
|
||||
// { "questionId": 1, "optionId": null, "starRating": parseInt(this.rate) },
|
||||
// { "questionId": 2, "optionId": 4, "starRating": parseInt(this.satisfied) }
|
||||
// ]
|
||||
// };
|
||||
|
||||
|
||||
|
||||
this.authService.setViewAds({
|
||||
"ItgNotificationMasterId": this.data.result.data.notificationMasterId,
|
||||
"ItgAdvertisement": {
|
||||
"advertisementId": this.data.result.data.advertisementId,
|
||||
"acknowledgment": status
|
||||
}
|
||||
}, (
|
||||
|
||||
) => { }, this.ts.trPK('general', 'ok')).subscribe((result) => {
|
||||
CommonService.SKIP = true;
|
||||
this.cs.openHome();
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
<ion-content padding class="survey-content">
|
||||
<!-- <div class="skip-btn" (click)="skip()" *ngIf="isSkip ==true">{{ts.trPK('worklistMain','skip')}} </div>
|
||||
<div class="seconds" *ngIf="isSkip ==false">{{setTime}}</div> -->
|
||||
<ion-grid class="ion-no-padding grid-parent">
|
||||
<ion-row>
|
||||
<ion-text class="title-text">
|
||||
|
||||
{{ts.trPK('erm-channel','fedback-about-ux')}}
|
||||
</ion-text>
|
||||
</ion-row>
|
||||
|
||||
<ion-row>
|
||||
<ion-col [size]="12">
|
||||
<p class="subheading">1. {{ts.trPK('erm-channel','how-would-you-like')}} </p>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col [size]="12">
|
||||
<rating id="surveyRatingNew" [(ngModel)]="rate" readonly="false" size="default"></rating>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
<ion-grid>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<p class="subheading">2. {{ts.trPK('erm-channel','how-would-you-satisfied')}} </p>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row class="faces-row">
|
||||
<ion-col [ngClass]="{'select2' : satisfied=='1'}">
|
||||
<img class="face" src="assets/icon/rate/poor.svg" (click)="select(1)">
|
||||
</ion-col>
|
||||
<ion-col [ngClass]="{'select2' : satisfied=='2'}">
|
||||
<img class="face" src="assets/icon/rate/bad.svg" (click)="select(2)">
|
||||
</ion-col>
|
||||
<ion-col [ngClass]="{'select2' : satisfied=='3'}">
|
||||
<img class="face" src="assets/icon/rate/normal.svg" (click)="select(3)">
|
||||
</ion-col>
|
||||
<ion-col [ngClass]="{'select2' : satisfied=='4'}">
|
||||
<img class="face" src="assets/icon/rate/good.svg" (click)="select(4)">
|
||||
</ion-col>
|
||||
<ion-col [ngClass]="{'select2' : satisfied=='5'}">
|
||||
<img class="face" src="assets/icon/rate/xcellent.svg" (click)="select(5)">
|
||||
</ion-col>
|
||||
|
||||
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<p class="comments"> {{ts.trPK('erm-channel','give-comments')}} </p>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-card class="doctor-card">
|
||||
|
||||
<ion-row class="input-field">
|
||||
<ion-col [size]="12">
|
||||
|
||||
|
||||
<ion-textarea rows="6" cols="20" [(ngModel)]="note" [placeholder]="ts.trPK('replacementRoll','enterNote')"></ion-textarea>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-card>
|
||||
|
||||
</ion-content>
|
||||
<ion-footer >
|
||||
<div class="centerDiv">
|
||||
<ion-button class="footer-button" ion-button (click)="saveSurvey()" [disabled]="!rate || (rate==1 && !note)">
|
||||
{{'general,submit' | translate}} </ion-button>
|
||||
|
||||
</div>
|
||||
</ion-footer>
|
||||
@ -0,0 +1,55 @@
|
||||
|
||||
.survey-content{
|
||||
--background:#f5f5f5;
|
||||
|
||||
}
|
||||
.title-text{ font-size: 28px; font-weight: bold;text-align: center; margin-top:20%}
|
||||
.survey-content{
|
||||
margin-top:50px;
|
||||
}
|
||||
.subheading{
|
||||
margin:30px 30px 0px 30px;
|
||||
font-size: 20px;
|
||||
font-weight: bold;}
|
||||
|
||||
.bottom-line{
|
||||
height: 150px;
|
||||
}
|
||||
.doctor-card{
|
||||
background: #fff;
|
||||
margin: 10px 20px 10px 20px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.comments{
|
||||
margin-left: 20px;
|
||||
margin-bottom: 0;
|
||||
font-weight: bold;
|
||||
}
|
||||
.faces-row{
|
||||
margin-left: 20px;
|
||||
margin-right:20px;
|
||||
}
|
||||
.faces-row ion-col{
|
||||
background: #fff;
|
||||
text-align: center;
|
||||
border-radius: 7px;
|
||||
margin: 5px;
|
||||
}
|
||||
ion-footer .footer-button{
|
||||
--background: #259CB8;
|
||||
width: 80%;
|
||||
background: #259CB8;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.skip-btn{
|
||||
position: absolute;
|
||||
background: black;
|
||||
color: #fff;
|
||||
margin: 10px;
|
||||
right: 10px;
|
||||
padding: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.select2{
|
||||
border:1px solid #000;
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SurveyComponent } from './survey.component';
|
||||
|
||||
describe('SurveyComponent', () => {
|
||||
let component: SurveyComponent;
|
||||
let fixture: ComponentFixture<SurveyComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SurveyComponent ],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SurveyComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,63 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { NavController } from '@ionic/angular';
|
||||
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
|
||||
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
||||
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-survey',
|
||||
templateUrl: './survey.component.html',
|
||||
styleUrls: ['./survey.component.scss'],
|
||||
})
|
||||
export class SurveyComponent implements OnInit {
|
||||
rate: any;
|
||||
isSkip: boolean = false;
|
||||
setTime: number = 5;
|
||||
satisfied: any = '5';
|
||||
note: any;
|
||||
constructor(public ts: TranslatorService, public cs: CommonService, public nav: NavController, public authService: AuthenticationService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.setTimer();
|
||||
}
|
||||
skip() {
|
||||
this.nav.pop();
|
||||
CommonService.SKIP = true;
|
||||
}
|
||||
setTimer() {
|
||||
setTimeout(() => {
|
||||
this.setTime--;
|
||||
if (this.setTime == 0) {
|
||||
this.isSkip = true;
|
||||
} else {
|
||||
this.setTimer();
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
saveSurvey() {
|
||||
|
||||
var data = this.cs.sharedService.getSharedData(
|
||||
AuthenticationService.SERVEY_DATA,
|
||||
false
|
||||
)
|
||||
|
||||
var request =
|
||||
{
|
||||
"ItgSurveyId": data.serviceId, "ItgNotificationMasterId": data.notificationMasterId, "ItgComments": this.note, "ItgQuestionResponses": [
|
||||
{ "questionId": 1, "optionId": null, "starRating": parseInt(this.rate) },
|
||||
{ "questionId": 2, "optionId": 4, "starRating": parseInt(this.satisfied) }
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
|
||||
this.authService.saveAdsStatus(request, () => { }, this.ts.trPK('general', 'ok')).subscribe((result) => {
|
||||
CommonService.SKIP = true;
|
||||
this.cs.openHome();
|
||||
})
|
||||
}
|
||||
select(rating) {
|
||||
this.satisfied = rating;
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,130 @@
|
||||
import { Injectable } from "@angular/core";
|
||||
import { BackgroundGeolocation } from '@ionic-native/background-geolocation/ngx';
|
||||
import { CommonService } from "src/app/hmg-common/services/common/common.service";
|
||||
import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service";
|
||||
import { DevicePermissionsService } from 'src/app/hmg-common/services/device-permissions/device-permissions.service';
|
||||
import { Geolocation } from '@ionic-native/geolocation/ngx';
|
||||
import { Platform } from "@ionic/angular";
|
||||
|
||||
declare const cordova: any;
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class HMGUtils {
|
||||
constructor(
|
||||
public backgroundGeolocation: BackgroundGeolocation,
|
||||
public common: CommonService,
|
||||
public ts: TranslatorService,
|
||||
private geolocation: Geolocation,
|
||||
public platform: Platform,
|
||||
public devicePermissionsService:DevicePermissionsService,
|
||||
) { }
|
||||
|
||||
async getCurrentLocation(callBack: Function) {
|
||||
|
||||
this.devicePermissionsService.requestLocationAutherization().then( async granted => {
|
||||
if(granted == true) {
|
||||
if (this.platform.is('android')) {
|
||||
if ((await this.isHuaweiDevice())) {
|
||||
this.getHMSLocation(callBack);
|
||||
} else {
|
||||
this.getGMSLocation(callBack);
|
||||
}
|
||||
} else {
|
||||
this.getIOSLocation(callBack);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
async isHuaweiDevice(): Promise<boolean> {
|
||||
const result: any = await new Promise((resolve, reject) => {
|
||||
cordova.plugins.CordovaHMSGMSCheckPlugin.isHmsAvailable(
|
||||
"index.js",
|
||||
(_res) => {
|
||||
const hmsAvailable = _res === "true";
|
||||
resolve(hmsAvailable);
|
||||
},
|
||||
(_err) => {
|
||||
reject({ "status": false, "error": JSON.stringify(_err) });
|
||||
this.common.presentAlert(this.ts.trPK('general', 'huawei-hms-gms-error'));
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private getHMSLocation(callBack: Function) {
|
||||
try {
|
||||
cordova.plugins.CordovaHMSLocationPlugin.requestLocation(
|
||||
"index.js",
|
||||
(_res) => {
|
||||
console.log("Huawei Location Success: [Stop Getting]");
|
||||
cordova.plugins.CordovaHMSLocationPlugin.removeLocation("", (_res) => { }, (_err) => { });
|
||||
const location = _res.split(',')
|
||||
console.log(location);
|
||||
if (location.length == 3) {
|
||||
let mock = false;
|
||||
const lat = Number(_res.split(',')[0]);
|
||||
const long = Number(_res.split(',')[1]);
|
||||
const mockValue = _res.split(',')[2];
|
||||
|
||||
// if (mockValue == 'true') {
|
||||
// mock = true;
|
||||
// } else {
|
||||
// mock = false;
|
||||
// }
|
||||
callBack({"latitude":lat, "longitude":long, "isfake":mock})
|
||||
} else {
|
||||
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) {
|
||||
console.log("Huawei Location Plugin [Error]: " + + JSON.stringify(_err));
|
||||
this.common.presentAlert(this.ts.trPK('general', 'huawei-plugin-issue'));
|
||||
}
|
||||
}
|
||||
|
||||
private getGMSLocation(callBack: Function) {
|
||||
this.backgroundGeolocation.getCurrentLocation({ timeout: 10000, enableHighAccuracy: true, maximumAge: 3000 }).then((resp) => {
|
||||
if (resp && (resp.latitude && resp.longitude)) {
|
||||
const isFakeLocation = resp.isFromMockProvider || resp.mockLocationsEnabled;
|
||||
const lat = resp.latitude;
|
||||
const long = resp.longitude;
|
||||
callBack({"latitude":lat, "longitude":long, "isfake":isFakeLocation})
|
||||
} else {
|
||||
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
|
||||
}
|
||||
}, (error) => {
|
||||
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
|
||||
});
|
||||
}
|
||||
|
||||
private getIOSLocation(callBack: Function) {
|
||||
this.geolocation.getCurrentPosition({ maximumAge: 3000, timeout: 10000, enableHighAccuracy: true }).then(resp => {
|
||||
if (resp && resp.coords.latitude && resp.coords.longitude) {
|
||||
const lat = resp.coords.latitude;
|
||||
const long = resp.coords.longitude;
|
||||
callBack({"latitude":lat, "longitude":long, "isfake":false})
|
||||
} else {
|
||||
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
|
||||
}
|
||||
}).catch(error => {
|
||||
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AnnouncementService } from './announcement.service';
|
||||
|
||||
describe('AnnouncementService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: AnnouncementService = TestBed.get(AnnouncementService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,35 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Request } from 'src/app/hmg-common/services/models/request';
|
||||
import { Observable } from 'rxjs';
|
||||
import { AuthenticationService } from '../authentication/authentication.service';
|
||||
import { ConnectorService } from '../connector/connector.service';
|
||||
import { AnnouncementRequest } from '../models/announcement-request';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AnnouncementService {
|
||||
public static getAnnouncemntList = 'Services/COCWS.svc/REST/GetAnnouncementDiscountsConfigData';
|
||||
|
||||
constructor(
|
||||
public authService: AuthenticationService,
|
||||
public con: ConnectorService,
|
||||
) { }
|
||||
|
||||
|
||||
getAnnouncementListService(pageNumber: number, id?: number, onError ?: any , oerrorLable ?: any) {
|
||||
const request = new AnnouncementRequest();
|
||||
this.authService.authenticateRequest(request);
|
||||
request.EmployeeNumber = request.P_USER_NAME;
|
||||
request.ItgPageNo = pageNumber;
|
||||
request.ItgPageSize = 5;
|
||||
request.ItgAwarenessID = 0;
|
||||
request.ItgRowID = (id) ? Number(id) : 0;
|
||||
return this.con.postNoLoad(
|
||||
AnnouncementService.getAnnouncemntList,
|
||||
request,
|
||||
onError,
|
||||
oerrorLable
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
|
||||
import { Request } from 'src/app/hmg-common/services/models/request';
|
||||
|
||||
export class AnnouncementRequest extends Request {
|
||||
public TokenID: string;
|
||||
public EmployeeNumber: string;
|
||||
public ItgPageNo: number;
|
||||
public ItgPageSize: number;
|
||||
public ItgAwarenessID: number;
|
||||
public ItgRowID: number;
|
||||
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
<div class="main-container" [ngStyle]="active === true ? {'color': color} : {}">
|
||||
<div class="main-container-radius" [ngStyle]="active === true ? {'color': '#ffffff'} : {'color': color}"></div>
|
||||
<span class="text-span" [ngStyle]="active === true ? {'color': '#269DB8'} : {}">{{text}}</span>
|
||||
</div>
|
||||
@ -0,0 +1,21 @@
|
||||
|
||||
|
||||
.main-container{
|
||||
width: 47px;
|
||||
position: relative;
|
||||
margin-left: 9px;
|
||||
}
|
||||
.main-container-radius{
|
||||
position: absolute;
|
||||
width: 30px;
|
||||
}
|
||||
.number-span{
|
||||
display: block;
|
||||
|
||||
}
|
||||
|
||||
.text-span{
|
||||
font-size: 13px;
|
||||
font-family: var(--fontFamilyPoppins-SemiBold, inherit);
|
||||
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CardCalendarComponent } from './card-calendar.component';
|
||||
|
||||
describe('CardCalendarComponent', () => {
|
||||
let component: CardCalendarComponent;
|
||||
let fixture: ComponentFixture<CardCalendarComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CardCalendarComponent ],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CardCalendarComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,18 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-card-calendar',
|
||||
templateUrl: './card-calendar.component.html',
|
||||
styleUrls: ['./card-calendar.component.scss'],
|
||||
})
|
||||
export class CardCalendarComponent implements OnInit {
|
||||
|
||||
@Input() text: string;
|
||||
@Input() active: boolean;
|
||||
@Input() color: string;
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue