Neues Initialrelease mit IonicMaterial

This commit is contained in:
Carsten Hilmer
2016-08-22 12:55:52 +02:00
parent 30a5df79aa
commit 45e482b14d
1249 changed files with 305225 additions and 68794 deletions

View File

@@ -0,0 +1,59 @@
<!--View Information-->
<!--View name : Schedule Push Notification-->
<!--Controller name : schedulePushNotificationCtrl-->
<!--Controller path : www/templates/push-notification/schedule-push-notification/js/controllers.js-->
<!--State name : app.schedulePushNotification-->
<!--URL : #app/schedulePushNotification-->
<ion-view title="Schedule Push Notification">
<!--push notification section-->
<ion-content id="push-notification">
<!--header section-->
<form>
<div>
<i class="fa fa-clock-o md-primary-color"></i>
</div>
<div class="sub-header">Schedule Push Notification</div>
<br/>
</form><!--end header section-->
<!--notification option section-->
<div class="notification-option">
<md-input-container md-no-float="">
<input ng-model="notificationMessage" placeholder="Notification Message Here.">
</md-input-container>
<md-input-container md-no-float="">
<input ng-model="startNotificationIn" placeholder="How many second to start send? " numbers-only type="tel">
</md-input-container>
<md-input-container md-no-float="">
<md-select ng-model="mdSelectValue" aria-label="md-option">
<md-option value="minute">Send Every Minute </md-option>
<md-option value="hour">Send Every Hour </md-option>
<md-option value="week">Send Every Week </md-option>
<md-option value="month">Send Every Month </md-option>
<md-option value="year">Send Every Year </md-option>
<md-option value="day">Send Every Day </md-option>
</md-select>
</md-input-container>
<a class="md-raised social-button md-button md-default-theme material-background"
ng-click="schedulePush(notificationMessage,startNotificationIn,mdSelectValue)">
Send Push Notification
</a>
<br/>
<a class="md-raised social-button md-button md-default-theme material-background"
ng-click="clearAllNotification()">
Clear All Push Notification
</a>
<!--footer section-->
<div class="footer">
Push Notification will show at <br/> Notification center of your devise.
</div><!--end footer section-->
</div><!--end notification option section-->
</ion-content><!--end push notification section-->
</ion-view>

View File

@@ -0,0 +1,152 @@
// For using Local Push Notification you have to install cordova-plugin-local-notifications by running the following
// command in your cmd.exe for windows or terminal for mac:
// $ cd your_project_path
// $ ionic plugin add https://github.com/katzer/cordova-plugin-local-notifications
//
// Push Notification will show at Notification center of your devise.
// Controller of Schedule Push Notification page.
appControllers.controller('schedulePushNotificationCtrl', function ($scope, $mdToast) {
// initialForm is the first activity in the controller.
// It will initial all variable data and let the function works when page load.
$scope.initialForm = function () {
// mdSelectValue is variable for md-select.
$scope.mdSelectValue = "minute";
// notificationMessage is variable for message that going to sent push notification.
$scope.notificationMessage = "";
// startNotificationIn is variable that use for calculate for start time of send push notification.
$scope.startNotificationIn = "";
$scope.setUpPushNotification();
};// End initialForm.
// setUpPushNotification is for set up the mobile to allow push notification from application.
$scope.setUpPushNotification = function(){
document.addEventListener('deviceready', function() {
//To check that application have permission that allow push notification or not.
cordova.plugins.notification.local.hasPermission(function(granted) {
if (granted == false) {
// To asking mobile for the permission to allow push notification.
cordova.plugins.notification.local.registerPermission(function(granted) {
console.log('registerPermission has been granted: ' + granted);
});
}
});
}, false);
};// End setUpPushNotification.
// schedulePush is for send schedule push notification.
// Parameter :
// message = message that going to sent push notification.
// startNotificationIn = use for calculate for start time of send push notification.
// processEvery :
// value of process type that select from the view.
// The possible value is only: "minute", "hour", "week", "month", "year","day".
$scope.schedulePush = function(message,startNotificationIn,processEvery) {
// Get current time.
var now = new Date().getTime();
// Get start process time of send a push notification.
var startProcessTime = new Date(now + startNotificationIn * 1000);
try{
// Send schedule push notification
// When call a plugins.notification.local have to call in deviceready function.
document.addEventListener('deviceready', function () {
// Calling plugins.notification.local.schedule to send push notification.
cordova.plugins.notification.local.schedule({
id: 1,
text: "Message: " + message,
at: startProcessTime,
every: processEvery
});
// Showing toast for send schedule push notification success.
$mdToast.show({
controller: 'toastController',
templateUrl: 'toast.html',
hideDelay: 400,
position: 'top',
locals: {
displayOption: {
title: "Message: " + message
}
}
});//End showing toast.
}, false);// End Send schedule push notification
}
catch (e) {
// Showing toast for unable to send schedule push notification.
$mdToast.show({
controller: 'toastController',
templateUrl: 'toast.html',
hideDelay: 800,
position: 'top',
locals: {
displayOption: {
title: window.globalVariable.message.errorMessage
}
}
});// End showing toast.
}
};// End schedulePush.
// callback is for get push notification ID that prepare for clear all push notification.
$scope.callback = function() {
// When call a plugins.notification.local have to call in deviceready function.
document.addEventListener('deviceready', function() {
// Calling plugins.notification.local.getIds to get push notification ids.
cordova.plugins.notification.local.getIds(function(ids) {});
}, false);
};// End callback.
// clearAllNotification is for clear all push notification.
$scope.clearAllNotification = function() {
try{
// Clear All push Notification
// When call a plugins.notification.cancelAll have to call in deviceready function.
document.addEventListener('deviceready', function() {
// Calling plugins.notification.local.cancelAll to clear all push notification.
cordova.plugins.notification.local.cancelAll($scope.callback);
// Showing toast for clear all push notification success.
$mdToast.show({
controller: 'toastController',
templateUrl: 'toast.html',
hideDelay: 400,
position: 'top',
locals: {
displayOption: {
title:"Clear All Notification Success."
}
}
});//End showing toast.
}, false);
}
catch (e) {
// Showing toast for unable to clear all push notification.
$mdToast.show({
controller: 'toastController',
templateUrl: 'toast.html',
hideDelay: 800,
position: 'top',
locals: {
displayOption: {
title: window.globalVariable.message.errorMessage
}
}
});// End showing toast.
}
};// End clearAllNotification.
$scope.initialForm();
});// End of controller Schedule Push Notification.

View File

@@ -0,0 +1,42 @@
<!--View Information-->
<!--View name : Single Push Notification-->
<!--Controller name : singlePushNotificationCtrl-->
<!--Controller path : www/templates/push-notification/single-push-notification/js/controllers.js-->
<!--State name : app.singlePushNotification-->
<!--URL : #app/singlePushNotification-->
<ion-view title="Single Push Notification">
<!--push notification section-->
<ion-content id="push-notification">
<!--header section-->
<form>
<div>
<i class="fa fa-sign-in fa-rotate-90 md-primary-color"></i>
</div>
<div class="sub-header">Single Push Notification</div>
<br/>
</form><!--end header section-->
<!--notification option section-->
<div class="notification-option">
<md-input-container md-no-float="">
<input ng-model="notificationMessage" placeholder="Notification Message Here.">
</md-input-container>
<a class="md-raised social-button md-button md-default-theme material-background"
ng-click="singlePush(notificationMessage)">
Send Push Notification
</a>
<br/>
<a class="md-raised social-button md-button md-default-theme material-background"
ng-click="clearAllNotification()">
Clear All Push Notification
</a>
<!--footer section-->
<div class="footer">
Push Notification will show at <br/> Notification center of your devise.
</div><!--end footer section-->
</div><!--end notification option section-->
</ion-content><!--end push notification section-->
</ion-view>

View File

@@ -0,0 +1,134 @@
// For using Local Push Notification you have to install cordova-plugin-local-notifications by running the following
// command in your cmd.exe for windows or terminal for mac:
// $ cd your_project_path
// $ ionic plugin add https://github.com/katzer/cordova-plugin-local-notifications
//
// Push Notification will show at Notification center of your devise.
// Controller of Single Push Notification page.
appControllers.controller('singlePushNotificationCtrl', function($scope, $mdToast) {
// initialForm is the first activity in the controller.
// It will initial all variable data and let the function works when page load.
$scope.initialForm = function () {
// message is variable for message that going to sent push.
$scope.notificationMessage = "";
$scope.setUpPushNotification();
};// End initialForm.
// setUpPushNotification is for set up the mobile to allow push notification from application.
$scope.setUpPushNotification = function(){
document.addEventListener('deviceready', function() {
//To check that application have permission that allow push notification or not.
cordova.plugins.notification.local.hasPermission(function(granted) {
if (granted == false) {
// To asking mobile for the permission to allow push notification.
cordova.plugins.notification.local.registerPermission(function(granted) {
console.log('registerPermission has been granted: ' + granted);
});
}
});
}, false);
};// End setUpPushNotification.
// singlePush is for send single push notification.
// Parameter :
// message = message that going to sent push notification.
$scope.singlePush = function(message) {
try{
// Send push notification
// When call a plugins.notification.local have to call in deviceready function.
document.addEventListener('deviceready', function() {
// Calling plugins.notification.local.schedule to send push.
cordova.plugins.notification.local.schedule({
text: "Message: " + message,
icon: "img/icon.png"
});
// Showing toast for send push notification success.
$mdToast.show({
controller: 'toastController',
templateUrl: 'toast.html',
hideDelay: 400,
position: 'top',
locals: {
displayOption: {
title: "Message: " + message
}
}
});//End showing toast.
}, false);// End Send push notification
}
catch (e) {
// Showing toast for unable to send push notification.
$mdToast.show({
controller: 'toastController',
templateUrl: 'toast.html',
hideDelay: 800,
position: 'top',
locals: {
displayOption: {
title: window.globalVariable.message.errorMessage
}
}
});// End showing toast.
}
};// End schedulePush.
// callback is for get push ID that prepare for clear all push notification.
$scope.callback = function() {
// When call a plugins.notification.local have to call in deviceready function.
document.addEventListener('deviceready', function() {
// Calling plugins.notification.local.getIds to get push ids.
cordova.plugins.notification.local.getIds(function(ids) {});
}, false);
};// End callback.
// clearAllNotification is for clear all push notification.
$scope.clearAllNotification = function() {
try{
// Clear All push Notification
// When call a plugins.notification.cancelAll have to call in deviceready function.
document.addEventListener('deviceready', function() {
// Calling plugins.notification.local.cancelAll to clear all push notification.
cordova.plugins.notification.local.cancelAll($scope.callback);
// Showing toast for clear all push notification success.
$mdToast.show({
controller: 'toastController',
templateUrl: 'toast.html',
hideDelay: 400,
position: 'top',
locals: {
displayOption: {
title:"Clear All Notification Success."
}
}
});//End showing toast.
}, false);
}
catch (e) {
// Showing toast for unable to clear all push notification.
$mdToast.show({
controller: 'toastController',
templateUrl: 'toast.html',
hideDelay: 800,
position: 'top',
locals: {
displayOption: {
title: window.globalVariable.message.errorMessage
}
}
});// End showing toast.
}
};// End clearAllNotification.
$scope.initialForm();
}); // End of controller Single Push Notification.