edsonhoraciojunior/verify-automatic-date-time-zone

Not able to install

Opened this issue · 3 comments

C:\Users\MSD\Desktop\project\lotteryApp>cordova plugin add https://github.com/edsonhoraciojunior/verify-automatic-date-time-zone
(node:11000) UnhandledPromiseRejectionWarning: CordovaError: Failed to fetch plugin https://github.com/edsonhoraciojunior/verify-automatic-date-time-zone via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: cmd: Command failed with exit code 1 Error output:
npm ERR! code ENOLOCAL
npm ERR! Could not install from "..\plug" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\MSD\AppData\Roaming\npm-cache_logs\2019-01-27T09_15_51_560Z-debug.log
at C:\Users\MSD\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\fetch.js:173:37
at _rejected (C:\Users\MSD\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:864:24)
at C:\Users\MSD\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:890:30
at Promise.when (C:\Users\MSD\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:1142:31)
at Promise.promise.promiseDispatch (C:\Users\MSD\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:808:41)
at C:\Users\MSD\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:624:44
at runSingle (C:\Users\MSD\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:137:13)
at flush (C:\Users\MSD\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
(node:11000) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async
function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:11000) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Make sure you’re on the root directory of your app and it contains a package.json file.
Also, in cordova plugin add use the package name not URL, like:

cordova plugin add verify-automatic-date-time-zone

Hello, I have installed the package but everytime I am getting the below error:

**Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'isAutomaticChecked')
TypeError: Cannot read properties of undefined (reading 'isAutomaticChecked')

Even though I have used ionic Platform.ready as shown in the below code:

constructor(
public alertController: AlertController,
private router: Router,
private platform: Platform
) {
this.platform.ready().then(() => {
window.VerifyAutomaticDateTimeZone.isAutomaticChecked(function(isIt){
if (isIt == 'true') {
console.log('true')
alert('true')
// do something
} else {
console.log('false')
alert('false')
// do something else
}
});})
}

It will be great if you help me out.. Thank you

@HARSHITKU The best option would be to create a function and try calling it after the app has initialized completely

not sure why it is undefined after the platform initialized

I have used this in this way in Ionic 1/Angular JS
I have also added a function to open time setting page from in my fork

$rootScope.checkTimeSetting = function(){
                window.VerifyAutomaticDateTimeZone.isAutomaticChecked(function(isIt){
                    if (isIt != 'true') {
                        Global.showAlert(GlobalConstants.errorAlertHeader, "The Automatic Time and Timezone settings are not enabled on your phone.For proper functioning of the app please enable these settings and restart the app",function(){
                            window.VerifyAutomaticDateTimeZone.openTimeSettingPage(function(isIt){
                                navigator.app.exitApp();
                            });
                        });
                    }
                });
            }