Skip to content

Commit

Permalink
#1247 (Mac Catalyst edition)
Browse files Browse the repository at this point in the history
- Settings fix for Sequoia.
- Added Delete Account to Logout confirmation; if chosen, logs out and shows the Delete Account web page.
- Fixed crash in reloading feed after logging out.
  • Loading branch information
Dejal committed Sep 26, 2024
1 parent 4346304 commit eb4228c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 22 deletions.
2 changes: 1 addition & 1 deletion clients/ios/Classes/Feed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class Feed: Identifiable {

var feed: [String : Any]? = appDelegate.dictActiveFeeds[id] as? [String : Any]

if feed == nil {
if feed == nil, appDelegate.dictFeeds != nil {
feed = appDelegate.dictFeeds[id] as? [String : Any]
}

Expand Down
39 changes: 26 additions & 13 deletions clients/ios/Classes/NewsBlurAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -1927,27 +1927,40 @@ - (NSArray *)feedIdsForFolderTitle:(NSString *)folderTitle {

- (void)confirmLogout {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Positive?" message:nil preferredStyle:UIAlertControllerStyleAlert];

[alertController addAction:[UIAlertAction actionWithTitle: @"Logout" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
[alertController dismissViewControllerAnimated:YES completion:nil];
NSLog(@"Logging out...");
NSString *urlString = [NSString stringWithFormat:@"%@/reader/logout?api=1",
self.url];
[self GET:urlString parameters:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
[MBProgressHUD hideHUDForView:self.view animated:YES];
[self showLogin];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];

[MBProgressHUD hideHUDForView:self.view animated:YES];
MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
HUD.labelText = @"Logging out...";
[self actuallyLogout];
}]];
#if TARGET_OS_MACCATALYST
[alertController addAction:[UIAlertAction actionWithTitle: @"Delete Account" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * action) {
[alertController dismissViewControllerAnimated:YES completion:nil];
[self actuallyLogout];
NSURL *url = [NSURL URLWithString:@"https://www.newsblur.com/profile/delete_account"];
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
}]];
#endif
[alertController addAction:[UIAlertAction actionWithTitle:@"Cancel"
style:UIAlertActionStyleCancel handler:nil]];
[self.feedsViewController presentViewController:alertController animated:YES completion:nil];
}

- (void)actuallyLogout {
NSLog(@"Logging out...");
NSString *urlString = [NSString stringWithFormat:@"%@/reader/logout?api=1",
self.url];
[self GET:urlString parameters:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
[MBProgressHUD hideHUDForView:self.view animated:YES];
[self showLogin];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];

[MBProgressHUD hideHUDForView:self.view animated:YES];
MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
HUD.labelText = @"Logging out...";
}

- (void)showConnectToService:(NSString *)serviceName {
AuthorizeServicesViewController *serviceVC = [[AuthorizeServicesViewController alloc] init];
serviceVC.url = [NSString stringWithFormat:@"/oauth/%@_connect", serviceName];
Expand Down
8 changes: 4 additions & 4 deletions clients/ios/Resources/MainInterface.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="6pv-7g-17r" initialMenu="YWi-Ju-M3z">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="6pv-7g-17r" initialMenu="YWi-Ju-M3z">
<device id="ipad11_0rounded" orientation="landscape" layout="fullscreen" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="UIMenu" message="Requires Xcode 11 or later." minToolsVersion="11.0" requiredIntegratedClassName="UICommandDiff"/>
Expand All @@ -15,7 +15,7 @@
<objects>
<viewController storyboardIdentifier="DetailViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="djW-7k-haK" customClass="DetailViewController" customModule="NewsBlur" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jTZ-4O-xyT">
<rect key="frame" x="0.0" y="0.0" width="514" height="834"/>
<rect key="frame" x="0.0" y="0.0" width="514.5" height="834"/>
<subviews>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bPa-u1-Aml">
<rect key="frame" x="0.0" y="74" width="1210" height="580"/>
Expand Down Expand Up @@ -900,7 +900,7 @@
<objects>
<navigationController storyboardIdentifier="DetailNavigationController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="HsP-cn-nIY" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="Noh-2M-34G">
<rect key="frame" x="0.0" y="24" width="514" height="50"/>
<rect key="frame" x="0.0" y="24" width="514.5" height="50"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
Expand Down
8 changes: 4 additions & 4 deletions clients/ios/Resources/mac/Settings.bundle/StoryList.plist
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
<key>Title</key>
<string>Show Infrequent Site Stories</string>
<key>DefaultValue</key>
<string>YES</string>
<true/>
<key>Key</key>
<string>show_infrequent_site_stories</string>
</dict>
Expand All @@ -172,7 +172,7 @@
<key>Title</key>
<string>Show Global Shared Stories</string>
<key>DefaultValue</key>
<string>YES</string>
<true/>
<key>Key</key>
<string>show_global_shared_stories</string>
</dict>
Expand All @@ -182,7 +182,7 @@
<key>Title</key>
<string>Mark stories read on scroll</string>
<key>DefaultValue</key>
<string>YES</string>
<true/>
<key>Key</key>
<string>default_scroll_read_filter</string>
</dict>
Expand All @@ -192,7 +192,7 @@
<key>Title</key>
<string>Show override mark read on scroll</string>
<key>DefaultValue</key>
<string>YES</string>
<true/>
<key>Key</key>
<string>override_scroll_read_filter</string>
</dict>
Expand Down

0 comments on commit eb4228c

Please sign in to comment.