Skip to content

Commit 739dae5

Browse files
authored
Merge pull request #3 from Netfilter-Com/copilot/modernize-app-for-ios
Modernize app for new iOS versions
2 parents cf9e125 + bcc7827 commit 739dae5

15 files changed

Lines changed: 84 additions & 82 deletions

Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
platform :ios, '8.0'
1+
platform :ios, '13.0'
22
#use_frameworks!
33
source 'https://github.com/CocoaPods/Specs.git'
44

PopulationClock.xcodeproj/project.pbxproj

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
825C8BCF168B44E1009D357D /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 825C8BCE168B44E1009D357D /* MessageUI.framework */; };
3939
825C8BD1168B44E9009D357D /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 825C8BD0168B44E9009D357D /* SystemConfiguration.framework */; };
4040
825C8BD3168B44EF009D357D /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 825C8BD2168B44EF009D357D /* StoreKit.framework */; };
41-
825C8BD6168B4C9D009D357D /* Social.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 825C8BD4168B4C9D009D357D /* Social.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
42-
825C8BD7168B4C9D009D357D /* Twitter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 825C8BD5168B4C9D009D357D /* Twitter.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
41+
825C8BD8168B4C9E009D357D /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 825C8BD9168B4C9E009D357D /* WebKit.framework */; };
42+
825C8BDA168B4C9F009D357D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 825C8BDB168B4C9F009D357D /* LaunchScreen.storyboard */; };
4343
8281CBD3169CB2E3008035C3 /* Description.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8281CBD2169CB2E3008035C3 /* Description.strings */; };
4444
832487F117E8F59500FE6B17 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 832487F017E8F59500FE6B17 /* Images.xcassets */; };
4545
ED0108A21680AC110067F88D /* rotate.png in Resources */ = {isa = PBXBuildFile; fileRef = ED0108A01680AC110067F88D /* rotate.png */; };
@@ -660,8 +660,8 @@
660660
825C8BCE168B44E1009D357D /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; };
661661
825C8BD0168B44E9009D357D /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
662662
825C8BD2168B44EF009D357D /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
663-
825C8BD4168B4C9D009D357D /* Social.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Social.framework; path = System/Library/Frameworks/Social.framework; sourceTree = SDKROOT; };
664-
825C8BD5168B4C9D009D357D /* Twitter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Twitter.framework; path = System/Library/Frameworks/Twitter.framework; sourceTree = SDKROOT; };
663+
825C8BD9168B4C9E009D357D /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
664+
825C8BDB168B4C9F009D357D /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
665665
8281CBD2169CB2E3008035C3 /* Description.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = Description.strings; sourceTree = "<group>"; };
666666
832487F017E8F59500FE6B17 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
667667
9521174D992B9488A5C8C907 /* Pods-PopulationClock.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PopulationClock.release.xcconfig"; path = "Pods/Target Support Files/Pods-PopulationClock/Pods-PopulationClock.release.xcconfig"; sourceTree = "<group>"; };
@@ -1293,8 +1293,7 @@
12931293
buildActionMask = 2147483647;
12941294
files = (
12951295
ED0F6BE9169DE24000C34C3A /* Accelerate.framework in Frameworks */,
1296-
825C8BD6168B4C9D009D357D /* Social.framework in Frameworks */,
1297-
825C8BD7168B4C9D009D357D /* Twitter.framework in Frameworks */,
1296+
825C8BD8168B4C9E009D357D /* WebKit.framework in Frameworks */,
12981297
825C8BD3168B44EF009D357D /* StoreKit.framework in Frameworks */,
12991298
825C8BD1168B44E9009D357D /* SystemConfiguration.framework in Frameworks */,
13001299
825C8BCF168B44E1009D357D /* MessageUI.framework in Frameworks */,
@@ -1822,11 +1821,10 @@
18221821
EDA0C3A6167BAF1400CBECC4 /* Foundation.framework */,
18231822
825C8BCE168B44E1009D357D /* MessageUI.framework */,
18241823
ED0108C11680DB350067F88D /* QuartzCore.framework */,
1825-
825C8BD4168B4C9D009D357D /* Social.framework */,
18261824
825C8BD2168B44EF009D357D /* StoreKit.framework */,
18271825
825C8BD0168B44E9009D357D /* SystemConfiguration.framework */,
1828-
825C8BD5168B4C9D009D357D /* Twitter.framework */,
18291826
EDA0C3A4167BAF1400CBECC4 /* UIKit.framework */,
1827+
825C8BD9168B4C9E009D357D /* WebKit.framework */,
18301828
30DED07AB717E8D7FE43650B /* libPods-PopulationClock.a */,
18311829
);
18321830
name = Frameworks;
@@ -1865,6 +1863,7 @@
18651863
EDADD8011684D3E1007E8BD5 /* globals.m */,
18661864
EDF8D0801695BF3500FE02B1 /* InAppPurchaseManager.h */,
18671865
EDF8D0811695BF3500FE02B1 /* InAppPurchaseManager.m */,
1866+
825C8BDB168B4C9F009D357D /* LaunchScreen.storyboard */,
18681867
EDA0C3BC167BAF1400CBECC4 /* MainStoryboard.storyboard */,
18691868
ED7769D616C41D0B00BC486F /* MainStoryboard_iPhone.storyboard */,
18701869
EDA0C3D0167BB23800CBECC4 /* MainView.h */,
@@ -2113,6 +2112,7 @@
21132112
buildActionMask = 2147483647;
21142113
files = (
21152114
EDA0C3BE167BAF1400CBECC4 /* MainStoryboard.storyboard in Resources */,
2115+
825C8BDA168B4C9F009D357D /* LaunchScreen.storyboard in Resources */,
21162116
EDA0C3E0167BB2F800CBECC4 /* colormap.plist in Resources */,
21172117
EDA0C3E1167BB2F800CBECC4 /* colormap.png in Resources */,
21182118
EDA0C3E2167BB2F800CBECC4 /* coords.plist in Resources */,
@@ -2829,7 +2829,7 @@
28292829
GCC_WARN_UNINITIALIZED_AUTOS = YES;
28302830
GCC_WARN_UNUSED_FUNCTION = YES;
28312831
GCC_WARN_UNUSED_VARIABLE = YES;
2832-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
2832+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
28332833
ONLY_ACTIVE_ARCH = YES;
28342834
OTHER_LDFLAGS = "$(inherited)";
28352835
PROVISIONING_PROFILE = "8E9AF256-1983-4D9D-B88D-38766ADD43C8";
@@ -2868,7 +2868,7 @@
28682868
GCC_WARN_UNINITIALIZED_AUTOS = YES;
28692869
GCC_WARN_UNUSED_FUNCTION = YES;
28702870
GCC_WARN_UNUSED_VARIABLE = YES;
2871-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
2871+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
28722872
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
28732873
OTHER_LDFLAGS = "$(inherited)";
28742874
PROVISIONING_PROFILE = "8E9AF256-1983-4D9D-B88D-38766ADD43C8";
@@ -2883,15 +2883,14 @@
28832883
baseConfigurationReference = 27FC292071771B679991D81C /* Pods-PopulationClock.debug.xcconfig */;
28842884
buildSettings = {
28852885
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
2886-
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
28872886
CODE_SIGN_IDENTITY = "iPhone Developer";
28882887
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
28892888
ENABLE_BITCODE = NO;
28902889
GCC_PRECOMPILE_PREFIX_HEADER = YES;
28912890
GCC_PREFIX_HEADER = "PopulationClock/PopulationClock-Prefix.pch";
28922891
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
28932892
INFOPLIST_FILE = "PopulationClock/PopulationClock-Info.plist";
2894-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
2893+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
28952894
LIBRARY_SEARCH_PATHS = "$(inherited)";
28962895
PRODUCT_BUNDLE_IDENTIFIER = "br.com.netfilter.${PRODUCT_NAME:rfc1034identifier}";
28972896
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -2906,15 +2905,14 @@
29062905
baseConfigurationReference = 9521174D992B9488A5C8C907 /* Pods-PopulationClock.release.xcconfig */;
29072906
buildSettings = {
29082907
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
2909-
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
29102908
CODE_SIGN_IDENTITY = "iPhone Developer";
29112909
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
29122910
ENABLE_BITCODE = NO;
29132911
GCC_PRECOMPILE_PREFIX_HEADER = YES;
29142912
GCC_PREFIX_HEADER = "PopulationClock/PopulationClock-Prefix.pch";
29152913
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
29162914
INFOPLIST_FILE = "PopulationClock/PopulationClock-Info.plist";
2917-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
2915+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
29182916
LIBRARY_SEARCH_PATHS = "$(inherited)";
29192917
PRODUCT_BUNDLE_IDENTIFIER = "br.com.netfilter.${PRODUCT_NAME:rfc1034identifier}";
29202918
PRODUCT_NAME = "$(TARGET_NAME)";

PopulationClock/AppDelegate.m

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@ @implementation AppDelegate
1717

1818
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
1919
// Style all toolbar buttons
20-
if (SYSTEM_VERSION_LESS_THAN(@"7.0"))
21-
{
22-
UIImage *barButtonImage = [UIImage imageNamed:@"barBtn"];
23-
UIEdgeInsets insets = UIEdgeInsetsMake(0, (barButtonImage.size.width - 1) / 2, 0, (barButtonImage.size.width - 1) / 2);
24-
barButtonImage = [barButtonImage resizableImageWithCapInsets:insets];
25-
[[UIBarButtonItem appearance] setBackgroundImage:barButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
26-
}
2720
NSDictionary *attrs = @{NSForegroundColorAttributeName : [UIColor nf_orangeTextColor]};
2821
[[UIBarButtonItem appearance] setTitleTextAttributes:attrs forState:UIControlStateNormal];
2922

PopulationClock/CountryInfoViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
#import "CountryInfoViewController.h"
10+
#import "CountryInfoWebView.h"
1011
#import "DataManager.h"
1112

1213
@implementation CountryInfoViewController {
@@ -17,7 +18,7 @@ @implementation CountryInfoViewController {
1718
IBOutlet __weak UIView *_portraitWebViewBackground;
1819
IBOutlet __weak UIView *_landscapeFlag;
1920
IBOutlet __weak UILabel *_landscapeCountryName;
20-
IBOutlet __weak UIWebView *_webView;
21+
IBOutlet __weak CountryInfoWebView *_webView;
2122
}
2223

2324
- (void)dealloc {

PopulationClock/CountryInfoViewController_iPhone.m

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,7 @@ - (NSArray *)extraToolbarItemsForCarouselViewController:(NFCarouselViewControlle
9191
[_segmentedControl setTitleTextAttributes:attrs forState:UIControlStateNormal];
9292
[_segmentedControl setTitleTextAttributes:attrs forState:UIControlStateHighlighted];
9393

94-
if (SYSTEM_VERSION_LESS_THAN(@"7.0")) {
95-
UIImage *separator = [UIImage imageNamed:@"separadorAtiveInactive"];
96-
[_segmentedControl setBackgroundImage:[UIImage imageNamed:@"bgBtHeadInactive"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
97-
[_segmentedControl setBackgroundImage:[UIImage imageNamed:@"bgBtHeadActive"] forState:UIControlStateSelected barMetrics:UIBarMetricsDefault];
98-
[_segmentedControl setDividerImage:separator forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateSelected barMetrics:UIBarMetricsDefault];
99-
[_segmentedControl setDividerImage:separator forLeftSegmentState:UIControlStateSelected rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
100-
} else {
101-
[_segmentedControl setTintColor:[UIColor nf_orangeTextColor]];
102-
}
94+
[_segmentedControl setTintColor:[UIColor nf_orangeTextColor]];
10395

10496
if (_selectedCountry) {
10597
_segmentedControl.selectedSegmentIndex = [_selectedCountry isEqualToString:@"world"] ? 0 : 1;

PopulationClock/CountryInfoWebView.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
// Copyright (c) 2012 NetFilter. All rights reserved.
77
//
88

9-
@interface CountryInfoWebView : UIWebView
9+
#import <WebKit/WebKit.h>
10+
11+
@interface CountryInfoWebView : UIView
12+
13+
@property (nonatomic, readonly) UIScrollView *scrollView;
14+
15+
- (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL;
1016

1117
@end

PopulationClock/CountryInfoWebView.m

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
//
88

99
#import <QuartzCore/QuartzCore.h>
10+
#import <WebKit/WebKit.h>
1011

1112
#import "CountryInfoWebView.h"
1213
#import "DataManager.h"
1314
#import "StatsBuilder.h"
1415

1516
@implementation CountryInfoWebView {
17+
WKWebView *_webView;
1618
NSString *_selectedCountry;
1719
CALayer *_shadowLayer;
1820

@@ -29,19 +31,23 @@ + (Class)layerClass
2931

3032
- (void)awakeFromNib {
3133
[super awakeFromNib];
34+
35+
// Create the internal WKWebView
36+
WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
37+
_webView = [[WKWebView alloc] initWithFrame:self.bounds configuration:config];
38+
_webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
39+
_webView.opaque = NO;
40+
_webView.backgroundColor = [UIColor clearColor];
41+
_webView.scrollView.backgroundColor = [UIColor clearColor];
42+
[self addSubview:_webView];
43+
3244
// Create the queue for background stuff
3345
_backgroundQueue = dispatch_queue_create("br.com.netfilter.CountryInfoWebView", 0);
3446
dispatch_queue_t lowPriorityQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0);
3547
dispatch_set_target_queue(_backgroundQueue, lowPriorityQueue);
3648

3749
// Disable bouncing
38-
self.scrollView.bounces = NO;
39-
40-
// Remove some random shadows (where does this come from?)
41-
for (UIView *subview in self.scrollView.subviews) {
42-
if ([subview isKindOfClass:[UIImageView class]])
43-
subview.hidden = YES;
44-
}
50+
_webView.scrollView.bounces = NO;
4551

4652
// Observe changes to the country selection
4753
[[NSNotificationCenter defaultCenter] addObserver:self
@@ -71,6 +77,14 @@ - (void)awakeFromNib {
7177
[self.layer addSublayer:_shadowLayer];
7278
}
7379

80+
- (UIScrollView *)scrollView {
81+
return _webView.scrollView;
82+
}
83+
84+
- (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL {
85+
[_webView loadHTMLString:string baseURL:baseURL];
86+
}
87+
7488
- (void)dealloc {
7589
// We are no longer observers
7690
[[NSNotificationCenter defaultCenter] removeObserver:self];
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21507" targetRuntime="AppleSDK" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3+
<scenes>
4+
<!--View Controller-->
5+
<scene sceneID="EHf-IW-A2E">
6+
<objects>
7+
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
8+
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
9+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
10+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
11+
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
12+
</view>
13+
</viewController>
14+
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ehk" userLabel="First Responder" sceneMemberID="firstResponder"/>
15+
</objects>
16+
<point key="canvasLocation" x="0" y="0"/>
17+
</scene>
18+
</scenes>
19+
</document>

PopulationClock/MainStoryboard_iPhone.storyboard

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,11 @@
209209
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
210210
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
211211
</view>
212-
<webView opaque="NO" contentMode="scaleToFill" id="U7w-0F-3g2" customClass="CountryInfoWebView">
212+
<view opaque="NO" contentMode="scaleToFill" id="U7w-0F-3g2" customClass="CountryInfoWebView">
213213
<rect key="frame" x="16" y="16" width="208" height="288"/>
214214
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
215215
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
216-
<dataDetectorType key="dataDetectorTypes"/>
217-
</webView>
216+
</view>
218217
</subviews>
219218
<color key="backgroundColor" cocoaTouchSystemColor="viewFlipsideBackgroundColor"/>
220219
</view>

PopulationClock/PopulationClock-Info.plist

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,17 @@
2222
<string>APPL</string>
2323
<key>CFBundleShortVersionString</key>
2424
<string>1.6.0</string>
25-
<key>CFBundleSignature</key>
26-
<string>????</string>
2725
<key>CFBundleVersion</key>
2826
<string>45</string>
2927
<key>LSRequiresIPhoneOS</key>
3028
<true/>
29+
<key>UILaunchStoryboardName</key>
30+
<string>LaunchScreen</string>
3131
<key>UIMainStoryboardFile~ipad</key>
3232
<string>MainStoryboard</string>
33-
<key>UIPrerenderedIcon</key>
34-
<true/>
3533
<key>UIRequiredDeviceCapabilities</key>
3634
<array>
37-
<string>armv7</string>
35+
<string>arm64</string>
3836
</array>
3937
<key>UIRequiresFullScreen</key>
4038
<true/>

0 commit comments

Comments
 (0)