-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Issues with main screen and tests (#55)
- Loading branch information
1 parent
431bb9a
commit 858fa85
Showing
12 changed files
with
237 additions
and
91 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,34 @@ | ||
def shared_testing_pods | ||
pod 'Quick', '~> 1.2.0' | ||
pod 'Nimble', '~> 9.2.0' | ||
pod 'Nocilla', '~> 0.11.0' | ||
pod 'Alamofire', '~> 4.5' | ||
pod 'Alamofire-Synchronous', '~> 4.0' | ||
end | ||
target 'PostHog' do | ||
# Comment the next line if you don't want to use dynamic frameworks | ||
use_frameworks! | ||
|
||
# Pods for PostHog | ||
|
||
def shared_testing_pods | ||
pod 'Quick', '~> 1.2.0' | ||
pod 'Nimble', '~> 9.2.0' | ||
pod 'Nocilla', '~> 0.11.0' | ||
pod 'Alamofire', '~> 4.5' | ||
pod 'Alamofire-Synchronous', '~> 4.0' | ||
end | ||
|
||
target 'PostHogTests' do | ||
platform :ios, '11' | ||
use_frameworks! | ||
target 'PostHogTests' do | ||
# Pods for testing | ||
shared_testing_pods | ||
end | ||
end | ||
|
||
target 'PostHogTestsTVOS' do | ||
platform :tvos | ||
use_frameworks! | ||
shared_testing_pods | ||
target 'PostHogTestsTVOS' do | ||
# Pods for testing | ||
shared_testing_pods | ||
end | ||
|
||
post_install do |installer| | ||
installer.generated_projects.each do |project| | ||
project.targets.each do |target| | ||
target.build_configurations.each do |config| | ||
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0' | ||
end | ||
end | ||
end | ||
end | ||
end |
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#import "PHGUtils.h" | ||
|
||
|
||
@implementation PHGUtils | ||
|
||
+ (NSData *_Nullable)dataFromPlist:(nonnull id)plist | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <UIKit/UIKit.h> | ||
#import "PHGStorage.h" | ||
|
||
|
||
@interface PHGApplicationUtils : NSObject | ||
|
||
+ (instancetype _Nonnull) sharedInstance; | ||
@property (nonatomic, readonly, nullable) UIApplication *sharedApplication; | ||
@property (nonatomic, readonly, nullable) NSArray<UIWindow *> *windows; | ||
|
||
@end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#import "PHGApplicationUtils.h" | ||
#import <Foundation/Foundation.h> | ||
#import <UIKit/UIKit.h> | ||
|
||
@implementation PHGApplicationUtils | ||
|
||
+ (instancetype _Nonnull)sharedInstance | ||
{ | ||
static PHGApplicationUtils *sharedInstance = nil; | ||
static dispatch_once_t onceToken; | ||
dispatch_once(&onceToken, ^{ | ||
sharedInstance = [[PHGApplicationUtils alloc] init]; | ||
}); | ||
|
||
return sharedInstance; | ||
} | ||
|
||
|
||
|
||
- (UIApplication *)sharedApplication | ||
{ | ||
if (![UIApplication respondsToSelector:@selector(sharedApplication)]) | ||
return nil; | ||
|
||
return [UIApplication performSelector:@selector(sharedApplication)]; | ||
} | ||
|
||
- (NSArray<UIWindow *> *)windows | ||
{ | ||
UIApplication *app = [self sharedApplication]; | ||
NSMutableArray *result = [NSMutableArray array]; | ||
|
||
if (@available(iOS 13.0, tvOS 13.0, *)) { | ||
NSArray<UIScene *> *scenes = @[]; | ||
|
||
if (app && [app respondsToSelector:@selector(connectedScenes)]) { | ||
scenes = [app.connectedScenes allObjects]; | ||
} | ||
|
||
for (UIScene *scene in scenes) { | ||
if (scene.activationState == UISceneActivationStateForegroundActive && scene.delegate && | ||
[scene.delegate respondsToSelector:@selector(window)]) { | ||
id window = [scene.delegate performSelector:@selector(window)]; | ||
if (window) { | ||
[result addObject:window]; | ||
} | ||
} | ||
} | ||
} | ||
|
||
if ([app.delegate respondsToSelector:@selector(window)] && app.delegate.window != nil) { | ||
[result addObject:app.delegate.window]; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
@end | ||
|
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