Permalink
Browse files

back to 150 for alert

  • Loading branch information...
1 parent 1223350 commit 86e9f7b4df63d6a1dd7d34727621b4f50fedf06e @semmons99 semmons99 committed Nov 13, 2012
@@ -17,11 +17,11 @@ def devices
# Stores the text alert message you want to send to the device.
#
- # If the message is over 108 characters long it will get truncated
- # to 108 characters with a <tt>...</tt>
+ # If the message is over 150 characters long it will get truncated
+ # to 150 characters with a <tt>...</tt>
def alert=(message)
- if !message.blank? && message.size > 108
- message = truncate(message, :length => 108)
+ if !message.blank? && message.size > 150
+ message = truncate(message, :length => 150)
end
write_attribute('alert', message)
end
@@ -45,8 +45,8 @@ def apple_hash
result = {}
result['aps'] = {}
if self.alert
- result['aps']['alert'] = if self.alert.size > 108 && configatron.apn.auto_truncate
- truncate(self.alert, :length => 108)
+ result['aps']['alert'] = if self.alert.size > 150 && configatron.apn.auto_truncate
+ truncate(self.alert, :length => 150)
else
self.alert
end
@@ -26,11 +26,11 @@ class APN::Notification < APN::Base
# Stores the text alert message you want to send to the device.
#
- # If the message is over 108 characters long it will get truncated
- # to 108 characters with a <tt>...</tt>
+ # If the message is over 150 characters long it will get truncated
+ # to 150 characters with a <tt>...</tt>
def alert=(message)
- if !message.blank? && message.size > 108
- message = truncate(message, :length => 108)
+ if !message.blank? && message.size > 150
+ message = truncate(message, :length => 150)
end
write_attribute('alert', message)
end
@@ -54,8 +54,8 @@ def apple_hash
result = {}
result['aps'] = {}
if self.alert
- result['aps']['alert'] = if self.alert.size > 108 && configatron.apn.auto_truncate
- truncate(self.alert, :length => 108)
+ result['aps']['alert'] = if self.alert.size > 150 && configatron.apn.auto_truncate
+ truncate(self.alert, :length => 150)
else
self.alert
end
@@ -8,7 +8,7 @@
describe 'alert' do
- it 'should trim the message to 108 characters' do
+ it 'should trim the message to 150 characters' do
noty = APN::GroupNotification.new
noty.alert = 'a' * 200
noty.alert.should == ('a' * 105) + '...'
@@ -8,7 +8,7 @@
describe 'alert' do
- it 'should trim the message to 108 characters' do
+ it 'should trim the message to 150 characters' do
noty = APN::Notification.new
noty.alert = 'a' * 200
noty.alert.should == ('a' * 105) + '...'

2 comments on commit 86e9f7b

@minter
minter commented on 86e9f7b Nov 13, 2012

The code in teamsnap/teamsnap and teamsnap/apiv2 is set to truncate at 130, fwiw. We gained around 22 characters by shrinking the JSON keys.

@semmons99
Member

I'll drop it down to 130 then just so we're inline.

Please sign in to comment.