Showing
1 changed file
with
7 additions
and
2 deletions
... | @@ -1939,14 +1939,19 @@ public final class WarplySDK { | ... | @@ -1939,14 +1939,19 @@ public final class WarplySDK { |
1939 | // Get coupon sets using pure Swift implementation | 1939 | // Get coupon sets using pure Swift implementation |
1940 | getCouponSets { couponSetsArray in | 1940 | getCouponSets { couponSetsArray in |
1941 | // Coupon sets already handled by getCouponSets method | 1941 | // Coupon sets already handled by getCouponSets method |
1942 | + } failureCallback: { error in | ||
1943 | + print("=== getCouponSets error: ", error) | ||
1942 | } | 1944 | } |
1943 | } | 1945 | } |
1944 | 1946 | ||
1945 | /// Get universal coupons | 1947 | /// Get universal coupons |
1946 | - public func getCouponsUniversal(language: String, _ completion: @escaping ([CouponItemModel]?) -> Void, failureCallback: @escaping (Int) -> Void) { | 1948 | + public func getCouponsUniversal(language: String? = nil, _ completion: @escaping ([CouponItemModel]?) -> Void, failureCallback: @escaping (Int) -> Void) { |
1949 | + // Handle language default inside the method | ||
1950 | + let finalLanguage = language ?? self.applicationLocale | ||
1951 | + | ||
1947 | Task { | 1952 | Task { |
1948 | do { | 1953 | do { |
1949 | - let endpoint = Endpoint.getCoupons(language: language, couponsetType: "") | 1954 | + let endpoint = Endpoint.getCoupons(language: finalLanguage, couponsetType: "") |
1950 | let response = try await networkService.requestRaw(endpoint) | 1955 | let response = try await networkService.requestRaw(endpoint) |
1951 | 1956 | ||
1952 | var couponsArray: [CouponItemModel] = [] | 1957 | var couponsArray: [CouponItemModel] = [] | ... | ... |
-
Please register or login to post a comment