Skip to content

Commit

Permalink
fixed KVO bug in MapView, ChatMessage Push, Activiy Invitation Push, …
Browse files Browse the repository at this point in the history
…Notification Refresh Bug
  • Loading branch information
csujedihy committed Apr 24, 2016
1 parent ac36a67 commit d356750
Show file tree
Hide file tree
Showing 44 changed files with 245 additions and 52 deletions.
10 changes: 7 additions & 3 deletions Dine.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
C1D04F5D1C9E3056003EB3C9 /* SignUpPasswordViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1D04F5C1C9E3056003EB3C9 /* SignUpPasswordViewController.swift */; };
C1D04F5F1C9E306E003EB3C9 /* SignUpNameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1D04F5E1C9E306E003EB3C9 /* SignUpNameViewController.swift */; };
C1D04F661C9E626C003EB3C9 /* SignUpViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1D04F651C9E626C003EB3C9 /* SignUpViewController.swift */; };
C1F0B74A1CCD67EA00E60CB3 /* AppIcon.appiconset in Resources */ = {isa = PBXBuildFile; fileRef = C1F0B7491CCD67EA00E60CB3 /* AppIcon.appiconset */; };
C1F9785A1C97BDBF007CE2A3 /* ViewExt.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1F978591C97BDBF007CE2A3 /* ViewExt.swift */; };
C62937E51CAF097700E46009 /* ContainerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C62937E41CAF097700E46009 /* ContainerViewController.swift */; };
C62937E91CAF183900E46009 /* UIViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C62937E81CAF183900E46009 /* UIViewController.swift */; };
Expand Down Expand Up @@ -146,6 +147,7 @@
C1D04F5C1C9E3056003EB3C9 /* SignUpPasswordViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignUpPasswordViewController.swift; sourceTree = "<group>"; };
C1D04F5E1C9E306E003EB3C9 /* SignUpNameViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignUpNameViewController.swift; sourceTree = "<group>"; };
C1D04F651C9E626C003EB3C9 /* SignUpViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignUpViewController.swift; sourceTree = "<group>"; };
C1F0B7491CCD67EA00E60CB3 /* AppIcon.appiconset */ = {isa = PBXFileReference; lastKnownFileType = folder; path = AppIcon.appiconset; sourceTree = "<group>"; };
C1F978591C97BDBF007CE2A3 /* ViewExt.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewExt.swift; sourceTree = "<group>"; };
C62937E41CAF097700E46009 /* ContainerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContainerViewController.swift; sourceTree = "<group>"; };
C62937E81CAF183900E46009 /* UIViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -367,6 +369,7 @@
C1AF836C1CA3C17400E634E3 /* ActvitityCreater.storyboard */,
C1AF83691CA3BF6900E634E3 /* SignInSignOut.storyboard */,
C6EE09191C906F6200345357 /* Assets.xcassets */,
C1F0B7491CCD67EA00E60CB3 /* AppIcon.appiconset */,
C6EE091B1C906F6200345357 /* LaunchScreen.storyboard */,
C6EE091E1C906F6200345357 /* Info.plist */,
);
Expand Down Expand Up @@ -475,7 +478,7 @@
DevelopmentTeam = NL7M2J93PJ;
SystemCapabilities = {
com.apple.BackgroundModes = {
enabled = 0;
enabled = 1;
};
com.apple.Keychain = {
enabled = 0;
Expand Down Expand Up @@ -514,6 +517,7 @@
C1AF836B1CA3BF6900E634E3 /* SignInSignOut.storyboard in Resources */,
C18320BA1CBF80F30088600F /* MenuCell.xib in Resources */,
C62937EE1CAF20BD00E46009 /* GroupChatView.storyboard in Resources */,
C1F0B74A1CCD67EA00E60CB3 /* AppIcon.appiconset in Resources */,
C1AF83721CA3C2D100E634E3 /* FriendList.storyboard in Resources */,
3BA5970F1CAC7F1F00D0E6C7 /* MemberMessageCell.xib in Resources */,
C6EE09421C972A5700345357 /* SidebarMenuHeaderView.xib in Resources */,
Expand Down Expand Up @@ -803,7 +807,7 @@
INFOPLIST_FILE = Dine/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = cn.c2fun.dineapp;
PRODUCT_BUNDLE_IDENTIFIER = cn.c2fun.letsdine;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "Dine-Bridging-Header.h";
Expand All @@ -823,7 +827,7 @@
INFOPLIST_FILE = Dine/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = cn.c2fun.dineapp;
PRODUCT_BUNDLE_IDENTIFIER = cn.c2fun.letsdine;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "Dine-Bridging-Header.h";
Expand Down
3 changes: 0 additions & 3 deletions Dine.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion Dine/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
PFPush.handlePush(userInfo)
}

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {

}

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

let types: UIUserNotificationType = [.Alert, .Badge, .Sound]
Expand Down Expand Up @@ -115,11 +119,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func userDidLogin() {
let installation = PFInstallation.currentInstallation()
guard let userId = PFUser.currentUser()?.objectId, _ = PFUser.currentUser() else {
guard let _ = PFUser.currentUser(), userId = PFUser.currentUser()?.objectId else {
Log.error("objectId not exists or currentUser not exists")
return
}

Log.info("userDidLogin \(userId)")

installation["userId"] = userId
installation.saveInBackground()

Expand Down
86 changes: 86 additions & 0 deletions Dine/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x",
"filename" : "[email protected]"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x",
"filename" : "[email protected]"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x",
"filename" : "[email protected]"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x",
"filename" : "[email protected]"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x",
"filename" : "[email protected]"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x",
"filename" : "[email protected]"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x",
"filename" : "Icon-Small.png"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x",
"filename" : "[email protected]"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x",
"filename" : "Icon-40.png"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x",
"filename" : "[email protected]"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x",
"filename" : "Icon-76.png"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x",
"filename" : "[email protected]"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x",
"filename" : "[email protected]"
}
],
"info" : {
"version" : 1,
"author" : "makeappicon"
}
}
Binary file added Dine/AppIcon.appiconset/Icon-40.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dine/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dine/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dine/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dine/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dine/AppIcon.appiconset/Icon-76.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dine/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dine/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dine/AppIcon.appiconset/Icon-Small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dine/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Dine/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 54 additions & 6 deletions Dine/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,82 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-Small.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-40.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-76.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
}
],
"info" : {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions Dine/Assets.xcassets/plate.imageset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"images" : [
{
"idiom" : "universal",
"filename" : "1461478515_Christmas-15.png",
"filename" : "1461530120_Christmas-15.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "1461478515_Christmas-16.png",
"filename" : "1461530200_Christmas-15.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "1461478515_Christmas-17.png",
"filename" : "1461530200_Christmas-17.png",
"scale" : "3x"
}
],
Expand Down
14 changes: 7 additions & 7 deletions Dine/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
Expand All @@ -22,26 +22,26 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="powered by TeamYYZ" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iDd-bW-yb1">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Powered by TeamYYZ" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iDd-bW-yb1">
<rect key="frame" x="77" y="522" width="167" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" white="0.70032790981490034" alpha="1" colorSpace="calibratedWhite"/>
<color key="textColor" red="0.90196079019999997" green="0.90196079019999997" blue="0.90196079019999997" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Let's Dine" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Mrx-sg-TVl">
<rect key="frame" x="67" y="115" width="186" height="55"/>
<rect key="frame" x="67" y="72" width="186" height="55"/>
<fontDescription key="fontDescription" name="DeftoneStylus-Regular" family="Deftone Stylus" pointSize="40"/>
<color key="textColor" red="0.5" green="0.0" blue="0.5" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
<color key="shadowColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
</label>
</subviews>
<color key="backgroundColor" red="0.95227056741714478" green="0.97246712446212769" blue="0.98490113019943237" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" red="0.0" green="0.50196081400000003" blue="0.25098040700000002" alpha="1" colorSpace="calibratedRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="28" y="355"/>
<point key="canvasLocation" x="14.933333333333334" y="336.06666666666666"/>
</scene>
</scenes>
</document>
2 changes: 2 additions & 0 deletions Dine/ChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class ChatViewController: UITableViewController, UIImagePickerControllerDelegate
}

func plusButtonOnClick() {
textInputBar.textView.resignFirstResponder()
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .ActionSheet)
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel) {
(action) in
Expand Down Expand Up @@ -113,6 +114,7 @@ class ChatViewController: UITableViewController, UIImagePickerControllerDelegate
let avatarPFFile = User.currentUser?.avatarImagePFFile

let message = Message(activityId: currentActivity.activityId, senderId: senderId, screenName: screenName, content: content, avatarPFFile: avatarPFFile, mediaPFFile: nil, mediaType: nil)
textInputBar.text = ""
message.saveToBackend({
self.fetchData()
}, failureHandler: { (error: NSError?) in
Expand Down
4 changes: 2 additions & 2 deletions Dine/CurrentActivityBottomBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ class CurrentActivityBottomBar: UIView {
override func awakeFromNib() {
// add the shadow to the base view
self.backgroundColor = UIColor.clearColor()
self.layer.shadowColor = UIColor.blackColor().CGColor
self.layer.shadowColor = UIColor.flatMagentaColor().CGColor
self.layer.shadowOffset = CGSize(width: 0, height: 0)
self.layer.shadowOpacity = 0.7
self.layer.shadowRadius = 1.0
self.layer.shadowRadius = 2.0

// improve performance
self.layer.shadowPath = UIBezierPath(roundedRect: self.bounds, cornerRadius: 10).CGPath
Expand Down
15 changes: 10 additions & 5 deletions Dine/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIAppFonts</key>
<array>
<string>deftone-stylus.ttf</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDocumentTypes</key>
Expand All @@ -30,7 +26,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.1</string>
<string>1.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand Down Expand Up @@ -68,6 +64,15 @@
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string>DineApp Requires Access To Your Location</string>
<key>UIAppFonts</key>
<array>
<string>deftone-stylus.ttf</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>location</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
Expand Down
Loading

0 comments on commit d356750

Please sign in to comment.