classPushNotifierclass<<selfdefclientreturn@clientif@clienjpush_configs=Rails.application.secrets['jpush']@client=JPush::JPushClient.new*jpush_configs.values_at('app_key','app_secret')enddefpush(message,receiver_credential_ids,extras={})# See how to define audience for pushing message, visit:# https://github.com/jpush/jpush-api-ruby-client/blob/master/example/push_example.rbreceiver_credential_ids=[*receiver_credential_ids]payload=JPush::PushPayload.build(platform:JPush::Platform.all,audience:JPush::Audience.build(:_alias=>receiver_credential_ids),notification:JPush::Notification.build(alert:message,ios:JPush::IOSNotification.build(alert:message,badge:"+1",sound:"happy",extras:extras),android:JPush::AndroidNotification.build(alert:message,builder_id:1,extras:extras)),message:JPush::Message.build(msg_content:"message content test",title:"schoolmatch",content_type:"message content type test",extras:extras),options:JPush::Options.build(sendno:1,apns_production:Rails.env.production?))result=client.sendPush(payload)Rails.logger.debug"Pushed message: #{result}"resultenddefdebug?%w(development test staging).include?Rails.envendendend# usage: PushNotifier.push('test', 1)
alias'ionic-emulate'='ionic emulate ios -l -c -s'ionic [run|emulate] <platform> [options][--livereload|-l] .... Live Reload app dev files from the device
[--consolelogs|-c] ... Print app console logs to Ionic CLI
[--serverlogs|-s] .... Print dev server logs to Ionic CLI
1. restart or r to restart the client app from the root
2. goto or g and a url to have the app navigate to the given url
3. consolelogs or c to enable/disable console log output
4. serverlogs or s to enable/disable server log output
5. quit or q to shutdown the server and exit
translations={en:{students:'Students',},zh:{students:'同学',}};app.config(function($translateProvider){//Get system languagevarsystemLang=navigator.language||navigator.userLanguage;for(langintranslations){$translateProvider.translations(lang,translations[lang]);}//Set app languagevarappLang=helper.matchLanguageString(systemLang);$translateProvider.preferredLanguage(appLang);});
angular.module('xx.services',[]).factory('Push',function(){varpush;return{setAlias:function(alias){if(push){console.log('jpush: set alias',alias);plugins.jPushPlugin.setAlias(alias);}},init:function(notificationCallback){console.log('jpush: start init-----------------------');push=window.plugins&&window.plugins.jPushPlugin;if(push){console.log('jpush: init');plugins.jPushPlugin.init();plugins.jPushPlugin.setDebugMode(true);plugins.jPushPlugin.openNotificationInAndroidCallback=notificationCallback;plugins.jPushPlugin.receiveNotificationIniOSCallback=notificationCallback;plugins.jPushPlugin.receiveMessageIniOSCallback=notificationCallback;}}};})Push.init(notificationCallback);varnotificationCallback=function(data){varnotification=angular.fromJson(data);//app 是否处于正在运行状varisActive=notification.notification;// here add your code}