Bgerstle has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/216692

Change subject: build url using formats until iOS 6 is dropped
......................................................................

build url using formats until iOS 6 is dropped

Can't use NSURLComponents until iOS 6 is dropped. Wrapped in a pragma
which will throw a compiler error when we drop iOS 6, that way we can
immediately switch to NSURLComponents.

Change-Id: I3bba52502e2bc1f361137069ccdf87c38ac9cbba
---
M MediaWikiKit/MediaWikiKit/MWKSite.m
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/ios/wikipedia 
refs/changes/92/216692/1

diff --git a/MediaWikiKit/MediaWikiKit/MWKSite.m 
b/MediaWikiKit/MediaWikiKit/MWKSite.m
index 66def57..d4ca25f 100644
--- a/MediaWikiKit/MediaWikiKit/MWKSite.m
+++ b/MediaWikiKit/MediaWikiKit/MWKSite.m
@@ -73,6 +73,8 @@
 }
 
 - (NSURL*)apiEndpoint:(BOOL)isMobile {
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_0
+#error use this implementation now that iOS 6 is dropped
     NSURLComponents* apiEndpointComponents = [[NSURLComponents alloc] init];
     apiEndpointComponents.scheme = @"https";
     NSMutableArray* hostComponents = [NSMutableArray 
arrayWithObject:self.language];
@@ -81,8 +83,14 @@
     }
     [hostComponents addObject:self.domain];
     apiEndpointComponents.host = [hostComponents 
componentsJoinedByString:@"."];
-    apiEndpointComponents.path = @"/w/api.php";
+    apiEndpointComponents.path = @"";
     return [apiEndpointComponents URL];
+#else
+    return [NSURL URLWithString:[NSString 
stringWithFormat:@"https://%@.%@%@/w/api.php";,
+                                 self.language,
+                                 isMobile ? @"m." : @"",
+                                 self.domain]];
+#endif
 }
 
 #pragma mark - NSObject

-- 
To view, visit https://gerrit.wikimedia.org/r/216692
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3bba52502e2bc1f361137069ccdf87c38ac9cbba
Gerrit-PatchSet: 1
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Bgerstle <bgers...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to