-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d668d17
Showing
117 changed files
with
5,886 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
5.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
148 changes: 148 additions & 0 deletions
148
Shared/Assets.xcassets/AppIcon.appiconset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "3x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "3x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "40x40" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "3x", | ||
"size" : "40x40" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "60x60" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "3x", | ||
"size" : "60x60" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "1x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "1x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "1x", | ||
"size" : "40x40" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "40x40" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "1x", | ||
"size" : "76x76" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "76x76" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "83.5x83.5" | ||
}, | ||
{ | ||
"idiom" : "ios-marketing", | ||
"scale" : "1x", | ||
"size" : "1024x1024" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "16x16" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "16x16" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "32x32" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "32x32" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "128x128" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "128x128" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "256x256" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "256x256" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "1x", | ||
"size" : "512x512" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"scale" : "2x", | ||
"size" : "512x512" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import CoreData | ||
import CoreSpotlight | ||
import Foundation | ||
// import MobileCoreServices | ||
import WallabagKit | ||
|
||
class Entry: NSManagedObject, Identifiable {} | ||
|
||
extension Entry { | ||
@nonobjc class func fetchRequestSorted() -> NSFetchRequest<Entry> { | ||
let fetchRequest = NSFetchRequest<Entry>(entityName: "Entry") | ||
let sortDescriptor = NSSortDescriptor(key: "id", ascending: false) | ||
fetchRequest.sortDescriptors = [sortDescriptor] | ||
return fetchRequest | ||
} | ||
|
||
@nonobjc class func fetchOneById(_ id: Int) -> NSFetchRequest<Entry> { | ||
let fetchRequest = NSFetchRequest<Entry>(entityName: "Entry") | ||
fetchRequest.predicate = NSPredicate(format: "id == %ld", id) | ||
return fetchRequest | ||
} | ||
|
||
@NSManaged dynamic var content: String? | ||
@NSManaged dynamic var createdAt: Date? | ||
@NSManaged dynamic var domainName: String? | ||
@NSManaged dynamic var id: Int | ||
@NSManaged dynamic var isArchived: Bool | ||
@NSManaged dynamic var isStarred: Bool | ||
@NSManaged dynamic var previewPicture: String? | ||
@NSManaged dynamic var title: String? | ||
@NSManaged dynamic var updatedAt: Date? | ||
@NSManaged dynamic var url: String? | ||
@NSManaged dynamic var readingTime: Int | ||
@NSManaged dynamic var screenPosition: Float | ||
@NSManaged var tags: Set<Tag> | ||
} | ||
|
||
extension Entry { | ||
var spotlightIdentifier: String { | ||
"\(Bundle.main.bundleIdentifier!).spotlight.\(Int(id))" | ||
} | ||
|
||
var searchableItemAttributeSet: CSSearchableItemAttributeSet { | ||
let searchableItemAttributeSet = CSSearchableItemAttributeSet(itemContentType: kUTTypeText as String) | ||
searchableItemAttributeSet.title = title | ||
searchableItemAttributeSet.contentDescription = content?.withoutHTML | ||
|
||
return searchableItemAttributeSet | ||
} | ||
|
||
func hydrate(from article: WallabagEntry) { | ||
id = article.id | ||
title = article.title | ||
content = article.content | ||
createdAt = Date.fromISOString(article.createdAt) | ||
updatedAt = Date.fromISOString(article.updatedAt) | ||
domainName = article.domainName | ||
isArchived = article.isArchived.bool | ||
isStarred = article.isStarred.bool | ||
previewPicture = article.previewPicture | ||
url = article.url | ||
readingTime = article.readingTime ?? 0 | ||
} | ||
|
||
func toggleArchive() { | ||
isArchived.toggle() | ||
objectWillChange.send() | ||
} | ||
|
||
func toggleStarred() { | ||
isStarred.toggle() | ||
objectWillChange.send() | ||
} | ||
|
||
var screenPositionForWebView: Double { | ||
if screenPosition < 0 { | ||
return 0.0 | ||
} | ||
return Double(screenPosition) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import Foundation | ||
|
||
struct Podcast { | ||
let id: Int | ||
let title: String | ||
let content: String | ||
let picture: String? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import CoreData | ||
import Foundation | ||
|
||
class Tag: NSManagedObject, Identifiable { | ||
@Published var isChecked: Bool = false | ||
} | ||
|
||
extension Tag { | ||
@nonobjc class func fetchRequestSorted() -> NSFetchRequest<Tag> { | ||
let fetchRequest = NSFetchRequest<Tag>(entityName: "Tag") | ||
let sortDescriptor = NSSortDescriptor(key: "label", ascending: true) | ||
fetchRequest.sortDescriptors = [sortDescriptor] | ||
return fetchRequest | ||
} | ||
|
||
@nonobjc class func fetchOneById(_ id: Int) -> NSFetchRequest<Tag> { | ||
let fetchRequest = NSFetchRequest<Tag>(entityName: "Tag") | ||
fetchRequest.predicate = NSPredicate(format: "id == %ld", id) | ||
return fetchRequest | ||
} | ||
|
||
@NSManaged dynamic var id: Int | ||
@NSManaged dynamic var label: String | ||
@NSManaged dynamic var slug: String | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Foundation | ||
|
||
extension Bool { | ||
var int: Int { | ||
self ? 1 : 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Foundation | ||
|
||
extension Date { | ||
static func fromISOString(_ string: String) -> Date? { | ||
let dateFormatter = DateFormatter() | ||
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssX" | ||
return dateFormatter.date(from: string) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Foundation | ||
|
||
extension Dictionary { | ||
func merge(dict: [Key: Value]) -> [Key: Value] { | ||
var mutableCopy = self | ||
for (key, value) in dict { | ||
// If both dictionaries have a value for same key, the value of the other dictionary is used. | ||
mutableCopy[key] = value | ||
} | ||
return mutableCopy | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Foundation | ||
// import UIKit | ||
|
||
extension Int { | ||
var readingTime: String { | ||
let date = Date(timeIntervalSince1970: TimeInterval(self * 60)) | ||
let dayTimePeriodFormatter = DateFormatter() | ||
dayTimePeriodFormatter.timeZone = TimeZone(secondsFromGMT: 0) | ||
dayTimePeriodFormatter.dateFormat = "HH:mm:ss" | ||
|
||
return dayTimePeriodFormatter.string(from: date as Date) | ||
} | ||
|
||
var rgb: CGFloat { | ||
CGFloat(self) / 255.0 | ||
} | ||
|
||
var bool: Bool { | ||
self == 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Foundation | ||
import StoreKit | ||
|
||
extension SKProduct { | ||
var title: String { | ||
let formatter = NumberFormatter() | ||
formatter.numberStyle = .currency | ||
formatter.locale = priceLocale | ||
|
||
return "\(localizedTitle) \(formatter.string(from: price)!)" | ||
} | ||
} |
Oops, something went wrong.