Skip to content

Commit

Permalink
Add support for Notification#content_available (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanahman committed Apr 7, 2024
1 parent ab5d772 commit c31b6c5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/push/notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,23 @@ def category_id(value)
raise ArgumentError, 'categoryId must be string-like or nil'
end

##
# Set or overwrite content available.
#
# Must be a boolean or nil, or an ArgumentError is raised.
#
# On iOS, use this to trigger a background fetch action.
# Under normal circumstances, the "content-available" flag should launch
# your app if it isn't running and wasn't killed by the user. However,
# this is ultimately decided by the OS, so it might not always happen.
#
def content_available(value)
raise ArgumentError, 'content_available must be boolean or nil' unless [true, false, nil].include?(value)

_params[:contentAvailable] = value
self
end

##
# Set or overwrite the mutability flag.
#
Expand Down

0 comments on commit c31b6c5

Please sign in to comment.