@@ -16,12 +16,14 @@ def self.run(params)
1616 browserstack_access_key = params [ :browserstack_access_key ] # Required
1717 custom_id = params [ :custom_id ]
1818 file_path = params [ :file_path ] . to_s # Required
19+ ios_keychain_support = params [ :ios_keychain_support ]
1920
2021 validate_file_path ( file_path )
22+ validate_ios_keychain_support ( ios_keychain_support ) unless ios_keychain_support . nil?
2123
2224 UI . message ( "Uploading app to BrowserStack AppAutomate..." )
2325
24- browserstack_app_id = Helper ::BrowserstackHelper . upload_file ( browserstack_username , browserstack_access_key , file_path , UPLOAD_API_ENDPOINT , custom_id )
26+ browserstack_app_id = Helper ::BrowserstackHelper . upload_file ( browserstack_username , browserstack_access_key , file_path , UPLOAD_API_ENDPOINT , custom_id , ios_keychain_support )
2527
2628 # Set 'BROWSERSTACK_APP_ID' environment variable, if app upload was successful.
2729 ENV [ 'BROWSERSTACK_APP_ID' ] = browserstack_app_id
@@ -45,6 +47,19 @@ def self.validate_file_path(file_path)
4547 end
4648 end
4749
50+ # Validate ios_keychain_support
51+ def self . validate_ios_keychain_support ( ios_keychain_support )
52+ platform = Actions . lane_context [ Actions ::SharedValues ::PLATFORM_NAME ]
53+ if !platform . nil? && platform != :ios
54+ # Check if platform is specified and not ios
55+ # If so, then raise error.
56+ UI . user_error! ( "ios_keychain_support param can only be used with platform ios" )
57+ end
58+ unless [ 'true' , 'false' ] . include? ( ios_keychain_support . to_s )
59+ UI . user_error! ( "ios_keychain_support should be either 'true' or 'false'." )
60+ end
61+ end
62+
4863 def self . description
4964 "Uploads IPA and APK files to BrowserStack AppAutomate for running automated tests."
5065 end
@@ -105,7 +120,11 @@ def self.available_options
105120 description : "Path to the app file" ,
106121 optional : true ,
107122 is_string : true ,
108- default_value : default_file_path )
123+ default_value : default_file_path ) ,
124+ FastlaneCore ::ConfigItem . new ( key : :ios_keychain_support ,
125+ description : "Enable/disable support for iOS keychain" ,
126+ optional : true ,
127+ is_string : true )
109128 ]
110129 end
111130
0 commit comments