Juanpe

Juanpe

iOS Developer at Domestika

Member Since 9 years ago

@dmstk, Madrid

Experience Points
707
follower
Lessons Completed
41
follow
Lessons Completed
104
stars
Best Reply Awards
52
repos

360 contributions in the last year

Pinned
⚡ ☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting
⚡ Gathering all info published, both by Apple and by others, about new framework SwiftUI.
⚡ Animate easy and with less code with Swift
⚡ Xcode template for VIPER Architecture written in Swift 4
⚡ Easy customizable avatar image asynchronously with progress bar animated
⚡ Sequence Animation to POP Framework. Runs POP Animations sequentially, one after another.
Activity
Jan
18
1 week ago
Activity icon
issue

Juanpe issue comment Juanpe/SkeletonView

Juanpe
Juanpe

Crash in version 1.26 with textLineHeight = .relativeToFont

Description

Hi all, we're experiencing a crash with the new version of the library (1.26.0) with the SkeletonAppearance with textLineHeight = .relativeToFont. The app crashes with "NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds" when calling layoutSkeletonIfNeeded if the UILabel to Skeletonize has nil text or is empty.

What type of issue is this? (place an x in one of the [ ])

  • [x ] bug
  • enhancement (feature request)
  • question
  • documentation related
  • discussion

Requirements (place an x in each of the [ ])

  • [ x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [ x] I've read and agree to the Code of Conduct.
  • [ x] I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

SkeletonView Environment:

**SkeletonView version: 1.26.0 **Xcode version: 13.2.1 **Swift version: Swift 5.5.2

Steps to reproduce:

Please replace this with the steps to reproduce the behavior.

  1. create a label = UILabel() with label.text = nil and set label.isSkeletonable = true
  2. set SkeletonAppearance.default.textLineHeight = .relativeToFont
  3. call showSkeleton() on the label
  4. the app crashes on the line 94 of SkeletonTextNode.swift: if let attributes = attributedText?.attributes(at: 0, effectiveRange: nil)

Expected result:

The app shouldn't crash.

Actual result:

The app crashes with "NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds"

Attachments:

I suggest this edit at line 93 of SkeletonTextNode.swift:

var fontLineHeight: CGFloat? {
    if let attributedText = attributedText,
       attributedText.string.count > 0,
       let fontAttribute = attributedText.attributes(at: 0, effectiveRange: nil).first(where: { $0.key == .font }) {
        return fontAttribute.value as? CGFloat ?? font.lineHeight
    } else {
        return font.lineHeight
    }
}
Juanpe
Juanpe

This fix was fixed in the version 1.29.2. Thanks for reporting 👍🏼

Activity icon
delete

Juanpe in Juanpe/SkeletonView delete branch fix/crash_when_text_is_nil

deleted time in 1 week ago
pull request

Juanpe pull request Juanpe/SkeletonView

Juanpe
Juanpe

Fix crash when text is empty

Summary

Resolves #482

Now, if a label or textView is empty the app crashes. So, I check if the text is not empty before to get the attributes to estimate the number of lines.

Activity icon
issue

Juanpe issue Juanpe/SkeletonView

Juanpe
Juanpe

Crash in version 1.26 with textLineHeight = .relativeToFont

Description

Hi all, we're experiencing a crash with the new version of the library (1.26.0) with the SkeletonAppearance with textLineHeight = .relativeToFont. The app crashes with "NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds" when calling layoutSkeletonIfNeeded if the UILabel to Skeletonize has nil text or is empty.

What type of issue is this? (place an x in one of the [ ])

  • [x ] bug
  • enhancement (feature request)
  • question
  • documentation related
  • discussion

Requirements (place an x in each of the [ ])

  • [ x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [ x] I've read and agree to the Code of Conduct.
  • [ x] I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

SkeletonView Environment:

**SkeletonView version: 1.26.0 **Xcode version: 13.2.1 **Swift version: Swift 5.5.2

Steps to reproduce:

Please replace this with the steps to reproduce the behavior.

  1. create a label = UILabel() with label.text = nil and set label.isSkeletonable = true
  2. set SkeletonAppearance.default.textLineHeight = .relativeToFont
  3. call showSkeleton() on the label
  4. the app crashes on the line 94 of SkeletonTextNode.swift: if let attributes = attributedText?.attributes(at: 0, effectiveRange: nil)

Expected result:

The app shouldn't crash.

Actual result:

The app crashes with "NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds"

Attachments:

I suggest this edit at line 93 of SkeletonTextNode.swift:

var fontLineHeight: CGFloat? {
    if let attributedText = attributedText,
       attributedText.string.count > 0,
       let fontAttribute = attributedText.attributes(at: 0, effectiveRange: nil).first(where: { $0.key == .font }) {
        return fontAttribute.value as? CGFloat ?? font.lineHeight
    } else {
        return font.lineHeight
    }
}
pull request

Juanpe pull request Juanpe/SkeletonView

Juanpe
Juanpe

Fix crash when text is empty

Summary

Resolves #482

Now, if a label or textView is empty the app crashes. So, I check if the text is not empty before to get the attributes to estimate the number of lines.

Activity icon
created branch

Juanpe in Juanpe/SkeletonView create branch fix/crash_when_text_is_nil

createdAt 1 week ago
Activity icon
issue

Juanpe issue comment Juanpe/SkeletonView

Juanpe
Juanpe

Crash in version 1.26 with textLineHeight = .relativeToFont

Description

Hi all, we're experiencing a crash with the new version of the library (1.26.0) with the SkeletonAppearance with textLineHeight = .relativeToFont. The app crashes with "NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds" when calling layoutSkeletonIfNeeded if the UILabel to Skeletonize has nil text or is empty.

What type of issue is this? (place an x in one of the [ ])

  • [x ] bug
  • enhancement (feature request)
  • question
  • documentation related
  • discussion

Requirements (place an x in each of the [ ])

  • [ x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [ x] I've read and agree to the Code of Conduct.
  • [ x] I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

SkeletonView Environment:

**SkeletonView version: 1.26.0 **Xcode version: 13.2.1 **Swift version: Swift 5.5.2

Steps to reproduce:

Please replace this with the steps to reproduce the behavior.

  1. create a label = UILabel() with label.text = nil and set label.isSkeletonable = true
  2. set SkeletonAppearance.default.textLineHeight = .relativeToFont
  3. call showSkeleton() on the label
  4. the app crashes on the line 94 of SkeletonTextNode.swift: if let attributes = attributedText?.attributes(at: 0, effectiveRange: nil)

Expected result:

The app shouldn't crash.

Actual result:

The app crashes with "NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds"

Attachments:

I suggest this edit at line 93 of SkeletonTextNode.swift:

var fontLineHeight: CGFloat? {
    if let attributedText = attributedText,
       attributedText.string.count > 0,
       let fontAttribute = attributedText.attributes(at: 0, effectiveRange: nil).first(where: { $0.key == .font }) {
        return fontAttribute.value as? CGFloat ?? font.lineHeight
    } else {
        return font.lineHeight
    }
}
Juanpe
Juanpe

Hi @dtamiazzo 👋🏼 Thanks for reporting this issue.

Good catch! I'll fix it asap 👍🏼

Jan
17
1 week ago
Activity icon
delete

Juanpe in Juanpe/purchases-ios delete branch purchase_package_check_if_thrown_error_is_StoreKitError

deleted time in 1 week ago
Activity icon
issue

Juanpe issue comment Juanpe/SkeletonView

Juanpe
Juanpe

HideSkeleton() does not apply transition within a UITableView

Description

The transition is broken when doing HideSkeleton(transition: .crossDisolve(TIME)) when the views is within a UITableView.

Same thing in Example app.

What type of issue is this? (place an x in one of the [ ])

  • [ X ] bug
  • enhancement (feature request)
  • question
  • documentation related
  • discussion

Requirements (place an x in each of the [ ])

  • [ X ] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [X ] I've read and agree to the Code of Conduct.
  • [X ] I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

SkeletonView Environment:

SkeletonView version: 1.26.0 Xcode version: 13.1 Swift version: 5.5.1

Steps to reproduce:

Please replace this with the steps to reproduce the behavior.

  1. Apply Skeleton views within UITableView cell
  2. Show Skeleton with crossdisolve of 1 sec
  3. Hide Skeleton with crossdisolve of 1 sec

Expected result:

Skeleton shows and hide with expected transition time

Actual result:

Skeleton shows with crossdisolve time of 1, and hide with no transition

Attachments:

Logs, screenshots, sample project, funny gif, etc.

Juanpe
Juanpe
Jan
15
1 week ago
Jan
14
1 week ago
open pull request

Juanpe wants to merge RevenueCat/purchases-ios

Juanpe
Juanpe

Improve the way to handle the error if `purchase(sk2Product)` fails due to an error when posting the receipt

Checklist

  • If applicable, unit tests
  • If applicable, create follow-up issues for purchases-android and hybrids

Motivation

Resolves #1114

Now, if purchase(sk2Product:) fails because of an error when posting the receipt, the method returns ErrorCode.unknownError because it assumes it always receives a StoreKitError. The goal of this PR is to improve the way to handle the error.

Description

  • Add a where condition to know if the error type is StoreKitError, if not the method returns the error received.
  • Add a new test method to validate this logic.
Juanpe
Juanpe

It makes sense.

Finally, I used the matchError, a predicate provided by Nimble to compare errors. Both the code and the domain are internally validated 👍🏼

pull request

Juanpe merge to RevenueCat/purchases-ios

Juanpe
Juanpe

Improve the way to handle the error if `purchase(sk2Product)` fails due to an error when posting the receipt

Checklist

  • If applicable, unit tests
  • If applicable, create follow-up issues for purchases-android and hybrids

Motivation

Resolves #1114

Now, if purchase(sk2Product:) fails because of an error when posting the receipt, the method returns ErrorCode.unknownError because it assumes it always receives a StoreKitError. The goal of this PR is to improve the way to handle the error.

Description

  • Add a where condition to know if the error type is StoreKitError, if not the method returns the error received.
  • Add a new test method to validate this logic.
pull request

Juanpe merge to RevenueCat/purchases-ios

Juanpe
Juanpe

Improve the way to handle the error if `purchase(sk2Product)` fails due to an error when posting the receipt

Checklist

  • If applicable, unit tests
  • If applicable, create follow-up issues for purchases-android and hybrids

Motivation

Resolves #1114

Now, if purchase(sk2Product:) fails because of an error when posting the receipt, the method returns ErrorCode.unknownError because it assumes it always receives a StoreKitError. The goal of this PR is to improve the way to handle the error.

Description

  • Add a where condition to know if the error type is StoreKitError, if not the method returns the error received.
  • Add a new test method to validate this logic.
open pull request

Juanpe wants to merge RevenueCat/purchases-ios

Juanpe
Juanpe

Improve the way to handle the error if `purchase(sk2Product)` fails due to an error when posting the receipt

Checklist

  • If applicable, unit tests
  • If applicable, create follow-up issues for purchases-android and hybrids

Motivation

Resolves #1114

Now, if purchase(sk2Product:) fails because of an error when posting the receipt, the method returns ErrorCode.unknownError because it assumes it always receives a StoreKitError. The goal of this PR is to improve the way to handle the error.

Description

  • Add a where condition to know if the error type is StoreKitError, if not the method returns the error received.
  • Add a new test method to validate this logic.
pull request

Juanpe pull request RevenueCat/purchases-ios

Juanpe
Juanpe

Improve the way to handle the error if `purchase(sk2Product)` fails due to an error when posting the receipt

Checklist

  • If applicable, unit tests
  • If applicable, create follow-up issues for purchases-android and hybrids

Motivation

Resolves #1114

Now, if purchase(sk2Product:) fails because of an error when posting the receipt, the method returns ErrorCode.unknownError because it assumes it always receives a StoreKitError. The goal of this PR is to improve the way to handle the error.

Description

  • Add a where condition to know if the error type is StoreKitError, if not the method returns the error received.
  • Add a new test method to validate this logic.
Activity icon
created branch

Juanpe in Juanpe/purchases-ios create branch purchase_package_check_if_thrown_error_is_StoreKitError

createdAt 1 week ago
push

Juanpe push Juanpe/purchases-ios

Juanpe
Juanpe

Add tests to ensure that HTTPClient calls the DNS checker (#1161)

  • Create DNSCheckerType

  • Define DNSChecker type as HTTPClient dependency

  • Create DNSCheckerSpy and create tests

  • Review comments

  • Update some test methods

  • Rename some properties

  • Check if the logged message is correct

Juanpe
Juanpe

Rename introductoryPrice -> introductoryStoreProductDiscount (#1165)

Juanpe
Juanpe

Temporarily disable useStoreKit2IfAvailable (#1169)

Juanpe
Juanpe

Deprecated Purchases.paymentDiscount(forProductDiscount:product:completion:) (#1159)

  • Deprecated Purchases.paymentDiscount(forProductDiscount:product:completion:)
  • Obsoletions: fixed incompatible introduced and obsoleted annotations

For some reason this only lead to a warning in the Objective-C APITester when deprecating a method with an @objc annotation:

Feature cannot be obsoleted in iOS version 1 before it was introduced in version 12.2; attribute ignored

But looking at the auto-generated RevenueCat-Swift.h I could see this was an issue for these methods as well. Likely the obsoleted annotation was being ignored.

To fix this, now we only have 1 @available annotation for each platform, with a matching introduced and obsoleted version.

Fixes [sc-12136]

Co-authored-by: Joshua Liebowitz [email protected]

Juanpe
Juanpe

Update Package.resolved (#1172)

Xcode 13.2.1 strikes again

Juanpe
Juanpe

Follow up (#1173)

Add back enum cases in APITesters

Juanpe
Juanpe

StoreKitUnitTests: add Transactions listener to all tests (#1151)

  • Moved observation to StoreKitConfigTestCase. A future PR will make purchases without observing Transaction.updates, so it will benefit from the change in #1121 as well.
  • Cancelling Task at the end of the test.
Juanpe
Juanpe

isRestore respects observer mode when syncing purchases in StoreKit2TransactionListenerDelegate (#1166)

  • Start of settting isRestore for observerMode

  • Add tests for storekit2 transactions finished with and without observer mode

Juanpe
Juanpe

StoreTransaction: added quantity (#1156)

Juanpe
Juanpe

StoreTransactionTests: don't skip SK1 test (#1176)

commit sha: 9538a32d2a4e27db8884ffe3eb73f163ccaf056e

push time in 1 week ago
Jan
13
2 weeks ago
pull request

Juanpe pull request leogdion/AWESOME-AWESOME-README

Juanpe
Juanpe

Add SkeletonView as example section

Closes #4

The goal of this PR is to add SkeletonView under the Examples section.

Activity icon
created branch

Juanpe in Juanpe/AWESOME-AWESOME-README create branch add_SkeletonView

createdAt 1 week ago
Activity icon
fork

Juanpe forked leogdion/AWESOME-AWESOME-README

Juanpe MIT License Updated
fork time in 1 week ago
Activity icon
issue

Juanpe issue comment RevenueCat/purchases-ios

Juanpe
Juanpe

`PurchasesOrchestrator.purchase(package:completion:)` assumes that `purchase(sk2Product:)` throws `StoreKitError`

If purchase(sk2Product:) fails because of an error when posting the receipt, the Error can be something like ErrorCode.invalidReceiptError, but the method calls ErrorUtils.purchasesError(withStoreKitError:), which ends up returning ErrorCode.unknownError instead.

Nacho cries in un-typed Errors

Juanpe
Juanpe

Hi @NachoSoto! 👋🏼 I could do it if it's still free

Activity icon
delete

Juanpe in Juanpe/purchases-ios delete branch ensure_HTTPClient_calls_DNS_checker

deleted time in 1 week ago
Activity icon
issue

Juanpe issue comment RevenueCat/purchases-ios

Juanpe
Juanpe

Add tests to ensure that `HTTPClient` calls the DNS checker

Resolves #1131

This PR adds tests to ensure that HTTPClient actually calls the DNS checker.

DNSChecker is an enum with static methods and because of that, it's hard to create tests related to these methods. So, I've created a protocol called DNSCheckerType to describe all the static methods. Also, I've defined a property of this type as a dependency of the HTTPClient.

For the tests, I've created a DNSChecker spy to know when a static method has been called.

Juanpe
Juanpe

@Juanpe looks fantastic! Looks like there are merge conflicts from #1113, we're good to merge after solving them!

Great! 🚀

I've updated the tests considering that now we return an error too.

BTW, I've moved DNSError out of to DNSChecker type because we are now using the abstraction DNSCheckerType instead of the implementation, so it doesn't make sense the error is a subtype of DNSChecker. Let me know if looks good for you 👍🏼

push

Juanpe push Juanpe/purchases-ios

Juanpe
Juanpe

Pass the blocked error back as an ErrorCode (#1113)

Make it easier for developers to decide what to do when we detect that our servers are being blocked.

  • Create public ErrorCode for when our API is blocked
  • Add error code to APITesters
Juanpe
Juanpe

Merge branch 'main' of https://github.com/Juanpe/purchases-ios into ensure_HTTPClient_calls_DNS_checker

Conflicts:

Purchases/Networking/HTTPClient.swift

commit sha: 2603b67eefb847184b59151e470d617816ccbbfb

push time in 1 week ago
push

Juanpe push Juanpe/purchases-ios

Juanpe
Juanpe

Pass the blocked error back as an ErrorCode (#1113)

Make it easier for developers to decide what to do when we detect that our servers are being blocked.

  • Create public ErrorCode for when our API is blocked
  • Add error code to APITesters

commit sha: 01086efac1cd83cebdffeabe576723021471bad5

push time in 1 week ago
Jan
12
2 weeks ago
Activity icon
issue

Juanpe issue leogdion/AWESOME-AWESOME-README

Juanpe
Juanpe

Add SkeletonView as example

Hi @leogdion! thanks for this repo. I think it's very useful for everyone 👍🏼

I have a project and IMHO it would be a good example of a README file. The project is SkeletonView.

What do you think? Could we include it?

Thanks! 🙂

Previous