This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let userInfo = reloadTrigger | |
.flatMapLatest { [apiService, selectedUser] in | |
apiService.fetchUserInfo(with: selectedUser.id) | |
.trackActivity(activityIndicator) | |
} | |
.share(replay: 1) | |
let favorites = userInfo | |
.flatMapLatest { [apiService] in | |
apiService.fetchFavorites(with: $0.id) | |
.trackActivity(activityIndicator) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let onUnit = BehaviorRelay(value: "") | |
let onTotal = BehaviorRelay(value: "") | |
let onPriceUpdated = BehaviorRelay<ProductPriceEntity?>(value: nil) | |
let onQuantity = BehaviorRelay(value: 1) | |
var prices: [ProductPriceEntity] = [] | |
Observable.combineLatest(onUnit, onQuantity).flatMapLatest{[weak self] (unit, qty) -> Observable<Void> in | |
guard let self = self else { return Observable.just(()) } | |
let price = self.unitPrices.value[unit]?.filter { price in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import RxSwift | |
import RxCocoa | |
import RxDataSources | |
private let reuseIdentifier = "OrderProductItemCell" | |
class OrderProductItemView: UICollectionViewController { | |
var viewModel: | |
OrderProductsViewModel! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let headerRefreshTrigger = PublishSubject<Void>() | |
let retryRefreshTrigger = PublishSubject<Void>() | |
let refresh = Observable.of(Observable.just(()), headerRefreshTrigger, retryRefreshTrigger.mapToVoid()).merge() | |
let input = ViewModel.Input(headerRefresh: refresh) | |
//triggered when retry button tapped | |
xbutton?.rx.tap.asDriver().drive(onNext: { [weak self] (_) in | |
self?.retryRefreshTrigger.onNext(()) | |
}).disposed(by: rx.disposeBag) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
` version: 2 | |
jobs: | |
build-and-test: | |
macos: | |
xcode: "10.0.0" | |
working_directory: /Users/distiller/project | |
environment: | |
LC_ALL: en_US.UTF-8 | |
LANG: en_US.UTF-8 | |
FL_OUTPUT_DIR: output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import RxSwift | |
import RxCocoa | |
import RxDataSources | |
private let reuseIdentifier = "ProductImageItemCell" | |
protocol ProductHeaderCarouselDelegate { | |
func didTapItem(indexPath: IndexPath, selectedImage: ImageView) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/ Create flow layout | |
let flow = UICollectionViewFlowLayout() | |
// Define layout constants | |
let itemSpacing: CGFloat = 1 | |
let minimumCellWidth: CGFloat = 120 | |
let collectionViewWidth = collectionView!.bounds.size.width | |
// Calculate other required constants | |
let itemsInOneLine = CGFloat(Int((collectionViewWidth - CGFloat(Int(collectionViewWidth / minimumCellWidth) - 1) * itemSpacing) / minimumCellWidth)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<android.support.design.widget.CoordinatorLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:fitsSystemWindows="true" | |
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun generateHashkey() { | |
try { | |
if (Build.VERSION.SDK_INT >= 28) { | |
@SuppressLint("WrongConstant") val packageInfo = getPackageManager().getPackageInfo( | |
getPAckageName(), PackageManager.GET_SIGNING_CERTIFICATES | |
) | |
val signatures = packageInfo.signingInfo.getApkContentsSigners() | |
val md = MessageDigest.getInstance("SHA") | |
for (signature in signatures) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-dontusemixedcaseclassnames | |
-dontskipnonpubliclibraryclasses | |
-verbose | |
-dontpreverify | |
# If you want to enable optimization, remove this for a 1-2% less but longer compile time | |
#-dontoptimize | |
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/* | |
-optimizationpasses 5 |
NewerOlder