Improve autocomplete fonts sizes.

This commit is contained in:
Marcin Czachursk 2023-02-28 06:28:00 +01:00
parent 96d57073c3
commit b0873f2d1a
3 changed files with 34 additions and 23 deletions

View File

@ -1059,7 +1059,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 40; CURRENT_PROJECT_VERSION = 41;
DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\"";
DEVELOPMENT_TEAM = B2U9FEKYP8; DEVELOPMENT_TEAM = B2U9FEKYP8;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
@ -1096,7 +1096,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 40; CURRENT_PROJECT_VERSION = 41;
DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\"";
DEVELOPMENT_TEAM = B2U9FEKYP8; DEVELOPMENT_TEAM = B2U9FEKYP8;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;

View File

@ -26,10 +26,10 @@ public class AuthorizationService {
do { do {
let account = try await client.verifyCredentials() let account = try await client.verifyCredentials()
try await self.update(account: currentAccount, await self.update(accountId: currentAccount.id,
basedOn: account, basedOn: account,
accessToken: accessToken, accessToken: accessToken,
refreshToken: currentAccount.refreshToken) refreshToken: currentAccount.refreshToken)
result(currentAccount) result(currentAccount)
} catch { } catch {
@ -165,10 +165,10 @@ public class AuthorizationService {
// Get account information from server. // Get account information from server.
let account = try await authenticatedClient.verifyCredentials() let account = try await authenticatedClient.verifyCredentials()
try await self.update(account: accountData, await self.update(accountId: accountData.id,
basedOn: account, basedOn: account,
accessToken: oAuthSwiftCredential.oauthToken, accessToken: oAuthSwiftCredential.oauthToken,
refreshToken: oAuthSwiftCredential.oauthRefreshToken) refreshToken: oAuthSwiftCredential.oauthRefreshToken)
} }
private func refreshCredentials(for accountData: AccountData, private func refreshCredentials(for accountData: AccountData,
@ -193,17 +193,21 @@ public class AuthorizationService {
// Get account information from server. // Get account information from server.
let account = try await authenticatedClient.verifyCredentials() let account = try await authenticatedClient.verifyCredentials()
try await self.update(account: accountData, await self.update(accountId: accountData.id,
basedOn: account, basedOn: account,
accessToken: oAuthSwiftCredential.oauthToken, accessToken: oAuthSwiftCredential.oauthToken,
refreshToken: oAuthSwiftCredential.oauthRefreshToken) refreshToken: oAuthSwiftCredential.oauthRefreshToken)
} }
private func update(account dbAccount: AccountData, private func update(accountId: String,
basedOn account: Account, basedOn account: Account,
accessToken: String, accessToken: String,
refreshToken: String? refreshToken: String?
) async throws { ) async {
guard let dbAccount = AccountDataHandler.shared.getAccountData(accountId: accountId) else {
return
}
dbAccount.username = account.username dbAccount.username = account.username
dbAccount.acct = account.acct dbAccount.acct = account.acct
dbAccount.displayName = account.displayNameWithoutEmojis dbAccount.displayName = account.displayNameWithoutEmojis

View File

@ -64,6 +64,7 @@ struct ComposeView: View {
private let contentWidth = Int(UIScreen.main.bounds.width) - 50 private let contentWidth = Int(UIScreen.main.bounds.width) - 50
private let keyboardFontImageSize = 20.0 private let keyboardFontImageSize = 20.0
private let keyboardFontTextSize = 16.0 private let keyboardFontTextSize = 16.0
private let autocompleteFontTextSize = 12.0
public init(statusViewModel: StatusModel? = nil) { public init(statusViewModel: StatusModel? = nil) {
_textModel = StateObject(wrappedValue: .init()) _textModel = StateObject(wrappedValue: .init())
@ -343,12 +344,18 @@ struct ComposeView: View {
Button { Button {
textModel.selectMentionSuggestion(account: account) textModel.selectMentionSuggestion(account: account)
} label: { } label: {
UsernameRow( HStack (alignment: .center) {
accountId: account.id, UserAvatar(accountAvatar: account.avatar, size: .comment)
accountAvatar: account.avatar,
accountDisplayName: account.displayNameWithoutEmojis, VStack (alignment: .leading) {
accountUsername: account.acct, Text(account.displayNameWithoutEmojis)
size: .comment) .foregroundColor(.mainTextColor)
Text("@\(account.acct)")
.foregroundColor(.lightGrayColor)
}
.padding(.leading, 8)
}
.font(.system(size: self.autocompleteFontTextSize))
.padding(.trailing, 8) .padding(.trailing, 8)
} }
Divider() Divider()
@ -359,7 +366,7 @@ struct ComposeView: View {
textModel.selectHashtagSuggestion(tag: tag) textModel.selectHashtagSuggestion(tag: tag)
} label: { } label: {
Text("#\(tag.name)") Text("#\(tag.name)")
.font(.callout) .font(.system(size: self.autocompleteFontTextSize))
.foregroundColor(self.applicationState.tintColor.color()) .foregroundColor(self.applicationState.tintColor.color())
} }
Divider() Divider()