commit 5e5059592e19a88b8598ccd70b74a34b10940a27
parent 51ea22f8c4c5665bc85bdf8467381a84b7487a91
Author: Naomi Welner <naomi@Naomis-MacBook-Air.local>
Date: Wed, 13 Mar 2019 19:48:56 -0700
Adding existing files
Diffstat:
4 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/.DS_Store b/.DS_Store
Binary files differ.
diff --git a/Teachers' Assistant/AppDelegate.swift b/Teachers' Assistant/AppDelegate.swift
@@ -19,22 +19,27 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
+ UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { (granted, error) in}
+ UNUserNotificationCenter.current().delegate = self
- /* PERMISSION REQUESTS START */
+ /* FIRST TIME RUN CODE START */
+ let hasLaunchedKey = "HasLaunched"
+ let defaults = UserDefaults.standard
+ let hasLaunched = defaults.bool(forKey: hasLaunchedKey)
- //Notification permissions and welcome notification
- UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { (granted, error) in
- let welcomeNotification = UNMutableNotificationContent()
- welcomeNotification.title = "Welcome"
- welcomeNotification.body = "Enjoy the app!"
- welcomeNotification.sound = UNNotificationSound.default()
- let welcomeTrigger = UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false)
- let welcomePing = UNNotificationRequest(identifier: "welcomePing", content: welcomeNotification, trigger: welcomeTrigger)
- UNUserNotificationCenter.current().add(welcomePing, withCompletionHandler: nil)
- UNUserNotificationCenter.current().delegate = self
-
+ let welcomeNotification = UNMutableNotificationContent()
+ welcomeNotification.title = "Welcome"
+ welcomeNotification.body = "Enjoy the app!"
+ welcomeNotification.sound = UNNotificationSound.default()
+ let welcomeTrigger = UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false)
+ let welcomePing = UNNotificationRequest(identifier: "welcomePing", content: welcomeNotification, trigger: welcomeTrigger)
+ UNUserNotificationCenter.current().add(welcomePing, withCompletionHandler: nil)
+
+ if !hasLaunched {
+ defaults.set(true, forKey: hasLaunchedKey)
}
- /* PERMISSION REQUESTS END */
+
+ /* FIRST TIME RUN CODE END */
return true
}
diff --git a/Teachers' Assistant/Info.plist b/Teachers' Assistant/Info.plist
@@ -2,10 +2,16 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
+ <key>NSLocationAlwaysUsageDescription</key>
+ <string>Teachers' Assistant requires location services to enable app features and prevent abuse</string>
+ <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
+ <string>Teachers' Assistant requires location services to enable app features and prevent abuse</string>
+ <key>NSLocationWhenInUseUsageDescription</key>
+ <string>Teachers' Assistant requires location services to enable app features and prevent abuse</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
- <string>Teachers' Assistant</string>
+ <string>Teachers' Assistant</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
@@ -18,19 +24,6 @@
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
- <key>CFBundleURLTypes</key>
- <array>
- <dict>
- <key>CFBundleTypeRole</key>
- <string>Editor</string>
- <key>CFBundleURLName</key>
- <string></string>
- <key>CFBundleURLSchemes</key>
- <array>
- <string>com.googleusercontent.apps.277304690130-tp39je6dr5d3a6enhdhumh8upc17g68i</string>
- </array>
- </dict>
- </array>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
diff --git a/TeachersAssistant.xcworkspace/xcuserdata/naomi.xcuserdatad/UserInterfaceState.xcuserstate b/TeachersAssistant.xcworkspace/xcuserdata/naomi.xcuserdatad/UserInterfaceState.xcuserstate
Binary files differ.