Merge lp:~urbanape/ubuntuone-ios-client/new-query-string-parser into lp:ubuntuone-ios-client

Proposed by Zachery Bir
Status: Merged
Approved by: Zachery Bir
Approved revision: 41
Merge reported by: Zachery Bir
Merged at revision: not available
Proposed branch: lp:~urbanape/ubuntuone-ios-client/new-query-string-parser
Merge into: lp:ubuntuone-ios-client
Diff against target: 260 lines (+150/-17)
5 files modified
contacts/iPhoneApp/Info.plist (+3/-3)
contacts/iPhoneApp/UI/include/URLQueryStringParser.h (+52/-0)
contacts/iPhoneApp/UI/src/AccountView.mm (+17/-14)
contacts/iPhoneApp/UI/src/URLQueryStringParser.mm (+72/-0)
contacts/iPhoneApp/funambolAppStore.xcodeproj/project.pbxproj (+6/-0)
To merge this branch: bzr merge lp:~urbanape/ubuntuone-ios-client/new-query-string-parser
Reviewer Review Type Date Requested Status
Aaron Brethorst (community) Approve
Review via email: mp+34582@code.launchpad.net

Description of the change

This branch uses parses the Funambol username and password out of the query string returned by the server, rather than encoded in the URL. It uses a new query string parser class to do this.

To post a comment you must log in.
Revision history for this message
Aaron Brethorst (aaronbrethorst-deactivatedaccount) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'contacts/iPhoneApp/Info.plist'
2--- contacts/iPhoneApp/Info.plist 2010-08-18 01:00:21 +0000
3+++ contacts/iPhoneApp/Info.plist 2010-09-03 21:17:44 +0000
4@@ -7,7 +7,7 @@
5 <key>CFBundleDevelopmentRegion</key>
6 <string>en</string>
7 <key>CFBundleDisplayName</key>
8- <string>Ubuntu One</string>
9+ <string>U1 Contacts</string>
10 <key>CFBundleExecutable</key>
11 <string>${EXECUTABLE_NAME}</string>
12 <key>CFBundleIconFile</key>
13@@ -35,10 +35,10 @@
14 <array>
15 <dict>
16 <key>CFBundleURLName</key>
17- <string>com.structlab.one.iphoneplugin</string>
18+ <string>com.ubuntu.one.iphoneplugin</string>
19 <key>CFBundleURLSchemes</key>
20 <array>
21- <string>ubuntuone</string>
22+ <string>x-ubuntuone-contacts</string>
23 </array>
24 </dict>
25 </array>
26
27=== added file 'contacts/iPhoneApp/UI/include/URLQueryStringParser.h'
28--- contacts/iPhoneApp/UI/include/URLQueryStringParser.h 1970-01-01 00:00:00 +0000
29+++ contacts/iPhoneApp/UI/include/URLQueryStringParser.h 2010-09-03 21:17:44 +0000
30@@ -0,0 +1,52 @@
31+/*
32+ * Funambol is a mobile platform developed by Funambol, Inc.
33+ * Copyright (C) 2010 Canonical Group Ltd.
34+ *
35+ * This program is free software; you can redistribute it and/or modify it under
36+ * the terms of the GNU Affero General Public License version 3 as published by
37+ * the Free Software Foundation with the addition of the following permission
38+ * added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
39+ * WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE
40+ * WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
41+ *
42+ * This program is distributed in the hope that it will be useful, but WITHOUT
43+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
44+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
45+ * details.
46+ *
47+ * You should have received a copy of the GNU Affero General Public License
48+ * along with this program; if not, see http://www.gnu.org/licenses or write to
49+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
50+ * MA 02110-1301 USA.
51+ *
52+ * You can contact Canonical Group Ltd. headquarters at:
53+ *
54+ * 27th Floor Millbank Tower
55+ * 21-24 Millbank
56+ * London SW1P 4QP
57+ * United Kingdom
58+ *
59+ * The interactive user interfaces in modified source and object code versions
60+ * of this program must display Appropriate Legal Notices, as required under
61+ * Section 5 of the GNU Affero General Public License version 3.
62+ *
63+ * In accordance with Section 7(b) of the GNU Affero General Public License
64+ * version 3, these Appropriate Legal Notices must retain the display of the
65+ * "Powered by Funambol" logo. If the display of the logo is not reasonably
66+ * feasible for technical reasons, the Appropriate Legal Notices must display
67+ * the words "Powered by Funambol".
68+ */
69+
70+#import <Foundation/Foundation.h>
71+
72+
73+@interface URLQueryStringParser : NSObject {
74+ NSMutableDictionary *queryDict;
75+}
76+
77+@property (nonatomic, retain) NSMutableDictionary *queryDict;
78+
79+- (id)initWithURL:(NSURL *)url;
80+- (NSString *)queryStringValueForKey:(NSString *)key;
81+
82+@end
83
84=== modified file 'contacts/iPhoneApp/UI/src/AccountView.mm'
85--- contacts/iPhoneApp/UI/src/AccountView.mm 2010-08-20 00:32:22 +0000
86+++ contacts/iPhoneApp/UI/src/AccountView.mm 2010-09-03 21:17:44 +0000
87@@ -42,6 +42,7 @@
88 #import "customs.h"
89 #import "FastSyncMethodsView.h"
90 #import "AboutView.h"
91+#import "URLQueryStringParser.h"
92
93 @interface AccountView (Private)
94 - (UITextField*)buildTextFieldWithFrame:(CGRect)aFrame text:(NSString*)text keyboardType:(UIKeyboardType)keyboardType returnKeyType:(UIReturnKeyType)returnKeyType;
95@@ -77,19 +78,21 @@
96 {
97 if (credentials)
98 {
99- NSURL *credURL = [NSURL URLWithString:credentials];
100-
101- if ([credURL user])
102- {
103- usernameValue.text = [credURL user];
104- [[FunambolAPI getInstance] saveUsernameConfig:[credURL user]];
105- }
106-
107- if ([credURL password])
108- {
109- passwordValue.text = [credURL password];
110- [[FunambolAPI getInstance] savePasswordConfig:[credURL password]];
111- }
112+ URLQueryStringParser *queryStringParser = [[URLQueryStringParser alloc] initWithURL:[NSURL URLWithString:credentials]];
113+ NSString *user = [queryStringParser queryStringValueForKey:@"u"];
114+ NSString *pass = [queryStringParser queryStringValueForKey:@"p"];
115+ if (user != nil)
116+ {
117+ usernameValue.text = user;
118+ [[FunambolAPI getInstance] saveUsernameConfig:user];
119+ }
120+
121+ if (pass != nil)
122+ {
123+ passwordValue.text = pass;
124+ [[FunambolAPI getInstance] savePasswordConfig:pass];
125+ }
126+ [queryStringParser release];
127 }
128 }
129
130@@ -294,7 +297,7 @@
131 {
132 if (1 == indexPath.section)
133 {
134- NSURL *credentialsURL = [NSURL URLWithString:@"https://one.ubuntu.com/phones/creds/ios"];
135+ NSURL *credentialsURL = [NSURL URLWithString:@"https://one.ubuntu.com/phones/creds/ios?scheme=x-ubuntuone-contacts"];
136 [tableView deselectRowAtIndexPath:indexPath animated:YES];
137 [[UIApplication sharedApplication] openURL:credentialsURL];
138 } else if (2 == indexPath.section) {
139
140=== added file 'contacts/iPhoneApp/UI/src/URLQueryStringParser.mm'
141--- contacts/iPhoneApp/UI/src/URLQueryStringParser.mm 1970-01-01 00:00:00 +0000
142+++ contacts/iPhoneApp/UI/src/URLQueryStringParser.mm 2010-09-03 21:17:44 +0000
143@@ -0,0 +1,72 @@
144+/*
145+ * Funambol is a mobile platform developed by Funambol, Inc.
146+ * Copyright (C) 2010 Canonical Group Ltd.
147+ *
148+ * This program is free software; you can redistribute it and/or modify it under
149+ * the terms of the GNU Affero General Public License version 3 as published by
150+ * the Free Software Foundation with the addition of the following permission
151+ * added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
152+ * WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE
153+ * WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
154+ *
155+ * This program is distributed in the hope that it will be useful, but WITHOUT
156+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
157+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
158+ * details.
159+ *
160+ * You should have received a copy of the GNU Affero General Public License
161+ * along with this program; if not, see http://www.gnu.org/licenses or write to
162+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
163+ * MA 02110-1301 USA.
164+ *
165+ * You can contact Canonical Group Ltd. headquarters at:
166+ *
167+ * 27th Floor Millbank Tower
168+ * 21-24 Millbank
169+ * London SW1P 4QP
170+ * United Kingdom
171+ *
172+ * The interactive user interfaces in modified source and object code versions
173+ * of this program must display Appropriate Legal Notices, as required under
174+ * Section 5 of the GNU Affero General Public License version 3.
175+ *
176+ * In accordance with Section 7(b) of the GNU Affero General Public License
177+ * version 3, these Appropriate Legal Notices must retain the display of the
178+ * "Powered by Funambol" logo. If the display of the logo is not reasonably
179+ * feasible for technical reasons, the Appropriate Legal Notices must display
180+ * the words "Powered by Funambol".
181+ */
182+
183+#import "URLQueryStringParser.h"
184+
185+
186+@implementation URLQueryStringParser
187+
188+- (id) initWithURL:(NSURL *)url {
189+ self = [super init];
190+ if (self != nil) {
191+ self.queryDict = [NSMutableDictionary dictionary];
192+
193+ NSString *query = [url query];
194+ NSArray *queryPairs = [query componentsSeparatedByString:@"&"];
195+ for (NSString *pair in queryPairs) {
196+ // take chunk and break it on @"=", setting key and value in dict
197+ NSArray *keyValue = [pair componentsSeparatedByString:@"="];
198+ [self.queryDict setObject:[keyValue objectAtIndex:1] forKey:[keyValue objectAtIndex:0]];
199+ }
200+ }
201+ return self;
202+}
203+
204+- (NSString *)queryStringValueForKey:(NSString *)key {
205+ return [self.queryDict objectForKey:key];
206+}
207+
208+- (void) dealloc {
209+ self.queryDict = nil;
210+ [super dealloc];
211+}
212+
213+@synthesize queryDict;
214+
215+@end
216
217=== modified file 'contacts/iPhoneApp/funambolAppStore.xcodeproj/project.pbxproj'
218--- contacts/iPhoneApp/funambolAppStore.xcodeproj/project.pbxproj 2010-08-20 00:32:22 +0000
219+++ contacts/iPhoneApp/funambolAppStore.xcodeproj/project.pbxproj 2010-09-03 21:17:44 +0000
220@@ -22,6 +22,7 @@
221 7C9F581B0DAF5C50007E0091 /* UIController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C9F57E90DAF5C50007E0091 /* UIController.mm */; };
222 7C9F59500DAF67B9007E0091 /* stringUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C9F594F0DAF67B9007E0091 /* stringUtils.cpp */; };
223 7C9F59620DAF683B007E0091 /* AddressBookSyncSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C9F59610DAF683B007E0091 /* AddressBookSyncSource.cpp */; };
224+ 9173D56212318DE2004CEDB9 /* URLQueryStringParser.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9173D56112318DE2004CEDB9 /* URLQueryStringParser.mm */; };
225 930D5A6A11F9FB8800DD6D06 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 930D5A6611F9FB8800DD6D06 /* Default.png */; };
226 930D5A6B11F9FB8800DD6D06 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 930D5A6711F9FB8800DD6D06 /* Default@2x.png */; };
227 930D5A6C11F9FB8800DD6D06 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 930D5A6811F9FB8800DD6D06 /* Icon.png */; };
228@@ -155,6 +156,8 @@
229 7C9F59600DAF683B007E0091 /* AddressBookSyncSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddressBookSyncSource.h; sourceTree = "<group>"; };
230 7C9F59610DAF683B007E0091 /* AddressBookSyncSource.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = AddressBookSyncSource.cpp; sourceTree = "<group>"; };
231 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
232+ 9173D4DF123019CC004CEDB9 /* URLQueryStringParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLQueryStringParser.h; sourceTree = "<group>"; };
233+ 9173D56112318DE2004CEDB9 /* URLQueryStringParser.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = URLQueryStringParser.mm; sourceTree = "<group>"; };
234 930D5A6611F9FB8800DD6D06 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
235 930D5A6711F9FB8800DD6D06 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = "<group>"; };
236 930D5A6811F9FB8800DD6D06 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
237@@ -441,6 +444,7 @@
238 7C9F57D30DAF5C50007E0091 /* AccountView.h */,
239 7C9F57D40DAF5C50007E0091 /* common.h */,
240 7C9F57D90DAF5C50007E0091 /* UIController.h */,
241+ 9173D4DF123019CC004CEDB9 /* URLQueryStringParser.h */,
242 );
243 path = include;
244 sourceTree = "<group>";
245@@ -455,6 +459,7 @@
246 7C7647BB0DB361F500786883 /* main.mm */,
247 7C9F57E40DAF5C50007E0091 /* AccountView.mm */,
248 7C9F57E90DAF5C50007E0091 /* UIController.mm */,
249+ 9173D56112318DE2004CEDB9 /* URLQueryStringParser.mm */,
250 );
251 path = src;
252 sourceTree = "<group>";
253@@ -687,6 +692,7 @@
254 ABF87D980DEE926E00E433ED /* FastSyncMethodsView.mm in Sources */,
255 ABC5F1430E249E9100119787 /* MainSingleView.mm in Sources */,
256 AB33A9900E5AD6750098F0A2 /* TimeUtils.mm in Sources */,
257+ 9173D56212318DE2004CEDB9 /* URLQueryStringParser.mm in Sources */,
258 );
259 runOnlyForDeploymentPostprocessing = 0;
260 };

Subscribers

People subscribed via source and target branches

to all changes: