Class: Deliver::SubmitForReview
- Inherits:
-
Object
- Object
- Deliver::SubmitForReview
- Defined in:
- deliver/lib/deliver/submit_for_review.rb
Instance Method Summary collapse
- #submit!(options) ⇒ Object
- #update_export_compliance(options, app, build) ⇒ Object
- #update_idfa(options, app, version) ⇒ Object
- #update_submission_information(options, app) ⇒ Object
- #wait_for_build_processing_to_be_complete(app: nil, platform: nil, options: nil) ⇒ Object
Instance Method Details
#submit!(options) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'deliver/lib/deliver/submit_for_review.rb', line 9 def submit!() app = Deliver.cache[:app] platform = Spaceship::ConnectAPI::Platform.map([:platform]) version = app.get_edit_app_store_version(platform: platform) unless version UI.user_error!("Cannot submit for review - could not find an editable version for '#{platform}'") return end build = select_build(, app, version, platform) update_export_compliance(, app, build) update_idfa(, app, version) update_submission_information(, app) version.create_app_store_version_submission UI.success("Successfully submitted the app for review!") end |
#update_export_compliance(options, app, build) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'deliver/lib/deliver/submit_for_review.rb', line 58 def update_export_compliance(, app, build) submission_information = [:submission_information] || {} submission_information = submission_information.transform_keys(&:to_sym) uses_encryption = submission_information[:export_compliance_uses_encryption] if build.uses_non_exempt_encryption.nil? UI.verbose("Updating build for export compliance status of '#{uses_encryption}'") if uses_encryption.to_s.empty? = [ "Export compliance is required to submit", "Add information to the :submission_information option...", " Docs: http://docs.fastlane.tools/actions/deliver/#compliance-and-idfa-settings", " Example: submission_information: { export_compliance_uses_encryption: false }", " Example CLI:", " --submission_information \"{\\\"export_compliance_uses_encryption\\\": false}\"", "This can also be set in your Info.plist with key 'ITSAppUsesNonExemptEncryption'" ].join("\n") UI.user_error!() end build = build.update(attributes: { usesNonExemptEncryption: uses_encryption }) UI.verbose("Successfully updated build for export compliance status of '#{build.uses_non_exempt_encryption}' on App Store Connect") end end |
#update_idfa(options, app, version) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'deliver/lib/deliver/submit_for_review.rb', line 88 def update_idfa(, app, version) submission_information = [:submission_information] || {} submission_information = submission_information.transform_keys(&:to_sym) uses_idfa = submission_information[:add_id_info_uses_idfa] idfa_declaration = begin version.fetch_idfa_declaration rescue nil end updated_idfa = false # Set IDFA on version unless uses_idfa.nil? UI.verbose("Updating app store version for IDFA status of '#{uses_idfa}'") version = version.update(attributes: { usesIdfa: uses_idfa }) UI.verbose("Updated app store version for IDFA status of '#{version.uses_idfa}'") updated_idfa = true end # Error if uses_idfa not set if version.uses_idfa.nil? = [ "Use of Advertising Identifier (IDFA) is required to submit", "Add information to the :submission_information option...", " Docs: http://docs.fastlane.tools/actions/deliver/#compliance-and-idfa-settings", " Example: submission_information: { add_id_info_uses_idfa: false }", " Example: submission_information: {", " add_id_info_uses_idfa: true,", " add_id_info_serves_ads: false,", " add_id_info_tracks_install: true,", " add_id_info_tracks_action: true,", " add_id_info_limits_tracking: true", " }", " Example CLI:", " --submission_information \"{\\\"add_id_info_uses_idfa\\\": false}\"" ].join("\n") UI.user_error!() end # Create, update, or delete IDFA declaration if uses_idfa == false if idfa_declaration UI.verbose("Deleting IDFA declaration") idfa_declaration.delete! updated_idfa = true UI.verbose("Deleted IDFA declaration") end elsif uses_idfa == true attributes = { honorsLimitedAdTracking: !!submission_information[:add_id_info_limits_tracking], servesAds: !!submission_information[:add_id_info_serves_ads], attributesAppInstallationToPreviousAd: !!submission_information[:add_id_info_tracks_install], attributesActionWithPreviousAd: !!submission_information[:add_id_info_tracks_action] } if idfa_declaration UI.verbose("Updating IDFA declaration") idfa_declaration.update(attributes: attributes) UI.verbose("Updated IDFA declaration") else UI.verbose("Creating IDFA declaration") version.create_idfa_declaration(attributes: attributes) UI.verbose("Created IDFA declaration") end updated_idfa = true end UI.success("Successfully updated IDFA declarations on App Store Connect") if updated_idfa end |
#update_submission_information(options, app) ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'deliver/lib/deliver/submit_for_review.rb', line 164 def update_submission_information(, app) submission_information = [:submission_information] || {} submission_information = submission_information.transform_keys(&:to_sym) content_rights = submission_information[:content_rights_contains_third_party_content] unless content_rights.nil? value = if content_rights Spaceship::ConnectAPI::App::ContentRightsDeclaration::USES_THIRD_PARTY_CONTENT else Spaceship::ConnectAPI::App::ContentRightsDeclaration::DOES_NOT_USE_THIRD_PARTY_CONTENT end UI.verbose("Updating contents rights declaration on App Store Connect") app.update(attributes: { contentRightsDeclaration: value }) UI.success("Successfully updated contents rights declaration on App Store Connect") end end |
#wait_for_build_processing_to_be_complete(app: nil, platform: nil, options: nil) ⇒ Object
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'deliver/lib/deliver/submit_for_review.rb', line 185 def wait_for_build_processing_to_be_complete(app: nil, platform: nil, options: nil) app_version = [:app_version] app_version ||= FastlaneCore::IpaFileAnalyser.fetch_app_version([:ipa]) if [:ipa] app_version ||= FastlaneCore::PkgFileAnalyser.fetch_app_version([:pkg]) if [:pkg] app_build ||= FastlaneCore::IpaFileAnalyser.fetch_app_build([:ipa]) if [:ipa] app_build ||= FastlaneCore::PkgFileAnalyser.fetch_app_build([:pkg]) if [:pkg] latest_build = FastlaneCore::BuildWatcher.wait_for_build_processing_to_be_complete( app_id: app.id, platform: platform, app_version: app_version, build_version: app_build, poll_interval: 15, return_when_build_appears: false, return_spaceship_testflight_build: false, select_latest: true ) if !app_version.nil? && !app_build.nil? unless latest_build.app_version == app_version && latest_build.version == app_build UI.important("Uploaded app #{app_version} - #{app_build}, but received build #{latest_build.app_version} - #{latest_build.version}.") end end return latest_build end |