mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-11 13:56:10 +10:00
Merge branch 'feature/settings' into develop
This commit is contained in:
@@ -94,6 +94,18 @@
|
||||
506E241E1AE6391A00A33C1A /* TouchZoomButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 506E241D1AE6391A00A33C1A /* TouchZoomButton.swift */; };
|
||||
506EC20A1AC95BFC00CE42B3 /* UIFont+Yep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 506EC2091AC95BFC00CE42B3 /* UIFont+Yep.swift */; };
|
||||
5076C56A1AC46B9F00B22952 /* FayeService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5076C5691AC46B9F00B22952 /* FayeService.swift */; };
|
||||
50894CF11AEA4726000981AF /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50894CF01AEA4726000981AF /* SettingsViewController.swift */; };
|
||||
50894CF51AEA4A01000981AF /* SettingsUserCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50894CF31AEA4A01000981AF /* SettingsUserCell.swift */; };
|
||||
50894CF61AEA4A01000981AF /* SettingsUserCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 50894CF41AEA4A01000981AF /* SettingsUserCell.xib */; };
|
||||
50894CFA1AEA54BA000981AF /* SettingsMoreCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50894CF81AEA54BA000981AF /* SettingsMoreCell.swift */; };
|
||||
50894CFB1AEA54BA000981AF /* SettingsMoreCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 50894CF91AEA54BA000981AF /* SettingsMoreCell.xib */; };
|
||||
50894CFE1AEA5A78000981AF /* EditProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50894CFD1AEA5A78000981AF /* EditProfileViewController.swift */; };
|
||||
50894D021AEA6433000981AF /* EditProfileLessInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50894D001AEA6433000981AF /* EditProfileLessInfoCell.swift */; };
|
||||
50894D031AEA6433000981AF /* EditProfileLessInfoCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 50894D011AEA6433000981AF /* EditProfileLessInfoCell.xib */; };
|
||||
50894D071AEDFDA2000981AF /* EditProfileMoreInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50894D051AEDFDA2000981AF /* EditProfileMoreInfoCell.swift */; };
|
||||
50894D081AEDFDA2000981AF /* EditProfileMoreInfoCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 50894D061AEDFDA2000981AF /* EditProfileMoreInfoCell.xib */; };
|
||||
50894D0C1AEE0177000981AF /* EditProfileColoredTitleCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50894D0A1AEE0177000981AF /* EditProfileColoredTitleCell.swift */; };
|
||||
50894D0D1AEE0177000981AF /* EditProfileColoredTitleCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 50894D0B1AEE0177000981AF /* EditProfileColoredTitleCell.xib */; };
|
||||
508C2AA01AD648B2002B8097 /* SearchUsersViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 508C2A9F1AD648B2002B8097 /* SearchUsersViewController.swift */; };
|
||||
508C2AA41AD661B3002B8097 /* UserStateCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 508C2AA21AD661B3002B8097 /* UserStateCell.swift */; };
|
||||
508C2AA51AD661B3002B8097 /* UserStateCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 508C2AA31AD661B3002B8097 /* UserStateCell.xib */; };
|
||||
@@ -241,6 +253,18 @@
|
||||
506E241D1AE6391A00A33C1A /* TouchZoomButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TouchZoomButton.swift; path = Views/Buttons/TouchZoomButton.swift; sourceTree = "<group>"; };
|
||||
506EC2091AC95BFC00CE42B3 /* UIFont+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "UIFont+Yep.swift"; path = "Extensions/UIFont+Yep.swift"; sourceTree = "<group>"; };
|
||||
5076C5691AC46B9F00B22952 /* FayeService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FayeService.swift; path = Services/FayeService.swift; sourceTree = "<group>"; };
|
||||
50894CF01AEA4726000981AF /* SettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SettingsViewController.swift; path = ViewControllers/Settings/SettingsViewController.swift; sourceTree = "<group>"; };
|
||||
50894CF31AEA4A01000981AF /* SettingsUserCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SettingsUserCell.swift; path = Views/Cells/SettingsUser/SettingsUserCell.swift; sourceTree = "<group>"; };
|
||||
50894CF41AEA4A01000981AF /* SettingsUserCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = SettingsUserCell.xib; path = Views/Cells/SettingsUser/SettingsUserCell.xib; sourceTree = "<group>"; };
|
||||
50894CF81AEA54BA000981AF /* SettingsMoreCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SettingsMoreCell.swift; path = Views/Cells/SettingsMore/SettingsMoreCell.swift; sourceTree = "<group>"; };
|
||||
50894CF91AEA54BA000981AF /* SettingsMoreCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = SettingsMoreCell.xib; path = Views/Cells/SettingsMore/SettingsMoreCell.xib; sourceTree = "<group>"; };
|
||||
50894CFD1AEA5A78000981AF /* EditProfileViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = EditProfileViewController.swift; path = ViewControllers/EditProfile/EditProfileViewController.swift; sourceTree = "<group>"; };
|
||||
50894D001AEA6433000981AF /* EditProfileLessInfoCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = EditProfileLessInfoCell.swift; path = Views/Cells/EditProfileLessInfo/EditProfileLessInfoCell.swift; sourceTree = "<group>"; };
|
||||
50894D011AEA6433000981AF /* EditProfileLessInfoCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = EditProfileLessInfoCell.xib; path = Views/Cells/EditProfileLessInfo/EditProfileLessInfoCell.xib; sourceTree = "<group>"; };
|
||||
50894D051AEDFDA2000981AF /* EditProfileMoreInfoCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = EditProfileMoreInfoCell.swift; path = Views/Cells/EditProfileMoreInfo/EditProfileMoreInfoCell.swift; sourceTree = "<group>"; };
|
||||
50894D061AEDFDA2000981AF /* EditProfileMoreInfoCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = EditProfileMoreInfoCell.xib; path = Views/Cells/EditProfileMoreInfo/EditProfileMoreInfoCell.xib; sourceTree = "<group>"; };
|
||||
50894D0A1AEE0177000981AF /* EditProfileColoredTitleCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = EditProfileColoredTitleCell.swift; path = Views/Cells/EditProfileColoredTitle/EditProfileColoredTitleCell.swift; sourceTree = "<group>"; };
|
||||
50894D0B1AEE0177000981AF /* EditProfileColoredTitleCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = EditProfileColoredTitleCell.xib; path = Views/Cells/EditProfileColoredTitle/EditProfileColoredTitleCell.xib; sourceTree = "<group>"; };
|
||||
508C2A9F1AD648B2002B8097 /* SearchUsersViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SearchUsersViewController.swift; path = ViewControllers/SearchUsers/SearchUsersViewController.swift; sourceTree = "<group>"; };
|
||||
508C2AA21AD661B3002B8097 /* UserStateCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UserStateCell.swift; path = Views/Cells/UserState/UserStateCell.swift; sourceTree = "<group>"; };
|
||||
508C2AA31AD661B3002B8097 /* UserStateCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = UserStateCell.xib; path = Views/Cells/UserState/UserStateCell.xib; sourceTree = "<group>"; };
|
||||
@@ -433,6 +457,8 @@
|
||||
502AE51F1AB712D6005BD199 /* Register */,
|
||||
502AE5361AB864A3005BD199 /* Login */,
|
||||
0A5D83951AC5D3CD000045BF /* TabBar */,
|
||||
50894CF21AEA472B000981AF /* Settings */,
|
||||
50894CFF1AEA5A7E000981AF /* EditProfile */,
|
||||
);
|
||||
name = ViewControllers;
|
||||
sourceTree = "<group>";
|
||||
@@ -524,6 +550,11 @@
|
||||
505EC81E1ADFBE1F001D27E0 /* SkillSelection */,
|
||||
50EB8CC11AE89EDE001AC1EE /* ChatLeftVideo */,
|
||||
50EB8CC61AE89F15001AC1EE /* ChatRightVideo */,
|
||||
50894CF71AEA4A04000981AF /* SettingsUser */,
|
||||
50894CFC1AEA54BE000981AF /* SettingsMore */,
|
||||
50894D041AEA6439000981AF /* EditProfileLessInfo */,
|
||||
50894D091AEDFDA6000981AF /* EditProfileMoreInfo */,
|
||||
50894D0E1AEE017B000981AF /* EditProfileColoredTitle */,
|
||||
);
|
||||
name = Cells;
|
||||
sourceTree = "<group>";
|
||||
@@ -758,6 +789,67 @@
|
||||
name = SkillAnnotationHeader;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
50894CF21AEA472B000981AF /* Settings */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
50894CF01AEA4726000981AF /* SettingsViewController.swift */,
|
||||
);
|
||||
name = Settings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
50894CF71AEA4A04000981AF /* SettingsUser */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
50894CF31AEA4A01000981AF /* SettingsUserCell.swift */,
|
||||
50894CF41AEA4A01000981AF /* SettingsUserCell.xib */,
|
||||
);
|
||||
name = SettingsUser;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
50894CFC1AEA54BE000981AF /* SettingsMore */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
50894CF81AEA54BA000981AF /* SettingsMoreCell.swift */,
|
||||
50894CF91AEA54BA000981AF /* SettingsMoreCell.xib */,
|
||||
);
|
||||
name = SettingsMore;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
50894CFF1AEA5A7E000981AF /* EditProfile */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
50894CFD1AEA5A78000981AF /* EditProfileViewController.swift */,
|
||||
);
|
||||
name = EditProfile;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
50894D041AEA6439000981AF /* EditProfileLessInfo */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
50894D001AEA6433000981AF /* EditProfileLessInfoCell.swift */,
|
||||
50894D011AEA6433000981AF /* EditProfileLessInfoCell.xib */,
|
||||
);
|
||||
name = EditProfileLessInfo;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
50894D091AEDFDA6000981AF /* EditProfileMoreInfo */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
50894D051AEDFDA2000981AF /* EditProfileMoreInfoCell.swift */,
|
||||
50894D061AEDFDA2000981AF /* EditProfileMoreInfoCell.xib */,
|
||||
);
|
||||
name = EditProfileMoreInfo;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
50894D0E1AEE017B000981AF /* EditProfileColoredTitle */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
50894D0A1AEE0177000981AF /* EditProfileColoredTitleCell.swift */,
|
||||
50894D0B1AEE0177000981AF /* EditProfileColoredTitleCell.xib */,
|
||||
);
|
||||
name = EditProfileColoredTitle;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
508C2AA11AD648BE002B8097 /* SearchUsers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -1037,12 +1129,15 @@
|
||||
502AE5411AB88862005BD199 /* SkillRankCell.xib in Resources */,
|
||||
502AE5541AB93215005BD199 /* ProfileFooterCell.xib in Resources */,
|
||||
50CDBE4A1ACBAD3200459CE0 /* ChatLeftImageCell.xib in Resources */,
|
||||
50894CF61AEA4A01000981AF /* SettingsUserCell.xib in Resources */,
|
||||
508D17481ACCF4710092D666 /* ChatLeftAudioCell.xib in Resources */,
|
||||
0A8F54B61AB67D11004AD60E /* Main.storyboard in Resources */,
|
||||
5033159D1AC101C80008A209 /* ChatRightTextCell.xib in Resources */,
|
||||
50894CFB1AEA54BA000981AF /* SettingsMoreCell.xib in Resources */,
|
||||
505EC8181ADF8151001D27E0 /* SkillCategoryCell.xib in Resources */,
|
||||
505EC81D1ADFBE1B001D27E0 /* SkillSelectionCell.xib in Resources */,
|
||||
50EB8CC01AE89ED8001AC1EE /* ChatLeftVideoCell.xib in Resources */,
|
||||
50894D0D1AEE0177000981AF /* EditProfileColoredTitleCell.xib in Resources */,
|
||||
50CDBE431ACA9B4200459CE0 /* ChatRightImageCell.xib in Resources */,
|
||||
508C2AA51AD661B3002B8097 /* UserStateCell.xib in Resources */,
|
||||
50E114FD1ABC549300F13000 /* ContactsCell.xib in Resources */,
|
||||
@@ -1051,9 +1146,11 @@
|
||||
0A8F54B81AB67D11004AD60E /* Images.xcassets in Resources */,
|
||||
50EB8CC51AE89F12001AC1EE /* ChatRightVideoCell.xib in Resources */,
|
||||
502AE5191AB70D72005BD199 /* Intro.storyboard in Resources */,
|
||||
50894D081AEDFDA2000981AF /* EditProfileMoreInfoCell.xib in Resources */,
|
||||
508D174D1ACCF49B0092D666 /* ChatRightAudioCell.xib in Resources */,
|
||||
50A9D44E1ACD382B000B2599 /* NSDateTimeAgo.bundle in Resources */,
|
||||
503315981AC1017E0008A209 /* ChatLeftTextCell.xib in Resources */,
|
||||
50894D031AEA6433000981AF /* EditProfileLessInfoCell.xib in Resources */,
|
||||
0AD7EA771AC3EEB000617758 /* PushConfig.plist in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -1133,6 +1230,7 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
50894CFE1AEA5A78000981AF /* EditProfileViewController.swift in Sources */,
|
||||
50CDBE421ACA9B4200459CE0 /* ChatRightImageCell.swift in Sources */,
|
||||
5099B9C41AB9510D002F940B /* RankView.swift in Sources */,
|
||||
502AE5311AB85067005BD199 /* RegisterPickMobileViewController.swift in Sources */,
|
||||
@@ -1153,7 +1251,10 @@
|
||||
502AE53D1AB87C0D005BD199 /* YepUserDefaults.swift in Sources */,
|
||||
50EB8CC41AE89F12001AC1EE /* ChatRightVideoCell.swift in Sources */,
|
||||
508D17471ACCF4710092D666 /* ChatLeftAudioCell.swift in Sources */,
|
||||
50894D021AEA6433000981AF /* EditProfileLessInfoCell.swift in Sources */,
|
||||
50894CFA1AEA54BA000981AF /* SettingsMoreCell.swift in Sources */,
|
||||
502AE51B1AB70DDB005BD199 /* WelcomeViewController.swift in Sources */,
|
||||
50894D071AEDFDA2000981AF /* EditProfileMoreInfoCell.swift in Sources */,
|
||||
50E114F41ABBF9CC00F13000 /* Models.swift in Sources */,
|
||||
50A9D4571ACD393A000B2599 /* YepWaverView.swift in Sources */,
|
||||
50165C451AC2860900C7AEBE /* ConversationLayout.swift in Sources */,
|
||||
@@ -1196,6 +1297,7 @@
|
||||
506E241C1AE6254F00A33C1A /* MessageTypeButton.swift in Sources */,
|
||||
508C2AA01AD648B2002B8097 /* SearchUsersViewController.swift in Sources */,
|
||||
0A3E60671ACCAECE003DC853 /* YepLocationService.swift in Sources */,
|
||||
50894CF11AEA4726000981AF /* SettingsViewController.swift in Sources */,
|
||||
5023DE2A1AB685BA00B3EE96 /* ContactsViewController.swift in Sources */,
|
||||
50CDBE491ACBAD3200459CE0 /* ChatLeftImageCell.swift in Sources */,
|
||||
5033159C1AC101C80008A209 /* ChatRightTextCell.swift in Sources */,
|
||||
@@ -1215,7 +1317,9 @@
|
||||
0A5D83991AC5D91E000045BF /* ContactsSearchTableViewController.swift in Sources */,
|
||||
0A944C251AC8BB2F00037A06 /* YepStorageService.swift in Sources */,
|
||||
505EC8171ADF8151001D27E0 /* SkillCategoryCell.swift in Sources */,
|
||||
50894CF51AEA4A01000981AF /* SettingsUserCell.swift in Sources */,
|
||||
504F415A1AD5028200FBB19A /* SkillCell.swift in Sources */,
|
||||
50894D0C1AEE0177000981AF /* EditProfileColoredTitleCell.swift in Sources */,
|
||||
5023DE521AB6C51300B3EE96 /* CGRect+Yep.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Ha4-ol-D2e">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
|
||||
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Conversations-->
|
||||
@@ -70,7 +71,7 @@
|
||||
<outlet property="delegate" destination="la3-6z-2aH" id="zOV-zM-2KH"/>
|
||||
</connections>
|
||||
</collectionView>
|
||||
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Q0w-sM-iIR" customClass="MessageToolbar" customModule="Yep" customModuleProvider="target">
|
||||
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Q0w-sM-iIR" customClass="MessageToolbar" customModule="Yep" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="250" width="600" height="50"/>
|
||||
<items/>
|
||||
</toolbar>
|
||||
@@ -412,7 +413,13 @@
|
||||
<constraint firstItem="VZO-hp-fyU" firstAttribute="leading" secondItem="i2Z-NU-5Yq" secondAttribute="leading" id="EIq-yc-gkc"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" title="Profile" id="4pO-kT-amp"/>
|
||||
<navigationItem key="navigationItem" title="Profile" id="4pO-kT-amp">
|
||||
<barButtonItem key="rightBarButtonItem" image="icon_settings" id="rTe-SV-2BV">
|
||||
<connections>
|
||||
<segue destination="XUP-IX-8LL" kind="show" id="srR-Ek-JSf"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
<connections>
|
||||
<outlet property="profileCollectionView" destination="VZO-hp-fyU" id="xat-9E-RVG"/>
|
||||
</connections>
|
||||
@@ -421,6 +428,143 @@
|
||||
</objects>
|
||||
<point key="canvasLocation" x="2027" y="1045"/>
|
||||
</scene>
|
||||
<!--Settings View Controller-->
|
||||
<scene sceneID="qZs-Er-4wk">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="SettingsViewController" id="XUP-IX-8LL" customClass="SettingsViewController" customModule="Yep" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="jwF-rD-Sd7"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="MGN-9w-VIC"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="XHY-eW-GV5">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="jKA-8q-sXn">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="XUP-IX-8LL" id="Rme-G5-eRl"/>
|
||||
<outlet property="delegate" destination="XUP-IX-8LL" id="8aq-YD-a2x"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="jKA-8q-sXn" firstAttribute="top" secondItem="XHY-eW-GV5" secondAttribute="top" id="7Gp-Zh-LdM"/>
|
||||
<constraint firstItem="jKA-8q-sXn" firstAttribute="leading" secondItem="XHY-eW-GV5" secondAttribute="leading" id="AA6-c5-CDa"/>
|
||||
<constraint firstAttribute="bottom" secondItem="jKA-8q-sXn" secondAttribute="bottom" id="FA5-ho-6Kk"/>
|
||||
<constraint firstAttribute="trailing" secondItem="jKA-8q-sXn" secondAttribute="trailing" id="kLM-IQ-m5G"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="settingsTableView" destination="jKA-8q-sXn" id="DgR-gO-x2w"/>
|
||||
<segue destination="TTy-VD-aor" kind="show" identifier="showEditProfile" id="Qhj-kS-Fq2"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="zuA-bP-KGx" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="2769" y="1045"/>
|
||||
</scene>
|
||||
<!--Edit Profile View Controller-->
|
||||
<scene sceneID="l0f-Y7-OKE">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="EditProfileViewController" id="TTy-VD-aor" customClass="EditProfileViewController" customModule="Yep" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="zVJ-dF-bPp"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="Lmv-fC-Aq8"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="kD8-yp-vNu">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="obf-ax-Bn7">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
|
||||
<view key="tableHeaderView" contentMode="scaleToFill" id="3ZX-Cq-RRV">
|
||||
<rect key="frame" x="0.0" y="64" width="600" height="250"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="kAg-ue-69C" userLabel="Avatar Image View">
|
||||
<rect key="frame" x="250" y="45" width="100" height="100"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="kAg-ue-69C" secondAttribute="height" multiplier="1:1" id="QZL-P8-pNS"/>
|
||||
<constraint firstAttribute="width" constant="100" id="fy0-3p-Tx4"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="profile_avatar_frame" translatesAutoresizingMaskIntoConstraints="NO" id="icj-Kl-sR6" userLabel="Avatar Frame Image View">
|
||||
<rect key="frame" x="244" y="39" width="112" height="112"/>
|
||||
<gestureRecognizers/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="icj-Kl-sR6" secondAttribute="height" multiplier="1:1" id="dFA-Cm-vac"/>
|
||||
<constraint firstAttribute="width" constant="112" id="vdB-G2-ueS"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outletCollection property="gestureRecognizers" destination="miK-LN-57H" appends="YES" id="po8-u4-CLv"/>
|
||||
</connections>
|
||||
</imageView>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_profile_phone" translatesAutoresizingMaskIntoConstraints="NO" id="xcV-T4-317" userLabel="Phone Image View">
|
||||
<rect key="frame" x="229" y="178" width="16" height="24"/>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="186-0235-4812" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bhV-NM-wXG" userLabel="Mobile Label">
|
||||
<rect key="frame" x="253" y="180" width="119" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Zc6-4l-BNt" userLabel="Helper View">
|
||||
<rect key="frame" x="229" y="175" width="143" height="30"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="30" id="4vv-aT-l3h"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="centerY" secondItem="kAg-ue-69C" secondAttribute="centerY" constant="30" id="0AC-xE-tNu"/>
|
||||
<constraint firstItem="xcV-T4-317" firstAttribute="leading" secondItem="Zc6-4l-BNt" secondAttribute="leading" id="0pJ-e1-JNS"/>
|
||||
<constraint firstAttribute="centerX" secondItem="kAg-ue-69C" secondAttribute="centerX" id="31e-Aq-G0k"/>
|
||||
<constraint firstAttribute="centerX" secondItem="Zc6-4l-BNt" secondAttribute="centerX" id="FZs-bJ-gip"/>
|
||||
<constraint firstItem="icj-Kl-sR6" firstAttribute="centerX" secondItem="kAg-ue-69C" secondAttribute="centerX" id="MNx-ow-h4U"/>
|
||||
<constraint firstItem="bhV-NM-wXG" firstAttribute="leading" secondItem="xcV-T4-317" secondAttribute="trailing" constant="8" id="Qj2-CF-afz"/>
|
||||
<constraint firstItem="bhV-NM-wXG" firstAttribute="centerY" secondItem="xcV-T4-317" secondAttribute="centerY" id="UfK-Vt-39G"/>
|
||||
<constraint firstItem="xcV-T4-317" firstAttribute="centerY" secondItem="Zc6-4l-BNt" secondAttribute="centerY" id="fSp-Xk-2dy"/>
|
||||
<constraint firstItem="bhV-NM-wXG" firstAttribute="trailing" secondItem="Zc6-4l-BNt" secondAttribute="trailing" id="lgi-Wh-O41"/>
|
||||
<constraint firstItem="Zc6-4l-BNt" firstAttribute="top" secondItem="kAg-ue-69C" secondAttribute="bottom" constant="30" id="xwH-u4-H0K"/>
|
||||
<constraint firstItem="icj-Kl-sR6" firstAttribute="centerY" secondItem="kAg-ue-69C" secondAttribute="centerY" id="zK4-Gg-43a"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="TTy-VD-aor" id="5KP-Bq-q7N"/>
|
||||
<outlet property="delegate" destination="TTy-VD-aor" id="Aog-I2-3XH"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="obf-ax-Bn7" secondAttribute="trailing" id="2dl-aG-24h"/>
|
||||
<constraint firstItem="obf-ax-Bn7" firstAttribute="leading" secondItem="kD8-yp-vNu" secondAttribute="leading" id="uE7-uX-ieh"/>
|
||||
<constraint firstItem="obf-ax-Bn7" firstAttribute="top" secondItem="kD8-yp-vNu" secondAttribute="top" id="uJL-0g-NPA"/>
|
||||
<constraint firstAttribute="bottom" secondItem="obf-ax-Bn7" secondAttribute="bottom" id="vqw-zt-2jR"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="avatarImageView" destination="kAg-ue-69C" id="vaB-SK-kBo"/>
|
||||
<outlet property="avatarImageViewWidthConstraint" destination="fy0-3p-Tx4" id="u5u-Us-aIh"/>
|
||||
<outlet property="editProfileTableView" destination="obf-ax-Bn7" id="wPW-Jg-rwD"/>
|
||||
<outlet property="mobileLabel" destination="bhV-NM-wXG" id="rUc-6h-9GQ"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="u2y-XJ-4gR" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
<tapGestureRecognizer id="miK-LN-57H">
|
||||
<connections>
|
||||
<action selector="changeAvatar:" destination="TTy-VD-aor" id="M5a-Sb-GjY"/>
|
||||
</connections>
|
||||
</tapGestureRecognizer>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="3514" y="1045"/>
|
||||
</scene>
|
||||
<!--Yep Tab Bar Controller-->
|
||||
<scene sceneID="vud-lc-IAG">
|
||||
<objects>
|
||||
@@ -548,5 +692,8 @@
|
||||
<image name="icon_more_add_location" width="70" height="50"/>
|
||||
<image name="icon_more_choose_photo" width="70" height="50"/>
|
||||
<image name="icon_more_take_photo" width="70" height="50"/>
|
||||
<image name="icon_profile_phone" width="16" height="24"/>
|
||||
<image name="icon_settings" width="30" height="30"/>
|
||||
<image name="profile_avatar_frame" width="112" height="112"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -143,7 +143,7 @@ class AvatarCache {
|
||||
}
|
||||
|
||||
if let url = NSURL(string: avatarURLString) {
|
||||
let roundImageKey = "round-\(url.hashValue)"
|
||||
let roundImageKey = "round-\(radius)-\(url.hashValue)"
|
||||
|
||||
// 先看看缓存
|
||||
if let roundImage = cache.objectForKey(roundImageKey) as? UIImage {
|
||||
@@ -219,7 +219,7 @@ class AvatarCache {
|
||||
}
|
||||
|
||||
if let url = NSURL(string: user.avatarURLString) {
|
||||
let roundImageKey = "round-\(url.hashValue)"
|
||||
let roundImageKey = "round-\(radius)-\(url.hashValue)"
|
||||
|
||||
// 先看看缓存
|
||||
if let roundImage = cache.objectForKey(roundImageKey) as? UIImage {
|
||||
|
||||
@@ -57,4 +57,22 @@ class YepConfig {
|
||||
class func audioSampleGap() -> CGFloat {
|
||||
return 1
|
||||
}
|
||||
|
||||
class func editProfileAvatarSize() -> CGFloat {
|
||||
return 100
|
||||
}
|
||||
|
||||
|
||||
struct Settings {
|
||||
static let userCellAvatarSize: CGFloat = 80
|
||||
|
||||
static let introFont = UIFont(name: "Helvetica-Light", size: 12)!
|
||||
static let introInset: CGFloat = 20 + userCellAvatarSize + 20 + 11 + 20
|
||||
}
|
||||
|
||||
struct EditProfile {
|
||||
static let introFont = UIFont(name: "Helvetica-Light", size: 15)!
|
||||
static let introInset: CGFloat = 20 + 20
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "icon_accessory.pdf"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode",
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "icon_profile_phone.pdf"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "icon_settings.pdf"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode",
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "profile_avatar_frame.pdf"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,240 @@
|
||||
//
|
||||
// EditProfileViewController.swift
|
||||
// Yep
|
||||
//
|
||||
// Created by NIX on 15/4/24.
|
||||
// Copyright (c) 2015年 Catch Inc. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Realm
|
||||
|
||||
let YepUpdatedProfileAvatarNotification = "YepUpdatedProfileAvatarNotification"
|
||||
|
||||
class EditProfileViewController: UIViewController {
|
||||
|
||||
@IBOutlet weak var avatarImageView: UIImageView!
|
||||
@IBOutlet weak var avatarImageViewWidthConstraint: NSLayoutConstraint!
|
||||
|
||||
@IBOutlet weak var mobileLabel: UILabel!
|
||||
|
||||
@IBOutlet weak var editProfileTableView: UITableView!
|
||||
|
||||
|
||||
let editProfileLessInfoCellIdentifier = "EditProfileLessInfoCell"
|
||||
let editProfileMoreInfoCellIdentifier = "EditProfileMoreInfoCell"
|
||||
let editProfileColoredTitleCellIdentifier = "EditProfileColoredTitleCell"
|
||||
|
||||
let intro = "I'm good at iOS Development and Singing. Come here, let me teach you." // TODO: User Intro
|
||||
let introAttributes = [NSFontAttributeName: YepConfig.EditProfile.introFont]
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
title = NSLocalizedString("Edit Profile", comment: "")
|
||||
|
||||
let avatarSize = YepConfig.editProfileAvatarSize()
|
||||
avatarImageViewWidthConstraint.constant = avatarSize
|
||||
|
||||
updateAvatar()
|
||||
|
||||
editProfileTableView.registerNib(UINib(nibName: editProfileLessInfoCellIdentifier, bundle: nil), forCellReuseIdentifier: editProfileLessInfoCellIdentifier)
|
||||
editProfileTableView.registerNib(UINib(nibName: editProfileMoreInfoCellIdentifier, bundle: nil), forCellReuseIdentifier: editProfileMoreInfoCellIdentifier)
|
||||
editProfileTableView.registerNib(UINib(nibName: editProfileColoredTitleCellIdentifier, bundle: nil), forCellReuseIdentifier: editProfileColoredTitleCellIdentifier)
|
||||
}
|
||||
|
||||
func updateAvatar() {
|
||||
if let avatarURLString = YepUserDefaults.avatarURLString() {
|
||||
|
||||
let avatarSize = YepConfig.editProfileAvatarSize()
|
||||
|
||||
self.avatarImageView.alpha = 0
|
||||
AvatarCache.sharedInstance.roundAvatarWithAvatarURLString(avatarURLString, withRadius: avatarSize * 0.5) { image in
|
||||
dispatch_async(dispatch_get_main_queue()) {
|
||||
self.avatarImageView.image = image
|
||||
|
||||
UIView.animateWithDuration(0.2, delay: 0.0, options: .CurveEaseOut, animations: { () -> Void in
|
||||
self.avatarImageView.alpha = 1
|
||||
}, completion: { (finished) -> Void in
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func changeAvatar(sender: UITapGestureRecognizer) {
|
||||
|
||||
|
||||
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .ActionSheet)
|
||||
|
||||
let choosePhotoAction: UIAlertAction = UIAlertAction(title: NSLocalizedString("Choose Photo", comment: ""), style: .Default) { action -> Void in
|
||||
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.SavedPhotosAlbum) {
|
||||
let imagePicker = UIImagePickerController()
|
||||
imagePicker.delegate = self
|
||||
imagePicker.sourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum
|
||||
imagePicker.allowsEditing = false
|
||||
|
||||
self.presentViewController(imagePicker, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
alertController.addAction(choosePhotoAction)
|
||||
|
||||
let takePhotoAction: UIAlertAction = UIAlertAction(title: NSLocalizedString("Take Photo", comment: ""), style: .Default) { action -> Void in
|
||||
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera){
|
||||
let imagePicker = UIImagePickerController()
|
||||
imagePicker.delegate = self
|
||||
imagePicker.sourceType = UIImagePickerControllerSourceType.Camera
|
||||
imagePicker.allowsEditing = false
|
||||
|
||||
self.presentViewController(imagePicker, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
alertController.addAction(takePhotoAction)
|
||||
|
||||
let cancelAction: UIAlertAction = UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .Cancel) { action -> Void in
|
||||
self.dismissViewControllerAnimated(true, completion: nil)
|
||||
}
|
||||
alertController.addAction(cancelAction)
|
||||
|
||||
self.presentViewController(alertController, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension EditProfileViewController: UITableViewDataSource, UITableViewDelegate {
|
||||
|
||||
enum Section: Int {
|
||||
case Info
|
||||
case LogOut
|
||||
}
|
||||
|
||||
enum InfoRow: Int {
|
||||
case Name = 0
|
||||
case Intro
|
||||
}
|
||||
|
||||
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
|
||||
return 2
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
|
||||
switch section {
|
||||
|
||||
case Section.Info.rawValue:
|
||||
return 2
|
||||
|
||||
case Section.LogOut.rawValue:
|
||||
return 1
|
||||
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
||||
switch indexPath.section {
|
||||
|
||||
case Section.Info.rawValue:
|
||||
|
||||
switch indexPath.row {
|
||||
case InfoRow.Name.rawValue:
|
||||
let cell = tableView.dequeueReusableCellWithIdentifier(editProfileLessInfoCellIdentifier) as! EditProfileLessInfoCell
|
||||
cell.annotationLabel.text = NSLocalizedString("Nickname", comment: "")
|
||||
cell.infoLabel.text = YepUserDefaults.nickname()
|
||||
return cell
|
||||
|
||||
case InfoRow.Intro.rawValue:
|
||||
let cell = tableView.dequeueReusableCellWithIdentifier(editProfileMoreInfoCellIdentifier) as! EditProfileMoreInfoCell
|
||||
cell.annotationLabel.text = NSLocalizedString("Introduction", comment: "")
|
||||
cell.infoLabel.text = intro
|
||||
return cell
|
||||
|
||||
default:
|
||||
return UITableViewCell()
|
||||
}
|
||||
|
||||
case Section.LogOut.rawValue:
|
||||
let cell = tableView.dequeueReusableCellWithIdentifier(editProfileColoredTitleCellIdentifier) as! EditProfileColoredTitleCell
|
||||
cell.coloredTitleLabel.text = NSLocalizedString("Log out", comment: "")
|
||||
cell.coloredTitleColor = UIColor.redColor()
|
||||
return cell
|
||||
|
||||
default:
|
||||
return UITableViewCell()
|
||||
}
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
|
||||
switch indexPath.section {
|
||||
case Section.Info.rawValue:
|
||||
|
||||
switch indexPath.row {
|
||||
case InfoRow.Name.rawValue:
|
||||
return 60
|
||||
|
||||
case InfoRow.Intro.rawValue:
|
||||
let tableViewWidth = CGRectGetWidth(editProfileTableView.bounds)
|
||||
let introLabelMaxWidth = tableViewWidth - YepConfig.EditProfile.introInset
|
||||
|
||||
let rect = intro.boundingRectWithSize(CGSize(width: introLabelMaxWidth, height: CGFloat(FLT_MAX)), options: .UsesLineFragmentOrigin | .UsesFontLeading, attributes: introAttributes, context: nil)
|
||||
|
||||
let height = 20 + 22 + 20 + ceil(rect.height) + 20
|
||||
|
||||
return height
|
||||
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
|
||||
case Section.LogOut.rawValue:
|
||||
return 80
|
||||
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: UIImagePicker
|
||||
|
||||
extension EditProfileViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
|
||||
func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage!, editingInfo: [NSObject : AnyObject]!) {
|
||||
s3PublicUploadParams(failureHandler: nil) { s3UploadParams in
|
||||
|
||||
let image = image.largestCenteredSquareImage().resizeToTargetSize(YepConfig.avatarMaxSize())
|
||||
|
||||
var imageData = UIImageJPEGRepresentation(image, YepConfig.avatarCompressionQuality())
|
||||
|
||||
// TODO: 等待的菊花
|
||||
uploadFileToS3(inFilePath: nil, orFileData: imageData, mimeType: "image/jpeg", s3UploadParams: s3UploadParams, completion: { (result, error) in
|
||||
println("upload avatar to s3 result: \(result), error: \(error)")
|
||||
|
||||
if (result) {
|
||||
let newAvatarURLString = "\(s3UploadParams.url)\(s3UploadParams.key)"
|
||||
|
||||
updateMyselfWithInfo(["avatar_url": newAvatarURLString], failureHandler: nil) { success in
|
||||
dispatch_async(dispatch_get_main_queue()) {
|
||||
YepUserDefaults.setAvatarURLString(newAvatarURLString)
|
||||
|
||||
self.updateAvatar()
|
||||
|
||||
if
|
||||
let myUserID = YepUserDefaults.userID(),
|
||||
let me = userWithUserID(myUserID) {
|
||||
let realm = RLMRealm.defaultRealm()
|
||||
realm.beginWriteTransaction()
|
||||
me.avatarURLString = newAvatarURLString
|
||||
realm.commitWriteTransaction()
|
||||
}
|
||||
|
||||
NSNotificationCenter.defaultCenter().postNotificationName(YepUpdatedProfileAvatarNotification, object: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
dismissViewControllerAnimated(true, completion: nil)
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,7 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Realm
|
||||
|
||||
let YepUpdatedProfileAvatarNotification = "YepUpdatedProfileAvatarNotification"
|
||||
let profileAvatarAspectRatio: CGFloat = 12.0 / 16.0
|
||||
|
||||
class ProfileViewController: UIViewController {
|
||||
@@ -43,6 +41,7 @@ class ProfileViewController: UIViewController {
|
||||
return ceil(rect.height) + 4
|
||||
}()
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
@@ -74,6 +73,8 @@ class ProfileViewController: UIViewController {
|
||||
|
||||
navigationController.navigationBar.titleTextAttributes = textAttributes
|
||||
|
||||
navigationItem.rightBarButtonItem?.tintColor = UIColor.whiteColor()
|
||||
|
||||
navigationItem.title = YepUserDefaults.nickname()
|
||||
}
|
||||
|
||||
@@ -101,52 +102,7 @@ class ProfileViewController: UIViewController {
|
||||
override func preferredStatusBarStyle() -> UIStatusBarStyle {
|
||||
return UIStatusBarStyle.LightContent
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: UIImagePicker
|
||||
|
||||
extension ProfileViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
|
||||
func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage!, editingInfo: [NSObject : AnyObject]!) {
|
||||
s3PublicUploadParams(failureHandler: nil) { s3UploadParams in
|
||||
|
||||
dispatch_async(dispatch_get_main_queue()) {
|
||||
if let cell = self.profileCollectionView.cellForItemAtIndexPath(NSIndexPath(forItem: 0, inSection: 0)) as? ProfileHeaderCell {
|
||||
cell.avatarImageView.image = image
|
||||
}
|
||||
}
|
||||
|
||||
let image = image.largestCenteredSquareImage().resizeToTargetSize(YepConfig.avatarMaxSize())
|
||||
|
||||
var imageData = UIImageJPEGRepresentation(image, YepConfig.avatarCompressionQuality())
|
||||
|
||||
uploadFileToS3(inFilePath: nil, orFileData: imageData, mimeType: "image/jpeg", s3UploadParams: s3UploadParams, completion: { (result, error) in
|
||||
println("upload avatar to s3 result: \(result), error: \(error)")
|
||||
|
||||
if (result) {
|
||||
let newAvatarURLString = "\(s3UploadParams.url)\(s3UploadParams.key)"
|
||||
|
||||
updateMyselfWithInfo(["avatar_url": newAvatarURLString], failureHandler: nil) { success in
|
||||
dispatch_async(dispatch_get_main_queue()) {
|
||||
YepUserDefaults.setAvatarURLString(newAvatarURLString)
|
||||
|
||||
if
|
||||
let myUserID = YepUserDefaults.userID(),
|
||||
let me = userWithUserID(myUserID) {
|
||||
let realm = RLMRealm.defaultRealm()
|
||||
realm.beginWriteTransaction()
|
||||
me.avatarURLString = newAvatarURLString
|
||||
realm.commitWriteTransaction()
|
||||
}
|
||||
|
||||
NSNotificationCenter.defaultCenter().postNotificationName(YepUpdatedProfileAvatarNotification, object: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
dismissViewControllerAnimated(true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: UICollectionView
|
||||
@@ -194,42 +150,6 @@ extension ProfileViewController: UICollectionViewDataSource, UICollectionViewDel
|
||||
|
||||
cell.nameLabel.text = YepUserDefaults.nickname()
|
||||
|
||||
cell.changeAvatarAction = {
|
||||
|
||||
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .ActionSheet)
|
||||
|
||||
let choosePhotoAction: UIAlertAction = UIAlertAction(title: NSLocalizedString("Choose Photo", comment: ""), style: .Default) { action -> Void in
|
||||
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.SavedPhotosAlbum) {
|
||||
let imagePicker = UIImagePickerController()
|
||||
imagePicker.delegate = self
|
||||
imagePicker.sourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum
|
||||
imagePicker.allowsEditing = false
|
||||
|
||||
self.presentViewController(imagePicker, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
alertController.addAction(choosePhotoAction)
|
||||
|
||||
let takePhotoAction: UIAlertAction = UIAlertAction(title: NSLocalizedString("Take Photo", comment: ""), style: .Default) { action -> Void in
|
||||
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera){
|
||||
let imagePicker = UIImagePickerController()
|
||||
imagePicker.delegate = self
|
||||
imagePicker.sourceType = UIImagePickerControllerSourceType.Camera
|
||||
imagePicker.allowsEditing = false
|
||||
|
||||
self.presentViewController(imagePicker, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
alertController.addAction(takePhotoAction)
|
||||
|
||||
let cancelAction: UIAlertAction = UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .Cancel) { action -> Void in
|
||||
self.dismissViewControllerAnimated(true, completion: nil)
|
||||
}
|
||||
alertController.addAction(cancelAction)
|
||||
|
||||
self.presentViewController(alertController, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
return cell
|
||||
|
||||
case ProfileSection.Master.rawValue:
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// SettingsViewController.swift
|
||||
// Yep
|
||||
//
|
||||
// Created by NIX on 15/4/24.
|
||||
// Copyright (c) 2015年 Catch Inc. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class SettingsViewController: UIViewController {
|
||||
|
||||
@IBOutlet weak var settingsTableView: UITableView!
|
||||
|
||||
let settingsUserCellIdentifier = "SettingsUserCell"
|
||||
let settingsMoreCellIdentifier = "SettingsMoreCell"
|
||||
|
||||
let intro = "I'm good at iOS Development and Singing. Come here, let me teach you." // TODO: User Intro
|
||||
let moreAnnotations: [String] = [
|
||||
NSLocalizedString("Notifications", comment: ""),
|
||||
NSLocalizedString("Feedback", comment: ""),
|
||||
NSLocalizedString("About", comment: ""),
|
||||
]
|
||||
|
||||
let introAttributes = [NSFontAttributeName: YepConfig.Settings.introFont]
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
title = NSLocalizedString("Settings", comment: "")
|
||||
|
||||
settingsTableView.registerNib(UINib(nibName: settingsUserCellIdentifier, bundle: nil), forCellReuseIdentifier: settingsUserCellIdentifier)
|
||||
settingsTableView.registerNib(UINib(nibName: settingsMoreCellIdentifier, bundle: nil), forCellReuseIdentifier: settingsMoreCellIdentifier)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension SettingsViewController: UITableViewDataSource, UITableViewDelegate {
|
||||
|
||||
enum Section: Int {
|
||||
case User = 0
|
||||
case More
|
||||
}
|
||||
|
||||
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
|
||||
return 2
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
switch section {
|
||||
case Section.User.rawValue:
|
||||
return 1
|
||||
case Section.More.rawValue:
|
||||
return moreAnnotations.count
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
||||
switch indexPath.section {
|
||||
|
||||
case Section.User.rawValue:
|
||||
let cell = tableView.dequeueReusableCellWithIdentifier(settingsUserCellIdentifier) as! SettingsUserCell
|
||||
cell.introLabel.text = intro
|
||||
return cell
|
||||
|
||||
case Section.More.rawValue:
|
||||
let cell = tableView.dequeueReusableCellWithIdentifier(settingsMoreCellIdentifier) as! SettingsMoreCell
|
||||
cell.annotationLabel.text = moreAnnotations[indexPath.row]
|
||||
return cell
|
||||
|
||||
default:
|
||||
return UITableViewCell()
|
||||
}
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
|
||||
switch indexPath.section {
|
||||
|
||||
case Section.User.rawValue:
|
||||
|
||||
let tableViewWidth = CGRectGetWidth(settingsTableView.bounds)
|
||||
let introLabelMaxWidth = tableViewWidth - YepConfig.Settings.introInset
|
||||
|
||||
let rect = intro.boundingRectWithSize(CGSize(width: introLabelMaxWidth, height: CGFloat(FLT_MAX)), options: .UsesLineFragmentOrigin | .UsesFontLeading, attributes: introAttributes, context: nil)
|
||||
|
||||
let height = max(20 + 10 + 22 + 8 + ceil(rect.height) + 20, 20 + YepConfig.Settings.userCellAvatarSize + 20)
|
||||
|
||||
return height
|
||||
|
||||
case Section.More.rawValue:
|
||||
return 60
|
||||
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
|
||||
tableView.deselectRowAtIndexPath(indexPath, animated: true)
|
||||
|
||||
switch indexPath.section {
|
||||
|
||||
case Section.User.rawValue:
|
||||
performSegueWithIdentifier("showEditProfile", sender: nil)
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// EditProfileColoredTitleCell.swift
|
||||
// Yep
|
||||
//
|
||||
// Created by NIX on 15/4/27.
|
||||
// Copyright (c) 2015年 Catch Inc. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class EditProfileColoredTitleCell: UITableViewCell {
|
||||
|
||||
var coloredTitleColor: UIColor = UIColor.redColor() {
|
||||
willSet {
|
||||
coloredTitleLabel.textColor = newValue
|
||||
}
|
||||
}
|
||||
|
||||
@IBOutlet weak var coloredTitleLabel: UILabel!
|
||||
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
override func setSelected(selected: Bool, animated: Bool) {
|
||||
super.setSelected(selected, animated: animated)
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="EditProfileColoredTitleCell" rowHeight="74" id="KGk-i7-Jjw" customClass="EditProfileColoredTitleCell" customModule="Yep" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="74"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Colored Title" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MHA-rr-62L">
|
||||
<rect key="frame" x="111" y="26" width="98" height="22"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="light" pointSize="18"/>
|
||||
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="centerY" secondItem="MHA-rr-62L" secondAttribute="centerY" id="sxx-f9-Lo6"/>
|
||||
<constraint firstAttribute="centerX" secondItem="MHA-rr-62L" secondAttribute="centerX" id="zNx-WP-eVR"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="coloredTitleLabel" destination="MHA-rr-62L" id="gF4-Qa-PTg"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="338" y="387"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// EditProfileLessInfoCell.swift
|
||||
// Yep
|
||||
//
|
||||
// Created by NIX on 15/4/24.
|
||||
// Copyright (c) 2015年 Catch Inc. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class EditProfileLessInfoCell: UITableViewCell {
|
||||
|
||||
@IBOutlet weak var annotationLabel: UILabel!
|
||||
|
||||
@IBOutlet weak var infoLabel: UILabel!
|
||||
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
override func setSelected(selected: Bool, animated: Bool) {
|
||||
super.setSelected(selected, animated: animated)
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="88" id="KGk-i7-Jjw" customClass="EditProfileLessInfoCell" customModule="Yep" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="88"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="Annotation" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0FC-Jf-4Gf" userLabel="Annotation Label">
|
||||
<rect key="frame" x="20" y="33" width="84" height="22"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="light" pointSize="18"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Info" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fGP-fu-MyB" userLabel="Info Label">
|
||||
<rect key="frame" x="114" y="33" width="188" height="22"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="light" pointSize="18"/>
|
||||
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="centerY" secondItem="fGP-fu-MyB" secondAttribute="centerY" id="082-8c-wbn"/>
|
||||
<constraint firstItem="0FC-Jf-4Gf" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="20" id="Ktt-S1-9Cv"/>
|
||||
<constraint firstItem="fGP-fu-MyB" firstAttribute="leading" secondItem="0FC-Jf-4Gf" secondAttribute="trailing" constant="10" id="UHV-0J-Zaw"/>
|
||||
<constraint firstAttribute="trailing" secondItem="fGP-fu-MyB" secondAttribute="trailing" constant="18" id="Une-Pw-pgT"/>
|
||||
<constraint firstAttribute="centerY" secondItem="0FC-Jf-4Gf" secondAttribute="centerY" id="lV1-c6-cFn"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="annotationLabel" destination="0FC-Jf-4Gf" id="RHM-ZO-VeP"/>
|
||||
<outlet property="infoLabel" destination="fGP-fu-MyB" id="PzP-fc-sc1"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="444" y="394"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// EditProfileMoreInfoCell.swift
|
||||
// Yep
|
||||
//
|
||||
// Created by NIX on 15/4/27.
|
||||
// Copyright (c) 2015年 Catch Inc. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class EditProfileMoreInfoCell: UITableViewCell {
|
||||
|
||||
@IBOutlet weak var annotationLabel: UILabel!
|
||||
|
||||
@IBOutlet weak var infoLabel: UILabel!
|
||||
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
infoLabel.font = YepConfig.EditProfile.introFont
|
||||
}
|
||||
|
||||
override func setSelected(selected: Bool, animated: Bool) {
|
||||
super.setSelected(selected, animated: animated)
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="EditProfileMoreInfoCell" rowHeight="111" id="KGk-i7-Jjw" customClass="EditProfileMoreInfoCell" customModule="Yep" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="111"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Annotation" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ewh-I8-MJ9" userLabel="Annotation Label">
|
||||
<rect key="frame" x="20" y="20" width="84" height="22"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="light" pointSize="18"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Info Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JHV-kp-OAI" userLabel="Info Label">
|
||||
<rect key="frame" x="20" y="62" width="64" height="18"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="light" pointSize="15"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="Ewh-I8-MJ9" firstAttribute="leading" secondItem="JHV-kp-OAI" secondAttribute="leading" id="Iqe-JH-Qj4"/>
|
||||
<constraint firstItem="Ewh-I8-MJ9" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="20" id="JRJ-wM-kMZ"/>
|
||||
<constraint firstItem="JHV-kp-OAI" firstAttribute="top" secondItem="Ewh-I8-MJ9" secondAttribute="bottom" constant="20" id="RzR-CT-w4C"/>
|
||||
<constraint firstItem="Ewh-I8-MJ9" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="20" id="aBz-Mo-kXV"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="JHV-kp-OAI" secondAttribute="trailing" constant="20" id="dZ8-KB-ANO"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="Ewh-I8-MJ9" secondAttribute="trailing" constant="20" id="kDN-WZ-MSL"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="annotationLabel" destination="Ewh-I8-MJ9" id="FbX-eI-A70"/>
|
||||
<outlet property="infoLabel" destination="JHV-kp-OAI" id="7uj-XN-GrS"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="444" y="405.5"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -10,25 +10,30 @@ import UIKit
|
||||
|
||||
class ProfileHeaderCell: UICollectionViewCell {
|
||||
|
||||
var changeAvatarAction: (() -> Void)?
|
||||
|
||||
|
||||
@IBOutlet weak var avatarImageView: UIImageView!
|
||||
@IBOutlet weak var nameLabel: UILabel!
|
||||
@IBOutlet weak var joinedDateLabel: UILabel!
|
||||
@IBOutlet weak var locationLabel: UILabel!
|
||||
|
||||
deinit {
|
||||
NSNotificationCenter.defaultCenter().removeObserver(self)
|
||||
}
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
nameLabel.hidden = true
|
||||
joinedDateLabel.hidden = true
|
||||
|
||||
let tap = UITapGestureRecognizer(target: self, action: "tryChangeAvatar")
|
||||
avatarImageView.userInteractionEnabled = true
|
||||
avatarImageView.addGestureRecognizer(tap)
|
||||
|
||||
updateAvatar()
|
||||
NSNotificationCenter.defaultCenter().addObserver(self, selector: "updateAvatar", name: YepUpdatedProfileAvatarNotification, object: nil)
|
||||
|
||||
YepLocationService.sharedManager
|
||||
|
||||
NSNotificationCenter.defaultCenter().addObserver(self, selector: "updateAddress", name: "YepLocationUpdated", object: nil)
|
||||
}
|
||||
|
||||
func updateAvatar() {
|
||||
avatarImageView.alpha = 0
|
||||
if let avatarURLString = YepUserDefaults.avatarURLString() {
|
||||
AvatarCache.sharedInstance.avatarFromURL(NSURL(string: avatarURLString)!) { image in
|
||||
@@ -41,10 +46,6 @@ class ProfileHeaderCell: UICollectionViewCell {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
YepLocationService.sharedManager
|
||||
|
||||
NSNotificationCenter.defaultCenter().addObserver(self, selector: "updateAddress", name: "YepLocationUpdated", object: nil)
|
||||
}
|
||||
|
||||
func updateAddress() {
|
||||
@@ -54,9 +55,4 @@ class ProfileHeaderCell: UICollectionViewCell {
|
||||
self.locationLabel.text = YepLocationService.sharedManager.address
|
||||
}
|
||||
|
||||
func tryChangeAvatar() {
|
||||
if let changeAvatarAction = changeAvatarAction {
|
||||
changeAvatarAction()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// SettingsMoreCell.swift
|
||||
// Yep
|
||||
//
|
||||
// Created by NIX on 15/4/24.
|
||||
// Copyright (c) 2015年 Catch Inc. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class SettingsMoreCell: UITableViewCell {
|
||||
|
||||
@IBOutlet weak var annotationLabel: UILabel!
|
||||
|
||||
@IBOutlet weak var accessoryImageView: UIImageView!
|
||||
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
accessoryImageView.tintColor = UIColor.lightGrayColor()
|
||||
}
|
||||
|
||||
override func setSelected(selected: Bool, animated: Bool) {
|
||||
super.setSelected(selected, animated: animated)
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="SettingsMoreCell" rowHeight="72" id="KGk-i7-Jjw" customClass="SettingsMoreCell" customModule="Yep" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="72"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="More" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rWz-Jb-Xgj" userLabel="Annotation Label">
|
||||
<rect key="frame" x="20" y="25" width="40" height="22"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="light" pointSize="18"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_accessory" translatesAutoresizingMaskIntoConstraints="NO" id="g81-Zw-MIi" userLabel="Accessory Image View">
|
||||
<rect key="frame" x="289" y="26" width="11" height="20"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="20" id="Vcq-kU-dBt"/>
|
||||
<constraint firstAttribute="width" constant="11" id="j4X-8c-Z1B"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="rWz-Jb-Xgj" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="20" id="GZU-3e-Nos"/>
|
||||
<constraint firstAttribute="centerY" secondItem="rWz-Jb-Xgj" secondAttribute="centerY" constant="-0.5" id="KWc-LJ-REX"/>
|
||||
<constraint firstAttribute="trailing" secondItem="g81-Zw-MIi" secondAttribute="trailing" constant="20" id="Pbg-ZQ-Wwu"/>
|
||||
<constraint firstItem="g81-Zw-MIi" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="rWz-Jb-Xgj" secondAttribute="trailing" constant="10" id="XiB-7u-nzk"/>
|
||||
<constraint firstAttribute="centerY" secondItem="g81-Zw-MIi" secondAttribute="centerY" id="f3M-TT-UGK"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="accessoryImageView" destination="g81-Zw-MIi" id="cGJ-DC-ZIp"/>
|
||||
<outlet property="annotationLabel" destination="rWz-Jb-Xgj" id="HBc-nZ-Rbw"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="321" y="409"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="icon_accessory" width="11" height="20"/>
|
||||
</resources>
|
||||
</document>
|
||||
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// SettingsUserCell.swift
|
||||
// Yep
|
||||
//
|
||||
// Created by NIX on 15/4/24.
|
||||
// Copyright (c) 2015年 Catch Inc. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class SettingsUserCell: UITableViewCell {
|
||||
|
||||
@IBOutlet weak var avatarImageView: UIImageView!
|
||||
@IBOutlet weak var avatarImageViewWidthConstraint: NSLayoutConstraint!
|
||||
|
||||
@IBOutlet weak var nameLabel: UILabel!
|
||||
|
||||
@IBOutlet weak var introLabel: UILabel!
|
||||
|
||||
@IBOutlet weak var accessoryImageView: UIImageView!
|
||||
|
||||
|
||||
deinit {
|
||||
NSNotificationCenter.defaultCenter().removeObserver(self)
|
||||
}
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
let avatarSize = YepConfig.Settings.userCellAvatarSize
|
||||
avatarImageViewWidthConstraint.constant = avatarSize
|
||||
|
||||
updateAvatar()
|
||||
NSNotificationCenter.defaultCenter().addObserver(self, selector: "updateAvatar", name: YepUpdatedProfileAvatarNotification, object: nil)
|
||||
|
||||
nameLabel.text = YepUserDefaults.nickname()
|
||||
|
||||
introLabel.font = YepConfig.Settings.introFont
|
||||
|
||||
accessoryImageView.tintColor = UIColor.lightGrayColor()
|
||||
|
||||
}
|
||||
|
||||
func updateAvatar() {
|
||||
|
||||
if let avatarURLString = YepUserDefaults.avatarURLString() {
|
||||
|
||||
let avatarSize = YepConfig.Settings.userCellAvatarSize
|
||||
|
||||
avatarImageView.alpha = 0
|
||||
AvatarCache.sharedInstance.roundAvatarWithAvatarURLString(avatarURLString, withRadius: avatarSize * 0.5) { image in
|
||||
dispatch_async(dispatch_get_main_queue()) {
|
||||
self.avatarImageView.image = image
|
||||
|
||||
UIView.animateWithDuration(0.2, delay: 0.0, options: .CurveEaseOut, animations: { () -> Void in
|
||||
self.avatarImageView.alpha = 1
|
||||
}, completion: { (finished) -> Void in
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override func setSelected(selected: Bool, animated: Bool) {
|
||||
super.setSelected(selected, animated: animated)
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
|
||||
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="123" id="KGk-i7-Jjw" customClass="SettingsUserCell" customModule="Yep" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="123"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ibs-9N-MGR" userLabel="Avatar Image View">
|
||||
<rect key="frame" x="20" y="20" width="80" height="80"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="80" id="82W-iA-aCD"/>
|
||||
<constraint firstAttribute="width" secondItem="ibs-9N-MGR" secondAttribute="height" multiplier="1:1" id="seq-PX-N4G"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="NIX" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Gbe-2T-8A9" userLabel="Name Label">
|
||||
<rect key="frame" x="120" y="30" width="27" height="22"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="light" pointSize="18"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VeK-Pq-9Rc" userLabel="Intro Label">
|
||||
<rect key="frame" x="120" y="60" width="29" height="15"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="light" pointSize="12"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_accessory" translatesAutoresizingMaskIntoConstraints="NO" id="8aX-g5-iad" userLabel="Accessory Image View">
|
||||
<rect key="frame" x="289" y="51" width="11" height="20"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="20" id="JYu-OH-0FU"/>
|
||||
<constraint firstAttribute="width" constant="11" id="NhX-BW-1H2"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="VeK-Pq-9Rc" firstAttribute="top" secondItem="Gbe-2T-8A9" secondAttribute="bottom" constant="8" id="DDp-pu-ZPK"/>
|
||||
<constraint firstItem="Gbe-2T-8A9" firstAttribute="leading" secondItem="ibs-9N-MGR" secondAttribute="trailing" constant="20" id="KXB-3a-b0G"/>
|
||||
<constraint firstAttribute="centerY" secondItem="8aX-g5-iad" secondAttribute="centerY" id="SGg-g6-2cW"/>
|
||||
<constraint firstItem="Gbe-2T-8A9" firstAttribute="leading" secondItem="VeK-Pq-9Rc" secondAttribute="leading" id="UrS-7v-tZ2"/>
|
||||
<constraint firstItem="Gbe-2T-8A9" firstAttribute="top" secondItem="ibs-9N-MGR" secondAttribute="top" constant="10" id="Vgm-9V-bum"/>
|
||||
<constraint firstItem="8aX-g5-iad" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="VeK-Pq-9Rc" secondAttribute="trailing" constant="10" id="ZMC-Mq-uZN"/>
|
||||
<constraint firstAttribute="trailing" secondItem="8aX-g5-iad" secondAttribute="trailing" constant="20" id="d7J-7j-Sgh"/>
|
||||
<constraint firstItem="ibs-9N-MGR" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="20" id="jBN-cc-b4Y"/>
|
||||
<constraint firstItem="ibs-9N-MGR" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="20" id="pcC-pd-KFR"/>
|
||||
<constraint firstItem="8aX-g5-iad" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Gbe-2T-8A9" secondAttribute="trailing" constant="10" id="yjm-3e-Mna"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="accessoryImageView" destination="8aX-g5-iad" id="SWg-BB-eau"/>
|
||||
<outlet property="avatarImageView" destination="ibs-9N-MGR" id="h6d-w9-Tip"/>
|
||||
<outlet property="avatarImageViewWidthConstraint" destination="82W-iA-aCD" id="7Ev-Bt-p6N"/>
|
||||
<outlet property="introLabel" destination="VeK-Pq-9Rc" id="Voc-0o-2Oh"/>
|
||||
<outlet property="nameLabel" destination="Gbe-2T-8A9" id="0lw-Og-My0"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="293" y="424.5"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="icon_accessory" width="11" height="20"/>
|
||||
</resources>
|
||||
</document>
|
||||
Reference in New Issue
Block a user