jenkins-bot has submitted this change and it was merged.

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
Bug: T101705
---
M MediaWikiKit/MediaWikiKit/MWKSite.m
1 file changed, 9 insertions(+), 1 deletion(-)

Approvals:
  Fjalapeno: Looks good to me, approved
  Mhurd: Looks good to me, but someone else must approve
  jenkins-bot: Verified



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: merged
Gerrit-Change-Id: I3bba52502e2bc1f361137069ccdf87c38ac9cbba
Gerrit-PatchSet: 2
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Bgerstle <bgers...@wikimedia.org>
Gerrit-Reviewer: Fjalapeno <cfl...@wikimedia.org>
Gerrit-Reviewer: Mhurd <mh...@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