Class: Fastlane::Actions::PromptCreateDataSafetyCsvAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::PromptCreateDataSafetyCsvAction
- Defined in:
- lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb
Constant Summary collapse
- FORMULA_CHARS =
%w[= + - @].freeze
Class Method Summary collapse
-
.addToHash(hash: nil, question_id: nil, response_id: "", value: nil) ⇒ Object
Prompt question and answer to Google Data Safety hash.
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
-
.headerDisplay(csv_file: nil) ⇒ Object
Displays terminal header of Fastlane action and about the upcoming prompts.
- .is_supported?(platform) ⇒ Boolean
-
.promptForAnswer(question: "", hash: nil, question_id: nil, response_id: "") ⇒ String
Prompt question to terminal for a string answer.
-
.promptForAnswerBoolean(question: "", hash: nil, question_id: nil, response_id: "", is_false_blank: false) ⇒ Boolean
Prompt question to terminal for a yes or no answer.
-
.promptForUrl(question: "", hash: nil, question_id: nil, response_id: "") ⇒ String
Prompt question to terminal for URL answer.
-
.questionDataInfo(hash: nil) ⇒ Object
Prompt question data type group question for Google Data Safety sheet.
-
.questionDataType(title: "", code: "", group_code: "", hash: nil) ⇒ Object
Prompt question of a specific data type about data sharing and data collection for Google Data Safety sheet.
- .return_value ⇒ Object
-
.run(params) ⇒ Object
Run the prompt_create_data_safety_csv action.
-
.saveCsvFile(data: nil, csv_file_path: "") ⇒ Object
Save CSV file with data sanitation.
-
.startingQuestion(hash: nil) ⇒ Object
Prompt questions for Google Data Safety sheet.
-
.valid_90_day_answers ⇒ Object
Array of valid answer strings for ninety days selection (delete account data).
-
.valid_false_answers ⇒ Object
Array of valid answer strings for false.
-
.valid_true_answers ⇒ Object
Array of valid answer strings for true.
-
.validUrl?(url) ⇒ Boolean
Detect if URL is valid format.
Class Method Details
.addToHash(hash: nil, question_id: nil, response_id: "", value: nil) ⇒ Object
Prompt question and answer to Google Data Safety hash
542 543 544 545 546 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 542 def self.addToHash(hash: nil, question_id: nil, response_id: "", value: nil) if !value.nil? && !hash.nil? hash["#{question_id},#{response_id}"] = value end end |
.authors ⇒ Object
552 553 554 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 552 def self. ["Owen Bean"] end |
.available_options ⇒ Object
564 565 566 567 568 569 570 571 572 573 574 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 564 def self. [ FastlaneCore::ConfigItem.new( key: :csv_file, env_name: "CSV_FILE", description: "File location to save csv file for Google data safety sheet", optional: false, type: String ) ] end |
.description ⇒ Object
548 549 550 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 548 def self.description "Prompt user questions to generate Google data safety sheet" end |
.details ⇒ Object
560 561 562 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 560 def self.details "Command line question prompts for information about Android app data collection" end |
.headerDisplay(csv_file: nil) ⇒ Object
Displays terminal header of Fastlane action and about the upcoming prompts.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 51 def self.headerDisplay(csv_file: nil) UI.important("") UI.important(" ____ _ ____ _ ____ __ _ ") UI.important(" / ___| ___ ___ __ _| | ___ | _ \\ __ _| |_ __ _ / ___| __ _ / _| ___| |_ _ _ ") UI.important(" | | _ / _ \\ / _ \\ / _` | |/ _ \\ | | | |/ _` | __/ _` | \\___ \\ / _` | |_ / _ | __| | | |") UI.important(" | |_| | (_) | (_) | (_| | | __/ | |_| | (_| | || (_| | ___) | (_| | _| __| |_| |_| |") UI.important(" \\____|\\___/ \\___/ \\__, |_|\\___| |____/ \\__,_|\\__\\__,_| |____/ \\__,_|_| \\___|\\__|\\__, |") UI.important(" |___/ |___/ ") UI.important("") UI.important("By: Owen Bean") UI.important("Report problems at https://github.com/owenbean400/fastlane-plugin-google_data_safety/issues") UI.important("") UI.important("Answer the following prompts below to generate CSV file to upload at #{csv_file}") UI.important("") end |
.is_supported?(platform) ⇒ Boolean
576 577 578 579 580 581 582 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 576 def self.is_supported?(platform) # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example) # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform # # [:ios, :mac, :android].include?(platform) true end |
.promptForAnswer(question: "", hash: nil, question_id: nil, response_id: "") ⇒ String
Prompt question to terminal for a string answer. Reprompt user if answer is empty string.
494 495 496 497 498 499 500 501 502 503 504 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 494 def self.promptForAnswer(question: "", hash: nil, question_id: nil, response_id: "") answer = UI.input(question) while answer.empty? UI.important("Please provide an answer") answer = UI.input(question) end self.addToHash(hash: hash, question_id: question_id, response_id: response_id, value: answer) return answer end |
.promptForAnswerBoolean(question: "", hash: nil, question_id: nil, response_id: "", is_false_blank: false) ⇒ Boolean
Prompt question to terminal for a yes or no answer. Reprompt user if answer is not a valid yes or no.
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 470 def self.promptForAnswerBoolean(question: "", hash: nil, question_id: nil, response_id: "", is_false_blank: false) answer = UI.input(question + " Y/N") while !self.valid_true_answers.include?(answer.downcase) && !self.valid_false_answers.include?(answer.downcase) UI.important("Please provide \"y\", \"yes\", \"true\", or \"t\" for yes; and \"n\", \"no\", \"false\", \"f\" for no") answer = UI.input(question + " Y/N") end if self.valid_true_answers.include?(answer.downcase) self.addToHash(hash: hash, question_id: question_id, response_id: response_id, value: "true") return true else self.addToHash(hash: hash, question_id: question_id, response_id: response_id, value: is_false_blank ? "" : "false") return false end end |
.promptForUrl(question: "", hash: nil, question_id: nil, response_id: "") ⇒ String
Prompt question to terminal for URL answer. Reprompt user if answer is not a valid URL.
513 514 515 516 517 518 519 520 521 522 523 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 513 def self.promptForUrl(question: "", hash: nil, question_id: nil, response_id: "") answer = UI.input(question) while !self.validUrl?(answer) UI.important("Please provide a proper URL") answer = UI.input(question) end self.addToHash(hash: hash, question_id: question_id, response_id: response_id, value: answer) return answer end |
.questionDataInfo(hash: nil) ⇒ Object
Prompt question data type group question for Google Data Safety sheet.
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 213 def self.questionDataInfo(hash: nil) UI.important("*** Below questions will be asked about location data ***") self.questionDataType(title: "approximate location", code: "PSL_APPROX_LOCATION", group_code: "PSL_DATA_TYPES_LOCATION", hash: hash) self.questionDataType(title: "precise location", code: "PSL_PRECISE_LOCATION", group_code: "PSL_DATA_TYPES_LOCATION", hash: hash) UI.important("*** Below questions will be asked about personal information data ***") self.questionDataType(title: "name", code: "PSL_NAME", group_code: "PSL_DATA_TYPES_PERSONAL", hash: hash) self.questionDataType(title: "email", code: "PSL_EMAIL", group_code: "PSL_DATA_TYPES_PERSONAL", hash: hash) self.questionDataType(title: "user ID", code: "PSL_USER_ACCOUNT", group_code: "PSL_DATA_TYPES_PERSONAL", hash: hash) self.questionDataType(title: "address", code: "PSL_ADDRESS", group_code: "PSL_DATA_TYPES_PERSONAL", hash: hash) self.questionDataType(title: "phone", code: "PSL_PHONE", group_code: "PSL_DATA_TYPES_PERSONAL", hash: hash) self.questionDataType(title: "race and ethnicity", code: "PSL_RACE_ETHNICITY", group_code: "PSL_DATA_TYPES_PERSONAL", hash: hash) self.questionDataType(title: "political or religious beliefs", code: "PSL_POLITICAL_RELIGIOUS", group_code: "PSL_DATA_TYPES_PERSONAL", hash: hash) self.questionDataType(title: "sexual orientation", code: "PSL_SEXUAL_ORIENTATION_GENDER_IDENTITY", group_code: "PSL_DATA_TYPES_PERSONAL", hash: hash) self.questionDataType(title: "other personal information", code: "PSL_OTHER_PERSONAL", group_code: "PSL_DATA_TYPES_PERSONAL", hash: hash) UI.important("*** Below questions will be asked about financial data ***") self.questionDataType(title: "user payment information", code: "PSL_CREDIT_DEBIT_BANK_ACCOUNT_NUMBER", group_code: "PSL_DATA_TYPES_FINANCIAL", hash: hash) self.questionDataType(title: "purchase history", code: "PSL_PURCHASE_HISTORY", group_code: "PSL_DATA_TYPES_FINANCIAL", hash: hash) self.questionDataType(title: "credit score", code: "PSL_CREDIT_SCORE", group_code: "PSL_DATA_TYPES_FINANCIAL", hash: hash) self.questionDataType(title: "other financial info", code: "PSL_OTHER", group_code: "PSL_DATA_TYPES_FINANCIAL", hash: hash) UI.important("\n*** Below questions will be asked about audio and music data ***") self.questionDataType(title: "health info", code: "PSL_HEALTH", group_code: "PSL_DATA_TYPES_HEALTH_AND_FITNESS", hash: hash) self.questionDataType(title: "fitness info", code: "PSL_FITNESS", group_code: "PSL_DATA_TYPES_HEALTH_AND_FITNESS", hash: hash) UI.important("*** Below questions will be asked about email and text data ***") self.questionDataType(title: "email", code: "PSL_EMAILS", group_code: "PSL_DATA_TYPES_EMAIL_AND_TEXT", hash: hash) self.questionDataType(title: "SMS or MMS", code: "PSL_SMS_CALL_LOG", group_code: "PSL_DATA_TYPES_EMAIL_AND_TEXT", hash: hash) self.questionDataType(title: "Other in-app messages", code: "PSL_OTHER_MESSAGES", group_code: "PSL_DATA_TYPES_EMAIL_AND_TEXT", hash: hash) UI.important("*** Below questions will be asked about photo and video data ***") self.questionDataType(title: "photo", code: "PSL_PHOTOS", group_code: "PSL_DATA_TYPES_PHOTOS_AND_VIDEOS", hash: hash) self.questionDataType(title: "videos", code: "PSL_VIDEOS", group_code: "PSL_DATA_TYPES_PHOTOS_AND_VIDEOS", hash: hash) UI.important("*** Below questions will be asked about audio and music data ***") self.questionDataType(title: "voice or sound recordings", code: "PSL_AUDIO", group_code: "PSL_DATA_TYPES_AUDIO", hash: hash) self.questionDataType(title: "music files", code: "PSL_MUSIC", group_code: "PSL_DATA_TYPES_AUDIO", hash: hash) self.questionDataType(title: "Other audio files", code: "PSL_OTHER_AUDIO", group_code: "PSL_DATA_TYPES_AUDIO", hash: hash) UI.important("*** Below questions will be asked about files and documents data ***") self.questionDataType(title: "files and docs", code: "PSL_FILES_AND_DOCS", group_code: "PSL_DATA_TYPES_FILES_AND_DOCS", hash: hash) UI.important("*** Below questions will be asked about calendar data ***") self.questionDataType(title: "calendar events", code: "PSL_CALENDAR", group_code: "PSL_DATA_TYPES_CALENDAR", hash: hash) UI.important("*** Below questions will be asked about contact data ***") self.questionDataType(title: "contacts", code: "PSL_CONTACTS", group_code: "PSL_DATA_TYPES_CONTACTS", hash: hash) UI.important("*** Below questions will be asked about app activity data ***") self.questionDataType(title: "app interactions", code: "PSL_USER_INTERACTION", group_code: "PSL_DATA_TYPES_APP_ACTIVITY", hash: hash) self.questionDataType(title: "in-app search history", code: "PSL_IN_APP_SEARCH_HISTORY", group_code: "PSL_DATA_TYPES_APP_ACTIVITY", hash: hash) self.questionDataType(title: "installed apps", code: "PSL_APPS_ON_DEVICE", group_code: "PSL_DATA_TYPES_APP_ACTIVITY", hash: hash) self.questionDataType(title: "other user-generated content", code: "PSL_USER_GENERATED_CONTENT", group_code: "PSL_DATA_TYPES_APP_ACTIVITY", hash: hash) self.questionDataType(title: "other actions", code: "PSL_OTHER_APP_ACTIVITY", group_code: "PSL_DATA_TYPES_APP_ACTIVITY", hash: hash) UI.important("*** Below questions will be asked about location data ***") self.questionDataType(title: "web browser history", code: "PSL_WEB_BROWSING_HISTORY", group_code: "PSL_DATA_TYPES_SEARCH_AND_BROWSING", hash: hash) UI.important("*** Below questions will be asked about app performance data ***") self.questionDataType(title: "crash log", code: "PSL_CRASH_LOGS", group_code: "PSL_DATA_TYPES_APP_PERFORMANCE", hash: hash) self.questionDataType(title: "performance diagnostics", code: "PSL_PERFORMANCE_DIAGNOSTICS", group_code: "PSL_DATA_TYPES_APP_PERFORMANCE", hash: hash) self.questionDataType(title: "other app performance data", code: "PSL_OTHER_PERFORMANCE", group_code: "PSL_DATA_TYPES_APP_PERFORMANCE", hash: hash) UI.important("*** Below questions will be asked about identifier data ***") self.questionDataType(title: "device or other IDs", code: "PSL_DEVICE_ID", group_code: "PSL_DATA_TYPES_IDENTIFIERS", hash: hash) end |
.questionDataType(title: "", code: "", group_code: "", hash: nil) ⇒ Object
Prompt question of a specific data type about data sharing and data collection for Google Data Safety sheet.
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 287 def self.questionDataType(title: "", code: "", group_code: "", hash: nil) isDataInputCollectOrShare = self.promptForAnswerBoolean( question: "Is #{title} data being collected or shared?", hash: hash, question_id: group_code, response_id: code, is_false_blank: true) if isDataInputCollectOrShare isDataInputShared = self.promptForAnswerBoolean( question: "Is #{title} data being shared?", hash: hash, question_id: "PSL_DATA_USAGE_RESPONSES:#{code}:PSL_DATA_USAGE_COLLECTION_AND_SHARING", response_id: "PSL_DATA_USAGE_ONLY_SHARED", is_false_blank: true) if isDataInputShared self.promptForAnswerBoolean( question: "Is #{title} shared for app functionality?", hash: hash, question_id: "PSL_DATA_USAGE_RESPONSES:#{code}:DATA_USAGE_SHARING_PURPOSE", response_id: "PSL_APP_FUNCTIONALITY", is_false_blank: true) self.promptForAnswerBoolean( question: "Is #{title} shared for analytics?", hash: hash, question_id: "PSL_DATA_USAGE_RESPONSES:#{code}:DATA_USAGE_SHARING_PURPOSE", response_id: "PSL_ANALYTICS", is_false_blank: true) self.promptForAnswerBoolean( question: "Is #{title} shared for developer communications?", hash: hash, question_id: "PSL_DATA_USAGE_RESPONSES:#{code}:DATA_USAGE_SHARING_PURPOSE", response_id: "PSL_DEVELOPER_COMMUNICATIONS", is_false_blank: true) self.promptForAnswerBoolean( question: "Is #{title} shared for advertising or marketing?", hash: hash, question_id: "PSL_DATA_USAGE_RESPONSES:#{code}:DATA_USAGE_SHARING_PURPOSE", response_id: "PSL_ADVERTISING", is_false_blank: true) self.promptForAnswerBoolean( question: "Is #{title} shared for fraud prevention, security, or compliance?", hash: hash, question_id: "PSL_DATA_USAGE_RESPONSES:#{code}:DATA_USAGE_SHARING_PURPOSE", response_id: "PSL_FRAUD_PREVENTION_SECURITY", is_false_blank: true) self.promptForAnswerBoolean( question: "Is #{title} shared for personalizing the app?", hash: hash, question_id: "PSL_DATA_USAGE_RESPONSES:#{code}:DATA_USAGE_SHARING_PURPOSE", response_id: "PSL_PERSONALIZATION", is_false_blank: true) self.promptForAnswerBoolean( question: "Is #{title} shared to manage account?", hash: hash, question_id: "PSL_DATA_USAGE_RESPONSES:#{code}:DATA_USAGE_SHARING_PURPOSE", response_id: "PSL_ACCOUNT_MANAGEMENT", is_false_blank: true) end isDataInputCollected = self.promptForAnswerBoolean( question: "Is #{title} data being collected?", hash: hash, question_id: "PSL_DATA_USAGE_RESPONSES:#{code}:PSL_DATA_USAGE_COLLECTION_AND_SHARING", response_id: "PSL_DATA_USAGE_ONLY_COLLECTED", is_false_blank: true) if isDataInputCollected self.promptForAnswerBoolean( question: "Is #{title} data processed ephemerally?", hash: hash, question_id: "PSL_DATA_USAGE_RESPONSES:#{code}:PSL_DATA_USAGE_EPHEMERAL", response_id: "", is_false_blank: false) isDataInputRequired = self.promptForAnswerBoolean( question: "Is #{title} data required for your app?", hash: nil, question_id: nil, response_id: nil, is_false_blank: false) if isDataInputRequired self.addToHash(hash: hash, question_id: "PSL_DATA_USAGE_RESPONSES:#{code}:DATA_USAGE_USER_CONTROL", response_id: "PSL_DATA_USAGE_USER_CONTROL_REQUIRED", value: "true") else self.addToHash(hash: hash, question_id: "PSL_DATA_USAGE_RESPONSES:#{code}:DATA_USAGE_USER_CONTROL", response_id: "PSL_DATA_USAGE_USER_CONTROL_OPTIONAL", value: "true") end self.promptForAnswerBoolean( question: "Is #{title} collected for app functionality?", hash: hash, question_id: "PSL_DATA_USAGE_RESPONSES:#{code}:DATA_USAGE_COLLECTION_PURPOSE", response_id: "PSL_APP_FUNCTIONALITY", is_false_blank: true) self.promptForAnswerBoolean( question: "Is #{title} collected for analytics?", hash: hash, question_id: "PSL_DATA_USAGE_RESPONSES:#{code}:DATA_USAGE_COLLECTION_PURPOSE", response_id: "PSL_ANALYTICS", is_false_blank: true) self.promptForAnswerBoolean( question: "Is #{title} collected for developer communications?", hash: hash, question_id: "PSL_DATA_USAGE_RESPONSES:#{code}:DATA_USAGE_COLLECTION_PURPOSE", response_id: "PSL_DEVELOPER_COMMUNICATIONS", is_false_blank: true) self.promptForAnswerBoolean( question: "Is #{title} collected for advertising or marketing?", hash: hash, question_id: "PSL_DATA_USAGE_RESPONSES:#{code}:DATA_USAGE_COLLECTION_PURPOSE", response_id: "PSL_ADVERTISING", is_false_blank: true) self.promptForAnswerBoolean( question: "Is #{title} collected for fraud prevention, security, or compliance?", hash: hash, question_id: "PSL_DATA_USAGE_RESPONSES:#{code}:DATA_USAGE_COLLECTION_PURPOSE", response_id: "PSL_FRAUD_PREVENTION_SECURITY", is_false_blank: true) self.promptForAnswerBoolean( question: "Is #{title} collected for personalizing the app?", hash: hash, question_id: "PSL_DATA_USAGE_RESPONSES:#{code}:DATA_USAGE_COLLECTION_PURPOSE", response_id: "PSL_PERSONALIZATION", is_false_blank: true) self.promptForAnswerBoolean( question: "Is #{title} collected to manage account?", hash: hash, question_id: "PSL_DATA_USAGE_RESPONSES:#{code}:DATA_USAGE_COLLECTION_PURPOSE", response_id: "PSL_ACCOUNT_MANAGEMENT", is_false_blank: true) end end end |
.return_value ⇒ Object
556 557 558 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 556 def self.return_value # If your method provides a return value, you can describe here what it does end |
.run(params) ⇒ Object
Run the prompt_create_data_safety_csv action.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 16 def self.run(params) if !UI.interactive? UI.error("Prompts questions can only display in interactive.") end csv_file_path = params[:csv_file] csv_file_path = File.(csv_file_path) hash = {} self.headerDisplay(csv_file: csv_file_path) self.startingQuestion(hash: hash) template_data = Helper::PromptCreateDataSafetyHelper.template_array() safety_data = template_data.each_with_index do | row | hash_key = "#{row[0]},#{row[1]}" if hash.key?(hash_key) row[2] = hash[hash_key] end end self.saveCsvFile(data: safety_data, csv_file_path: csv_file_path) end |
.saveCsvFile(data: nil, csv_file_path: "") ⇒ Object
Save CSV file with data sanitation.
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 438 def self.saveCsvFile(data: nil, csv_file_path: "") FileUtils.mkdir_p(File.dirname(csv_file_path)) CSV.open(csv_file_path, "w") do |csv| data.each do |row| sanitized_row = row.map do |cell| if cell.is_a?(String) cleaned = cell.gsub(/[\t\r\n]/, '').strip if cleaned.lstrip.start_with?(*FORMULA_CHARS) cleaned = "'#{cleaned}" end cleaned else cell end end csv << sanitized_row end end end |
.startingQuestion(hash: nil) ⇒ Object
Prompt questions for Google Data Safety sheet.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 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 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 70 def self.startingQuestion(hash: nil) isDataInputAppInfo = self.promptForAnswerBoolean( question: "Does your app collect or share any of the required user data types?", hash: hash, question_id: "PSL_DATA_COLLECTION_COLLECTS_PERSONAL_DATA", response_id: "", is_false_blank: false) if isDataInputAppInfo self.promptForAnswerBoolean( question: "Is all of the user data collected by your app encrypted in transit?", hash: hash, question_id: "PSL_DATA_COLLECTION_ENCRYPTED_IN_TRANSIT", response_id: "", is_false_blank: false) isDataInputAccountCreate = self.promptForAnswerBoolean( question: "Does the app allow for account creation from within the app?", hash: nil, question_id: nil, response_id: nil, is_false_blank: false) if isDataInputAccountCreate self.promptForAnswerBoolean( question: "Does the app allow for account creation from username and password?", hash: hash, question_id: "PSL_SUPPORTED_ACCOUNT_CREATION_METHODS", response_id: "PSL_ACM_USER_ID_PASSWORD", is_false_blank: true) self.promptForAnswerBoolean( question: "Does the app allow for account creation from username and other authentication?", hash: hash, question_id: "PSL_SUPPORTED_ACCOUNT_CREATION_METHODS", response_id: "PSL_ACM_USER_ID_OTHER_AUTH", is_false_blank: true) self.promptForAnswerBoolean( question: "Does the app allow for account creation from username, password, and other authentication?", hash: hash, question_id: "PSL_SUPPORTED_ACCOUNT_CREATION_METHODS", response_id: "PSL_ACM_USER_ID_PASSWORD_OTHER_AUTH", is_false_blank: true) self.promptForAnswerBoolean( question: "Does the app allow for account creation from OAuth?", hash: hash, question_id: "PSL_SUPPORTED_ACCOUNT_CREATION_METHODS", response_id: "PSL_ACM_OAUTH", is_false_blank: true) isDataInputCreateOther = self.promptForAnswerBoolean( question: "Does the app allow for other account creation method?", hash: hash, question_id: "PSL_SUPPORTED_ACCOUNT_CREATION_METHODS", response_id: "PSL_ACM_OTHER", is_false_blank: true) if isDataInputCreateOther self.promptForAnswer( question: "Describe the method of account creation that your app supports", hash: hash, question_id: "PSL_ACM_SPECIFY", response_id: "") end self.promptForUrl( question: "Add a valid URL for account deletion", hash: hash, question_id: "PSL_ACCOUNT_DELETION_URL", response_id: "") else isDataInputLoginOutside = self.promptForAnswerBoolean( question: "Can users login to your app with accounts created outside of the app?", hash: hash, question_id: "PSL_HAS_OUTSIDE_APP_ACCOUNTS", response_id: "", is_false_blank: true) if isDataInputLoginOutside self.promptForAnswerBoolean( question: "Can users create account outside of app by app identification (e.g. SIM binding, service subscription)?", hash: hash, question_id: "PSL_OUTSIDE_APP_ACCOUNT_TYPES", response_id: "PSL_LOGIN_WITH_OUTSIDE_APP_ID", is_false_blank: true) self.promptForAnswerBoolean( question: "Can users create account outside of app by employment or enterprise account?", hash: hash, question_id: "PSL_OUTSIDE_APP_ACCOUNT_TYPES", response_id: "PSL_LOGIN_THROUGH_EMPLOYMENT_OR_ENTERPRISE_ACCOUNT", is_false_blank: true) isDataInputLoginOutsideOther = self.promptForAnswerBoolean( question: "Is there other way users can create account outside of app?", hash: hash, question_id: "PSL_OUTSIDE_APP_ACCOUNT_TYPES", response_id: "PSL_OUTSIDE_APP_ACCOUNT_TYPE_OTHER", is_false_blank: true) if isDataInputLoginOutsideOther self.promptForAnswer( question: "Describe how these accounts are created", hash: hash, question_id: "PSL_OUTSIDE_APP_ACCOUNT_TYPE_SPECIFY", response_id: "") end end end dataInputDeleteData = UI.input("Do you provide a way for users to request that their data is deleted? Type 90 for deletion after 90 days. Y/N/90") while !self.valid_true_answers.include?(dataInputDeleteData.downcase) && !self.valid_false_answers.include?(dataInputDeleteData.downcase) && !self.valid_90_day_answers.include?(dataInputDeleteData.downcase) UI.important("Please provide an answer of either yes, no, or 90") dataInputDeleteData = UI.input("Do you provide a way for users to request that their data is deleted? Type 90 for deletion after 90 days. Y/N/90") end if self.valid_true_answers.include?(dataInputDeleteData.downcase) self.addToHash(hash: hash, question_id: "PSL_SUPPORT_DATA_DELETION_BY_USER", response_id: "DATA_DELETION_YES", value: "true") self.promptForUrl( question: "What URL link can users request to delete data?", hash: hash, question_id: "PSL_DATA_DELETION_URL", response_id: "") elsif self.valid_90_day_answers.include?(dataInputDeleteData.downcase) self.addToHash(hash: hash, question_id: "PSL_SUPPORT_DATA_DELETION_BY_USER", response_id: "DATA_DELETION_NO_AUTO_DELETED", value: "true") else self.addToHash(hash: hash, question_id: "PSL_SUPPORT_DATA_DELETION_BY_USER", response_id: "DATA_DELETION_NO", value: "true") end self.questionDataInfo(hash: hash) end end |
.valid_90_day_answers ⇒ Object
Array of valid answer strings for ninety days selection (delete account data).
46 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 46 def self.valid_90_day_answers = ["90", "ninety"] |
.valid_false_answers ⇒ Object
Array of valid answer strings for false.
44 45 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 44 def self.valid_false_answers = ["n", "no", "false", "f"] # Array of valid answer strings for ninety days selection (delete account data). |
.valid_true_answers ⇒ Object
Array of valid answer strings for true.
42 43 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 42 def self.valid_true_answers = ["y", "yes", "true", "t"] # Array of valid answer strings for false. |
.validUrl?(url) ⇒ Boolean
Detect if URL is valid format.
529 530 531 532 533 534 |
# File 'lib/fastlane/plugin/google_data_safety/actions/prompt_create_data_safety_csv_action.rb', line 529 def self.validUrl?(url) uri = URI.parse(url) uri.is_a?(URI::HTTP) && !uri.host.nil? rescue URI::InvalidURIError false end |