diff --git a/.gitignore b/.gitignore
index de5ce8ce6971..aaeae4df8eaf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
**/build/*
**/node_modules/*
**/tmp/*
+/private/certs/*
*.bak
*.iml
*.ipr
diff --git a/.meteor/packages b/.meteor/packages
index 1d999325d691..9da4e4208269 100644
--- a/.meteor/packages
+++ b/.meteor/packages
@@ -78,3 +78,4 @@ todda00:friendly-slugs
underscorestring:underscore.string
yasaricli:slugify
yasinuslu:blaze-meta
+raix:push@2.6.12-rc1
diff --git a/.meteor/versions b/.meteor/versions
index 5fa0eb189dd4..6a3e77f8aa1d 100644
--- a/.meteor/versions
+++ b/.meteor/versions
@@ -101,7 +101,9 @@ percolate:migrations@0.7.5
percolatestudio:synced-cron@1.1.0
qnub:emojione@0.0.3
raix:eventemitter@0.1.3
+raix:eventstate@0.0.2
raix:handlebar-helpers@0.2.4
+raix:push@2.6.12-rc1
raix:ui-dropped-event@0.0.7
random@1.0.3
reactive-dict@1.1.0
diff --git a/client/lib/cordova/push.coffee b/client/lib/cordova/push.coffee
new file mode 100644
index 000000000000..fa2c5208a9eb
--- /dev/null
+++ b/client/lib/cordova/push.coffee
@@ -0,0 +1,29 @@
+if Meteor.isCordova
+ if RocketChat.settings.get('Push_enable') is true
+ Push.Configure {}
+
+ Push.addListener 'token', (token) ->
+ Meteor.call 'log', 'token', arguments
+
+ Push.addListener 'error', (err) ->
+ Meteor.call 'log', 'error', arguments
+ if error.type == 'apn.cordova'
+ Meteor.call 'log', err.error
+
+ Push.addListener 'register', (evt) ->
+ Meteor.call 'log', 'register', arguments
+
+ Push.addListener 'alert', (notification) ->
+ Meteor.call 'log', 'alert', arguments
+
+ Push.addListener 'sound', (notification) ->
+ Meteor.call 'log', 'sound', arguments
+
+ Push.addListener 'badge', (notification) ->
+ Meteor.call 'log', 'badge', arguments
+
+ Push.addListener 'startup', (notification) ->
+ Meteor.call 'log', 'startup', arguments
+
+ Push.addListener 'message', (notification) ->
+ Meteor.call 'log', 'message', arguments
\ No newline at end of file
diff --git a/client/views/settings/settings.coffee b/client/views/settings/settings.coffee
index e84c93a9baf6..3d1edb0e685f 100644
--- a/client/views/settings/settings.coffee
+++ b/client/views/settings/settings.coffee
@@ -23,16 +23,16 @@ Template.settings.helpers
Template.settings.events
- "click .submit": ->
+ "click .submit": (e, t) ->
group = FlowRouter.getParam('group')
settings = Settings.find({ group: group }).fetch()
updateSettings = []
for setting in settings
value = null
if setting.type is 'string'
- value = _.trim($("input[name=#{setting._id}]").val())
- else if setting.type is 'boolean' and $("input[name=#{setting._id}]:checked").length
- value = if $("input[name=#{setting._id}]:checked").val() is "1" then true else false
+ value = _.trim(t.$("[name=#{setting._id}]").val())
+ else if setting.type is 'boolean' and t.$("[name=#{setting._id}]:checked").length
+ value = if t.$("[name=#{setting._id}]:checked").val() is "1" then true else false
if value?
updateSettings.push { _id: setting._id, value: value }
diff --git a/client/views/settings/settings.html b/client/views/settings/settings.html
index fc15dcf5a45e..8e61a5dd69fb 100644
--- a/client/views/settings/settings.html
+++ b/client/views/settings/settings.html
@@ -23,7 +23,11 @@
{{description}}
{{/if}}
diff --git a/mobile-config.js b/mobile-config.js
index 0c25b4967693..ff5ae8401aef 100644
--- a/mobile-config.js
+++ b/mobile-config.js
@@ -1,12 +1,12 @@
// This section sets up some basic app metadata,
// the entire section is optional.
App.info({
- id: 'com.konecty.rocketchat',
- name: 'Rocket.Chat',
- description: 'Rocket.Chat',
- author: 'Rocket.Chat Development Group',
- email: 'contact@rocket.chat',
- website: 'https://rocket.chat'
+ id: 'com.konecty.rocket.chat',
+ name: 'Rocket.Chat',
+ description: 'Rocket.Chat',
+ author: 'Rocket.Chat Development Group',
+ email: 'contact@rocket.chat',
+ website: 'https://rocket.chat'
});
// Set up resources such as icons and launch screens.
diff --git a/packages/rocketchat-lib/settings/server/methods.coffee b/packages/rocketchat-lib/settings/server/methods.coffee
index 3a9ed0bc8d0a..a0816558d1aa 100644
--- a/packages/rocketchat-lib/settings/server/methods.coffee
+++ b/packages/rocketchat-lib/settings/server/methods.coffee
@@ -9,19 +9,20 @@ RocketChat.settings.add = (_id, value, options = {}) ->
if not _id or not value?
return false
- console.log '[functions] RocketChat.settings.add -> '.green, 'arguments:', arguments
+ # console.log '[functions] RocketChat.settings.add -> '.green, 'arguments:', arguments
if Meteor.settings?[_id]?
value = Meteor.settings[_id]
-
+
updateSettings =
i18nLabel: options.i18nLabel or _id
i18nDescription: options.i18nDescription if options.i18nDescription?
-
+
updateSettings.type = options.type if options.type
+ updateSettings.multiline = options.multiline if options.multiline
updateSettings.group = options.group if options.group
updateSettings.public = options.public if options.public
-
+
return Settings.upsert { _id: _id }, { $setOnInsert: { value: value }, $set: updateSettings }
###
@@ -33,7 +34,7 @@ RocketChat.settings.addGroup = (_id, options = {}) ->
if not _id
return false
- console.log '[functions] RocketChat.settings.addGroup -> '.green, 'arguments:', arguments
+ # console.log '[functions] RocketChat.settings.addGroup -> '.green, 'arguments:', arguments
updateSettings =
i18nLabel: options.i18nLabel or _id
@@ -50,6 +51,6 @@ Meteor.methods
unless user?.admin is true
throw new Meteor.Error 503, 'Not authorized'
- console.log "saveSetting -> ".green, _id, value
+ # console.log "saveSetting -> ".green, _id, value
Settings.update { _id: _id }, { $set: { value: value } }
return true
\ No newline at end of file
diff --git a/packages/rocketchat-lib/settings/server/startup.coffee b/packages/rocketchat-lib/settings/server/startup.coffee
index 886d1c09b66b..74b278635825 100644
--- a/packages/rocketchat-lib/settings/server/startup.coffee
+++ b/packages/rocketchat-lib/settings/server/startup.coffee
@@ -30,3 +30,14 @@ Meteor.startup ->
RocketChat.settings.add 'Meta:robots', '', { type: 'string', group: 'Meta' }
RocketChat.settings.add 'Meta:google-site-verification', '', { type: 'string', group: 'Meta' }
RocketChat.settings.add 'Meta:msvalidate.01', '', { type: 'string', group: 'Meta' }
+
+ RocketChat.settings.addGroup 'Push'
+ RocketChat.settings.add 'Push_debug', false, { type: 'boolean', group: 'Push' }
+ RocketChat.settings.add 'Push_enable', false, { type: 'boolean', group: 'Push' }
+ RocketChat.settings.add 'Push_production', false, { type: 'boolean', group: 'Push' }
+ RocketChat.settings.add 'Push_apn_passphrase', '', { type: 'string', group: 'Push' }
+ RocketChat.settings.add 'Push_apn_key', '', { type: 'string', multiline: true, group: 'Push' }
+ RocketChat.settings.add 'Push_apn_cert', '', { type: 'string', multiline: true, group: 'Push' }
+ RocketChat.settings.add 'Push_apn_dev_passphrase', '', { type: 'string', group: 'Push' }
+ RocketChat.settings.add 'Push_apn_dev_key', '', { type: 'string', multiline: true, group: 'Push' }
+ RocketChat.settings.add 'Push_apn_dev_cert', '', { type: 'string', multiline: true, group: 'Push' }
diff --git a/server/lib/cordova.coffee b/server/lib/cordova.coffee
new file mode 100644
index 000000000000..92bb24fec753
--- /dev/null
+++ b/server/lib/cordova.coffee
@@ -0,0 +1,24 @@
+Meteor.methods
+ log: ->
+ console.log.apply console, arguments
+
+Meteor.startup ->
+
+ Push.debug = RocketChat.settings.get 'Push_debug'
+
+ if RocketChat.settings.get('Push_enable') is true
+ Push.Configure
+ apn:
+ passphrase: RocketChat.settings.get 'Push_apn_passphrase'
+ keyData: RocketChat.settings.get 'Push_apn_key'
+ certData: RocketChat.settings.get 'Push_apn_cert'
+ 'apn-dev':
+ passphrase: RocketChat.settings.get 'Push_apn_dev_passphrase'
+ keyData: RocketChat.settings.get 'Push_apn_dev_key'
+ certData: RocketChat.settings.get 'Push_apn_dev_cert'
+ gateway: 'gateway.sandbox.push.apple.com'
+ production: RocketChat.settings.get 'Push_production'
+ badge: true
+ sound: true
+ alert: true
+ vibrate: true
diff --git a/server/startup/i18n-validation.coffee b/server/startup/i18n-validation.coffee
index f665f125e7ec..8f7b9735c073 100644
--- a/server/startup/i18n-validation.coffee
+++ b/server/startup/i18n-validation.coffee
@@ -9,6 +9,7 @@ flat = (obj, newObj = {}, path = '') ->
Meteor.startup ->
+ return
l = {}
keys = {}
errors = []