Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
Empty file modified LICENSE
100644 → 100755
Empty file.
18 changes: 15 additions & 3 deletions LocalNotificationBase.xcodeproj/project.pbxproj
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
2280B31D22B2C4680008A5DB /* BronzeTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2280B31C22B2C4680008A5DB /* BronzeTableViewController.swift */; };
AA6671C922B1292D00824252 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA6671C822B1292D00824252 /* AppDelegate.swift */; };
AA6671CB22B1292D00824252 /* BaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA6671CA22B1292D00824252 /* BaseViewController.swift */; };
AA6671CE22B1292D00824252 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AA6671CC22B1292D00824252 /* Main.storyboard */; };
Expand All @@ -15,6 +16,7 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
2280B31C22B2C4680008A5DB /* BronzeTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BronzeTableViewController.swift; sourceTree = "<group>"; };
AA6671C522B1292D00824252 /* LocalNotificationBase.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LocalNotificationBase.app; sourceTree = BUILT_PRODUCTS_DIR; };
AA6671C822B1292D00824252 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
AA6671CA22B1292D00824252 /* BaseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseViewController.swift; sourceTree = "<group>"; };
Expand All @@ -35,6 +37,15 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
2280B31E22B2C4700008A5DB /* Views */ = {
isa = PBXGroup;
children = (
AA6671CA22B1292D00824252 /* BaseViewController.swift */,
2280B31C22B2C4680008A5DB /* BronzeTableViewController.swift */,
);
path = Views;
sourceTree = "<group>";
};
AA6671BC22B1292D00824252 = {
isa = PBXGroup;
children = (
Expand All @@ -54,8 +65,8 @@
AA6671C722B1292D00824252 /* LocalNotificationBase */ = {
isa = PBXGroup;
children = (
2280B31E22B2C4700008A5DB /* Views */,
AA6671C822B1292D00824252 /* AppDelegate.swift */,
AA6671CA22B1292D00824252 /* BaseViewController.swift */,
AA6671CC22B1292D00824252 /* Main.storyboard */,
AA6671CF22B1293000824252 /* Assets.xcassets */,
AA6671D122B1293000824252 /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -136,6 +147,7 @@
buildActionMask = 2147483647;
files = (
AA6671CB22B1292D00824252 /* BaseViewController.swift in Sources */,
2280B31D22B2C4680008A5DB /* BronzeTableViewController.swift in Sources */,
AA6671C922B1292D00824252 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -283,7 +295,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = GT48V5L69E;
DEVELOPMENT_TEAM = 4LXC4A87QZ;
INFOPLIST_FILE = LocalNotificationBase/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -301,7 +313,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = GT48V5L69E;
DEVELOPMENT_TEAM = 4LXC4A87QZ;
INFOPLIST_FILE = LocalNotificationBase/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand Down
Empty file.
Empty file.
1 change: 1 addition & 0 deletions LocalNotificationBase/AppDelegate.swift
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
UIApplication.shared.applicationIconBadgeNumber = 0
}

func applicationWillTerminate(_ application: UIApplication) {
Expand Down
Empty file.
Empty file modified LocalNotificationBase/Assets.xcassets/Contents.json
100644 → 100755
Empty file.
Empty file modified LocalNotificationBase/Base.lproj/LaunchScreen.storyboard
100644 → 100755
Empty file.
159 changes: 157 additions & 2 deletions LocalNotificationBase/Base.lproj/Main.storyboard
100644 → 100755

Large diffs are not rendered by default.

Empty file modified LocalNotificationBase/Info.plist
100644 → 100755
Empty file.
File renamed without changes.
24 changes: 24 additions & 0 deletions LocalNotificationBase/Views/BronzeTableViewCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// BronzeTableViewCell.swift
// LocalNotificationBase
//
// Created by Victor Falcetta do Nascimento on 13/06/19.
// Copyright © 2019 Bruno Omella Mainieri. All rights reserved.
//

import UIKit

class BronzeTableViewCell: UITableViewCell {

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
}

}
106 changes: 106 additions & 0 deletions LocalNotificationBase/Views/BronzeTableViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
//
// BronzeTableViewController.swift
// LocalNotificationBase
//
// Created by Victor Falcetta do Nascimento on 13/06/19.
// Copyright © 2019 Bruno Omella Mainieri. All rights reserved.
//

import UIKit
import UserNotifications

class BronzeTableViewController: UITableViewController, UIPickerViewDelegate, UIPickerViewDataSource {


@IBOutlet weak var fieldTitulo: UITextField!
@IBOutlet weak var fieldCorpo: UITextField!
@IBOutlet weak var pickerTempoSeg: UIPickerView!
@IBOutlet weak var switchSom: UISwitch!
@IBOutlet weak var switchBadge: UISwitch!

var pickerDadosSeg: [String] = [String]()


override func viewDidLoad() {
super.viewDidLoad()

self.pickerTempoSeg.delegate = self
self.pickerTempoSeg.dataSource = self

pickerDadosSeg = ["0","1","2","3","4","5","6","7","8","9"]


}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}

func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}

func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return pickerDadosSeg.count
}

func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return pickerDadosSeg[row]
}



@IBAction func botaoEnviar(_ sender: Any) {
let contentudo = UNMutableNotificationContent()

if let tituloFieldText = self.fieldTitulo.text{
contentudo.title = NSString.localizedUserNotificationString(forKey: tituloFieldText, arguments: nil)
}

if let corpoFieldText = self.fieldCorpo.text{
contentudo.title = NSString.localizedUserNotificationString(forKey: corpoFieldText, arguments: nil)
}



if self.switchSom.isOn {
contentudo.sound = UNNotificationSound.default
}

let triggerino = UNTimeIntervalNotificationTrigger(timeInterval: TimeInterval(pickerTempoSeg.selectedRow(inComponent: 0)) , repeats: false)

let request = UNNotificationRequest(identifier: "BronzeOmella", content: contentudo, trigger: triggerino)

if self.switchBadge.isOn{
contentudo.badge = 1
}

let bronzeNotificationCenter = UNUserNotificationCenter.current()
bronzeNotificationCenter.getNotificationSettings{ (settings) in
if settings.authorizationStatus == .authorized{
let center = UNUserNotificationCenter.current()
center.add(request) { (error : Error?) in
if let error = error {
print(error.localizedDescription)
}
}
}else{
print("Impossível mandar notificação - permissão negada")
}
}
}
}


// MARK: - Table view data source

// override func numberOfSections(in tableView: UITableView) -> Int {
// // #warning Incomplete implementation, return the number of sections
// return 0
// }
//
// override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// // #warning Incomplete implementation, return the number of rows
// return 0
// }

Empty file modified README.md
100644 → 100755
Empty file.