Skip to content

Commit 5cbc290

Browse files
authored
Merge pull request #87 from hsnl-dev/tiny-fix
bug fixed.
2 parents 068c173 + 34de706 commit 5cbc290

File tree

7 files changed

+52
-25
lines changed

7 files changed

+52
-25
lines changed

voiceIn/AppDelegate.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import CoreData
33
import IQKeyboardManagerSwift
44
import Fabric
55
import Crashlytics
6+
import Haneke
67

78
@UIApplicationMain
89
class AppDelegate: UIResponder, UIApplicationDelegate {
@@ -40,6 +41,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
4041

4142
if let window = self.window {
4243
window.rootViewController = rootController
44+
45+
let hnkImageCache = Shared.imageCache
46+
hnkImageCache.removeAll()
47+
4348
window.makeKeyAndVisible()
4449
}
4550

voiceIn/Base.lproj/Main.storyboard

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,6 @@
689689
<constraints>
690690
<constraint firstAttribute="width" constant="30" id="QlZ-aA-ABC"/>
691691
<constraint firstAttribute="height" constant="30" id="cnD-iR-KS2"/>
692-
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="30" id="drX-25-uoa"/>
693692
</constraints>
694693
<color key="tintColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
695694
<state key="normal" image="close">
@@ -1404,11 +1403,11 @@
14041403
</tableViewSection>
14051404
<tableViewSection headerTitle="設定" id="eki-en-qBd">
14061405
<cells>
1407-
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="detailButton" indentationWidth="10" id="56j-GG-6p8" customClass="MaterialTableViewCell" customModule="Material">
1406+
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" editingAccessoryType="detailDisclosureButton" id="56j-GG-6p8" customClass="MaterialTableViewCell" customModule="Material">
14081407
<rect key="frame" x="0.0" y="300" width="600" height="44"/>
14091408
<autoresizingMask key="autoresizingMask"/>
14101409
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="56j-GG-6p8" id="bmT-aY-WQP">
1411-
<rect key="frame" x="0.0" y="0.0" width="553" height="43"/>
1410+
<rect key="frame" x="0.0" y="0.0" width="600" height="43"/>
14121411
<autoresizingMask key="autoresizingMask"/>
14131412
<subviews>
14141413
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="個人資料設定" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="biE-wW-k6O">
@@ -1424,7 +1423,7 @@
14241423
</constraints>
14251424
</tableViewCellContentView>
14261425
<connections>
1427-
<segue destination="2V3-kn-mV4" kind="presentation" id="a4g-o3-ZwN"/>
1426+
<segue destination="2V3-kn-mV4" kind="presentation" modalTransitionStyle="crossDissolve" id="a4g-o3-ZwN"/>
14281427
</connections>
14291428
</tableViewCell>
14301429
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="1Sd-gS-0DG" customClass="MaterialTableViewCell" customModule="Material">

voiceIn/Controllers/Contact/ContactTableViewController.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ class ContactTableViewController: UITableViewController, NSFetchedResultsControl
4848
self.refreshControl?.addTarget(self, action: #selector(ContactTableViewController.refresh(_:)), forControlEvents: UIControlEvents.ValueChanged)
4949

5050
super.viewDidLoad()
51-
5251
//MAKR - Init search view contrller
5352
self.resultSearchController = ({
5453
let controller = UISearchController(searchResultsController: nil)

voiceIn/Controllers/Setting/EditProfileViewController.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ class EditProfileViewController: FormViewController {
245245
let updateInformationApiRoute = API_END_POINT + "/accounts/" + userUuid
246246
let uploadAvatarApiRoute = API_END_POINT + "/accounts/" + userUuid + "/avatar"
247247
let dateFormatter = NSDateFormatter()
248+
var isUploadSuccess = false
248249

249250
var avatarImageFile = UIImageJPEGRepresentation(UIImage(named: "user")!, 0.6)
250251

@@ -286,7 +287,7 @@ class EditProfileViewController: FormViewController {
286287
Alamofire
287288
.request(.PUT, updateInformationApiRoute, parameters: parameters, encoding: .JSON, headers: headers)
288289
.response { request, response, data, error in
289-
if error == nil && !self.isUserSelectPhoto {
290+
if error == nil {
290291
//MARK: error is nil, nothing happened! All is well :)
291292

292293
UserPref.setUserPref("userName", value: parameters["userName"])
@@ -300,18 +301,27 @@ class EditProfileViewController: FormViewController {
300301
if let superview = self.view.superview {
301302
SwiftOverlays.removeAllOverlaysFromView(superview)
302303
}
304+
305+
isUploadSuccess = true
303306
self.dismissViewControllerAnimated(true, completion: nil)
304307
}
305308
} else {
306309
if let superview = self.view.superview {
307310
SwiftOverlays.removeAllOverlaysFromView(superview)
308311
}
312+
313+
isUploadSuccess = false
309314
AlertBox.createAlertView(self, title: "失敗", body: "出現網路或伺服器錯誤", buttonValue: "確認")
310315
}
316+
311317
debugPrint(error)
312318
self.isSaveClicked = false
313319
}
314320

321+
if isUploadSuccess == true {
322+
return
323+
}
324+
315325
/**
316326
POST: Upload avatar image.
317327
**/

voiceIn/Controllers/Setting/SettingViewController.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import UIKit
22
import Alamofire
33
import SwiftyJSON
4+
import SwiftOverlays
45
import Haneke
56

67
class SettingViewController: UITableViewController {
@@ -20,6 +21,12 @@ class SettingViewController: UITableViewController {
2021
@IBAction func refreshCredit(sender: UIButton) {
2122
self.credit?.text = "讀取中"
2223

24+
let text = "重新整理中..."
25+
26+
if let superview = self.view.superview {
27+
SwiftOverlays.showCenteredWaitOverlayWithText(superview, text: text)
28+
}
29+
2330
let getInformationApiRoute = API_END_POINT + "/accounts/" + UserPref.getUserPrefByKey("userUuid")
2431
let headers = Network.generateHeader(isTokenNeeded: true)
2532
let parameters = [
@@ -29,6 +36,8 @@ class SettingViewController: UITableViewController {
2936
.request(.GET, getInformationApiRoute, headers: headers, parameters: parameters, encoding: .URLEncodedInURL)
3037
.responseJSON {
3138
response in
39+
sender.setTitle("重新整理", forState: .Normal)
40+
3241
switch response.result {
3342
case .Success(let JSON_RESPONSE):
3443
let jsonResponse = JSON(JSON_RESPONSE)
@@ -46,6 +55,10 @@ class SettingViewController: UITableViewController {
4655
self.credit?.text = "讀取失敗"
4756
debugPrint(error)
4857
}
58+
59+
if let superview = self.view.superview {
60+
SwiftOverlays.removeAllOverlaysFromView(superview)
61+
}
4962
}
5063
}
5164

voiceIn/Controllers/Validation/UserInformationViewController.swift

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -348,25 +348,26 @@ class UserInformationViewController: FormViewController {
348348
return
349349
}
350350
})
351-
} else {
352-
// MARK - POST: Generate QRCode
353-
Alamofire
354-
.request(.POST, generateQrcodeApiRoute, headers: headers)
355-
.response {
356-
request, response, data, error in
357-
358-
if let superview = self.view {
359-
SwiftOverlays.removeAllOverlaysFromView(superview)
360-
}
361-
362-
if error == nil {
363-
print("Generate QR Code Successfully!")
364-
self.presentViewController(contactTableView, animated: true, completion: nil)
365-
} else {
366-
AlertBox.createAlertView(self ,title: "抱歉!", body: "網路或伺服器錯誤,請稍候再嘗試", buttonValue: "確認")
367-
}
351+
}
352+
353+
// MARK - POST: Generate QRCode
354+
Alamofire
355+
.request(.POST, generateQrcodeApiRoute, headers: headers)
356+
.response {
357+
request, response, data, error in
358+
359+
if let superview = self.view {
360+
SwiftOverlays.removeAllOverlaysFromView(superview)
361+
}
362+
363+
if error == nil {
364+
print("Generate QR Code Successfully!")
365+
self.presentViewController(contactTableView, animated: true, completion: nil)
366+
} else {
367+
AlertBox.createAlertView(self ,title: "抱歉!", body: "網路或伺服器錯誤,請稍候再嘗試", buttonValue: "確認")
368368
}
369369
}
370+
370371
}
371372

372373
/**

voiceIn/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.0.1</string>
18+
<string>1.0.2</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>44</string>
22+
<string>1</string>
2323
<key>Fabric</key>
2424
<dict>
2525
<key>APIKey</key>

0 commit comments

Comments
 (0)