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

View File

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

View File

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