Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit f490f93

Browse files
committed
Fixed downloading some Reddit videos, Update build number for production
1 parent a122c20 commit f490f93

File tree

4 files changed

+122
-19
lines changed

4 files changed

+122
-19
lines changed

Slide for Reddit.xcodeproj/project.pbxproj

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2270,12 +2270,12 @@
22702270
CODE_SIGN_IDENTITY = "iPhone Developer";
22712271
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
22722272
CODE_SIGN_STYLE = Automatic;
2273-
CURRENT_PROJECT_VERSION = 142;
2273+
CURRENT_PROJECT_VERSION = 143;
22742274
DEVELOPMENT_TEAM = FTT89576VQ;
22752275
GCC_C_LANGUAGE_STANDARD = gnu11;
22762276
IBSC_MODULE = Slide_for_Apple_Watch_Extension;
22772277
INFOPLIST_FILE = "Slide for Apple Watch/Info.plist";
2278-
MARKETING_VERSION = 5.3;
2278+
MARKETING_VERSION = 5.3.1;
22792279
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
22802280
MTL_FAST_MATH = YES;
22812281
PRODUCT_BUNDLE_IDENTIFIER = "$(USR_BASE_IDENTIFIER).watchkitapp";
@@ -2302,12 +2302,12 @@
23022302
CODE_SIGN_IDENTITY = "iPhone Developer";
23032303
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
23042304
CODE_SIGN_STYLE = Automatic;
2305-
CURRENT_PROJECT_VERSION = 142;
2305+
CURRENT_PROJECT_VERSION = 143;
23062306
DEVELOPMENT_TEAM = FTT89576VQ;
23072307
GCC_C_LANGUAGE_STANDARD = gnu11;
23082308
IBSC_MODULE = Slide_for_Apple_Watch_Extension;
23092309
INFOPLIST_FILE = "Slide for Apple Watch/Info.plist";
2310-
MARKETING_VERSION = 5.3;
2310+
MARKETING_VERSION = 5.3.1;
23112311
MTL_FAST_MATH = YES;
23122312
PRODUCT_BUNDLE_IDENTIFIER = "$(USR_BASE_IDENTIFIER).watchkitapp";
23132313
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -2329,12 +2329,12 @@
23292329
CLANG_ENABLE_OBJC_WEAK = YES;
23302330
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
23312331
CODE_SIGN_STYLE = Automatic;
2332-
CURRENT_PROJECT_VERSION = 142;
2332+
CURRENT_PROJECT_VERSION = 143;
23332333
DEVELOPMENT_TEAM = FTT89576VQ;
23342334
GCC_C_LANGUAGE_STANDARD = gnu11;
23352335
INFOPLIST_FILE = "Slide for Apple Watch Extension/Info.plist";
23362336
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
2337-
MARKETING_VERSION = 5.3;
2337+
MARKETING_VERSION = 5.3.1;
23382338
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
23392339
MTL_FAST_MATH = YES;
23402340
PRODUCT_BUNDLE_IDENTIFIER = "$(USR_BASE_IDENTIFIER).watchkitapp.watchkitextension";
@@ -2356,12 +2356,12 @@
23562356
CLANG_ENABLE_OBJC_WEAK = YES;
23572357
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
23582358
CODE_SIGN_STYLE = Automatic;
2359-
CURRENT_PROJECT_VERSION = 142;
2359+
CURRENT_PROJECT_VERSION = 143;
23602360
DEVELOPMENT_TEAM = FTT89576VQ;
23612361
GCC_C_LANGUAGE_STANDARD = gnu11;
23622362
INFOPLIST_FILE = "Slide for Apple Watch Extension/Info.plist";
23632363
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
2364-
MARKETING_VERSION = 5.3;
2364+
MARKETING_VERSION = 5.3.1;
23652365
MTL_FAST_MATH = YES;
23662366
PRODUCT_BUNDLE_IDENTIFIER = "$(USR_BASE_IDENTIFIER).watchkitapp.watchkitextension";
23672367
PRODUCT_NAME = "${TARGET_NAME}";
@@ -2384,13 +2384,13 @@
23842384
CODE_SIGN_IDENTITY = "iPhone Developer";
23852385
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
23862386
CODE_SIGN_STYLE = Automatic;
2387-
CURRENT_PROJECT_VERSION = 142;
2387+
CURRENT_PROJECT_VERSION = 143;
23882388
DEVELOPMENT_TEAM = FTT89576VQ;
23892389
GCC_C_LANGUAGE_STANDARD = gnu11;
23902390
INFOPLIST_FILE = "Open in Slide/Info.plist";
23912391
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
23922392
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
2393-
MARKETING_VERSION = 5.3;
2393+
MARKETING_VERSION = 5.3.1;
23942394
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
23952395
MTL_FAST_MATH = YES;
23962396
PRODUCT_BUNDLE_IDENTIFIER = "$(USR_BASE_IDENTIFIER).Open-in-Slide";
@@ -2412,13 +2412,13 @@
24122412
CODE_SIGN_IDENTITY = "iPhone Developer";
24132413
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
24142414
CODE_SIGN_STYLE = Automatic;
2415-
CURRENT_PROJECT_VERSION = 142;
2415+
CURRENT_PROJECT_VERSION = 143;
24162416
DEVELOPMENT_TEAM = FTT89576VQ;
24172417
GCC_C_LANGUAGE_STANDARD = gnu11;
24182418
INFOPLIST_FILE = "Open in Slide/Info.plist";
24192419
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
24202420
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
2421-
MARKETING_VERSION = 5.3;
2421+
MARKETING_VERSION = 5.3.1;
24222422
MTL_FAST_MATH = YES;
24232423
PRODUCT_BUNDLE_IDENTIFIER = "$(USR_BASE_IDENTIFIER).Open-in-Slide";
24242424
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -2558,13 +2558,13 @@
25582558
CODE_SIGN_IDENTITY = "iPhone Developer";
25592559
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
25602560
CODE_SIGN_STYLE = Automatic;
2561-
CURRENT_PROJECT_VERSION = 142;
2561+
CURRENT_PROJECT_VERSION = 143;
25622562
DEVELOPMENT_TEAM = FTT89576VQ;
25632563
GCC_WARN_UNUSED_PARAMETER = YES;
25642564
INFOPLIST_FILE = "Slide for Reddit/Info.plist";
25652565
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
25662566
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
2567-
MARKETING_VERSION = 5.3;
2567+
MARKETING_VERSION = 5.3.1;
25682568
OTHER_LDFLAGS = (
25692569
"$(inherited)",
25702570
"-framework",
@@ -2594,14 +2594,14 @@
25942594
CODE_SIGN_IDENTITY = "iPhone Developer";
25952595
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
25962596
CODE_SIGN_STYLE = Automatic;
2597-
CURRENT_PROJECT_VERSION = 142;
2597+
CURRENT_PROJECT_VERSION = 143;
25982598
DEVELOPMENT_TEAM = FTT89576VQ;
25992599
GCC_OPTIMIZATION_LEVEL = fast;
26002600
GCC_WARN_UNUSED_PARAMETER = YES;
26012601
INFOPLIST_FILE = "Slide for Reddit/Info.plist";
26022602
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
26032603
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
2604-
MARKETING_VERSION = 5.3;
2604+
MARKETING_VERSION = 5.3.1;
26052605
OTHER_LDFLAGS = (
26062606
"$(inherited)",
26072607
"-framework",

Slide for Reddit/CommentViewController.swift

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,8 +1596,10 @@ class CommentViewController: MediaViewController, UITableViewDelegate, UITableVi
15961596

15971597
@objc func search(_ sender: AnyObject) {
15981598
if !dataArray.isEmpty {
1599+
expandAll()
15991600
showSearchBar()
16001601
}
1602+
// Todo future loadAllMore()
16011603
}
16021604

16031605
public func extendKeepMore(in comment: Thing, current depth: Int) -> ([(Thing, Int)]) {
@@ -2644,6 +2646,101 @@ class CommentViewController: MediaViewController, UITableViewDelegate, UITableVi
26442646
let children = walkTreeFully(n: n)
26452647
return children.count - 1
26462648
}
2649+
2650+
func loadAllMore() {
2651+
expandAll()
2652+
2653+
loadMoreWithCallback(0)
2654+
}
2655+
2656+
func loadMoreWithCallback(_ datasetPosition: Int) {
2657+
if datasetPosition > dataArray.count {
2658+
return
2659+
}
2660+
if let more = content[dataArray[datasetPosition]] as? RMore, let link = self.submission {
2661+
if more.children.isEmpty {
2662+
loadMoreWithCallback(datasetPosition + 1)
2663+
} else {
2664+
do {
2665+
var strings: [String] = []
2666+
for c in more.children {
2667+
strings.append(c.value)
2668+
}
2669+
try session?.getMoreChildren(strings, name: link.id, sort: .top, id: more.id, completion: { (result) -> Void in
2670+
switch result {
2671+
case .failure(let error):
2672+
print(error)
2673+
case .success(let list):
2674+
DispatchQueue.main.async(execute: { () -> Void in
2675+
let startDepth = self.cDepth[more.getIdentifier()] ?? 0
2676+
2677+
var queue: [Object] = []
2678+
for i in self.extendForMore(parentId: more.parentId, comments: list, current: startDepth) {
2679+
let item = i.0 is Comment ? RealmDataWrapper.commentToRComment(comment: i.0 as! Comment, depth: i.1) : RealmDataWrapper.moreToRMore(more: i.0 as! More)
2680+
queue.append(item)
2681+
self.cDepth[item.getIdentifier()] = i.1
2682+
self.updateStrings([i])
2683+
}
2684+
2685+
var realPosition = 0
2686+
for comment in self.comments {
2687+
if comment == more.getIdentifier() {
2688+
break
2689+
}
2690+
realPosition += 1
2691+
}
2692+
2693+
if self.comments.count > realPosition && self.comments[realPosition] != nil {
2694+
self.comments.remove(at: realPosition)
2695+
} else {
2696+
return
2697+
}
2698+
self.dataArray.remove(at: datasetPosition)
2699+
2700+
let currentParent = self.parents[more.getIdentifier()]
2701+
2702+
var ids: [String] = []
2703+
for item in queue {
2704+
let id = item.getIdentifier()
2705+
self.parents[id] = currentParent
2706+
ids.append(id)
2707+
self.content[id] = item
2708+
}
2709+
2710+
if queue.count != 0 {
2711+
self.tableView.beginUpdates()
2712+
self.tableView.deleteRows(at: [IndexPath.init(row: datasetPosition, section: 0)], with: .fade)
2713+
self.dataArray.insert(contentsOf: ids, at: datasetPosition)
2714+
self.comments.insert(contentsOf: ids, at: realPosition)
2715+
self.doArrays()
2716+
var paths: [IndexPath] = []
2717+
for i in stride(from: datasetPosition, to: datasetPosition + queue.count, by: 1) {
2718+
paths.append(IndexPath.init(row: i, section: 0))
2719+
}
2720+
self.tableView.insertRows(at: paths, with: .left)
2721+
self.tableView.endUpdates()
2722+
self.loadMoreWithCallback(datasetPosition + 1)
2723+
2724+
} else {
2725+
self.doArrays()
2726+
self.tableView.reloadData()
2727+
self.loadMoreWithCallback(datasetPosition + 1)
2728+
}
2729+
})
2730+
2731+
}
2732+
2733+
})
2734+
2735+
} catch {
2736+
loadMoreWithCallback(datasetPosition + 1)
2737+
print(error)
2738+
}
2739+
}
2740+
} else {
2741+
loadMoreWithCallback(datasetPosition + 1)
2742+
}
2743+
}
26472744

26482745
func highlight(_ cc: NSAttributedString) -> NSAttributedString {
26492746
let base = NSMutableAttributedString.init(attributedString: cc)

Slide for Reddit/SingleSubredditViewController.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2392,6 +2392,13 @@ extension SingleSubredditViewController: UICollectionViewDataSource {
23922392
if row >= self.links.count {
23932393
if nomore {
23942394
let cell = tableView.dequeueReusableCell(withReuseIdentifier: "nothing", for: indexPath) as! NothingHereCell
2395+
if links.count < 10 {
2396+
var title = NSMutableAttributedString(string: "You've reached the end!", attributes: [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 12), NSAttributedString.Key.foregroundColor: ColorUtil.theme.fontColor])
2397+
title.append(NSAttributedString(string: "/n"))
2398+
title.append(NSMutableAttributedString(string: "If you are unable to view new posts, check your Filter settings", attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 10), NSAttributedString.Key.foregroundColor: ColorUtil.theme.fontColor]))
2399+
cell.text.attributedText = title
2400+
}
2401+
23952402
return cell
23962403
}
23972404
let cell = tableView.dequeueReusableCell(withReuseIdentifier: "loading", for: indexPath) as! LoadingCell
@@ -2881,9 +2888,8 @@ public class NothingHereCell: UICollectionViewCell {
28812888
}
28822889

28832890
func setupView() {
2884-
28852891
self.contentView.addSubview(text)
2886-
2892+
28872893
let title = NSMutableAttributedString(string: "You've reached the end!", attributes: [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 12), NSAttributedString.Key.foregroundColor: ColorUtil.theme.fontColor])
28882894

28892895
text.attributedText = title

Slide for Reddit/VideoMediaDownloader.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class VideoMediaDownloader {
2424

2525
self.videoType = VideoMediaViewController.VideoType.fromPath(baseURL)
2626

27-
if urlToLoad.absoluteString.endsWith("HLSPlaylist.m3u8") {
27+
if urlToLoad.absoluteString.contains("HLSPlaylist.m3u8") {
2828
let qualityList = ["1080", "720", "480", "360", "240", "96"]
2929
getQualityURL(urlToLoad: urlToLoad.absoluteString, qualityList: qualityList)
3030
} else {

0 commit comments

Comments
 (0)