diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..cf03e92 Binary files /dev/null and b/.DS_Store differ diff --git a/LocalNotificationBase.xcodeproj/project.pbxproj b/LocalNotificationBase.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index dd7afac..0ff538e --- a/LocalNotificationBase.xcodeproj/project.pbxproj +++ b/LocalNotificationBase.xcodeproj/project.pbxproj @@ -12,6 +12,9 @@ AA6671CE22B1292D00824252 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AA6671CC22B1292D00824252 /* Main.storyboard */; }; AA6671D022B1293000824252 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AA6671CF22B1293000824252 /* Assets.xcassets */; }; AA6671D322B1293000824252 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AA6671D122B1293000824252 /* LaunchScreen.storyboard */; }; + CB27C7E322B2C79300D97C55 /* BronzeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB27C7E222B2C79300D97C55 /* BronzeVC.swift */; }; + CB27C7E522B2C7A400D97C55 /* PrataVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB27C7E422B2C7A400D97C55 /* PrataVC.swift */; }; + CB27C7E722B2C7B000D97C55 /* OuroVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB27C7E622B2C7B000D97C55 /* OuroVC.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -22,6 +25,9 @@ AA6671CF22B1293000824252 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; AA6671D222B1293000824252 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; AA6671D422B1293000824252 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + CB27C7E222B2C79300D97C55 /* BronzeVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BronzeVC.swift; sourceTree = ""; }; + CB27C7E422B2C7A400D97C55 /* PrataVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrataVC.swift; sourceTree = ""; }; + CB27C7E622B2C7B000D97C55 /* OuroVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OuroVC.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -54,8 +60,8 @@ AA6671C722B1292D00824252 /* LocalNotificationBase */ = { isa = PBXGroup; children = ( + CB27C7E822B2C7BB00D97C55 /* VC */, AA6671C822B1292D00824252 /* AppDelegate.swift */, - AA6671CA22B1292D00824252 /* BaseViewController.swift */, AA6671CC22B1292D00824252 /* Main.storyboard */, AA6671CF22B1293000824252 /* Assets.xcassets */, AA6671D122B1293000824252 /* LaunchScreen.storyboard */, @@ -64,6 +70,17 @@ path = LocalNotificationBase; sourceTree = ""; }; + CB27C7E822B2C7BB00D97C55 /* VC */ = { + isa = PBXGroup; + children = ( + CB27C7E222B2C79300D97C55 /* BronzeVC.swift */, + CB27C7E622B2C7B000D97C55 /* OuroVC.swift */, + CB27C7E422B2C7A400D97C55 /* PrataVC.swift */, + AA6671CA22B1292D00824252 /* BaseViewController.swift */, + ); + path = VC; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -135,8 +152,11 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + CB27C7E322B2C79300D97C55 /* BronzeVC.swift in Sources */, + CB27C7E522B2C7A400D97C55 /* PrataVC.swift in Sources */, AA6671CB22B1292D00824252 /* BaseViewController.swift in Sources */, AA6671C922B1292D00824252 /* AppDelegate.swift in Sources */, + CB27C7E722B2C7B000D97C55 /* OuroVC.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -283,7 +303,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = GT48V5L69E; + DEVELOPMENT_TEAM = W76FRTKWHT; INFOPLIST_FILE = LocalNotificationBase/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -301,7 +321,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = GT48V5L69E; + DEVELOPMENT_TEAM = W76FRTKWHT; INFOPLIST_FILE = LocalNotificationBase/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", diff --git a/LocalNotificationBase.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/LocalNotificationBase.xcodeproj/project.xcworkspace/contents.xcworkspacedata old mode 100644 new mode 100755 diff --git a/LocalNotificationBase.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/LocalNotificationBase.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist old mode 100644 new mode 100755 diff --git a/LocalNotificationBase/.DS_Store b/LocalNotificationBase/.DS_Store new file mode 100644 index 0000000..86c9f71 Binary files /dev/null and b/LocalNotificationBase/.DS_Store differ diff --git a/LocalNotificationBase/AppDelegate.swift b/LocalNotificationBase/AppDelegate.swift old mode 100644 new mode 100755 diff --git a/LocalNotificationBase/Assets.xcassets/AppIcon.appiconset/Contents.json b/LocalNotificationBase/Assets.xcassets/AppIcon.appiconset/Contents.json old mode 100644 new mode 100755 diff --git a/LocalNotificationBase/Assets.xcassets/Contents.json b/LocalNotificationBase/Assets.xcassets/Contents.json old mode 100644 new mode 100755 diff --git a/LocalNotificationBase/Base.lproj/LaunchScreen.storyboard b/LocalNotificationBase/Base.lproj/LaunchScreen.storyboard old mode 100644 new mode 100755 diff --git a/LocalNotificationBase/Base.lproj/Main.storyboard b/LocalNotificationBase/Base.lproj/Main.storyboard old mode 100644 new mode 100755 index 0d2afb5..1e403bd --- a/LocalNotificationBase/Base.lproj/Main.storyboard +++ b/LocalNotificationBase/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -10,7 +10,143 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -31,9 +167,11 @@ + + diff --git a/LocalNotificationBase/Info.plist b/LocalNotificationBase/Info.plist old mode 100644 new mode 100755 diff --git a/LocalNotificationBase/BaseViewController.swift b/LocalNotificationBase/VC/BaseViewController.swift old mode 100644 new mode 100755 similarity index 91% rename from LocalNotificationBase/BaseViewController.swift rename to LocalNotificationBase/VC/BaseViewController.swift index b3615fb..63eb94a --- a/LocalNotificationBase/BaseViewController.swift +++ b/LocalNotificationBase/VC/BaseViewController.swift @@ -22,11 +22,11 @@ class BaseViewController: UIViewController { if settings.authorizationStatus == .authorized { let content = UNMutableNotificationContent() - content.title = NSString.localizedUserNotificationString(forKey: "Lembre-se", arguments: nil) - content.body = NSString.localizedUserNotificationString(forKey: "Você se lembrou", arguments: nil) + content.title = NSString.localizedUserNotificationString(forKey: "Lembrar", arguments: nil) + content.body = NSString.localizedUserNotificationString(forKey: "O app te lembrou de se lembrar", arguments: nil) content.sound = UNNotificationSound.default - let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false) + let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 10, repeats: false) let request = UNNotificationRequest(identifier: "5seconds", content: content, trigger: trigger) diff --git a/LocalNotificationBase/VC/BronzeVC.swift b/LocalNotificationBase/VC/BronzeVC.swift new file mode 100644 index 0000000..8c8826a --- /dev/null +++ b/LocalNotificationBase/VC/BronzeVC.swift @@ -0,0 +1,65 @@ +// +// BronzeVC.swift +// LocalNotificationBase +// +// Created by Cassia Aparecida Barbosa on 13/06/19. +// Copyright © 2019 Bruno Omella Mainieri. All rights reserved. +// + +import UIKit +import UserNotifications + +class Bronze: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view. +} + + @IBOutlet weak var titulo: UITextField! + + @IBOutlet weak var corpo: UITextField! + + @IBOutlet weak var tempo: UITextField! + + + @IBOutlet weak var somSwitch: UISwitch! + + + @IBOutlet weak var notificacaoSwitch: UISwitch! + + + + @IBAction func criarNotificacao(_ sender: Any) { + let notificationCenter = UNUserNotificationCenter.current() + guard let tempoUsado = self.tempo?.text as? String else{return} + guard let tituloUsado = self.titulo?.text as? String else{return} + guard let corpoUsado = self.corpo?.text as? String else{return} + notificationCenter.getNotificationSettings { (settings) in + + + if settings.authorizationStatus == .authorized { + if self.somSwitch.isOn { + + let content = UNMutableNotificationContent() + content.title = NSString.localizedUserNotificationString(forKey: tituloUsado, arguments: nil) + content.body = NSString.localizedUserNotificationString(forKey: corpoUsado, arguments: nil) + content.sound = nil + + let trigger = UNTimeIntervalNotificationTrigger(timeInterval: Double(tempoUsado) as! TimeInterval, repeats: false) + + let request = UNNotificationRequest(identifier: "tempoSetado", content: content, trigger: trigger) + + 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") + } + } } + + } + +} diff --git a/LocalNotificationBase/VC/OuroVC.swift b/LocalNotificationBase/VC/OuroVC.swift new file mode 100644 index 0000000..be556a9 --- /dev/null +++ b/LocalNotificationBase/VC/OuroVC.swift @@ -0,0 +1,18 @@ +// +// OuroVC.swift +// LocalNotificationBase +// +// Created by Cassia Aparecida Barbosa on 13/06/19. +// Copyright © 2019 Bruno Omella Mainieri. All rights reserved. +// + +import UIKit +import UserNotifications + +class Ouro: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view. +} +} diff --git a/LocalNotificationBase/VC/PrataVC.swift b/LocalNotificationBase/VC/PrataVC.swift new file mode 100644 index 0000000..1404276 --- /dev/null +++ b/LocalNotificationBase/VC/PrataVC.swift @@ -0,0 +1,18 @@ +// +// PrataVC.swift +// LocalNotificationBase +// +// Created by Cassia Aparecida Barbosa on 13/06/19. +// Copyright © 2019 Bruno Omella Mainieri. All rights reserved. +// + +import UIKit +import UserNotifications + +class Prata: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view. +} +}