fastlane/lib/fastlane/actions/onesignal.rb in fastlane-2.90.0.beta.20180405050125 vs fastlane/lib/fastlane/actions/onesignal.rb in fastlane-2.90.0.beta.20180406050006
- old
+ new
@@ -14,10 +14,11 @@
UI.message("Parameter App name: #{params[:app_name]}")
auth_token = params[:auth_token]
app_name = params[:app_name]
apns_p12_password = params[:apns_p12_password]
android_token = params[:android_token]
+ android_gcm_sender_id = params[:android_gcm_sender_id]
payload = {}
payload['name'] = app_name
unless params[:apns_p12].nil?
@@ -28,10 +29,11 @@
# we need to have something for the p12 password, even if it's an empty string
payload["apns_p12_password"] = apns_p12_password || ""
end
payload["gcm_key"] = android_token unless android_token.nil?
+ payload["android_gcm_sender_id"] = android_gcm_sender_id unless android_gcm_sender_id.nil?
# here's the actual lifting - POST to OneSignal
json_headers = { 'Content-Type' => 'application/json', 'Authorization' => "Basic #{auth_token}" }
uri = URI.parse('https://onesignal.com/api/v1/apps')
@@ -90,10 +92,16 @@
env_name: "ANDROID_TOKEN",
description: "ANDROID GCM KEY",
sensitive: true,
optional: true),
+ FastlaneCore::ConfigItem.new(key: :android_gcm_sender_id,
+ env_name: "ANDROID_GCM_SENDER_ID",
+ description: "GCM SENDER ID",
+ sensitive: true,
+ optional: true),
+
FastlaneCore::ConfigItem.new(key: :apns_p12,
env_name: "APNS_P12",
description: "APNS P12 File (in .p12 format)",
optional: true),
@@ -121,18 +129,19 @@
def self.authors
["timothybarraclough", "smartshowltd"]
end
def self.is_supported?(platform)
- platform == :ios
+ [:ios, :android].include?(platform)
end
def self.example_code
[
'onesignal(
auth_token: "Your OneSignal Auth Token",
app_name: "Name for OneSignal App",
android_token: "Your Android GCM key (optional)",
+ android_gcm_sender_id: "Your Android GCM Sender ID (optional)",
apns_p12: "Path to Apple .p12 file (optional)",
apns_p12_password: "Password for .p12 file (optional)",
apns_env: "production/sandbox (defaults to production)"
)'
]