크리에이터 채널 - 팔로우/팔로잉 버튼 로컬 라이징 적용

This commit is contained in:
Yu Sung
2026-01-20 00:17:42 +09:00
parent f1353fc2e6
commit d3037d1ba3
18 changed files with 217 additions and 28 deletions

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "btn_follow_big_en.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "btn_follow_big_ja.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "btn_following_big_en.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "btn_following_big_ja.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "btn_following_no_alarm_big_en.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "btn_following_no_alarm_big_ja.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -0,0 +1,66 @@
//
// FollowButtonImageAsset.swift
// SodaLive
//
// Created by Codex on 2025/03/15.
//
import SwiftUI
enum FollowButtonImageType {
case follow
case following
case followingNoAlarm
}
struct FollowButtonImageAsset {
let type: FollowButtonImageType
var imageName: String {
let languageCode = LanguageHeaderProvider.current
let suffix: String
switch languageCode {
case "ja":
suffix = "_ja"
case "en":
suffix = "_en"
default:
suffix = ""
}
switch type {
case .follow:
return "btn_follow_big\(suffix)"
case .following:
return "btn_following_big\(suffix)"
case .followingNoAlarm:
return "btn_following_no_alarm_big\(suffix)"
}
}
var size: CGSize? {
let languageCode = LanguageHeaderProvider.current
guard languageCode == "ja" || languageCode == "en" else { return nil }
switch type {
case .follow:
return CGSize(width: 80, height: 26.7)
case .following, .followingNoAlarm:
return CGSize(width: 100, height: 26.7)
}
}
@ViewBuilder
func imageView(defaultSize: CGSize? = nil) -> some View {
if let size = size {
Image(imageName)
.resizable()
.frame(width: size.width, height: size.height)
} else if let defaultSize = defaultSize {
Image(imageName)
.resizable()
.frame(width: defaultSize.width, height: defaultSize.height)
} else {
Image(imageName)
}
}
}

View File

@@ -36,12 +36,12 @@ struct ContentDetailCreatorProfileView: View {
Spacer()
if creator.creatorId != UserDefaults.int(forKey: .userId) {
Image(creator.isFollow ?
creator.isNotify ?
"btn_following_big" :
"btn_following_no_alarm_big" :
"btn_follow_big"
let asset = FollowButtonImageAsset(
type: creator.isFollow
? (creator.isNotify ? .following : .followingNoAlarm)
: .follow
)
asset.imageView()
.onTapGesture {
if creator.isFollowing {
showCreatorFollowNotifyDialog(creator.creatorId)

View File

@@ -152,13 +152,12 @@ struct SeriesDetailView: View {
Spacer()
if seriesDetail.creator.creatorId != UserDefaults.int(forKey: .userId) {
Image(
viewModel.isFollow ?
viewModel.isNotify ?
"btn_following_big" :
"btn_following_no_alarm_big" :
"btn_follow_big"
let asset = FollowButtonImageAsset(
type: viewModel.isFollow
? (viewModel.isNotify ? .following : .followingNoAlarm)
: .follow
)
asset.imageView()
.onTapGesture {
if viewModel.isFollow {
creatorId = seriesDetail.creator.creatorId

View File

@@ -41,12 +41,12 @@ struct FollowerListItemView: View {
Spacer()
if let isFollow = item.isFollow, let isNotify = item.isNotify {
Image(isFollow ?
isNotify ?
"btn_following_big" :
"btn_following_no_alarm_big" :
"btn_follow_big"
let asset = FollowButtonImageAsset(
type: isFollow
? (isNotify ? .following : .followingNoAlarm)
: .follow
)
asset.imageView()
.onTapGesture {
isFollow ?
showCreatorFollowNotifyDialog(item.userId) :

View File

@@ -47,13 +47,12 @@ struct UserProfileView: View {
.foregroundColor(.white)
if creatorProfile.creator.creatorId != UserDefaults.int(forKey: .userId) {
Image(
creatorProfile.creator.isFollow ?
creatorProfile.creator.isNotify ? "btn_following_big": "btn_following_no_alarm_big"
: "btn_follow_big"
let asset = FollowButtonImageAsset(
type: creatorProfile.creator.isFollow
? (creatorProfile.creator.isNotify ? .following : .followingNoAlarm)
: .follow
)
.resizable()
.frame(width: 83.3, height: 26.7)
asset.imageView(defaultSize: CGSize(width: 83.3, height: 26.7))
.onTapGesture {
if creatorProfile.creator.isFollow {
isShowFollowNotifyDialog = true

View File

@@ -36,13 +36,12 @@ struct FollowCreatorItemView: View {
Spacer()
Image(
creator.isFollow ?
creator.isNotify ?
"btn_following_big" :
"btn_following_no_alarm_big" :
"btn_follow_big"
let asset = FollowButtonImageAsset(
type: creator.isFollow
? (creator.isNotify ? .following : .followingNoAlarm)
: .follow
)
asset.imageView()
.onTapGesture {
if creator.isFollow {
showCreatorFollowNotifyDialog(creator.creatorId)