Merge pull request #292 from mastodon/feature/multi-account
[WIP] Add multiple account supports
This commit is contained in:
commit
8dbbbc374a
|
@ -534,6 +534,14 @@
|
|||
"show_next": "Show Next",
|
||||
"show_previous": "Show Previous"
|
||||
}
|
||||
},
|
||||
"account_list": {
|
||||
"tab_bar_hint": "Current selected profile: %s. Double tap then hold to show account switcher",
|
||||
"dismiss_account_switcher": "Dismiss Account Switcher",
|
||||
"add_account": "Add Account",
|
||||
},
|
||||
"wizard": {
|
||||
"multiple_account_switch_intro_description": "Switch between multiple accounts by holding the profile button."
|
||||
}
|
||||
}
|
||||
}
|
|
@ -202,6 +202,7 @@
|
|||
DB0F8150264D1E2500F2A12B /* PickServerLoaderTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0F814F264D1E2500F2A12B /* PickServerLoaderTableViewCell.swift */; };
|
||||
DB118A8225E4B6E600FAB162 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DB118A8125E4B6E600FAB162 /* Preview Assets.xcassets */; };
|
||||
DB1D186C25EF5BA7003F1F23 /* PollTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB1D186B25EF5BA7003F1F23 /* PollTableView.swift */; };
|
||||
DB1D61CF26F1B33600DA8662 /* WelcomeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB1D61CE26F1B33600DA8662 /* WelcomeViewModel.swift */; };
|
||||
DB1D842C26551A1C000346B3 /* StatusProvider+StatusTableViewKeyCommandNavigateable.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB1D842B26551A1C000346B3 /* StatusProvider+StatusTableViewKeyCommandNavigateable.swift */; };
|
||||
DB1D842E26552C4D000346B3 /* StatusTableViewControllerNavigateable.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB1D842D26552C4D000346B3 /* StatusTableViewControllerNavigateable.swift */; };
|
||||
DB1D843026566512000346B3 /* KeyboardPreference.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB1D842F26566512000346B3 /* KeyboardPreference.swift */; };
|
||||
|
@ -262,6 +263,8 @@
|
|||
DB482A45261335BA008AE74C /* UserTimelineViewController+Provider.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB482A44261335BA008AE74C /* UserTimelineViewController+Provider.swift */; };
|
||||
DB482A4B261340A7008AE74C /* APIService+UserTimeline.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB482A4A261340A7008AE74C /* APIService+UserTimeline.swift */; };
|
||||
DB4924E226312AB200E9DB22 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB4924E126312AB200E9DB22 /* NotificationService.swift */; };
|
||||
DB4932B126F1FB5300EF46D4 /* WizardCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB4932B026F1FB5300EF46D4 /* WizardCardView.swift */; };
|
||||
DB4932B326F2054200EF46D4 /* CircleAvatarButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB4932B226F2054200EF46D4 /* CircleAvatarButton.swift */; };
|
||||
DB49A61425FF2C5600B98345 /* EmojiService.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB49A61325FF2C5600B98345 /* EmojiService.swift */; };
|
||||
DB49A61F25FF32AA00B98345 /* EmojiService+CustomEmojiViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB49A61E25FF32AA00B98345 /* EmojiService+CustomEmojiViewModel.swift */; };
|
||||
DB49A62525FF334C00B98345 /* EmojiService+CustomEmojiViewModel+LoadState.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB49A62425FF334C00B98345 /* EmojiService+CustomEmojiViewModel+LoadState.swift */; };
|
||||
|
@ -301,6 +304,8 @@
|
|||
DB6180F826391D660018D199 /* MediaPreviewingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB6180F726391D660018D199 /* MediaPreviewingViewController.swift */; };
|
||||
DB6180FA26391F2E0018D199 /* MediaPreviewViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB6180F926391F2E0018D199 /* MediaPreviewViewModel.swift */; };
|
||||
DB63BE7F268DD1070011D3F9 /* NotificationViewController+StatusProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB63BE7E268DD1070011D3F9 /* NotificationViewController+StatusProvider.swift */; };
|
||||
DB647C5726F1E97300F7F82C /* MainTabBarController+Wizard.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB647C5626F1E97300F7F82C /* MainTabBarController+Wizard.swift */; };
|
||||
DB647C5926F1EA2700F7F82C /* WizardPreference.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB647C5826F1EA2700F7F82C /* WizardPreference.swift */; };
|
||||
DB66728C25F9F8DC00D60309 /* ComposeViewModel+DataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB66728B25F9F8DC00D60309 /* ComposeViewModel+DataSource.swift */; };
|
||||
DB66729625F9F91600D60309 /* ComposeStatusSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB66729525F9F91600D60309 /* ComposeStatusSection.swift */; };
|
||||
DB66729C25F9F91F00D60309 /* ComposeStatusItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB66729B25F9F91F00D60309 /* ComposeStatusItem.swift */; };
|
||||
|
@ -415,6 +420,9 @@
|
|||
DB9D6C3825E508BE0051B173 /* Attachment.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB9D6C3725E508BE0051B173 /* Attachment.swift */; };
|
||||
DB9D7C21269824B80054B3DF /* APIService+Filter.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB9D7C20269824B80054B3DF /* APIService+Filter.swift */; };
|
||||
DB9E0D6F25EE008500CFDD76 /* UIInterpolatingMotionEffect.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB9E0D6E25EE008500CFDD76 /* UIInterpolatingMotionEffect.swift */; };
|
||||
DB9F58EC26EF435000E7BBE9 /* AccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB9F58EB26EF435000E7BBE9 /* AccountViewController.swift */; };
|
||||
DB9F58EF26EF491E00E7BBE9 /* AccountListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB9F58EE26EF491E00E7BBE9 /* AccountListViewModel.swift */; };
|
||||
DB9F58F126EF512300E7BBE9 /* AccountListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB9F58F026EF512300E7BBE9 /* AccountListTableViewCell.swift */; };
|
||||
DBA088DF26958164003EB4B2 /* UserFetchedResultsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA088DE26958164003EB4B2 /* UserFetchedResultsController.swift */; };
|
||||
DBA0A11325FB3FC10079C110 /* ComposeToolbarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA0A11225FB3FC10079C110 /* ComposeToolbarView.swift */; };
|
||||
DBA1DB80268F84F80052DB59 /* NotificationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA1DB7F268F84F80052DB59 /* NotificationType.swift */; };
|
||||
|
@ -422,6 +430,9 @@
|
|||
DBA465952696E387002B41DB /* AppPreference.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA465942696E387002B41DB /* AppPreference.swift */; };
|
||||
DBA4B0F626C269880077136E /* Intents.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = DBA4B0F926C269880077136E /* Intents.stringsdict */; };
|
||||
DBA4B0F726C269880077136E /* Intents.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = DBA4B0F926C269880077136E /* Intents.stringsdict */; };
|
||||
DBA5A52F26F07ED800CACBAA /* PanModal in Frameworks */ = {isa = PBXBuildFile; productRef = DBA5A52E26F07ED800CACBAA /* PanModal */; };
|
||||
DBA5A53126F08EF000CACBAA /* DragIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA5A53026F08EF000CACBAA /* DragIndicatorView.swift */; };
|
||||
DBA5A53526F0A36A00CACBAA /* AddAccountTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA5A53426F0A36A00CACBAA /* AddAccountTableViewCell.swift */; };
|
||||
DBA5E7A3263AD0A3004598BB /* PhotoLibraryService.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA5E7A2263AD0A3004598BB /* PhotoLibraryService.swift */; };
|
||||
DBA5E7A5263BD28C004598BB /* ContextMenuImagePreviewViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA5E7A4263BD28C004598BB /* ContextMenuImagePreviewViewModel.swift */; };
|
||||
DBA5E7A9263BD3A4004598BB /* ContextMenuImagePreviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBA5E7A8263BD3A4004598BB /* ContextMenuImagePreviewViewController.swift */; };
|
||||
|
@ -943,6 +954,7 @@
|
|||
DB0F814F264D1E2500F2A12B /* PickServerLoaderTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PickServerLoaderTableViewCell.swift; sourceTree = "<group>"; };
|
||||
DB118A8125E4B6E600FAB162 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
|
||||
DB1D186B25EF5BA7003F1F23 /* PollTableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PollTableView.swift; sourceTree = "<group>"; };
|
||||
DB1D61CE26F1B33600DA8662 /* WelcomeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeViewModel.swift; sourceTree = "<group>"; };
|
||||
DB1D842B26551A1C000346B3 /* StatusProvider+StatusTableViewKeyCommandNavigateable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "StatusProvider+StatusTableViewKeyCommandNavigateable.swift"; sourceTree = "<group>"; };
|
||||
DB1D842D26552C4D000346B3 /* StatusTableViewControllerNavigateable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusTableViewControllerNavigateable.swift; sourceTree = "<group>"; };
|
||||
DB1D842F26566512000346B3 /* KeyboardPreference.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardPreference.swift; sourceTree = "<group>"; };
|
||||
|
@ -1010,6 +1022,8 @@
|
|||
DB482A44261335BA008AE74C /* UserTimelineViewController+Provider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UserTimelineViewController+Provider.swift"; sourceTree = "<group>"; };
|
||||
DB482A4A261340A7008AE74C /* APIService+UserTimeline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "APIService+UserTimeline.swift"; sourceTree = "<group>"; };
|
||||
DB4924E126312AB200E9DB22 /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
|
||||
DB4932B026F1FB5300EF46D4 /* WizardCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WizardCardView.swift; sourceTree = "<group>"; };
|
||||
DB4932B226F2054200EF46D4 /* CircleAvatarButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircleAvatarButton.swift; sourceTree = "<group>"; };
|
||||
DB49A61325FF2C5600B98345 /* EmojiService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiService.swift; sourceTree = "<group>"; };
|
||||
DB49A61E25FF32AA00B98345 /* EmojiService+CustomEmojiViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "EmojiService+CustomEmojiViewModel.swift"; sourceTree = "<group>"; };
|
||||
DB49A62425FF334C00B98345 /* EmojiService+CustomEmojiViewModel+LoadState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "EmojiService+CustomEmojiViewModel+LoadState.swift"; sourceTree = "<group>"; };
|
||||
|
@ -1073,6 +1087,8 @@
|
|||
DB6180F726391D660018D199 /* MediaPreviewingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaPreviewingViewController.swift; sourceTree = "<group>"; };
|
||||
DB6180F926391F2E0018D199 /* MediaPreviewViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaPreviewViewModel.swift; sourceTree = "<group>"; };
|
||||
DB63BE7E268DD1070011D3F9 /* NotificationViewController+StatusProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NotificationViewController+StatusProvider.swift"; sourceTree = "<group>"; };
|
||||
DB647C5626F1E97300F7F82C /* MainTabBarController+Wizard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MainTabBarController+Wizard.swift"; sourceTree = "<group>"; };
|
||||
DB647C5826F1EA2700F7F82C /* WizardPreference.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WizardPreference.swift; sourceTree = "<group>"; };
|
||||
DB66728B25F9F8DC00D60309 /* ComposeViewModel+DataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ComposeViewModel+DataSource.swift"; sourceTree = "<group>"; };
|
||||
DB66729525F9F91600D60309 /* ComposeStatusSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeStatusSection.swift; sourceTree = "<group>"; };
|
||||
DB66729B25F9F91F00D60309 /* ComposeStatusItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeStatusItem.swift; sourceTree = "<group>"; };
|
||||
|
@ -1184,6 +1200,9 @@
|
|||
DB9D6C3725E508BE0051B173 /* Attachment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Attachment.swift; sourceTree = "<group>"; };
|
||||
DB9D7C20269824B80054B3DF /* APIService+Filter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "APIService+Filter.swift"; sourceTree = "<group>"; };
|
||||
DB9E0D6E25EE008500CFDD76 /* UIInterpolatingMotionEffect.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIInterpolatingMotionEffect.swift; sourceTree = "<group>"; };
|
||||
DB9F58EB26EF435000E7BBE9 /* AccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountViewController.swift; sourceTree = "<group>"; };
|
||||
DB9F58EE26EF491E00E7BBE9 /* AccountListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountListViewModel.swift; sourceTree = "<group>"; };
|
||||
DB9F58F026EF512300E7BBE9 /* AccountListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountListTableViewCell.swift; sourceTree = "<group>"; };
|
||||
DBA088DE26958164003EB4B2 /* UserFetchedResultsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserFetchedResultsController.swift; sourceTree = "<group>"; };
|
||||
DBA0A11225FB3FC10079C110 /* ComposeToolbarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeToolbarView.swift; sourceTree = "<group>"; };
|
||||
DBA1DB7F268F84F80052DB59 /* NotificationType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationType.swift; sourceTree = "<group>"; };
|
||||
|
@ -1219,6 +1238,8 @@
|
|||
DBA4B0EF26C153B20077136E /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
DBA4B0F526C2621D0077136E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Intents.strings; sourceTree = "<group>"; };
|
||||
DBA4B0F826C269880077136E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Intents.stringsdict; sourceTree = "<group>"; };
|
||||
DBA5A53026F08EF000CACBAA /* DragIndicatorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DragIndicatorView.swift; sourceTree = "<group>"; };
|
||||
DBA5A53426F0A36A00CACBAA /* AddAccountTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddAccountTableViewCell.swift; sourceTree = "<group>"; };
|
||||
DBA5E7A2263AD0A3004598BB /* PhotoLibraryService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoLibraryService.swift; sourceTree = "<group>"; };
|
||||
DBA5E7A4263BD28C004598BB /* ContextMenuImagePreviewViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContextMenuImagePreviewViewModel.swift; sourceTree = "<group>"; };
|
||||
DBA5E7A8263BD3A4004598BB /* ContextMenuImagePreviewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContextMenuImagePreviewViewController.swift; sourceTree = "<group>"; };
|
||||
|
@ -1381,6 +1402,7 @@
|
|||
87FFDA5D898A5C42ADCB35E7 /* Pods_Mastodon.framework in Frameworks */,
|
||||
DBF7A0FC26830C33004176A2 /* FPSIndicator in Frameworks */,
|
||||
DB01E23526A98F0900C3965B /* MetaTextKit in Frameworks */,
|
||||
DBA5A52F26F07ED800CACBAA /* PanModal in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -1487,6 +1509,7 @@
|
|||
children = (
|
||||
DBABE3F125ECAC4E00879EE5 /* View */,
|
||||
0FAA0FDE25E0B57E0017CCDE /* WelcomeViewController.swift */,
|
||||
DB1D61CE26F1B33600DA8662 /* WelcomeViewModel.swift */,
|
||||
);
|
||||
path = Welcome;
|
||||
sourceTree = "<group>";
|
||||
|
@ -1664,6 +1687,7 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
DB0C947126A7D2D70088FB11 /* AvatarButton.swift */,
|
||||
DB4932B226F2054200EF46D4 /* CircleAvatarButton.swift */,
|
||||
DB71FD2B25F86A5100512AE1 /* AvatarStackContainerButton.swift */,
|
||||
2D42FF8425C8224F004A627A /* HitTestExpandedButton.swift */,
|
||||
0FAA101125E105390017CCDE /* PrimaryActionButton.swift */,
|
||||
|
@ -2310,6 +2334,7 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
DBA465942696E387002B41DB /* AppPreference.swift */,
|
||||
DB647C5826F1EA2700F7F82C /* WizardPreference.swift */,
|
||||
DB6D1B3C2636857500ACB481 /* AppearancePreference.swift */,
|
||||
DBE54AC52636C89F004E7C0B /* NotificationPreference.swift */,
|
||||
DB1D842F26566512000346B3 /* KeyboardPreference.swift */,
|
||||
|
@ -2590,6 +2615,7 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
DB8AF54F25C13703002E6C99 /* MainTabBarController.swift */,
|
||||
DB647C5626F1E97300F7F82C /* MainTabBarController+Wizard.swift */,
|
||||
);
|
||||
path = MainTab;
|
||||
sourceTree = "<group>";
|
||||
|
@ -2601,6 +2627,7 @@
|
|||
DB6180E426391A500018D199 /* Transition */,
|
||||
DB8AF54E25C13703002E6C99 /* MainTab */,
|
||||
DB01409B25C40BB600F9F3CF /* Onboarding */,
|
||||
DB9F58ED26EF435800E7BBE9 /* Account */,
|
||||
2D38F1D325CD463600561493 /* HomeTimeline */,
|
||||
2D76316325C14BAC00929FB9 /* PublicTimeline */,
|
||||
5B24BBD6262DB14800A9381B /* Report */,
|
||||
|
@ -2775,6 +2802,34 @@
|
|||
path = ViewModel;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
DB9F58ED26EF435800E7BBE9 /* Account */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DBA5A53226F08EF300CACBAA /* View */,
|
||||
DBA5A53326F0932E00CACBAA /* Cell */,
|
||||
DB9F58EB26EF435000E7BBE9 /* AccountViewController.swift */,
|
||||
DB9F58EE26EF491E00E7BBE9 /* AccountListViewModel.swift */,
|
||||
);
|
||||
path = Account;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
DBA5A53226F08EF300CACBAA /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DBA5A53026F08EF000CACBAA /* DragIndicatorView.swift */,
|
||||
);
|
||||
path = View;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
DBA5A53326F0932E00CACBAA /* Cell */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DB9F58F026EF512300E7BBE9 /* AccountListTableViewCell.swift */,
|
||||
DBA5A53426F0A36A00CACBAA /* AddAccountTableViewCell.swift */,
|
||||
);
|
||||
path = Cell;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
DBA5E7A6263BD298004598BB /* ContextMenu */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -2806,6 +2861,7 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
DBABE3EB25ECAC4B00879EE5 /* WelcomeIllustrationView.swift */,
|
||||
DB4932B026F1FB5300EF46D4 /* WizardCardView.swift */,
|
||||
);
|
||||
path = View;
|
||||
sourceTree = "<group>";
|
||||
|
@ -3144,6 +3200,7 @@
|
|||
DB01E23226A98F0900C3965B /* MastodonMeta */,
|
||||
DB01E23426A98F0900C3965B /* MetaTextKit */,
|
||||
DB552D4E26BBD10C00E481F6 /* OrderedCollections */,
|
||||
DBA5A52E26F07ED800CACBAA /* PanModal */,
|
||||
);
|
||||
productName = Mastodon;
|
||||
productReference = DB427DD225BAA00100D1B89D /* Mastodon.app */;
|
||||
|
@ -3403,6 +3460,7 @@
|
|||
DB0E2D2C26833FF600865C3C /* XCRemoteSwiftPackageReference "Nuke-FLAnimatedImage-Plugin" */,
|
||||
DB01E23126A98F0900C3965B /* XCRemoteSwiftPackageReference "MetaTextKit" */,
|
||||
DB552D4D26BBD10C00E481F6 /* XCRemoteSwiftPackageReference "swift-collections" */,
|
||||
DBA5A52D26F07ED800CACBAA /* XCRemoteSwiftPackageReference "PanModal" */,
|
||||
);
|
||||
productRefGroup = DB427DD325BAA00100D1B89D /* Products */;
|
||||
projectDirPath = "";
|
||||
|
@ -3756,6 +3814,7 @@
|
|||
2D5A3D3825CF8D9F002347D6 /* ScrollViewContainer.swift in Sources */,
|
||||
DB6180EF26391CA50018D199 /* MediaPreviewImageViewController.swift in Sources */,
|
||||
DB1E347825F519300079D7DF /* PickServerItem.swift in Sources */,
|
||||
DBA5A53126F08EF000CACBAA /* DragIndicatorView.swift in Sources */,
|
||||
DB1FD45A25F27898004CFCFC /* CategoryPickerItem.swift in Sources */,
|
||||
DB6180F626391D580018D199 /* MediaPreviewableViewController.swift in Sources */,
|
||||
2D571B2F26004EC000540450 /* NavigationBarProgressView.swift in Sources */,
|
||||
|
@ -3922,10 +3981,12 @@
|
|||
2D45E5BF25C9549700A6D639 /* PublicTimelineViewModel+State.swift in Sources */,
|
||||
DB8AF55D25C138B7002E6C99 /* UIViewController.swift in Sources */,
|
||||
DB7F48452620241000796008 /* ProfileHeaderViewModel.swift in Sources */,
|
||||
DB647C5926F1EA2700F7F82C /* WizardPreference.swift in Sources */,
|
||||
2D3F9E0425DFA133004262D9 /* UITapGestureRecognizer.swift in Sources */,
|
||||
5DDDF1992617447F00311060 /* Mastodon+Entity+Tag.swift in Sources */,
|
||||
5B90C45F262599800002E742 /* SettingsToggleTableViewCell.swift in Sources */,
|
||||
2D694A7425F9EB4E0038ADDC /* ContentWarningOverlayView.swift in Sources */,
|
||||
DB4932B126F1FB5300EF46D4 /* WizardCardView.swift in Sources */,
|
||||
DBAE3F682615DD60004B8251 /* UserProvider.swift in Sources */,
|
||||
DBAC6488267D388B007FE9FD /* ASTableNode.swift in Sources */,
|
||||
DB6D9F76263587C7008423CD /* SettingFetchedResultController.swift in Sources */,
|
||||
|
@ -3960,6 +4021,7 @@
|
|||
2D5981A125E4A593000FB903 /* MastodonConfirmEmailViewModel.swift in Sources */,
|
||||
DB4F096C269EFA2000D62E92 /* SearchResultViewController+StatusProvider.swift in Sources */,
|
||||
DB87D4452609BE0500D12C0D /* ComposeStatusPollOptionCollectionViewCell.swift in Sources */,
|
||||
DB9F58EF26EF491E00E7BBE9 /* AccountListViewModel.swift in Sources */,
|
||||
DB6D9F7D26358ED4008423CD /* SettingsSection.swift in Sources */,
|
||||
DB0E91EA26A9675100BD2ACC /* MetaLabel.swift in Sources */,
|
||||
DB8AF55025C13703002E6C99 /* MainTabBarController.swift in Sources */,
|
||||
|
@ -4017,12 +4079,14 @@
|
|||
DB938F1526241FDF00E5B6C1 /* APIService+Thread.swift in Sources */,
|
||||
DB482A45261335BA008AE74C /* UserTimelineViewController+Provider.swift in Sources */,
|
||||
2D206B8625F5FB0900143C56 /* Double.swift in Sources */,
|
||||
DB9F58F126EF512300E7BBE9 /* AccountListTableViewCell.swift in Sources */,
|
||||
2D76319F25C1521200929FB9 /* StatusSection.swift in Sources */,
|
||||
DB35FC252612FD7A006193C9 /* ProfileFieldView.swift in Sources */,
|
||||
DB938F0326240EA300E5B6C1 /* CachedThreadViewModel.swift in Sources */,
|
||||
DB6D9F6326357848008423CD /* SettingService.swift in Sources */,
|
||||
2D650FAB25ECDC9300851B58 /* Mastodon+Entity+Error+Detail.swift in Sources */,
|
||||
2D24E12D2626FD2E00A59D4F /* NotificationViewModel+LoadOldestState.swift in Sources */,
|
||||
DBA5A53526F0A36A00CACBAA /* AddAccountTableViewCell.swift in Sources */,
|
||||
2DB72C8C262D764300CE6173 /* Mastodon+Entity+Notification+Type.swift in Sources */,
|
||||
2D35237A26256D920031AF25 /* NotificationSection.swift in Sources */,
|
||||
DB084B5725CBC56C00F898ED /* Status.swift in Sources */,
|
||||
|
@ -4075,6 +4139,7 @@
|
|||
DB9D6C3825E508BE0051B173 /* Attachment.swift in Sources */,
|
||||
5DFC35DF262068D20045711D /* SearchViewController+Follow.swift in Sources */,
|
||||
DB8AF52E25C13561002E6C99 /* ViewStateStore.swift in Sources */,
|
||||
DB1D61CF26F1B33600DA8662 /* WelcomeViewModel.swift in Sources */,
|
||||
2DA7D04A25CA52CB00804E11 /* TimelineBottomLoaderTableViewCell.swift in Sources */,
|
||||
DBD376B2269302A4007FEC24 /* UITableViewCell.swift in Sources */,
|
||||
DB4F0966269ED52200D62E92 /* SearchResultViewModel.swift in Sources */,
|
||||
|
@ -4105,14 +4170,17 @@
|
|||
2D198649261C0B8500F0B013 /* SearchResultSection.swift in Sources */,
|
||||
DB4F097B26A039FF00D62E92 /* SearchHistorySection.swift in Sources */,
|
||||
DBB525302611EBF3002F1F29 /* ProfilePagingViewModel.swift in Sources */,
|
||||
DB9F58EC26EF435000E7BBE9 /* AccountViewController.swift in Sources */,
|
||||
DBCBCC0B2680B03F000F5B51 /* AsyncHomeTimelineViewModel+LoadOldestState.swift in Sources */,
|
||||
2D5A3D6225CFD9CB002347D6 /* HomeTimelineViewController+DebugAction.swift in Sources */,
|
||||
DB49A62525FF334C00B98345 /* EmojiService+CustomEmojiViewModel+LoadState.swift in Sources */,
|
||||
DB4924E226312AB200E9DB22 /* NotificationService.swift in Sources */,
|
||||
DB6D9F6F2635807F008423CD /* Setting.swift in Sources */,
|
||||
DB647C5726F1E97300F7F82C /* MainTabBarController+Wizard.swift in Sources */,
|
||||
DB6F5E38264E994A009108F4 /* AutoCompleteTopChevronView.swift in Sources */,
|
||||
DBB525412611ED54002F1F29 /* ProfileHeaderViewController.swift in Sources */,
|
||||
DB9D6BFF25E4F5940051B173 /* ProfileViewController.swift in Sources */,
|
||||
DB4932B326F2054200EF46D4 /* CircleAvatarButton.swift in Sources */,
|
||||
0FB3D30825E524C600AAD544 /* PickServerCategoriesCell.swift in Sources */,
|
||||
2D4AD8A226316CD200613EFC /* SelectedAccountSection.swift in Sources */,
|
||||
DB789A1225F9F2CC0071ACA0 /* ComposeViewModel.swift in Sources */,
|
||||
|
@ -5825,6 +5893,14 @@
|
|||
minimumVersion = 1.4.1;
|
||||
};
|
||||
};
|
||||
DBA5A52D26F07ED800CACBAA /* XCRemoteSwiftPackageReference "PanModal" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/slackhq/PanModal.git";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 1.2.7;
|
||||
};
|
||||
};
|
||||
DBAC6481267D0B21007FE9FD /* XCRemoteSwiftPackageReference "DifferenceKit" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/ra1028/DifferenceKit.git";
|
||||
|
@ -5937,6 +6013,11 @@
|
|||
package = DB9A487C2603456B008B817C /* XCRemoteSwiftPackageReference "UITextView-Placeholder" */;
|
||||
productName = "UITextView+Placeholder";
|
||||
};
|
||||
DBA5A52E26F07ED800CACBAA /* PanModal */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = DBA5A52D26F07ED800CACBAA /* XCRemoteSwiftPackageReference "PanModal" */;
|
||||
productName = PanModal;
|
||||
};
|
||||
DBAC6482267D0B21007FE9FD /* DifferenceKit */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = DBAC6481267D0B21007FE9FD /* XCRemoteSwiftPackageReference "DifferenceKit" */;
|
||||
|
|
|
@ -7,42 +7,42 @@
|
|||
<key>AppShared.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>60</integer>
|
||||
<integer>38</integer>
|
||||
</dict>
|
||||
<key>CoreDataStack.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>62</integer>
|
||||
<integer>35</integer>
|
||||
</dict>
|
||||
<key>Mastodon - ASDK.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>11</integer>
|
||||
<integer>3</integer>
|
||||
</dict>
|
||||
<key>Mastodon - RTL.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>12</integer>
|
||||
<integer>13</integer>
|
||||
</dict>
|
||||
<key>Mastodon - Release.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>10</integer>
|
||||
<integer>2</integer>
|
||||
</dict>
|
||||
<key>Mastodon - ar.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>7</integer>
|
||||
<integer>10</integer>
|
||||
</dict>
|
||||
<key>Mastodon - ca.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>32</integer>
|
||||
<integer>16</integer>
|
||||
</dict>
|
||||
<key>Mastodon - de.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>8</integer>
|
||||
<integer>11</integer>
|
||||
</dict>
|
||||
<key>Mastodon - en.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
|
@ -52,42 +52,42 @@
|
|||
<key>Mastodon - es-419.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>5</integer>
|
||||
<integer>8</integer>
|
||||
</dict>
|
||||
<key>Mastodon - es.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>4</integer>
|
||||
<integer>7</integer>
|
||||
</dict>
|
||||
<key>Mastodon - fr.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>6</integer>
|
||||
<integer>9</integer>
|
||||
</dict>
|
||||
<key>Mastodon - jp.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>27</integer>
|
||||
<integer>14</integer>
|
||||
</dict>
|
||||
<key>Mastodon - nl.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>9</integer>
|
||||
<integer>12</integer>
|
||||
</dict>
|
||||
<key>Mastodon - ru.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>2</integer>
|
||||
<integer>4</integer>
|
||||
</dict>
|
||||
<key>Mastodon - th.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>3</integer>
|
||||
<integer>5</integer>
|
||||
</dict>
|
||||
<key>Mastodon - zh_Hans.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>30</integer>
|
||||
<integer>15</integer>
|
||||
</dict>
|
||||
<key>Mastodon.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
|
@ -97,7 +97,7 @@
|
|||
<key>MastodonIntent.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>56</integer>
|
||||
<integer>36</integer>
|
||||
</dict>
|
||||
<key>MastodonIntents.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
|
@ -112,12 +112,12 @@
|
|||
<key>NotificationService.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>13</integer>
|
||||
<integer>6</integer>
|
||||
</dict>
|
||||
<key>ShareActionExtension.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>58</integer>
|
||||
<integer>37</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
|
|
|
@ -127,6 +127,15 @@
|
|||
"version": "3.6.2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "PanModal",
|
||||
"repositoryURL": "https://github.com/slackhq/PanModal.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "b012aecb6b67a8e46369227f893c12544846613f",
|
||||
"version": "1.2.7"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "SDWebImage",
|
||||
"repositoryURL": "https://github.com/SDWebImage/SDWebImage.git",
|
||||
|
@ -141,8 +150,8 @@
|
|||
"repositoryURL": "https://github.com/apple/swift-collections.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "0959ba76a1d4a98fd11163aa83fd49c25b93bfae",
|
||||
"version": "0.0.5"
|
||||
"revision": "9d8719c8bebdc79740b6969c912ac706eb721d7a",
|
||||
"version": "0.0.7"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
import UIKit
|
||||
import SafariServices
|
||||
import CoreDataStack
|
||||
import PanModal
|
||||
|
||||
final public class SceneCoordinator {
|
||||
|
||||
|
@ -31,6 +32,7 @@ extension SceneCoordinator {
|
|||
case show // push
|
||||
case showDetail // replace
|
||||
case modal(animated: Bool, completion: (() -> Void)? = nil)
|
||||
case panModal
|
||||
case custom(transitioningDelegate: UIViewControllerTransitioningDelegate)
|
||||
case customPush
|
||||
case safariPresent(animated: Bool, completion: (() -> Void)? = nil)
|
||||
|
@ -66,6 +68,7 @@ extension SceneCoordinator {
|
|||
case hashtagTimeline(viewModel: HashtagTimelineViewModel)
|
||||
|
||||
// profile
|
||||
case accountList
|
||||
case profile(viewModel: ProfileViewModel)
|
||||
case favorite(viewModel: FavoriteViewModel)
|
||||
|
||||
|
@ -184,6 +187,13 @@ extension SceneCoordinator {
|
|||
}
|
||||
presentingViewController.present(modalNavigationController, animated: animated, completion: completion)
|
||||
|
||||
case .panModal:
|
||||
guard let panModalPresentable = viewController as? PanModalPresentable & UIViewController else {
|
||||
assertionFailure()
|
||||
return nil
|
||||
}
|
||||
presentingViewController.presentPanModal(panModalPresentable)
|
||||
|
||||
case .custom(let transitioningDelegate):
|
||||
viewController.modalPresentationStyle = .custom
|
||||
viewController.transitioningDelegate = transitioningDelegate
|
||||
|
@ -273,6 +283,9 @@ private extension SceneCoordinator {
|
|||
let _viewController = HashtagTimelineViewController()
|
||||
_viewController.viewModel = viewModel
|
||||
viewController = _viewController
|
||||
case .accountList:
|
||||
let _viewController = AccountListViewController()
|
||||
viewController = _viewController
|
||||
case .profile(let viewModel):
|
||||
let _viewController = ProfileViewController()
|
||||
_viewController.viewModel = viewModel
|
||||
|
|
|
@ -32,7 +32,7 @@ open class TableNodeDiffableDataSource<SectionIdentifierType: Hashable, ItemIden
|
|||
self.cellProvider = cellProvider
|
||||
super.init()
|
||||
|
||||
tableNode.dataSource = self
|
||||
tableNode.delegate = self
|
||||
}
|
||||
|
||||
/// Applies given snapshot to perform automatic diffing update.
|
||||
|
|
|
@ -20,6 +20,8 @@ extension MetaLabel {
|
|||
case titleView
|
||||
case settingTableFooter
|
||||
case autoCompletion
|
||||
case accountListName
|
||||
case accountListUsername
|
||||
}
|
||||
|
||||
convenience init(style: Style) {
|
||||
|
@ -74,6 +76,12 @@ extension MetaLabel {
|
|||
case .autoCompletion:
|
||||
font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 17, weight: .semibold), maximumPointSize: 22)
|
||||
textColor = Asset.Colors.brandBlue.color
|
||||
case .accountListName:
|
||||
font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 17, weight: .regular), maximumPointSize: 22)
|
||||
textColor = Asset.Colors.Label.primary.color
|
||||
case .accountListUsername:
|
||||
font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 15, weight: .regular), maximumPointSize: 20)
|
||||
textColor = Asset.Colors.Label.secondary.color
|
||||
}
|
||||
|
||||
self.font = font
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
//
|
||||
// WizardPreference.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by Cirno MainasuK on 2021-9-15.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
extension UserDefaults {
|
||||
@objc dynamic var didShowMultipleAccountSwitchWizard: Bool {
|
||||
get { return bool(forKey: #function) }
|
||||
set { self[#function] = newValue }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,137 @@
|
|||
//
|
||||
// AccountListViewModel.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by Cirno MainasuK on 2021-9-13.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Combine
|
||||
import CoreData
|
||||
import CoreDataStack
|
||||
import MastodonSDK
|
||||
import MastodonMeta
|
||||
|
||||
final class AccountListViewModel {
|
||||
|
||||
var disposeBag = Set<AnyCancellable>()
|
||||
|
||||
// input
|
||||
let context: AppContext
|
||||
|
||||
// output
|
||||
let authentications = CurrentValueSubject<[Item], Never>([])
|
||||
let activeUserID = CurrentValueSubject<Mastodon.Entity.Account.ID?, Never>(nil)
|
||||
var diffableDataSource: UITableViewDiffableDataSource<Section, Item>!
|
||||
|
||||
init(context: AppContext) {
|
||||
self.context = context
|
||||
|
||||
Publishers.CombineLatest(
|
||||
context.authenticationService.mastodonAuthentications,
|
||||
context.authenticationService.activeMastodonAuthentication
|
||||
)
|
||||
.sink { [weak self] authentications, activeAuthentication in
|
||||
guard let self = self else { return }
|
||||
var items: [Item] = []
|
||||
var activeUserID: Mastodon.Entity.Account.ID?
|
||||
for authentication in authentications {
|
||||
let item = Item.authentication(objectID: authentication.objectID)
|
||||
items.append(item)
|
||||
if authentication === activeAuthentication {
|
||||
activeUserID = authentication.userID
|
||||
}
|
||||
}
|
||||
self.authentications.value = items
|
||||
self.activeUserID.value = activeUserID
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
||||
authentications
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] authentications in
|
||||
guard let self = self else { return }
|
||||
guard let diffableDataSource = self.diffableDataSource else { return }
|
||||
|
||||
var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
|
||||
snapshot.appendSections([.main])
|
||||
snapshot.appendItems(authentications, toSection: .main)
|
||||
snapshot.appendItems([.addAccount], toSection: .main)
|
||||
|
||||
diffableDataSource.apply(snapshot)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension AccountListViewModel {
|
||||
enum Section: Hashable {
|
||||
case main
|
||||
}
|
||||
|
||||
enum Item: Hashable {
|
||||
case authentication(objectID: NSManagedObjectID)
|
||||
case addAccount
|
||||
}
|
||||
|
||||
func setupDiffableDataSource(
|
||||
tableView: UITableView,
|
||||
managedObjectContext: NSManagedObjectContext
|
||||
) {
|
||||
diffableDataSource = UITableViewDiffableDataSource(tableView: tableView) { tableView, indexPath, item in
|
||||
switch item {
|
||||
case .authentication(let objectID):
|
||||
let authentication = managedObjectContext.object(with: objectID) as! MastodonAuthentication
|
||||
let user = authentication.user
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: AccountListTableViewCell.self), for: indexPath) as! AccountListTableViewCell
|
||||
AccountListViewModel.configure(
|
||||
cell: cell,
|
||||
user: user,
|
||||
activeUserID: self.activeUserID.eraseToAnyPublisher()
|
||||
)
|
||||
return cell
|
||||
case .addAccount:
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: AddAccountTableViewCell.self), for: indexPath) as! AddAccountTableViewCell
|
||||
return cell
|
||||
}
|
||||
}
|
||||
|
||||
var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
|
||||
snapshot.appendSections([.main])
|
||||
diffableDataSource?.apply(snapshot)
|
||||
}
|
||||
|
||||
static func configure(
|
||||
cell: AccountListTableViewCell,
|
||||
user: MastodonUser,
|
||||
activeUserID: AnyPublisher<Mastodon.Entity.Account.ID?, Never>
|
||||
) {
|
||||
// avatar
|
||||
cell.configure(with: AvatarConfigurableViewConfiguration(avatarImageURL: user.avatarImageURL()))
|
||||
|
||||
// name
|
||||
do {
|
||||
let content = MastodonContent(content: user.displayNameWithFallback, emojis: user.emojiMeta)
|
||||
let metaContent = try MastodonMetaContent.convert(document: content)
|
||||
cell.nameLabel.configure(content: metaContent)
|
||||
} catch {
|
||||
assertionFailure()
|
||||
cell.nameLabel.configure(content: PlaintextMetaContent(string: user.displayNameWithFallback))
|
||||
}
|
||||
|
||||
// username
|
||||
let usernameMetaContent = PlaintextMetaContent(string: "@" + user.acctWithDomain)
|
||||
cell.usernameLabel.configure(content: usernameMetaContent)
|
||||
|
||||
// checkmark
|
||||
activeUserID
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { userID in
|
||||
let isCurrentUser = user.id == userID
|
||||
cell.tintColor = .label
|
||||
cell.accessoryType = isCurrentUser ? .checkmark : .none
|
||||
}
|
||||
.store(in: &cell.disposeBag)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
//
|
||||
// AccountViewController.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by Cirno MainasuK on 2021-9-13.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import CoreDataStack
|
||||
import PanModal
|
||||
|
||||
final class AccountListViewController: UIViewController, NeedsDependency {
|
||||
|
||||
let logger = Logger(subsystem: "AccountListViewController", category: "UI")
|
||||
|
||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||
|
||||
var disposeBag = Set<AnyCancellable>()
|
||||
private(set) lazy var viewModel = AccountListViewModel(context: context)
|
||||
|
||||
private(set) lazy var addBarButtonItem: UIBarButtonItem = {
|
||||
let barButtonItem = UIBarButtonItem(
|
||||
image: UIImage(systemName: "plus"),
|
||||
style: .plain,
|
||||
target: self,
|
||||
action: #selector(AccountListViewController.addBarButtonItem(_:))
|
||||
)
|
||||
return barButtonItem
|
||||
}()
|
||||
|
||||
let dragIndicatorView = DragIndicatorView()
|
||||
|
||||
private(set) lazy var tableView: UITableView = {
|
||||
let tableView = UITableView()
|
||||
tableView.register(AccountListTableViewCell.self, forCellReuseIdentifier: String(describing: AccountListTableViewCell.self))
|
||||
tableView.register(AddAccountTableViewCell.self, forCellReuseIdentifier: String(describing: AddAccountTableViewCell.self))
|
||||
tableView.backgroundColor = .clear
|
||||
tableView.tableFooterView = UIView()
|
||||
tableView.separatorStyle = .none
|
||||
return tableView
|
||||
}()
|
||||
|
||||
}
|
||||
|
||||
// MARK: - PanModalPresentable
|
||||
extension AccountListViewController: PanModalPresentable {
|
||||
var panScrollable: UIScrollView? { tableView }
|
||||
var showDragIndicator: Bool { false }
|
||||
|
||||
var shortFormHeight: PanModalHeight {
|
||||
return .contentHeight(300)
|
||||
}
|
||||
|
||||
var longFormHeight: PanModalHeight {
|
||||
return .maxHeightWithTopInset(40)
|
||||
}
|
||||
}
|
||||
|
||||
extension AccountListViewController {
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
view.backgroundColor = ThemeService.shared.currentTheme.value.systemBackgroundColor.withAlphaComponent(0.9)
|
||||
ThemeService.shared.currentTheme
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] theme in
|
||||
guard let self = self else { return }
|
||||
self.setupBackgroundColor(theme: theme)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
navigationItem.rightBarButtonItem = addBarButtonItem
|
||||
|
||||
dragIndicatorView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(dragIndicatorView)
|
||||
NSLayoutConstraint.activate([
|
||||
dragIndicatorView.topAnchor.constraint(equalTo: view.topAnchor),
|
||||
dragIndicatorView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||
dragIndicatorView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
||||
dragIndicatorView.heightAnchor.constraint(equalToConstant: DragIndicatorView.height).priority(.required - 1),
|
||||
])
|
||||
|
||||
tableView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(tableView)
|
||||
NSLayoutConstraint.activate([
|
||||
tableView.topAnchor.constraint(equalTo: dragIndicatorView.bottomAnchor),
|
||||
tableView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||
tableView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
||||
tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
|
||||
])
|
||||
|
||||
tableView.delegate = self
|
||||
viewModel.setupDiffableDataSource(
|
||||
tableView: tableView,
|
||||
managedObjectContext: context.managedObjectContext
|
||||
)
|
||||
|
||||
if UIAccessibility.isVoiceOverRunning {
|
||||
let dragIndicatorTapGestureRecognizer = UITapGestureRecognizer.singleTapGestureRecognizer
|
||||
dragIndicatorView.addGestureRecognizer(dragIndicatorTapGestureRecognizer)
|
||||
dragIndicatorTapGestureRecognizer.addTarget(self, action: #selector(AccountListViewController.dragIndicatorTapGestureRecognizerHandler(_:)))
|
||||
dragIndicatorView.isAccessibilityElement = true
|
||||
dragIndicatorView.accessibilityLabel = "Dismiss Account Switcher"
|
||||
}
|
||||
}
|
||||
|
||||
private func setupBackgroundColor(theme: Theme) {
|
||||
view.backgroundColor = theme.systemBackgroundColor.withAlphaComponent(0.9)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension AccountListViewController {
|
||||
|
||||
@objc private func addBarButtonItem(_ sender: UIBarButtonItem) {
|
||||
logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)")
|
||||
coordinator.present(scene: .welcome, from: self, transition: .modal(animated: true, completion: nil))
|
||||
}
|
||||
|
||||
@objc private func dragIndicatorTapGestureRecognizerHandler(_ sender: UITapGestureRecognizer) {
|
||||
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)")
|
||||
dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - UITableViewDelegate
|
||||
extension AccountListViewController: UITableViewDelegate {
|
||||
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
tableView.deselectRow(at: indexPath, animated: true)
|
||||
|
||||
guard let diffableDataSource = viewModel.diffableDataSource else { return }
|
||||
guard let item = diffableDataSource.itemIdentifier(for: indexPath) else { return }
|
||||
|
||||
switch item {
|
||||
case .authentication(let objectID):
|
||||
assert(Thread.isMainThread)
|
||||
let authentication = context.managedObjectContext.object(with: objectID) as! MastodonAuthentication
|
||||
context.authenticationService.activeMastodonUser(domain: authentication.domain, userID: authentication.userID)
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] result in
|
||||
guard let self = self else { return }
|
||||
self.coordinator.setup()
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
case .addAccount:
|
||||
// TODO: add dismiss entry for welcome scene
|
||||
coordinator.present(scene: .welcome, from: self, transition: .modal(animated: true, completion: nil))
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
//
|
||||
// AccountListTableViewCell.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by Cirno MainasuK on 2021-9-13.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Combine
|
||||
import FLAnimatedImage
|
||||
import MetaTextKit
|
||||
|
||||
final class AccountListTableViewCell: UITableViewCell {
|
||||
|
||||
var disposeBag = Set<AnyCancellable>()
|
||||
|
||||
let avatarButton = CircleAvatarButton(frame: .zero)
|
||||
let nameLabel = MetaLabel(style: .accountListName)
|
||||
let usernameLabel = MetaLabel(style: .accountListUsername)
|
||||
let separatorLine = UIView.separatorLine
|
||||
|
||||
override func prepareForReuse() {
|
||||
super.prepareForReuse()
|
||||
|
||||
disposeBag.removeAll()
|
||||
}
|
||||
|
||||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
_init()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
_init()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension AccountListTableViewCell {
|
||||
|
||||
private func _init() {
|
||||
avatarButton.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(avatarButton)
|
||||
NSLayoutConstraint.activate([
|
||||
avatarButton.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor),
|
||||
avatarButton.centerYAnchor.constraint(equalTo: contentView.centerYAnchor),
|
||||
avatarButton.heightAnchor.constraint(equalTo: avatarButton.widthAnchor, multiplier: 1.0).priority(.required - 1),
|
||||
avatarButton.heightAnchor.constraint(greaterThanOrEqualToConstant: 30).priority(.required - 1),
|
||||
])
|
||||
avatarButton.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
||||
avatarButton.setContentHuggingPriority(.defaultLow, for: .vertical)
|
||||
|
||||
let labelContainerStackView = UIStackView()
|
||||
labelContainerStackView.axis = .vertical
|
||||
labelContainerStackView.distribution = .equalCentering
|
||||
labelContainerStackView.spacing = 2
|
||||
labelContainerStackView.distribution = .fillProportionally
|
||||
labelContainerStackView.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(labelContainerStackView)
|
||||
NSLayoutConstraint.activate([
|
||||
labelContainerStackView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 8),
|
||||
labelContainerStackView.leadingAnchor.constraint(equalTo: avatarButton.trailingAnchor, constant: 10),
|
||||
contentView.bottomAnchor.constraint(equalTo: labelContainerStackView.bottomAnchor, constant: 10),
|
||||
avatarButton.heightAnchor.constraint(equalTo: labelContainerStackView.heightAnchor, multiplier: 0.8).priority(.required - 10),
|
||||
labelContainerStackView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
||||
])
|
||||
|
||||
labelContainerStackView.addArrangedSubview(nameLabel)
|
||||
labelContainerStackView.addArrangedSubview(usernameLabel)
|
||||
|
||||
avatarButton.isUserInteractionEnabled = false
|
||||
nameLabel.isUserInteractionEnabled = false
|
||||
usernameLabel.isUserInteractionEnabled = false
|
||||
|
||||
separatorLine.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(separatorLine)
|
||||
NSLayoutConstraint.activate([
|
||||
separatorLine.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor),
|
||||
separatorLine.trailingAnchor.constraint(equalTo: trailingAnchor), // needs align to edge
|
||||
separatorLine.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
||||
separatorLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: contentView)),
|
||||
])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - AvatarConfigurableView
|
||||
extension AccountListTableViewCell: AvatarConfigurableView {
|
||||
static var configurableAvatarImageSize: CGSize { CGSize(width: 30, height: 30) }
|
||||
static var configurableAvatarImageCornerRadius: CGFloat { 0 }
|
||||
var configurableAvatarImageView: FLAnimatedImageView? { avatarButton.avatarImageView }
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
//
|
||||
// AddAccountTableViewCell.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by Cirno MainasuK on 2021-9-14.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MetaTextKit
|
||||
|
||||
final class AddAccountTableViewCell: UITableViewCell {
|
||||
|
||||
let iconImageView: UIImageView = {
|
||||
let image = UIImage(systemName: "plus.circle.fill")!
|
||||
let imageView = UIImageView(image: image)
|
||||
imageView.tintColor = Asset.Colors.Label.primary.color
|
||||
return imageView
|
||||
}()
|
||||
let titleLabel: UILabel = {
|
||||
let label = UILabel()
|
||||
label.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 17, weight: .regular), maximumPointSize: 22)
|
||||
label.textColor = Asset.Colors.Label.primary.color
|
||||
label.text = "Add Account" // TODO: i18n
|
||||
return label
|
||||
}()
|
||||
let usernameLabel = MetaLabel(style: .accountListUsername)
|
||||
let separatorLine = UIView.separatorLine
|
||||
|
||||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
_init()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
_init()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension AddAccountTableViewCell {
|
||||
|
||||
private func _init() {
|
||||
iconImageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(iconImageView)
|
||||
NSLayoutConstraint.activate([
|
||||
iconImageView.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor),
|
||||
iconImageView.centerYAnchor.constraint(equalTo: contentView.centerYAnchor),
|
||||
iconImageView.heightAnchor.constraint(equalTo: iconImageView.widthAnchor, multiplier: 1.0).priority(.required - 1),
|
||||
iconImageView.heightAnchor.constraint(greaterThanOrEqualToConstant: 30).priority(.required - 1),
|
||||
])
|
||||
iconImageView.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
||||
iconImageView.setContentHuggingPriority(.defaultLow, for: .vertical)
|
||||
|
||||
titleLabel.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(titleLabel)
|
||||
NSLayoutConstraint.activate([
|
||||
titleLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 19),
|
||||
titleLabel.leadingAnchor.constraint(equalTo: iconImageView.trailingAnchor, constant: 10),
|
||||
contentView.bottomAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 19),
|
||||
iconImageView.heightAnchor.constraint(equalTo: titleLabel.heightAnchor, multiplier: 1.0).priority(.required - 10),
|
||||
titleLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
||||
])
|
||||
|
||||
separatorLine.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(separatorLine)
|
||||
NSLayoutConstraint.activate([
|
||||
separatorLine.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
||||
separatorLine.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
||||
separatorLine.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
||||
separatorLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: contentView)),
|
||||
])
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
//
|
||||
// DragIndicatorView.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by Cirno MainasuK on 2021-9-14.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
final class DragIndicatorView: UIView {
|
||||
|
||||
static let height: CGFloat = 38
|
||||
|
||||
let barView = UIView()
|
||||
let separatorLine = UIView.separatorLine
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
_init()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
_init()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension DragIndicatorView {
|
||||
|
||||
private func _init() {
|
||||
barView.backgroundColor = Asset.Colors.Label.secondary.color
|
||||
barView.layer.masksToBounds = true
|
||||
barView.layer.cornerRadius = 2.5
|
||||
|
||||
barView.translatesAutoresizingMaskIntoConstraints = false
|
||||
addSubview(barView)
|
||||
NSLayoutConstraint.activate([
|
||||
barView.centerXAnchor.constraint(equalTo: centerXAnchor),
|
||||
barView.centerYAnchor.constraint(equalTo: centerYAnchor),
|
||||
barView.heightAnchor.constraint(equalToConstant: 5).priority(.required - 1),
|
||||
barView.widthAnchor.constraint(equalToConstant: 36).priority(.required - 1),
|
||||
])
|
||||
|
||||
separatorLine.translatesAutoresizingMaskIntoConstraints = false
|
||||
addSubview(separatorLine)
|
||||
NSLayoutConstraint.activate([
|
||||
separatorLine.leadingAnchor.constraint(equalTo: leadingAnchor),
|
||||
separatorLine.trailingAnchor.constraint(equalTo: trailingAnchor),
|
||||
separatorLine.bottomAnchor.constraint(equalTo: bottomAnchor),
|
||||
separatorLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: self)),
|
||||
])
|
||||
}
|
||||
|
||||
}
|
|
@ -23,20 +23,9 @@ extension HomeTimelineViewController {
|
|||
identifier: nil,
|
||||
options: .displayInline,
|
||||
children: [
|
||||
UIAction(title: "Show FLEX", image: nil, attributes: [], handler: { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showFLEXAction(action)
|
||||
}),
|
||||
showMenu,
|
||||
moveMenu,
|
||||
dropMenu,
|
||||
UIAction(title: "Show Welcome", image: UIImage(systemName: "figure.walk"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showWelcomeAction(action)
|
||||
},
|
||||
UIAction(title: "Show Confirm Email", image: UIImage(systemName: "envelope"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showConfirmEmail(action)
|
||||
},
|
||||
UIAction(title: "Toggle EmptyView", image: UIImage(systemName: "clear"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
if self.emptyView.superview != nil {
|
||||
|
@ -45,18 +34,6 @@ extension HomeTimelineViewController {
|
|||
self.showEmptyView()
|
||||
}
|
||||
},
|
||||
UIAction(title: "Show Public Timeline", image: UIImage(systemName: "list.dash"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showPublicTimelineAction(action)
|
||||
},
|
||||
UIAction(title: "Show Profile", image: UIImage(systemName: "person.crop.circle"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showProfileAction(action)
|
||||
},
|
||||
UIAction(title: "Show Thread", image: UIImage(systemName: "bubble.left.and.bubble.right"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showThreadAction(action)
|
||||
},
|
||||
UIAction(title: "Settings", image: UIImage(systemName: "gear"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showSettings(action)
|
||||
|
@ -70,6 +47,45 @@ extension HomeTimelineViewController {
|
|||
return menu
|
||||
}
|
||||
|
||||
var showMenu: UIMenu {
|
||||
return UIMenu(
|
||||
title: "Show…",
|
||||
image: UIImage(systemName: "plus.rectangle.on.rectangle"),
|
||||
identifier: nil,
|
||||
options: [],
|
||||
children: [
|
||||
UIAction(title: "FLEX", image: nil, attributes: [], handler: { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showFLEXAction(action)
|
||||
}),
|
||||
UIAction(title: "Welcome", image: UIImage(systemName: "figure.walk"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showWelcomeAction(action)
|
||||
},
|
||||
UIAction(title: "Confirm Email", image: UIImage(systemName: "envelope"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showConfirmEmail(action)
|
||||
},
|
||||
UIAction(title: "Account List", image: UIImage(systemName: "person"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showAccountList(action)
|
||||
},
|
||||
UIAction(title: "Public Timeline", image: UIImage(systemName: "list.dash"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showPublicTimelineAction(action)
|
||||
},
|
||||
UIAction(title: "Profile", image: UIImage(systemName: "person.crop.circle"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showProfileAction(action)
|
||||
},
|
||||
UIAction(title: "Thread", image: UIImage(systemName: "bubble.left.and.bubble.right"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showThreadAction(action)
|
||||
},
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
var moveMenu: UIMenu {
|
||||
return UIMenu(
|
||||
title: "Move to…",
|
||||
|
@ -322,6 +338,10 @@ extension HomeTimelineViewController {
|
|||
coordinator.present(scene: .mastodonConfirmEmail(viewModel: mastodonConfirmEmailViewModel), from: nil, transition: .modal(animated: true, completion: nil))
|
||||
}
|
||||
|
||||
@objc private func showAccountList(_ sender: UIAction) {
|
||||
coordinator.present(scene: .accountList, from: self, transition: .modal(animated: true, completion: nil))
|
||||
}
|
||||
|
||||
@objc private func showPublicTimelineAction(_ sender: UIAction) {
|
||||
coordinator.present(scene: .publicTimeline, from: self, transition: .show)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
//
|
||||
// MainTabBarController+Wizard.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by Cirno MainasuK on 2021-9-15.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
|
||||
protocol WizardDelegate: AnyObject {
|
||||
func spotlight(item: MainTabBarController.Wizard.Item) -> UIBezierPath
|
||||
func layoutWizardCard(_ wizard: MainTabBarController.Wizard, item: MainTabBarController.Wizard.Item)
|
||||
}
|
||||
|
||||
extension MainTabBarController {
|
||||
class Wizard {
|
||||
|
||||
let logger = Logger(subsystem: "Wizard", category: "UI")
|
||||
|
||||
weak var delegate: WizardDelegate?
|
||||
|
||||
private(set) var items: [Item]
|
||||
|
||||
let backgroundView: UIView = {
|
||||
let view = UIView()
|
||||
view.backgroundColor = UIColor.black.withAlphaComponent(0.7)
|
||||
return view
|
||||
}()
|
||||
|
||||
init() {
|
||||
var items: [Item] = []
|
||||
if !UserDefaults.shared.didShowMultipleAccountSwitchWizard {
|
||||
items.append(.multipleAccountSwitch)
|
||||
}
|
||||
self.items = items
|
||||
|
||||
let backgroundTapGestureRecognizer = UITapGestureRecognizer.singleTapGestureRecognizer
|
||||
backgroundTapGestureRecognizer.addTarget(self, action: #selector(MainTabBarController.Wizard.backgroundTapGestureRecognizerHandler(_:)))
|
||||
backgroundView.addGestureRecognizer(backgroundTapGestureRecognizer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension MainTabBarController.Wizard {
|
||||
enum Item {
|
||||
case multipleAccountSwitch
|
||||
|
||||
var title: String {
|
||||
return "New in Mastodon"
|
||||
}
|
||||
|
||||
var description: String {
|
||||
switch self {
|
||||
case .multipleAccountSwitch:
|
||||
return "Switch between multiple accounts by holding the profile button."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension MainTabBarController.Wizard {
|
||||
|
||||
func setup(in view: UIView) {
|
||||
assert(delegate != nil, "need set delegate before use")
|
||||
backgroundView.frame = view.bounds
|
||||
backgroundView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(backgroundView)
|
||||
NSLayoutConstraint.activate([
|
||||
backgroundView.topAnchor.constraint(equalTo: view.topAnchor),
|
||||
backgroundView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||
backgroundView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
||||
backgroundView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
|
||||
])
|
||||
}
|
||||
|
||||
func consume() {
|
||||
guard !items.isEmpty else {
|
||||
backgroundView.removeFromSuperview()
|
||||
return
|
||||
}
|
||||
let item = items.removeFirst()
|
||||
perform(item: item)
|
||||
}
|
||||
|
||||
private func perform(item: Item) {
|
||||
guard let delegate = delegate else {
|
||||
assertionFailure()
|
||||
return
|
||||
}
|
||||
|
||||
prepareForReuse()
|
||||
|
||||
// add spotlight
|
||||
let spotlight = delegate.spotlight(item: item)
|
||||
let maskLayer = CAShapeLayer()
|
||||
let path = UIBezierPath(rect: backgroundView.bounds)
|
||||
path.append(spotlight)
|
||||
maskLayer.fillRule = .evenOdd
|
||||
maskLayer.path = path.cgPath
|
||||
backgroundView.layer.mask = maskLayer
|
||||
|
||||
// layout wizard card
|
||||
delegate.layoutWizardCard(self, item: item)
|
||||
}
|
||||
|
||||
private func prepareForReuse() {
|
||||
backgroundView.subviews.forEach { subview in
|
||||
subview.removeFromSuperview()
|
||||
}
|
||||
backgroundView.mask = nil
|
||||
backgroundView.layer.mask = nil
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension MainTabBarController.Wizard {
|
||||
@objc private func backgroundTapGestureRecognizerHandler(_ sender: UITapGestureRecognizer) {
|
||||
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)")
|
||||
|
||||
// TODO: toggle current item preference flag
|
||||
consume()
|
||||
}
|
||||
}
|
|
@ -12,11 +12,18 @@ import SafariServices
|
|||
|
||||
class MainTabBarController: UITabBarController {
|
||||
|
||||
let logger = Logger(subsystem: "MainTabBarController", category: "UI")
|
||||
|
||||
var disposeBag = Set<AnyCancellable>()
|
||||
|
||||
weak var context: AppContext!
|
||||
weak var coordinator: SceneCoordinator!
|
||||
|
||||
static let avatarButtonSize = CGSize(width: 28, height: 28)
|
||||
let avatarButton = CircleAvatarButton()
|
||||
|
||||
let wizard = Wizard()
|
||||
|
||||
var currentTab = Tab.home
|
||||
|
||||
enum Tab: Int, CaseIterable {
|
||||
|
@ -25,6 +32,10 @@ class MainTabBarController: UITabBarController {
|
|||
case notification
|
||||
case me
|
||||
|
||||
var tag: Int {
|
||||
return rawValue
|
||||
}
|
||||
|
||||
var title: String {
|
||||
switch self {
|
||||
case .home: return L10n.Common.Controls.Tabs.home
|
||||
|
@ -121,6 +132,7 @@ extension MainTabBarController {
|
|||
let tabs = Tab.allCases
|
||||
let viewControllers: [UIViewController] = tabs.map { tab in
|
||||
let viewController = tab.viewController(context: context, coordinator: coordinator)
|
||||
viewController.tabBarItem.tag = tab.tag
|
||||
viewController.tabBarItem.title = tab.title
|
||||
viewController.tabBarItem.image = tab.image
|
||||
viewController.tabBarItem.accessibilityLabel = tab.title
|
||||
|
@ -204,11 +216,105 @@ extension MainTabBarController {
|
|||
}
|
||||
.store(in: &disposeBag)
|
||||
|
||||
layoutAvatarButton()
|
||||
context.authenticationService.activeMastodonAuthentication
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] activeMastodonAuthentication in
|
||||
guard let self = self else { return }
|
||||
|
||||
let avatarImageURL = activeMastodonAuthentication?.user.avatarImageURL()
|
||||
self.avatarButton.avatarImageView.setImage(
|
||||
url: avatarImageURL,
|
||||
placeholder: .placeholder(color: .systemFill),
|
||||
scaleToSize: MainTabBarController.avatarButtonSize
|
||||
)
|
||||
|
||||
// a11y
|
||||
let _profileTabItem = self.tabBar.items?.first { item in item.tag == Tab.me.tag }
|
||||
guard let profileTabItem = _profileTabItem else { return }
|
||||
|
||||
let currentUserDisplayName = activeMastodonAuthentication?.user.displayNameWithFallback ?? "no user"
|
||||
profileTabItem.accessibilityHint = "Current selected profile: \(currentUserDisplayName). Double tap then hold to show account switcher"
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
||||
wizard.delegate = self
|
||||
wizard.setup(in: view)
|
||||
|
||||
let tabBarLongPressGestureRecognizer = UILongPressGestureRecognizer()
|
||||
tabBarLongPressGestureRecognizer.addTarget(self, action: #selector(MainTabBarController.tabBarLongPressGestureRecognizerHandler(_:)))
|
||||
tabBar.addGestureRecognizer(tabBarLongPressGestureRecognizer)
|
||||
|
||||
#if DEBUG
|
||||
// selectedIndex = 1
|
||||
#endif
|
||||
}
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
|
||||
wizard.consume()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension MainTabBarController {
|
||||
@objc private func tabBarLongPressGestureRecognizerHandler(_ sender: UILongPressGestureRecognizer) {
|
||||
guard sender.state == .began else { return }
|
||||
|
||||
var _tab: Tab?
|
||||
let location = sender.location(in: tabBar)
|
||||
for item in tabBar.items ?? [] {
|
||||
guard let tab = Tab(rawValue: item.tag) else { continue }
|
||||
guard let view = item.value(forKey: "view") as? UIView else { continue }
|
||||
guard view.frame.contains(location) else { continue}
|
||||
|
||||
_tab = tab
|
||||
break
|
||||
}
|
||||
|
||||
guard let tab = _tab else { return }
|
||||
logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): long press \(tab.title) tab")
|
||||
|
||||
switch tab {
|
||||
case .me:
|
||||
coordinator.present(scene: .accountList, from: nil, transition: .panModal)
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension MainTabBarController {
|
||||
private func layoutAvatarButton() {
|
||||
guard avatarButton.superview == nil else { return }
|
||||
|
||||
let _profileTabItem = self.tabBar.items?.first { item in item.tag == Tab.me.tag }
|
||||
guard let profileTabItem = _profileTabItem else { return }
|
||||
guard let view = profileTabItem.value(forKey: "view") as? UIView else {
|
||||
return
|
||||
}
|
||||
|
||||
let _anchorImageView = view.subviews.first { subview in subview is UIImageView } as? UIImageView
|
||||
guard let anchorImageView = _anchorImageView else {
|
||||
assertionFailure()
|
||||
return
|
||||
}
|
||||
anchorImageView.alpha = 0
|
||||
|
||||
self.avatarButton.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(self.avatarButton)
|
||||
NSLayoutConstraint.activate([
|
||||
self.avatarButton.centerXAnchor.constraint(equalTo: view.centerXAnchor),
|
||||
self.avatarButton.centerYAnchor.constraint(equalTo: anchorImageView.centerYAnchor),
|
||||
self.avatarButton.widthAnchor.constraint(equalToConstant: MainTabBarController.avatarButtonSize.width).priority(.required - 1),
|
||||
self.avatarButton.heightAnchor.constraint(equalToConstant: MainTabBarController.avatarButtonSize.height).priority(.required - 1),
|
||||
])
|
||||
self.avatarButton.setContentHuggingPriority(.required - 1, for: .horizontal)
|
||||
self.avatarButton.setContentHuggingPriority(.required - 1, for: .vertical)
|
||||
self.avatarButton.isUserInteractionEnabled = false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension MainTabBarController {
|
||||
|
@ -239,6 +345,53 @@ extension MainTabBarController: UITabBarControllerDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
// MARK: - WizardDataSource
|
||||
extension MainTabBarController: WizardDelegate {
|
||||
func spotlight(item: Wizard.Item) -> UIBezierPath {
|
||||
switch item {
|
||||
case .multipleAccountSwitch:
|
||||
guard let avatarButtonFrameInView = avatarButtonFrameInView() else {
|
||||
return UIBezierPath()
|
||||
}
|
||||
return UIBezierPath(ovalIn: avatarButtonFrameInView)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func layoutWizardCard(_ wizard: MainTabBarController.Wizard, item: Wizard.Item) {
|
||||
switch item {
|
||||
case .multipleAccountSwitch:
|
||||
guard let avatarButtonFrameInView = avatarButtonFrameInView() else {
|
||||
return
|
||||
}
|
||||
let anchorView = UIView()
|
||||
anchorView.frame = avatarButtonFrameInView
|
||||
wizard.backgroundView.addSubview(anchorView)
|
||||
|
||||
let wizardCardView = WizardCardView()
|
||||
wizardCardView.arrowRectCorner = view.traitCollection.layoutDirection == .leftToRight ? .bottomRight : .bottomLeft
|
||||
wizardCardView.titleLabel.text = item.title
|
||||
wizardCardView.descriptionLabel.text = item.description
|
||||
|
||||
wizardCardView.translatesAutoresizingMaskIntoConstraints = false
|
||||
wizard.backgroundView.addSubview(wizardCardView)
|
||||
NSLayoutConstraint.activate([
|
||||
anchorView.topAnchor.constraint(equalTo: wizardCardView.bottomAnchor, constant: 13), // 13pt spacing
|
||||
wizardCardView.trailingAnchor.constraint(equalTo: anchorView.centerXAnchor),
|
||||
wizardCardView.widthAnchor.constraint(equalTo: wizard.backgroundView.widthAnchor, multiplier: 2.0/3.0).priority(.required - 1),
|
||||
])
|
||||
wizardCardView.setContentHuggingPriority(.defaultLow, for: .vertical)
|
||||
}
|
||||
}
|
||||
|
||||
private func avatarButtonFrameInView() -> CGRect? {
|
||||
guard let superview = avatarButton.superview else {
|
||||
assertionFailure()
|
||||
return nil
|
||||
}
|
||||
return superview.convert(avatarButton.frame, to: view)
|
||||
}
|
||||
}
|
||||
|
||||
// HIG: keyboard UX
|
||||
// https://developer.apple.com/design/human-interface-guidelines/macos/user-interaction/keyboard/
|
||||
|
|
|
@ -222,7 +222,8 @@ extension MastodonPickServerViewController {
|
|||
assertionFailure(error.localizedDescription)
|
||||
case .success(let isActived):
|
||||
assert(isActived)
|
||||
self.dismiss(animated: true, completion: nil)
|
||||
// self.dismiss(animated: true, completion: nil)
|
||||
self.coordinator.setup()
|
||||
}
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
//
|
||||
// WizardCardView.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by Cirno MainasuK on 2021-9-15.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
final class WizardCardView: UIView {
|
||||
|
||||
static let bubbleArrowHeight: CGFloat = 17
|
||||
static let bubbleArrowWidth: CGFloat = 20
|
||||
|
||||
let contentView = UIView()
|
||||
|
||||
let backgroundShapeLayer = CAShapeLayer()
|
||||
var arrowRectCorner: UIRectCorner = .bottomRight
|
||||
|
||||
let titleLabel: UILabel = {
|
||||
let label = UILabel()
|
||||
label.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 15, weight: .semibold))
|
||||
label.textColor = .black
|
||||
return label
|
||||
}()
|
||||
|
||||
let descriptionLabel: UILabel = {
|
||||
let label = UILabel()
|
||||
label.font = UIFontMetrics(forTextStyle: .subheadline).scaledFont(for: .systemFont(ofSize: 13, weight: .regular))
|
||||
label.textColor = .black
|
||||
label.numberOfLines = 0
|
||||
return label
|
||||
}()
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
_init()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
_init()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension WizardCardView {
|
||||
private func _init() {
|
||||
layer.masksToBounds = false
|
||||
layer.addSublayer(backgroundShapeLayer)
|
||||
|
||||
contentView.translatesAutoresizingMaskIntoConstraints = false
|
||||
addSubview(contentView)
|
||||
NSLayoutConstraint.activate([
|
||||
contentView.topAnchor.constraint(equalTo: topAnchor, constant: WizardCardView.bubbleArrowHeight),
|
||||
contentView.leadingAnchor.constraint(equalTo: leadingAnchor),
|
||||
trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
||||
bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: WizardCardView.bubbleArrowHeight),
|
||||
])
|
||||
|
||||
let containerStackView = UIStackView()
|
||||
containerStackView.axis = .vertical
|
||||
containerStackView.spacing = 2
|
||||
containerStackView.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(containerStackView)
|
||||
NSLayoutConstraint.activate([
|
||||
containerStackView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 5),
|
||||
containerStackView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 7),
|
||||
contentView.trailingAnchor.constraint(equalTo: containerStackView.trailingAnchor, constant: 24),
|
||||
contentView.bottomAnchor.constraint(equalTo: containerStackView.bottomAnchor, constant: 5),
|
||||
])
|
||||
|
||||
containerStackView.addArrangedSubview(titleLabel)
|
||||
containerStackView.addArrangedSubview(descriptionLabel)
|
||||
}
|
||||
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
|
||||
let radius: CGFloat = 5
|
||||
let rect = contentView.frame
|
||||
let path = UIBezierPath()
|
||||
|
||||
switch arrowRectCorner {
|
||||
case .bottomRight:
|
||||
path.move(to: CGPoint(x: rect.maxX - WizardCardView.bubbleArrowWidth, y: rect.maxY + radius))
|
||||
path.addArc(withCenter: CGPoint(x: rect.minX, y: rect.maxY), radius: radius, startAngle: .pi / 2, endAngle: .pi, clockwise: true)
|
||||
path.addArc(withCenter: CGPoint(x: rect.minX, y: rect.minY), radius: radius, startAngle: .pi, endAngle: .pi / 2 * 3, clockwise: true)
|
||||
path.addArc(withCenter: CGPoint(x: rect.maxX, y: rect.minY), radius: radius, startAngle: .pi / 2 * 3, endAngle: .pi * 2, clockwise: true)
|
||||
path.addLine(to: CGPoint(x: rect.maxX + radius, y: rect.maxY + radius + WizardCardView.bubbleArrowHeight))
|
||||
path.close()
|
||||
case .bottomLeft:
|
||||
path.move(to: CGPoint(x: rect.minX + WizardCardView.bubbleArrowWidth, y: rect.maxY + radius))
|
||||
path.addArc(withCenter: CGPoint(x: rect.maxX, y: rect.maxY), radius: radius, startAngle: .pi / 2, endAngle: 0, clockwise: false)
|
||||
path.addArc(withCenter: CGPoint(x: rect.maxX, y: rect.minY), radius: radius, startAngle: 0, endAngle: -.pi / 2, clockwise: false)
|
||||
path.addArc(withCenter: CGPoint(x: rect.minX, y: rect.minY), radius: radius, startAngle: -.pi / 2, endAngle: -.pi, clockwise: false)
|
||||
path.addLine(to: CGPoint(x: rect.minX - radius, y: rect.maxY + radius + WizardCardView.bubbleArrowHeight))
|
||||
path.close()
|
||||
default:
|
||||
assertionFailure("FIXME")
|
||||
}
|
||||
|
||||
backgroundShapeLayer.lineCap = .round
|
||||
backgroundShapeLayer.lineJoin = .round
|
||||
backgroundShapeLayer.lineWidth = 3
|
||||
backgroundShapeLayer.strokeColor = UIColor.white.cgColor
|
||||
backgroundShapeLayer.fillColor = UIColor.white.cgColor
|
||||
backgroundShapeLayer.path = path.cgPath
|
||||
}
|
||||
}
|
|
@ -7,15 +7,21 @@
|
|||
|
||||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
|
||||
final class WelcomeViewController: UIViewController, NeedsDependency {
|
||||
|
||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||
|
||||
var disposeBag = Set<AnyCancellable>()
|
||||
private(set) lazy var viewModel = WelcomeViewModel(context: context)
|
||||
|
||||
let welcomeIllustrationView = WelcomeIllustrationView()
|
||||
var welcomeIllustrationViewBottomAnchorLayoutConstraint: NSLayoutConstraint?
|
||||
|
||||
private(set) lazy var dismissBarButtonItem = UIBarButtonItem(barButtonSystemItem: .close, target: self, action: #selector(WelcomeViewController.dismissBarButtonItemDidPressed(_:)))
|
||||
|
||||
private(set) lazy var logoImageView: UIImageView = {
|
||||
let image = view.traitCollection.userInterfaceIdiom == .phone ? Asset.Scene.Welcome.mastodonLogo.image : Asset.Scene.Welcome.mastodonLogoBlackLarge.image
|
||||
let imageView = UIImageView(image: image)
|
||||
|
@ -90,6 +96,14 @@ extension WelcomeViewController {
|
|||
|
||||
signUpButton.addTarget(self, action: #selector(signUpButtonDidClicked(_:)), for: .touchUpInside)
|
||||
signInButton.addTarget(self, action: #selector(signInButtonDidClicked(_:)), for: .touchUpInside)
|
||||
|
||||
viewModel.needsShowDismissEntry
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] needsShowDismissEntry in
|
||||
guard let self = self else { return }
|
||||
self.navigationItem.leftBarButtonItem = needsShowDismissEntry ? self.dismissBarButtonItem : nil
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
}
|
||||
|
||||
override func viewSafeAreaInsetsDidChange() {
|
||||
|
@ -213,6 +227,11 @@ extension WelcomeViewController {
|
|||
private func signInButtonDidClicked(_ sender: UIButton) {
|
||||
coordinator.present(scene: .mastodonPickServer(viewMode: MastodonPickServerViewModel(context: context, mode: .signIn)), from: self, transition: .show)
|
||||
}
|
||||
|
||||
@objc
|
||||
private func dismissBarButtonItemDidPressed(_ sender: UIButton) {
|
||||
dismiss(animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - OnboardingViewControllerAppearance
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
//
|
||||
// WelcomeViewModel.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by Cirno MainasuK on 2021-9-15.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Combine
|
||||
|
||||
final class WelcomeViewModel {
|
||||
|
||||
var disposeBag = Set<AnyCancellable>()
|
||||
|
||||
// input
|
||||
let context: AppContext
|
||||
|
||||
// output
|
||||
let needsShowDismissEntry = CurrentValueSubject<Bool, Never>(false)
|
||||
|
||||
init(context: AppContext) {
|
||||
self.context = context
|
||||
|
||||
context.authenticationService.mastodonAuthentications
|
||||
.map { !$0.isEmpty }
|
||||
.assign(to: \.value, on: needsShowDismissEntry)
|
||||
.store(in: &disposeBag)
|
||||
}
|
||||
|
||||
}
|
|
@ -28,6 +28,7 @@ class AvatarButton: UIControl {
|
|||
}
|
||||
|
||||
func _init() {
|
||||
avatarImageView.frame = bounds
|
||||
avatarImageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
addSubview(avatarImageView)
|
||||
NSLayoutConstraint.activate([
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
//
|
||||
// CircleAvatarButton.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by Cirno MainasuK on 2021-9-15.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
final class CircleAvatarButton: AvatarButton {
|
||||
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
|
||||
layer.masksToBounds = true
|
||||
layer.cornerRadius = frame.width * 0.5
|
||||
layer.borderColor = UIColor.systemFill.cgColor
|
||||
layer.borderWidth = 1
|
||||
}
|
||||
}
|
|
@ -121,7 +121,7 @@ final class StatusNode: ASCellNode {
|
|||
// }
|
||||
|
||||
for imageNode in mediaMultiplexImageNodes {
|
||||
imageNode.dataSource = self
|
||||
imageNode.delegate = self
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,4 +80,4 @@ SPEC CHECKSUMS:
|
|||
|
||||
PODFILE CHECKSUM: 4db0bdf969729c5758bd923e33d9e097cb892086
|
||||
|
||||
COCOAPODS: 1.10.2
|
||||
COCOAPODS: 1.11.0
|
||||
|
|
|
@ -70,6 +70,7 @@ The app is compatible with [toot-relay](https://github.com/DagAgren/toot-relay)
|
|||
- [Nuke-FLAnimatedImage-Plugin](https://github.com/kean/Nuke-FLAnimatedImage-Plugin)
|
||||
- [Nuke](https://github.com/kean/Nuke)
|
||||
- [Pageboy](https://github.com/uias/Pageboy#the-basics)
|
||||
- [PanModal](https://github.com/slackhq/PanModal.git)
|
||||
- [SDWebImage](https://github.com/SDWebImage/SDWebImage)
|
||||
- [swift-collections](https://github.com/apple/swift-collections)
|
||||
- [swift-nio](https://github.com/apple/swift-nio)
|
||||
|
|
Loading…
Reference in New Issue