크리에이터 채널 - 팔로우/팔로잉 버튼 로컬 라이징 적용
This commit is contained in:
21
SodaLive/Resources/Assets.xcassets/btn_follow_big_en.imageset/Contents.json
vendored
Normal file
21
SodaLive/Resources/Assets.xcassets/btn_follow_big_en.imageset/Contents.json
vendored
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
SodaLive/Resources/Assets.xcassets/btn_follow_big_en.imageset/btn_follow_big_en.png
vendored
Normal file
BIN
SodaLive/Resources/Assets.xcassets/btn_follow_big_en.imageset/btn_follow_big_en.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
21
SodaLive/Resources/Assets.xcassets/btn_follow_big_ja.imageset/Contents.json
vendored
Normal file
21
SodaLive/Resources/Assets.xcassets/btn_follow_big_ja.imageset/Contents.json
vendored
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
SodaLive/Resources/Assets.xcassets/btn_follow_big_ja.imageset/btn_follow_big_ja.png
vendored
Normal file
BIN
SodaLive/Resources/Assets.xcassets/btn_follow_big_ja.imageset/btn_follow_big_ja.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
21
SodaLive/Resources/Assets.xcassets/btn_following_big_en.imageset/Contents.json
vendored
Normal file
21
SodaLive/Resources/Assets.xcassets/btn_following_big_en.imageset/Contents.json
vendored
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
SodaLive/Resources/Assets.xcassets/btn_following_big_en.imageset/btn_following_big_en.png
vendored
Normal file
BIN
SodaLive/Resources/Assets.xcassets/btn_following_big_en.imageset/btn_following_big_en.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
21
SodaLive/Resources/Assets.xcassets/btn_following_big_ja.imageset/Contents.json
vendored
Normal file
21
SodaLive/Resources/Assets.xcassets/btn_following_big_ja.imageset/Contents.json
vendored
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
SodaLive/Resources/Assets.xcassets/btn_following_big_ja.imageset/btn_following_big_ja.png
vendored
Normal file
BIN
SodaLive/Resources/Assets.xcassets/btn_following_big_ja.imageset/btn_following_big_ja.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
21
SodaLive/Resources/Assets.xcassets/btn_following_no_alarm_big_en.imageset/Contents.json
vendored
Normal file
21
SodaLive/Resources/Assets.xcassets/btn_following_no_alarm_big_en.imageset/Contents.json
vendored
Normal 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 |
21
SodaLive/Resources/Assets.xcassets/btn_following_no_alarm_big_ja.imageset/Contents.json
vendored
Normal file
21
SodaLive/Resources/Assets.xcassets/btn_following_no_alarm_big_ja.imageset/Contents.json
vendored
Normal 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 |
66
SodaLive/Sources/Common/FollowButtonImageAsset.swift
Normal file
66
SodaLive/Sources/Common/FollowButtonImageAsset.swift
Normal 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -36,12 +36,12 @@ struct ContentDetailCreatorProfileView: View {
|
|||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
if creator.creatorId != UserDefaults.int(forKey: .userId) {
|
if creator.creatorId != UserDefaults.int(forKey: .userId) {
|
||||||
Image(creator.isFollow ?
|
let asset = FollowButtonImageAsset(
|
||||||
creator.isNotify ?
|
type: creator.isFollow
|
||||||
"btn_following_big" :
|
? (creator.isNotify ? .following : .followingNoAlarm)
|
||||||
"btn_following_no_alarm_big" :
|
: .follow
|
||||||
"btn_follow_big"
|
|
||||||
)
|
)
|
||||||
|
asset.imageView()
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
if creator.isFollowing {
|
if creator.isFollowing {
|
||||||
showCreatorFollowNotifyDialog(creator.creatorId)
|
showCreatorFollowNotifyDialog(creator.creatorId)
|
||||||
|
|||||||
@@ -152,13 +152,12 @@ struct SeriesDetailView: View {
|
|||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
if seriesDetail.creator.creatorId != UserDefaults.int(forKey: .userId) {
|
if seriesDetail.creator.creatorId != UserDefaults.int(forKey: .userId) {
|
||||||
Image(
|
let asset = FollowButtonImageAsset(
|
||||||
viewModel.isFollow ?
|
type: viewModel.isFollow
|
||||||
viewModel.isNotify ?
|
? (viewModel.isNotify ? .following : .followingNoAlarm)
|
||||||
"btn_following_big" :
|
: .follow
|
||||||
"btn_following_no_alarm_big" :
|
|
||||||
"btn_follow_big"
|
|
||||||
)
|
)
|
||||||
|
asset.imageView()
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
if viewModel.isFollow {
|
if viewModel.isFollow {
|
||||||
creatorId = seriesDetail.creator.creatorId
|
creatorId = seriesDetail.creator.creatorId
|
||||||
|
|||||||
@@ -41,12 +41,12 @@ struct FollowerListItemView: View {
|
|||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
if let isFollow = item.isFollow, let isNotify = item.isNotify {
|
if let isFollow = item.isFollow, let isNotify = item.isNotify {
|
||||||
Image(isFollow ?
|
let asset = FollowButtonImageAsset(
|
||||||
isNotify ?
|
type: isFollow
|
||||||
"btn_following_big" :
|
? (isNotify ? .following : .followingNoAlarm)
|
||||||
"btn_following_no_alarm_big" :
|
: .follow
|
||||||
"btn_follow_big"
|
|
||||||
)
|
)
|
||||||
|
asset.imageView()
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
isFollow ?
|
isFollow ?
|
||||||
showCreatorFollowNotifyDialog(item.userId) :
|
showCreatorFollowNotifyDialog(item.userId) :
|
||||||
|
|||||||
@@ -47,13 +47,12 @@ struct UserProfileView: View {
|
|||||||
.foregroundColor(.white)
|
.foregroundColor(.white)
|
||||||
|
|
||||||
if creatorProfile.creator.creatorId != UserDefaults.int(forKey: .userId) {
|
if creatorProfile.creator.creatorId != UserDefaults.int(forKey: .userId) {
|
||||||
Image(
|
let asset = FollowButtonImageAsset(
|
||||||
creatorProfile.creator.isFollow ?
|
type: creatorProfile.creator.isFollow
|
||||||
creatorProfile.creator.isNotify ? "btn_following_big": "btn_following_no_alarm_big"
|
? (creatorProfile.creator.isNotify ? .following : .followingNoAlarm)
|
||||||
: "btn_follow_big"
|
: .follow
|
||||||
)
|
)
|
||||||
.resizable()
|
asset.imageView(defaultSize: CGSize(width: 83.3, height: 26.7))
|
||||||
.frame(width: 83.3, height: 26.7)
|
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
if creatorProfile.creator.isFollow {
|
if creatorProfile.creator.isFollow {
|
||||||
isShowFollowNotifyDialog = true
|
isShowFollowNotifyDialog = true
|
||||||
|
|||||||
@@ -36,13 +36,12 @@ struct FollowCreatorItemView: View {
|
|||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
Image(
|
let asset = FollowButtonImageAsset(
|
||||||
creator.isFollow ?
|
type: creator.isFollow
|
||||||
creator.isNotify ?
|
? (creator.isNotify ? .following : .followingNoAlarm)
|
||||||
"btn_following_big" :
|
: .follow
|
||||||
"btn_following_no_alarm_big" :
|
|
||||||
"btn_follow_big"
|
|
||||||
)
|
)
|
||||||
|
asset.imageView()
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
if creator.isFollow {
|
if creator.isFollow {
|
||||||
showCreatorFollowNotifyDialog(creator.creatorId)
|
showCreatorFollowNotifyDialog(creator.creatorId)
|
||||||
|
|||||||
Reference in New Issue
Block a user