Skip to content

Commit

Permalink
Migrated localization.
Browse files Browse the repository at this point in the history
  • Loading branch information
andersfischernielsen committed Aug 9, 2019
1 parent d41beaa commit 7f63682
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 18 deletions.
3 changes: 1 addition & 2 deletions Traktor Transition Finder.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,9 @@
};
buildConfigurationList = CD6B9487BAC72AB0154CB3BF /* Build configuration list for PBXProject "Traktor Transition Finder" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down
2 changes: 1 addition & 1 deletion Traktor Transition Finder/DragDropViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class DragDropViewController: NSViewController {
}

func selectSong(audioID: String) {
stateController?.incrementSelectedSongs()
stateController?.checkDonationStatus()
transitions = (graph?[audioID]?.1.map { edge in return edge })

if (transitions != nil) {
Expand Down
2 changes: 1 addition & 1 deletion Traktor Transition Finder/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundleShortVersionString</key>
<string>1.6.6</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>2</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.music</string>
<key>LSMinimumSystemVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion Traktor Transition Finder/SongToSongViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class SongToSongViewController: NSViewController {
}

func selectSong(audioID: String, index: Int) {
stateController?.incrementSelectedSongs()
stateController?.checkDonationStatus()
guard index < 2 else { return }
if let song = graph?[audioID]?.0 {
if index == 0 { firstSong = song }
Expand Down
14 changes: 5 additions & 9 deletions Traktor Transition Finder/StateController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class StateController {
}
}
var graph: [String: (Song, [Edge])]?
private var openedDialogLast = Date()
private var listeners: [StateSubscriber]

init() {
Expand All @@ -43,21 +44,15 @@ class StateController {
listeners.append(listener)
}

func incrementSelectedSongs() {
let before = UserDefaults.standard.integer(forKey: "selectedSongs")
UserDefaults.standard.set(before + 1, forKey: "selectedSongs")
checkDonationStatus()
}

private func checkDonationStatus() {
func checkDonationStatus() {
func openDonateURL() {
let url = URL(string: "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ME8E22EZTC5G4&source=url")
NSWorkspace.shared.open(url!)
}

let songCount = UserDefaults.standard.integer(forKey: "selectedSongs")
let donated = UserDefaults.standard.bool(forKey: "alreadyDonated")
if (songCount % 10 == 0 && !donated) {
let interval = DateInterval(start: self.openedDialogLast, end: Date())
if (!donated && interval.duration/60 > 5) {
let alert = NSAlert()
alert.messageText = "Please consider supporting the development of Traktor Transition Finder"
alert.informativeText = "Developing software takes time and ressources. \nPlease consider donating to support the development and improvement of Traktor Transition Finder."
Expand All @@ -79,6 +74,7 @@ class StateController {
else {
UserDefaults.standard.set(false, forKey: "alreadyDonated")
}
self.openedDialogLast = Date()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
</dict>
</plist>

0 comments on commit 7f63682

Please sign in to comment.