Skip to content

Commit

Permalink
Merge branch 'master' into discover
Browse files Browse the repository at this point in the history
* master: (44 commits)
  iOS v13.1
  Load offline story images even when online to speed up image display.
  #1875 (borders between panes not using theme colors)
  #1247 (Mac Catalyst edition)
  #1874 (Crash on opening widget story)
  #1247 (Mac Catalyst edition)
  #1247 (Mac Catalyst edition)
  #1247 (Mac Catalyst edition)
  #1247 (Mac Catalyst edition)
  #1247 (Mac Catalyst edition)
  #1247 (Mac Catalyst edition)
  Bumped version number
  #1247 (Mac Catalyst edition)
  #1851 (mark as read button at bottom of story list)
  #1247 (Mac Catalyst edition)
  #1247 (Mac Catalyst edition)
  Added privacy manifest
  #1247 (Mac Catalyst edition)
  #1247 (Mac Catalyst edition)
  #1247 (Mac Catalyst edition)
  ...
  • Loading branch information
samuelclay committed Aug 9, 2024
2 parents 7cef002 + 10b2246 commit f03d881
Show file tree
Hide file tree
Showing 117 changed files with 4,847 additions and 948 deletions.
8 changes: 4 additions & 4 deletions clients/ios/Classes/ActivityModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger activitiesCount = [appDelegate.userActivitiesArray count];
int minimumHeight;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
if (!appDelegate.isPhone) {
minimumHeight = MINIMUM_ACTIVITY_HEIGHT_IPAD;
} else {
minimumHeight = MINIMUM_ACTIVITY_HEIGHT_IPHONE;
Expand All @@ -165,7 +165,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
}

id activityCell;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
if (!appDelegate.isPhone) {
activityCell = [[ActivityCell alloc] init];
} else {
activityCell = [[SmallActivityCell alloc] init];
Expand All @@ -185,7 +185,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
ActivityCell *cell = [tableView
dequeueReusableCellWithIdentifier:@"ActivityCell"];
if (cell == nil) {
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
if (!appDelegate.isPhone) {
cell = [[ActivityCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"ActivityCell"];
Expand Down Expand Up @@ -304,7 +304,7 @@ - (UITableViewCell *)makeLoadingCell {
UIImage *img = [UIImage imageNamed:@"fleuron.png"];
UIImageView *fleuron = [[UIImageView alloc] initWithImage:img];
int height;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
if (!appDelegate.isPhone) {
height = MINIMUM_ACTIVITY_HEIGHT_IPAD;
} else {
height = MINIMUM_ACTIVITY_HEIGHT_IPHONE;
Expand Down
7 changes: 1 addition & 6 deletions clients/ios/Classes/AddSiteViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,10 @@
//

#import <UIKit/UIKit.h>
#import "NewsBlurAppDelegate.h"
#import "NewsBlur-Swift.h"

@class NewsBlurAppDelegate;

@interface AddSiteViewController : BaseViewController
<UITextFieldDelegate, UITableViewDelegate, UITableViewDataSource> {
NewsBlurAppDelegate *appDelegate;
}
<UITextFieldDelegate, UITableViewDelegate, UITableViewDataSource>

- (void)reload;
- (IBAction)addSite;
Expand Down
7 changes: 3 additions & 4 deletions clients/ios/Classes/AddSiteViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#import "AddSiteViewController.h"
#import "AddSiteAutocompleteCell.h"
#import "NewsBlurAppDelegate.h"
#import "MenuViewController.h"
#import "SBJson4.h"
#import "NewsBlur-Swift.h"
Expand Down Expand Up @@ -93,7 +92,7 @@ - (void)viewWillAppear:(BOOL)animated {

//- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// // Return YES for supported orientations
// if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
// if (!self.isPhone) {
// return YES;
// } else if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) {
// return YES;
Expand Down Expand Up @@ -130,7 +129,7 @@ - (CGSize)preferredContentSize {
}

- (IBAction)doCancelButton {
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
if (!self.isPhone) {
[appDelegate hidePopover];
} else {
[appDelegate hidePopoverAnimated:YES];
Expand Down Expand Up @@ -272,7 +271,7 @@ - (IBAction)addSite {
[self.errorLabel setText:[responseObject valueForKey:@"message"]];
[self.errorLabel setHidden:NO];
} else {
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
if (!self.isPhone) {
[self->appDelegate hidePopover];
} else {
[self->appDelegate hidePopoverAnimated:YES];
Expand Down
5 changes: 3 additions & 2 deletions clients/ios/Classes/AuthorizeServicesViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ - (void)viewWillAppear:(BOOL)animated {
[self.webView loadRequest:requestObj];
}];

if (self.fromStory && [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
if (self.fromStory && !appDelegate.isPhone) {
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc]
initWithTitle: @"Cancel"
style: UIBarButtonItemStylePlain
Expand All @@ -75,6 +75,7 @@ - (void)doCancelButton {
}

- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
BOOL isPhone = appDelegate.isPhone;
NSURLRequest *request = navigationAction.request;
NSString *URLString = [[request URL] absoluteString];
NSLog(@"URL STRING IS %@", URLString);
Expand All @@ -86,7 +87,7 @@ - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigati

if (self.fromStory) {
[self.appDelegate refreshUserProfile:^{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
if (!isPhone) {
[self.appDelegate.shareNavigationController viewWillAppear:YES];
[self.appDelegate.modalNavigationController dismissViewControllerAnimated:YES completion:nil];
} else {
Expand Down
70 changes: 70 additions & 0 deletions clients/ios/Classes/AuxSceneDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//
// AuxSceneDelegate.swift
// NewsBlur
//
// Created by David Sinclair on 2024-05-30.
// Copyright © 2024 NewsBlur. All rights reserved.
//

import UIKit

/// Scene delegate for auxiliary windows. Currently only used on macOS.
class AuxSceneDelegate: UIResponder, UIWindowSceneDelegate {
let appDelegate: NewsBlurAppDelegate = .shared

var window: UIWindow?
#if targetEnvironment(macCatalyst)
var toolbar = NSToolbar(identifier: "aux")
var toolbarDelegate = ToolbarDelegate()
#endif

/// Open a new window with an `OriginalStoryViewController` for the given URL.
@objc(openWindowForURL:customTitle:) class func openWindow(for url: URL, customTitle: String) {
let activity = NSUserActivity(activityType: "aux")

activity.userInfo = ["url" : url, "title" : customTitle]

if #available(iOS 17.0, *) {
let request = UISceneSessionActivationRequest(userActivity: activity)

UIApplication.shared.activateSceneSession(for: request) { error in
print("Error activating scene: \(error)")
}
} else {
UIApplication.shared.requestSceneSessionActivation(nil, userActivity: activity, options: nil) { error in
print("Error activating scene: \(error)")
}
}
}

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
#if targetEnvironment(macCatalyst)
guard let windowScene = scene as? UIWindowScene, //let titlebar = windowScene.titlebar,
let userInfo = connectionOptions.userActivities.first?.userInfo else {
return
}

let url = userInfo["url"] as? URL
let title = userInfo["title"] as? String

let controller = OriginalStoryViewController()

windowScene.title = "Loading…"
window?.rootViewController = controller

appDelegate.activeOriginalStoryURL = url

controller.customPageTitle = title
_ = controller.view
controller.loadInitialStory()

//TODO: 🚧 perhaps make a toolbar for this window
// toolbar.delegate = toolbarDelegate
// toolbar.displayMode = .iconOnly
//
// titlebar.toolbar = toolbar
// titlebar.toolbarStyle = .automatic

#endif
}
}
65 changes: 65 additions & 0 deletions clients/ios/Classes/BaseViewController.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
#import <UIKit/UIKit.h>
#import "MBProgressHUD.h"

@class NewsBlurAppDelegate;

@interface BaseViewController : UIViewController {
NewsBlurAppDelegate *appDelegate;
}

@property (nonatomic) IBOutlet NewsBlurAppDelegate *appDelegate;

@property (nonatomic, readonly) BOOL isPhone;
@property (nonatomic, readonly) BOOL isMac;
@property (nonatomic, readonly) BOOL isVision;
@property (nonatomic, readonly) BOOL isPortrait;
@property (nonatomic, readonly) BOOL isCompactWidth;
@property (nonatomic, readonly) BOOL isGrid;
@property (nonatomic, readonly) BOOL isFeedShown;
@property (nonatomic, readonly) BOOL isStoryShown;

- (void)informError:(id)error;
- (void)informError:(id)error statusCode:(NSInteger)statusCode;
- (void)informMessage:(NSString *)message;
Expand All @@ -13,6 +27,7 @@
- (void)addKeyCommandWithInput:(NSString *)input modifierFlags:(UIKeyModifierFlags)modifierFlags action:(SEL)action discoverabilityTitle:(NSString *)discoverabilityTitle wantPriority:(BOOL)wantPriority;
- (void)addCancelKeyCommandWithAction:(SEL)action discoverabilityTitle:(NSString *)discoverabilityTitle;

- (void)systemAppearanceDidChange:(BOOL)isDark;
- (void)updateTheme;

- (void)tableView:(UITableView *)tableView redisplayCellAtIndexPath:(NSIndexPath *)indexPath;
Expand All @@ -25,5 +40,55 @@
- (void)collectionView:(UICollectionView *)collectionView selectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UICollectionViewScrollPosition)scrollPosition;
- (void)collectionView:(UICollectionView *)collectionView deselectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated;

- (IBAction)newSite:(id)sender;
- (IBAction)reloadFeeds:(id)sender;
- (IBAction)showMuteSites:(id)sender;
- (IBAction)showOrganizeSites:(id)sender;
- (IBAction)showWidgetSites:(id)sender;
- (IBAction)showNotifications:(id)sender;
- (IBAction)showFindFriends:(id)sender;
- (IBAction)showPremium:(id)sender;
- (IBAction)showSupportForum:(id)sender;
- (IBAction)showLogout:(id)sender;

- (IBAction)findInFeeds:(id)sender;
- (IBAction)findInFeedDetail:(id)sender;

- (IBAction)chooseColumns:(id)sender;
- (IBAction)chooseLayout:(id)sender;
- (IBAction)chooseTitle:(id)sender;
- (IBAction)choosePreview:(id)sender;
- (IBAction)chooseGridColumns:(id)sender;
- (IBAction)chooseGridHeight:(id)sender;
- (IBAction)chooseFontSize:(id)sender;
- (IBAction)chooseSpacing:(id)sender;
- (IBAction)chooseTheme:(id)sender;

- (IBAction)moveSite:(id)sender;
- (IBAction)openRenameSite:(id)sender;
- (IBAction)muteSite:(id)sender;
- (IBAction)deleteSite:(id)sender;
- (IBAction)openTrainSite:(id)sender;
- (IBAction)openNotifications:(id)sender;
- (IBAction)openStatistics:(id)sender;
- (IBAction)instaFetchFeed:(id)sender;
- (IBAction)doMarkAllRead:(id)sender;
- (IBAction)openMarkReadMenu:(id)sender;
- (IBAction)openSettingsMenu:(id)sender;
- (IBAction)nextSite:(id)sender;
- (IBAction)previousSite:(id)sender;
- (IBAction)nextFolder:(id)sender;
- (IBAction)previousFolder:(id)sender;
- (IBAction)openAllStories:(id)sender;

- (IBAction)showSendTo:(id)sender;
- (IBAction)showTrain:(id)sender;
- (IBAction)showShare:(id)sender;
- (IBAction)nextUnreadStory:(id)sender;
- (IBAction)nextStory:(id)sender;
- (IBAction)previousStory:(id)sender;
- (IBAction)toggleTextStory:(id)sender;
- (IBAction)openInBrowser:(id)sender;

@end

Loading

0 comments on commit f03d881

Please sign in to comment.