Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request #56 from numutracker/develop
Browse files Browse the repository at this point in the history
v1.3.2
  • Loading branch information
amiantos committed Feb 24, 2019
2 parents 3c29e36 + a925b02 commit 9d2bb1c
Show file tree
Hide file tree
Showing 389 changed files with 49,804 additions and 203 deletions.
62 changes: 53 additions & 9 deletions .gitignore
@@ -1,10 +1,12 @@
*.DS_Store

Pods/

# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
.DS_Store
## Build generated
build/
DerivedData/

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
Expand All @@ -15,20 +17,62 @@ DerivedData/
!default.perspectivev3
xcuserdata/

## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint

## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno
# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
.build/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output

# Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/
6 changes: 5 additions & 1 deletion Numu Tracker.xcodeproj/project.pbxproj
Expand Up @@ -34,6 +34,7 @@
447FED45217BB68D0084530E /* SearchYouTubeTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 447FED43217BB68D0084530E /* SearchYouTubeTableViewCell.swift */; };
447FED46217BB68D0084530E /* SearchYouTubeTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 447FED44217BB68D0084530E /* SearchYouTubeTableViewCell.xib */; };
447FED48217BC17C0084530E /* NumuModalButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 447FED47217BC17C0084530E /* NumuModalButton.swift */; };
448C68EB21CB092B00ECEC61 /* AlertModal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 448C68EA21CB092B00ECEC61 /* AlertModal.swift */; };
449F5A7B2176B99900B9C919 /* MoreReleasesTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 449F5A792176B99900B9C919 /* MoreReleasesTableViewCell.swift */; };
449F5A7C2176B99900B9C919 /* MoreReleasesTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 449F5A7A2176B99900B9C919 /* MoreReleasesTableViewCell.xib */; };
44D3917021691D5000CFB9A3 /* NumuSortView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44D3916E21691D5000CFB9A3 /* NumuSortView.swift */; };
Expand Down Expand Up @@ -98,6 +99,7 @@
447FED43217BB68D0084530E /* SearchYouTubeTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchYouTubeTableViewCell.swift; sourceTree = "<group>"; };
447FED44217BB68D0084530E /* SearchYouTubeTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SearchYouTubeTableViewCell.xib; sourceTree = "<group>"; };
447FED47217BC17C0084530E /* NumuModalButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumuModalButton.swift; sourceTree = "<group>"; };
448C68EA21CB092B00ECEC61 /* AlertModal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertModal.swift; sourceTree = "<group>"; };
449F5A792176B99900B9C919 /* MoreReleasesTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreReleasesTableViewCell.swift; sourceTree = "<group>"; };
449F5A7A2176B99900B9C919 /* MoreReleasesTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MoreReleasesTableViewCell.xib; sourceTree = "<group>"; };
44D3916E21691D5000CFB9A3 /* NumuSortView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumuSortView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -232,6 +234,7 @@
4461CB7A2158470C001939F0 /* FetchJSONOperation.swift */,
446DBDE7215AF82400AE2AA7 /* ImportAppleMusicOperation.swift */,
4406A0022173A674002900E8 /* ImportSpotifyOperation.swift */,
448C68EA21CB092B00ECEC61 /* AlertModal.swift */,
);
path = Operations;
sourceTree = "<group>";
Expand Down Expand Up @@ -568,7 +571,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint >/dev/null; then\nswiftlint\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
shellScript = "\"${PODS_ROOT}/SwiftLint/swiftlint\"\n";
};
B48D5FE01F6CE6D70045961A /* Fabric */ = {
isa = PBXShellScriptBuildPhase;
Expand Down Expand Up @@ -624,6 +627,7 @@
B4F1E3AB2058C6C100F2544A /* NumuReviewHelper.swift in Sources */,
B46754581F6DA66F00C80544 /* InstructionsViewController.swift in Sources */,
4461CB7F21585488001939F0 /* NumuAPI.swift in Sources */,
448C68EB21CB092B00ECEC61 /* AlertModal.swift in Sources */,
B4B940AE1E6131B800F52027 /* NotificationsViewController.swift in Sources */,
447FED3E217B839F0084530E /* MusicServicesViewController.swift in Sources */,
B4283A851D8548F300467CE6 /* AppDelegate.swift in Sources */,
Expand Down
5 changes: 5 additions & 0 deletions Numu Tracker/AppDelegate.swift
Expand Up @@ -22,6 +22,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

// Production
let pusher = Pusher(key: "")
let oldPusher = Pusher(key: "")

// Development
//let pusher = Pusher(key: "")
Expand Down Expand Up @@ -64,7 +65,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
pusher.nativePusher.register(deviceToken: deviceToken)
oldPusher.nativePusher.register(deviceToken: deviceToken)
if let username = NumuCredential.shared.getUsername() {
oldPusher.nativePusher.unsubscribe(interestName: "newReleased_" + username)
oldPusher.nativePusher.unsubscribe(interestName: "newAnnouncements_" + username)
oldPusher.nativePusher.unsubscribe(interestName: "moreReleases_" + username)
if defaults.newReleased {
pusher.nativePusher.subscribe(interestName: "newReleased_" + username)
print("Turned on new notifications")
Expand Down
5 changes: 3 additions & 2 deletions Numu Tracker/Info.plist
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.3.1</string>
<string>1.3.2</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>858</string>
<string>948</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
Expand All @@ -52,6 +52,7 @@
<key>LSApplicationQueriesSchemes</key>
<array>
<string>spotify-action</string>
<string>twitter</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
Expand Down
46 changes: 46 additions & 0 deletions Numu Tracker/Operations/AlertModal.swift
@@ -0,0 +1,46 @@
//
// AlertModal.swift
// Numu Tracker
//
// Created by Brad Root on 12/19/18.
// Copyright © 2018 Numu Tracker. All rights reserved.
//

import UIKit

class AlertModal: AsyncOperation {
let title: String!
let button: String!
let message: String!

init(title: String, button: String, message: String) {
self.title = title
self.button = button
self.message = message
}

override func main() {
let alertView = NumuAlertView()
alertView.providesPresentationContextTransitionStyle = true
alertView.definesPresentationContext = true
alertView.modalPresentationStyle = UIModalPresentationStyle.overFullScreen
alertView.modalTransitionStyle = UIModalTransitionStyle.crossDissolve
alertView.modalPresentationCapturesStatusBarAppearance = true
DispatchQueue.main.async {
if let appDelegate = UIApplication.shared.delegate,
let appWindow = appDelegate.window!,
let rootViewController = appWindow.rootViewController {
rootViewController.present(alertView, animated: true, completion: nil)
alertView.titleText = self.title
alertView.buttonText = self.button
alertView.messageText = self.message
}
}
self.state = .isFinished
}

func present() {
self.qualityOfService = .userInitiated
OperationQueue.main.addOperation(self)
}
}
42 changes: 14 additions & 28 deletions Numu Tracker/Operations/ImportAppleMusicOperation.swift
Expand Up @@ -69,8 +69,8 @@ class ImportAppleMusicOperation: AsyncOperation {
if let success = returnedJSON["success"] as? Int {
self.artistsImported = success
NumuReviewHelper.incrementAndAskForReview()
self.displaySuccessMessage()
DispatchQueue.main.async(execute: {
self.displaySuccessMessage()
NotificationCenter.default.post(name: .UpdatedArtists, object: nil)
NotificationCenter.default.post(name: .LoggedIn, object: nil)
Answers.logCustomEvent(withName: "AM Artist Import")
Expand All @@ -94,19 +94,13 @@ class ImportAppleMusicOperation: AsyncOperation {
}

func displaySuccessMessage() {
DispatchQueue.main.async {
let alertView = NumuAlertView()
alertView.providesPresentationContextTransitionStyle = true
alertView.definesPresentationContext = true
alertView.modalPresentationStyle = UIModalPresentationStyle.overFullScreen
alertView.modalTransitionStyle = UIModalTransitionStyle.crossDissolve
alertView.modalPresentationCapturesStatusBarAppearance = true
if let appDelegate = UIApplication.shared.delegate,
let appWindow = appDelegate.window!,
let rootViewController = appWindow.rootViewController {
rootViewController.present(alertView, animated: true, completion: nil)
}
}
AlertModal(
title: "Success",
button: "Groovy",
message: "Your artists have been imported. "
+ "Please wait several minutes for all artists "
+ "to appear in your collection."
).present()
}

func displayAMError() {
Expand All @@ -121,20 +115,12 @@ class ImportAppleMusicOperation: AsyncOperation {
error = "Unknown error"
}
DispatchQueue.main.async {
let alertView = NumuAlertView()
alertView.providesPresentationContextTransitionStyle = true
alertView.definesPresentationContext = true
alertView.modalPresentationStyle = UIModalPresentationStyle.overFullScreen
alertView.modalTransitionStyle = UIModalTransitionStyle.crossDissolve
alertView.modalPresentationCapturesStatusBarAppearance = true
alertView.titleText = "Error"
alertView.messageText = error
alertView.buttonText = "Oh no"
if let appDelegate = UIApplication.shared.delegate,
let appWindow = appDelegate.window!,
let rootViewController = appWindow.rootViewController {
rootViewController.present(alertView, animated: true, completion: nil)
}
AlertModal(
title: "Error",
button: "Oh no",
message: error
).present()
}
self.state = .isFinished
}
}
37 changes: 12 additions & 25 deletions Numu Tracker/Operations/ImportSpotifyOperation.swift
Expand Up @@ -170,36 +170,23 @@ class ImportSpotifyOperation: AsyncOperation {

func displaySuccessMessage() {
DispatchQueue.main.async {
let alertView = NumuAlertView()
alertView.providesPresentationContextTransitionStyle = true
alertView.definesPresentationContext = true
alertView.modalPresentationStyle = UIModalPresentationStyle.overFullScreen
alertView.modalTransitionStyle = UIModalTransitionStyle.crossDissolve
alertView.modalPresentationCapturesStatusBarAppearance = true
if let appDelegate = UIApplication.shared.delegate,
let appWindow = appDelegate.window!,
let rootViewController = appWindow.rootViewController {
rootViewController.present(alertView, animated: true, completion: nil)
}
AlertModal(
title: "Success",
button: "Groovy",
message: "Your artists have been imported. "
+ "Please wait several minutes for all artists "
+ "to appear in your collection."
).present()
}
}

func displaySpotifyError(error: String) {
DispatchQueue.main.async {
let alertView = NumuAlertView()
alertView.providesPresentationContextTransitionStyle = true
alertView.definesPresentationContext = true
alertView.modalPresentationStyle = UIModalPresentationStyle.overFullScreen
alertView.modalTransitionStyle = UIModalTransitionStyle.crossDissolve
alertView.modalPresentationCapturesStatusBarAppearance = true
alertView.titleText = "Error"
alertView.messageText = error
alertView.buttonText = "Oh no"
if let appDelegate = UIApplication.shared.delegate,
let appWindow = appDelegate.window!,
let rootViewController = appWindow.rootViewController {
rootViewController.present(alertView, animated: true, completion: nil)
}
AlertModal(
title: "Error",
button: "Oh no",
message: error
).present()
self.state = .isFinished
}
}
Expand Down

0 comments on commit 9d2bb1c

Please sign in to comment.