Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
omidgolparvar committed Aug 13, 2019
1 parent 1b16aab commit bef84fc
Show file tree
Hide file tree
Showing 10 changed files with 142 additions and 109 deletions.
14 changes: 13 additions & 1 deletion Vazhegan.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
1A7F815E211F230A004BA888 /* IRANSansMobile_Medium.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1A53718E1FB44AEE00F9F534 /* IRANSansMobile_Medium.ttf */; };
1A7F815F211F230A004BA888 /* IRANSansMobile.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1A53718F1FB44AEE00F9F534 /* IRANSansMobile.ttf */; };
1A7F8160211F230A004BA888 /* ionicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1AEB41F91E2D655400B379F3 /* ionicons.ttf */; };
1A802CD52302B65A006DE213 /* Haptic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A802CD42302B65A006DE213 /* Haptic.swift */; };
1A890184211F423B00429CA7 /* Fabric.Keys in Resources */ = {isa = PBXBuildFile; fileRef = 1A890183211F423B00429CA7 /* Fabric.Keys */; };
1A8C329122533C7E0069B1CA /* QueryCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A8C328F22533C7E0069B1CA /* QueryCell.swift */; };
1A8C329222533C7E0069B1CA /* QueryCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1A8C329022533C7E0069B1CA /* QueryCell.xib */; };
Expand Down Expand Up @@ -180,6 +181,7 @@
1A7F811D211EEC0E004BA888 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = "<group>"; };
1A7F811F211EEC0E004BA888 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
1A7F8157211F0DF3004BA888 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
1A802CD42302B65A006DE213 /* Haptic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Haptic.swift; sourceTree = "<group>"; };
1A890183211F423B00429CA7 /* Fabric.Keys */ = {isa = PBXFileReference; lastKnownFileType = text; path = Fabric.Keys; sourceTree = "<group>"; };
1A890185211F570500429CA7 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
1A8C328F22533C7E0069B1CA /* QueryCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QueryCell.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -420,13 +422,14 @@
1AEAB52D1E5B3202002C20A6 /* Vazhegan.entitlements */,
1A890183211F423B00429CA7 /* Fabric.Keys */,
1A70CAE21E2A4C2F008D768B /* Info.plist */,
1A692A0422689A71001171B6 /* Texts.plist */,
1A70CAD31E2A4C2E008D768B /* AppDelegate.swift */,
1A70CADD1E2A4C2F008D768B /* Assets.xcassets */,
1AB7BEC4224E286700A67C13 /* Controllers */,
1A802CD62302C925006DE213 /* Other */,
1AEB41F81E2D652E00B379F3 /* Resources */,
1A582063225299DC00F98D52 /* Storyboards */,
1A58205B2252985200F98D52 /* Views */,
1A692A0422689A71001171B6 /* Texts.plist */,
);
path = Vazhegan;
sourceTree = "<group>";
Expand All @@ -443,6 +446,14 @@
path = VazheganActionExtension;
sourceTree = "<group>";
};
1A802CD62302C925006DE213 /* Other */ = {
isa = PBXGroup;
children = (
1A802CD42302B65A006DE213 /* Haptic.swift */,
);
path = Other;
sourceTree = "<group>";
};
1AB7BEC4224E286700A67C13 /* Controllers */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -833,6 +844,7 @@
1A5820362250E6AC00F98D52 /* SettingsController.swift in Sources */,
1A3E95D1226B12B40096D3B4 /* MyWordsController.swift in Sources */,
1AB7BEC3224E283100A67C13 /* HomeController.swift in Sources */,
1A802CD52302B65A006DE213 /* Haptic.swift in Sources */,
1A58203922516A9800F98D52 /* DatabaseCell.swift in Sources */,
1A58206522529A4100F98D52 /* VNavigationController.swift in Sources */,
1A8C329122533C7E0069B1CA /* QueryCell.swift in Sources */,
Expand Down
Binary file not shown.
1 change: 0 additions & 1 deletion Vazhegan/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ extension AppDelegate {

IDAlertAction.TitleTextFont = IDFont.Medium.withSize(19)
IDAlertAction.SubtitleTextFont = IDFont.Regular.withSize(14)

}

}
Expand Down
14 changes: 1 addition & 13 deletions Vazhegan/Controllers/SettingsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,6 @@ extension SettingsController {
})
}

let action_Instagram = IDAlertAction.InitializeNormalAction(title: "اینستاگرام خودم", alignment: .right, leftImage: #imageLiteral(resourceName: "App_Instagram")) {
UIApplication.ID_TryToOpen(url: URL(string: "instagram://user?username=golparvar")!, onFailed: {
UIApplication.ID_Open(url: URL(string: "https://www.instagram.com/golparvar/")!)
})
}

let action_Twitter = IDAlertAction.InitializeNormalAction(title: "توییتر خودم", alignment: .right, leftImage: #imageLiteral(resourceName: "App_Twitter")) {
UIApplication.ID_TryToOpen(url: URL(string: "twitter://user?screen_name=omidgolparvar")!, onFailed: {
UIApplication.ID_Open(url: URL(string: "https://twitter.com/omidgolparvar")!)
})
}

let action_Website = IDAlertAction.InitializeNormalAction(title: "وبسایت تیم‌مون", alignment: .right, leftImage: #imageLiteral(resourceName: "App_Safari")) {
UIApplication.ID_Open(url: URL(string: "https://www.idco.io/")!)
}
Expand All @@ -117,7 +105,7 @@ extension SettingsController {

let idAlertController = IDAlertController(
header : idAlertHeader,
actions : [action_Telegram, action_Instagram, action_Twitter, action_Website, action_Cancel],
actions : [action_Telegram, action_Website, action_Cancel],
preferredStyle : .actionSheet
)

Expand Down
4 changes: 2 additions & 2 deletions Vazhegan/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.2</string>
<string>2.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>418</string>
<string>427</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
Expand Down
45 changes: 45 additions & 0 deletions Vazhegan/Other/Haptic.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//

import Foundation
import UIKit

enum Haptic {

enum HapticFeedbackStyle: Int {
case light, medium, heavy

var value: UIImpactFeedbackGenerator.FeedbackStyle {
return UIImpactFeedbackGenerator.FeedbackStyle(rawValue: rawValue)!
}
}

enum HapticFeedbackType: Int {
case success, warning, error

var value: UINotificationFeedbackGenerator.FeedbackType {
return UINotificationFeedbackGenerator.FeedbackType(rawValue: rawValue)!
}
}


case impact(HapticFeedbackStyle)
case notification(HapticFeedbackType)
case selection

func generate() {
switch self {
case .impact(let style):
let generator = UIImpactFeedbackGenerator(style: style.value)
generator.prepare()
generator.impactOccurred()
case .notification(let type):
let generator = UINotificationFeedbackGenerator()
generator.prepare()
generator.notificationOccurred(type.value)
case .selection:
let generator = UISelectionFeedbackGenerator()
generator.prepare()
generator.selectionChanged()
}
}
}
45 changes: 16 additions & 29 deletions Vazhegan/Views/VazheganBackgroundView/VazheganBackgroundView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,19 @@ class VazheganBackgroundView: UIView {

var view: UIView!

@IBOutlet weak var button_Settings : UIButton!
@IBOutlet weak var button_About : UIButton!
@IBOutlet weak var button_MyWords : UIButton!
@IBOutlet weak var button_History : UIButton!
@IBOutlet weak var view_ButtonsHolder : UIView!

weak var viewController : UIViewController!

func xibSetup() {
private func xibSetup() {
view = loadViewFromNib()
view.frame = bounds
view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
addSubview(view)
setupUI()
}

func loadViewFromNib() -> UIView {
private func loadViewFromNib() -> UIView {
let bundle = Bundle(for: type(of: self))
let nib = UINib(nibName: "VazheganBackgroundView", bundle: bundle)
let view = nib.instantiate(withOwner: self, options: nil)[0] as! UIView
Expand All @@ -46,54 +43,44 @@ class VazheganBackgroundView: UIView {
}

private func setupUI() {
button_Settings.id_SetCornerRadius(16)
button_About.id_SetCornerRadius(16)
button_MyWords.id_SetCornerRadius(16)
button_History.id_SetCornerRadius(16)
view_ButtonsHolder.id_SetCornerRadius(16)
}

func setup(viewController: UIViewController) {
self.viewController = viewController
}

@IBAction func action_PresentSettingsController(_ sender: UIButton) {
let settingsController = SettingsController.IDViewControllerInstance
let navigationController = VNavigationController(rootViewController: settingsController)
private func presentViewController(_ destination: UIViewController) {
Haptic.impact(.medium).generate()
IDRouter.Present(
source : viewController,
destination : navigationController,
destination : destination,
type : .storky(delegate: viewController as! IDStorkyPresenterDelegate)
)
}

@IBAction func action_PresentSettingsController(_ sender: UIButton) {
let settingsController = SettingsController.IDViewControllerInstance
let navigationController = VNavigationController(rootViewController: settingsController)
presentViewController(navigationController)
}

@IBAction func action_PresentAboutController(_ sender: UIButton) {
let aboutController = AboutController.IDViewControllerInstance
IDRouter.Present(
source : viewController,
destination : aboutController,
type : .storky(delegate: viewController as! IDStorkyPresenterDelegate)
)
presentViewController(aboutController)
}

@IBAction func action_PresentMyWords(_ sender: UIButton) {
let myWordsController = MyWordsController.IDViewControllerInstance
let navigationController = VNavigationController(rootViewController: myWordsController)
IDRouter.Present(
source : viewController,
destination : navigationController,
type : .storky(delegate: viewController as! IDStorkyPresenterDelegate)
)
presentViewController(navigationController)
}

@IBAction func action_PresentHistory(_ sender: UIButton) {
let historyController = HistoryController.IDViewControllerInstance
historyController.searcherDelegate = (viewController as! HomeSearcherDelegate)
let navigationController = VNavigationController(rootViewController: historyController)
IDRouter.Present(
source : viewController,
destination : navigationController,
type : .storky(delegate: viewController as! IDStorkyPresenterDelegate)
)
presentViewController(navigationController)
}

}
Loading

0 comments on commit bef84fc

Please sign in to comment.