Skip to content

Commit

Permalink
Merge pull request #62 from fassko/1.3
Browse files Browse the repository at this point in the history
1.3
  • Loading branch information
fassko committed Mar 26, 2016
2 parents 1546684 + cebe9b8 commit b9bd0e8
Show file tree
Hide file tree
Showing 149 changed files with 17,360 additions and 4,079 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ before_install:
- brew update
- brew outdated xctool || brew upgrade xctool
language: objective-c
osx_image: xcode7.2
osx_image: xcode7.3
script:
- fastlane travis
notifications: change
10 changes: 7 additions & 3 deletions Dodies.lv.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
636EA8361BA5BDF40071397A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636EA8351BA5BDF40071397A /* AppDelegate.swift */; };
636EA83D1BA5BDF40071397A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 636EA83B1BA5BDF40071397A /* Main.storyboard */; };
636EA8421BA5BDF40071397A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 636EA8401BA5BDF40071397A /* LaunchScreen.storyboard */; };
638EB5111CA6FBC100FA7903 /* DescriptionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 638EB5101CA6FBC100FA7903 /* DescriptionViewController.swift */; };
639710851C8200F1003C3842 /* dodies_logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 639710821C8200F1003C3842 /* dodies_logo.png */; };
639710861C8200F1003C3842 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 639710831C8200F1003C3842 /* [email protected] */; };
639710871C8200F1003C3842 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 639710841C8200F1003C3842 /* [email protected] */; };
Expand Down Expand Up @@ -77,6 +78,7 @@
636EA83C1BA5BDF40071397A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
636EA8411BA5BDF40071397A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
636EA8431BA5BDF40071397A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
638EB5101CA6FBC100FA7903 /* DescriptionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DescriptionViewController.swift; sourceTree = "<group>"; };
639710821C8200F1003C3842 /* dodies_logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = dodies_logo.png; sourceTree = "<group>"; };
639710831C8200F1003C3842 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
639710841C8200F1003C3842 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -266,8 +268,9 @@
isa = PBXGroup;
children = (
6304EB001BA5C2C700B7CD49 /* Map.swift */,
63CA57A61BA606B800A9F5DC /* Details.swift */,
63F5DC6D1C8358F200AEB195 /* AboutViewController.swift */,
63CA57A61BA606B800A9F5DC /* Details.swift */,
638EB5101CA6FBC100FA7903 /* DescriptionViewController.swift */,
);
name = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -488,6 +491,7 @@
63475FEC1C5CC95500A9A5E4 /* DodiesPoint.swift in Sources */,
63F5DC6E1C8358F200AEB195 /* AboutViewController.swift in Sources */,
63CA57A71BA606B800A9F5DC /* Details.swift in Sources */,
638EB5111CA6FBC100FA7903 /* DescriptionViewController.swift in Sources */,
6304EB011BA5C2C700B7CD49 /* Map.swift in Sources */,
63AFB8011C5E3FFC004A58E1 /* Helper.swift in Sources */,
);
Expand Down Expand Up @@ -535,7 +539,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer: Kristaps Grinbergs (MMGQCA8E72)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Kristaps Grinbergs (MMGQCA8E72)";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 26;
CURRENT_PROJECT_VERSION = 30;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down Expand Up @@ -587,7 +591,7 @@
CODE_SIGN_IDENTITY = "iPhone Distribution: Kristaps Grinbergs (3SGNZQGS68)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Kristaps Grinbergs (3SGNZQGS68)";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 26;
CURRENT_PROJECT_VERSION = 30;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_BITCODE = NO;
ENABLE_NS_ASSERTIONS = NO;
Expand Down
360 changes: 293 additions & 67 deletions Dodies.lv/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions Dodies.lv/DescriptionViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// DescriptionViewController.swift
// Dodies.lv
//
// Created by Kristaps Grinbergs on 26/03/16.
// Copyright © 2016 fassko. All rights reserved.
//

import UIKit
import Foundation
import Attributed
import Fabric
import Crashlytics
import LKAlertController


class DescriptionViewController: UIViewController {

var point : DodiesAnnotation!

@IBOutlet weak var descriptionWebView: UIWebView!

override func viewDidLoad() {
super.viewDidLoad()

self.title = point.title

let titleLabel = UILabel(frame: CGRectMake(0, 0, view.frame.size.width - 120, 44))
titleLabel.backgroundColor = UIColor.clearColor()
titleLabel.font = UIFont(name: "HelveticaNeue-Medium", size: 18)
titleLabel.textAlignment = NSTextAlignment.Center
titleLabel.text = self.title
titleLabel.textColor = UIColor.whiteColor()
titleLabel.adjustsFontSizeToFitWidth = true

self.navigationItem.titleView = titleLabel



self.automaticallyAdjustsScrollViewInsets = false

descriptionWebView.loadRequest(NSURLRequest(URL: NSURL(string: "http://dodies.lv/info?taka=\(point.id)")!))
descriptionWebView.scrollView.contentOffset = CGPoint(x: 0, y: 0)

}
}
88 changes: 78 additions & 10 deletions Dodies.lv/Details.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,21 @@ import UIKit
import Attributed
import Fabric
import Crashlytics
import LKAlertController
import Alamofire
import AlamofireImage

class Details : UIViewController {

var point : DodiesAnnotation!

@IBOutlet weak var desc: UITextView!
@IBOutlet weak var descriptionLinkButton: UIButton!
@IBOutlet weak var coordinatesButton: UIButton!
@IBOutlet weak var lenght: UILabel!
@IBOutlet weak var checked: UILabel!
@IBOutlet weak var details: UIBarButtonItem!

@IBOutlet weak var image: UIImageView?


override func viewDidLoad() {
Expand All @@ -44,16 +49,24 @@ class Details : UIViewController {

self.automaticallyAdjustsScrollViewInsets = false

descriptionLinkButton.layer.cornerRadius = 5
coordinatesButton.titleLabel?.text = "\(point.coordinate.latitude),\(point.coordinate.longitude)"
coordinatesButton.setTitle("\(String(format: "%.5f",point.coordinate.latitude)), \(String(format: "%.5f",point.coordinate.longitude))", forState: UIControlState.Normal)

lenght.text = point.garums != "" ? "\(point.garums) km" : "-"
checked.text = point.datums != "" ? point.datums : "-"

if point.apraksts == "true" {
descriptionLinkButton.hidden = false
}
let attributes = [NSFontAttributeName: UIFont.fontAwesomeOfSize(20)] as Dictionary!
details.setTitleTextAttributes(attributes, forState: .Normal)
details.title = String.fontAwesomeIconWithName(.Info)

Alamofire.request(.GET, "http://dodies.lv/img/large/\(self.point.id)-01.jpg").responseImage {
response in

if let image = response.result.value {
let radius: CGFloat = 10.0

self.image?.image = image.af_imageWithRoundedCornerRadius(radius)
}
}
}

override func viewWillAppear(animated: Bool) {
Expand Down Expand Up @@ -83,14 +96,69 @@ class Details : UIViewController {
}

@IBAction func showDescription(sender: AnyObject) {
UIApplication.sharedApplication().openURL(NSURL(string: "http://dodies.lv/info?taka=\(point.id)")!)
if point.apraksts == "true" {
performSegueWithIdentifier("showDescription", sender: self)
} else {
Alert(title: "Dodies.lv", message: "Diemžēl apraksts vēl nav izveidots.").addAction("OK").show()
}
}

@IBAction func openNavigation(sender: AnyObject) {
let u = "http://maps.apple.com/?daddr=\(point.coordinate.latitude),\(point.coordinate.longitude)"
print(u)
UIApplication.sharedApplication().openURL(NSURL(string: u)!)
let optionMenu = UIAlertController(title: nil, message: "Navigēt ar", preferredStyle: .ActionSheet)

let apple = UIAlertAction(title: "Apple Maps", style: .Default, handler: {
(alert: UIAlertAction!) -> Void in
let u = "http://maps.apple.com/?daddr=\(self.point.coordinate.latitude),\(self.point.coordinate.longitude)"
UIApplication.sharedApplication().openURL(NSURL(string: u)!)
})

let google = UIAlertAction(title: "Google Maps", style: .Default, handler: {
(alert: UIAlertAction!) -> Void in

if (UIApplication.sharedApplication().canOpenURL(NSURL(string:"comgooglemaps://")!)) {
UIApplication.sharedApplication().openURL(NSURL(string:
"comgooglemaps://?saddr=&daddr=\(self.point.coordinate.latitude),\(self.point.coordinate.longitude)&directionsmode=driving")!)

} else {
let link = "http://itunes.apple.com/us/app/id585027354"
UIApplication.sharedApplication().openURL(NSURL(string: link)!)
UIApplication.sharedApplication().idleTimerDisabled = true
}
})

let waze = UIAlertAction(title: "Waze", style: .Default, handler: {
(alert: UIAlertAction!) -> Void in

if UIApplication.sharedApplication().canOpenURL(NSURL(string: "waze://")!) {
UIApplication.sharedApplication().openURL(NSURL(string: "waze://?ll=\(self.point.coordinate.latitude),\(self.point.coordinate.longitude)&navigate=yes")!)
UIApplication.sharedApplication().idleTimerDisabled = true
} else {
UIApplication.sharedApplication().openURL(NSURL(string: "http://itunes.apple.com/us/app/id323229106")!)
UIApplication.sharedApplication().idleTimerDisabled = true
}
})

let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: {
(alert: UIAlertAction!) -> Void in
})

optionMenu.addAction(apple)
optionMenu.addAction(google)
optionMenu.addAction(waze)
optionMenu.addAction(cancelAction)

self.presentViewController(optionMenu, animated: true, completion: nil)
}

// pass object to details view
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "showDescription" {

if let description: DescriptionViewController = segue.destinationViewController as? DescriptionViewController {
navigationItem.title = ""
description.point = self.point
}
}
}

}
10 changes: 8 additions & 2 deletions Dodies.lv/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<string>1.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand All @@ -43,7 +43,7 @@
<key>LSRequiresIPhoneOS</key>
<true/>
<key>MGLMapboxAccessToken</key>
<string>sk.eyJ1Ijoia3Jpc3RhcHMiLCJhIjoiY2llaWx1aG9kMDAydXRlbHo1ZTgwazk5YiJ9.Vx8dPdWobZHh7_5c1XPXNA</string>
<string>sk.eyJ1Ijoibm9ybWlzIiwiYSI6ImNpbTBjZzQ5bTAwaTZ2OW00YXBlMjRpaDYifQ.QfD2KOVBvTqzu2AcQIOHTA</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
Expand Down Expand Up @@ -90,5 +90,11 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>waze</string>
<string>comgooglemaps</string>
</array>
<key>ITSAppUsesNonExemptEncryption</key><false/>
</dict>
</plist>
Loading

0 comments on commit b9bd0e8

Please sign in to comment.