{"action":"created","issue":{"url":"https://api.github.com/repos/stripe/stripe-ios/issues/916","repository_url":"https://api.github.com/repos/stripe/stripe-ios","labels_url":"https://api.github.com/repos/stripe/stripe-ios/issues/916/labels{/name}","comments_url":"https://api.github.com/repos/stripe/stripe-ios/issues/916/comments","events_url":"https://api.github.com/repos/stripe/stripe-ios/issues/916/events","html_url":"https://github.com/stripe/stripe-ios/issues/916","id":311943041,"number":916,"title":"Customizing default theme does not work as documented","user":{"login":"Blackjacx","id":794372,"avatar_url":"https://avatars2.githubusercontent.com/u/794372?v=4","gravatar_id":"","url":"https://api.github.com/users/Blackjacx","html_url":"https://github.com/Blackjacx","followers_url":"https://api.github.com/users/Blackjacx/followers","following_url":"https://api.github.com/users/Blackjacx/following{/other_user}","gists_url":"https://api.github.com/users/Blackjacx/gists{/gist_id}","starred_url":"https://api.github.com/users/Blackjacx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Blackjacx/subscriptions","organizations_url":"https://api.github.com/users/Blackjacx/orgs","repos_url":"https://api.github.com/users/Blackjacx/repos","events_url":"https://api.github.com/users/Blackjacx/events{/privacy}","received_events_url":"https://api.github.com/users/Blackjacx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-04-06T11:36:02Z","updated_at":"2018-04-09T17:47:18Z","closed_at":null,"author_association":"NONE","body":"To make it easier to diagnose your issue, please fill out the following:\r\n\r\n## Summary\r\n\r\nCustomizing default theme does not work as documented in https://stripe.com/docs/mobile/ios/standard#theming. What I need to do is the following:\r\n\r\n```\r\n/// Customizes default theme exactly once per app start.\r\n    static let theme: STPTheme = {\r\n        var theme = STPTheme.default()\r\n        theme.primaryBackgroundColor = UIColor.backgroundColor\r\n        theme.secondaryBackgroundColor = UIColor.backgroundColor\r\n        theme.primaryForegroundColor = UIColor.textColor\r\n        theme.secondaryForegroundColor = UIColor.brightTextColor\r\n        theme.accentColor = UIColor.contrast2\r\n        theme.errorColor = UIColor.contrast3\r\n        theme.font = Fonts.body3.font\r\n        theme.emphasisFont = Fonts.body3Medium.font\r\n        return theme\r\n    }()\r\n```\r\n\r\nand then explicitly use that theme for the payment context. Normally I can just leave out the theme  parameter when init the payment ctx. \r\n\r\n## iOS version\r\n\r\niOS 11.3\r\n\r\n## Installation method\r\n\r\nCocoapods\r\n\r\n## SDK version\r\n\r\nThe newest from today\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/stripe/stripe-ios/issues/comments/379836034","html_url":"https://github.com/stripe/stripe-ios/issues/916#issuecomment-379836034","issue_url":"https://api.github.com/repos/stripe/stripe-ios/issues/916","id":379836034,"user":{"login":"Blackjacx","id":794372,"avatar_url":"https://avatars2.githubusercontent.com/u/794372?v=4","gravatar_id":"","url":"https://api.github.com/users/Blackjacx","html_url":"https://github.com/Blackjacx","followers_url":"https://api.github.com/users/Blackjacx/followers","following_url":"https://api.github.com/users/Blackjacx/following{/other_user}","gists_url":"https://api.github.com/users/Blackjacx/gists{/gist_id}","starred_url":"https://api.github.com/users/Blackjacx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Blackjacx/subscriptions","organizations_url":"https://api.github.com/users/Blackjacx/orgs","repos_url":"https://api.github.com/users/Blackjacx/repos","events_url":"https://api.github.com/users/Blackjacx/events{/privacy}","received_events_url":"https://api.github.com/users/Blackjacx/received_events","type":"User","site_admin":false},"created_at":"2018-04-09T17:47:18Z","updated_at":"2018-04-09T17:47:18Z","author_association":"NONE","body":"Nope, as far as I understood static let properties, the theme block is evaluated when the enclosing class is used the first time. And since all I do with stripe is in that class it is evaluated before any UI interaction. What I tried to do is sth like:\r\n\r\n```\r\nSTPTheme.default().primaryBackgroundColor = UIColor.backgroundColor\r\nSTPTheme.default().secondaryBackgroundColor = UIColor.backgroundColor\r\nSTPTheme.default().primaryForegroundColor = UIColor.textColor\r\nSTPTheme.default().secondaryForegroundColor = UIColor.brightTextColor\r\nSTPTheme.default().accentColor = UIColor.contrast2\r\nSTPTheme.default().errorColor = UIColor.contrast3\r\nSTPTheme.default().font = Fonts.body3.font\r\nSTPTheme.default().emphasisFont = Fonts.body3Medium.font\r\n```\r\n\r\nIn my PaymentHandler's initializer and then create the STPPaymentContext using the short format: `STPPaymentContext(customerContext: context)`. But then the payment context used another default theme 😅 not that what I configured. \r\n\r\nWe use a pure Swift app. Could it be that something gets confused with the default values?"}}
{"actor":{"display_login":"Blackjacx"}}