processout / processout-ios

MIT License
3 stars 7 forks source link

React native integration #254

Closed sergey-shablenko closed 7 months ago

sergey-shablenko commented 7 months ago

I want to use this sdk with react-native, could you provide detailed installation instructions for this package? Im not a swift developer, it is not really obvious what to do and how to use it

andrii-vysotskyi-cko commented 7 months ago

Hi @sergey-shablenko , thank you for the question. Unfortunately we don't offer official support for React-Native but there is a React-Native documentation that may help. Could you please check it?

Please note, that adding wrappers and integrating iOS SDK may not be sufficient and you may need integrating Android SDK as well if it's supported platform.

sergey-shablenko commented 7 months ago

I followed that doc, is there any way to skip processout assets during build phase? There is an error I have during build

Multiple commands produce '/Library/Developer/Xcode/DerivedData/project-id/Build/Products/Debug-iphonesimulator/my-awesome.app/Assets.car'

tried to do this

installer.pods_project.targets.each do |target|
      if target.name == 'ProcessOut'
        target.build_phases.each do |phase|
          if phase.is_a?(Xcodeproj::Project::Object::PBXResourcesBuildPhase)
            phase.files_references.each do |file_ref|
              phase.remove_file_reference(file_ref)
            end
          end
        end
      end
    end
sergey-shablenko commented 7 months ago

I think I found a fix

image

could you follow last solution from this article https://dev.to/kylefoo/xcode-12-new-build-system-warns-multiple-commands-produce-assets-car-56im and update your podspec to use resource_bundles?

sergey-shablenko commented 7 months ago

here is a patch I made, project builds successfully and starts, not sure if I missed anything, I do not really use Processout native ui, so styling might be off

Subject: [PATCH] new: switch to resource_bundles
new: switch to resource_bundles
new: switch to resource_bundles
new: switch to resource_bundles
---
Index: ProcessOut.podspec
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/ProcessOut.podspec b/ProcessOut.podspec
--- a/ProcessOut.podspec    (revision 21e9e217ab2a75e92eea5884eb8e090e0fac250e)
+++ b/ProcessOut.podspec    (revision 4fafd288f4827adca3cdbc336a9a6b7242d130d5)
@@ -10,7 +10,7 @@
   s.frameworks            = 'Foundation', 'UIKit'
   s.ios.deployment_target = '13.0'
   s.vendored_frameworks   = "Vendor/cmark.xcframework"
-  s.ios.resources         = 'Sources/ProcessOut/Resources/**/*'
+  s.resource_bundles      = { 'ProcessOutResources' => ['Sources/ProcessOut/Resources/**/*'] }
   s.source_files          = 'Sources/ProcessOut/**/*.swift'
   s.pod_target_xcconfig   = { 'OTHER_SWIFT_FLAGS' => '-Xfrontend -module-interface-preserve-types-as-written' }
 end
Index: Sources/ProcessOut/Sources/UI/Modules/NativeAlternativePaymentMethod/Models/Style/PONativeAlternativePaymentMethodBackgroundStyle.swift
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Sources/ProcessOut/Sources/UI/Modules/NativeAlternativePaymentMethod/Models/Style/PONativeAlternativePaymentMethodBackgroundStyle.swift b/Sources/ProcessOut/Sources/UI/Modules/NativeAlternativePaymentMethod/Models/Style/PONativeAlternativePaymentMethodBackgroundStyle.swift
--- a/Sources/ProcessOut/Sources/UI/Modules/NativeAlternativePaymentMethod/Models/Style/PONativeAlternativePaymentMethodBackgroundStyle.swift   (revision 4fafd288f4827adca3cdbc336a9a6b7242d130d5)
+++ b/Sources/ProcessOut/Sources/UI/Modules/NativeAlternativePaymentMethod/Models/Style/PONativeAlternativePaymentMethodBackgroundStyle.swift   (revision 4ddbc7ea41d28070e544af432bf6e827fb5865be)
@@ -19,7 +19,7 @@

     /// Creates background style instance.
     public init(regular: UIColor? = nil, success: UIColor? = nil) {
-        self.regular = regular ?? UIColor(resource: .Surface.level1)
-        self.success = success ?? UIColor(resource: .Surface.success)
+        self.regular = regular ?? UIColor.resourceColor(named: "SurfaceLevel1")
+        self.success = success ?? UIColor.resourceColor(named: "SurfaceSuccess")
     }
 }
Index: Sources/ProcessOut/Sources/UI/Modules/NativeAlternativePaymentMethod/Models/Style/PONativeAlternativePaymentMethodStyle.swift
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Sources/ProcessOut/Sources/UI/Modules/NativeAlternativePaymentMethod/Models/Style/PONativeAlternativePaymentMethodStyle.swift b/Sources/ProcessOut/Sources/UI/Modules/NativeAlternativePaymentMethod/Models/Style/PONativeAlternativePaymentMethodStyle.swift
--- a/Sources/ProcessOut/Sources/UI/Modules/NativeAlternativePaymentMethod/Models/Style/PONativeAlternativePaymentMethodStyle.swift (revision 4fafd288f4827adca3cdbc336a9a6b7242d130d5)
+++ b/Sources/ProcessOut/Sources/UI/Modules/NativeAlternativePaymentMethod/Models/Style/PONativeAlternativePaymentMethodStyle.swift (revision 4ddbc7ea41d28070e544af432bf6e827fb5865be)
@@ -82,21 +82,21 @@
     // MARK: - Private Nested Types

     private enum Constants {
-        static let title = POTextStyle(color: UIColor(resource: .Text.primary), typography: .Medium.title)
+        static let title = POTextStyle(color: UIColor.resourceColor(named: "TextPrimary"), typography: .Medium.title)
         static let sectionTitle = POTextStyle(
-            color: UIColor(resource: .Text.secondary), typography: .Fixed.labelHeading
+            color: UIColor.resourceColor(named: "TextSecondary"), typography: .Fixed.labelHeading
         )
         static let input = POInputStyle.default()
         static let codeInput = POInputStyle.default(typography: .Medium.title)
         static let radioButton = PORadioButtonStyle.default
-        static let errorDescription = POTextStyle(color: UIColor(resource: .Text.error), typography: .Fixed.label)
+        static let errorDescription = POTextStyle(color: UIColor.resourceColor(named: "TextError"), typography: .Fixed.label)
         static let actions = POActionsContainerStyle()
         static let activityIndicator = POActivityIndicatorStyle.system(
-            .large, color: UIColor(resource: .Text.secondary)
+            .large, color: UIColor.resourceColor(named: "TextSecondary")
         )
-        static let message = POTextStyle(color: UIColor(resource: .Text.primary), typography: .Fixed.body)
-        static let successMessage = POTextStyle(color: UIColor(resource: .Text.success), typography: .Fixed.body)
+        static let message = POTextStyle(color: UIColor.resourceColor(named: "TextPrimary"), typography: .Fixed.body)
+        static let successMessage = POTextStyle(color: UIColor.resourceColor(named: "TextSuccess"), typography: .Fixed.body)
         static let background = PONativeAlternativePaymentMethodBackgroundStyle()
-        static let separatorColor = UIColor(resource: .Border.subtle)
+        static let separatorColor = UIColor.resourceColor(named: "BorderSubtle")
     }
 }
Index: Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Styles/Input/POInputStyle.swift
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Styles/Input/POInputStyle.swift b/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Styles/Input/POInputStyle.swift
--- a/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Styles/Input/POInputStyle.swift (revision 4fafd288f4827adca3cdbc336a9a6b7242d130d5)
+++ b/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Styles/Input/POInputStyle.swift (revision 4ddbc7ea41d28070e544af432bf6e827fb5865be)
@@ -32,20 +32,20 @@
     public static func `default`(typography: POTypography? = nil) -> POInputStyle {
         POInputStyle(
             normal: POInputStateStyle(
-                text: .init(color: UIColor(resource: .Text.primary), typography: typography ?? .Fixed.label),
-                placeholder: .init(color: UIColor(resource: .Text.muted), typography: typography ?? .Fixed.label),
-                backgroundColor: UIColor(resource: .Surface.background),
-                border: .regular(radius: 8, color: UIColor(resource: .Border.default)),
+                text: .init(color: UIColor.resourceColor(named: "TextPrimary"), typography: typography ?? .Fixed.label),
+                placeholder: .init(color: UIColor.resourceColor(named: "TextMuted"), typography: typography ?? .Fixed.label),
+                backgroundColor: UIColor.resourceColor(named: "SurfaceBackground"),
+                border: .regular(radius: 8, color: UIColor.resourceColor(named: "BorderDefault")),
                 shadow: .clear,
-                tintColor: UIColor(resource: .Text.primary)
+                tintColor: UIColor.resourceColor(named: "TextPrimary")
             ),
             error: POInputStateStyle(
-                text: .init(color: UIColor(resource: .Text.primary), typography: typography ?? .Fixed.label),
-                placeholder: .init(color: UIColor(resource: .Text.muted), typography: typography ?? .Fixed.label),
-                backgroundColor: UIColor(resource: .Surface.background),
-                border: .regular(radius: 8, color: UIColor(resource: .Text.error)),
+                text: .init(color: UIColor.resourceColor(named: "TextPrimary"), typography: typography ?? .Fixed.label),
+                placeholder: .init(color: UIColor.resourceColor(named: "TextMuted"), typography: typography ?? .Fixed.label),
+                backgroundColor: UIColor.resourceColor(named: "SurfaceBackground"),
+                border: .regular(radius: 8, color: UIColor.resourceColor(named: "TextError")),
                 shadow: .clear,
-                tintColor: UIColor(resource: .Text.error)
+                tintColor: UIColor.resourceColor(named: "TextError")
             )
         )
     }
Index: Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/ActionsContainer/POActionsContainerStyle.swift
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/ActionsContainer/POActionsContainerStyle.swift b/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/ActionsContainer/POActionsContainerStyle.swift
--- a/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/ActionsContainer/POActionsContainerStyle.swift    (revision 4fafd288f4827adca3cdbc336a9a6b7242d130d5)
+++ b/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/ActionsContainer/POActionsContainerStyle.swift    (revision 4ddbc7ea41d28070e544af432bf6e827fb5865be)
@@ -36,7 +36,7 @@
         self.primary = primary ?? .primary
         self.secondary = secondary ?? .secondary
         self.axis = axis ?? .vertical
-        self.separatorColor = separatorColor ?? UIColor(resource: .Border.subtle)
-        self.backgroundColor = backgroundColor ?? UIColor(resource: .Surface.level1)
+        self.separatorColor = separatorColor ?? UIColor.resourceColor(named: "BorderSubtle")
+        self.backgroundColor = backgroundColor ?? UIColor.resourceColor(named: "SurfaceLevel1")
     }
 }
Index: Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/Button/POButtonStyle.swift
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/Button/POButtonStyle.swift b/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/Button/POButtonStyle.swift
--- a/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/Button/POButtonStyle.swift    (revision 4fafd288f4827adca3cdbc336a9a6b7242d130d5)
+++ b/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/Button/POButtonStyle.swift    (revision 4ddbc7ea41d28070e544af432bf6e827fb5865be)
@@ -35,52 +35,61 @@
     }
 }

+let bundlePath = Bundle.main.path(forResource: "ProcessOutResources", ofType: "bundle")
+let resourceBundle = Bundle(path: bundlePath!)
+
+extension UIColor {
+    static func resourceColor(named name: String) -> UIColor {
+        return UIColor(named: name, in: resourceBundle, compatibleWith: nil) ?? UIColor.black // Provide a fallback color
+    }
+}
+
 extension POButtonStyle {

     /// Default style for primary button.
     public static let primary = POButtonStyle(
         normal: .init(
-            title: .init(color: UIColor(resource: .Text.on), typography: .Fixed.button),
+            title: .init(color: UIColor.resourceColor(named: "TextOn"), typography: .Fixed.button),
             border: .clear(radius: 8),
             shadow: .clear,
-            backgroundColor: UIColor(resource: .Action.Primary.default)
+            backgroundColor: UIColor.resourceColor(named: "ActionPrimaryDefault")
         ),
         highlighted: .init(
-            title: .init(color: UIColor(resource: .Text.on), typography: .Fixed.button),
+            title: .init(color: UIColor.resourceColor(named: "TextOn"), typography: .Fixed.button),
             border: .clear(radius: 8),
             shadow: .clear,
-            backgroundColor: UIColor(resource: .Action.Primary.pressed)
+            backgroundColor: UIColor.resourceColor(named: "ActionPrimaryPressed")
         ),
         disabled: .init(
-            title: .init(color: UIColor(resource: .Text.disabled), typography: .Fixed.button),
+            title: .init(color: UIColor.resourceColor(named: "TextDisabled"), typography: .Fixed.button),
             border: .clear(radius: 8),
             shadow: .clear,
-            backgroundColor: UIColor(resource: .Action.Primary.disabled)
+            backgroundColor: UIColor.resourceColor(named: "ActionPrimaryDisabled")
         ),
-        activityIndicator: activityIndicatorStyle(color: UIColor(resource: .Text.on))
+        activityIndicator: activityIndicatorStyle(color: UIColor.resourceColor(named: "TextOn"))
     )

     /// Default style for secondary button.
     public static let secondary = POButtonStyle(
         normal: .init(
-            title: .init(color: UIColor(resource: .Text.secondary), typography: .Fixed.button),
-            border: .regular(radius: 8, color: UIColor(resource: .Border.default)),
+            title: .init(color: UIColor.resourceColor(named: "TextSecondary"), typography: .Fixed.button),
+            border: .regular(radius: 8, color: UIColor.resourceColor(named: "BorderDefault")),
             shadow: .clear,
-            backgroundColor: UIColor(resource: .Action.Secondary.default)
+            backgroundColor: UIColor.resourceColor(named: "ActionSecondaryDefault")
         ),
         highlighted: .init(
-            title: .init(color: UIColor(resource: .Text.secondary), typography: .Fixed.button),
-            border: .regular(radius: 8, color: UIColor(resource: .Border.default)),
+            title: .init(color: UIColor.resourceColor(named: "TextSecondary"), typography: .Fixed.button),
+            border: .regular(radius: 8, color: UIColor.resourceColor(named: "BorderDefault")),
             shadow: .clear,
-            backgroundColor: UIColor(resource: .Action.Secondary.pressed)
+            backgroundColor: UIColor.resourceColor(named: "ActionSecondaryPressed")
         ),
         disabled: .init(
-            title: .init(color: UIColor(resource: .Text.disabled), typography: .Fixed.button),
-            border: .regular(radius: 8, color: UIColor(resource: .Action.Border.disabled)),
+            title: .init(color: UIColor.resourceColor(named: "TextDisabled"), typography: .Fixed.button),
+            border: .regular(radius: 8, color: UIColor.resourceColor(named: "ActionBorderDisabled")),
             shadow: .clear,
             backgroundColor: .clear
         ),
-        activityIndicator: activityIndicatorStyle(color: UIColor(resource: .Text.secondary))
+        activityIndicator: activityIndicatorStyle(color: UIColor.resourceColor(named: "TextSecondary"))
     )

     // MARK: - Private Methods
Index: Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/Picker/Picker.swift
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/Picker/Picker.swift b/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/Picker/Picker.swift
--- a/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/Picker/Picker.swift   (revision 4fafd288f4827adca3cdbc336a9a6b7242d130d5)
+++ b/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/Picker/Picker.swift   (revision a22fbce4949735b4c7542ba868eb0b8b30b6993e)
@@ -76,7 +76,10 @@
     }()

     private lazy var iconImageView: UIImageView = {
-        let imageView = UIImageView(image: UIImage(resource: .chevronDown).withRenderingMode(.alwaysTemplate))
+        let bundlePath = Bundle.main.path(forResource: "ProcessOutResources", ofType: "bundle")
+        let bundle = Bundle(path: bundlePath!)
+        let image = UIImage(named: "ChevronDown", in: bundle, compatibleWith: nil)?.withRenderingMode(.alwaysTemplate)
+        let imageView = UIImageView(image: image)
         imageView.translatesAutoresizingMaskIntoConstraints = false
         imageView.setContentHuggingPriority(.required, for: .horizontal)
         imageView.setContentCompressionResistancePriority(.required, for: .horizontal)
Index: Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/RadioButton/PORadioButtonStyle.swift
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/RadioButton/PORadioButtonStyle.swift b/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/RadioButton/PORadioButtonStyle.swift
--- a/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/RadioButton/PORadioButtonStyle.swift  (revision 4fafd288f4827adca3cdbc336a9a6b7242d130d5)
+++ b/Sources/ProcessOut/Sources/UI/Shared/DesignSystem/Views/RadioButton/PORadioButtonStyle.swift  (revision 4ddbc7ea41d28070e544af432bf6e827fb5865be)
@@ -43,7 +43,7 @@
         normal: .init(
             knob: .init(
                 backgroundColor: .clear,
-                border: .regular(radius: 0, color: UIColor(resource: .Border.default)),
+                border: .regular(radius: 0, color: UIColor.resourceColor(named: "BorderDefault")),
                 innerCircleColor: .clear,
                 innerCircleRadius: 0
             ),
@@ -52,8 +52,8 @@
         selected: .init(
             knob: .init(
                 backgroundColor: .clear,
-                border: .regular(radius: 0, color: UIColor(resource: .Action.Primary.default)),
-                innerCircleColor: UIColor(resource: .Action.Primary.default),
+                border: .regular(radius: 0, color: UIColor.resourceColor(named: "ActionPrimaryDefault")),
+                innerCircleColor: UIColor.resourceColor(named: "ActionPrimaryDefault"),
                 innerCircleRadius: 4
             ),
             value: valueStyle
@@ -61,7 +61,7 @@
         highlighted: .init(
             knob: .init(
                 backgroundColor: .clear,
-                border: .regular(radius: 0, color: UIColor(resource: .Text.muted)),
+                border: .regular(radius: 0, color: UIColor.resourceColor(named: "TextMuted")),
                 innerCircleColor: .clear,
                 innerCircleRadius: 0
             ),
@@ -70,7 +70,7 @@
         error: .init(
             knob: .init(
                 backgroundColor: .clear,
-                border: .regular(radius: 0, color: UIColor(resource: .Text.error)),
+                border: .regular(radius: 0, color: UIColor.resourceColor(named: "TextError")),
                 innerCircleColor: .clear,
                 innerCircleRadius: 0
             ),
@@ -80,5 +80,5 @@

     // MARK: - Private Properties

-    private static let valueStyle = POTextStyle(color: UIColor(resource: .Text.primary), typography: .Fixed.label)
+    private static let valueStyle = POTextStyle(color: UIColor.resourceColor(named: "TextPrimary"), typography: .Fixed.label)
 }
Index: Sources/ProcessOutCoreUI/Sources/DesignSystem/CodeTextField/CodeFieldComponentView.swift
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Sources/ProcessOutCoreUI/Sources/DesignSystem/CodeTextField/CodeFieldComponentView.swift b/Sources/ProcessOutCoreUI/Sources/DesignSystem/CodeTextField/CodeFieldComponentView.swift
--- a/Sources/ProcessOutCoreUI/Sources/DesignSystem/CodeTextField/CodeFieldComponentView.swift  (revision 4fafd288f4827adca3cdbc336a9a6b7242d130d5)
+++ b/Sources/ProcessOutCoreUI/Sources/DesignSystem/CodeTextField/CodeFieldComponentView.swift  (revision 4ddbc7ea41d28070e544af432bf6e827fb5865be)
@@ -59,14 +59,14 @@
                     builder.typography = viewModel.style.text.typography
                     builder.maximumFontSize = Constants.maximumFontSize
                     builder.alignment = .center
-                    builder.color = UIColor(viewModel.style.text.color)
+                    builder.color = UIColor.resourceColor(named: viewModel.style.text.color)
                     builder.text = .plain(viewModel.value.map(String.init) ?? "")
                 }
                 .build()
             if animated, valueLabel.attributedText != previousAttributedText {
                 valueLabel.addTransitionAnimation()
             }
-            carretView.backgroundColor = UIColor(viewModel.style.tintColor)
+            carretView.backgroundColor = UIColor.resourceColor(named: viewModel.style.tintColor)
             UIView.performWithoutAnimation(layoutIfNeeded)
         }
         currentViewModel = viewModel
Index: Sources/ProcessOutCoreUI/Sources/DesignSystem/Markdown/POMarkdown.swift
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Sources/ProcessOutCoreUI/Sources/DesignSystem/Markdown/POMarkdown.swift b/Sources/ProcessOutCoreUI/Sources/DesignSystem/Markdown/POMarkdown.swift
--- a/Sources/ProcessOutCoreUI/Sources/DesignSystem/Markdown/POMarkdown.swift   (revision 4fafd288f4827adca3cdbc336a9a6b7242d130d5)
+++ b/Sources/ProcessOutCoreUI/Sources/DesignSystem/Markdown/POMarkdown.swift   (revision 4ddbc7ea41d28070e544af432bf6e827fb5865be)
@@ -59,7 +59,7 @@
             .with { builder in
                 builder.typography = style.typography
                 builder.sizeCategory = UIContentSizeCategory(sizeCategory)
-                builder.color = UIColor(style.color)
+                builder.color = UIColor.resourceColor(named: style.color)
                 builder.lineBreakMode = .byWordWrapping
                 builder.alignment = NSTextAlignment(multilineTextAlignment)
                 builder.text = .markdown(string)
Index: Sources/ProcessOutCoreUI/Sources/DesignSystem/TextField/POTextField.swift
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Sources/ProcessOutCoreUI/Sources/DesignSystem/TextField/POTextField.swift b/Sources/ProcessOutCoreUI/Sources/DesignSystem/TextField/POTextField.swift
--- a/Sources/ProcessOutCoreUI/Sources/DesignSystem/TextField/POTextField.swift (revision 4fafd288f4827adca3cdbc336a9a6b7242d130d5)
+++ b/Sources/ProcessOutCoreUI/Sources/DesignSystem/TextField/POTextField.swift (revision 4ddbc7ea41d28070e544af432bf6e827fb5865be)
@@ -138,7 +138,7 @@
             .with { builder in
                 builder.typography = style.text.typography
                 builder.sizeCategory = .init(sizeCategory)
-                builder.color = UIColor(style.text.color)
+                builder.color = UIColor.resourceColor(named: style.text.color)
             }
             .buildAttributes()
             .filter { Constants.includedTextAttributes.contains($0.key) }
@@ -150,7 +150,7 @@
             .with { builder in
                 builder.typography = style.placeholder.typography
                 builder.sizeCategory = .init(sizeCategory)
-                builder.color = UIColor(style.placeholder.color)
+                builder.color = UIColor.resourceColor(named: style.placeholder.color)
             }
             .buildAttributes()
             .filter { Constants.includedTextAttributes.contains($0.key) }
Index: Sources/ProcessOut/Sources/UI/Modules/NativeAlternativePaymentMethod/ViewModel/DefaultNativeAlternativePaymentMethodViewModel.swift
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Sources/ProcessOut/Sources/UI/Modules/NativeAlternativePaymentMethod/ViewModel/DefaultNativeAlternativePaymentMethodViewModel.swift b/Sources/ProcessOut/Sources/UI/Modules/NativeAlternativePaymentMethod/ViewModel/DefaultNativeAlternativePaymentMethodViewModel.swift
--- a/Sources/ProcessOut/Sources/UI/Modules/NativeAlternativePaymentMethod/ViewModel/DefaultNativeAlternativePaymentMethodViewModel.swift   (revision 4ddbc7ea41d28070e544af432bf6e827fb5865be)
+++ b/Sources/ProcessOut/Sources/UI/Modules/NativeAlternativePaymentMethod/ViewModel/DefaultNativeAlternativePaymentMethodViewModel.swift   (revision a22fbce4949735b4c7542ba868eb0b8b30b6993e)
@@ -212,11 +212,13 @@
                     self?.completion?(.success(()))
                 }
             )
+            let bundlePath = Bundle.main.path(forResource: "ProcessOutResources", ofType: "bundle")
+            let bundle = Bundle(path: bundlePath!)
             let submittedItem = State.SubmittedItem(
                 title: capturedState.logoImage == nil ? capturedState.paymentProviderName : nil,
                 logoImage: capturedState.logoImage,
                 message: String(resource: .NativeAlternativePayment.Success.message),
-                image: UIImage(resource: .success),
+                image: UIImage(named: "Success", in: bundle, compatibleWith: nil),
                 isCaptured: true
             )
             let startedState = State.Started(
Index: Sources/ProcessOutUI/Sources/Modules/NativeAlternativePayment/ViewModel/DefaultNativeAlternativePaymentViewModel.swift
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Sources/ProcessOutUI/Sources/Modules/NativeAlternativePayment/ViewModel/DefaultNativeAlternativePaymentViewModel.swift b/Sources/ProcessOutUI/Sources/Modules/NativeAlternativePayment/ViewModel/DefaultNativeAlternativePaymentViewModel.swift
--- a/Sources/ProcessOutUI/Sources/Modules/NativeAlternativePayment/ViewModel/DefaultNativeAlternativePaymentViewModel.swift    (revision 4ddbc7ea41d28070e544af432bf6e827fb5865be)
+++ b/Sources/ProcessOutUI/Sources/Modules/NativeAlternativePayment/ViewModel/DefaultNativeAlternativePaymentViewModel.swift    (revision a22fbce4949735b4c7542ba868eb0b8b30b6993e)
@@ -186,12 +186,14 @@
                     self?.completion?(.success(()))
                 }
             )
+            let bundlePath = Bundle.main.path(forResource: "ProcessOutResources", ofType: "bundle")
+            let bundle = Bundle(path: bundlePath!)
             let item = NativeAlternativePaymentViewModelItem.Submitted(
                 id: "captured",
                 title: state.logoImage == nil ? state.paymentProviderName : nil,
                 logoImage: state.logoImage,
                 message: String(resource: .NativeAlternativePayment.Success.message),
-                image: UIImage(resource: .success),
+                image: UIImage(named: "Success", in: bundle, compatibleWith: nil),
                 isCaptured: true,
                 isProgressViewHidden: true
             )
andrii-vysotskyi-cko commented 7 months ago

could you follow last solution from this article https://dev.to/kylefoo/xcode-12-new-build-system-warns-multiple-commands-produce-assets-car-56im and update your podspec to use resource_bundles?

As for your suggestion we are relying on Asset Symbols Generation that was introduced in Xcode 15. And unfortunately it is not compatible with cocoapod's resource bundle.


Also resource name collisions is only possible when Pod is linked as a static library. Could you please check if forcing dynamic linking will do the thing use_frameworks! :linkage => :dynamic ?

sergey-shablenko commented 7 months ago

could you follow last solution from this article https://dev.to/kylefoo/xcode-12-new-build-system-warns-multiple-commands-produce-assets-car-56im and update your podspec to use resource_bundles?

As for your suggestion we are relying on Asset Symbols Generation that was introduced in Xcode 15. And unfortunately it is not compatible with cocoapod's resource bundle.

Also resource name collisions is only possible when Pod is linked as a static library. Could you please check if forcing dynamic linking will do the thing use_frameworks! :linkage => :dynamic ?

Thanks, unfortunately it does not work, it breaks other project dependencies. I made a fork and ported it to use resource_bundles, it complies and sdk works not sure if there will be any other issues, Im not really using ui, so it should not probably affect main logic will see if there are any issues with 3DS, but tokenization works fine

sergey-shablenko commented 7 months ago

@andrii-vysotskyi-cko sorry I keep bothering you, but Im stuck with this error

image

I have added ProcessOutCheckout3DS to podfile and now trying to build the project, it keeps throwing error regarding swift version, which is really confusing, as processout also uses swift 5.9. My project was initially configured to run on 5.9, in attempts to resolve that issue I updated xcode to 15.3 and swift 5.10 but it did not resolve the issue I also tried to import Checkout3DS before processout, hoping it would be built using my project settings instead of processout Tried to override swift version specifically for Checkout3DS pod, but it also had no effect

sergey-shablenko commented 7 months ago

Im also considering manual integration of processout into my project are there instructions on how to build the project? I need to build .framework file, I do not see such file in your repo

muhammadalizkhan commented 7 months ago

npx pod-install ios npx react-native link Configure SDK, & Use SDK in JavaScript

andrii-vysotskyi-cko commented 7 months ago

I have added ProcessOutCheckout3DS to podfile and now trying to build the project, it keeps throwing error regarding swift version, which is really confusing, as processout also uses swift 5.9.

I doubt that it has something to do with compiler versions, because Checkout3DS (dependency of ProcessOutCheckout3DS) is distributed with Library Evolution enabled, meaning it's compatible with older/newer versions.

Im also considering manual integration of processout into my project. Are there instructions on how to build the project?

We dropped binary frameworks distribution support in 4.8.0. The last version where it was available is 4.7.1. Please check script we used to generate XCFramework.

sergey-shablenko commented 7 months ago

Managed to build with 3DS, had to adjust Podfile to make it work, thanks for your feedback, it pointed me in the right direction I was trying to use dynamic frameworks for whole project, which was breaking other dependencies When I applied dynamic frameworks to processout and its dependencies, it started working


dynamic_frameworks = [
  'ProcessOut',
  'ProcessOutCheckout3DS',
  'Checkout3DS',
  'CheckoutEventLoggerKit',
  'JOSESwift',
  'Checkout3DS-Security'
]

# overriding use_frameworks to be dynamic_framework for pods
  pre_install do |installer|
    installer.pod_targets.each do |pod|
      if dynamic_frameworks.include?(pod.name)
        def pod.dynamic_framework?;
          true
        end
        def pod.build_type;
          Pod::BuildType.dynamic_framework
        end
      end
    end
  end

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      if dynamic_frameworks.include?(target.name)
        target.build_configurations.each do |config|
          config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
          config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'i386  x86_64'
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.4'
        end
      end
    end

    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
  end