Show add icon in bottom menu

This commit is contained in:
Marcin Czachursk 2023-04-15 21:25:32 +02:00
parent 093882bd6a
commit 392948d84c
4 changed files with 55 additions and 23 deletions

View File

@ -28,7 +28,7 @@ Creating new translation is pretty easy, all you need to do is to copy two folde
- `Vernissage/Localization/en.lproj`
- `Vernissage/PixelfedKit/Sources/PixelfedKit/Resources/en.lproj`
In the name of the folders you have to put ne code of the new language ([here](https://stackoverflow.com/a/13360348) you can find the languages codes).
In the name of the folders you have to put the code of the new language ([here](https://stackoverflow.com/a/13360348) you can find the languages codes).
Then you have to open files in these folders and translate them 🇯🇵🇫🇷🇨🇮🇧🇪. After translation create a Pull Request 👍.
From time to time you have to come back and translate lines which has been added since the last translation.

View File

@ -175,6 +175,7 @@
F8F6E44D29BCC1F90004795E /* MediumWidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8F6E44829BCC0F00004795E /* MediumWidgetView.swift */; };
F8F6E44E29BCC1FB0004795E /* LargeWidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8F6E44A29BCC0FF0004795E /* LargeWidgetView.swift */; };
F8F6E45129BCE9190004795E /* UIImage+Resize.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8F6E45029BCE9190004795E /* UIImage+Resize.swift */; };
F8FB8ABA29EB2ED400342C04 /* NavigationMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8FB8AB929EB2ED400342C04 /* NavigationMenu.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -355,6 +356,7 @@
F8F6E44829BCC0F00004795E /* MediumWidgetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediumWidgetView.swift; sourceTree = "<group>"; };
F8F6E44A29BCC0FF0004795E /* LargeWidgetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LargeWidgetView.swift; sourceTree = "<group>"; };
F8F6E45029BCE9190004795E /* UIImage+Resize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+Resize.swift"; sourceTree = "<group>"; };
F8FB8AB929EB2ED400342C04 /* NavigationMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationMenu.swift; sourceTree = "<group>"; };
F8FFBD4929E99BEE0047EE80 /* Vernissage-009.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "Vernissage-009.xcdatamodel"; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -633,6 +635,7 @@
F88BC53729E068D200CE6141 /* ViewModifiers */ = {
isa = PBXGroup;
children = (
F8FB8AB929EB2ED400342C04 /* NavigationMenu.swift */,
F88BC53A29E06A5100CE6141 /* ImageContextMenu.swift */,
);
path = ViewModifiers;
@ -1108,6 +1111,7 @@
F8D5444329D4066C002225D6 /* AppDelegate.swift in Sources */,
F802884F297AEED5000BDD51 /* DatabaseError.swift in Sources */,
F86A4307299AA5E900DF7645 /* ThanksView.swift in Sources */,
F8FB8ABA29EB2ED400342C04 /* NavigationMenu.swift in Sources */,
F88BC51D29E0377B00CE6141 /* AccountData+AccountModel.swift in Sources */,
F89B5CC229D01BF700549F2F /* InstanceView.swift in Sources */,
F89F57B029D1C11200001EE3 /* RelationshipModel.swift in Sources */,
@ -1169,7 +1173,7 @@
CODE_SIGN_ENTITLEMENTS = VernissageWidget/VernissageWidgetExtension.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 114;
CURRENT_PROJECT_VERSION = 115;
DEVELOPMENT_TEAM = B2U9FEKYP8;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = VernissageWidget/Info.plist;
@ -1180,7 +1184,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.4.0;
MARKETING_VERSION = 1.5.0;
PRODUCT_BUNDLE_IDENTIFIER = dev.mczachurski.vernissage.widget;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
@ -1197,7 +1201,7 @@
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
CODE_SIGN_ENTITLEMENTS = VernissageWidget/VernissageWidgetExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 114;
CURRENT_PROJECT_VERSION = 115;
DEVELOPMENT_TEAM = B2U9FEKYP8;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = VernissageWidget/Info.plist;
@ -1208,7 +1212,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.4.0;
MARKETING_VERSION = 1.5.0;
PRODUCT_BUNDLE_IDENTIFIER = dev.mczachurski.vernissage.widget;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
@ -1224,7 +1228,7 @@
CODE_SIGN_ENTITLEMENTS = VernissageShare/VernissageShareExtension.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 114;
CURRENT_PROJECT_VERSION = 115;
DEVELOPMENT_TEAM = B2U9FEKYP8;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = VernissageShare/Info.plist;
@ -1236,7 +1240,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.4.0;
MARKETING_VERSION = 1.5.0;
PRODUCT_BUNDLE_IDENTIFIER = dev.mczachurski.vernissage.share;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
@ -1251,7 +1255,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = VernissageShare/VernissageShareExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 114;
CURRENT_PROJECT_VERSION = 115;
DEVELOPMENT_TEAM = B2U9FEKYP8;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = VernissageShare/Info.plist;
@ -1263,7 +1267,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.4.0;
MARKETING_VERSION = 1.5.0;
PRODUCT_BUNDLE_IDENTIFIER = dev.mczachurski.vernissage.share;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
@ -1400,7 +1404,7 @@
CODE_SIGN_ENTITLEMENTS = Vernissage/Vernissage.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 114;
CURRENT_PROJECT_VERSION = 115;
DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\"";
DEVELOPMENT_TEAM = B2U9FEKYP8;
ENABLE_PREVIEWS = YES;
@ -1417,7 +1421,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.4.0;
MARKETING_VERSION = 1.5.0;
PRODUCT_BUNDLE_IDENTIFIER = dev.mczachurski.vernissage;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -1440,7 +1444,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CODE_SIGN_ENTITLEMENTS = Vernissage/Vernissage.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 114;
CURRENT_PROJECT_VERSION = 115;
DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\"";
DEVELOPMENT_TEAM = B2U9FEKYP8;
ENABLE_PREVIEWS = YES;
@ -1457,7 +1461,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.4.0;
MARKETING_VERSION = 1.5.0;
PRODUCT_BUNDLE_IDENTIFIER = dev.mczachurski.vernissage;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";

View File

@ -7,6 +7,7 @@
import Foundation
import SwiftUI
import EnvironmentKit
import ServicesKit
public extension View {
func navigationMenu<MenuItems>(menuPosition: Binding<MenuPosition>,
@ -16,9 +17,9 @@ public extension View {
}
private struct NavigationMenu<MenuItems>: ViewModifier where MenuItems: View {
@EnvironmentObject var routerPath: RouterPath
private let menuItems: () -> MenuItems
@Binding var menuPosition: MenuPosition
init(menuPosition: Binding<MenuPosition>, @ViewBuilder menuItems: @escaping () -> MenuItems) {
@ -39,13 +40,13 @@ private struct NavigationMenu<MenuItems>: ViewModifier where MenuItems: View {
if self.menuPosition == .bottomRight {
Spacer()
self.menuContent()
self.menuContainerView()
.padding(.trailing, 30)
.padding(.bottom, 10)
}
if self.menuPosition == .bottomLeft {
self.menuContent()
self.menuContainerView()
.padding(.leading, 30)
.padding(.bottom, 10)
@ -58,20 +59,48 @@ private struct NavigationMenu<MenuItems>: ViewModifier where MenuItems: View {
}
@ViewBuilder
private func menuContent() -> some View {
private func menuContainerView() -> some View {
HStack(alignment: .center) {
if self.menuPosition == .bottomRight {
self.contextMenuView()
self.composeImageView()
}
if self.menuPosition == .bottomLeft {
self.composeImageView()
self.contextMenuView()
}
}
.padding(.horizontal, 8)
.background(.ultraThinMaterial)
.clipShape(RoundedRectangle(cornerRadius: 22))
}
@ViewBuilder
private func contextMenuView() -> some View {
Menu {
self.menuItems()
} label: {
Image(systemName: "line.3.horizontal")
.resizable()
.foregroundColor(.mainTextColor.opacity(0.8))
.shadow(radius: 5)
.padding(12)
.frame(width: 44, height: 44)
.background(.ultraThinMaterial)
.clipShape(Circle())
}
}
private func composeImageView() -> some View {
Button {
HapticService.shared.fireHaptic(of: .buttonPress)
self.routerPath.presentedSheet = .newStatusEditor
} label: {
Image(systemName: "plus")
.resizable()
.foregroundColor(.mainTextColor.opacity(0.8))
.shadow(radius: 5)
.padding(12)
.frame(width: 44, height: 44)
}
}
}

View File

@ -45,9 +45,8 @@ struct MainView: View {
if self.applicationState.menuPosition == .top {
self.getPrincipalToolbar()
self.getTrailingToolbar()
}
self.getTrailingToolbar()
}
.onChange(of: tipsStore.status) { status in
if status == .successful {
@ -156,7 +155,7 @@ struct MainView: View {
HapticService.shared.fireHaptic(of: .buttonPress)
self.routerPath.presentedSheet = .newStatusEditor
} label: {
Image(systemName: "square.and.pencil")
Image(systemName: "plus")
.foregroundColor(Color.mainTextColor)
.fontWeight(.semibold)
}