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.
8 changes: 8 additions & 0 deletions LocalNotificationBase.xcodeproj/project.pbxproj
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
956323AC22B2D049001505FB /* BronzeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 956323AB22B2D049001505FB /* BronzeViewController.swift */; };
956323AE22B2E0BC001505FB /* enviarNotificacao.swift in Sources */ = {isa = PBXBuildFile; fileRef = 956323AD22B2E0BC001505FB /* enviarNotificacao.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 +17,8 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
956323AB22B2D049001505FB /* BronzeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BronzeViewController.swift; sourceTree = "<group>"; };
956323AD22B2E0BC001505FB /* enviarNotificacao.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = enviarNotificacao.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 Down Expand Up @@ -54,12 +58,14 @@
AA6671C722B1292D00824252 /* LocalNotificationBase */ = {
isa = PBXGroup;
children = (
956323AB22B2D049001505FB /* BronzeViewController.swift */,
AA6671C822B1292D00824252 /* AppDelegate.swift */,
AA6671CA22B1292D00824252 /* BaseViewController.swift */,
AA6671CC22B1292D00824252 /* Main.storyboard */,
AA6671CF22B1293000824252 /* Assets.xcassets */,
AA6671D122B1293000824252 /* LaunchScreen.storyboard */,
AA6671D422B1293000824252 /* Info.plist */,
956323AD22B2E0BC001505FB /* enviarNotificacao.swift */,
);
path = LocalNotificationBase;
sourceTree = "<group>";
Expand Down Expand Up @@ -136,7 +142,9 @@
buildActionMask = 2147483647;
files = (
AA6671CB22B1292D00824252 /* BaseViewController.swift in Sources */,
956323AC22B2D049001505FB /* BronzeViewController.swift in Sources */,
AA6671C922B1292D00824252 /* AppDelegate.swift in Sources */,
956323AE22B2E0BC001505FB /* enviarNotificacao.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
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 @@ -40,6 +40,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
application.applicationIconBadgeNumber = 0
}

func applicationDidBecomeActive(_ 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.
121 changes: 120 additions & 1 deletion LocalNotificationBase/Base.lproj/Main.storyboard
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="9nJ-yD-Vd4">
<device id="retina6_1" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
Expand Down Expand Up @@ -31,9 +31,128 @@
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
<navigationItem key="navigationItem" id="066-cs-9TC">
<barButtonItem key="rightBarButtonItem" systemItem="compose" id="dSi-6m-fxW">
<connections>
<segue destination="Vas-Qx-6Sf" kind="show" id="NbQ-SV-Jnf"/>
</connections>
</barButtonItem>
</navigationItem>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1142.0289855072465" y="79.6875"/>
</scene>
<!--Bronze View Controller-->
<scene sceneID="bl0-rd-C4f">
<objects>
<viewController id="Vas-Qx-6Sf" customClass="BronzeViewController" customModule="LocalNotificationBase" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="AFp-dn-jVj">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="ckj-Cy-dgx">
<rect key="frame" x="42" y="139" width="337" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Título" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cWo-3F-FiE">
<rect key="frame" x="42" y="95" width="127" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="22"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Corpo do texto" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jnp-pF-Wo9">
<rect key="frame" x="42" y="177" width="141" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="22"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Tempo" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="l6b-4P-z1Q">
<rect key="frame" x="42" y="266" width="141" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="22"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<pickerView contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4jG-gR-ppg">
<rect key="frame" x="3" y="303" width="414" height="239"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
</pickerView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Som" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7ca-bJ-aJG">
<rect key="frame" x="42" y="550" width="141" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="22"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Badge" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="X8q-t0-1TD">
<rect key="frame" x="42" y="601" width="141" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="22"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5xP-vg-TFh">
<rect key="frame" x="284" y="562" width="49" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</switch>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="JF6-Ig-Akh">
<rect key="frame" x="284" y="628" width="49" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</switch>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="62u-C0-Bc2">
<rect key="frame" x="186" y="832" width="42" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Enviar"/>
<connections>
<action selector="enviar:" destination="Vas-Qx-6Sf" eventType="touchUpInside" id="lm9-HP-mGx"/>
</connections>
</button>
<textField opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Ww8-6r-sUI">
<rect key="frame" x="42" y="228" width="337" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<viewLayoutGuide key="safeArea" id="akE-B3-BE5"/>
</view>
<connections>
<outlet property="badge" destination="JF6-Ig-Akh" id="gTK-bx-kIn"/>
<outlet property="corpo" destination="Ww8-6r-sUI" id="Krc-cP-4Fs"/>
<outlet property="picker" destination="4jG-gR-ppg" id="VJ8-hH-YzD"/>
<outlet property="som" destination="5xP-vg-TFh" id="0gN-Cb-Ke1"/>
<outlet property="titulo" destination="ckj-Cy-dgx" id="bPG-dl-bQ2"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="LBl-Qz-ZKb" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1916" y="80"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="m8Y-U9-dvW">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="9nJ-yD-Vd4" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="3ph-Ih-3hz">
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="8Ks-Pg-Od1"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="XLB-X0-giY" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="231.8840579710145" y="79.6875"/>
</scene>
</scenes>
</document>
26 changes: 2 additions & 24 deletions LocalNotificationBase/BaseViewController.swift
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,8 @@ class BaseViewController: UIViewController {
}

@IBAction func remindButton(_ sender: Any) {
let notificationCenter = UNUserNotificationCenter.current()
notificationCenter.getNotificationSettings { (settings) in
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.sound = UNNotificationSound.default

let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false)

let request = UNNotificationRequest(identifier: "5seconds", 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")
}
}

enviarNotificacao(titulo: "Lembre-se 2", corpo: "Corpo", identificador: "1", intervalo: "5", badge: true, som: true)
}

}
Expand Down
60 changes: 60 additions & 0 deletions LocalNotificationBase/BronzeViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//
// TableViewController.swift
// LocalNotificationBase
//
// Created by Tamara Erlij on 13/06/19.
// Copyright © 2019 Bruno Omella Mainieri. All rights reserved.
//

import UIKit

class BronzeViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource {




@IBOutlet weak var titulo: UITextField!
@IBOutlet weak var corpo: UITextField!
@IBOutlet weak var picker: UIPickerView!
@IBOutlet weak var som: UISwitch!
@IBOutlet weak var badge: UISwitch!

let array = ["1","2","3","4","5","6","7","8","9","10"]
var pickerSelected = ""

@IBAction func enviar(_ sender: Any) {

let titulo = self.titulo.text as! String
let corpo = self.corpo.text as! String
let som = self.som.isOn
let badge = self.badge.isOn

enviarNotificacao(titulo: titulo, corpo: corpo, identificador: "1", intervalo: pickerSelected, badge: badge, som: som)
// print(titulo, corpo, som, badge, pickerSelected)
}
override func viewDidLoad() {

super.viewDidLoad()

picker.dataSource = self
picker.delegate = self
}


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

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

func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return array[row]
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
pickerSelected = array[row]
}


}
Empty file modified LocalNotificationBase/Info.plist
100644 → 100755
Empty file.
9 changes: 9 additions & 0 deletions LocalNotificationBase/PickerView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// PickerView.swift
// LocalNotificationBase
//
// Created by Tamara Erlij on 13/06/19.
// Copyright © 2019 Bruno Omella Mainieri. All rights reserved.
//

import Foundation
Loading