From f35ec24602e267c5aa38160f0e01e7ba9dc59f4c Mon Sep 17 00:00:00 2001 From: Robert Schulze Dieckhoff Date: Mon, 4 Sep 2023 14:09:53 +0200 Subject: [PATCH 1/4] Added ktlint diff --git a/android/.editorconfig b/android/.editorconfig new file mode 100644 index 0000000..c04ece5 --- /dev/null +++ b/android/.editorconfig @@ -0,0 +1,614 @@ +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +max_line_length = 100 +tab_width = 4 +ij_continuation_indent_size = 4 +ij_formatter_off_tag = @formatter:off +ij_formatter_on_tag = @formatter:on +ij_formatter_tags_enabled = false +ij_smart_tabs = false +ij_visual_guides = none +ij_wrap_on_typing = false + +[*.java] +max_line_length = 120 +ij_java_align_consecutive_assignments = false +ij_java_align_consecutive_variable_declarations = false +ij_java_align_group_field_declarations = false +ij_java_align_multiline_annotation_parameters = false +ij_java_align_multiline_array_initializer_expression = false +ij_java_align_multiline_assignment = false +ij_java_align_multiline_binary_operation = false +ij_java_align_multiline_chained_methods = false +ij_java_align_multiline_extends_list = false +ij_java_align_multiline_for = true +ij_java_align_multiline_method_parentheses = false +ij_java_align_multiline_parameters = true +ij_java_align_multiline_parameters_in_calls = false +ij_java_align_multiline_parenthesized_expression = false +ij_java_align_multiline_records = true +ij_java_align_multiline_resources = true +ij_java_align_multiline_ternary_operation = false +ij_java_align_multiline_text_blocks = false +ij_java_align_multiline_throws_list = false +ij_java_align_subsequent_simple_methods = false +ij_java_align_throws_keyword = false +ij_java_annotation_parameter_wrap = off +ij_java_array_initializer_new_line_after_left_brace = false +ij_java_array_initializer_right_brace_on_new_line = false +ij_java_array_initializer_wrap = off +ij_java_assert_statement_colon_on_next_line = false +ij_java_assert_statement_wrap = off +ij_java_assignment_wrap = off +ij_java_binary_operation_sign_on_next_line = false +ij_java_binary_operation_wrap = off +ij_java_blank_lines_after_anonymous_class_header = 0 +ij_java_blank_lines_after_class_header = 0 +ij_java_blank_lines_after_imports = 1 +ij_java_blank_lines_after_package = 1 +ij_java_blank_lines_around_class = 1 +ij_java_blank_lines_around_field = 0 +ij_java_blank_lines_around_field_in_interface = 0 +ij_java_blank_lines_around_initializer = 1 +ij_java_blank_lines_around_method = 1 +ij_java_blank_lines_around_method_in_interface = 1 +ij_java_blank_lines_before_class_end = 0 +ij_java_blank_lines_before_imports = 1 +ij_java_blank_lines_before_method_body = 0 +ij_java_blank_lines_before_package = 0 +ij_java_block_brace_style = end_of_line +ij_java_block_comment_at_first_column = true +ij_java_builder_methods = none +ij_java_call_parameters_new_line_after_left_paren = false +ij_java_call_parameters_right_paren_on_new_line = false +ij_java_call_parameters_wrap = off +ij_java_case_statement_on_separate_line = true +ij_java_catch_on_new_line = false +ij_java_class_annotation_wrap = split_into_lines +ij_java_class_brace_style = end_of_line +ij_java_class_count_to_use_import_on_demand = 99 +ij_java_class_names_in_javadoc = 1 +ij_java_do_not_indent_top_level_class_members = false +ij_java_do_not_wrap_after_single_annotation = false +ij_java_do_while_brace_force = never +ij_java_doc_add_blank_line_after_description = true +ij_java_doc_add_blank_line_after_param_comments = false +ij_java_doc_add_blank_line_after_return = false +ij_java_doc_add_p_tag_on_empty_lines = true +ij_java_doc_align_exception_comments = true +ij_java_doc_align_param_comments = true +ij_java_doc_do_not_wrap_if_one_line = false +ij_java_doc_enable_formatting = true +ij_java_doc_enable_leading_asterisks = true +ij_java_doc_indent_on_continuation = false +ij_java_doc_keep_empty_lines = true +ij_java_doc_keep_empty_parameter_tag = true +ij_java_doc_keep_empty_return_tag = true +ij_java_doc_keep_empty_throws_tag = true +ij_java_doc_keep_invalid_tags = true +ij_java_doc_param_description_on_new_line = false +ij_java_doc_preserve_line_breaks = false +ij_java_doc_use_throws_not_exception_tag = true +ij_java_else_on_new_line = false +ij_java_enum_constants_wrap = off +ij_java_extends_keyword_wrap = off +ij_java_extends_list_wrap = off +ij_java_field_annotation_wrap = split_into_lines +ij_java_finally_on_new_line = false +ij_java_for_brace_force = never +ij_java_for_statement_new_line_after_left_paren = false +ij_java_for_statement_right_paren_on_new_line = false +ij_java_for_statement_wrap = off +ij_java_generate_final_locals = false +ij_java_generate_final_parameters = false +ij_java_if_brace_force = never +ij_java_imports_layout = $android.**,$androidx.**,$com.**,$junit.**,$net.**,$org.**,$java.**,$javax.**,$*,|,android.**,|,androidx.**,|,com.**,|,junit.**,|,net.**,|,org.**,|,java.**,|,javax.**,|,*,| +ij_java_indent_case_from_switch = true +ij_java_insert_inner_class_imports = false +ij_java_insert_override_annotation = true +ij_java_keep_blank_lines_before_right_brace = 2 +ij_java_keep_blank_lines_between_package_declaration_and_header = 2 +ij_java_keep_blank_lines_in_code = 2 +ij_java_keep_blank_lines_in_declarations = 2 +ij_java_keep_builder_methods_indents = false +ij_java_keep_control_statement_in_one_line = true +ij_java_keep_first_column_comment = true +ij_java_keep_indents_on_empty_lines = false +ij_java_keep_line_breaks = true +ij_java_keep_multiple_expressions_in_one_line = false +ij_java_keep_simple_blocks_in_one_line = false +ij_java_keep_simple_classes_in_one_line = false +ij_java_keep_simple_lambdas_in_one_line = false +ij_java_keep_simple_methods_in_one_line = false +ij_java_label_indent_absolute = false +ij_java_label_indent_size = 0 +ij_java_lambda_brace_style = end_of_line +ij_java_layout_static_imports_separately = true +ij_java_line_comment_add_space = false +ij_java_line_comment_at_first_column = true +ij_java_method_annotation_wrap = split_into_lines +ij_java_method_brace_style = end_of_line +ij_java_method_call_chain_wrap = off +ij_java_method_parameters_new_line_after_left_paren = false +ij_java_method_parameters_right_paren_on_new_line = false +ij_java_method_parameters_wrap = off +ij_java_modifier_list_wrap = false +ij_java_names_count_to_use_import_on_demand = 99 +ij_java_new_line_after_lparen_in_record_header = false +ij_java_parameter_annotation_wrap = off +ij_java_parentheses_expression_new_line_after_left_paren = false +ij_java_parentheses_expression_right_paren_on_new_line = false +ij_java_place_assignment_sign_on_next_line = false +ij_java_prefer_longer_names = true +ij_java_prefer_parameters_wrap = false +ij_java_record_components_wrap = normal +ij_java_repeat_synchronized = true +ij_java_replace_instanceof_and_cast = false +ij_java_replace_null_check = true +ij_java_replace_sum_lambda_with_method_ref = true +ij_java_resource_list_new_line_after_left_paren = false +ij_java_resource_list_right_paren_on_new_line = false +ij_java_resource_list_wrap = off +ij_java_rparen_on_new_line_in_record_header = false +ij_java_space_after_closing_angle_bracket_in_type_argument = false +ij_java_space_after_colon = true +ij_java_space_after_comma = true +ij_java_space_after_comma_in_type_arguments = true +ij_java_space_after_for_semicolon = true +ij_java_space_after_quest = true +ij_java_space_after_type_cast = true +ij_java_space_before_annotation_array_initializer_left_brace = false +ij_java_space_before_annotation_parameter_list = false +ij_java_space_before_array_initializer_left_brace = false +ij_java_space_before_catch_keyword = true +ij_java_space_before_catch_left_brace = true +ij_java_space_before_catch_parentheses = true +ij_java_space_before_class_left_brace = true +ij_java_space_before_colon = true +ij_java_space_before_colon_in_foreach = true +ij_java_space_before_comma = false +ij_java_space_before_do_left_brace = true +ij_java_space_before_else_keyword = true +ij_java_space_before_else_left_brace = true +ij_java_space_before_finally_keyword = true +ij_java_space_before_finally_left_brace = true +ij_java_space_before_for_left_brace = true +ij_java_space_before_for_parentheses = true +ij_java_space_before_for_semicolon = false +ij_java_space_before_if_left_brace = true +ij_java_space_before_if_parentheses = true +ij_java_space_before_method_call_parentheses = false +ij_java_space_before_method_left_brace = true +ij_java_space_before_method_parentheses = false +ij_java_space_before_opening_angle_bracket_in_type_parameter = false +ij_java_space_before_quest = true +ij_java_space_before_switch_left_brace = true +ij_java_space_before_switch_parentheses = true +ij_java_space_before_synchronized_left_brace = true +ij_java_space_before_synchronized_parentheses = true +ij_java_space_before_try_left_brace = true +ij_java_space_before_try_parentheses = true +ij_java_space_before_type_parameter_list = false +ij_java_space_before_while_keyword = true +ij_java_space_before_while_left_brace = true +ij_java_space_before_while_parentheses = true +ij_java_space_inside_one_line_enum_braces = false +ij_java_space_within_empty_array_initializer_braces = false +ij_java_space_within_empty_method_call_parentheses = false +ij_java_space_within_empty_method_parentheses = false +ij_java_spaces_around_additive_operators = true +ij_java_spaces_around_assignment_operators = true +ij_java_spaces_around_bitwise_operators = true +ij_java_spaces_around_equality_operators = true +ij_java_spaces_around_lambda_arrow = true +ij_java_spaces_around_logical_operators = true +ij_java_spaces_around_method_ref_dbl_colon = false +ij_java_spaces_around_multiplicative_operators = true +ij_java_spaces_around_relational_operators = true +ij_java_spaces_around_shift_operators = true +ij_java_spaces_around_type_bounds_in_type_parameters = true +ij_java_spaces_around_unary_operator = false +ij_java_spaces_within_angle_brackets = false +ij_java_spaces_within_annotation_parentheses = false +ij_java_spaces_within_array_initializer_braces = false +ij_java_spaces_within_braces = false +ij_java_spaces_within_brackets = false +ij_java_spaces_within_cast_parentheses = false +ij_java_spaces_within_catch_parentheses = false +ij_java_spaces_within_for_parentheses = false +ij_java_spaces_within_if_parentheses = false +ij_java_spaces_within_method_call_parentheses = false +ij_java_spaces_within_method_parentheses = false +ij_java_spaces_within_parentheses = false +ij_java_spaces_within_record_header = false +ij_java_spaces_within_switch_parentheses = false +ij_java_spaces_within_synchronized_parentheses = false +ij_java_spaces_within_try_parentheses = false +ij_java_spaces_within_while_parentheses = false +ij_java_special_else_if_treatment = true +ij_java_subclass_name_suffix = Impl +ij_java_ternary_operation_signs_on_next_line = false +ij_java_ternary_operation_wrap = off +ij_java_test_name_suffix = Test +ij_java_throws_keyword_wrap = off +ij_java_throws_list_wrap = off +ij_java_use_external_annotations = false +ij_java_use_fq_class_names = false +ij_java_use_relative_indents = false +ij_java_use_single_class_imports = true +ij_java_variable_annotation_wrap = off +ij_java_visibility = public +ij_java_while_brace_force = never +ij_java_while_on_new_line = false +ij_java_wrap_comments = false +ij_java_wrap_first_method_in_call_chain = false +ij_java_wrap_long_lines = false + +[*.properties] +ij_properties_align_group_field_declarations = false +ij_properties_keep_blank_lines = false +ij_properties_key_value_delimiter = equals +ij_properties_spaces_around_key_value_delimiter = false + +[.editorconfig] +ij_editorconfig_align_group_field_declarations = false +ij_editorconfig_space_after_colon = false +ij_editorconfig_space_after_comma = true +ij_editorconfig_space_before_colon = false +ij_editorconfig_space_before_comma = false +ij_editorconfig_spaces_around_assignment_operators = true + +[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.rng,*.tld,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul}] +ij_xml_align_attributes = false +ij_xml_align_text = false +ij_xml_attribute_wrap = normal +ij_xml_block_comment_at_first_column = true +ij_xml_keep_blank_lines = 2 +ij_xml_keep_indents_on_empty_lines = false +ij_xml_keep_line_breaks = false +ij_xml_keep_line_breaks_in_text = true +ij_xml_keep_whitespaces = false +ij_xml_keep_whitespaces_around_cdata = preserve +ij_xml_keep_whitespaces_inside_cdata = false +ij_xml_line_comment_at_first_column = true +ij_xml_space_after_tag_name = false +ij_xml_space_around_equals_in_attribute = false +ij_xml_space_inside_empty_tag = true +ij_xml_text_wrap = normal +ij_xml_use_custom_settings = true + +[{*.bash,*.sh,*.zsh}] +indent_size = 2 +tab_width = 2 +ij_shell_binary_ops_start_line = false +ij_shell_keep_column_alignment_padding = false +ij_shell_minify_program = false +ij_shell_redirect_followed_by_space = false +ij_shell_switch_cases_indented = false +ij_shell_use_unix_line_separator = true + +[{*.gant,*.gradle,*.groovy,*.gy}] +ij_groovy_align_group_field_declarations = false +ij_groovy_align_multiline_array_initializer_expression = false +ij_groovy_align_multiline_assignment = false +ij_groovy_align_multiline_binary_operation = false +ij_groovy_align_multiline_chained_methods = false +ij_groovy_align_multiline_extends_list = false +ij_groovy_align_multiline_for = true +ij_groovy_align_multiline_list_or_map = true +ij_groovy_align_multiline_method_parentheses = false +ij_groovy_align_multiline_parameters = true +ij_groovy_align_multiline_parameters_in_calls = false +ij_groovy_align_multiline_resources = true +ij_groovy_align_multiline_ternary_operation = false +ij_groovy_align_multiline_throws_list = false +ij_groovy_align_named_args_in_map = true +ij_groovy_align_throws_keyword = false +ij_groovy_array_initializer_new_line_after_left_brace = false +ij_groovy_array_initializer_right_brace_on_new_line = false +ij_groovy_array_initializer_wrap = off +ij_groovy_assert_statement_wrap = off +ij_groovy_assignment_wrap = off +ij_groovy_binary_operation_wrap = off +ij_groovy_blank_lines_after_class_header = 0 +ij_groovy_blank_lines_after_imports = 1 +ij_groovy_blank_lines_after_package = 1 +ij_groovy_blank_lines_around_class = 1 +ij_groovy_blank_lines_around_field = 0 +ij_groovy_blank_lines_around_field_in_interface = 0 +ij_groovy_blank_lines_around_method = 1 +ij_groovy_blank_lines_around_method_in_interface = 1 +ij_groovy_blank_lines_before_imports = 1 +ij_groovy_blank_lines_before_method_body = 0 +ij_groovy_blank_lines_before_package = 0 +ij_groovy_block_brace_style = end_of_line +ij_groovy_block_comment_at_first_column = true +ij_groovy_call_parameters_new_line_after_left_paren = false +ij_groovy_call_parameters_right_paren_on_new_line = false +ij_groovy_call_parameters_wrap = off +ij_groovy_catch_on_new_line = false +ij_groovy_class_annotation_wrap = split_into_lines +ij_groovy_class_brace_style = end_of_line +ij_groovy_class_count_to_use_import_on_demand = 5 +ij_groovy_do_while_brace_force = never +ij_groovy_else_on_new_line = false +ij_groovy_enum_constants_wrap = off +ij_groovy_extends_keyword_wrap = off +ij_groovy_extends_list_wrap = off +ij_groovy_field_annotation_wrap = split_into_lines +ij_groovy_finally_on_new_line = false +ij_groovy_for_brace_force = never +ij_groovy_for_statement_new_line_after_left_paren = false +ij_groovy_for_statement_right_paren_on_new_line = false +ij_groovy_for_statement_wrap = off +ij_groovy_if_brace_force = never +ij_groovy_import_annotation_wrap = 2 +ij_groovy_imports_layout = *,|,javax.**,java.**,|,$* +ij_groovy_indent_case_from_switch = true +ij_groovy_indent_label_blocks = true +ij_groovy_insert_inner_class_imports = false +ij_groovy_keep_blank_lines_before_right_brace = 2 +ij_groovy_keep_blank_lines_in_code = 2 +ij_groovy_keep_blank_lines_in_declarations = 2 +ij_groovy_keep_control_statement_in_one_line = true +ij_groovy_keep_first_column_comment = true +ij_groovy_keep_indents_on_empty_lines = false +ij_groovy_keep_line_breaks = true +ij_groovy_keep_multiple_expressions_in_one_line = false +ij_groovy_keep_simple_blocks_in_one_line = false +ij_groovy_keep_simple_classes_in_one_line = true +ij_groovy_keep_simple_lambdas_in_one_line = true +ij_groovy_keep_simple_methods_in_one_line = true +ij_groovy_label_indent_absolute = false +ij_groovy_label_indent_size = 0 +ij_groovy_lambda_brace_style = end_of_line +ij_groovy_layout_static_imports_separately = true +ij_groovy_line_comment_add_space = false +ij_groovy_line_comment_at_first_column = true +ij_groovy_method_annotation_wrap = split_into_lines +ij_groovy_method_brace_style = end_of_line +ij_groovy_method_call_chain_wrap = off +ij_groovy_method_parameters_new_line_after_left_paren = false +ij_groovy_method_parameters_right_paren_on_new_line = false +ij_groovy_method_parameters_wrap = off +ij_groovy_modifier_list_wrap = false +ij_groovy_names_count_to_use_import_on_demand = 3 +ij_groovy_parameter_annotation_wrap = off +ij_groovy_parentheses_expression_new_line_after_left_paren = false +ij_groovy_parentheses_expression_right_paren_on_new_line = false +ij_groovy_prefer_parameters_wrap = false +ij_groovy_resource_list_new_line_after_left_paren = false +ij_groovy_resource_list_right_paren_on_new_line = false +ij_groovy_resource_list_wrap = off +ij_groovy_space_after_assert_separator = true +ij_groovy_space_after_colon = true +ij_groovy_space_after_comma = true +ij_groovy_space_after_comma_in_type_arguments = true +ij_groovy_space_after_for_semicolon = true +ij_groovy_space_after_quest = true +ij_groovy_space_after_type_cast = true +ij_groovy_space_before_annotation_parameter_list = false +ij_groovy_space_before_array_initializer_left_brace = false +ij_groovy_space_before_assert_separator = false +ij_groovy_space_before_catch_keyword = true +ij_groovy_space_before_catch_left_brace = true +ij_groovy_space_before_catch_parentheses = true +ij_groovy_space_before_class_left_brace = true +ij_groovy_space_before_closure_left_brace = true +ij_groovy_space_before_colon = true +ij_groovy_space_before_comma = false +ij_groovy_space_before_do_left_brace = true +ij_groovy_space_before_else_keyword = true +ij_groovy_space_before_else_left_brace = true +ij_groovy_space_before_finally_keyword = true +ij_groovy_space_before_finally_left_brace = true +ij_groovy_space_before_for_left_brace = true +ij_groovy_space_before_for_parentheses = true +ij_groovy_space_before_for_semicolon = false +ij_groovy_space_before_if_left_brace = true +ij_groovy_space_before_if_parentheses = true +ij_groovy_space_before_method_call_parentheses = false +ij_groovy_space_before_method_left_brace = true +ij_groovy_space_before_method_parentheses = false +ij_groovy_space_before_quest = true +ij_groovy_space_before_switch_left_brace = true +ij_groovy_space_before_switch_parentheses = true +ij_groovy_space_before_synchronized_left_brace = true +ij_groovy_space_before_synchronized_parentheses = true +ij_groovy_space_before_try_left_brace = true +ij_groovy_space_before_try_parentheses = true +ij_groovy_space_before_while_keyword = true +ij_groovy_space_before_while_left_brace = true +ij_groovy_space_before_while_parentheses = true +ij_groovy_space_in_named_argument = true +ij_groovy_space_in_named_argument_before_colon = false +ij_groovy_space_within_empty_array_initializer_braces = false +ij_groovy_space_within_empty_method_call_parentheses = false +ij_groovy_spaces_around_additive_operators = true +ij_groovy_spaces_around_assignment_operators = true +ij_groovy_spaces_around_bitwise_operators = true +ij_groovy_spaces_around_equality_operators = true +ij_groovy_spaces_around_lambda_arrow = true +ij_groovy_spaces_around_logical_operators = true +ij_groovy_spaces_around_multiplicative_operators = true +ij_groovy_spaces_around_regex_operators = true +ij_groovy_spaces_around_relational_operators = true +ij_groovy_spaces_around_shift_operators = true +ij_groovy_spaces_within_annotation_parentheses = false +ij_groovy_spaces_within_array_initializer_braces = false +ij_groovy_spaces_within_braces = true +ij_groovy_spaces_within_brackets = false +ij_groovy_spaces_within_cast_parentheses = false +ij_groovy_spaces_within_catch_parentheses = false +ij_groovy_spaces_within_for_parentheses = false +ij_groovy_spaces_within_gstring_injection_braces = false +ij_groovy_spaces_within_if_parentheses = false +ij_groovy_spaces_within_list_or_map = false +ij_groovy_spaces_within_method_call_parentheses = false +ij_groovy_spaces_within_method_parentheses = false +ij_groovy_spaces_within_parentheses = false +ij_groovy_spaces_within_switch_parentheses = false +ij_groovy_spaces_within_synchronized_parentheses = false +ij_groovy_spaces_within_try_parentheses = false +ij_groovy_spaces_within_tuple_expression = false +ij_groovy_spaces_within_while_parentheses = false +ij_groovy_special_else_if_treatment = true +ij_groovy_ternary_operation_wrap = off +ij_groovy_throws_keyword_wrap = off +ij_groovy_throws_list_wrap = off +ij_groovy_use_flying_geese_braces = false +ij_groovy_use_fq_class_names = false +ij_groovy_use_fq_class_names_in_javadoc = true +ij_groovy_use_relative_indents = false +ij_groovy_use_single_class_imports = true +ij_groovy_variable_annotation_wrap = off +ij_groovy_while_brace_force = never +ij_groovy_while_on_new_line = false +ij_groovy_wrap_long_lines = false + +# noinspection EditorConfigKeyCorrectness +[{*.kt,*.kts}] +ktlint_standard_import-ordering = disabled +ktlint_standard_multiline-if-else = disabled +ktlint_standard_trailing-comma-on-call-site = disabled +ktlint_standard_trailing-comma-on-declaration-site = disabled +ktLint_standard_package-name = disabled +max_line_length = 120 +ij_kotlin_align_in_columns_case_branch = false +ij_kotlin_align_multiline_binary_operation = false +ij_kotlin_align_multiline_extends_list = false +ij_kotlin_align_multiline_method_parentheses = false +ij_kotlin_align_multiline_parameters = true +ij_kotlin_align_multiline_parameters_in_calls = false +ij_kotlin_allow_trailing_comma = false +ij_kotlin_allow_trailing_comma_on_call_site = false +ij_kotlin_assignment_wrap = normal +ij_kotlin_blank_lines_after_class_header = 0 +ij_kotlin_blank_lines_around_block_when_branches = 0 +ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1 +ij_kotlin_block_comment_at_first_column = true +ij_kotlin_call_parameters_new_line_after_left_paren = true +ij_kotlin_call_parameters_right_paren_on_new_line = true +ij_kotlin_call_parameters_wrap = on_every_item +ij_kotlin_catch_on_new_line = false +ij_kotlin_class_annotation_wrap = split_into_lines +ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL +ij_kotlin_continuation_indent_for_chained_calls = false +ij_kotlin_continuation_indent_for_expression_bodies = false +ij_kotlin_continuation_indent_in_argument_lists = false +ij_kotlin_continuation_indent_in_elvis = false +ij_kotlin_continuation_indent_in_if_conditions = false +ij_kotlin_continuation_indent_in_parameter_lists = false +ij_kotlin_continuation_indent_in_supertype_lists = false +ij_kotlin_else_on_new_line = false +ij_kotlin_enum_constants_wrap = off +ij_kotlin_extends_list_wrap = normal +ij_kotlin_field_annotation_wrap = split_into_lines +ij_kotlin_finally_on_new_line = false +ij_kotlin_if_rparen_on_new_line = true +ij_kotlin_import_nested_classes = false +ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^ +ij_kotlin_insert_whitespaces_in_simple_one_line_method = true +ij_kotlin_keep_blank_lines_before_right_brace = 2 +ij_kotlin_keep_blank_lines_in_code = 2 +ij_kotlin_keep_blank_lines_in_declarations = 2 +ij_kotlin_keep_first_column_comment = true +ij_kotlin_keep_indents_on_empty_lines = false +ij_kotlin_keep_line_breaks = true +ij_kotlin_lbrace_on_next_line = false +ij_kotlin_line_comment_add_space = false +ij_kotlin_line_comment_at_first_column = true +ij_kotlin_method_annotation_wrap = split_into_lines +ij_kotlin_method_call_chain_wrap = normal +ij_kotlin_method_parameters_new_line_after_left_paren = true +ij_kotlin_method_parameters_right_paren_on_new_line = true +ij_kotlin_method_parameters_wrap = on_every_item +ij_kotlin_name_count_to_use_star_import = 2147483647 +ij_kotlin_name_count_to_use_star_import_for_members = 2147483647 +ij_kotlin_packages_to_use_import_on_demand = kotlinx.android.synthetic.**,io.ktor.** +ij_kotlin_parameter_annotation_wrap = off +ij_kotlin_space_after_comma = true +ij_kotlin_space_after_extend_colon = true +ij_kotlin_space_after_type_colon = true +ij_kotlin_space_before_catch_parentheses = true +ij_kotlin_space_before_comma = false +ij_kotlin_space_before_extend_colon = true +ij_kotlin_space_before_for_parentheses = true +ij_kotlin_space_before_if_parentheses = true +ij_kotlin_space_before_lambda_arrow = true +ij_kotlin_space_before_type_colon = false +ij_kotlin_space_before_when_parentheses = true +ij_kotlin_space_before_while_parentheses = true +ij_kotlin_spaces_around_additive_operators = true +ij_kotlin_spaces_around_assignment_operators = true +ij_kotlin_spaces_around_equality_operators = true +ij_kotlin_spaces_around_function_type_arrow = true +ij_kotlin_spaces_around_logical_operators = true +ij_kotlin_spaces_around_multiplicative_operators = true +ij_kotlin_spaces_around_range = false +ij_kotlin_spaces_around_relational_operators = true +ij_kotlin_spaces_around_unary_operator = false +ij_kotlin_spaces_around_when_arrow = true +ij_kotlin_use_custom_formatting_for_modifiers = true +ij_kotlin_variable_annotation_wrap = off +ij_kotlin_while_on_new_line = false +ij_kotlin_wrap_elvis_expressions = 1 +ij_kotlin_wrap_expression_body_functions = 1 +ij_kotlin_wrap_first_method_in_call_chain = false + +[{*.har,*.json}] +indent_size = 2 +ij_json_keep_blank_lines_in_code = 0 +ij_json_keep_indents_on_empty_lines = false +ij_json_keep_line_breaks = true +ij_json_space_after_colon = true +ij_json_space_after_comma = true +ij_json_space_before_colon = true +ij_json_space_before_comma = false +ij_json_spaces_within_braces = false +ij_json_spaces_within_brackets = false +ij_json_wrap_long_lines = false + +[{*.htm,*.html,*.sht,*.shtm,*.shtml}] +ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 +ij_html_align_attributes = true +ij_html_align_text = false +ij_html_attribute_wrap = normal +ij_html_block_comment_at_first_column = true +ij_html_do_not_align_children_of_min_lines = 0 +ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p +ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot +ij_html_enforce_quotes = false +ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var +ij_html_keep_blank_lines = 2 +ij_html_keep_indents_on_empty_lines = false +ij_html_keep_line_breaks = true +ij_html_keep_line_breaks_in_text = true +ij_html_keep_whitespaces = false +ij_html_keep_whitespaces_inside = span,pre,textarea +ij_html_line_comment_at_first_column = true +ij_html_new_line_after_last_attribute = never +ij_html_new_line_before_first_attribute = never +ij_html_quote_style = double +ij_html_remove_new_line_before_tags = br +ij_html_space_after_tag_name = false +ij_html_space_around_equality_in_attribute = false +ij_html_space_inside_empty_tag = false +ij_html_text_wrap = normal + +[{*.yaml,*.yml}] +indent_size = 2 +ij_yaml_align_values_properties = do_not_align +ij_yaml_autoinsert_sequence_marker = true +ij_yaml_block_mapping_on_new_line = false +ij_yaml_indent_sequence_value = true +ij_yaml_keep_indents_on_empty_lines = false +ij_yaml_keep_line_breaks = true +ij_yaml_sequence_on_new_line = false +ij_yaml_space_before_colon = false +ij_yaml_spaces_within_braces = true +ij_yaml_spaces_within_brackets = true diff --git a/android/build.gradle b/android/build.gradle index eb1d199..7f39895 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -23,6 +23,7 @@ allprojects { apply plugin: 'com.android.library' apply plugin: 'kotlin-android' +apply from: 'ktlint.gradle' android { namespace = "com.adyen.adyen_checkout" @@ -64,4 +65,4 @@ android { } } } -} +} \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..8bc9958 --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip diff --git a/android/ktlint.gradle b/android/ktlint.gradle new file mode 100644 index 0000000..8089dd0 --- /dev/null +++ b/android/ktlint.gradle @@ -0,0 +1,28 @@ +configurations { + ktlint +} + +dependencies { + ktlint "com.pinterest:ktlint:0.50.0" +} + +tasks.register('ktlintCheck', JavaExec) { + description = "Check Kotlin code style." + group = "verification" + + classpath = configurations.ktlint + main = "com.pinterest.ktlint.Main" + args "src/**/main/**/*.kt", "--reporter=plain", "--reporter=checkstyle,output=${project.buildDir}/reports/klint/klint-results.xml" +} + +check.dependsOn ktlintCheck + +tasks.register('ktlintFormat', JavaExec) { + description = "Fix Kotlin code style deviations." + group = "formatting" + + classpath = configurations.ktlint + main = "com.pinterest.ktlint.Main" + args "-F", "src/main/**/*.kt" + jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED") +} diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt index bd82874..c2aa5cb 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt @@ -21,6 +21,7 @@ import io.flutter.embedding.engine.plugins.FlutterPlugin import io.flutter.embedding.engine.plugins.activity.ActivityAware import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding import io.flutter.embedding.engine.plugins.lifecycle.HiddenLifecycleReference +import DropInResult as FlutterDropInResult /** AdyenCheckoutPlugin */ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt index 35f641e..eddc4c9 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt @@ -62,11 +62,10 @@ class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : activity.applicationContext, dropInSessionLauncher, checkoutSession, - dropInConfiguration + dropInConfiguration, ) } } - } override fun startDropInAdvancedFlowPayment( @@ -77,7 +76,7 @@ class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : setAdvancedFlowDropInServiceObserver() activity.lifecycleScope.launch(Dispatchers.IO) { val paymentMethodsApiResponse = PaymentMethodsApiResponse.SERIALIZER.deserialize( - JSONObject(paymentMethodsResponse) + JSONObject(paymentMethodsResponse), ) val paymentMethodsWithoutGiftCards = removeGiftCardPaymentMethods(paymentMethodsApiResponse) @@ -109,7 +108,7 @@ class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : private suspend fun createCheckoutSession( sessionModel: com.adyen.checkout.sessions.core.SessionModel, - dropInConfiguration: com.adyen.checkout.dropin.DropInConfiguration + dropInConfiguration: com.adyen.checkout.dropin.DropInConfiguration, ): CheckoutSession { val checkoutSessionResult = CheckoutSessionProvider.createSession(sessionModel, dropInConfiguration) @@ -119,7 +118,6 @@ class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : } } - private fun setAdvancedFlowDropInServiceObserver() { DropInServiceResultMessenger.instance().removeObservers(activity) DropInServiceResultMessenger.instance().observe(activity) { message -> @@ -129,7 +127,7 @@ class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : val model = PlatformCommunicationModel( PlatformCommunicationType.PAYMENTCOMPONENT, - data = message.contentIfNotHandled.toString() + data = message.contentIfNotHandled.toString(), ) checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} } @@ -144,7 +142,7 @@ class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : val model = PlatformCommunicationModel( PlatformCommunicationType.ADDITIONALDETAILS, - data = message.contentIfNotHandled.toString() + data = message.contentIfNotHandled.toString(), ) checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} } diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt index 1e49317..5c3d14e 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt @@ -120,4 +120,5 @@ class AdvancedFlowDropInService : DropInService(), LifecycleOwner { override val lifecycle: Lifecycle get() = dispatcher.lifecycle -} \ No newline at end of file +} + diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/DropInServiceResultHandler.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/DropInServiceResultHandler.kt new file mode 100644 index 0000000..e69de29 diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/DropInServiceResultMessenger.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/DropInServiceResultMessenger.kt index d56ef40..ca5c66d 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/DropInServiceResultMessenger.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/DropInServiceResultMessenger.kt @@ -48,4 +48,4 @@ class DropInAdditionalDetailsResultMessenger : LiveData>() { dropInAdditionalDetailsResultMessenger.postValue(Event(value)) } } -} \ No newline at end of file +} diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Event.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Event.kt index 429f9bd..d3d98b2 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Event.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Event.kt @@ -23,4 +23,4 @@ class Event(content: T?) { fun hasBeenHandled(): Boolean { return hasBeenHandled } -} \ No newline at end of file +} diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Mapper.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Mapper.kt index e9c7709..8e347a5 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Mapper.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Mapper.kt @@ -20,8 +20,8 @@ object Mapper { return com.adyen.checkout.dropin.DropInConfiguration.Builder( context, this.environment.mapToEnvironment(), - clientKey - ).setAmount(amount).build(); + clientKey, + ).setAmount(amount).build() } private fun Environment.mapToEnvironment(): com.adyen.checkout.core.Environment { @@ -33,7 +33,6 @@ object Mapper { Environment.INDIA -> SDKEnvironment.INDIA Environment.APSE -> SDKEnvironment.APSE } - } private fun Amount.mapToAmount(): com.adyen.checkout.components.core.Amount { @@ -49,7 +48,7 @@ object Mapper { pspReference = pspReference, orderData = orderData, amount = amount?.mapTopAmount(), - remainingAmount = remainingAmount?.mapTopAmount() + remainingAmount = remainingAmount?.mapTopAmount(), ) } -} \ No newline at end of file +} --- android/.editorconfig | 614 ++++++++++++++++++ android/build.gradle | 3 +- android/ktlint.gradle | 28 + .../adyen_checkout/AdyenCheckoutPlugin.kt | 1 + .../adyen_checkout/CheckoutPlatformApi.kt | 12 +- .../AdvancedFlowDropInService.kt | 3 +- .../DropInServiceResultHandler.kt | 0 .../DropInServiceResultMessenger.kt | 2 +- .../com/adyen/adyen_checkout/utils/Event.kt | 2 +- .../com/adyen/adyen_checkout/utils/Mapper.kt | 9 +- 10 files changed, 658 insertions(+), 16 deletions(-) create mode 100644 android/.editorconfig create mode 100644 android/ktlint.gradle create mode 100644 android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/DropInServiceResultHandler.kt diff --git a/android/.editorconfig b/android/.editorconfig new file mode 100644 index 00000000..c04ece5d --- /dev/null +++ b/android/.editorconfig @@ -0,0 +1,614 @@ +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +max_line_length = 100 +tab_width = 4 +ij_continuation_indent_size = 4 +ij_formatter_off_tag = @formatter:off +ij_formatter_on_tag = @formatter:on +ij_formatter_tags_enabled = false +ij_smart_tabs = false +ij_visual_guides = none +ij_wrap_on_typing = false + +[*.java] +max_line_length = 120 +ij_java_align_consecutive_assignments = false +ij_java_align_consecutive_variable_declarations = false +ij_java_align_group_field_declarations = false +ij_java_align_multiline_annotation_parameters = false +ij_java_align_multiline_array_initializer_expression = false +ij_java_align_multiline_assignment = false +ij_java_align_multiline_binary_operation = false +ij_java_align_multiline_chained_methods = false +ij_java_align_multiline_extends_list = false +ij_java_align_multiline_for = true +ij_java_align_multiline_method_parentheses = false +ij_java_align_multiline_parameters = true +ij_java_align_multiline_parameters_in_calls = false +ij_java_align_multiline_parenthesized_expression = false +ij_java_align_multiline_records = true +ij_java_align_multiline_resources = true +ij_java_align_multiline_ternary_operation = false +ij_java_align_multiline_text_blocks = false +ij_java_align_multiline_throws_list = false +ij_java_align_subsequent_simple_methods = false +ij_java_align_throws_keyword = false +ij_java_annotation_parameter_wrap = off +ij_java_array_initializer_new_line_after_left_brace = false +ij_java_array_initializer_right_brace_on_new_line = false +ij_java_array_initializer_wrap = off +ij_java_assert_statement_colon_on_next_line = false +ij_java_assert_statement_wrap = off +ij_java_assignment_wrap = off +ij_java_binary_operation_sign_on_next_line = false +ij_java_binary_operation_wrap = off +ij_java_blank_lines_after_anonymous_class_header = 0 +ij_java_blank_lines_after_class_header = 0 +ij_java_blank_lines_after_imports = 1 +ij_java_blank_lines_after_package = 1 +ij_java_blank_lines_around_class = 1 +ij_java_blank_lines_around_field = 0 +ij_java_blank_lines_around_field_in_interface = 0 +ij_java_blank_lines_around_initializer = 1 +ij_java_blank_lines_around_method = 1 +ij_java_blank_lines_around_method_in_interface = 1 +ij_java_blank_lines_before_class_end = 0 +ij_java_blank_lines_before_imports = 1 +ij_java_blank_lines_before_method_body = 0 +ij_java_blank_lines_before_package = 0 +ij_java_block_brace_style = end_of_line +ij_java_block_comment_at_first_column = true +ij_java_builder_methods = none +ij_java_call_parameters_new_line_after_left_paren = false +ij_java_call_parameters_right_paren_on_new_line = false +ij_java_call_parameters_wrap = off +ij_java_case_statement_on_separate_line = true +ij_java_catch_on_new_line = false +ij_java_class_annotation_wrap = split_into_lines +ij_java_class_brace_style = end_of_line +ij_java_class_count_to_use_import_on_demand = 99 +ij_java_class_names_in_javadoc = 1 +ij_java_do_not_indent_top_level_class_members = false +ij_java_do_not_wrap_after_single_annotation = false +ij_java_do_while_brace_force = never +ij_java_doc_add_blank_line_after_description = true +ij_java_doc_add_blank_line_after_param_comments = false +ij_java_doc_add_blank_line_after_return = false +ij_java_doc_add_p_tag_on_empty_lines = true +ij_java_doc_align_exception_comments = true +ij_java_doc_align_param_comments = true +ij_java_doc_do_not_wrap_if_one_line = false +ij_java_doc_enable_formatting = true +ij_java_doc_enable_leading_asterisks = true +ij_java_doc_indent_on_continuation = false +ij_java_doc_keep_empty_lines = true +ij_java_doc_keep_empty_parameter_tag = true +ij_java_doc_keep_empty_return_tag = true +ij_java_doc_keep_empty_throws_tag = true +ij_java_doc_keep_invalid_tags = true +ij_java_doc_param_description_on_new_line = false +ij_java_doc_preserve_line_breaks = false +ij_java_doc_use_throws_not_exception_tag = true +ij_java_else_on_new_line = false +ij_java_enum_constants_wrap = off +ij_java_extends_keyword_wrap = off +ij_java_extends_list_wrap = off +ij_java_field_annotation_wrap = split_into_lines +ij_java_finally_on_new_line = false +ij_java_for_brace_force = never +ij_java_for_statement_new_line_after_left_paren = false +ij_java_for_statement_right_paren_on_new_line = false +ij_java_for_statement_wrap = off +ij_java_generate_final_locals = false +ij_java_generate_final_parameters = false +ij_java_if_brace_force = never +ij_java_imports_layout = $android.**,$androidx.**,$com.**,$junit.**,$net.**,$org.**,$java.**,$javax.**,$*,|,android.**,|,androidx.**,|,com.**,|,junit.**,|,net.**,|,org.**,|,java.**,|,javax.**,|,*,| +ij_java_indent_case_from_switch = true +ij_java_insert_inner_class_imports = false +ij_java_insert_override_annotation = true +ij_java_keep_blank_lines_before_right_brace = 2 +ij_java_keep_blank_lines_between_package_declaration_and_header = 2 +ij_java_keep_blank_lines_in_code = 2 +ij_java_keep_blank_lines_in_declarations = 2 +ij_java_keep_builder_methods_indents = false +ij_java_keep_control_statement_in_one_line = true +ij_java_keep_first_column_comment = true +ij_java_keep_indents_on_empty_lines = false +ij_java_keep_line_breaks = true +ij_java_keep_multiple_expressions_in_one_line = false +ij_java_keep_simple_blocks_in_one_line = false +ij_java_keep_simple_classes_in_one_line = false +ij_java_keep_simple_lambdas_in_one_line = false +ij_java_keep_simple_methods_in_one_line = false +ij_java_label_indent_absolute = false +ij_java_label_indent_size = 0 +ij_java_lambda_brace_style = end_of_line +ij_java_layout_static_imports_separately = true +ij_java_line_comment_add_space = false +ij_java_line_comment_at_first_column = true +ij_java_method_annotation_wrap = split_into_lines +ij_java_method_brace_style = end_of_line +ij_java_method_call_chain_wrap = off +ij_java_method_parameters_new_line_after_left_paren = false +ij_java_method_parameters_right_paren_on_new_line = false +ij_java_method_parameters_wrap = off +ij_java_modifier_list_wrap = false +ij_java_names_count_to_use_import_on_demand = 99 +ij_java_new_line_after_lparen_in_record_header = false +ij_java_parameter_annotation_wrap = off +ij_java_parentheses_expression_new_line_after_left_paren = false +ij_java_parentheses_expression_right_paren_on_new_line = false +ij_java_place_assignment_sign_on_next_line = false +ij_java_prefer_longer_names = true +ij_java_prefer_parameters_wrap = false +ij_java_record_components_wrap = normal +ij_java_repeat_synchronized = true +ij_java_replace_instanceof_and_cast = false +ij_java_replace_null_check = true +ij_java_replace_sum_lambda_with_method_ref = true +ij_java_resource_list_new_line_after_left_paren = false +ij_java_resource_list_right_paren_on_new_line = false +ij_java_resource_list_wrap = off +ij_java_rparen_on_new_line_in_record_header = false +ij_java_space_after_closing_angle_bracket_in_type_argument = false +ij_java_space_after_colon = true +ij_java_space_after_comma = true +ij_java_space_after_comma_in_type_arguments = true +ij_java_space_after_for_semicolon = true +ij_java_space_after_quest = true +ij_java_space_after_type_cast = true +ij_java_space_before_annotation_array_initializer_left_brace = false +ij_java_space_before_annotation_parameter_list = false +ij_java_space_before_array_initializer_left_brace = false +ij_java_space_before_catch_keyword = true +ij_java_space_before_catch_left_brace = true +ij_java_space_before_catch_parentheses = true +ij_java_space_before_class_left_brace = true +ij_java_space_before_colon = true +ij_java_space_before_colon_in_foreach = true +ij_java_space_before_comma = false +ij_java_space_before_do_left_brace = true +ij_java_space_before_else_keyword = true +ij_java_space_before_else_left_brace = true +ij_java_space_before_finally_keyword = true +ij_java_space_before_finally_left_brace = true +ij_java_space_before_for_left_brace = true +ij_java_space_before_for_parentheses = true +ij_java_space_before_for_semicolon = false +ij_java_space_before_if_left_brace = true +ij_java_space_before_if_parentheses = true +ij_java_space_before_method_call_parentheses = false +ij_java_space_before_method_left_brace = true +ij_java_space_before_method_parentheses = false +ij_java_space_before_opening_angle_bracket_in_type_parameter = false +ij_java_space_before_quest = true +ij_java_space_before_switch_left_brace = true +ij_java_space_before_switch_parentheses = true +ij_java_space_before_synchronized_left_brace = true +ij_java_space_before_synchronized_parentheses = true +ij_java_space_before_try_left_brace = true +ij_java_space_before_try_parentheses = true +ij_java_space_before_type_parameter_list = false +ij_java_space_before_while_keyword = true +ij_java_space_before_while_left_brace = true +ij_java_space_before_while_parentheses = true +ij_java_space_inside_one_line_enum_braces = false +ij_java_space_within_empty_array_initializer_braces = false +ij_java_space_within_empty_method_call_parentheses = false +ij_java_space_within_empty_method_parentheses = false +ij_java_spaces_around_additive_operators = true +ij_java_spaces_around_assignment_operators = true +ij_java_spaces_around_bitwise_operators = true +ij_java_spaces_around_equality_operators = true +ij_java_spaces_around_lambda_arrow = true +ij_java_spaces_around_logical_operators = true +ij_java_spaces_around_method_ref_dbl_colon = false +ij_java_spaces_around_multiplicative_operators = true +ij_java_spaces_around_relational_operators = true +ij_java_spaces_around_shift_operators = true +ij_java_spaces_around_type_bounds_in_type_parameters = true +ij_java_spaces_around_unary_operator = false +ij_java_spaces_within_angle_brackets = false +ij_java_spaces_within_annotation_parentheses = false +ij_java_spaces_within_array_initializer_braces = false +ij_java_spaces_within_braces = false +ij_java_spaces_within_brackets = false +ij_java_spaces_within_cast_parentheses = false +ij_java_spaces_within_catch_parentheses = false +ij_java_spaces_within_for_parentheses = false +ij_java_spaces_within_if_parentheses = false +ij_java_spaces_within_method_call_parentheses = false +ij_java_spaces_within_method_parentheses = false +ij_java_spaces_within_parentheses = false +ij_java_spaces_within_record_header = false +ij_java_spaces_within_switch_parentheses = false +ij_java_spaces_within_synchronized_parentheses = false +ij_java_spaces_within_try_parentheses = false +ij_java_spaces_within_while_parentheses = false +ij_java_special_else_if_treatment = true +ij_java_subclass_name_suffix = Impl +ij_java_ternary_operation_signs_on_next_line = false +ij_java_ternary_operation_wrap = off +ij_java_test_name_suffix = Test +ij_java_throws_keyword_wrap = off +ij_java_throws_list_wrap = off +ij_java_use_external_annotations = false +ij_java_use_fq_class_names = false +ij_java_use_relative_indents = false +ij_java_use_single_class_imports = true +ij_java_variable_annotation_wrap = off +ij_java_visibility = public +ij_java_while_brace_force = never +ij_java_while_on_new_line = false +ij_java_wrap_comments = false +ij_java_wrap_first_method_in_call_chain = false +ij_java_wrap_long_lines = false + +[*.properties] +ij_properties_align_group_field_declarations = false +ij_properties_keep_blank_lines = false +ij_properties_key_value_delimiter = equals +ij_properties_spaces_around_key_value_delimiter = false + +[.editorconfig] +ij_editorconfig_align_group_field_declarations = false +ij_editorconfig_space_after_colon = false +ij_editorconfig_space_after_comma = true +ij_editorconfig_space_before_colon = false +ij_editorconfig_space_before_comma = false +ij_editorconfig_spaces_around_assignment_operators = true + +[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.rng,*.tld,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul}] +ij_xml_align_attributes = false +ij_xml_align_text = false +ij_xml_attribute_wrap = normal +ij_xml_block_comment_at_first_column = true +ij_xml_keep_blank_lines = 2 +ij_xml_keep_indents_on_empty_lines = false +ij_xml_keep_line_breaks = false +ij_xml_keep_line_breaks_in_text = true +ij_xml_keep_whitespaces = false +ij_xml_keep_whitespaces_around_cdata = preserve +ij_xml_keep_whitespaces_inside_cdata = false +ij_xml_line_comment_at_first_column = true +ij_xml_space_after_tag_name = false +ij_xml_space_around_equals_in_attribute = false +ij_xml_space_inside_empty_tag = true +ij_xml_text_wrap = normal +ij_xml_use_custom_settings = true + +[{*.bash,*.sh,*.zsh}] +indent_size = 2 +tab_width = 2 +ij_shell_binary_ops_start_line = false +ij_shell_keep_column_alignment_padding = false +ij_shell_minify_program = false +ij_shell_redirect_followed_by_space = false +ij_shell_switch_cases_indented = false +ij_shell_use_unix_line_separator = true + +[{*.gant,*.gradle,*.groovy,*.gy}] +ij_groovy_align_group_field_declarations = false +ij_groovy_align_multiline_array_initializer_expression = false +ij_groovy_align_multiline_assignment = false +ij_groovy_align_multiline_binary_operation = false +ij_groovy_align_multiline_chained_methods = false +ij_groovy_align_multiline_extends_list = false +ij_groovy_align_multiline_for = true +ij_groovy_align_multiline_list_or_map = true +ij_groovy_align_multiline_method_parentheses = false +ij_groovy_align_multiline_parameters = true +ij_groovy_align_multiline_parameters_in_calls = false +ij_groovy_align_multiline_resources = true +ij_groovy_align_multiline_ternary_operation = false +ij_groovy_align_multiline_throws_list = false +ij_groovy_align_named_args_in_map = true +ij_groovy_align_throws_keyword = false +ij_groovy_array_initializer_new_line_after_left_brace = false +ij_groovy_array_initializer_right_brace_on_new_line = false +ij_groovy_array_initializer_wrap = off +ij_groovy_assert_statement_wrap = off +ij_groovy_assignment_wrap = off +ij_groovy_binary_operation_wrap = off +ij_groovy_blank_lines_after_class_header = 0 +ij_groovy_blank_lines_after_imports = 1 +ij_groovy_blank_lines_after_package = 1 +ij_groovy_blank_lines_around_class = 1 +ij_groovy_blank_lines_around_field = 0 +ij_groovy_blank_lines_around_field_in_interface = 0 +ij_groovy_blank_lines_around_method = 1 +ij_groovy_blank_lines_around_method_in_interface = 1 +ij_groovy_blank_lines_before_imports = 1 +ij_groovy_blank_lines_before_method_body = 0 +ij_groovy_blank_lines_before_package = 0 +ij_groovy_block_brace_style = end_of_line +ij_groovy_block_comment_at_first_column = true +ij_groovy_call_parameters_new_line_after_left_paren = false +ij_groovy_call_parameters_right_paren_on_new_line = false +ij_groovy_call_parameters_wrap = off +ij_groovy_catch_on_new_line = false +ij_groovy_class_annotation_wrap = split_into_lines +ij_groovy_class_brace_style = end_of_line +ij_groovy_class_count_to_use_import_on_demand = 5 +ij_groovy_do_while_brace_force = never +ij_groovy_else_on_new_line = false +ij_groovy_enum_constants_wrap = off +ij_groovy_extends_keyword_wrap = off +ij_groovy_extends_list_wrap = off +ij_groovy_field_annotation_wrap = split_into_lines +ij_groovy_finally_on_new_line = false +ij_groovy_for_brace_force = never +ij_groovy_for_statement_new_line_after_left_paren = false +ij_groovy_for_statement_right_paren_on_new_line = false +ij_groovy_for_statement_wrap = off +ij_groovy_if_brace_force = never +ij_groovy_import_annotation_wrap = 2 +ij_groovy_imports_layout = *,|,javax.**,java.**,|,$* +ij_groovy_indent_case_from_switch = true +ij_groovy_indent_label_blocks = true +ij_groovy_insert_inner_class_imports = false +ij_groovy_keep_blank_lines_before_right_brace = 2 +ij_groovy_keep_blank_lines_in_code = 2 +ij_groovy_keep_blank_lines_in_declarations = 2 +ij_groovy_keep_control_statement_in_one_line = true +ij_groovy_keep_first_column_comment = true +ij_groovy_keep_indents_on_empty_lines = false +ij_groovy_keep_line_breaks = true +ij_groovy_keep_multiple_expressions_in_one_line = false +ij_groovy_keep_simple_blocks_in_one_line = false +ij_groovy_keep_simple_classes_in_one_line = true +ij_groovy_keep_simple_lambdas_in_one_line = true +ij_groovy_keep_simple_methods_in_one_line = true +ij_groovy_label_indent_absolute = false +ij_groovy_label_indent_size = 0 +ij_groovy_lambda_brace_style = end_of_line +ij_groovy_layout_static_imports_separately = true +ij_groovy_line_comment_add_space = false +ij_groovy_line_comment_at_first_column = true +ij_groovy_method_annotation_wrap = split_into_lines +ij_groovy_method_brace_style = end_of_line +ij_groovy_method_call_chain_wrap = off +ij_groovy_method_parameters_new_line_after_left_paren = false +ij_groovy_method_parameters_right_paren_on_new_line = false +ij_groovy_method_parameters_wrap = off +ij_groovy_modifier_list_wrap = false +ij_groovy_names_count_to_use_import_on_demand = 3 +ij_groovy_parameter_annotation_wrap = off +ij_groovy_parentheses_expression_new_line_after_left_paren = false +ij_groovy_parentheses_expression_right_paren_on_new_line = false +ij_groovy_prefer_parameters_wrap = false +ij_groovy_resource_list_new_line_after_left_paren = false +ij_groovy_resource_list_right_paren_on_new_line = false +ij_groovy_resource_list_wrap = off +ij_groovy_space_after_assert_separator = true +ij_groovy_space_after_colon = true +ij_groovy_space_after_comma = true +ij_groovy_space_after_comma_in_type_arguments = true +ij_groovy_space_after_for_semicolon = true +ij_groovy_space_after_quest = true +ij_groovy_space_after_type_cast = true +ij_groovy_space_before_annotation_parameter_list = false +ij_groovy_space_before_array_initializer_left_brace = false +ij_groovy_space_before_assert_separator = false +ij_groovy_space_before_catch_keyword = true +ij_groovy_space_before_catch_left_brace = true +ij_groovy_space_before_catch_parentheses = true +ij_groovy_space_before_class_left_brace = true +ij_groovy_space_before_closure_left_brace = true +ij_groovy_space_before_colon = true +ij_groovy_space_before_comma = false +ij_groovy_space_before_do_left_brace = true +ij_groovy_space_before_else_keyword = true +ij_groovy_space_before_else_left_brace = true +ij_groovy_space_before_finally_keyword = true +ij_groovy_space_before_finally_left_brace = true +ij_groovy_space_before_for_left_brace = true +ij_groovy_space_before_for_parentheses = true +ij_groovy_space_before_for_semicolon = false +ij_groovy_space_before_if_left_brace = true +ij_groovy_space_before_if_parentheses = true +ij_groovy_space_before_method_call_parentheses = false +ij_groovy_space_before_method_left_brace = true +ij_groovy_space_before_method_parentheses = false +ij_groovy_space_before_quest = true +ij_groovy_space_before_switch_left_brace = true +ij_groovy_space_before_switch_parentheses = true +ij_groovy_space_before_synchronized_left_brace = true +ij_groovy_space_before_synchronized_parentheses = true +ij_groovy_space_before_try_left_brace = true +ij_groovy_space_before_try_parentheses = true +ij_groovy_space_before_while_keyword = true +ij_groovy_space_before_while_left_brace = true +ij_groovy_space_before_while_parentheses = true +ij_groovy_space_in_named_argument = true +ij_groovy_space_in_named_argument_before_colon = false +ij_groovy_space_within_empty_array_initializer_braces = false +ij_groovy_space_within_empty_method_call_parentheses = false +ij_groovy_spaces_around_additive_operators = true +ij_groovy_spaces_around_assignment_operators = true +ij_groovy_spaces_around_bitwise_operators = true +ij_groovy_spaces_around_equality_operators = true +ij_groovy_spaces_around_lambda_arrow = true +ij_groovy_spaces_around_logical_operators = true +ij_groovy_spaces_around_multiplicative_operators = true +ij_groovy_spaces_around_regex_operators = true +ij_groovy_spaces_around_relational_operators = true +ij_groovy_spaces_around_shift_operators = true +ij_groovy_spaces_within_annotation_parentheses = false +ij_groovy_spaces_within_array_initializer_braces = false +ij_groovy_spaces_within_braces = true +ij_groovy_spaces_within_brackets = false +ij_groovy_spaces_within_cast_parentheses = false +ij_groovy_spaces_within_catch_parentheses = false +ij_groovy_spaces_within_for_parentheses = false +ij_groovy_spaces_within_gstring_injection_braces = false +ij_groovy_spaces_within_if_parentheses = false +ij_groovy_spaces_within_list_or_map = false +ij_groovy_spaces_within_method_call_parentheses = false +ij_groovy_spaces_within_method_parentheses = false +ij_groovy_spaces_within_parentheses = false +ij_groovy_spaces_within_switch_parentheses = false +ij_groovy_spaces_within_synchronized_parentheses = false +ij_groovy_spaces_within_try_parentheses = false +ij_groovy_spaces_within_tuple_expression = false +ij_groovy_spaces_within_while_parentheses = false +ij_groovy_special_else_if_treatment = true +ij_groovy_ternary_operation_wrap = off +ij_groovy_throws_keyword_wrap = off +ij_groovy_throws_list_wrap = off +ij_groovy_use_flying_geese_braces = false +ij_groovy_use_fq_class_names = false +ij_groovy_use_fq_class_names_in_javadoc = true +ij_groovy_use_relative_indents = false +ij_groovy_use_single_class_imports = true +ij_groovy_variable_annotation_wrap = off +ij_groovy_while_brace_force = never +ij_groovy_while_on_new_line = false +ij_groovy_wrap_long_lines = false + +# noinspection EditorConfigKeyCorrectness +[{*.kt,*.kts}] +ktlint_standard_import-ordering = disabled +ktlint_standard_multiline-if-else = disabled +ktlint_standard_trailing-comma-on-call-site = disabled +ktlint_standard_trailing-comma-on-declaration-site = disabled +ktLint_standard_package-name = disabled +max_line_length = 120 +ij_kotlin_align_in_columns_case_branch = false +ij_kotlin_align_multiline_binary_operation = false +ij_kotlin_align_multiline_extends_list = false +ij_kotlin_align_multiline_method_parentheses = false +ij_kotlin_align_multiline_parameters = true +ij_kotlin_align_multiline_parameters_in_calls = false +ij_kotlin_allow_trailing_comma = false +ij_kotlin_allow_trailing_comma_on_call_site = false +ij_kotlin_assignment_wrap = normal +ij_kotlin_blank_lines_after_class_header = 0 +ij_kotlin_blank_lines_around_block_when_branches = 0 +ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1 +ij_kotlin_block_comment_at_first_column = true +ij_kotlin_call_parameters_new_line_after_left_paren = true +ij_kotlin_call_parameters_right_paren_on_new_line = true +ij_kotlin_call_parameters_wrap = on_every_item +ij_kotlin_catch_on_new_line = false +ij_kotlin_class_annotation_wrap = split_into_lines +ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL +ij_kotlin_continuation_indent_for_chained_calls = false +ij_kotlin_continuation_indent_for_expression_bodies = false +ij_kotlin_continuation_indent_in_argument_lists = false +ij_kotlin_continuation_indent_in_elvis = false +ij_kotlin_continuation_indent_in_if_conditions = false +ij_kotlin_continuation_indent_in_parameter_lists = false +ij_kotlin_continuation_indent_in_supertype_lists = false +ij_kotlin_else_on_new_line = false +ij_kotlin_enum_constants_wrap = off +ij_kotlin_extends_list_wrap = normal +ij_kotlin_field_annotation_wrap = split_into_lines +ij_kotlin_finally_on_new_line = false +ij_kotlin_if_rparen_on_new_line = true +ij_kotlin_import_nested_classes = false +ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^ +ij_kotlin_insert_whitespaces_in_simple_one_line_method = true +ij_kotlin_keep_blank_lines_before_right_brace = 2 +ij_kotlin_keep_blank_lines_in_code = 2 +ij_kotlin_keep_blank_lines_in_declarations = 2 +ij_kotlin_keep_first_column_comment = true +ij_kotlin_keep_indents_on_empty_lines = false +ij_kotlin_keep_line_breaks = true +ij_kotlin_lbrace_on_next_line = false +ij_kotlin_line_comment_add_space = false +ij_kotlin_line_comment_at_first_column = true +ij_kotlin_method_annotation_wrap = split_into_lines +ij_kotlin_method_call_chain_wrap = normal +ij_kotlin_method_parameters_new_line_after_left_paren = true +ij_kotlin_method_parameters_right_paren_on_new_line = true +ij_kotlin_method_parameters_wrap = on_every_item +ij_kotlin_name_count_to_use_star_import = 2147483647 +ij_kotlin_name_count_to_use_star_import_for_members = 2147483647 +ij_kotlin_packages_to_use_import_on_demand = kotlinx.android.synthetic.**,io.ktor.** +ij_kotlin_parameter_annotation_wrap = off +ij_kotlin_space_after_comma = true +ij_kotlin_space_after_extend_colon = true +ij_kotlin_space_after_type_colon = true +ij_kotlin_space_before_catch_parentheses = true +ij_kotlin_space_before_comma = false +ij_kotlin_space_before_extend_colon = true +ij_kotlin_space_before_for_parentheses = true +ij_kotlin_space_before_if_parentheses = true +ij_kotlin_space_before_lambda_arrow = true +ij_kotlin_space_before_type_colon = false +ij_kotlin_space_before_when_parentheses = true +ij_kotlin_space_before_while_parentheses = true +ij_kotlin_spaces_around_additive_operators = true +ij_kotlin_spaces_around_assignment_operators = true +ij_kotlin_spaces_around_equality_operators = true +ij_kotlin_spaces_around_function_type_arrow = true +ij_kotlin_spaces_around_logical_operators = true +ij_kotlin_spaces_around_multiplicative_operators = true +ij_kotlin_spaces_around_range = false +ij_kotlin_spaces_around_relational_operators = true +ij_kotlin_spaces_around_unary_operator = false +ij_kotlin_spaces_around_when_arrow = true +ij_kotlin_use_custom_formatting_for_modifiers = true +ij_kotlin_variable_annotation_wrap = off +ij_kotlin_while_on_new_line = false +ij_kotlin_wrap_elvis_expressions = 1 +ij_kotlin_wrap_expression_body_functions = 1 +ij_kotlin_wrap_first_method_in_call_chain = false + +[{*.har,*.json}] +indent_size = 2 +ij_json_keep_blank_lines_in_code = 0 +ij_json_keep_indents_on_empty_lines = false +ij_json_keep_line_breaks = true +ij_json_space_after_colon = true +ij_json_space_after_comma = true +ij_json_space_before_colon = true +ij_json_space_before_comma = false +ij_json_spaces_within_braces = false +ij_json_spaces_within_brackets = false +ij_json_wrap_long_lines = false + +[{*.htm,*.html,*.sht,*.shtm,*.shtml}] +ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 +ij_html_align_attributes = true +ij_html_align_text = false +ij_html_attribute_wrap = normal +ij_html_block_comment_at_first_column = true +ij_html_do_not_align_children_of_min_lines = 0 +ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p +ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot +ij_html_enforce_quotes = false +ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var +ij_html_keep_blank_lines = 2 +ij_html_keep_indents_on_empty_lines = false +ij_html_keep_line_breaks = true +ij_html_keep_line_breaks_in_text = true +ij_html_keep_whitespaces = false +ij_html_keep_whitespaces_inside = span,pre,textarea +ij_html_line_comment_at_first_column = true +ij_html_new_line_after_last_attribute = never +ij_html_new_line_before_first_attribute = never +ij_html_quote_style = double +ij_html_remove_new_line_before_tags = br +ij_html_space_after_tag_name = false +ij_html_space_around_equality_in_attribute = false +ij_html_space_inside_empty_tag = false +ij_html_text_wrap = normal + +[{*.yaml,*.yml}] +indent_size = 2 +ij_yaml_align_values_properties = do_not_align +ij_yaml_autoinsert_sequence_marker = true +ij_yaml_block_mapping_on_new_line = false +ij_yaml_indent_sequence_value = true +ij_yaml_keep_indents_on_empty_lines = false +ij_yaml_keep_line_breaks = true +ij_yaml_sequence_on_new_line = false +ij_yaml_space_before_colon = false +ij_yaml_spaces_within_braces = true +ij_yaml_spaces_within_brackets = true diff --git a/android/build.gradle b/android/build.gradle index 4bbe2344..d5d15e83 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -23,6 +23,7 @@ allprojects { apply plugin: 'com.android.library' apply plugin: 'kotlin-android' +apply from: 'ktlint.gradle' android { namespace = "com.adyen.adyen_checkout" @@ -64,4 +65,4 @@ android { } } } -} +} \ No newline at end of file diff --git a/android/ktlint.gradle b/android/ktlint.gradle new file mode 100644 index 00000000..8089dd0a --- /dev/null +++ b/android/ktlint.gradle @@ -0,0 +1,28 @@ +configurations { + ktlint +} + +dependencies { + ktlint "com.pinterest:ktlint:0.50.0" +} + +tasks.register('ktlintCheck', JavaExec) { + description = "Check Kotlin code style." + group = "verification" + + classpath = configurations.ktlint + main = "com.pinterest.ktlint.Main" + args "src/**/main/**/*.kt", "--reporter=plain", "--reporter=checkstyle,output=${project.buildDir}/reports/klint/klint-results.xml" +} + +check.dependsOn ktlintCheck + +tasks.register('ktlintFormat', JavaExec) { + description = "Fix Kotlin code style deviations." + group = "formatting" + + classpath = configurations.ktlint + main = "com.pinterest.ktlint.Main" + args "-F", "src/main/**/*.kt" + jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED") +} diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt index bd828748..c2aa5cbb 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt @@ -21,6 +21,7 @@ import io.flutter.embedding.engine.plugins.FlutterPlugin import io.flutter.embedding.engine.plugins.activity.ActivityAware import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding import io.flutter.embedding.engine.plugins.lifecycle.HiddenLifecycleReference +import DropInResult as FlutterDropInResult /** AdyenCheckoutPlugin */ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt index 35f641ef..eddc4c9d 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt @@ -62,11 +62,10 @@ class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : activity.applicationContext, dropInSessionLauncher, checkoutSession, - dropInConfiguration + dropInConfiguration, ) } } - } override fun startDropInAdvancedFlowPayment( @@ -77,7 +76,7 @@ class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : setAdvancedFlowDropInServiceObserver() activity.lifecycleScope.launch(Dispatchers.IO) { val paymentMethodsApiResponse = PaymentMethodsApiResponse.SERIALIZER.deserialize( - JSONObject(paymentMethodsResponse) + JSONObject(paymentMethodsResponse), ) val paymentMethodsWithoutGiftCards = removeGiftCardPaymentMethods(paymentMethodsApiResponse) @@ -109,7 +108,7 @@ class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : private suspend fun createCheckoutSession( sessionModel: com.adyen.checkout.sessions.core.SessionModel, - dropInConfiguration: com.adyen.checkout.dropin.DropInConfiguration + dropInConfiguration: com.adyen.checkout.dropin.DropInConfiguration, ): CheckoutSession { val checkoutSessionResult = CheckoutSessionProvider.createSession(sessionModel, dropInConfiguration) @@ -119,7 +118,6 @@ class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : } } - private fun setAdvancedFlowDropInServiceObserver() { DropInServiceResultMessenger.instance().removeObservers(activity) DropInServiceResultMessenger.instance().observe(activity) { message -> @@ -129,7 +127,7 @@ class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : val model = PlatformCommunicationModel( PlatformCommunicationType.PAYMENTCOMPONENT, - data = message.contentIfNotHandled.toString() + data = message.contentIfNotHandled.toString(), ) checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} } @@ -144,7 +142,7 @@ class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : val model = PlatformCommunicationModel( PlatformCommunicationType.ADDITIONALDETAILS, - data = message.contentIfNotHandled.toString() + data = message.contentIfNotHandled.toString(), ) checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} } diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt index ce5f7b17..5362117b 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt @@ -140,4 +140,5 @@ class AdvancedFlowDropInService : DropInService(), LifecycleOwner { override val lifecycle: Lifecycle get() = dispatcher.lifecycle -} \ No newline at end of file +} + diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/DropInServiceResultHandler.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/DropInServiceResultHandler.kt new file mode 100644 index 00000000..e69de29b diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/DropInServiceResultMessenger.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/DropInServiceResultMessenger.kt index d56ef40d..ca5c66d6 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/DropInServiceResultMessenger.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/DropInServiceResultMessenger.kt @@ -48,4 +48,4 @@ class DropInAdditionalDetailsResultMessenger : LiveData>() { dropInAdditionalDetailsResultMessenger.postValue(Event(value)) } } -} \ No newline at end of file +} diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Event.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Event.kt index 429f9bde..d3d98b2f 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Event.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Event.kt @@ -23,4 +23,4 @@ class Event(content: T?) { fun hasBeenHandled(): Boolean { return hasBeenHandled } -} \ No newline at end of file +} diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Mapper.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Mapper.kt index e9c77090..8e347a54 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Mapper.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Mapper.kt @@ -20,8 +20,8 @@ object Mapper { return com.adyen.checkout.dropin.DropInConfiguration.Builder( context, this.environment.mapToEnvironment(), - clientKey - ).setAmount(amount).build(); + clientKey, + ).setAmount(amount).build() } private fun Environment.mapToEnvironment(): com.adyen.checkout.core.Environment { @@ -33,7 +33,6 @@ object Mapper { Environment.INDIA -> SDKEnvironment.INDIA Environment.APSE -> SDKEnvironment.APSE } - } private fun Amount.mapToAmount(): com.adyen.checkout.components.core.Amount { @@ -49,7 +48,7 @@ object Mapper { pspReference = pspReference, orderData = orderData, amount = amount?.mapTopAmount(), - remainingAmount = remainingAmount?.mapTopAmount() + remainingAmount = remainingAmount?.mapTopAmount(), ) } -} \ No newline at end of file +} From 429e6244500d31bee622f1a8fd63cb2ad642bd3b Mon Sep 17 00:00:00 2001 From: Robert Schulze Dieckhoff Date: Thu, 14 Sep 2023 10:03:57 +0200 Subject: [PATCH 2/4] Disabled ktlint for PlatformApi.kt because the class is generated code diff --git a/android/.editorconfig b/android/.editorconfig index c04ece5..911c5a6 100644 --- a/android/.editorconfig +++ b/android/.editorconfig @@ -106,7 +106,7 @@ ij_java_for_statement_wrap = off ij_java_generate_final_locals = false ij_java_generate_final_parameters = false ij_java_if_brace_force = never -ij_java_imports_layout = $android.**,$androidx.**,$com.**,$junit.**,$net.**,$org.**,$java.**,$javax.**,$*,|,android.**,|,androidx.**,|,com.**,|,junit.**,|,net.**,|,org.**,|,java.**,|,javax.**,|,*,| +ij_java_imports_layout = $android.**, $androidx.**, $com.**, $junit.**, $net.**, $org.**, $java.**, $javax.**, $*, |, android.**, |, androidx.**, |, com.**, |, junit.**, |, net.**, |, org.**, |, java.**, |, javax.**, |, *, | ij_java_indent_case_from_switch = true ij_java_insert_inner_class_imports = false ij_java_insert_override_annotation = true @@ -347,7 +347,7 @@ ij_groovy_for_statement_right_paren_on_new_line = false ij_groovy_for_statement_wrap = off ij_groovy_if_brace_force = never ij_groovy_import_annotation_wrap = 2 -ij_groovy_imports_layout = *,|,javax.**,java.**,|,$* +ij_groovy_imports_layout = *, |, javax.**, java.**, |, $* ij_groovy_indent_case_from_switch = true ij_groovy_indent_label_blocks = true ij_groovy_insert_inner_class_imports = false @@ -472,6 +472,7 @@ ij_groovy_wrap_long_lines = false # noinspection EditorConfigKeyCorrectness [{*.kt,*.kts}] +ktlint_code_style = ktlint_official ktlint_standard_import-ordering = disabled ktlint_standard_multiline-if-else = disabled ktlint_standard_trailing-comma-on-call-site = disabled @@ -511,7 +512,7 @@ ij_kotlin_field_annotation_wrap = split_into_lines ij_kotlin_finally_on_new_line = false ij_kotlin_if_rparen_on_new_line = true ij_kotlin_import_nested_classes = false -ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^ +ij_kotlin_imports_layout = *, java.**, javax.**, kotlin.**, ^ ij_kotlin_insert_whitespaces_in_simple_one_line_method = true ij_kotlin_keep_blank_lines_before_right_brace = 2 ij_kotlin_keep_blank_lines_in_code = 2 @@ -529,7 +530,7 @@ ij_kotlin_method_parameters_right_paren_on_new_line = true ij_kotlin_method_parameters_wrap = on_every_item ij_kotlin_name_count_to_use_star_import = 2147483647 ij_kotlin_name_count_to_use_star_import_for_members = 2147483647 -ij_kotlin_packages_to_use_import_on_demand = kotlinx.android.synthetic.**,io.ktor.** +ij_kotlin_packages_to_use_import_on_demand = kotlinx.android.synthetic.**, io.ktor.** ij_kotlin_parameter_annotation_wrap = off ij_kotlin_space_after_comma = true ij_kotlin_space_after_extend_colon = true @@ -574,22 +575,22 @@ ij_json_spaces_within_brackets = false ij_json_wrap_long_lines = false [{*.htm,*.html,*.sht,*.shtm,*.shtml}] -ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 +ij_html_add_new_line_before_tags = body, div, p, form, h1, h2, h3 ij_html_align_attributes = true ij_html_align_text = false ij_html_attribute_wrap = normal ij_html_block_comment_at_first_column = true ij_html_do_not_align_children_of_min_lines = 0 -ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p -ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot +ij_html_do_not_break_if_inline_tags = title, h1, h2, h3, h4, h5, h6, p +ij_html_do_not_indent_children_of_tags = html, body, thead, tbody, tfoot ij_html_enforce_quotes = false -ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var +ij_html_inline_tags = a, abbr, acronym, b, basefont, bdo, big, br, cite, cite, code, dfn, em, font, i, img, input, kbd, label, q, s, samp, select, small, span, strike, strong, sub, sup, textarea, tt, u, var ij_html_keep_blank_lines = 2 ij_html_keep_indents_on_empty_lines = false ij_html_keep_line_breaks = true ij_html_keep_line_breaks_in_text = true ij_html_keep_whitespaces = false -ij_html_keep_whitespaces_inside = span,pre,textarea +ij_html_keep_whitespaces_inside = span, pre, textarea ij_html_line_comment_at_first_column = true ij_html_new_line_after_last_attribute = never ij_html_new_line_before_first_attribute = never @@ -612,3 +613,7 @@ ij_yaml_sequence_on_new_line = false ij_yaml_space_before_colon = false ij_yaml_spaces_within_braces = true ij_yaml_spaces_within_brackets = true + + +[{PlatformApi.kt,PlatformApi.kts}] +ktlint_standard = disabled diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt index c2aa5cb..74e635d 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt @@ -21,7 +21,6 @@ import io.flutter.embedding.engine.plugins.FlutterPlugin import io.flutter.embedding.engine.plugins.activity.ActivityAware import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding import io.flutter.embedding.engine.plugins.lifecycle.HiddenLifecycleReference -import DropInResult as FlutterDropInResult /** AdyenCheckoutPlugin */ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { @@ -45,8 +44,9 @@ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { override fun onDetachedFromActivityForConfigChanges() = teardown() - override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) = - setupActivity(binding) + override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) = setupActivity( + binding + ) override fun onDetachedFromActivity() = teardown() @@ -70,10 +70,9 @@ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { Lifecycle.Event.ON_CREATE -> { checkoutPlatformApi?.dropInSessionLauncher = DropIn.registerForDropInResult(fragmentActivity, sessionDropInCallback()) - checkoutPlatformApi?.dropInAdvancedFlowLauncher = - DropIn.registerForDropInResult( - fragmentActivity, dropInAdvancedFlowCallback - ) + checkoutPlatformApi?.dropInAdvancedFlowLauncher = DropIn.registerForDropInResult( + fragmentActivity, dropInAdvancedFlowCallback + ) } else -> {} @@ -92,11 +91,13 @@ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { ) is SessionDropInResult.Error -> PaymentResult( - PaymentResultEnum.ERROR, reason = sessionDropInResult.reason + PaymentResultEnum.ERROR, + reason = sessionDropInResult.reason ) is SessionDropInResult.Finished -> PaymentResult( - PaymentResultEnum.FINISHED, result = with(sessionDropInResult.result) { + PaymentResultEnum.FINISHED, + result = with(sessionDropInResult.result) { PaymentResultModel( sessionId, sessionData, @@ -120,18 +121,22 @@ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { ) is DropInResult.Error -> PaymentResult( - PaymentResultEnum.ERROR, reason = dropInAdvancedFlowResult.reason + PaymentResultEnum.ERROR, + reason = dropInAdvancedFlowResult.reason ) is DropInResult.Finished -> PaymentResult( - PaymentResultEnum.FINISHED, result = PaymentResultModel( + PaymentResultEnum.FINISHED, + result = PaymentResultModel( resultCode = dropInAdvancedFlowResult.result ) ) } val model = PlatformCommunicationModel( - PlatformCommunicationType.RESULT, data = "", paymentResult = mappedResult + PlatformCommunicationType.RESULT, + data = "", + paymentResult = mappedResult ) checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} } diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt index eddc4c9..bd858f6 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt @@ -35,136 +35,139 @@ import org.json.JSONObject @Suppress("NAME_SHADOWING") class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : CheckoutPlatformInterface { - lateinit var activity: FragmentActivity - lateinit var dropInSessionLauncher: ActivityResultLauncher - lateinit var dropInAdvancedFlowLauncher: ActivityResultLauncher + lateinit var activity: FragmentActivity + lateinit var dropInSessionLauncher: + ActivityResultLauncher + lateinit var dropInAdvancedFlowLauncher: ActivityResultLauncher - override fun getPlatformVersion(callback: (Result) -> Unit) { - callback.invoke(Result.success("Android ${android.os.Build.VERSION.RELEASE}")) - } + override fun getPlatformVersion(callback: (Result) -> Unit) { + callback.invoke(Result.success("Android ${android.os.Build.VERSION.RELEASE}")) + } - override fun getReturnUrl(callback: (Result) -> Unit) { - callback(Result.success(RedirectComponent.getReturnUrl(activity.applicationContext))) - } + override fun getReturnUrl(callback: (Result) -> Unit) { + callback(Result.success(RedirectComponent.getReturnUrl(activity.applicationContext))) + } - override fun startDropInSessionPayment( - dropInConfiguration: DropInConfiguration, - session: Session, - ) { - checkForFlutterFragmentActivity() - activity.lifecycleScope.launch(Dispatchers.IO) { - val sessionModel = session.mapToSession() - val dropInConfiguration = - dropInConfiguration.mapToDropInConfiguration(activity.applicationContext) - val checkoutSession = createCheckoutSession(sessionModel, dropInConfiguration) - withContext(Dispatchers.Main) { - DropIn.startPayment( - activity.applicationContext, - dropInSessionLauncher, - checkoutSession, - dropInConfiguration, - ) + override fun startDropInSessionPayment( + dropInConfiguration: DropInConfiguration, + session: Session, + ) { + checkForFlutterFragmentActivity() + activity.lifecycleScope.launch(Dispatchers.IO) { + val sessionModel = session.mapToSession() + val dropInConfiguration = + dropInConfiguration.mapToDropInConfiguration(activity.applicationContext) + val checkoutSession = createCheckoutSession(sessionModel, dropInConfiguration) + withContext(Dispatchers.Main) { + DropIn.startPayment( + activity.applicationContext, + dropInSessionLauncher, + checkoutSession, + dropInConfiguration, + ) + } } } - } - override fun startDropInAdvancedFlowPayment( - dropInConfiguration: DropInConfiguration, - paymentMethodsResponse: String, - ) { - checkForFlutterFragmentActivity() - setAdvancedFlowDropInServiceObserver() - activity.lifecycleScope.launch(Dispatchers.IO) { - val paymentMethodsApiResponse = PaymentMethodsApiResponse.SERIALIZER.deserialize( - JSONObject(paymentMethodsResponse), - ) - val paymentMethodsWithoutGiftCards = - removeGiftCardPaymentMethods(paymentMethodsApiResponse) - val dropInConfiguration = - dropInConfiguration.mapToDropInConfiguration(activity.applicationContext) - withContext(Dispatchers.Main) { - DropIn.startPayment( - activity.applicationContext, - dropInAdvancedFlowLauncher, - paymentMethodsWithoutGiftCards, - dropInConfiguration, - AdvancedFlowDropInService::class.java, + override fun startDropInAdvancedFlowPayment( + dropInConfiguration: DropInConfiguration, + paymentMethodsResponse: String, + ) { + checkForFlutterFragmentActivity() + setAdvancedFlowDropInServiceObserver() + activity.lifecycleScope.launch(Dispatchers.IO) { + val paymentMethodsApiResponse = PaymentMethodsApiResponse.SERIALIZER.deserialize( + JSONObject(paymentMethodsResponse), ) + val paymentMethodsWithoutGiftCards = + removeGiftCardPaymentMethods(paymentMethodsApiResponse) + val dropInConfiguration = + dropInConfiguration.mapToDropInConfiguration(activity.applicationContext) + withContext(Dispatchers.Main) { + DropIn.startPayment( + activity.applicationContext, + dropInAdvancedFlowLauncher, + paymentMethodsWithoutGiftCards, + dropInConfiguration, + AdvancedFlowDropInService::class.java, + ) + } } } - } - override fun onPaymentsResult(paymentsResult: DropInResult) { - if (paymentsResult.dropInResultType == DropInResultType.ACTION) { - setAdvanceFlowDropInAdditionalDetailsMessengerObserver() - } - - DropInPaymentResultMessenger.sendResult(paymentsResult) - } + override fun onPaymentsResult(paymentsResult: DropInResult) { + if (paymentsResult.dropInResultType == DropInResultType.ACTION) { + setAdvanceFlowDropInAdditionalDetailsMessengerObserver() + } - override fun onPaymentsDetailsResult(paymentsDetailsResult: DropInResult) { - DropInAdditionalDetailsResultMessenger.sendResult(paymentsDetailsResult) - } + DropInPaymentResultMessenger.sendResult(paymentsResult) + } - private suspend fun createCheckoutSession( - sessionModel: com.adyen.checkout.sessions.core.SessionModel, - dropInConfiguration: com.adyen.checkout.dropin.DropInConfiguration, - ): CheckoutSession { - val checkoutSessionResult = - CheckoutSessionProvider.createSession(sessionModel, dropInConfiguration) - return when (checkoutSessionResult) { - is CheckoutSessionResult.Success -> checkoutSessionResult.checkoutSession - is CheckoutSessionResult.Error -> throw checkoutSessionResult.exception + override fun onPaymentsDetailsResult(paymentsDetailsResult: DropInResult) { + DropInAdditionalDetailsResultMessenger.sendResult(paymentsDetailsResult) } - } - private fun setAdvancedFlowDropInServiceObserver() { - DropInServiceResultMessenger.instance().removeObservers(activity) - DropInServiceResultMessenger.instance().observe(activity) { message -> - if (message.hasBeenHandled()) { - return@observe + private suspend fun createCheckoutSession( + sessionModel: com.adyen.checkout.sessions.core.SessionModel, + dropInConfiguration: com.adyen.checkout.dropin.DropInConfiguration, + ): CheckoutSession { + val checkoutSessionResult = + CheckoutSessionProvider.createSession(sessionModel, dropInConfiguration) + return when (checkoutSessionResult) { + is CheckoutSessionResult.Success -> checkoutSessionResult.checkoutSession + is CheckoutSessionResult.Error -> throw checkoutSessionResult.exception } - - val model = PlatformCommunicationModel( - PlatformCommunicationType.PAYMENTCOMPONENT, - data = message.contentIfNotHandled.toString(), - ) - checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} } - } - private fun setAdvanceFlowDropInAdditionalDetailsMessengerObserver() { - DropInAdditionalDetailsPlatformMessenger.instance().removeObservers(activity) - DropInAdditionalDetailsPlatformMessenger.instance().observe(activity) { message -> - if (message.hasBeenHandled()) { - return@observe + private fun setAdvancedFlowDropInServiceObserver() { + DropInServiceResultMessenger.instance().removeObservers(activity) + DropInServiceResultMessenger.instance().observe(activity) { message -> + if (message.hasBeenHandled()) { + return@observe + } + + val model = PlatformCommunicationModel( + PlatformCommunicationType.PAYMENTCOMPONENT, + data = message.contentIfNotHandled.toString(), + ) + checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} } + } - val model = PlatformCommunicationModel( - PlatformCommunicationType.ADDITIONALDETAILS, - data = message.contentIfNotHandled.toString(), - ) - checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} + private fun setAdvanceFlowDropInAdditionalDetailsMessengerObserver() { + DropInAdditionalDetailsPlatformMessenger.instance().removeObservers(activity) + DropInAdditionalDetailsPlatformMessenger.instance().observe(activity) { message -> + if (message.hasBeenHandled()) { + return@observe + } + + val model = PlatformCommunicationModel( + PlatformCommunicationType.ADDITIONALDETAILS, + data = message.contentIfNotHandled.toString(), + ) + checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} + } } - } - private fun checkForFlutterFragmentActivity() { - if (!this::activity.isInitialized) { - throw Exception(WRONG_FLUTTER_ACTIVITY_USAGE_ERROR_MESSAGE) + private fun checkForFlutterFragmentActivity() { + if (!this::activity.isInitialized) { + throw Exception(WRONG_FLUTTER_ACTIVITY_USAGE_ERROR_MESSAGE) + } } - } - //Gift cards will be supported in a later version - private fun removeGiftCardPaymentMethods(paymentMethodsResponse: PaymentMethodsApiResponse): PaymentMethodsApiResponse { - val giftCardTypeIdentifier = "giftcard" - val storedPaymentMethods = - paymentMethodsResponse.storedPaymentMethods?.filterNot { it.type == giftCardTypeIdentifier } - val paymentMethods = - paymentMethodsResponse.paymentMethods?.filterNot { it.type == giftCardTypeIdentifier } - - return PaymentMethodsApiResponse( - storedPaymentMethods = storedPaymentMethods, - paymentMethods = paymentMethods - ) + // Gift cards will be supported in a later version + private fun removeGiftCardPaymentMethods( + paymentMethodsResponse: PaymentMethodsApiResponse + ): PaymentMethodsApiResponse { + val giftCardTypeIdentifier = "giftcard" + val storedPaymentMethods = + paymentMethodsResponse.storedPaymentMethods?.filterNot { it.type == giftCardTypeIdentifier } + val paymentMethods = + paymentMethodsResponse.paymentMethods?.filterNot { it.type == giftCardTypeIdentifier } + + return PaymentMethodsApiResponse( + storedPaymentMethods = storedPaymentMethods, + paymentMethods = paymentMethods + ) + } } -} diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/PlatformApi.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/PlatformApi.kt index 5b0559c..2957598 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/PlatformApi.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/PlatformApi.kt @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// Autogenerated from Pigeon (v11.0.1), do not edit directly. // See also: https://pub.dev/packages/pigeon diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt index 5362117..cccafb2 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt @@ -1,8 +1,7 @@ package com.adyen.adyen_checkout.dropInAdvancedFlow - import DropInResult -import DropInResultType.* +import DropInResultType import android.content.Intent import android.os.IBinder import androidx.lifecycle.Lifecycle @@ -83,15 +82,17 @@ class AdvancedFlowDropInService : DropInService(), LifecycleOwner { private fun mapToDropInResult(dropInResult: DropInResult?): DropInServiceResult { return when (dropInResult?.dropInResultType) { - FINISHED -> DropInServiceResult.Finished(result = "${dropInResult.result}") + DropInResultType.FINISHED -> DropInServiceResult.Finished( + result = "${dropInResult.result}" + ) - ERROR -> DropInServiceResult.Error( + DropInResultType.ERROR -> DropInServiceResult.Error( errorDialog = null, reason = dropInResult.error?.reason, dismissDropIn = dropInResult.error?.dismissDropIn ?: false ) - ACTION -> { + DropInResultType.ACTION -> { if (dropInResult.actionResponse == null) { DropInServiceResult.Error( errorDialog = null, @@ -141,4 +142,3 @@ class AdvancedFlowDropInService : DropInService(), LifecycleOwner { override val lifecycle: Lifecycle get() = dispatcher.lifecycle } - diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Constants.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Constants.kt index b85cefb..d4cbe2c 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Constants.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Constants.kt @@ -5,4 +5,4 @@ class Constants { const val WRONG_FLUTTER_ACTIVITY_USAGE_ERROR_MESSAGE = "FlutterFragmentActivity not used. Your activity needs to inherit from FlutterFragmentActivity." } -} \ No newline at end of file +} diff --git a/ios/Classes/PlatformApi.swift b/ios/Classes/PlatformApi.swift index 33a473e..0cace8a 100644 --- a/ios/Classes/PlatformApi.swift +++ b/ios/Classes/PlatformApi.swift @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// Autogenerated from Pigeon (v11.0.1), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation diff --git a/lib/platform_api.g.dart b/lib/platform_api.g.dart index 6980e9a..5512b87 100644 --- a/lib/platform_api.g.dart +++ b/lib/platform_api.g.dart @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// Autogenerated from Pigeon (v11.0.1), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import --- android/.editorconfig | 23 +- .../adyen_checkout/AdyenCheckoutPlugin.kt | 29 ++- .../adyen_checkout/CheckoutPlatformApi.kt | 221 +++++++++--------- .../com/adyen/adyen_checkout/PlatformApi.kt | 2 +- .../AdvancedFlowDropInService.kt | 12 +- .../adyen/adyen_checkout/utils/Constants.kt | 2 +- ios/Classes/PlatformApi.swift | 2 +- lib/platform_api.g.dart | 2 +- 8 files changed, 153 insertions(+), 140 deletions(-) diff --git a/android/.editorconfig b/android/.editorconfig index c04ece5d..911c5a67 100644 --- a/android/.editorconfig +++ b/android/.editorconfig @@ -106,7 +106,7 @@ ij_java_for_statement_wrap = off ij_java_generate_final_locals = false ij_java_generate_final_parameters = false ij_java_if_brace_force = never -ij_java_imports_layout = $android.**,$androidx.**,$com.**,$junit.**,$net.**,$org.**,$java.**,$javax.**,$*,|,android.**,|,androidx.**,|,com.**,|,junit.**,|,net.**,|,org.**,|,java.**,|,javax.**,|,*,| +ij_java_imports_layout = $android.**, $androidx.**, $com.**, $junit.**, $net.**, $org.**, $java.**, $javax.**, $*, |, android.**, |, androidx.**, |, com.**, |, junit.**, |, net.**, |, org.**, |, java.**, |, javax.**, |, *, | ij_java_indent_case_from_switch = true ij_java_insert_inner_class_imports = false ij_java_insert_override_annotation = true @@ -347,7 +347,7 @@ ij_groovy_for_statement_right_paren_on_new_line = false ij_groovy_for_statement_wrap = off ij_groovy_if_brace_force = never ij_groovy_import_annotation_wrap = 2 -ij_groovy_imports_layout = *,|,javax.**,java.**,|,$* +ij_groovy_imports_layout = *, |, javax.**, java.**, |, $* ij_groovy_indent_case_from_switch = true ij_groovy_indent_label_blocks = true ij_groovy_insert_inner_class_imports = false @@ -472,6 +472,7 @@ ij_groovy_wrap_long_lines = false # noinspection EditorConfigKeyCorrectness [{*.kt,*.kts}] +ktlint_code_style = ktlint_official ktlint_standard_import-ordering = disabled ktlint_standard_multiline-if-else = disabled ktlint_standard_trailing-comma-on-call-site = disabled @@ -511,7 +512,7 @@ ij_kotlin_field_annotation_wrap = split_into_lines ij_kotlin_finally_on_new_line = false ij_kotlin_if_rparen_on_new_line = true ij_kotlin_import_nested_classes = false -ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^ +ij_kotlin_imports_layout = *, java.**, javax.**, kotlin.**, ^ ij_kotlin_insert_whitespaces_in_simple_one_line_method = true ij_kotlin_keep_blank_lines_before_right_brace = 2 ij_kotlin_keep_blank_lines_in_code = 2 @@ -529,7 +530,7 @@ ij_kotlin_method_parameters_right_paren_on_new_line = true ij_kotlin_method_parameters_wrap = on_every_item ij_kotlin_name_count_to_use_star_import = 2147483647 ij_kotlin_name_count_to_use_star_import_for_members = 2147483647 -ij_kotlin_packages_to_use_import_on_demand = kotlinx.android.synthetic.**,io.ktor.** +ij_kotlin_packages_to_use_import_on_demand = kotlinx.android.synthetic.**, io.ktor.** ij_kotlin_parameter_annotation_wrap = off ij_kotlin_space_after_comma = true ij_kotlin_space_after_extend_colon = true @@ -574,22 +575,22 @@ ij_json_spaces_within_brackets = false ij_json_wrap_long_lines = false [{*.htm,*.html,*.sht,*.shtm,*.shtml}] -ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 +ij_html_add_new_line_before_tags = body, div, p, form, h1, h2, h3 ij_html_align_attributes = true ij_html_align_text = false ij_html_attribute_wrap = normal ij_html_block_comment_at_first_column = true ij_html_do_not_align_children_of_min_lines = 0 -ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p -ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot +ij_html_do_not_break_if_inline_tags = title, h1, h2, h3, h4, h5, h6, p +ij_html_do_not_indent_children_of_tags = html, body, thead, tbody, tfoot ij_html_enforce_quotes = false -ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var +ij_html_inline_tags = a, abbr, acronym, b, basefont, bdo, big, br, cite, cite, code, dfn, em, font, i, img, input, kbd, label, q, s, samp, select, small, span, strike, strong, sub, sup, textarea, tt, u, var ij_html_keep_blank_lines = 2 ij_html_keep_indents_on_empty_lines = false ij_html_keep_line_breaks = true ij_html_keep_line_breaks_in_text = true ij_html_keep_whitespaces = false -ij_html_keep_whitespaces_inside = span,pre,textarea +ij_html_keep_whitespaces_inside = span, pre, textarea ij_html_line_comment_at_first_column = true ij_html_new_line_after_last_attribute = never ij_html_new_line_before_first_attribute = never @@ -612,3 +613,7 @@ ij_yaml_sequence_on_new_line = false ij_yaml_space_before_colon = false ij_yaml_spaces_within_braces = true ij_yaml_spaces_within_brackets = true + + +[{PlatformApi.kt,PlatformApi.kts}] +ktlint_standard = disabled diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt index c2aa5cbb..74e635dc 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt @@ -21,7 +21,6 @@ import io.flutter.embedding.engine.plugins.FlutterPlugin import io.flutter.embedding.engine.plugins.activity.ActivityAware import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding import io.flutter.embedding.engine.plugins.lifecycle.HiddenLifecycleReference -import DropInResult as FlutterDropInResult /** AdyenCheckoutPlugin */ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { @@ -45,8 +44,9 @@ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { override fun onDetachedFromActivityForConfigChanges() = teardown() - override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) = - setupActivity(binding) + override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) = setupActivity( + binding + ) override fun onDetachedFromActivity() = teardown() @@ -70,10 +70,9 @@ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { Lifecycle.Event.ON_CREATE -> { checkoutPlatformApi?.dropInSessionLauncher = DropIn.registerForDropInResult(fragmentActivity, sessionDropInCallback()) - checkoutPlatformApi?.dropInAdvancedFlowLauncher = - DropIn.registerForDropInResult( - fragmentActivity, dropInAdvancedFlowCallback - ) + checkoutPlatformApi?.dropInAdvancedFlowLauncher = DropIn.registerForDropInResult( + fragmentActivity, dropInAdvancedFlowCallback + ) } else -> {} @@ -92,11 +91,13 @@ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { ) is SessionDropInResult.Error -> PaymentResult( - PaymentResultEnum.ERROR, reason = sessionDropInResult.reason + PaymentResultEnum.ERROR, + reason = sessionDropInResult.reason ) is SessionDropInResult.Finished -> PaymentResult( - PaymentResultEnum.FINISHED, result = with(sessionDropInResult.result) { + PaymentResultEnum.FINISHED, + result = with(sessionDropInResult.result) { PaymentResultModel( sessionId, sessionData, @@ -120,18 +121,22 @@ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { ) is DropInResult.Error -> PaymentResult( - PaymentResultEnum.ERROR, reason = dropInAdvancedFlowResult.reason + PaymentResultEnum.ERROR, + reason = dropInAdvancedFlowResult.reason ) is DropInResult.Finished -> PaymentResult( - PaymentResultEnum.FINISHED, result = PaymentResultModel( + PaymentResultEnum.FINISHED, + result = PaymentResultModel( resultCode = dropInAdvancedFlowResult.result ) ) } val model = PlatformCommunicationModel( - PlatformCommunicationType.RESULT, data = "", paymentResult = mappedResult + PlatformCommunicationType.RESULT, + data = "", + paymentResult = mappedResult ) checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} } diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt index eddc4c9d..bd858f67 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt @@ -35,136 +35,139 @@ import org.json.JSONObject @Suppress("NAME_SHADOWING") class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : CheckoutPlatformInterface { - lateinit var activity: FragmentActivity - lateinit var dropInSessionLauncher: ActivityResultLauncher - lateinit var dropInAdvancedFlowLauncher: ActivityResultLauncher + lateinit var activity: FragmentActivity + lateinit var dropInSessionLauncher: + ActivityResultLauncher + lateinit var dropInAdvancedFlowLauncher: ActivityResultLauncher - override fun getPlatformVersion(callback: (Result) -> Unit) { - callback.invoke(Result.success("Android ${android.os.Build.VERSION.RELEASE}")) - } + override fun getPlatformVersion(callback: (Result) -> Unit) { + callback.invoke(Result.success("Android ${android.os.Build.VERSION.RELEASE}")) + } - override fun getReturnUrl(callback: (Result) -> Unit) { - callback(Result.success(RedirectComponent.getReturnUrl(activity.applicationContext))) - } + override fun getReturnUrl(callback: (Result) -> Unit) { + callback(Result.success(RedirectComponent.getReturnUrl(activity.applicationContext))) + } - override fun startDropInSessionPayment( - dropInConfiguration: DropInConfiguration, - session: Session, - ) { - checkForFlutterFragmentActivity() - activity.lifecycleScope.launch(Dispatchers.IO) { - val sessionModel = session.mapToSession() - val dropInConfiguration = - dropInConfiguration.mapToDropInConfiguration(activity.applicationContext) - val checkoutSession = createCheckoutSession(sessionModel, dropInConfiguration) - withContext(Dispatchers.Main) { - DropIn.startPayment( - activity.applicationContext, - dropInSessionLauncher, - checkoutSession, - dropInConfiguration, - ) + override fun startDropInSessionPayment( + dropInConfiguration: DropInConfiguration, + session: Session, + ) { + checkForFlutterFragmentActivity() + activity.lifecycleScope.launch(Dispatchers.IO) { + val sessionModel = session.mapToSession() + val dropInConfiguration = + dropInConfiguration.mapToDropInConfiguration(activity.applicationContext) + val checkoutSession = createCheckoutSession(sessionModel, dropInConfiguration) + withContext(Dispatchers.Main) { + DropIn.startPayment( + activity.applicationContext, + dropInSessionLauncher, + checkoutSession, + dropInConfiguration, + ) + } } } - } - override fun startDropInAdvancedFlowPayment( - dropInConfiguration: DropInConfiguration, - paymentMethodsResponse: String, - ) { - checkForFlutterFragmentActivity() - setAdvancedFlowDropInServiceObserver() - activity.lifecycleScope.launch(Dispatchers.IO) { - val paymentMethodsApiResponse = PaymentMethodsApiResponse.SERIALIZER.deserialize( - JSONObject(paymentMethodsResponse), - ) - val paymentMethodsWithoutGiftCards = - removeGiftCardPaymentMethods(paymentMethodsApiResponse) - val dropInConfiguration = - dropInConfiguration.mapToDropInConfiguration(activity.applicationContext) - withContext(Dispatchers.Main) { - DropIn.startPayment( - activity.applicationContext, - dropInAdvancedFlowLauncher, - paymentMethodsWithoutGiftCards, - dropInConfiguration, - AdvancedFlowDropInService::class.java, + override fun startDropInAdvancedFlowPayment( + dropInConfiguration: DropInConfiguration, + paymentMethodsResponse: String, + ) { + checkForFlutterFragmentActivity() + setAdvancedFlowDropInServiceObserver() + activity.lifecycleScope.launch(Dispatchers.IO) { + val paymentMethodsApiResponse = PaymentMethodsApiResponse.SERIALIZER.deserialize( + JSONObject(paymentMethodsResponse), ) + val paymentMethodsWithoutGiftCards = + removeGiftCardPaymentMethods(paymentMethodsApiResponse) + val dropInConfiguration = + dropInConfiguration.mapToDropInConfiguration(activity.applicationContext) + withContext(Dispatchers.Main) { + DropIn.startPayment( + activity.applicationContext, + dropInAdvancedFlowLauncher, + paymentMethodsWithoutGiftCards, + dropInConfiguration, + AdvancedFlowDropInService::class.java, + ) + } } } - } - override fun onPaymentsResult(paymentsResult: DropInResult) { - if (paymentsResult.dropInResultType == DropInResultType.ACTION) { - setAdvanceFlowDropInAdditionalDetailsMessengerObserver() - } - - DropInPaymentResultMessenger.sendResult(paymentsResult) - } + override fun onPaymentsResult(paymentsResult: DropInResult) { + if (paymentsResult.dropInResultType == DropInResultType.ACTION) { + setAdvanceFlowDropInAdditionalDetailsMessengerObserver() + } - override fun onPaymentsDetailsResult(paymentsDetailsResult: DropInResult) { - DropInAdditionalDetailsResultMessenger.sendResult(paymentsDetailsResult) - } + DropInPaymentResultMessenger.sendResult(paymentsResult) + } - private suspend fun createCheckoutSession( - sessionModel: com.adyen.checkout.sessions.core.SessionModel, - dropInConfiguration: com.adyen.checkout.dropin.DropInConfiguration, - ): CheckoutSession { - val checkoutSessionResult = - CheckoutSessionProvider.createSession(sessionModel, dropInConfiguration) - return when (checkoutSessionResult) { - is CheckoutSessionResult.Success -> checkoutSessionResult.checkoutSession - is CheckoutSessionResult.Error -> throw checkoutSessionResult.exception + override fun onPaymentsDetailsResult(paymentsDetailsResult: DropInResult) { + DropInAdditionalDetailsResultMessenger.sendResult(paymentsDetailsResult) } - } - private fun setAdvancedFlowDropInServiceObserver() { - DropInServiceResultMessenger.instance().removeObservers(activity) - DropInServiceResultMessenger.instance().observe(activity) { message -> - if (message.hasBeenHandled()) { - return@observe + private suspend fun createCheckoutSession( + sessionModel: com.adyen.checkout.sessions.core.SessionModel, + dropInConfiguration: com.adyen.checkout.dropin.DropInConfiguration, + ): CheckoutSession { + val checkoutSessionResult = + CheckoutSessionProvider.createSession(sessionModel, dropInConfiguration) + return when (checkoutSessionResult) { + is CheckoutSessionResult.Success -> checkoutSessionResult.checkoutSession + is CheckoutSessionResult.Error -> throw checkoutSessionResult.exception } - - val model = PlatformCommunicationModel( - PlatformCommunicationType.PAYMENTCOMPONENT, - data = message.contentIfNotHandled.toString(), - ) - checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} } - } - private fun setAdvanceFlowDropInAdditionalDetailsMessengerObserver() { - DropInAdditionalDetailsPlatformMessenger.instance().removeObservers(activity) - DropInAdditionalDetailsPlatformMessenger.instance().observe(activity) { message -> - if (message.hasBeenHandled()) { - return@observe + private fun setAdvancedFlowDropInServiceObserver() { + DropInServiceResultMessenger.instance().removeObservers(activity) + DropInServiceResultMessenger.instance().observe(activity) { message -> + if (message.hasBeenHandled()) { + return@observe + } + + val model = PlatformCommunicationModel( + PlatformCommunicationType.PAYMENTCOMPONENT, + data = message.contentIfNotHandled.toString(), + ) + checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} } + } - val model = PlatformCommunicationModel( - PlatformCommunicationType.ADDITIONALDETAILS, - data = message.contentIfNotHandled.toString(), - ) - checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} + private fun setAdvanceFlowDropInAdditionalDetailsMessengerObserver() { + DropInAdditionalDetailsPlatformMessenger.instance().removeObservers(activity) + DropInAdditionalDetailsPlatformMessenger.instance().observe(activity) { message -> + if (message.hasBeenHandled()) { + return@observe + } + + val model = PlatformCommunicationModel( + PlatformCommunicationType.ADDITIONALDETAILS, + data = message.contentIfNotHandled.toString(), + ) + checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} + } } - } - private fun checkForFlutterFragmentActivity() { - if (!this::activity.isInitialized) { - throw Exception(WRONG_FLUTTER_ACTIVITY_USAGE_ERROR_MESSAGE) + private fun checkForFlutterFragmentActivity() { + if (!this::activity.isInitialized) { + throw Exception(WRONG_FLUTTER_ACTIVITY_USAGE_ERROR_MESSAGE) + } } - } - //Gift cards will be supported in a later version - private fun removeGiftCardPaymentMethods(paymentMethodsResponse: PaymentMethodsApiResponse): PaymentMethodsApiResponse { - val giftCardTypeIdentifier = "giftcard" - val storedPaymentMethods = - paymentMethodsResponse.storedPaymentMethods?.filterNot { it.type == giftCardTypeIdentifier } - val paymentMethods = - paymentMethodsResponse.paymentMethods?.filterNot { it.type == giftCardTypeIdentifier } - - return PaymentMethodsApiResponse( - storedPaymentMethods = storedPaymentMethods, - paymentMethods = paymentMethods - ) + // Gift cards will be supported in a later version + private fun removeGiftCardPaymentMethods( + paymentMethodsResponse: PaymentMethodsApiResponse + ): PaymentMethodsApiResponse { + val giftCardTypeIdentifier = "giftcard" + val storedPaymentMethods = + paymentMethodsResponse.storedPaymentMethods?.filterNot { it.type == giftCardTypeIdentifier } + val paymentMethods = + paymentMethodsResponse.paymentMethods?.filterNot { it.type == giftCardTypeIdentifier } + + return PaymentMethodsApiResponse( + storedPaymentMethods = storedPaymentMethods, + paymentMethods = paymentMethods + ) + } } -} diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/PlatformApi.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/PlatformApi.kt index 5b0559ca..29575987 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/PlatformApi.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/PlatformApi.kt @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// Autogenerated from Pigeon (v11.0.1), do not edit directly. // See also: https://pub.dev/packages/pigeon diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt index 5362117b..cccafb20 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt @@ -1,8 +1,7 @@ package com.adyen.adyen_checkout.dropInAdvancedFlow - import DropInResult -import DropInResultType.* +import DropInResultType import android.content.Intent import android.os.IBinder import androidx.lifecycle.Lifecycle @@ -83,15 +82,17 @@ class AdvancedFlowDropInService : DropInService(), LifecycleOwner { private fun mapToDropInResult(dropInResult: DropInResult?): DropInServiceResult { return when (dropInResult?.dropInResultType) { - FINISHED -> DropInServiceResult.Finished(result = "${dropInResult.result}") + DropInResultType.FINISHED -> DropInServiceResult.Finished( + result = "${dropInResult.result}" + ) - ERROR -> DropInServiceResult.Error( + DropInResultType.ERROR -> DropInServiceResult.Error( errorDialog = null, reason = dropInResult.error?.reason, dismissDropIn = dropInResult.error?.dismissDropIn ?: false ) - ACTION -> { + DropInResultType.ACTION -> { if (dropInResult.actionResponse == null) { DropInServiceResult.Error( errorDialog = null, @@ -141,4 +142,3 @@ class AdvancedFlowDropInService : DropInService(), LifecycleOwner { override val lifecycle: Lifecycle get() = dispatcher.lifecycle } - diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Constants.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Constants.kt index b85cefb9..d4cbe2c7 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Constants.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Constants.kt @@ -5,4 +5,4 @@ class Constants { const val WRONG_FLUTTER_ACTIVITY_USAGE_ERROR_MESSAGE = "FlutterFragmentActivity not used. Your activity needs to inherit from FlutterFragmentActivity." } -} \ No newline at end of file +} diff --git a/ios/Classes/PlatformApi.swift b/ios/Classes/PlatformApi.swift index 33a473e7..0cace8ae 100644 --- a/ios/Classes/PlatformApi.swift +++ b/ios/Classes/PlatformApi.swift @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// Autogenerated from Pigeon (v11.0.1), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation diff --git a/lib/platform_api.g.dart b/lib/platform_api.g.dart index 6980e9ac..5512b870 100644 --- a/lib/platform_api.g.dart +++ b/lib/platform_api.g.dart @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// Autogenerated from Pigeon (v11.0.1), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import From 1fbc9f764642c60e4ff5457aad4a737e0a3218c7 Mon Sep 17 00:00:00 2001 From: Robert Schulze Dieckhoff Date: Mon, 4 Sep 2023 14:09:53 +0200 Subject: [PATCH 3/4] Added ktlint diff --git a/android/.editorconfig b/android/.editorconfig new file mode 100644 index 0000000..c04ece5 --- /dev/null +++ b/android/.editorconfig @@ -0,0 +1,614 @@ +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +max_line_length = 100 +tab_width = 4 +ij_continuation_indent_size = 4 +ij_formatter_off_tag = @formatter:off +ij_formatter_on_tag = @formatter:on +ij_formatter_tags_enabled = false +ij_smart_tabs = false +ij_visual_guides = none +ij_wrap_on_typing = false + +[*.java] +max_line_length = 120 +ij_java_align_consecutive_assignments = false +ij_java_align_consecutive_variable_declarations = false +ij_java_align_group_field_declarations = false +ij_java_align_multiline_annotation_parameters = false +ij_java_align_multiline_array_initializer_expression = false +ij_java_align_multiline_assignment = false +ij_java_align_multiline_binary_operation = false +ij_java_align_multiline_chained_methods = false +ij_java_align_multiline_extends_list = false +ij_java_align_multiline_for = true +ij_java_align_multiline_method_parentheses = false +ij_java_align_multiline_parameters = true +ij_java_align_multiline_parameters_in_calls = false +ij_java_align_multiline_parenthesized_expression = false +ij_java_align_multiline_records = true +ij_java_align_multiline_resources = true +ij_java_align_multiline_ternary_operation = false +ij_java_align_multiline_text_blocks = false +ij_java_align_multiline_throws_list = false +ij_java_align_subsequent_simple_methods = false +ij_java_align_throws_keyword = false +ij_java_annotation_parameter_wrap = off +ij_java_array_initializer_new_line_after_left_brace = false +ij_java_array_initializer_right_brace_on_new_line = false +ij_java_array_initializer_wrap = off +ij_java_assert_statement_colon_on_next_line = false +ij_java_assert_statement_wrap = off +ij_java_assignment_wrap = off +ij_java_binary_operation_sign_on_next_line = false +ij_java_binary_operation_wrap = off +ij_java_blank_lines_after_anonymous_class_header = 0 +ij_java_blank_lines_after_class_header = 0 +ij_java_blank_lines_after_imports = 1 +ij_java_blank_lines_after_package = 1 +ij_java_blank_lines_around_class = 1 +ij_java_blank_lines_around_field = 0 +ij_java_blank_lines_around_field_in_interface = 0 +ij_java_blank_lines_around_initializer = 1 +ij_java_blank_lines_around_method = 1 +ij_java_blank_lines_around_method_in_interface = 1 +ij_java_blank_lines_before_class_end = 0 +ij_java_blank_lines_before_imports = 1 +ij_java_blank_lines_before_method_body = 0 +ij_java_blank_lines_before_package = 0 +ij_java_block_brace_style = end_of_line +ij_java_block_comment_at_first_column = true +ij_java_builder_methods = none +ij_java_call_parameters_new_line_after_left_paren = false +ij_java_call_parameters_right_paren_on_new_line = false +ij_java_call_parameters_wrap = off +ij_java_case_statement_on_separate_line = true +ij_java_catch_on_new_line = false +ij_java_class_annotation_wrap = split_into_lines +ij_java_class_brace_style = end_of_line +ij_java_class_count_to_use_import_on_demand = 99 +ij_java_class_names_in_javadoc = 1 +ij_java_do_not_indent_top_level_class_members = false +ij_java_do_not_wrap_after_single_annotation = false +ij_java_do_while_brace_force = never +ij_java_doc_add_blank_line_after_description = true +ij_java_doc_add_blank_line_after_param_comments = false +ij_java_doc_add_blank_line_after_return = false +ij_java_doc_add_p_tag_on_empty_lines = true +ij_java_doc_align_exception_comments = true +ij_java_doc_align_param_comments = true +ij_java_doc_do_not_wrap_if_one_line = false +ij_java_doc_enable_formatting = true +ij_java_doc_enable_leading_asterisks = true +ij_java_doc_indent_on_continuation = false +ij_java_doc_keep_empty_lines = true +ij_java_doc_keep_empty_parameter_tag = true +ij_java_doc_keep_empty_return_tag = true +ij_java_doc_keep_empty_throws_tag = true +ij_java_doc_keep_invalid_tags = true +ij_java_doc_param_description_on_new_line = false +ij_java_doc_preserve_line_breaks = false +ij_java_doc_use_throws_not_exception_tag = true +ij_java_else_on_new_line = false +ij_java_enum_constants_wrap = off +ij_java_extends_keyword_wrap = off +ij_java_extends_list_wrap = off +ij_java_field_annotation_wrap = split_into_lines +ij_java_finally_on_new_line = false +ij_java_for_brace_force = never +ij_java_for_statement_new_line_after_left_paren = false +ij_java_for_statement_right_paren_on_new_line = false +ij_java_for_statement_wrap = off +ij_java_generate_final_locals = false +ij_java_generate_final_parameters = false +ij_java_if_brace_force = never +ij_java_imports_layout = $android.**,$androidx.**,$com.**,$junit.**,$net.**,$org.**,$java.**,$javax.**,$*,|,android.**,|,androidx.**,|,com.**,|,junit.**,|,net.**,|,org.**,|,java.**,|,javax.**,|,*,| +ij_java_indent_case_from_switch = true +ij_java_insert_inner_class_imports = false +ij_java_insert_override_annotation = true +ij_java_keep_blank_lines_before_right_brace = 2 +ij_java_keep_blank_lines_between_package_declaration_and_header = 2 +ij_java_keep_blank_lines_in_code = 2 +ij_java_keep_blank_lines_in_declarations = 2 +ij_java_keep_builder_methods_indents = false +ij_java_keep_control_statement_in_one_line = true +ij_java_keep_first_column_comment = true +ij_java_keep_indents_on_empty_lines = false +ij_java_keep_line_breaks = true +ij_java_keep_multiple_expressions_in_one_line = false +ij_java_keep_simple_blocks_in_one_line = false +ij_java_keep_simple_classes_in_one_line = false +ij_java_keep_simple_lambdas_in_one_line = false +ij_java_keep_simple_methods_in_one_line = false +ij_java_label_indent_absolute = false +ij_java_label_indent_size = 0 +ij_java_lambda_brace_style = end_of_line +ij_java_layout_static_imports_separately = true +ij_java_line_comment_add_space = false +ij_java_line_comment_at_first_column = true +ij_java_method_annotation_wrap = split_into_lines +ij_java_method_brace_style = end_of_line +ij_java_method_call_chain_wrap = off +ij_java_method_parameters_new_line_after_left_paren = false +ij_java_method_parameters_right_paren_on_new_line = false +ij_java_method_parameters_wrap = off +ij_java_modifier_list_wrap = false +ij_java_names_count_to_use_import_on_demand = 99 +ij_java_new_line_after_lparen_in_record_header = false +ij_java_parameter_annotation_wrap = off +ij_java_parentheses_expression_new_line_after_left_paren = false +ij_java_parentheses_expression_right_paren_on_new_line = false +ij_java_place_assignment_sign_on_next_line = false +ij_java_prefer_longer_names = true +ij_java_prefer_parameters_wrap = false +ij_java_record_components_wrap = normal +ij_java_repeat_synchronized = true +ij_java_replace_instanceof_and_cast = false +ij_java_replace_null_check = true +ij_java_replace_sum_lambda_with_method_ref = true +ij_java_resource_list_new_line_after_left_paren = false +ij_java_resource_list_right_paren_on_new_line = false +ij_java_resource_list_wrap = off +ij_java_rparen_on_new_line_in_record_header = false +ij_java_space_after_closing_angle_bracket_in_type_argument = false +ij_java_space_after_colon = true +ij_java_space_after_comma = true +ij_java_space_after_comma_in_type_arguments = true +ij_java_space_after_for_semicolon = true +ij_java_space_after_quest = true +ij_java_space_after_type_cast = true +ij_java_space_before_annotation_array_initializer_left_brace = false +ij_java_space_before_annotation_parameter_list = false +ij_java_space_before_array_initializer_left_brace = false +ij_java_space_before_catch_keyword = true +ij_java_space_before_catch_left_brace = true +ij_java_space_before_catch_parentheses = true +ij_java_space_before_class_left_brace = true +ij_java_space_before_colon = true +ij_java_space_before_colon_in_foreach = true +ij_java_space_before_comma = false +ij_java_space_before_do_left_brace = true +ij_java_space_before_else_keyword = true +ij_java_space_before_else_left_brace = true +ij_java_space_before_finally_keyword = true +ij_java_space_before_finally_left_brace = true +ij_java_space_before_for_left_brace = true +ij_java_space_before_for_parentheses = true +ij_java_space_before_for_semicolon = false +ij_java_space_before_if_left_brace = true +ij_java_space_before_if_parentheses = true +ij_java_space_before_method_call_parentheses = false +ij_java_space_before_method_left_brace = true +ij_java_space_before_method_parentheses = false +ij_java_space_before_opening_angle_bracket_in_type_parameter = false +ij_java_space_before_quest = true +ij_java_space_before_switch_left_brace = true +ij_java_space_before_switch_parentheses = true +ij_java_space_before_synchronized_left_brace = true +ij_java_space_before_synchronized_parentheses = true +ij_java_space_before_try_left_brace = true +ij_java_space_before_try_parentheses = true +ij_java_space_before_type_parameter_list = false +ij_java_space_before_while_keyword = true +ij_java_space_before_while_left_brace = true +ij_java_space_before_while_parentheses = true +ij_java_space_inside_one_line_enum_braces = false +ij_java_space_within_empty_array_initializer_braces = false +ij_java_space_within_empty_method_call_parentheses = false +ij_java_space_within_empty_method_parentheses = false +ij_java_spaces_around_additive_operators = true +ij_java_spaces_around_assignment_operators = true +ij_java_spaces_around_bitwise_operators = true +ij_java_spaces_around_equality_operators = true +ij_java_spaces_around_lambda_arrow = true +ij_java_spaces_around_logical_operators = true +ij_java_spaces_around_method_ref_dbl_colon = false +ij_java_spaces_around_multiplicative_operators = true +ij_java_spaces_around_relational_operators = true +ij_java_spaces_around_shift_operators = true +ij_java_spaces_around_type_bounds_in_type_parameters = true +ij_java_spaces_around_unary_operator = false +ij_java_spaces_within_angle_brackets = false +ij_java_spaces_within_annotation_parentheses = false +ij_java_spaces_within_array_initializer_braces = false +ij_java_spaces_within_braces = false +ij_java_spaces_within_brackets = false +ij_java_spaces_within_cast_parentheses = false +ij_java_spaces_within_catch_parentheses = false +ij_java_spaces_within_for_parentheses = false +ij_java_spaces_within_if_parentheses = false +ij_java_spaces_within_method_call_parentheses = false +ij_java_spaces_within_method_parentheses = false +ij_java_spaces_within_parentheses = false +ij_java_spaces_within_record_header = false +ij_java_spaces_within_switch_parentheses = false +ij_java_spaces_within_synchronized_parentheses = false +ij_java_spaces_within_try_parentheses = false +ij_java_spaces_within_while_parentheses = false +ij_java_special_else_if_treatment = true +ij_java_subclass_name_suffix = Impl +ij_java_ternary_operation_signs_on_next_line = false +ij_java_ternary_operation_wrap = off +ij_java_test_name_suffix = Test +ij_java_throws_keyword_wrap = off +ij_java_throws_list_wrap = off +ij_java_use_external_annotations = false +ij_java_use_fq_class_names = false +ij_java_use_relative_indents = false +ij_java_use_single_class_imports = true +ij_java_variable_annotation_wrap = off +ij_java_visibility = public +ij_java_while_brace_force = never +ij_java_while_on_new_line = false +ij_java_wrap_comments = false +ij_java_wrap_first_method_in_call_chain = false +ij_java_wrap_long_lines = false + +[*.properties] +ij_properties_align_group_field_declarations = false +ij_properties_keep_blank_lines = false +ij_properties_key_value_delimiter = equals +ij_properties_spaces_around_key_value_delimiter = false + +[.editorconfig] +ij_editorconfig_align_group_field_declarations = false +ij_editorconfig_space_after_colon = false +ij_editorconfig_space_after_comma = true +ij_editorconfig_space_before_colon = false +ij_editorconfig_space_before_comma = false +ij_editorconfig_spaces_around_assignment_operators = true + +[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.rng,*.tld,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul}] +ij_xml_align_attributes = false +ij_xml_align_text = false +ij_xml_attribute_wrap = normal +ij_xml_block_comment_at_first_column = true +ij_xml_keep_blank_lines = 2 +ij_xml_keep_indents_on_empty_lines = false +ij_xml_keep_line_breaks = false +ij_xml_keep_line_breaks_in_text = true +ij_xml_keep_whitespaces = false +ij_xml_keep_whitespaces_around_cdata = preserve +ij_xml_keep_whitespaces_inside_cdata = false +ij_xml_line_comment_at_first_column = true +ij_xml_space_after_tag_name = false +ij_xml_space_around_equals_in_attribute = false +ij_xml_space_inside_empty_tag = true +ij_xml_text_wrap = normal +ij_xml_use_custom_settings = true + +[{*.bash,*.sh,*.zsh}] +indent_size = 2 +tab_width = 2 +ij_shell_binary_ops_start_line = false +ij_shell_keep_column_alignment_padding = false +ij_shell_minify_program = false +ij_shell_redirect_followed_by_space = false +ij_shell_switch_cases_indented = false +ij_shell_use_unix_line_separator = true + +[{*.gant,*.gradle,*.groovy,*.gy}] +ij_groovy_align_group_field_declarations = false +ij_groovy_align_multiline_array_initializer_expression = false +ij_groovy_align_multiline_assignment = false +ij_groovy_align_multiline_binary_operation = false +ij_groovy_align_multiline_chained_methods = false +ij_groovy_align_multiline_extends_list = false +ij_groovy_align_multiline_for = true +ij_groovy_align_multiline_list_or_map = true +ij_groovy_align_multiline_method_parentheses = false +ij_groovy_align_multiline_parameters = true +ij_groovy_align_multiline_parameters_in_calls = false +ij_groovy_align_multiline_resources = true +ij_groovy_align_multiline_ternary_operation = false +ij_groovy_align_multiline_throws_list = false +ij_groovy_align_named_args_in_map = true +ij_groovy_align_throws_keyword = false +ij_groovy_array_initializer_new_line_after_left_brace = false +ij_groovy_array_initializer_right_brace_on_new_line = false +ij_groovy_array_initializer_wrap = off +ij_groovy_assert_statement_wrap = off +ij_groovy_assignment_wrap = off +ij_groovy_binary_operation_wrap = off +ij_groovy_blank_lines_after_class_header = 0 +ij_groovy_blank_lines_after_imports = 1 +ij_groovy_blank_lines_after_package = 1 +ij_groovy_blank_lines_around_class = 1 +ij_groovy_blank_lines_around_field = 0 +ij_groovy_blank_lines_around_field_in_interface = 0 +ij_groovy_blank_lines_around_method = 1 +ij_groovy_blank_lines_around_method_in_interface = 1 +ij_groovy_blank_lines_before_imports = 1 +ij_groovy_blank_lines_before_method_body = 0 +ij_groovy_blank_lines_before_package = 0 +ij_groovy_block_brace_style = end_of_line +ij_groovy_block_comment_at_first_column = true +ij_groovy_call_parameters_new_line_after_left_paren = false +ij_groovy_call_parameters_right_paren_on_new_line = false +ij_groovy_call_parameters_wrap = off +ij_groovy_catch_on_new_line = false +ij_groovy_class_annotation_wrap = split_into_lines +ij_groovy_class_brace_style = end_of_line +ij_groovy_class_count_to_use_import_on_demand = 5 +ij_groovy_do_while_brace_force = never +ij_groovy_else_on_new_line = false +ij_groovy_enum_constants_wrap = off +ij_groovy_extends_keyword_wrap = off +ij_groovy_extends_list_wrap = off +ij_groovy_field_annotation_wrap = split_into_lines +ij_groovy_finally_on_new_line = false +ij_groovy_for_brace_force = never +ij_groovy_for_statement_new_line_after_left_paren = false +ij_groovy_for_statement_right_paren_on_new_line = false +ij_groovy_for_statement_wrap = off +ij_groovy_if_brace_force = never +ij_groovy_import_annotation_wrap = 2 +ij_groovy_imports_layout = *,|,javax.**,java.**,|,$* +ij_groovy_indent_case_from_switch = true +ij_groovy_indent_label_blocks = true +ij_groovy_insert_inner_class_imports = false +ij_groovy_keep_blank_lines_before_right_brace = 2 +ij_groovy_keep_blank_lines_in_code = 2 +ij_groovy_keep_blank_lines_in_declarations = 2 +ij_groovy_keep_control_statement_in_one_line = true +ij_groovy_keep_first_column_comment = true +ij_groovy_keep_indents_on_empty_lines = false +ij_groovy_keep_line_breaks = true +ij_groovy_keep_multiple_expressions_in_one_line = false +ij_groovy_keep_simple_blocks_in_one_line = false +ij_groovy_keep_simple_classes_in_one_line = true +ij_groovy_keep_simple_lambdas_in_one_line = true +ij_groovy_keep_simple_methods_in_one_line = true +ij_groovy_label_indent_absolute = false +ij_groovy_label_indent_size = 0 +ij_groovy_lambda_brace_style = end_of_line +ij_groovy_layout_static_imports_separately = true +ij_groovy_line_comment_add_space = false +ij_groovy_line_comment_at_first_column = true +ij_groovy_method_annotation_wrap = split_into_lines +ij_groovy_method_brace_style = end_of_line +ij_groovy_method_call_chain_wrap = off +ij_groovy_method_parameters_new_line_after_left_paren = false +ij_groovy_method_parameters_right_paren_on_new_line = false +ij_groovy_method_parameters_wrap = off +ij_groovy_modifier_list_wrap = false +ij_groovy_names_count_to_use_import_on_demand = 3 +ij_groovy_parameter_annotation_wrap = off +ij_groovy_parentheses_expression_new_line_after_left_paren = false +ij_groovy_parentheses_expression_right_paren_on_new_line = false +ij_groovy_prefer_parameters_wrap = false +ij_groovy_resource_list_new_line_after_left_paren = false +ij_groovy_resource_list_right_paren_on_new_line = false +ij_groovy_resource_list_wrap = off +ij_groovy_space_after_assert_separator = true +ij_groovy_space_after_colon = true +ij_groovy_space_after_comma = true +ij_groovy_space_after_comma_in_type_arguments = true +ij_groovy_space_after_for_semicolon = true +ij_groovy_space_after_quest = true +ij_groovy_space_after_type_cast = true +ij_groovy_space_before_annotation_parameter_list = false +ij_groovy_space_before_array_initializer_left_brace = false +ij_groovy_space_before_assert_separator = false +ij_groovy_space_before_catch_keyword = true +ij_groovy_space_before_catch_left_brace = true +ij_groovy_space_before_catch_parentheses = true +ij_groovy_space_before_class_left_brace = true +ij_groovy_space_before_closure_left_brace = true +ij_groovy_space_before_colon = true +ij_groovy_space_before_comma = false +ij_groovy_space_before_do_left_brace = true +ij_groovy_space_before_else_keyword = true +ij_groovy_space_before_else_left_brace = true +ij_groovy_space_before_finally_keyword = true +ij_groovy_space_before_finally_left_brace = true +ij_groovy_space_before_for_left_brace = true +ij_groovy_space_before_for_parentheses = true +ij_groovy_space_before_for_semicolon = false +ij_groovy_space_before_if_left_brace = true +ij_groovy_space_before_if_parentheses = true +ij_groovy_space_before_method_call_parentheses = false +ij_groovy_space_before_method_left_brace = true +ij_groovy_space_before_method_parentheses = false +ij_groovy_space_before_quest = true +ij_groovy_space_before_switch_left_brace = true +ij_groovy_space_before_switch_parentheses = true +ij_groovy_space_before_synchronized_left_brace = true +ij_groovy_space_before_synchronized_parentheses = true +ij_groovy_space_before_try_left_brace = true +ij_groovy_space_before_try_parentheses = true +ij_groovy_space_before_while_keyword = true +ij_groovy_space_before_while_left_brace = true +ij_groovy_space_before_while_parentheses = true +ij_groovy_space_in_named_argument = true +ij_groovy_space_in_named_argument_before_colon = false +ij_groovy_space_within_empty_array_initializer_braces = false +ij_groovy_space_within_empty_method_call_parentheses = false +ij_groovy_spaces_around_additive_operators = true +ij_groovy_spaces_around_assignment_operators = true +ij_groovy_spaces_around_bitwise_operators = true +ij_groovy_spaces_around_equality_operators = true +ij_groovy_spaces_around_lambda_arrow = true +ij_groovy_spaces_around_logical_operators = true +ij_groovy_spaces_around_multiplicative_operators = true +ij_groovy_spaces_around_regex_operators = true +ij_groovy_spaces_around_relational_operators = true +ij_groovy_spaces_around_shift_operators = true +ij_groovy_spaces_within_annotation_parentheses = false +ij_groovy_spaces_within_array_initializer_braces = false +ij_groovy_spaces_within_braces = true +ij_groovy_spaces_within_brackets = false +ij_groovy_spaces_within_cast_parentheses = false +ij_groovy_spaces_within_catch_parentheses = false +ij_groovy_spaces_within_for_parentheses = false +ij_groovy_spaces_within_gstring_injection_braces = false +ij_groovy_spaces_within_if_parentheses = false +ij_groovy_spaces_within_list_or_map = false +ij_groovy_spaces_within_method_call_parentheses = false +ij_groovy_spaces_within_method_parentheses = false +ij_groovy_spaces_within_parentheses = false +ij_groovy_spaces_within_switch_parentheses = false +ij_groovy_spaces_within_synchronized_parentheses = false +ij_groovy_spaces_within_try_parentheses = false +ij_groovy_spaces_within_tuple_expression = false +ij_groovy_spaces_within_while_parentheses = false +ij_groovy_special_else_if_treatment = true +ij_groovy_ternary_operation_wrap = off +ij_groovy_throws_keyword_wrap = off +ij_groovy_throws_list_wrap = off +ij_groovy_use_flying_geese_braces = false +ij_groovy_use_fq_class_names = false +ij_groovy_use_fq_class_names_in_javadoc = true +ij_groovy_use_relative_indents = false +ij_groovy_use_single_class_imports = true +ij_groovy_variable_annotation_wrap = off +ij_groovy_while_brace_force = never +ij_groovy_while_on_new_line = false +ij_groovy_wrap_long_lines = false + +# noinspection EditorConfigKeyCorrectness +[{*.kt,*.kts}] +ktlint_standard_import-ordering = disabled +ktlint_standard_multiline-if-else = disabled +ktlint_standard_trailing-comma-on-call-site = disabled +ktlint_standard_trailing-comma-on-declaration-site = disabled +ktLint_standard_package-name = disabled +max_line_length = 120 +ij_kotlin_align_in_columns_case_branch = false +ij_kotlin_align_multiline_binary_operation = false +ij_kotlin_align_multiline_extends_list = false +ij_kotlin_align_multiline_method_parentheses = false +ij_kotlin_align_multiline_parameters = true +ij_kotlin_align_multiline_parameters_in_calls = false +ij_kotlin_allow_trailing_comma = false +ij_kotlin_allow_trailing_comma_on_call_site = false +ij_kotlin_assignment_wrap = normal +ij_kotlin_blank_lines_after_class_header = 0 +ij_kotlin_blank_lines_around_block_when_branches = 0 +ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1 +ij_kotlin_block_comment_at_first_column = true +ij_kotlin_call_parameters_new_line_after_left_paren = true +ij_kotlin_call_parameters_right_paren_on_new_line = true +ij_kotlin_call_parameters_wrap = on_every_item +ij_kotlin_catch_on_new_line = false +ij_kotlin_class_annotation_wrap = split_into_lines +ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL +ij_kotlin_continuation_indent_for_chained_calls = false +ij_kotlin_continuation_indent_for_expression_bodies = false +ij_kotlin_continuation_indent_in_argument_lists = false +ij_kotlin_continuation_indent_in_elvis = false +ij_kotlin_continuation_indent_in_if_conditions = false +ij_kotlin_continuation_indent_in_parameter_lists = false +ij_kotlin_continuation_indent_in_supertype_lists = false +ij_kotlin_else_on_new_line = false +ij_kotlin_enum_constants_wrap = off +ij_kotlin_extends_list_wrap = normal +ij_kotlin_field_annotation_wrap = split_into_lines +ij_kotlin_finally_on_new_line = false +ij_kotlin_if_rparen_on_new_line = true +ij_kotlin_import_nested_classes = false +ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^ +ij_kotlin_insert_whitespaces_in_simple_one_line_method = true +ij_kotlin_keep_blank_lines_before_right_brace = 2 +ij_kotlin_keep_blank_lines_in_code = 2 +ij_kotlin_keep_blank_lines_in_declarations = 2 +ij_kotlin_keep_first_column_comment = true +ij_kotlin_keep_indents_on_empty_lines = false +ij_kotlin_keep_line_breaks = true +ij_kotlin_lbrace_on_next_line = false +ij_kotlin_line_comment_add_space = false +ij_kotlin_line_comment_at_first_column = true +ij_kotlin_method_annotation_wrap = split_into_lines +ij_kotlin_method_call_chain_wrap = normal +ij_kotlin_method_parameters_new_line_after_left_paren = true +ij_kotlin_method_parameters_right_paren_on_new_line = true +ij_kotlin_method_parameters_wrap = on_every_item +ij_kotlin_name_count_to_use_star_import = 2147483647 +ij_kotlin_name_count_to_use_star_import_for_members = 2147483647 +ij_kotlin_packages_to_use_import_on_demand = kotlinx.android.synthetic.**,io.ktor.** +ij_kotlin_parameter_annotation_wrap = off +ij_kotlin_space_after_comma = true +ij_kotlin_space_after_extend_colon = true +ij_kotlin_space_after_type_colon = true +ij_kotlin_space_before_catch_parentheses = true +ij_kotlin_space_before_comma = false +ij_kotlin_space_before_extend_colon = true +ij_kotlin_space_before_for_parentheses = true +ij_kotlin_space_before_if_parentheses = true +ij_kotlin_space_before_lambda_arrow = true +ij_kotlin_space_before_type_colon = false +ij_kotlin_space_before_when_parentheses = true +ij_kotlin_space_before_while_parentheses = true +ij_kotlin_spaces_around_additive_operators = true +ij_kotlin_spaces_around_assignment_operators = true +ij_kotlin_spaces_around_equality_operators = true +ij_kotlin_spaces_around_function_type_arrow = true +ij_kotlin_spaces_around_logical_operators = true +ij_kotlin_spaces_around_multiplicative_operators = true +ij_kotlin_spaces_around_range = false +ij_kotlin_spaces_around_relational_operators = true +ij_kotlin_spaces_around_unary_operator = false +ij_kotlin_spaces_around_when_arrow = true +ij_kotlin_use_custom_formatting_for_modifiers = true +ij_kotlin_variable_annotation_wrap = off +ij_kotlin_while_on_new_line = false +ij_kotlin_wrap_elvis_expressions = 1 +ij_kotlin_wrap_expression_body_functions = 1 +ij_kotlin_wrap_first_method_in_call_chain = false + +[{*.har,*.json}] +indent_size = 2 +ij_json_keep_blank_lines_in_code = 0 +ij_json_keep_indents_on_empty_lines = false +ij_json_keep_line_breaks = true +ij_json_space_after_colon = true +ij_json_space_after_comma = true +ij_json_space_before_colon = true +ij_json_space_before_comma = false +ij_json_spaces_within_braces = false +ij_json_spaces_within_brackets = false +ij_json_wrap_long_lines = false + +[{*.htm,*.html,*.sht,*.shtm,*.shtml}] +ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 +ij_html_align_attributes = true +ij_html_align_text = false +ij_html_attribute_wrap = normal +ij_html_block_comment_at_first_column = true +ij_html_do_not_align_children_of_min_lines = 0 +ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p +ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot +ij_html_enforce_quotes = false +ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var +ij_html_keep_blank_lines = 2 +ij_html_keep_indents_on_empty_lines = false +ij_html_keep_line_breaks = true +ij_html_keep_line_breaks_in_text = true +ij_html_keep_whitespaces = false +ij_html_keep_whitespaces_inside = span,pre,textarea +ij_html_line_comment_at_first_column = true +ij_html_new_line_after_last_attribute = never +ij_html_new_line_before_first_attribute = never +ij_html_quote_style = double +ij_html_remove_new_line_before_tags = br +ij_html_space_after_tag_name = false +ij_html_space_around_equality_in_attribute = false +ij_html_space_inside_empty_tag = false +ij_html_text_wrap = normal + +[{*.yaml,*.yml}] +indent_size = 2 +ij_yaml_align_values_properties = do_not_align +ij_yaml_autoinsert_sequence_marker = true +ij_yaml_block_mapping_on_new_line = false +ij_yaml_indent_sequence_value = true +ij_yaml_keep_indents_on_empty_lines = false +ij_yaml_keep_line_breaks = true +ij_yaml_sequence_on_new_line = false +ij_yaml_space_before_colon = false +ij_yaml_spaces_within_braces = true +ij_yaml_spaces_within_brackets = true diff --git a/android/build.gradle b/android/build.gradle index eb1d199..7f39895 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -23,6 +23,7 @@ allprojects { apply plugin: 'com.android.library' apply plugin: 'kotlin-android' +apply from: 'ktlint.gradle' android { namespace = "com.adyen.adyen_checkout" @@ -64,4 +65,4 @@ android { } } } -} +} \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..8bc9958 --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip diff --git a/android/ktlint.gradle b/android/ktlint.gradle new file mode 100644 index 0000000..8089dd0 --- /dev/null +++ b/android/ktlint.gradle @@ -0,0 +1,28 @@ +configurations { + ktlint +} + +dependencies { + ktlint "com.pinterest:ktlint:0.50.0" +} + +tasks.register('ktlintCheck', JavaExec) { + description = "Check Kotlin code style." + group = "verification" + + classpath = configurations.ktlint + main = "com.pinterest.ktlint.Main" + args "src/**/main/**/*.kt", "--reporter=plain", "--reporter=checkstyle,output=${project.buildDir}/reports/klint/klint-results.xml" +} + +check.dependsOn ktlintCheck + +tasks.register('ktlintFormat', JavaExec) { + description = "Fix Kotlin code style deviations." + group = "formatting" + + classpath = configurations.ktlint + main = "com.pinterest.ktlint.Main" + args "-F", "src/main/**/*.kt" + jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED") +} diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt index bd82874..c2aa5cb 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt @@ -21,6 +21,7 @@ import io.flutter.embedding.engine.plugins.FlutterPlugin import io.flutter.embedding.engine.plugins.activity.ActivityAware import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding import io.flutter.embedding.engine.plugins.lifecycle.HiddenLifecycleReference +import DropInResult as FlutterDropInResult /** AdyenCheckoutPlugin */ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt index 35f641e..eddc4c9 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt @@ -62,11 +62,10 @@ class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : activity.applicationContext, dropInSessionLauncher, checkoutSession, - dropInConfiguration + dropInConfiguration, ) } } - } override fun startDropInAdvancedFlowPayment( @@ -77,7 +76,7 @@ class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : setAdvancedFlowDropInServiceObserver() activity.lifecycleScope.launch(Dispatchers.IO) { val paymentMethodsApiResponse = PaymentMethodsApiResponse.SERIALIZER.deserialize( - JSONObject(paymentMethodsResponse) + JSONObject(paymentMethodsResponse), ) val paymentMethodsWithoutGiftCards = removeGiftCardPaymentMethods(paymentMethodsApiResponse) @@ -109,7 +108,7 @@ class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : private suspend fun createCheckoutSession( sessionModel: com.adyen.checkout.sessions.core.SessionModel, - dropInConfiguration: com.adyen.checkout.dropin.DropInConfiguration + dropInConfiguration: com.adyen.checkout.dropin.DropInConfiguration, ): CheckoutSession { val checkoutSessionResult = CheckoutSessionProvider.createSession(sessionModel, dropInConfiguration) @@ -119,7 +118,6 @@ class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : } } - private fun setAdvancedFlowDropInServiceObserver() { DropInServiceResultMessenger.instance().removeObservers(activity) DropInServiceResultMessenger.instance().observe(activity) { message -> @@ -129,7 +127,7 @@ class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : val model = PlatformCommunicationModel( PlatformCommunicationType.PAYMENTCOMPONENT, - data = message.contentIfNotHandled.toString() + data = message.contentIfNotHandled.toString(), ) checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} } @@ -144,7 +142,7 @@ class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : val model = PlatformCommunicationModel( PlatformCommunicationType.ADDITIONALDETAILS, - data = message.contentIfNotHandled.toString() + data = message.contentIfNotHandled.toString(), ) checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} } diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt index 1e49317..5c3d14e 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt @@ -120,4 +120,5 @@ class AdvancedFlowDropInService : DropInService(), LifecycleOwner { override val lifecycle: Lifecycle get() = dispatcher.lifecycle -} \ No newline at end of file +} + diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/DropInServiceResultHandler.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/DropInServiceResultHandler.kt new file mode 100644 index 0000000..e69de29 diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/DropInServiceResultMessenger.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/DropInServiceResultMessenger.kt index d56ef40..ca5c66d 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/DropInServiceResultMessenger.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/DropInServiceResultMessenger.kt @@ -48,4 +48,4 @@ class DropInAdditionalDetailsResultMessenger : LiveData>() { dropInAdditionalDetailsResultMessenger.postValue(Event(value)) } } -} \ No newline at end of file +} diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Event.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Event.kt index 429f9bd..d3d98b2 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Event.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Event.kt @@ -23,4 +23,4 @@ class Event(content: T?) { fun hasBeenHandled(): Boolean { return hasBeenHandled } -} \ No newline at end of file +} diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Mapper.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Mapper.kt index e9c7709..8e347a5 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Mapper.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Mapper.kt @@ -20,8 +20,8 @@ object Mapper { return com.adyen.checkout.dropin.DropInConfiguration.Builder( context, this.environment.mapToEnvironment(), - clientKey - ).setAmount(amount).build(); + clientKey, + ).setAmount(amount).build() } private fun Environment.mapToEnvironment(): com.adyen.checkout.core.Environment { @@ -33,7 +33,6 @@ object Mapper { Environment.INDIA -> SDKEnvironment.INDIA Environment.APSE -> SDKEnvironment.APSE } - } private fun Amount.mapToAmount(): com.adyen.checkout.components.core.Amount { @@ -49,7 +48,7 @@ object Mapper { pspReference = pspReference, orderData = orderData, amount = amount?.mapTopAmount(), - remainingAmount = remainingAmount?.mapTopAmount() + remainingAmount = remainingAmount?.mapTopAmount(), ) } -} \ No newline at end of file +} --- android/.editorconfig | 23 ++++++++----------- .../adyen_checkout/AdyenCheckoutPlugin.kt | 1 + .../AdvancedFlowDropInService.kt | 12 +++++----- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/android/.editorconfig b/android/.editorconfig index 911c5a67..c04ece5d 100644 --- a/android/.editorconfig +++ b/android/.editorconfig @@ -106,7 +106,7 @@ ij_java_for_statement_wrap = off ij_java_generate_final_locals = false ij_java_generate_final_parameters = false ij_java_if_brace_force = never -ij_java_imports_layout = $android.**, $androidx.**, $com.**, $junit.**, $net.**, $org.**, $java.**, $javax.**, $*, |, android.**, |, androidx.**, |, com.**, |, junit.**, |, net.**, |, org.**, |, java.**, |, javax.**, |, *, | +ij_java_imports_layout = $android.**,$androidx.**,$com.**,$junit.**,$net.**,$org.**,$java.**,$javax.**,$*,|,android.**,|,androidx.**,|,com.**,|,junit.**,|,net.**,|,org.**,|,java.**,|,javax.**,|,*,| ij_java_indent_case_from_switch = true ij_java_insert_inner_class_imports = false ij_java_insert_override_annotation = true @@ -347,7 +347,7 @@ ij_groovy_for_statement_right_paren_on_new_line = false ij_groovy_for_statement_wrap = off ij_groovy_if_brace_force = never ij_groovy_import_annotation_wrap = 2 -ij_groovy_imports_layout = *, |, javax.**, java.**, |, $* +ij_groovy_imports_layout = *,|,javax.**,java.**,|,$* ij_groovy_indent_case_from_switch = true ij_groovy_indent_label_blocks = true ij_groovy_insert_inner_class_imports = false @@ -472,7 +472,6 @@ ij_groovy_wrap_long_lines = false # noinspection EditorConfigKeyCorrectness [{*.kt,*.kts}] -ktlint_code_style = ktlint_official ktlint_standard_import-ordering = disabled ktlint_standard_multiline-if-else = disabled ktlint_standard_trailing-comma-on-call-site = disabled @@ -512,7 +511,7 @@ ij_kotlin_field_annotation_wrap = split_into_lines ij_kotlin_finally_on_new_line = false ij_kotlin_if_rparen_on_new_line = true ij_kotlin_import_nested_classes = false -ij_kotlin_imports_layout = *, java.**, javax.**, kotlin.**, ^ +ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^ ij_kotlin_insert_whitespaces_in_simple_one_line_method = true ij_kotlin_keep_blank_lines_before_right_brace = 2 ij_kotlin_keep_blank_lines_in_code = 2 @@ -530,7 +529,7 @@ ij_kotlin_method_parameters_right_paren_on_new_line = true ij_kotlin_method_parameters_wrap = on_every_item ij_kotlin_name_count_to_use_star_import = 2147483647 ij_kotlin_name_count_to_use_star_import_for_members = 2147483647 -ij_kotlin_packages_to_use_import_on_demand = kotlinx.android.synthetic.**, io.ktor.** +ij_kotlin_packages_to_use_import_on_demand = kotlinx.android.synthetic.**,io.ktor.** ij_kotlin_parameter_annotation_wrap = off ij_kotlin_space_after_comma = true ij_kotlin_space_after_extend_colon = true @@ -575,22 +574,22 @@ ij_json_spaces_within_brackets = false ij_json_wrap_long_lines = false [{*.htm,*.html,*.sht,*.shtm,*.shtml}] -ij_html_add_new_line_before_tags = body, div, p, form, h1, h2, h3 +ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 ij_html_align_attributes = true ij_html_align_text = false ij_html_attribute_wrap = normal ij_html_block_comment_at_first_column = true ij_html_do_not_align_children_of_min_lines = 0 -ij_html_do_not_break_if_inline_tags = title, h1, h2, h3, h4, h5, h6, p -ij_html_do_not_indent_children_of_tags = html, body, thead, tbody, tfoot +ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p +ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot ij_html_enforce_quotes = false -ij_html_inline_tags = a, abbr, acronym, b, basefont, bdo, big, br, cite, cite, code, dfn, em, font, i, img, input, kbd, label, q, s, samp, select, small, span, strike, strong, sub, sup, textarea, tt, u, var +ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var ij_html_keep_blank_lines = 2 ij_html_keep_indents_on_empty_lines = false ij_html_keep_line_breaks = true ij_html_keep_line_breaks_in_text = true ij_html_keep_whitespaces = false -ij_html_keep_whitespaces_inside = span, pre, textarea +ij_html_keep_whitespaces_inside = span,pre,textarea ij_html_line_comment_at_first_column = true ij_html_new_line_after_last_attribute = never ij_html_new_line_before_first_attribute = never @@ -613,7 +612,3 @@ ij_yaml_sequence_on_new_line = false ij_yaml_space_before_colon = false ij_yaml_spaces_within_braces = true ij_yaml_spaces_within_brackets = true - - -[{PlatformApi.kt,PlatformApi.kts}] -ktlint_standard = disabled diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt index 74e635dc..ee0e3764 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt @@ -21,6 +21,7 @@ import io.flutter.embedding.engine.plugins.FlutterPlugin import io.flutter.embedding.engine.plugins.activity.ActivityAware import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding import io.flutter.embedding.engine.plugins.lifecycle.HiddenLifecycleReference +import DropInResult as FlutterDropInResult /** AdyenCheckoutPlugin */ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt index cccafb20..5362117b 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt @@ -1,7 +1,8 @@ package com.adyen.adyen_checkout.dropInAdvancedFlow + import DropInResult -import DropInResultType +import DropInResultType.* import android.content.Intent import android.os.IBinder import androidx.lifecycle.Lifecycle @@ -82,17 +83,15 @@ class AdvancedFlowDropInService : DropInService(), LifecycleOwner { private fun mapToDropInResult(dropInResult: DropInResult?): DropInServiceResult { return when (dropInResult?.dropInResultType) { - DropInResultType.FINISHED -> DropInServiceResult.Finished( - result = "${dropInResult.result}" - ) + FINISHED -> DropInServiceResult.Finished(result = "${dropInResult.result}") - DropInResultType.ERROR -> DropInServiceResult.Error( + ERROR -> DropInServiceResult.Error( errorDialog = null, reason = dropInResult.error?.reason, dismissDropIn = dropInResult.error?.dismissDropIn ?: false ) - DropInResultType.ACTION -> { + ACTION -> { if (dropInResult.actionResponse == null) { DropInServiceResult.Error( errorDialog = null, @@ -142,3 +141,4 @@ class AdvancedFlowDropInService : DropInService(), LifecycleOwner { override val lifecycle: Lifecycle get() = dispatcher.lifecycle } + From d3491e50537c4f2e1f94e59471e1d8a6474cc283 Mon Sep 17 00:00:00 2001 From: Robert Schulze Dieckhoff Date: Thu, 14 Sep 2023 10:03:57 +0200 Subject: [PATCH 4/4] Disabled ktlint for PlatformApi.kt because the class is generated code diff --git a/android/.editorconfig b/android/.editorconfig index c04ece5..911c5a6 100644 --- a/android/.editorconfig +++ b/android/.editorconfig @@ -106,7 +106,7 @@ ij_java_for_statement_wrap = off ij_java_generate_final_locals = false ij_java_generate_final_parameters = false ij_java_if_brace_force = never -ij_java_imports_layout = $android.**,$androidx.**,$com.**,$junit.**,$net.**,$org.**,$java.**,$javax.**,$*,|,android.**,|,androidx.**,|,com.**,|,junit.**,|,net.**,|,org.**,|,java.**,|,javax.**,|,*,| +ij_java_imports_layout = $android.**, $androidx.**, $com.**, $junit.**, $net.**, $org.**, $java.**, $javax.**, $*, |, android.**, |, androidx.**, |, com.**, |, junit.**, |, net.**, |, org.**, |, java.**, |, javax.**, |, *, | ij_java_indent_case_from_switch = true ij_java_insert_inner_class_imports = false ij_java_insert_override_annotation = true @@ -347,7 +347,7 @@ ij_groovy_for_statement_right_paren_on_new_line = false ij_groovy_for_statement_wrap = off ij_groovy_if_brace_force = never ij_groovy_import_annotation_wrap = 2 -ij_groovy_imports_layout = *,|,javax.**,java.**,|,$* +ij_groovy_imports_layout = *, |, javax.**, java.**, |, $* ij_groovy_indent_case_from_switch = true ij_groovy_indent_label_blocks = true ij_groovy_insert_inner_class_imports = false @@ -472,6 +472,7 @@ ij_groovy_wrap_long_lines = false # noinspection EditorConfigKeyCorrectness [{*.kt,*.kts}] +ktlint_code_style = ktlint_official ktlint_standard_import-ordering = disabled ktlint_standard_multiline-if-else = disabled ktlint_standard_trailing-comma-on-call-site = disabled @@ -511,7 +512,7 @@ ij_kotlin_field_annotation_wrap = split_into_lines ij_kotlin_finally_on_new_line = false ij_kotlin_if_rparen_on_new_line = true ij_kotlin_import_nested_classes = false -ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^ +ij_kotlin_imports_layout = *, java.**, javax.**, kotlin.**, ^ ij_kotlin_insert_whitespaces_in_simple_one_line_method = true ij_kotlin_keep_blank_lines_before_right_brace = 2 ij_kotlin_keep_blank_lines_in_code = 2 @@ -529,7 +530,7 @@ ij_kotlin_method_parameters_right_paren_on_new_line = true ij_kotlin_method_parameters_wrap = on_every_item ij_kotlin_name_count_to_use_star_import = 2147483647 ij_kotlin_name_count_to_use_star_import_for_members = 2147483647 -ij_kotlin_packages_to_use_import_on_demand = kotlinx.android.synthetic.**,io.ktor.** +ij_kotlin_packages_to_use_import_on_demand = kotlinx.android.synthetic.**, io.ktor.** ij_kotlin_parameter_annotation_wrap = off ij_kotlin_space_after_comma = true ij_kotlin_space_after_extend_colon = true @@ -574,22 +575,22 @@ ij_json_spaces_within_brackets = false ij_json_wrap_long_lines = false [{*.htm,*.html,*.sht,*.shtm,*.shtml}] -ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 +ij_html_add_new_line_before_tags = body, div, p, form, h1, h2, h3 ij_html_align_attributes = true ij_html_align_text = false ij_html_attribute_wrap = normal ij_html_block_comment_at_first_column = true ij_html_do_not_align_children_of_min_lines = 0 -ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p -ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot +ij_html_do_not_break_if_inline_tags = title, h1, h2, h3, h4, h5, h6, p +ij_html_do_not_indent_children_of_tags = html, body, thead, tbody, tfoot ij_html_enforce_quotes = false -ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var +ij_html_inline_tags = a, abbr, acronym, b, basefont, bdo, big, br, cite, cite, code, dfn, em, font, i, img, input, kbd, label, q, s, samp, select, small, span, strike, strong, sub, sup, textarea, tt, u, var ij_html_keep_blank_lines = 2 ij_html_keep_indents_on_empty_lines = false ij_html_keep_line_breaks = true ij_html_keep_line_breaks_in_text = true ij_html_keep_whitespaces = false -ij_html_keep_whitespaces_inside = span,pre,textarea +ij_html_keep_whitespaces_inside = span, pre, textarea ij_html_line_comment_at_first_column = true ij_html_new_line_after_last_attribute = never ij_html_new_line_before_first_attribute = never @@ -612,3 +613,7 @@ ij_yaml_sequence_on_new_line = false ij_yaml_space_before_colon = false ij_yaml_spaces_within_braces = true ij_yaml_spaces_within_brackets = true + + +[{PlatformApi.kt,PlatformApi.kts}] +ktlint_standard = disabled diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt index c2aa5cb..74e635d 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt @@ -21,7 +21,6 @@ import io.flutter.embedding.engine.plugins.FlutterPlugin import io.flutter.embedding.engine.plugins.activity.ActivityAware import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding import io.flutter.embedding.engine.plugins.lifecycle.HiddenLifecycleReference -import DropInResult as FlutterDropInResult /** AdyenCheckoutPlugin */ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { @@ -45,8 +44,9 @@ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { override fun onDetachedFromActivityForConfigChanges() = teardown() - override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) = - setupActivity(binding) + override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) = setupActivity( + binding + ) override fun onDetachedFromActivity() = teardown() @@ -70,10 +70,9 @@ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { Lifecycle.Event.ON_CREATE -> { checkoutPlatformApi?.dropInSessionLauncher = DropIn.registerForDropInResult(fragmentActivity, sessionDropInCallback()) - checkoutPlatformApi?.dropInAdvancedFlowLauncher = - DropIn.registerForDropInResult( - fragmentActivity, dropInAdvancedFlowCallback - ) + checkoutPlatformApi?.dropInAdvancedFlowLauncher = DropIn.registerForDropInResult( + fragmentActivity, dropInAdvancedFlowCallback + ) } else -> {} @@ -92,11 +91,13 @@ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { ) is SessionDropInResult.Error -> PaymentResult( - PaymentResultEnum.ERROR, reason = sessionDropInResult.reason + PaymentResultEnum.ERROR, + reason = sessionDropInResult.reason ) is SessionDropInResult.Finished -> PaymentResult( - PaymentResultEnum.FINISHED, result = with(sessionDropInResult.result) { + PaymentResultEnum.FINISHED, + result = with(sessionDropInResult.result) { PaymentResultModel( sessionId, sessionData, @@ -120,18 +121,22 @@ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { ) is DropInResult.Error -> PaymentResult( - PaymentResultEnum.ERROR, reason = dropInAdvancedFlowResult.reason + PaymentResultEnum.ERROR, + reason = dropInAdvancedFlowResult.reason ) is DropInResult.Finished -> PaymentResult( - PaymentResultEnum.FINISHED, result = PaymentResultModel( + PaymentResultEnum.FINISHED, + result = PaymentResultModel( resultCode = dropInAdvancedFlowResult.result ) ) } val model = PlatformCommunicationModel( - PlatformCommunicationType.RESULT, data = "", paymentResult = mappedResult + PlatformCommunicationType.RESULT, + data = "", + paymentResult = mappedResult ) checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} } diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt index eddc4c9..bd858f6 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/CheckoutPlatformApi.kt @@ -35,136 +35,139 @@ import org.json.JSONObject @Suppress("NAME_SHADOWING") class CheckoutPlatformApi(private val checkoutFlutterApi: CheckoutFlutterApi?) : CheckoutPlatformInterface { - lateinit var activity: FragmentActivity - lateinit var dropInSessionLauncher: ActivityResultLauncher - lateinit var dropInAdvancedFlowLauncher: ActivityResultLauncher + lateinit var activity: FragmentActivity + lateinit var dropInSessionLauncher: + ActivityResultLauncher + lateinit var dropInAdvancedFlowLauncher: ActivityResultLauncher - override fun getPlatformVersion(callback: (Result) -> Unit) { - callback.invoke(Result.success("Android ${android.os.Build.VERSION.RELEASE}")) - } + override fun getPlatformVersion(callback: (Result) -> Unit) { + callback.invoke(Result.success("Android ${android.os.Build.VERSION.RELEASE}")) + } - override fun getReturnUrl(callback: (Result) -> Unit) { - callback(Result.success(RedirectComponent.getReturnUrl(activity.applicationContext))) - } + override fun getReturnUrl(callback: (Result) -> Unit) { + callback(Result.success(RedirectComponent.getReturnUrl(activity.applicationContext))) + } - override fun startDropInSessionPayment( - dropInConfiguration: DropInConfiguration, - session: Session, - ) { - checkForFlutterFragmentActivity() - activity.lifecycleScope.launch(Dispatchers.IO) { - val sessionModel = session.mapToSession() - val dropInConfiguration = - dropInConfiguration.mapToDropInConfiguration(activity.applicationContext) - val checkoutSession = createCheckoutSession(sessionModel, dropInConfiguration) - withContext(Dispatchers.Main) { - DropIn.startPayment( - activity.applicationContext, - dropInSessionLauncher, - checkoutSession, - dropInConfiguration, - ) + override fun startDropInSessionPayment( + dropInConfiguration: DropInConfiguration, + session: Session, + ) { + checkForFlutterFragmentActivity() + activity.lifecycleScope.launch(Dispatchers.IO) { + val sessionModel = session.mapToSession() + val dropInConfiguration = + dropInConfiguration.mapToDropInConfiguration(activity.applicationContext) + val checkoutSession = createCheckoutSession(sessionModel, dropInConfiguration) + withContext(Dispatchers.Main) { + DropIn.startPayment( + activity.applicationContext, + dropInSessionLauncher, + checkoutSession, + dropInConfiguration, + ) + } } } - } - override fun startDropInAdvancedFlowPayment( - dropInConfiguration: DropInConfiguration, - paymentMethodsResponse: String, - ) { - checkForFlutterFragmentActivity() - setAdvancedFlowDropInServiceObserver() - activity.lifecycleScope.launch(Dispatchers.IO) { - val paymentMethodsApiResponse = PaymentMethodsApiResponse.SERIALIZER.deserialize( - JSONObject(paymentMethodsResponse), - ) - val paymentMethodsWithoutGiftCards = - removeGiftCardPaymentMethods(paymentMethodsApiResponse) - val dropInConfiguration = - dropInConfiguration.mapToDropInConfiguration(activity.applicationContext) - withContext(Dispatchers.Main) { - DropIn.startPayment( - activity.applicationContext, - dropInAdvancedFlowLauncher, - paymentMethodsWithoutGiftCards, - dropInConfiguration, - AdvancedFlowDropInService::class.java, + override fun startDropInAdvancedFlowPayment( + dropInConfiguration: DropInConfiguration, + paymentMethodsResponse: String, + ) { + checkForFlutterFragmentActivity() + setAdvancedFlowDropInServiceObserver() + activity.lifecycleScope.launch(Dispatchers.IO) { + val paymentMethodsApiResponse = PaymentMethodsApiResponse.SERIALIZER.deserialize( + JSONObject(paymentMethodsResponse), ) + val paymentMethodsWithoutGiftCards = + removeGiftCardPaymentMethods(paymentMethodsApiResponse) + val dropInConfiguration = + dropInConfiguration.mapToDropInConfiguration(activity.applicationContext) + withContext(Dispatchers.Main) { + DropIn.startPayment( + activity.applicationContext, + dropInAdvancedFlowLauncher, + paymentMethodsWithoutGiftCards, + dropInConfiguration, + AdvancedFlowDropInService::class.java, + ) + } } } - } - override fun onPaymentsResult(paymentsResult: DropInResult) { - if (paymentsResult.dropInResultType == DropInResultType.ACTION) { - setAdvanceFlowDropInAdditionalDetailsMessengerObserver() - } - - DropInPaymentResultMessenger.sendResult(paymentsResult) - } + override fun onPaymentsResult(paymentsResult: DropInResult) { + if (paymentsResult.dropInResultType == DropInResultType.ACTION) { + setAdvanceFlowDropInAdditionalDetailsMessengerObserver() + } - override fun onPaymentsDetailsResult(paymentsDetailsResult: DropInResult) { - DropInAdditionalDetailsResultMessenger.sendResult(paymentsDetailsResult) - } + DropInPaymentResultMessenger.sendResult(paymentsResult) + } - private suspend fun createCheckoutSession( - sessionModel: com.adyen.checkout.sessions.core.SessionModel, - dropInConfiguration: com.adyen.checkout.dropin.DropInConfiguration, - ): CheckoutSession { - val checkoutSessionResult = - CheckoutSessionProvider.createSession(sessionModel, dropInConfiguration) - return when (checkoutSessionResult) { - is CheckoutSessionResult.Success -> checkoutSessionResult.checkoutSession - is CheckoutSessionResult.Error -> throw checkoutSessionResult.exception + override fun onPaymentsDetailsResult(paymentsDetailsResult: DropInResult) { + DropInAdditionalDetailsResultMessenger.sendResult(paymentsDetailsResult) } - } - private fun setAdvancedFlowDropInServiceObserver() { - DropInServiceResultMessenger.instance().removeObservers(activity) - DropInServiceResultMessenger.instance().observe(activity) { message -> - if (message.hasBeenHandled()) { - return@observe + private suspend fun createCheckoutSession( + sessionModel: com.adyen.checkout.sessions.core.SessionModel, + dropInConfiguration: com.adyen.checkout.dropin.DropInConfiguration, + ): CheckoutSession { + val checkoutSessionResult = + CheckoutSessionProvider.createSession(sessionModel, dropInConfiguration) + return when (checkoutSessionResult) { + is CheckoutSessionResult.Success -> checkoutSessionResult.checkoutSession + is CheckoutSessionResult.Error -> throw checkoutSessionResult.exception } - - val model = PlatformCommunicationModel( - PlatformCommunicationType.PAYMENTCOMPONENT, - data = message.contentIfNotHandled.toString(), - ) - checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} } - } - private fun setAdvanceFlowDropInAdditionalDetailsMessengerObserver() { - DropInAdditionalDetailsPlatformMessenger.instance().removeObservers(activity) - DropInAdditionalDetailsPlatformMessenger.instance().observe(activity) { message -> - if (message.hasBeenHandled()) { - return@observe + private fun setAdvancedFlowDropInServiceObserver() { + DropInServiceResultMessenger.instance().removeObservers(activity) + DropInServiceResultMessenger.instance().observe(activity) { message -> + if (message.hasBeenHandled()) { + return@observe + } + + val model = PlatformCommunicationModel( + PlatformCommunicationType.PAYMENTCOMPONENT, + data = message.contentIfNotHandled.toString(), + ) + checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} } + } - val model = PlatformCommunicationModel( - PlatformCommunicationType.ADDITIONALDETAILS, - data = message.contentIfNotHandled.toString(), - ) - checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} + private fun setAdvanceFlowDropInAdditionalDetailsMessengerObserver() { + DropInAdditionalDetailsPlatformMessenger.instance().removeObservers(activity) + DropInAdditionalDetailsPlatformMessenger.instance().observe(activity) { message -> + if (message.hasBeenHandled()) { + return@observe + } + + val model = PlatformCommunicationModel( + PlatformCommunicationType.ADDITIONALDETAILS, + data = message.contentIfNotHandled.toString(), + ) + checkoutFlutterApi?.onDropInAdvancedFlowPlatformCommunication(model) {} + } } - } - private fun checkForFlutterFragmentActivity() { - if (!this::activity.isInitialized) { - throw Exception(WRONG_FLUTTER_ACTIVITY_USAGE_ERROR_MESSAGE) + private fun checkForFlutterFragmentActivity() { + if (!this::activity.isInitialized) { + throw Exception(WRONG_FLUTTER_ACTIVITY_USAGE_ERROR_MESSAGE) + } } - } - //Gift cards will be supported in a later version - private fun removeGiftCardPaymentMethods(paymentMethodsResponse: PaymentMethodsApiResponse): PaymentMethodsApiResponse { - val giftCardTypeIdentifier = "giftcard" - val storedPaymentMethods = - paymentMethodsResponse.storedPaymentMethods?.filterNot { it.type == giftCardTypeIdentifier } - val paymentMethods = - paymentMethodsResponse.paymentMethods?.filterNot { it.type == giftCardTypeIdentifier } - - return PaymentMethodsApiResponse( - storedPaymentMethods = storedPaymentMethods, - paymentMethods = paymentMethods - ) + // Gift cards will be supported in a later version + private fun removeGiftCardPaymentMethods( + paymentMethodsResponse: PaymentMethodsApiResponse + ): PaymentMethodsApiResponse { + val giftCardTypeIdentifier = "giftcard" + val storedPaymentMethods = + paymentMethodsResponse.storedPaymentMethods?.filterNot { it.type == giftCardTypeIdentifier } + val paymentMethods = + paymentMethodsResponse.paymentMethods?.filterNot { it.type == giftCardTypeIdentifier } + + return PaymentMethodsApiResponse( + storedPaymentMethods = storedPaymentMethods, + paymentMethods = paymentMethods + ) + } } -} diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/PlatformApi.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/PlatformApi.kt index 5b0559c..2957598 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/PlatformApi.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/PlatformApi.kt @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// Autogenerated from Pigeon (v11.0.1), do not edit directly. // See also: https://pub.dev/packages/pigeon diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt index 5362117..cccafb2 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt @@ -1,8 +1,7 @@ package com.adyen.adyen_checkout.dropInAdvancedFlow - import DropInResult -import DropInResultType.* +import DropInResultType import android.content.Intent import android.os.IBinder import androidx.lifecycle.Lifecycle @@ -83,15 +82,17 @@ class AdvancedFlowDropInService : DropInService(), LifecycleOwner { private fun mapToDropInResult(dropInResult: DropInResult?): DropInServiceResult { return when (dropInResult?.dropInResultType) { - FINISHED -> DropInServiceResult.Finished(result = "${dropInResult.result}") + DropInResultType.FINISHED -> DropInServiceResult.Finished( + result = "${dropInResult.result}" + ) - ERROR -> DropInServiceResult.Error( + DropInResultType.ERROR -> DropInServiceResult.Error( errorDialog = null, reason = dropInResult.error?.reason, dismissDropIn = dropInResult.error?.dismissDropIn ?: false ) - ACTION -> { + DropInResultType.ACTION -> { if (dropInResult.actionResponse == null) { DropInServiceResult.Error( errorDialog = null, @@ -141,4 +142,3 @@ class AdvancedFlowDropInService : DropInService(), LifecycleOwner { override val lifecycle: Lifecycle get() = dispatcher.lifecycle } - diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Constants.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Constants.kt index b85cefb..d4cbe2c 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Constants.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/utils/Constants.kt @@ -5,4 +5,4 @@ class Constants { const val WRONG_FLUTTER_ACTIVITY_USAGE_ERROR_MESSAGE = "FlutterFragmentActivity not used. Your activity needs to inherit from FlutterFragmentActivity." } -} \ No newline at end of file +} diff --git a/ios/Classes/PlatformApi.swift b/ios/Classes/PlatformApi.swift index 33a473e..0cace8a 100644 --- a/ios/Classes/PlatformApi.swift +++ b/ios/Classes/PlatformApi.swift @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// Autogenerated from Pigeon (v11.0.1), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation diff --git a/lib/platform_api.g.dart b/lib/platform_api.g.dart index 6980e9a..5512b87 100644 --- a/lib/platform_api.g.dart +++ b/lib/platform_api.g.dart @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v11.0.0), do not edit directly. +// Autogenerated from Pigeon (v11.0.1), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import --- android/.editorconfig | 23 +++++++++++-------- .../adyen_checkout/AdyenCheckoutPlugin.kt | 1 - .../AdvancedFlowDropInService.kt | 12 +++++----- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/android/.editorconfig b/android/.editorconfig index c04ece5d..911c5a67 100644 --- a/android/.editorconfig +++ b/android/.editorconfig @@ -106,7 +106,7 @@ ij_java_for_statement_wrap = off ij_java_generate_final_locals = false ij_java_generate_final_parameters = false ij_java_if_brace_force = never -ij_java_imports_layout = $android.**,$androidx.**,$com.**,$junit.**,$net.**,$org.**,$java.**,$javax.**,$*,|,android.**,|,androidx.**,|,com.**,|,junit.**,|,net.**,|,org.**,|,java.**,|,javax.**,|,*,| +ij_java_imports_layout = $android.**, $androidx.**, $com.**, $junit.**, $net.**, $org.**, $java.**, $javax.**, $*, |, android.**, |, androidx.**, |, com.**, |, junit.**, |, net.**, |, org.**, |, java.**, |, javax.**, |, *, | ij_java_indent_case_from_switch = true ij_java_insert_inner_class_imports = false ij_java_insert_override_annotation = true @@ -347,7 +347,7 @@ ij_groovy_for_statement_right_paren_on_new_line = false ij_groovy_for_statement_wrap = off ij_groovy_if_brace_force = never ij_groovy_import_annotation_wrap = 2 -ij_groovy_imports_layout = *,|,javax.**,java.**,|,$* +ij_groovy_imports_layout = *, |, javax.**, java.**, |, $* ij_groovy_indent_case_from_switch = true ij_groovy_indent_label_blocks = true ij_groovy_insert_inner_class_imports = false @@ -472,6 +472,7 @@ ij_groovy_wrap_long_lines = false # noinspection EditorConfigKeyCorrectness [{*.kt,*.kts}] +ktlint_code_style = ktlint_official ktlint_standard_import-ordering = disabled ktlint_standard_multiline-if-else = disabled ktlint_standard_trailing-comma-on-call-site = disabled @@ -511,7 +512,7 @@ ij_kotlin_field_annotation_wrap = split_into_lines ij_kotlin_finally_on_new_line = false ij_kotlin_if_rparen_on_new_line = true ij_kotlin_import_nested_classes = false -ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^ +ij_kotlin_imports_layout = *, java.**, javax.**, kotlin.**, ^ ij_kotlin_insert_whitespaces_in_simple_one_line_method = true ij_kotlin_keep_blank_lines_before_right_brace = 2 ij_kotlin_keep_blank_lines_in_code = 2 @@ -529,7 +530,7 @@ ij_kotlin_method_parameters_right_paren_on_new_line = true ij_kotlin_method_parameters_wrap = on_every_item ij_kotlin_name_count_to_use_star_import = 2147483647 ij_kotlin_name_count_to_use_star_import_for_members = 2147483647 -ij_kotlin_packages_to_use_import_on_demand = kotlinx.android.synthetic.**,io.ktor.** +ij_kotlin_packages_to_use_import_on_demand = kotlinx.android.synthetic.**, io.ktor.** ij_kotlin_parameter_annotation_wrap = off ij_kotlin_space_after_comma = true ij_kotlin_space_after_extend_colon = true @@ -574,22 +575,22 @@ ij_json_spaces_within_brackets = false ij_json_wrap_long_lines = false [{*.htm,*.html,*.sht,*.shtm,*.shtml}] -ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 +ij_html_add_new_line_before_tags = body, div, p, form, h1, h2, h3 ij_html_align_attributes = true ij_html_align_text = false ij_html_attribute_wrap = normal ij_html_block_comment_at_first_column = true ij_html_do_not_align_children_of_min_lines = 0 -ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p -ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot +ij_html_do_not_break_if_inline_tags = title, h1, h2, h3, h4, h5, h6, p +ij_html_do_not_indent_children_of_tags = html, body, thead, tbody, tfoot ij_html_enforce_quotes = false -ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var +ij_html_inline_tags = a, abbr, acronym, b, basefont, bdo, big, br, cite, cite, code, dfn, em, font, i, img, input, kbd, label, q, s, samp, select, small, span, strike, strong, sub, sup, textarea, tt, u, var ij_html_keep_blank_lines = 2 ij_html_keep_indents_on_empty_lines = false ij_html_keep_line_breaks = true ij_html_keep_line_breaks_in_text = true ij_html_keep_whitespaces = false -ij_html_keep_whitespaces_inside = span,pre,textarea +ij_html_keep_whitespaces_inside = span, pre, textarea ij_html_line_comment_at_first_column = true ij_html_new_line_after_last_attribute = never ij_html_new_line_before_first_attribute = never @@ -612,3 +613,7 @@ ij_yaml_sequence_on_new_line = false ij_yaml_space_before_colon = false ij_yaml_spaces_within_braces = true ij_yaml_spaces_within_brackets = true + + +[{PlatformApi.kt,PlatformApi.kts}] +ktlint_standard = disabled diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt index ee0e3764..74e635dc 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/AdyenCheckoutPlugin.kt @@ -21,7 +21,6 @@ import io.flutter.embedding.engine.plugins.FlutterPlugin import io.flutter.embedding.engine.plugins.activity.ActivityAware import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding import io.flutter.embedding.engine.plugins.lifecycle.HiddenLifecycleReference -import DropInResult as FlutterDropInResult /** AdyenCheckoutPlugin */ class AdyenCheckoutPlugin : FlutterPlugin, ActivityAware { diff --git a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt index 5362117b..cccafb20 100644 --- a/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt +++ b/android/src/main/kotlin/com/adyen/adyen_checkout/dropInAdvancedFlow/AdvancedFlowDropInService.kt @@ -1,8 +1,7 @@ package com.adyen.adyen_checkout.dropInAdvancedFlow - import DropInResult -import DropInResultType.* +import DropInResultType import android.content.Intent import android.os.IBinder import androidx.lifecycle.Lifecycle @@ -83,15 +82,17 @@ class AdvancedFlowDropInService : DropInService(), LifecycleOwner { private fun mapToDropInResult(dropInResult: DropInResult?): DropInServiceResult { return when (dropInResult?.dropInResultType) { - FINISHED -> DropInServiceResult.Finished(result = "${dropInResult.result}") + DropInResultType.FINISHED -> DropInServiceResult.Finished( + result = "${dropInResult.result}" + ) - ERROR -> DropInServiceResult.Error( + DropInResultType.ERROR -> DropInServiceResult.Error( errorDialog = null, reason = dropInResult.error?.reason, dismissDropIn = dropInResult.error?.dismissDropIn ?: false ) - ACTION -> { + DropInResultType.ACTION -> { if (dropInResult.actionResponse == null) { DropInServiceResult.Error( errorDialog = null, @@ -141,4 +142,3 @@ class AdvancedFlowDropInService : DropInService(), LifecycleOwner { override val lifecycle: Lifecycle get() = dispatcher.lifecycle } -