created currency change feature

This commit is contained in:
u-e 2019-01-30 11:57:09 +03:00
parent d4770cf075
commit fa4a181d1d
40 changed files with 770 additions and 516 deletions

View File

@ -79,8 +79,8 @@ PODS:
- React/Core
- RSKImageCropper
- RSKImageCropper (2.2.1)
- SDWebImage/Core (4.4.3)
- SDWebImage/GIF (4.4.3):
- SDWebImage/Core (4.4.4)
- SDWebImage/GIF (4.4.4):
- FLAnimatedImage (~> 1.0)
- SDWebImage/Core
- SSZipArchive (2.1.4)
@ -160,7 +160,7 @@ SPEC CHECKSUMS:
react-native-version-number: 36c0d8eb57a275a6239a860f8dbab3d18299b0e0
RNImageCropPicker: 32ca4b9fef4e1b7b85ba69494242122948117e06
RSKImageCropper: 98296ad26b41753f796b6898d015509598f13d97
SDWebImage: c5594f1a19c48d526d321e548902b56b479cd508
SDWebImage: c00ec18ab25d10e5ffac109b0f78d1b4341c9691
SSZipArchive: 41455d4b8d2b6ab93990820b50dc697c2554a322
yoga: b1ce48b6cf950b98deae82838f5173ea7cf89e85

View File

@ -0,0 +1 @@
../../../SDWebImage/SDWebImage/UIImage+MemoryCacheCost.h

View File

@ -0,0 +1,45 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif
#import "NSButton+WebCache.h"
#import "NSData+ImageContentType.h"
#import "NSImage+WebCache.h"
#import "SDAnimatedImageRep.h"
#import "SDImageCache.h"
#import "SDImageCacheConfig.h"
#import "SDWebImageCoder.h"
#import "SDWebImageCoderHelper.h"
#import "SDWebImageCodersManager.h"
#import "SDWebImageCompat.h"
#import "SDWebImageDownloader.h"
#import "SDWebImageDownloaderOperation.h"
#import "SDWebImageFrame.h"
#import "SDWebImageGIFCoder.h"
#import "SDWebImageImageIOCoder.h"
#import "SDWebImageManager.h"
#import "SDWebImageOperation.h"
#import "SDWebImagePrefetcher.h"
#import "SDWebImageTransition.h"
#import "UIButton+WebCache.h"
#import "UIImage+ForceDecode.h"
#import "UIImage+GIF.h"
#import "UIImage+MemoryCacheCost.h"
#import "UIImage+MultiFormat.h"
#import "UIImageView+HighlightedWebCache.h"
#import "UIImageView+WebCache.h"
#import "UIView+WebCache.h"
#import "UIView+WebCacheOperation.h"
#import "FLAnimatedImageView+WebCache.h"
FOUNDATION_EXPORT double SDWebImageVersionNumber;
FOUNDATION_EXPORT const unsigned char SDWebImageVersionString[];

View File

@ -0,0 +1,6 @@
module SDWebImage {
umbrella header "SDWebImage-umbrella.h"
export *
module * { export * }
}

View File

@ -0,0 +1 @@
../../../SDWebImage/SDWebImage/UIImage+MemoryCacheCost.h

View File

@ -79,8 +79,8 @@ PODS:
- React/Core
- RSKImageCropper
- RSKImageCropper (2.2.1)
- SDWebImage/Core (4.4.3)
- SDWebImage/GIF (4.4.3):
- SDWebImage/Core (4.4.4)
- SDWebImage/GIF (4.4.4):
- FLAnimatedImage (~> 1.0)
- SDWebImage/Core
- SSZipArchive (2.1.4)
@ -160,7 +160,7 @@ SPEC CHECKSUMS:
react-native-version-number: 36c0d8eb57a275a6239a860f8dbab3d18299b0e0
RNImageCropPicker: 32ca4b9fef4e1b7b85ba69494242122948117e06
RSKImageCropper: 98296ad26b41753f796b6898d015509598f13d97
SDWebImage: c5594f1a19c48d526d321e548902b56b479cd508
SDWebImage: c00ec18ab25d10e5ffac109b0f78d1b4341c9691
SSZipArchive: 41455d4b8d2b6ab93990820b50dc697c2554a322
yoga: b1ce48b6cf950b98deae82838f5173ea7cf89e85

File diff suppressed because it is too large Load Diff

View File

@ -110,7 +110,16 @@ platform :ios, '7.0'
pod 'SDWebImage', '~> 4.0'
```
If you are using Swift, be sure to add `use_frameworks!` and set your target to iOS 8+:
##### Swift
If you are using `Swift`, `Xcode 9+` and `CocoaPods` `1.5.0+`, you only need to set your target to `iOS 8+` if you need static library:
```
platform :ios, '8.0'
```
If not, you still need to add `use_frameworks!` to use dynamic framework:
```
platform :ios, '8.0'
use_frameworks!

View File

@ -15,6 +15,20 @@
#import "NSData+ImageContentType.h"
#import "UIImageView+WebCache.h"
#import "UIImage+MultiFormat.h"
#import "UIImage+MemoryCacheCost.h"
@interface UIView (PrivateWebCache)
- (void)sd_internalSetImageWithURL:(nullable NSURL *)url
placeholderImage:(nullable UIImage *)placeholder
options:(SDWebImageOptions)options
operationKey:(nullable NSString *)operationKey
internalSetImageBlock:(nullable SDInternalSetImageBlock)setImageBlock
progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
completed:(nullable SDExternalCompletionBlock)completedBlock
context:(nullable NSDictionary<NSString *, id> *)context;
@end
static inline FLAnimatedImage * SDWebImageCreateFLAnimatedImage(FLAnimatedImageView *imageView, NSData *imageData) {
if ([NSData sd_imageFormatForImageData:imageData] != SDImageFormatGIF) {
@ -30,6 +44,17 @@ static inline FLAnimatedImage * SDWebImageCreateFLAnimatedImage(FLAnimatedImageV
return animatedImage;
}
static inline NSUInteger SDWebImageMemoryCostFLAnimatedImage(FLAnimatedImage *animatedImage, UIImage *image) {
NSUInteger frameCacheSizeCurrent = animatedImage.frameCacheSizeCurrent; // [1...frame count], more suitable than raw frame count because FLAnimatedImage internal actually store a buffer size but not full frames (they called `window`)
NSUInteger pixelsPerFrame = animatedImage.size.width * animatedImage.size.height; // FLAnimatedImage does not support scale factor
NSUInteger animatedImageCost = frameCacheSizeCurrent * pixelsPerFrame;
NSUInteger imageCost = image.size.height * image.size.width * image.scale * image.scale; // Same as normal cost calculation
imageCost = image.images ? (imageCost * image.images.count) : imageCost;
return animatedImageCost + imageCost;
}
@implementation UIImage (FLAnimatedImage)
- (FLAnimatedImage *)sd_FLAnimatedImage {
@ -119,7 +144,7 @@ static inline FLAnimatedImage * SDWebImageCreateFLAnimatedImage(FLAnimatedImageV
placeholderImage:placeholder
options:options
operationKey:nil
setImageBlock:^(UIImage *image, NSData *imageData) {
internalSetImageBlock:^(UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
__strong typeof(weakSelf)strongSelf = weakSelf;
if (!strongSelf) {
dispatch_group_leave(group);
@ -138,7 +163,7 @@ static inline FLAnimatedImage * SDWebImageCreateFLAnimatedImage(FLAnimatedImageV
// Step 2. Check if original compressed image data is "GIF"
BOOL isGIF = (image.sd_imageFormat == SDImageFormatGIF || [NSData sd_imageFormatForImageData:imageData] == SDImageFormatGIF);
// Check if placeholder, which does not trigger a backup disk cache query
BOOL isPlaceholder = (image == placeholder);
BOOL isPlaceholder = !imageData && image && cacheType == SDImageCacheTypeNone;
if (!isGIF || isPlaceholder) {
strongSelf.image = image;
strongSelf.animatedImage = nil;
@ -152,9 +177,9 @@ static inline FLAnimatedImage * SDWebImageCreateFLAnimatedImage(FLAnimatedImageV
__strong typeof(wweakSelf) sstrongSelf = wweakSelf;
if (!sstrongSelf || ![url isEqual:sstrongSelf.sd_imageURL]) { return ; }
// Step 3. Check if data exist or query disk cache
NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:url];
__block NSData *gifData = imageData;
if (!gifData) {
NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:url];
gifData = [[SDImageCache sharedImageCache] diskImageDataForKey:key];
}
// Step 4. Create FLAnimatedImage
@ -163,8 +188,12 @@ static inline FLAnimatedImage * SDWebImageCreateFLAnimatedImage(FLAnimatedImageV
if (![url isEqual:sstrongSelf.sd_imageURL]) { return ; }
// Step 5. Set animatedImage or normal image
if (animatedImage) {
if (sstrongSelf.sd_cacheFLAnimatedImage) {
if (sstrongSelf.sd_cacheFLAnimatedImage && SDImageCache.sharedImageCache.config.shouldCacheImagesInMemory) {
image.sd_FLAnimatedImage = animatedImage;
image.sd_memoryCost = SDWebImageMemoryCostFLAnimatedImage(animatedImage, image);
// Update the memory cache
[SDImageCache.sharedImageCache removeImageForKey:key fromDisk:NO withCompletion:nil];
[SDImageCache.sharedImageCache storeImage:image forKey:key toDisk:NO completion:nil];
}
sstrongSelf.image = animatedImage.posterImage;
sstrongSelf.animatedImage = animatedImage;

View File

@ -9,6 +9,7 @@
#import "SDImageCache.h"
#import <CommonCrypto/CommonDigest.h>
#import "NSImage+WebCache.h"
#import "UIImage+MemoryCacheCost.h"
#import "SDWebImageCodersManager.h"
#define SD_MAX_FILE_EXTENSION_LENGTH (NAME_MAX - CC_MD5_DIGEST_LENGTH * 2 - 1)
@ -16,14 +17,6 @@
#define LOCK(lock) dispatch_semaphore_wait(lock, DISPATCH_TIME_FOREVER);
#define UNLOCK(lock) dispatch_semaphore_signal(lock);
FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
#if SD_MAC
return image.size.height * image.size.width;
#elif SD_UIKIT || SD_WATCH
return image.size.height * image.size.width * image.scale * image.scale;
#endif
}
// A memory cache which auto purge the cache on memory warning and support weak cache.
@interface SDMemoryCache <KeyType, ObjectType> : NSCache <KeyType, ObjectType>
@ -82,7 +75,9 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
if (key && obj) {
// Store weak cache
LOCK(self.weakCacheLock);
[self.weakCache setObject:obj forKey:key];
// Do the real copy of the key and only let NSMapTable manage the key's lifetime
// Fixes issue #2507 https://github.com/SDWebImage/SDWebImage/issues/2507
[self.weakCache setObject:obj forKey:[[key mutableCopy] copy]];
UNLOCK(self.weakCacheLock);
}
}
@ -101,7 +96,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
// Sync cache
NSUInteger cost = 0;
if ([obj isKindOfClass:[UIImage class]]) {
cost = SDCacheCostForImage(obj);
cost = [(UIImage *)obj sd_memoryCost];
}
[super setObject:obj forKey:key cost:cost];
}
@ -298,7 +293,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
}
// if memory cache is enabled
if (self.config.shouldCacheImagesInMemory) {
NSUInteger cost = SDCacheCostForImage(image);
NSUInteger cost = image.sd_memoryCost;
[self.memCache setObject:image forKey:key cost:cost];
}
@ -424,7 +419,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
- (nullable UIImage *)imageFromDiskCacheForKey:(nullable NSString *)key {
UIImage *diskImage = [self diskImageForKey:key];
if (diskImage && self.config.shouldCacheImagesInMemory) {
NSUInteger cost = SDCacheCostForImage(diskImage);
NSUInteger cost = diskImage.sd_memoryCost;
[self.memCache setObject:diskImage forKey:key cost:cost];
}
@ -545,7 +540,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
// decode image data only if in-memory cache missed
diskImage = [self diskImageForKey:key data:diskData options:options];
if (diskImage && self.config.shouldCacheImagesInMemory) {
NSUInteger cost = SDCacheCostForImage(diskImage);
NSUInteger cost = diskImage.sd_memoryCost;
[self.memCache setObject:diskImage forKey:key cost:cost];
}
}

View File

@ -289,8 +289,8 @@
LOCK(self.operationsLock);
NSOperation<SDWebImageDownloaderOperationInterface> *operation = [self.URLOperations objectForKey:url];
// There is a case that the operation may be marked as finished, but not been removed from `self.URLOperations`.
if (!operation || operation.isFinished) {
// There is a case that the operation may be marked as finished or cancelled, but not been removed from `self.URLOperations`.
if (!operation || operation.isFinished || operation.isCancelled) {
operation = [self createDownloaderOperationWithUrl:url options:options];
__weak typeof(self) wself = self;
operation.completionBlock = ^{
@ -307,6 +307,15 @@
// `addOperation:` does not synchronously execute the `operation.completionBlock` so this will not cause deadlock.
[self.downloadQueue addOperation:operation];
}
else if (!operation.isExecuting) {
if (options & SDWebImageDownloaderHighPriority) {
operation.queuePriority = NSOperationQueuePriorityHigh;
} else if (options & SDWebImageDownloaderLowPriority) {
operation.queuePriority = NSOperationQueuePriorityLow;
} else {
operation.queuePriority = NSOperationQueuePriorityNormal;
}
}
UNLOCK(self.operationsLock);
id downloadOperationCancelToken = [operation addHandlersForProgress:progressBlock completed:completedBlock];

View File

@ -82,6 +82,9 @@ typedef NSMutableDictionary<NSString *, id> SDCallbacksDictionary;
_unownedSession = session;
_callbacksLock = dispatch_semaphore_create(1);
_coderQueue = dispatch_queue_create("com.hackemist.SDWebImageDownloaderOperationCoderQueue", DISPATCH_QUEUE_SERIAL);
#if SD_UIKIT
_backgroundTaskId = UIBackgroundTaskInvalid;
#endif
}
return self;
}
@ -135,14 +138,7 @@ typedef NSMutableDictionary<NSString *, id> SDCallbacksDictionary;
__weak __typeof__ (self) wself = self;
UIApplication * app = [UIApplicationClass performSelector:@selector(sharedApplication)];
self.backgroundTaskId = [app beginBackgroundTaskWithExpirationHandler:^{
__strong __typeof (wself) sself = wself;
if (sself) {
[sself cancel];
[app endBackgroundTask:sself.backgroundTaskId];
sself.backgroundTaskId = UIBackgroundTaskInvalid;
}
[wself cancel];
}];
}
#endif
@ -197,27 +193,15 @@ typedef NSMutableDictionary<NSString *, id> SDCallbacksDictionary;
for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) {
progressBlock(0, NSURLResponseUnknownLength, self.request.URL);
}
__weak typeof(self) weakSelf = self;
__block typeof(self) strongSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStartNotification object:weakSelf];
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStartNotification object:strongSelf];
});
} else {
[self callCompletionBlocksWithError:[NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorUnknown userInfo:@{NSLocalizedDescriptionKey : @"Task can't be initialized"}]];
[self done];
return;
}
#if SD_UIKIT
Class UIApplicationClass = NSClassFromString(@"UIApplication");
if(!UIApplicationClass || ![UIApplicationClass respondsToSelector:@selector(sharedApplication)]) {
return;
}
if (self.backgroundTaskId != UIBackgroundTaskInvalid) {
UIApplication * app = [UIApplication performSelector:@selector(sharedApplication)];
[app endBackgroundTask:self.backgroundTaskId];
self.backgroundTaskId = UIBackgroundTaskInvalid;
}
#endif
}
- (void)cancel {
@ -232,9 +216,9 @@ typedef NSMutableDictionary<NSString *, id> SDCallbacksDictionary;
if (self.dataTask) {
[self.dataTask cancel];
__weak typeof(self) weakSelf = self;
__block typeof(self) strongSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:weakSelf];
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:strongSelf];
});
// As we cancelled the task, its callback won't be called and thus won't
@ -256,11 +240,23 @@ typedef NSMutableDictionary<NSString *, id> SDCallbacksDictionary;
LOCK(self.callbacksLock);
[self.callbackBlocks removeAllObjects];
UNLOCK(self.callbacksLock);
self.dataTask = nil;
if (self.ownedSession) {
[self.ownedSession invalidateAndCancel];
self.ownedSession = nil;
@synchronized (self) {
self.dataTask = nil;
if (self.ownedSession) {
[self.ownedSession invalidateAndCancel];
self.ownedSession = nil;
}
#if SD_UIKIT
if (self.backgroundTaskId != UIBackgroundTaskInvalid) {
// If backgroundTaskId != UIBackgroundTaskInvalid, sharedApplication is always exist
UIApplication * app = [UIApplication performSelector:@selector(sharedApplication)];
[app endBackgroundTask:self.backgroundTaskId];
self.backgroundTaskId = UIBackgroundTaskInvalid;
}
#endif
}
}
@ -307,10 +303,9 @@ didReceiveResponse:(NSURLResponse *)response
// Status code invalid and marked as cancelled. Do not call `[self.dataTask cancel]` which may mass up URLSession life cycle
disposition = NSURLSessionResponseCancel;
}
__weak typeof(self) weakSelf = self;
__block typeof(self) strongSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadReceiveResponseNotification object:weakSelf];
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadReceiveResponseNotification object:strongSelf];
});
if (completionHandler) {
@ -388,11 +383,11 @@ didReceiveResponse:(NSURLResponse *)response
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error {
@synchronized(self) {
self.dataTask = nil;
__weak typeof(self) weakSelf = self;
__block typeof(self) strongSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:weakSelf];
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:strongSelf];
if (!error) {
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadFinishNotification object:weakSelf];
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadFinishNotification object:strongSelf];
}
});
}
@ -423,19 +418,8 @@ didReceiveResponse:(NSURLResponse *)response
NSString *key = [[SDWebImageManager sharedManager] cacheKeyForURL:self.request.URL];
image = [self scaledImageForKey:key image:image];
BOOL shouldDecode = YES;
// Do not force decoding animated GIFs and WebPs
if (image.images) {
shouldDecode = NO;
} else {
#ifdef SD_WEBP
SDImageFormat imageFormat = [NSData sd_imageFormatForImageData:imageData];
if (imageFormat == SDImageFormatWebP) {
shouldDecode = NO;
}
#endif
}
// Do not force decoding animated images
BOOL shouldDecode = !image.images;
if (shouldDecode) {
if (self.shouldDecompressImages) {
BOOL shouldScaleDown = self.options & SDWebImageDownloaderScaleDownLargeImages;

View File

@ -0,0 +1,23 @@
/*
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <rs@dailymotion.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#import "SDWebImageCompat.h"
@interface UIImage (MemoryCacheCost)
/**
The memory cache cost for specify image used by image cache. The cost function is the pixles count held in memory.
If you set some associated object to `UIImage`, you can set the custom value to indicate the memory cost.
For `UIImage`, this method return the single frame pixles count when `image.images` is nil for static image. Retuen full frame pixels count when `image.images` is not nil for animated image.
For `NSImage`, this method return the single frame pixels count because `NSImage` does not store all frames in memory.
@note Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods.
*/
@property (assign, nonatomic) NSUInteger sd_memoryCost;
@end

View File

@ -0,0 +1,38 @@
/*
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <rs@dailymotion.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#import "UIImage+MemoryCacheCost.h"
#import "objc/runtime.h"
FOUNDATION_STATIC_INLINE NSUInteger SDMemoryCacheCostForImage(UIImage *image) {
#if SD_MAC
return image.size.height * image.size.width;
#elif SD_UIKIT || SD_WATCH
NSUInteger imageSize = image.size.height * image.size.width * image.scale * image.scale;
return image.images ? (imageSize * image.images.count) : imageSize;
#endif
}
@implementation UIImage (MemoryCacheCost)
- (NSUInteger)sd_memoryCost {
NSNumber *value = objc_getAssociatedObject(self, @selector(sd_memoryCost));
NSUInteger memoryCost;
if (value != nil) {
memoryCost = [value unsignedIntegerValue];
} else {
memoryCost = SDMemoryCacheCostForImage(self);
}
return memoryCost;
}
- (void)setSd_memoryCost:(NSUInteger)sd_memoryCost {
objc_setAssociatedObject(self, @selector(sd_memoryCost), @(sd_memoryCost), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
@end

View File

@ -24,6 +24,7 @@ FOUNDATION_EXPORT NSString * _Nonnull const SDWebImageExternalCustomManagerKey;
FOUNDATION_EXPORT const int64_t SDWebImageProgressUnitCountUnknown; /* 1LL */
typedef void(^SDSetImageBlock)(UIImage * _Nullable image, NSData * _Nullable imageData);
typedef void(^SDInternalSetImageBlock)(UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL);
@interface UIView (WebCache)

View File

@ -60,6 +60,25 @@ static char TAG_ACTIVITY_SHOW;
progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
completed:(nullable SDExternalCompletionBlock)completedBlock
context:(nullable NSDictionary<NSString *, id> *)context {
SDInternalSetImageBlock internalSetImageBlock;
if (setImageBlock) {
internalSetImageBlock = ^(UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
if (setImageBlock) {
setImageBlock(image, imageData);
}
};
}
[self sd_internalSetImageWithURL:url placeholderImage:placeholder options:options operationKey:operationKey internalSetImageBlock:internalSetImageBlock progress:progressBlock completed:completedBlock context:context];
}
- (void)sd_internalSetImageWithURL:(nullable NSURL *)url
placeholderImage:(nullable UIImage *)placeholder
options:(SDWebImageOptions)options
operationKey:(nullable NSString *)operationKey
internalSetImageBlock:(nullable SDInternalSetImageBlock)setImageBlock
progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
completed:(nullable SDExternalCompletionBlock)completedBlock
context:(nullable NSDictionary<NSString *, id> *)context {
NSString *validOperationKey = operationKey ?: NSStringFromClass([self class]);
[self sd_cancelImageLoadOperationWithKey:validOperationKey];
objc_setAssociatedObject(self, &imageURLKey, url, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
@ -70,7 +89,7 @@ static char TAG_ACTIVITY_SHOW;
dispatch_group_enter(group);
}
dispatch_main_async_safe(^{
[self sd_setImage:placeholder imageData:nil basedOnClassOrViaCustomSetImageBlock:setImageBlock];
[self sd_setImage:placeholder imageData:nil basedOnClassOrViaCustomSetImageBlock:setImageBlock cacheType:SDImageCacheTypeNone imageURL:url];
});
}
@ -157,7 +176,7 @@ static char TAG_ACTIVITY_SHOW;
#if SD_UIKIT || SD_MAC
[sself sd_setImage:targetImage imageData:targetData basedOnClassOrViaCustomSetImageBlock:setImageBlock transition:transition cacheType:cacheType imageURL:imageURL];
#else
[sself sd_setImage:targetImage imageData:targetData basedOnClassOrViaCustomSetImageBlock:setImageBlock];
[sself sd_setImage:targetImage imageData:targetData basedOnClassOrViaCustomSetImageBlock:setImageBlock cacheType:cacheType imageURL:imageURL];
#endif
if (group) {
// compatible code for FLAnimatedImage, because we assume completedBlock called after image was set. This will be removed in 5.x
@ -190,13 +209,13 @@ static char TAG_ACTIVITY_SHOW;
[self sd_cancelImageLoadOperationWithKey:NSStringFromClass([self class])];
}
- (void)sd_setImage:(UIImage *)image imageData:(NSData *)imageData basedOnClassOrViaCustomSetImageBlock:(SDSetImageBlock)setImageBlock {
- (void)sd_setImage:(UIImage *)image imageData:(NSData *)imageData basedOnClassOrViaCustomSetImageBlock:(SDInternalSetImageBlock)setImageBlock cacheType:(SDImageCacheType)cacheType imageURL:(NSURL *)imageURL {
#if SD_UIKIT || SD_MAC
[self sd_setImage:image imageData:imageData basedOnClassOrViaCustomSetImageBlock:setImageBlock transition:nil cacheType:0 imageURL:nil];
[self sd_setImage:image imageData:imageData basedOnClassOrViaCustomSetImageBlock:setImageBlock transition:nil cacheType:cacheType imageURL:imageURL];
#else
// watchOS does not support view transition. Simplify the logic
if (setImageBlock) {
setImageBlock(image, imageData);
setImageBlock(image, imageData, cacheType, imageURL);
} else if ([self isKindOfClass:[UIImageView class]]) {
UIImageView *imageView = (UIImageView *)self;
[imageView setImage:image];
@ -205,21 +224,21 @@ static char TAG_ACTIVITY_SHOW;
}
#if SD_UIKIT || SD_MAC
- (void)sd_setImage:(UIImage *)image imageData:(NSData *)imageData basedOnClassOrViaCustomSetImageBlock:(SDSetImageBlock)setImageBlock transition:(SDWebImageTransition *)transition cacheType:(SDImageCacheType)cacheType imageURL:(NSURL *)imageURL {
- (void)sd_setImage:(UIImage *)image imageData:(NSData *)imageData basedOnClassOrViaCustomSetImageBlock:(SDInternalSetImageBlock)setImageBlock transition:(SDWebImageTransition *)transition cacheType:(SDImageCacheType)cacheType imageURL:(NSURL *)imageURL {
UIView *view = self;
SDSetImageBlock finalSetImageBlock;
SDInternalSetImageBlock finalSetImageBlock;
if (setImageBlock) {
finalSetImageBlock = setImageBlock;
} else if ([view isKindOfClass:[UIImageView class]]) {
UIImageView *imageView = (UIImageView *)view;
finalSetImageBlock = ^(UIImage *setImage, NSData *setImageData) {
finalSetImageBlock = ^(UIImage *setImage, NSData *setImageData, SDImageCacheType setCacheType, NSURL *setImageURL) {
imageView.image = setImage;
};
}
#if SD_UIKIT
else if ([view isKindOfClass:[UIButton class]]) {
UIButton *button = (UIButton *)view;
finalSetImageBlock = ^(UIImage *setImage, NSData *setImageData){
finalSetImageBlock = ^(UIImage *setImage, NSData *setImageData, SDImageCacheType setCacheType, NSURL *setImageURL) {
[button setImage:setImage forState:UIControlStateNormal];
};
}
@ -235,7 +254,7 @@ static char TAG_ACTIVITY_SHOW;
} completion:^(BOOL finished) {
[UIView transitionWithView:view duration:transition.duration options:transition.animationOptions animations:^{
if (finalSetImageBlock && !transition.avoidAutoSetImage) {
finalSetImageBlock(image, imageData);
finalSetImageBlock(image, imageData, cacheType, imageURL);
}
if (transition.animations) {
transition.animations(view, image);
@ -255,7 +274,7 @@ static char TAG_ACTIVITY_SHOW;
context.timingFunction = transition.timingFunction;
context.allowsImplicitAnimation = (transition.animationOptions & SDWebImageAnimationOptionAllowsImplicitAnimation);
if (finalSetImageBlock && !transition.avoidAutoSetImage) {
finalSetImageBlock(image, imageData);
finalSetImageBlock(image, imageData, cacheType, imageURL);
}
if (transition.animations) {
transition.animations(view, image);
@ -269,7 +288,7 @@ static char TAG_ACTIVITY_SHOW;
#endif
} else {
if (finalSetImageBlock) {
finalSetImageBlock(image, imageData);
finalSetImageBlock(image, imageData, cacheType, imageURL);
}
}
}

View File

@ -2,9 +2,9 @@ FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/AppCenter/AppCenter-SDK-Appl
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AppCenter" "${PODS_ROOT}/Headers/Public/AppCenterReactNativeShared" "${PODS_ROOT}/Headers/Public/Base64" "${PODS_ROOT}/Headers/Public/CodePush" "${PODS_ROOT}/Headers/Public/DoubleConversion" "${PODS_ROOT}/Headers/Public/FLAnimatedImage" "${PODS_ROOT}/Headers/Public/JWT" "${PODS_ROOT}/Headers/Public/QBImagePickerController" "${PODS_ROOT}/Headers/Public/RNImageCropPicker" "${PODS_ROOT}/Headers/Public/RSKImageCropper" "${PODS_ROOT}/Headers/Public/React" "${PODS_ROOT}/Headers/Public/SDWebImage" "${PODS_ROOT}/Headers/Public/SSZipArchive" "${PODS_ROOT}/Headers/Public/glog" "${PODS_ROOT}/Headers/Public/react-native-fast-image" "${PODS_ROOT}/Headers/Public/react-native-version-number" "${PODS_ROOT}/Headers/Public/yoga"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Base64" "${PODS_CONFIGURATION_BUILD_DIR}/CodePush" "${PODS_CONFIGURATION_BUILD_DIR}/DoubleConversion" "${PODS_CONFIGURATION_BUILD_DIR}/FLAnimatedImage" "${PODS_CONFIGURATION_BUILD_DIR}/Folly" "${PODS_CONFIGURATION_BUILD_DIR}/JWT" "${PODS_CONFIGURATION_BUILD_DIR}/QBImagePickerController" "${PODS_CONFIGURATION_BUILD_DIR}/RNImageCropPicker" "${PODS_CONFIGURATION_BUILD_DIR}/RSKImageCropper" "${PODS_CONFIGURATION_BUILD_DIR}/React" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" "${PODS_CONFIGURATION_BUILD_DIR}/SSZipArchive" "${PODS_CONFIGURATION_BUILD_DIR}/glog" "${PODS_CONFIGURATION_BUILD_DIR}/react-native-fast-image" "${PODS_CONFIGURATION_BUILD_DIR}/react-native-version-number" "${PODS_CONFIGURATION_BUILD_DIR}/yoga"
OTHER_CFLAGS = $(inherited) -fmodule-map-file="${PODS_ROOT}/Headers/Public/SSZipArchive/SSZipArchive.modulemap" -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AppCenter" -isystem "${PODS_ROOT}/Headers/Public/AppCenterReactNativeShared" -isystem "${PODS_ROOT}/Headers/Public/Base64" -isystem "${PODS_ROOT}/Headers/Public/CodePush" -isystem "${PODS_ROOT}/Headers/Public/DoubleConversion" -isystem "${PODS_ROOT}/Headers/Public/FLAnimatedImage" -isystem "${PODS_ROOT}/Headers/Public/JWT" -isystem "${PODS_ROOT}/Headers/Public/QBImagePickerController" -isystem "${PODS_ROOT}/Headers/Public/RNImageCropPicker" -isystem "${PODS_ROOT}/Headers/Public/RSKImageCropper" -isystem "${PODS_ROOT}/Headers/Public/React" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage" -isystem "${PODS_ROOT}/Headers/Public/SSZipArchive" -isystem "${PODS_ROOT}/Headers/Public/glog" -isystem "${PODS_ROOT}/Headers/Public/react-native-fast-image" -isystem "${PODS_ROOT}/Headers/Public/react-native-version-number" -isystem "${PODS_ROOT}/Headers/Public/yoga"
OTHER_CFLAGS = $(inherited) -fmodule-map-file="${PODS_ROOT}/Headers/Public/SDWebImage/SDWebImage.modulemap" -fmodule-map-file="${PODS_ROOT}/Headers/Public/SSZipArchive/SSZipArchive.modulemap" -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AppCenter" -isystem "${PODS_ROOT}/Headers/Public/AppCenterReactNativeShared" -isystem "${PODS_ROOT}/Headers/Public/Base64" -isystem "${PODS_ROOT}/Headers/Public/CodePush" -isystem "${PODS_ROOT}/Headers/Public/DoubleConversion" -isystem "${PODS_ROOT}/Headers/Public/FLAnimatedImage" -isystem "${PODS_ROOT}/Headers/Public/JWT" -isystem "${PODS_ROOT}/Headers/Public/QBImagePickerController" -isystem "${PODS_ROOT}/Headers/Public/RNImageCropPicker" -isystem "${PODS_ROOT}/Headers/Public/RSKImageCropper" -isystem "${PODS_ROOT}/Headers/Public/React" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage" -isystem "${PODS_ROOT}/Headers/Public/SSZipArchive" -isystem "${PODS_ROOT}/Headers/Public/glog" -isystem "${PODS_ROOT}/Headers/Public/react-native-fast-image" -isystem "${PODS_ROOT}/Headers/Public/react-native-version-number" -isystem "${PODS_ROOT}/Headers/Public/yoga"
OTHER_LDFLAGS = $(inherited) -ObjC -l"Base64" -l"CodePush" -l"DoubleConversion" -l"FLAnimatedImage" -l"Folly" -l"JWT" -l"QBImagePickerController" -l"RNImageCropPicker" -l"RSKImageCropper" -l"React" -l"SDWebImage" -l"SSZipArchive" -l"c++" -l"glog" -l"react-native-fast-image" -l"react-native-version-number" -l"sqlite3" -l"stdc++" -l"yoga" -l"z" -framework "AppCenter" -framework "AppCenterAnalytics" -framework "AppCenterCrashes" -framework "AppCenterPush" -framework "AppCenterReactNativeShared" -framework "CoreGraphics" -framework "CoreTelephony" -framework "Foundation" -framework "ImageIO" -framework "JavaScriptCore" -framework "MobileCoreServices" -framework "Photos" -framework "QuartzCore" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -weak_framework "UserNotifications"
OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/SSZipArchive/SSZipArchive.modulemap"
OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/SDWebImage/SDWebImage.modulemap" -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/SSZipArchive/SSZipArchive.modulemap"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.

View File

@ -2,9 +2,9 @@ FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/AppCenter/AppCenter-SDK-Appl
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AppCenter" "${PODS_ROOT}/Headers/Public/AppCenterReactNativeShared" "${PODS_ROOT}/Headers/Public/Base64" "${PODS_ROOT}/Headers/Public/CodePush" "${PODS_ROOT}/Headers/Public/DoubleConversion" "${PODS_ROOT}/Headers/Public/FLAnimatedImage" "${PODS_ROOT}/Headers/Public/JWT" "${PODS_ROOT}/Headers/Public/QBImagePickerController" "${PODS_ROOT}/Headers/Public/RNImageCropPicker" "${PODS_ROOT}/Headers/Public/RSKImageCropper" "${PODS_ROOT}/Headers/Public/React" "${PODS_ROOT}/Headers/Public/SDWebImage" "${PODS_ROOT}/Headers/Public/SSZipArchive" "${PODS_ROOT}/Headers/Public/glog" "${PODS_ROOT}/Headers/Public/react-native-fast-image" "${PODS_ROOT}/Headers/Public/react-native-version-number" "${PODS_ROOT}/Headers/Public/yoga"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Base64" "${PODS_CONFIGURATION_BUILD_DIR}/CodePush" "${PODS_CONFIGURATION_BUILD_DIR}/DoubleConversion" "${PODS_CONFIGURATION_BUILD_DIR}/FLAnimatedImage" "${PODS_CONFIGURATION_BUILD_DIR}/Folly" "${PODS_CONFIGURATION_BUILD_DIR}/JWT" "${PODS_CONFIGURATION_BUILD_DIR}/QBImagePickerController" "${PODS_CONFIGURATION_BUILD_DIR}/RNImageCropPicker" "${PODS_CONFIGURATION_BUILD_DIR}/RSKImageCropper" "${PODS_CONFIGURATION_BUILD_DIR}/React" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" "${PODS_CONFIGURATION_BUILD_DIR}/SSZipArchive" "${PODS_CONFIGURATION_BUILD_DIR}/glog" "${PODS_CONFIGURATION_BUILD_DIR}/react-native-fast-image" "${PODS_CONFIGURATION_BUILD_DIR}/react-native-version-number" "${PODS_CONFIGURATION_BUILD_DIR}/yoga"
OTHER_CFLAGS = $(inherited) -fmodule-map-file="${PODS_ROOT}/Headers/Public/SSZipArchive/SSZipArchive.modulemap" -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AppCenter" -isystem "${PODS_ROOT}/Headers/Public/AppCenterReactNativeShared" -isystem "${PODS_ROOT}/Headers/Public/Base64" -isystem "${PODS_ROOT}/Headers/Public/CodePush" -isystem "${PODS_ROOT}/Headers/Public/DoubleConversion" -isystem "${PODS_ROOT}/Headers/Public/FLAnimatedImage" -isystem "${PODS_ROOT}/Headers/Public/JWT" -isystem "${PODS_ROOT}/Headers/Public/QBImagePickerController" -isystem "${PODS_ROOT}/Headers/Public/RNImageCropPicker" -isystem "${PODS_ROOT}/Headers/Public/RSKImageCropper" -isystem "${PODS_ROOT}/Headers/Public/React" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage" -isystem "${PODS_ROOT}/Headers/Public/SSZipArchive" -isystem "${PODS_ROOT}/Headers/Public/glog" -isystem "${PODS_ROOT}/Headers/Public/react-native-fast-image" -isystem "${PODS_ROOT}/Headers/Public/react-native-version-number" -isystem "${PODS_ROOT}/Headers/Public/yoga"
OTHER_CFLAGS = $(inherited) -fmodule-map-file="${PODS_ROOT}/Headers/Public/SDWebImage/SDWebImage.modulemap" -fmodule-map-file="${PODS_ROOT}/Headers/Public/SSZipArchive/SSZipArchive.modulemap" -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AppCenter" -isystem "${PODS_ROOT}/Headers/Public/AppCenterReactNativeShared" -isystem "${PODS_ROOT}/Headers/Public/Base64" -isystem "${PODS_ROOT}/Headers/Public/CodePush" -isystem "${PODS_ROOT}/Headers/Public/DoubleConversion" -isystem "${PODS_ROOT}/Headers/Public/FLAnimatedImage" -isystem "${PODS_ROOT}/Headers/Public/JWT" -isystem "${PODS_ROOT}/Headers/Public/QBImagePickerController" -isystem "${PODS_ROOT}/Headers/Public/RNImageCropPicker" -isystem "${PODS_ROOT}/Headers/Public/RSKImageCropper" -isystem "${PODS_ROOT}/Headers/Public/React" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage" -isystem "${PODS_ROOT}/Headers/Public/SSZipArchive" -isystem "${PODS_ROOT}/Headers/Public/glog" -isystem "${PODS_ROOT}/Headers/Public/react-native-fast-image" -isystem "${PODS_ROOT}/Headers/Public/react-native-version-number" -isystem "${PODS_ROOT}/Headers/Public/yoga"
OTHER_LDFLAGS = $(inherited) -ObjC -l"Base64" -l"CodePush" -l"DoubleConversion" -l"FLAnimatedImage" -l"Folly" -l"JWT" -l"QBImagePickerController" -l"RNImageCropPicker" -l"RSKImageCropper" -l"React" -l"SDWebImage" -l"SSZipArchive" -l"c++" -l"glog" -l"react-native-fast-image" -l"react-native-version-number" -l"sqlite3" -l"stdc++" -l"yoga" -l"z" -framework "AppCenter" -framework "AppCenterAnalytics" -framework "AppCenterCrashes" -framework "AppCenterPush" -framework "AppCenterReactNativeShared" -framework "CoreGraphics" -framework "CoreTelephony" -framework "Foundation" -framework "ImageIO" -framework "JavaScriptCore" -framework "MobileCoreServices" -framework "Photos" -framework "QuartzCore" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -weak_framework "UserNotifications"
OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/SSZipArchive/SSZipArchive.modulemap"
OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/SDWebImage/SDWebImage.modulemap" -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/SSZipArchive/SSZipArchive.modulemap"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.

View File

@ -2,9 +2,9 @@ FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/AppCenter/AppCenter-SDK-Appl
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AppCenter" "${PODS_ROOT}/Headers/Public/AppCenterReactNativeShared" "${PODS_ROOT}/Headers/Public/Base64" "${PODS_ROOT}/Headers/Public/CodePush" "${PODS_ROOT}/Headers/Public/DoubleConversion" "${PODS_ROOT}/Headers/Public/FLAnimatedImage" "${PODS_ROOT}/Headers/Public/JWT" "${PODS_ROOT}/Headers/Public/QBImagePickerController" "${PODS_ROOT}/Headers/Public/RNImageCropPicker" "${PODS_ROOT}/Headers/Public/RSKImageCropper" "${PODS_ROOT}/Headers/Public/React" "${PODS_ROOT}/Headers/Public/SDWebImage" "${PODS_ROOT}/Headers/Public/SSZipArchive" "${PODS_ROOT}/Headers/Public/glog" "${PODS_ROOT}/Headers/Public/react-native-fast-image" "${PODS_ROOT}/Headers/Public/react-native-version-number" "${PODS_ROOT}/Headers/Public/yoga"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Base64" "${PODS_CONFIGURATION_BUILD_DIR}/CodePush" "${PODS_CONFIGURATION_BUILD_DIR}/DoubleConversion" "${PODS_CONFIGURATION_BUILD_DIR}/FLAnimatedImage" "${PODS_CONFIGURATION_BUILD_DIR}/Folly" "${PODS_CONFIGURATION_BUILD_DIR}/JWT" "${PODS_CONFIGURATION_BUILD_DIR}/QBImagePickerController" "${PODS_CONFIGURATION_BUILD_DIR}/RNImageCropPicker" "${PODS_CONFIGURATION_BUILD_DIR}/RSKImageCropper" "${PODS_CONFIGURATION_BUILD_DIR}/React" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" "${PODS_CONFIGURATION_BUILD_DIR}/SSZipArchive" "${PODS_CONFIGURATION_BUILD_DIR}/glog" "${PODS_CONFIGURATION_BUILD_DIR}/react-native-fast-image" "${PODS_CONFIGURATION_BUILD_DIR}/react-native-version-number" "${PODS_CONFIGURATION_BUILD_DIR}/yoga"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AppCenter" -isystem "${PODS_ROOT}/Headers/Public/AppCenterReactNativeShared" -isystem "${PODS_ROOT}/Headers/Public/Base64" -isystem "${PODS_ROOT}/Headers/Public/CodePush" -isystem "${PODS_ROOT}/Headers/Public/DoubleConversion" -isystem "${PODS_ROOT}/Headers/Public/FLAnimatedImage" -isystem "${PODS_ROOT}/Headers/Public/JWT" -isystem "${PODS_ROOT}/Headers/Public/QBImagePickerController" -isystem "${PODS_ROOT}/Headers/Public/RNImageCropPicker" -isystem "${PODS_ROOT}/Headers/Public/RSKImageCropper" -isystem "${PODS_ROOT}/Headers/Public/React" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage" -isystem "${PODS_ROOT}/Headers/Public/SSZipArchive" -isystem "${PODS_ROOT}/Headers/Public/glog" -isystem "${PODS_ROOT}/Headers/Public/react-native-fast-image" -isystem "${PODS_ROOT}/Headers/Public/react-native-version-number" -isystem "${PODS_ROOT}/Headers/Public/yoga" -fmodule-map-file="${PODS_ROOT}/Headers/Public/SSZipArchive/SSZipArchive.modulemap"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AppCenter" -isystem "${PODS_ROOT}/Headers/Public/AppCenterReactNativeShared" -isystem "${PODS_ROOT}/Headers/Public/Base64" -isystem "${PODS_ROOT}/Headers/Public/CodePush" -isystem "${PODS_ROOT}/Headers/Public/DoubleConversion" -isystem "${PODS_ROOT}/Headers/Public/FLAnimatedImage" -isystem "${PODS_ROOT}/Headers/Public/JWT" -isystem "${PODS_ROOT}/Headers/Public/QBImagePickerController" -isystem "${PODS_ROOT}/Headers/Public/RNImageCropPicker" -isystem "${PODS_ROOT}/Headers/Public/RSKImageCropper" -isystem "${PODS_ROOT}/Headers/Public/React" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage" -isystem "${PODS_ROOT}/Headers/Public/SSZipArchive" -isystem "${PODS_ROOT}/Headers/Public/glog" -isystem "${PODS_ROOT}/Headers/Public/react-native-fast-image" -isystem "${PODS_ROOT}/Headers/Public/react-native-version-number" -isystem "${PODS_ROOT}/Headers/Public/yoga" -fmodule-map-file="${PODS_ROOT}/Headers/Public/SDWebImage/SDWebImage.modulemap" -fmodule-map-file="${PODS_ROOT}/Headers/Public/SSZipArchive/SSZipArchive.modulemap"
OTHER_LDFLAGS = $(inherited) -ObjC -l"c++" -l"sqlite3" -l"stdc++" -l"z" -framework "CoreGraphics" -framework "CoreTelephony" -framework "Foundation" -framework "ImageIO" -framework "JavaScriptCore" -framework "MobileCoreServices" -framework "Photos" -framework "QuartzCore" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -weak_framework "UserNotifications"
OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/SSZipArchive/SSZipArchive.modulemap"
OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/SDWebImage/SDWebImage.modulemap" -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/SSZipArchive/SSZipArchive.modulemap"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.

View File

@ -2,9 +2,9 @@ FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/AppCenter/AppCenter-SDK-Appl
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AppCenter" "${PODS_ROOT}/Headers/Public/AppCenterReactNativeShared" "${PODS_ROOT}/Headers/Public/Base64" "${PODS_ROOT}/Headers/Public/CodePush" "${PODS_ROOT}/Headers/Public/DoubleConversion" "${PODS_ROOT}/Headers/Public/FLAnimatedImage" "${PODS_ROOT}/Headers/Public/JWT" "${PODS_ROOT}/Headers/Public/QBImagePickerController" "${PODS_ROOT}/Headers/Public/RNImageCropPicker" "${PODS_ROOT}/Headers/Public/RSKImageCropper" "${PODS_ROOT}/Headers/Public/React" "${PODS_ROOT}/Headers/Public/SDWebImage" "${PODS_ROOT}/Headers/Public/SSZipArchive" "${PODS_ROOT}/Headers/Public/glog" "${PODS_ROOT}/Headers/Public/react-native-fast-image" "${PODS_ROOT}/Headers/Public/react-native-version-number" "${PODS_ROOT}/Headers/Public/yoga"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Base64" "${PODS_CONFIGURATION_BUILD_DIR}/CodePush" "${PODS_CONFIGURATION_BUILD_DIR}/DoubleConversion" "${PODS_CONFIGURATION_BUILD_DIR}/FLAnimatedImage" "${PODS_CONFIGURATION_BUILD_DIR}/Folly" "${PODS_CONFIGURATION_BUILD_DIR}/JWT" "${PODS_CONFIGURATION_BUILD_DIR}/QBImagePickerController" "${PODS_CONFIGURATION_BUILD_DIR}/RNImageCropPicker" "${PODS_CONFIGURATION_BUILD_DIR}/RSKImageCropper" "${PODS_CONFIGURATION_BUILD_DIR}/React" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" "${PODS_CONFIGURATION_BUILD_DIR}/SSZipArchive" "${PODS_CONFIGURATION_BUILD_DIR}/glog" "${PODS_CONFIGURATION_BUILD_DIR}/react-native-fast-image" "${PODS_CONFIGURATION_BUILD_DIR}/react-native-version-number" "${PODS_CONFIGURATION_BUILD_DIR}/yoga"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AppCenter" -isystem "${PODS_ROOT}/Headers/Public/AppCenterReactNativeShared" -isystem "${PODS_ROOT}/Headers/Public/Base64" -isystem "${PODS_ROOT}/Headers/Public/CodePush" -isystem "${PODS_ROOT}/Headers/Public/DoubleConversion" -isystem "${PODS_ROOT}/Headers/Public/FLAnimatedImage" -isystem "${PODS_ROOT}/Headers/Public/JWT" -isystem "${PODS_ROOT}/Headers/Public/QBImagePickerController" -isystem "${PODS_ROOT}/Headers/Public/RNImageCropPicker" -isystem "${PODS_ROOT}/Headers/Public/RSKImageCropper" -isystem "${PODS_ROOT}/Headers/Public/React" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage" -isystem "${PODS_ROOT}/Headers/Public/SSZipArchive" -isystem "${PODS_ROOT}/Headers/Public/glog" -isystem "${PODS_ROOT}/Headers/Public/react-native-fast-image" -isystem "${PODS_ROOT}/Headers/Public/react-native-version-number" -isystem "${PODS_ROOT}/Headers/Public/yoga" -fmodule-map-file="${PODS_ROOT}/Headers/Public/SSZipArchive/SSZipArchive.modulemap"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AppCenter" -isystem "${PODS_ROOT}/Headers/Public/AppCenterReactNativeShared" -isystem "${PODS_ROOT}/Headers/Public/Base64" -isystem "${PODS_ROOT}/Headers/Public/CodePush" -isystem "${PODS_ROOT}/Headers/Public/DoubleConversion" -isystem "${PODS_ROOT}/Headers/Public/FLAnimatedImage" -isystem "${PODS_ROOT}/Headers/Public/JWT" -isystem "${PODS_ROOT}/Headers/Public/QBImagePickerController" -isystem "${PODS_ROOT}/Headers/Public/RNImageCropPicker" -isystem "${PODS_ROOT}/Headers/Public/RSKImageCropper" -isystem "${PODS_ROOT}/Headers/Public/React" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage" -isystem "${PODS_ROOT}/Headers/Public/SSZipArchive" -isystem "${PODS_ROOT}/Headers/Public/glog" -isystem "${PODS_ROOT}/Headers/Public/react-native-fast-image" -isystem "${PODS_ROOT}/Headers/Public/react-native-version-number" -isystem "${PODS_ROOT}/Headers/Public/yoga" -fmodule-map-file="${PODS_ROOT}/Headers/Public/SDWebImage/SDWebImage.modulemap" -fmodule-map-file="${PODS_ROOT}/Headers/Public/SSZipArchive/SSZipArchive.modulemap"
OTHER_LDFLAGS = $(inherited) -ObjC -l"c++" -l"sqlite3" -l"stdc++" -l"z" -framework "CoreGraphics" -framework "CoreTelephony" -framework "Foundation" -framework "ImageIO" -framework "JavaScriptCore" -framework "MobileCoreServices" -framework "Photos" -framework "QuartzCore" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" -weak_framework "UserNotifications"
OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/SSZipArchive/SSZipArchive.modulemap"
OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/SDWebImage/SDWebImage.modulemap" -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/SSZipArchive/SSZipArchive.modulemap"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.

View File

@ -1,8 +1,10 @@
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage
DEFINES_MODULE = YES
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/SDWebImage" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/FLAnimatedImage" "${PODS_ROOT}/Headers/Public/SDWebImage"
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/SDWebImage" "${PODS_ROOT}/Headers/Public"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/FLAnimatedImage"
OTHER_LDFLAGS = -framework "ImageIO"
OTHER_SWIFT_FLAGS = $(inherited) -import-underlying-module -Xcc -fmodule-map-file="${SRCROOT}/${MODULEMAP_FILE}"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}

View File

@ -2,7 +2,9 @@ CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/react-native-fast-imag
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/react-native-fast-image" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/DoubleConversion" "${PODS_ROOT}/Headers/Public/FLAnimatedImage" "${PODS_ROOT}/Headers/Public/React" "${PODS_ROOT}/Headers/Public/SDWebImage" "${PODS_ROOT}/Headers/Public/glog" "${PODS_ROOT}/Headers/Public/react-native-fast-image" "${PODS_ROOT}/Headers/Public/yoga"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DoubleConversion" "${PODS_CONFIGURATION_BUILD_DIR}/FLAnimatedImage" "${PODS_CONFIGURATION_BUILD_DIR}/Folly" "${PODS_CONFIGURATION_BUILD_DIR}/React" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" "${PODS_CONFIGURATION_BUILD_DIR}/glog" "${PODS_CONFIGURATION_BUILD_DIR}/yoga"
OTHER_CFLAGS = $(inherited) -fmodule-map-file="${PODS_ROOT}/Headers/Public/SDWebImage/SDWebImage.modulemap"
OTHER_LDFLAGS = -framework "UIKit"
OTHER_SWIFT_FLAGS = $(inherited) -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/SDWebImage/SDWebImage.modulemap"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}

View File

@ -1707,7 +1707,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n";
};
113EEBCD594A2DC02B68990D /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;

View File

@ -32,12 +32,13 @@
"buffer": "^5.2.1",
"core-js": "^2.6.0",
"crypto-js": "^3.1.9-1",
"currency-symbol-map": "^4.0.4",
"diff-match-patch": "^1.0.4",
"dsteem": "^0.10.1",
"intl": "^1.2.5",
"jsc-android": "^236355.1.1",
"moment": "^2.22.2",
"react": "^16.6.0-alpha.8af6728",
"react": "^16.7.0",
"react-intl": "^2.7.2",
"react-native": "^0.57.5",
"react-native-actionsheet": "^2.4.2",

View File

@ -4,7 +4,7 @@ import { TouchableWithoutFeedback, Text, View } from 'react-native';
import styles from './textButtonStyles';
const TextButtonView = ({
text, onPress, style, textStyle,
text, onPress, style, textStyle, isHasChild,
}) => (
<Fragment>
<TouchableWithoutFeedback style={[styles.button]} onPress={() => onPress && onPress()}>

View File

@ -0,0 +1,16 @@
import React, { Fragment } from 'react';
import { connect } from 'react-redux';
const FormattedCurrency = ({ value, fixAt = 5, currency }) => {
const { currencyRate, currencySymbol } = currency;
const valueInCurrency = value * currencyRate;
const toFixedValue = valueInCurrency.toFixed(fixAt);
return <Fragment key="result-val">{`${currencySymbol} ${toFixedValue}`}</Fragment>;
};
const mapStateToProps = state => ({
currency: state.application.currency,
});
export default connect(mapStateToProps)(FormattedCurrency);

View File

@ -0,0 +1,3 @@
import FormatedCurrency from './formattedCurrency/formattedCurrencyView';
export { FormatedCurrency };

View File

@ -14,6 +14,7 @@ import { vestsToRshares } from '../../../utils/conversions';
import { Icon } from '../../icon';
import { PulseAnimation } from '../../animations';
import { TextButton } from '../../buttons';
import { FormatedCurrency } from '../../formatedElements';
// STEEM
import { vote } from '../../../providers/steem/dsteem';
@ -203,7 +204,7 @@ class UpvoteView extends Component {
<TextButton
style={styles.payoutTextButton}
textStyle={[styles.payoutValue, isDecinedPayout && styles.declinedPayout]}
text={`$${_totalPayout}`}
text={<FormatedCurrency value={_totalPayout} />}
onPress={() => {
openPopover();
this.setState({ isShowDetails: true });

View File

@ -3,6 +3,8 @@ import searchApi from '../../config/search';
import imageApi from '../../config/imageApi';
import serverList from '../../config/serverListApi';
export const getCurrencyRate = currency => api.get(`/currencyRate/${currency.toUpperCase()}/steem`).then(resp => resp.data);
/**
* @params username
*/

View File

@ -84,7 +84,6 @@ const migration = (oldRealm, newRealm) => {
// if (oldRealm.schemaVersion < 1) {
// const oldObjects = oldRealm.objects('Person');
// const newObjects = newRealm.objects('Person');
// // loop through all objects and set the name property in the new schema
// for (let i = 0; i < oldObjects.length; i++) {
// newObjects[i].name = `${oldObjects[i].firstName} ${oldObjects[i].lastName}`;
@ -411,10 +410,10 @@ export const setNotificationIsOpen = notificationIsOpen => new Promise((resolve,
}
});
export const setCurrency = selectedCurrency => new Promise((resolve, reject) => {
export const setCurrency = currencyProps => new Promise((resolve, reject) => {
try {
realm.write(() => {
settings[0].curreny = selectedCurrency;
settings[0].currency = currencyProps;
resolve(true);
});
} catch (error) {

View File

@ -1,3 +1,5 @@
import getSymbolFromCurrency from 'currency-symbol-map';
import { getCurrencyRate } from '../../providers/esteem/esteem';
import {
ACTIVE_APPLICATION,
CLOSE_PIN_CODE_MODAL,
@ -50,11 +52,6 @@ export const setLanguage = payload => ({
type: SET_LANGUAGE,
});
export const setCurrency = payload => ({
payload,
type: SET_CURRENCY,
});
export const setApi = payload => ({
payload,
type: SET_API,
@ -79,3 +76,15 @@ export const setConnectivityStatus = payload => ({
payload,
type: IS_CONNECTED,
});
/**
* MW
*/
export const setCurrency = currency => (dispatch) => {
const currencySymbol = getSymbolFromCurrency(currency);
getCurrencyRate(currency).then(currencyRate => dispatch({
type: SET_CURRENCY,
payload: { currency, currencyRate, currencySymbol },
}));
};

View File

@ -17,7 +17,11 @@ import {
const initialState = {
api: 'api.steemit.com',
currency: 'usd',
currency: {
currency: 'usd',
currecyRate: 1,
currencySymbol: '$',
},
isActive: false,
isConnected: true, // internet connectivity
isDarkTheme: false,

View File

@ -116,9 +116,9 @@ class ApplicationContainer extends Component {
}
_fetchApp = async () => {
this._refreshGlobalProps();
this._getSettings();
await this._getUserData();
this._refreshGlobalProps();
};
_handleConntectionChange = (status) => {
@ -223,17 +223,18 @@ class ApplicationContainer extends Component {
};
_getSettings = () => {
const { dispatch } = this.props;
const { dispatch, actions } = this.props;
getSettings().then((response) => {
if (response) {
if (response.isDarkTheme !== '') dispatch(isDarkTheme(response.isDarkTheme));
if (response.language !== '') dispatch(setLanguage(response.language));
if (response.currency !== '') dispatch(setCurrency(response.currency));
if (response.notification !== '') dispatch(isNotificationOpen(response.notification));
if (response.server !== '') dispatch(setApi(response.server));
if (response.upvotePercent !== '') dispatch(setUpvotePercent(Number(response.upvotePercent)));
dispatch(setCurrency(response.currency !== '' ? response.currency : 'usd'));
this.setState({ isReady: true });
}
});
@ -340,6 +341,7 @@ export default connect(
notificationSettings: state.application.isNotificationOpen,
isLogingOut: state.application.isLogingOut,
isLoggedIn: state.application.isLoggedIn,
isConnected: state.application.isConnected,
nav: state.nav.routes,
// Account

View File

@ -26,7 +26,7 @@ class ApplicationScreen extends Component {
render() {
const { isConnected, isDarkTheme, locale } = this.props;
const barStyle = isDarkTheme || !isConnected ? 'light-content' : 'dark-content';
const barStyle = isDarkTheme ? 'light-content' : 'dark-content';
const barColor = isDarkTheme ? '#1e2835' : '#fff';
return (

View File

@ -1,4 +1,4 @@
import React, { Component, Fragment } from 'react';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { withNavigation } from 'react-navigation';
@ -28,9 +28,9 @@ class ProfileContainer extends Component {
constructor(props) {
super(props);
const isReverseHeader = !!(
props.navigation.state &&
props.navigation.state.params &&
props.navigation.state.username
props.navigation.state
&& props.navigation.state.params
&& props.navigation.state.username
);
this.state = {
@ -78,8 +78,7 @@ class ProfileContainer extends Component {
const {
navigation, currentAccount, activeBottomTab, isLoggedIn,
} = this.props;
const currentUsername = currentAccount.name !== nextProps.currentAccount.name
&& nextProps.currentAccount.name;
const currentUsername = currentAccount.name !== nextProps.currentAccount.name && nextProps.currentAccount.name;
if (isLoggedIn && !nextProps.isLoggedIn) {
navigation.navigate(ROUTES.SCREENS.LOGIN);
@ -328,45 +327,50 @@ class ProfileContainer extends Component {
user,
username,
} = this.state;
const { isDarkTheme, isLoggedIn } = this.props;
const { isDarkTheme, isLoggedIn, currency } = this.props;
return (
<Fragment>
<ProfileScreen
about={user && user.about && user.about.profile}
avatar={avatar}
comments={comments}
error={error}
follows={follows}
handleFollowUnfollowUser={this._handleFollowUnfollowUser}
handleMuteUnmuteUser={this._handleMuteUnmuteUser}
handleOnBackPress={this._handleOnBackPress}
handleOnFavoritePress={this._handleOnFavoritePress}
handleOnFollowsPress={this._handleFollowsPress}
isDarkTheme={isDarkTheme}
isFavorite={isFavorite}
isFollowing={isFollowing}
isLoggedIn={isLoggedIn}
isMuted={isMuted}
isProfileLoading={isProfileLoading}
isReady={isReady}
isReverseHeader={isReverseHeader}
selectedQuickProfile={selectedQuickProfile}
selectedUser={user}
username={username}
getReplies={() => this._getReplies(username)}
/>
</Fragment>
<ProfileScreen
about={user && user.about && user.about.profile}
avatar={avatar}
comments={comments}
currency={currency}
error={error}
follows={follows}
getReplies={() => this._getReplies(username)}
handleFollowUnfollowUser={this._handleFollowUnfollowUser}
handleMuteUnmuteUser={this._handleMuteUnmuteUser}
handleOnBackPress={this._handleOnBackPress}
handleOnFavoritePress={this._handleOnFavoritePress}
handleOnFollowsPress={this._handleFollowsPress}
isDarkTheme={isDarkTheme}
isFavorite={isFavorite}
isFollowing={isFollowing}
isLoggedIn={isLoggedIn}
isMuted={isMuted}
isProfileLoading={isProfileLoading}
isReady={isReady}
isReverseHeader={isReverseHeader}
selectedQuickProfile={selectedQuickProfile}
selectedUser={user}
username={username}
/>
);
}
}
const mapStateToProps = state => ({
// Applicaiton
isLoggedIn: state.application.isLoggedIn,
isDarkTheme: state.application.isDarkTheme,
currency: state.application.currency,
// Ui
activeBottomTab: state.ui.activeBottomTab,
// Account
currentAccount: state.account.currentAccount,
pinCode: state.account.pin,
isDarkTheme: state.application.isDarkTheme,
activeBottomTab: state.ui.activeBottomTab,
});
export default connect(mapStateToProps)(withNavigation(ProfileContainer));

View File

@ -1,5 +1,5 @@
import React, { PureComponent, Fragment } from 'react';
import { View, ScrollView } from 'react-native';
import { View, Text, ScrollView } from 'react-native';
import { injectIntl } from 'react-intl';
// Components
@ -16,6 +16,9 @@ import { Posts } from '../../../components/posts';
import { ProfileSummary } from '../../../components/profileSummary';
import { TabBar } from '../../../components/tabBar';
import { Wallet } from '../../../components/wallet';
import { FormatedCurrency } from '../../../components/formatedElements';
// Constants
import { PROFILE_FILTERS } from '../../../constants/options/filters';
// Utilitites
@ -55,13 +58,15 @@ class ProfileScreen extends PureComponent {
_setEstimatedWalletValue = (value) => {
if (value) this.setState({ estimatedWalletValue: value });
}
};
render() {
const {
about,
comments,
currency,
follows,
getReplies,
handleFollowUnfollowUser,
handleMuteUnmuteUser,
handleOnBackPress,
@ -79,11 +84,13 @@ class ProfileScreen extends PureComponent {
selectedQuickProfile,
selectedUser,
username,
getReplies,
} = this.props;
const {
isSummaryOpen, collapsibleMoreHeight, estimatedWalletValue, oldEstimatedWalletValue,
isSummaryOpen,
collapsibleMoreHeight,
estimatedWalletValue,
oldEstimatedWalletValue,
} = this.state;
let _about;
@ -94,6 +101,7 @@ class ProfileScreen extends PureComponent {
let resourceCredits;
let fullInHourVP;
let fullInHourRC;
let _estimatedWalletValue;
if (selectedUser) {
votingPower = getVotingPower(selectedUser).toFixed(1);
@ -108,6 +116,14 @@ class ProfileScreen extends PureComponent {
({ location } = about);
({ website } = about);
}
if (estimatedWalletValue) {
const { currencyRate, currencySymbol } = currency;
_estimatedWalletValue = `${currencySymbol} ${(estimatedWalletValue * currencyRate).toFixed(
5,
)}`;
}
return (
<Fragment>
<Header
@ -192,12 +208,15 @@ class ProfileScreen extends PureComponent {
/>
</View>
<View
tabLabel={isReverseHeader
? intl.formatMessage({
id: 'profile.comments',
}) : intl.formatMessage({
id: 'profile.replies',
})}
tabLabel={
isReverseHeader
? intl.formatMessage({
id: 'profile.comments',
})
: intl.formatMessage({
id: 'profile.replies',
})
}
style={styles.commentsTabBar}
>
{comments && comments.length > 0 ? (
@ -217,20 +236,22 @@ class ProfileScreen extends PureComponent {
)}
</View>
<View
tabLabel={estimatedWalletValue
? `$${Math.round(estimatedWalletValue * 1000) / 1000}`
: intl.formatMessage({
id: 'profile.wallet',
})}
tabLabel={
estimatedWalletValue
? `${_estimatedWalletValue}`
: intl.formatMessage({
id: 'profile.wallet',
})
}
>
{selectedUser
? (
<Wallet
setEstimatedWalletValue={this._setEstimatedWalletValue}
selectedUser={selectedUser}
/>
)
: <WalletDetailsPlaceHolder />}
{selectedUser ? (
<Wallet
setEstimatedWalletValue={this._setEstimatedWalletValue}
selectedUser={selectedUser}
/>
) : (
<WalletDetailsPlaceHolder />
)}
</View>
</ScrollableTabView>
</View>

View File

@ -22,7 +22,7 @@ import {
isDarkTheme,
openPinCodeModal,
} from '../../../redux/actions/applicationActions';
import { setPushToken, getNodes } from '../../../providers/esteem/esteem';
import { setPushToken, getNodes, getCurrencyRate } from '../../../providers/esteem/esteem';
// Middleware
@ -65,8 +65,7 @@ class SettingsContainer extends Component {
switch (actionType) {
case 'currency':
dispatch(setCurrency(CURRENCY_VALUE[action]));
setCurrency2DB(CURRENCY_VALUE[action]);
this._currencyChange(action);
break;
case 'language':
@ -84,6 +83,13 @@ class SettingsContainer extends Component {
}
};
_currencyChange = (action) => {
const { dispatch } = this.props;
dispatch(setCurrency(CURRENCY_VALUE[action]));
setCurrency2DB(CURRENCY_VALUE[action]);
};
_handleToggleChanged = (action, actionType) => {
const { dispatch } = this.props;
@ -174,4 +180,5 @@ const mapStateToProps = state => ({
isLoggedIn: state.application.isLoggedIn,
username: state.account.currentAccount && state.account.currentAccount.name,
});
export default connect(mapStateToProps)(SettingsContainer);

View File

@ -59,7 +59,7 @@ class SettingsScreen extends PureComponent {
type="dropdown"
actionType="currency"
options={CURRENCY}
selectedOptionIndex={CURRENCY_VALUE.indexOf(selectedCurrency)}
selectedOptionIndex={CURRENCY_VALUE.indexOf(selectedCurrency.currency)}
handleOnChange={handleOnChange}
/>
<SettingsItem

View File

@ -2567,6 +2567,11 @@ csstype@^2.2.0:
resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.5.8.tgz#4ce5aa16ea0d562ef9105fa3ae2676f199586a35"
integrity sha512-r4DbsyNJ7slwBSKoGesxDubRWJ71ghG8W2+1HcsDlAo12KGca9dDLv0u98tfdFw7ldBdoA7XmCnI6Q8LpAJXaQ==
currency-symbol-map@^4.0.4:
version "4.0.4"
resolved "https://registry.yarnpkg.com/currency-symbol-map/-/currency-symbol-map-4.0.4.tgz#3cfba625974dd3f86822d327ecbd10248695e95e"
integrity sha512-hkSCCopJXVsvIZIiumJc6FoNXR5LQ646c3ufzF0yfv3155PYygysHw24JuzPSg4j86EFpvtgeX+vEhzRtcJ5Ag==
damerau-levenshtein@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.4.tgz#03191c432cb6eea168bb77f3a55ffdccb8978514"
@ -7260,15 +7265,15 @@ react-transform-hmr@^1.0.4:
global "^4.3.0"
react-proxy "^1.1.7"
react@^16.6.0-alpha.8af6728:
version "16.6.3"
resolved "https://registry.yarnpkg.com/react/-/react-16.6.3.tgz#25d77c91911d6bbdd23db41e70fb094cc1e0871c"
integrity sha512-zCvmH2vbEolgKxtqXL2wmGCUxUyNheYn/C+PD1YAjfxHC54+MhdruyhO7QieQrYsYeTxrn93PM2y0jRH1zEExw==
react@^16.7.0:
version "16.7.0"
resolved "https://registry.yarnpkg.com/react/-/react-16.7.0.tgz#b674ec396b0a5715873b350446f7ea0802ab6381"
integrity sha512-StCz3QY8lxTb5cl2HJxjwLFOXPIFQp+p+hxQfc8WE0QiLfCtIlKj8/+5tjjKm8uSTlAW+fCPaavGFS06V9Ar3A==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.2"
scheduler "^0.11.2"
scheduler "^0.12.0"
read-pkg-up@^1.0.1:
version "1.0.1"
@ -7756,10 +7761,10 @@ scheduler@^0.10.0-alpha.8af6728:
loose-envify "^1.1.0"
object-assign "^4.1.1"
scheduler@^0.11.2:
version "0.11.3"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.11.3.tgz#b5769b90cf8b1464f3f3cfcafe8e3cd7555a2d6b"
integrity sha512-i9X9VRRVZDd3xZw10NY5Z2cVMbdYg6gqFecfj79USv1CFN+YrJ3gIPRKf1qlY+Sxly4djoKdfx1T+m9dnRB8kQ==
scheduler@^0.12.0:
version "0.12.0"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.12.0.tgz#8ab17699939c0aedc5a196a657743c496538647b"
integrity sha512-t7MBR28Akcp4Jm+QoR63XgAi9YgCUmgvDHqf5otgAj4QvdoBE4ImCX0ffehefePPG+aitiYHp0g/mW6s4Tp+dw==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"