Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
15c52dd
Merge pull request #470 from dashpay/master
pankcuf Nov 8, 2022
ebb0eec
chore: Add Ukrainian localization
tikhop Nov 22, 2022
47f2d88
Merge pull request #473 from dashpay/feature/ukrainian-localization
pankcuf Nov 23, 2022
acc6f66
feat: Remove spark prices operation
tikhop Nov 23, 2022
4a067c6
Merge pull request #474 from dashpay/feature/remove-spark-price-fetching
pankcuf Nov 23, 2022
835dc3d
chore: Remove DSNetworkActivityIndicatorManager
tikhop Dec 7, 2022
b5750a4
feat: Introduce new method within UIWindow class to get a key window
tikhop Dec 7, 2022
f111e5a
refactor: Use BackgroundTasks framework since the minimum supported i…
tikhop Dec 7, 2022
5cf3896
refactor: Use keyWindow method of UIWindow class to get a key window
tikhop Dec 7, 2022
5bd60df
chore: Remove checking for iOS 13 availability since the minimum supp…
tikhop Dec 7, 2022
d59ecf6
Merge pull request #475 from dashpay/chore/remove-deprecated-code
pankcuf Dec 7, 2022
abff423
feat: Expose DSLog macro to swift
tikhop Dec 8, 2022
736b947
Merge pull request #476 from dashpay/feature/expose-logger-to-swift
pankcuf Dec 8, 2022
e90d5a3
fix: setting requested currency code in fiatCurrencyString
Jan 6, 2023
2938ff8
Merge pull request #477 from Syn-McJ/fix/fiat-formatting
pankcuf Jan 6, 2023
59920a2
ci: Increase timeout for Network Info job
tikhop Jan 13, 2023
e7a3b1c
ci: Fire network job on push (temp)
tikhop Jan 13, 2023
48125e0
ci: Fix network info build caching
tikhop Jan 13, 2023
c7ace2b
ci: Fix relic when building fox macos
tikhop Jan 13, 2023
736e627
ci: Make network job to run only on PR
tikhop Jan 13, 2023
31c8c6a
Merge pull request #478 from dashpay/ci/fix-network-info
pankcuf Jan 13, 2023
7de0e44
feat: Don't use dash.casa api to fetch exchange rates. It doesn't wor…
tikhop Jan 14, 2023
b8c7f04
feat: Don't use itcoinaverage.com api to fetch exchange rates. This i…
tikhop Jan 14, 2023
fce935d
refactor: Remove Spark rates fetching operation since we don't use it…
tikhop Jan 14, 2023
f8788b3
feat: Update description for first fallback prices operation
tikhop Jan 14, 2023
afb74c3
refactor: Remove code we don't need
tikhop Jan 14, 2023
d3eeb37
Merge pull request #479 from dashpay/feature/currency-exchanger-impro…
pankcuf Jan 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/network.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ jobs:
run: pod install --repo-update
- name: Cache network info build
id: cache-network-info-build
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ./dashsync/Example/build/NetworkInfo/Build/Products/Debug
key: ${{ runner.os }}-NetworkInfo-${{ hashFiles('NetworkInfo') }}
key: ${{ runner.os }}-NetworkInfo-${{ hashFiles('NetworkInfo/**') }}
restore-keys: |
${{ runner.os }}-NetworkInfo-
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion DashSync.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Pod::Spec.new do |s|
s.ios.framework = 'UIKit'
s.macos.framework = 'Cocoa'
s.compiler_flags = '-Wno-comma'
s.dependency 'DashSharedCore', '0.2.6'
s.dependency 'DashSharedCore', '0.2.8'
s.dependency 'secp256k1_dash', '0.1.4-alpha.2'
s.dependency 'bls-signatures-pod', '1.0.7'
s.dependency 'CocoaLumberjack', '3.7.2'
Expand Down
20 changes: 2 additions & 18 deletions DashSync/iOS/Categories/UIColor+DSStyle.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,7 @@ + (UIColor *)ds_dashBlueColor {
}

+ (UIColor *)ds_labelColorForMode:(DSAppearanceMode)appearanceMode {
if (@available(iOS 13.0, *)) {
return [UIColor labelColor];
} else {
if (appearanceMode == DSAppearanceMode_Dark) {
return [UIColor whiteColor];
} else {
return [UIColor blackColor];
}
}
return [UIColor labelColor];
}

+ (UIColor *)ds_pinBackgroundColor {
Expand All @@ -61,15 +53,7 @@ + (UIColor *)ds_pinInputDotColor {
}

+ (UIColor *)ds_passphraseBackgroundColorForMode:(DSAppearanceMode)appearanceMode {
if (@available(iOS 13.0, *)) {
return [UIColor systemBackgroundColor];
} else {
if (appearanceMode == DSAppearanceMode_Dark) {
return [UIColor blackColor];
} else {
return [UIColor whiteColor];
}
}
return [UIColor systemBackgroundColor];
}

@end
Expand Down
1 change: 1 addition & 0 deletions DashSync/iOS/Categories/UIWindow+DSUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ NS_ASSUME_NONNULL_BEGIN

@interface UIWindow (DSUtils)

+ (nullable UIWindow *)keyWindow;
- (UIViewController *)ds_presentingViewController;

@end
Expand Down
34 changes: 34 additions & 0 deletions DashSync/iOS/Categories/UIWindow+DSUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,40 @@

@implementation UIWindow (DSUtils)

+ (nullable UIWindow *)keyWindow {
if (@available(iOS 15.0, *)) {
UIApplication *app = [UIApplication sharedApplication];
NSSet<UIScene *> *connectedScenes = app.connectedScenes;

for (UIScene *scene in connectedScenes) {
if ([scene isKindOfClass:UIWindowScene.class]) {
UIWindowScene *windowScene = (UIWindowScene *)scene;
UIWindow *window = windowScene.keyWindow;
if (window) return window;
}
}
} else if (@available(iOS 13.0, *)) {
UIApplication *app = [UIApplication sharedApplication];
NSSet<UIScene *> *connectedScenes = app.connectedScenes;

for (UIScene *scene in connectedScenes) {
if ([scene isKindOfClass:UIWindowScene.class]) {
UIWindowScene *windowScene = (UIWindowScene *)scene;
for (UIWindow *window in windowScene.windows) {
if (window.keyWindow) return window;
}
}
}
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return [[UIApplication sharedApplication] keyWindow];
#pragma clang diagnostic pop
}

return nil;
}

- (UIViewController *)ds_presentingViewController {
UIViewController *controller = [self rootViewController];
return [self ds_topViewControllerWithRootViewController:controller];
Expand Down
71 changes: 28 additions & 43 deletions DashSync/shared/DashSync.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,29 +66,25 @@ - (void)registerBackgroundFetchOnce {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// use background fetch to stay synced with the blockchain
if (@available(iOS 13.0, *)) {
BGTaskScheduler *taskScheduler = [BGTaskScheduler sharedScheduler];
const BOOL registerSuccess =
[taskScheduler registerForTaskWithIdentifier:BG_TASK_REFRESH_IDENTIFIER
usingQueue:nil
launchHandler:^(BGTask *task) {
[self scheduleBackgroundFetch];

[task setExpirationHandler:^{
[self backgroundFetchTimedOut];
}];

[self performFetchWithCompletionHandler:^(UIBackgroundFetchResult backgroundFetchResult) {
const BOOL success = backgroundFetchResult == UIBackgroundFetchResultNewData;
[task setTaskCompletedWithSuccess:success];
}];
}];

NSAssert(registerSuccess, @"Add background task identifier '%@' to the App's Info.plist",
BG_TASK_REFRESH_IDENTIFIER);
} else {
[[UIApplication sharedApplication] setMinimumBackgroundFetchInterval:UIApplicationBackgroundFetchIntervalMinimum];
}
BGTaskScheduler *taskScheduler = [BGTaskScheduler sharedScheduler];
const BOOL registerSuccess =
[taskScheduler registerForTaskWithIdentifier:BG_TASK_REFRESH_IDENTIFIER
usingQueue:nil
launchHandler:^(BGTask *task) {
[self scheduleBackgroundFetch];

[task setExpirationHandler:^{
[self backgroundFetchTimedOut];
}];

[self performFetchWithCompletionHandler:^(UIBackgroundFetchResult backgroundFetchResult) {
const BOOL success = backgroundFetchResult == UIBackgroundFetchResultNewData;
[task setTaskCompletedWithSuccess:success];
}];
}];

NSAssert(registerSuccess, @"Add background task identifier '%@' to the App's Info.plist",
BG_TASK_REFRESH_IDENTIFIER);
});
}
#endif
Expand Down Expand Up @@ -315,17 +311,15 @@ - (uint64_t)dbSize {

#if TARGET_OS_IOS
- (void)scheduleBackgroundFetch {
if (@available(iOS 13.0, *)) {
BGAppRefreshTaskRequest *request = [[BGAppRefreshTaskRequest alloc] initWithIdentifier:BG_TASK_REFRESH_IDENTIFIER];
// Fetch no earlier than 15 minutes from now
// Disabled as we'd like to be run asap
// request.earliestBeginDate = [NSDate dateWithTimeIntervalSinceNow:15.0 * 60.0];

NSError *error = nil;
[[BGTaskScheduler sharedScheduler] submitTaskRequest:request error:&error];
if (error) {
DSLog(@"Error scheduling background refresh");
}
BGAppRefreshTaskRequest *request = [[BGAppRefreshTaskRequest alloc] initWithIdentifier:BG_TASK_REFRESH_IDENTIFIER];
// Fetch no earlier than 15 minutes from now
// Disabled as we'd like to be run asap
// request.earliestBeginDate = [NSDate dateWithTimeIntervalSinceNow:15.0 * 60.0];

NSError *error = nil;
[[BGTaskScheduler sharedScheduler] submitTaskRequest:request error:&error];
if (error) {
DSLog(@"Error scheduling background refresh");
}
}

Expand All @@ -343,15 +337,6 @@ - (void)performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))com

self.backgroundFetchCompletion = completionHandler;

if (@available(iOS 13.0, *)) { //!OCLINT

} else {
// timeout after 25 seconds
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 25 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
[self backgroundFetchTimedOut];
});
}

NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];

self.protectedDataNotificationObserver =
Expand Down
6 changes: 6 additions & 0 deletions DashSync/shared/Libraries/DSLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ NS_ASSUME_NONNULL_BEGIN

- (NSArray<NSURL *> *)logFiles;

/** @fn log:
* @brief This method is identical to `DSLog` macro
* @param message Final message to log
*/
+ (void)log:(NSString *)message;

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

Expand Down
4 changes: 4 additions & 0 deletions DashSync/shared/Libraries/DSLogger.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ - (instancetype)init {
return [logFiles copy];
}

+ (void)log:(NSString *)message {
DSLog(@"%@", message);
}

@end

NS_ASSUME_NONNULL_END

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#import "HTTPLoaderOperation.h"

#import "DSNetworkActivityIndicatorManager.h"
#import "HTTPCancellationToken.h"
#import "HTTPLoader.h"
#import "HTTPLoaderDelegate.h"
Expand Down Expand Up @@ -69,8 +68,6 @@ - (void)performWithCompletion:(HTTPLoaderRawCompletionBlock)completion {

self.cancellationToken = [self.httpLoader performRequest:self.httpRequest];
NSAssert(self.cancellationToken, @"Performing request failed");

[DSNetworkActivityIndicatorManager increaseActivityCounter];
}

#pragma mark HTTPLoaderOperationProtocol
Expand Down Expand Up @@ -102,26 +99,20 @@ - (void)cancelByProducingResumeData:(void (^)(NSData *_Nullable resumeData))comp
#pragma mark HTTPLoaderDelegate

- (void)httpLoader:(HTTPLoader *)httpLoader didReceiveSuccessfulResponse:(HTTPResponse *)response {
[DSNetworkActivityIndicatorManager decreaseActivityCounter];

if (self.completion) {
self.completion(YES, NO, response);
}
self.completion = nil;
}

- (void)httpLoader:(HTTPLoader *)httpLoader didReceiveErrorResponse:(HTTPResponse *)response {
[DSNetworkActivityIndicatorManager decreaseActivityCounter];

if (self.completion) {
self.completion(NO, NO, response);
}
self.completion = nil;
}

- (void)httpLoader:(HTTPLoader *)httpLoader didCancelRequest:(HTTPRequest *)request {
[DSNetworkActivityIndicatorManager decreaseActivityCounter];

if (self.completion) {
self.completion(NO, YES, nil);
}
Expand Down
Loading