Skip to content

Commit 6da1f59

Browse files
committed
Multi SB to Single SB
1 parent a9696ab commit 6da1f59

29 files changed

+1344
-802
lines changed

PHPHub.xcodeproj/project.pbxproj

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
251E93F21C156E8800894F8C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 251E93F11C156E8800894F8C /* Assets.xcassets */; };
1212
251E93F51C156E8800894F8C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 251E93F31C156E8800894F8C /* LaunchScreen.storyboard */; };
1313
251E94001C156E8800894F8C /* PHPHubTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 251E93FF1C156E8800894F8C /* PHPHubTests.swift */; };
14-
251E940F1C15B4FD00894F8C /* Me.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 251E940E1C15B4FD00894F8C /* Me.storyboard */; };
15-
251E94121C16778400894F8C /* Fornum.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 251E94111C16778400894F8C /* Fornum.storyboard */; };
1614
251E941A1C17D64500894F8C /* ForumViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 251E94191C17D64500894F8C /* ForumViewController.swift */; };
17-
251E941C1C17E7E000894F8C /* Topic.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 251E941B1C17E7E000894F8C /* Topic.storyboard */; };
1815
251E941E1C17F2AA00894F8C /* TopicListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 251E941D1C17F2AA00894F8C /* TopicListTableViewCell.swift */; };
1916
251E94211C180FB600894F8C /* TopicListTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 251E94201C180FB600894F8C /* TopicListTableViewController.swift */; };
2017
251E942A1C181D4D00894F8C /* AlamofireExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 251E94281C181D4D00894F8C /* AlamofireExtension.swift */; };
@@ -36,6 +33,9 @@
3633
25B6FF1C1C2ACB0300C16070 /* MeTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25B6FF1B1C2ACB0300C16070 /* MeTableViewController.swift */; };
3734
25B6FF1E1C2BBE4000C16070 /* QRCodeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25B6FF1D1C2BBE4000C16070 /* QRCodeViewController.swift */; };
3835
25EC94E91C58B7B700F18013 /* SwiftNotice.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25EC94E81C58B7B700F18013 /* SwiftNotice.swift */; };
36+
25EC94EB1C59B60900F18013 /* UserApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25EC94EA1C59B60900F18013 /* UserApi.swift */; };
37+
25EC94F31C5F09DE00F18013 /* CurrentUserHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25EC94F21C5F09DE00F18013 /* CurrentUserHandler.swift */; };
38+
25EC94F51C5F542800F18013 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 25EC94F41C5F542800F18013 /* Main.storyboard */; };
3939
6DDCE3C0C75815B4239B1EB2 /* Pods_PHPHub.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B1778C7C86A4B30F7DD48137 /* Pods_PHPHub.framework */; };
4040
/* End PBXBuildFile section */
4141

@@ -58,10 +58,7 @@
5858
251E93FB1C156E8800894F8C /* PHPHubTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PHPHubTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
5959
251E93FF1C156E8800894F8C /* PHPHubTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PHPHubTests.swift; sourceTree = "<group>"; };
6060
251E94011C156E8800894F8C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
61-
251E940E1C15B4FD00894F8C /* Me.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Me.storyboard; path = Views/Me/Me.storyboard; sourceTree = "<group>"; };
62-
251E94111C16778400894F8C /* Fornum.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Fornum.storyboard; path = Views/Fornum/Fornum.storyboard; sourceTree = "<group>"; };
6361
251E94191C17D64500894F8C /* ForumViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ForumViewController.swift; path = Controller/Fornum/ForumViewController.swift; sourceTree = "<group>"; };
64-
251E941B1C17E7E000894F8C /* Topic.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Topic.storyboard; path = Views/Topic/Topic.storyboard; sourceTree = "<group>"; };
6562
251E941D1C17F2AA00894F8C /* TopicListTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TopicListTableViewCell.swift; path = Views/Topic/TopicListTableViewCell.swift; sourceTree = "<group>"; };
6663
251E94201C180FB600894F8C /* TopicListTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TopicListTableViewController.swift; path = Controller/Topic/TopicListTableViewController.swift; sourceTree = "<group>"; };
6764
251E94281C181D4D00894F8C /* AlamofireExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AlamofireExtension.swift; path = Common/Network/AlamofireExtension.swift; sourceTree = "<group>"; };
@@ -83,6 +80,9 @@
8380
25B6FF1B1C2ACB0300C16070 /* MeTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MeTableViewController.swift; path = Controller/Me/MeTableViewController.swift; sourceTree = "<group>"; };
8481
25B6FF1D1C2BBE4000C16070 /* QRCodeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = QRCodeViewController.swift; path = Controller/Me/QRCodeViewController.swift; sourceTree = "<group>"; };
8582
25EC94E81C58B7B700F18013 /* SwiftNotice.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SwiftNotice.swift; path = Common/Utils/SwiftNotice.swift; sourceTree = "<group>"; };
83+
25EC94EA1C59B60900F18013 /* UserApi.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UserApi.swift; path = Apis/UserApi.swift; sourceTree = "<group>"; };
84+
25EC94F21C5F09DE00F18013 /* CurrentUserHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CurrentUserHandler.swift; path = Handlers/CurrentUserHandler.swift; sourceTree = "<group>"; };
85+
25EC94F41C5F542800F18013 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = Views/Main.storyboard; sourceTree = "<group>"; };
8686
6787A7C6A353DD2C1941C434 /* Pods-PHPHub.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PHPHub.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PHPHub/Pods-PHPHub.debug.xcconfig"; sourceTree = "<group>"; };
8787
894CC7717934CE3DAFCF95F7 /* Pods-PHPHub.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PHPHub.release.xcconfig"; path = "Pods/Target Support Files/Pods-PHPHub/Pods-PHPHub.release.xcconfig"; sourceTree = "<group>"; };
8888
B1778C7C86A4B30F7DD48137 /* Pods_PHPHub.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PHPHub.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -166,38 +166,20 @@
166166
isa = PBXGroup;
167167
children = (
168168
251E93F31C156E8800894F8C /* LaunchScreen.storyboard */,
169-
251E94101C16774900894F8C /* Fornum */,
170169
251E940D1C158F0400894F8C /* Topic */,
171-
251E940C1C158EF200894F8C /* Me */,
170+
25EC94F41C5F542800F18013 /* Main.storyboard */,
172171
);
173172
name = Views;
174173
sourceTree = "<group>";
175174
};
176-
251E940C1C158EF200894F8C /* Me */ = {
177-
isa = PBXGroup;
178-
children = (
179-
251E940E1C15B4FD00894F8C /* Me.storyboard */,
180-
);
181-
name = Me;
182-
sourceTree = "<group>";
183-
};
184175
251E940D1C158F0400894F8C /* Topic */ = {
185176
isa = PBXGroup;
186177
children = (
187-
251E941B1C17E7E000894F8C /* Topic.storyboard */,
188178
251E941D1C17F2AA00894F8C /* TopicListTableViewCell.swift */,
189179
);
190180
name = Topic;
191181
sourceTree = "<group>";
192182
};
193-
251E94101C16774900894F8C /* Fornum */ = {
194-
isa = PBXGroup;
195-
children = (
196-
251E94111C16778400894F8C /* Fornum.storyboard */,
197-
);
198-
name = Fornum;
199-
sourceTree = "<group>";
200-
};
201183
251E94171C17D5F400894F8C /* Controllers */ = {
202184
isa = PBXGroup;
203185
children = (
@@ -269,6 +251,7 @@
269251
children = (
270252
253304761C1D97ED00E3C5F3 /* AuthorizeApi.swift */,
271253
253304821C20631300E3C5F3 /* TopicApi.swift */,
254+
25EC94EA1C59B60900F18013 /* UserApi.swift */,
272255
);
273256
name = Apis;
274257
sourceTree = "<group>";
@@ -278,6 +261,7 @@
278261
children = (
279262
253304791C1E9E5C00E3C5F3 /* AccessTokenHandler.swift */,
280263
253304841C20636700E3C5F3 /* ApiHandler.swift */,
264+
25EC94F21C5F09DE00F18013 /* CurrentUserHandler.swift */,
281265
);
282266
name = Handlers;
283267
sourceTree = "<group>";
@@ -402,11 +386,9 @@
402386
isa = PBXResourcesBuildPhase;
403387
buildActionMask = 2147483647;
404388
files = (
405-
251E941C1C17E7E000894F8C /* Topic.storyboard in Resources */,
389+
25EC94F51C5F542800F18013 /* Main.storyboard in Resources */,
406390
251E93F51C156E8800894F8C /* LaunchScreen.storyboard in Resources */,
407391
251E93F21C156E8800894F8C /* Assets.xcassets in Resources */,
408-
251E940F1C15B4FD00894F8C /* Me.storyboard in Resources */,
409-
251E94121C16778400894F8C /* Fornum.storyboard in Resources */,
410392
);
411393
runOnlyForDeploymentPostprocessing = 0;
412394
};
@@ -481,8 +463,10 @@
481463
25B6FF181C2AA02900C16070 /* LoginViewController.swift in Sources */,
482464
25EC94E91C58B7B700F18013 /* SwiftNotice.swift in Sources */,
483465
2557FECF1C24087800961EF9 /* TopicDetailViewController.swift in Sources */,
466+
25EC94EB1C59B60900F18013 /* UserApi.swift in Sources */,
484467
2533047D1C20079300E3C5F3 /* Topic.swift in Sources */,
485468
251E942B1C181D4D00894F8C /* Router.swift in Sources */,
469+
25EC94F31C5F09DE00F18013 /* CurrentUserHandler.swift in Sources */,
486470
2524FFAE1C19CF0900706D56 /* MainTabBarController.swift in Sources */,
487471
2533047A1C1E9E5C00E3C5F3 /* AccessTokenHandler.swift in Sources */,
488472
251E941E1C17F2AA00894F8C /* TopicListTableViewCell.swift in Sources */,

PHPHub/Apis/AuthorizeApi.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class AuthorizeApi {
3030

3131
class func getLoginAccessToken(username username: String, loginToken: String, callback: JSON -> Void) {
3232
let parameters:[String: AnyObject] = [
33-
"grant_type" : "client_credentials",
33+
"grant_type" : "login_token",
3434
"client_id": AppConfig.Api.Client_id,
3535
"client_secret": AppConfig.Api.Client_secret,
3636
"username": username,
@@ -50,7 +50,7 @@ class AuthorizeApi {
5050

5151
class func refreshLoginAccessToken(callback: JSON -> Void) {
5252
let parameters:[String: AnyObject] = [
53-
"grant_type" : "client_credentials",
53+
"grant_type" : "refresh_token",
5454
"client_id": AppConfig.Api.Client_id,
5555
"client_secret": AppConfig.Api.Client_secret
5656
]

PHPHub/Apis/UserApi.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// UserApi.swift
3+
// PHPHub
4+
//
5+
// Created by 2014-104 on 16/1/28.
6+
// Copyright © 2016年 ninerec. All rights reserved.
7+
//
8+
9+
import Alamofire
10+
import SwiftyJSON
11+
12+
class UserApi {
13+
class func getCurrentUser(callback: User -> Void) {
14+
ApiHandler.sharedInstance.ObjectRequest(Router.CurrentUser, callback: callback)
15+
}
16+
}
17+
18+

PHPHub/AppDelegate.swift

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,20 @@
88

99
import UIKit
1010

11+
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
12+
1113
@UIApplicationMain
1214
class AppDelegate: UIResponder, UIApplicationDelegate {
1315

1416
var window: UIWindow?
15-
17+
18+
var tabBarController: UITabBarController {
19+
return self.window!.rootViewController as! UITabBarController
20+
}
1621

1722
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
18-
// setupVisible
19-
window = UIWindow(frame: UIScreen.mainScreen().bounds)
20-
window?.backgroundColor = UIColor.whiteColor()
21-
window?.makeKeyAndVisible()
22-
23-
let rootViewController = MainTabBarController()
24-
window?.rootViewController = rootViewController
25-
26-
let accessTokenHandler = AccessTokenHandler()
27-
guard let _ = accessTokenHandler.getLocalClientAccessToken() else {
28-
accessTokenHandler.getServerClientAccessToken()
29-
return true
30-
}
3123

24+
CurrentUserHandler.setDefaultHandler(CurrentUserHandler())
3225
return true
3326
}
34-
35-
func applicationWillResignActive(application: UIApplication) {
36-
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
37-
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
38-
}
39-
40-
func applicationDidEnterBackground(application: UIApplication) {
41-
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
42-
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
43-
}
44-
45-
func applicationWillEnterForeground(application: UIApplication) {
46-
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
47-
}
48-
49-
func applicationDidBecomeActive(application: UIApplication) {
50-
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
51-
}
52-
53-
func applicationWillTerminate(application: UIApplication) {
54-
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
55-
}
56-
57-
5827
}
59-
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"scale" : "1x"
6+
},
7+
{
8+
"idiom" : "universal",
9+
"filename" : "ring_icon.png",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
975 Bytes
Loading
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"scale" : "1x"
6+
},
7+
{
8+
"idiom" : "universal",
9+
"filename" : "settings_icon.png",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
1.24 KB
Loading
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"scale" : "1x"
6+
},
7+
{
8+
"idiom" : "universal",
9+
"filename" : "topic_icon.png",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
369 Bytes
Loading

0 commit comments

Comments
 (0)