Skip to content

Commit 7f66ab1

Browse files
author
게임플랫폼클라팀
committed
Update Gamebase iOS SDK 2.65.0
1 parent 4fd1c9e commit 7f66ab1

File tree

7 files changed

+149
-98
lines changed

7 files changed

+149
-98
lines changed

GamebaseSampleApp/GamebaseSampleApp/Extensions/UIAlertAction+Extension.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,17 @@
66
//
77

88
import UIKit
9+
import Gamebase
910

1011
extension UIAlertAction {
1112
static func closeAction() -> UIAlertAction {
1213
return UIAlertAction(title: "닫기", style: .cancel)
1314
}
15+
16+
static func copyToClipboardAction(message: String) -> UIAlertAction {
17+
return UIAlertAction(title: "복사하기", style: .default) { _ in
18+
UIPasteboard.general.string = message
19+
TCGBUtil.showToast(message: "복사되었습니다.", length: .short)
20+
}
21+
}
1422
}

GamebaseSampleApp/GamebaseSampleApp/Extensions/UIViewController+Extension.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ extension UIViewController {
3232
}
3333
}
3434

35-
static func showAlert(above viewController: UIViewController = UIApplication.topViewController()!,
36-
alertInfo: AlertInfo) {
37-
let actions = alertInfo.addCloseAction ? alertInfo.actions + UIAlertAction.closeAction() : alertInfo.actions
35+
static func showAlert(above viewController: UIViewController = UIApplication.topViewController()!, alertInfo: AlertInfo) {
36+
var actions = alertInfo.addCloseAction ? alertInfo.actions + UIAlertAction.closeAction() : alertInfo.actions
37+
38+
if alertInfo.clipboardCopyable, let message = alertInfo.message {
39+
actions += UIAlertAction.copyToClipboardAction(message: message)
40+
}
3841

3942
let textFields = alertInfo.textFields?
4043
.compactMap { info -> ((UITextField) -> ()) in

GamebaseSampleApp/GamebaseSampleApp/Model/AlertInfo.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ struct AlertInfo {
1414
let addCloseAction: Bool
1515
let actions: [UIAlertAction]
1616
let textFields: [AlertTextFieldInfo]?
17+
let clipboardCopyable: Bool
1718
let confirmHandler: ((UIAlertController) -> ())?
1819

1920
init(title: String?,
@@ -22,13 +23,15 @@ struct AlertInfo {
2223
preferredStyle: UIAlertController.Style = .alert,
2324
additionalActions: [UIAlertAction] = [],
2425
textFields: [AlertTextFieldInfo]? = nil,
26+
clipboardCopyable: Bool = false,
2527
confirmHandler: ((UIAlertController) -> ())? = nil) {
2628
self.title = title
2729
self.message = message
2830
self.preferredStyle = preferredStyle
2931
self.addCloseAction = addCloseAction
3032
self.actions = additionalActions
3133
self.textFields = textFields
34+
self.clipboardCopyable = clipboardCopyable
3235
self.confirmHandler = confirmHandler
3336
}
3437
}

GamebaseSampleApp/GamebaseSampleApp/View/ViewControllers/Developer/DeveloperViewController.swift

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ final class DeveloperViewController: QuickTableViewController {
3030
private let inputWebViewConfiguration = PublishRelay<Void>()
3131
private let inputRequestContactURL = PublishRelay<Void>()
3232
private let inputContactConfiguration = PublishRelay<Void>()
33+
private let inputIdfa = PublishRelay<Void>()
34+
private let inputDeviceLanguage = PublishRelay<Void>()
35+
private let inputDeviceCountryCode = PublishRelay<Void>()
36+
private let inputDisplayLanguage = PublishRelay<Void>()
37+
3338
private var disposeBag = DisposeBag()
3439

3540
required init?(coder: NSCoder) {
@@ -163,20 +168,16 @@ extension DeveloperViewController {
163168
NavigationRow(text: "OS 버전", detailText: .value1(self.viewModel.osVersion())),
164169

165170
TapActionRow<CustomTapActionCell>(text: "IDFA 조회", action: { [weak self] _ in
166-
UIViewController.showAlert(title: "IDFA",
167-
message: self?.viewModel.getIDFA())
171+
self?.inputIdfa.accept(())
168172
}),
169173
TapActionRow<CustomTapActionCell>(text: "Device Language 조회", action: { [weak self] _ in
170-
UIViewController.showAlert(title: "Device Language",
171-
message: self?.viewModel.getDeviceLanguage())
174+
self?.inputDeviceLanguage.accept(())
172175
}),
173176
TapActionRow<CustomTapActionCell>(text: "Device Country Code 조회", action: { [weak self] _ in
174-
UIViewController.showAlert(title: "Device Country Code",
175-
message: self?.viewModel.getDeviceCountryCode())
176-
}),
177+
self?.inputDeviceCountryCode.accept(())
178+
}),
177179
TapActionRow<CustomTapActionCell>(text: "Display Language 조회", action: { [weak self] _ in
178-
UIViewController.showAlert(title: "Display Language",
179-
message: self?.viewModel.getDisplayLanguage())
180+
self?.inputDisplayLanguage.accept(())
180181
}),
181182
])
182183
]
@@ -197,7 +198,11 @@ extension DeveloperViewController {
197198
imageNoticeConfiguration: inputImageNoticeConfiguration,
198199
webViewConfiguration: inputWebViewConfiguration,
199200
requestContactURL: inputRequestContactURL,
200-
contactConfiguration: inputContactConfiguration)
201+
contactConfiguration: inputContactConfiguration,
202+
idfa: inputIdfa,
203+
deviceLanguage: inputDeviceLanguage,
204+
deviceCountryCode: inputDeviceCountryCode,
205+
displayLanguage: inputDisplayLanguage)
201206
let output = self.viewModel.transform(input: input)
202207

203208
output.isLoading

GamebaseSampleApp/GamebaseSampleApp/ViewModel/DeveloperViewModel.swift

Lines changed: 47 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ extension DeveloperViewModel: ViewModelType {
4444
let webViewConfiguration: PublishRelay<Void>
4545
let requestContactURL: PublishRelay<Void>
4646
let contactConfiguration: PublishRelay<Void>
47+
let idfa: PublishRelay<Void>
48+
let deviceLanguage: PublishRelay<Void>
49+
let deviceCountryCode: PublishRelay<Void>
50+
let displayLanguage: PublishRelay<Void>
4751
}
4852

4953
struct Output {
@@ -151,6 +155,30 @@ extension DeveloperViewModel: ViewModelType {
151155
}
152156
.disposed(by: disposeBag)
153157

158+
input.idfa
159+
.subscribe(with: self) { owner, _ in
160+
owner.idfa()
161+
}
162+
.disposed(by: disposeBag)
163+
164+
input.deviceLanguage
165+
.subscribe(with: self) { owner, _ in
166+
owner.deviceLanguage()
167+
}
168+
.disposed(by: disposeBag)
169+
170+
input.deviceCountryCode
171+
.subscribe(with: self) { owner, _ in
172+
owner.deviceCountryCode()
173+
}
174+
.disposed(by: disposeBag)
175+
176+
input.displayLanguage
177+
.subscribe(with: self) { owner, _ in
178+
owner.displayLanguage()
179+
}
180+
.disposed(by: disposeBag)
181+
154182
return Output(isLoading: isLoading.asSignal(),
155183
routeToChildView: routeToChildView.asSignal(),
156184
routeToReceiptView: routeToReceiptView.asSignal(),
@@ -212,7 +240,8 @@ extension DeveloperViewModel{
212240
.subscribe(with: self) { owner, pushTokenInfo in
213241
owner.isLoading.accept(false)
214242
owner.showAlert.accept(AlertInfo(title: "푸시 설정 조회 성공",
215-
message: "\(pushTokenInfo.prettyJsonString())"))
243+
message: "\(pushTokenInfo.prettyJsonString())",
244+
clipboardCopyable: true))
216245
} onError: { owner, error in
217246
owner.isLoading.accept(false)
218247
owner.showAlert.accept(AlertInfo(title: "푸시 설정 조회 실패",
@@ -292,7 +321,8 @@ extension DeveloperViewModel {
292321
.subscribe(with: self) { owner, queryTermsResult in
293322
owner.isLoading.accept(false)
294323
owner.showAlert.accept(AlertInfo(title: "약관 정보 조회 성공",
295-
message: "\(queryTermsResult.prettyJsonString())"))
324+
message: "\(queryTermsResult.prettyJsonString())",
325+
clipboardCopyable: true))
296326
} onError: { owner, error in
297327
owner.isLoading.accept(false)
298328
owner.showAlert.accept(AlertInfo(title: "약관 정보 조회 실패",
@@ -446,7 +476,8 @@ extension DeveloperViewModel {
446476
})
447477
.subscribe(with: self) { owner, contactURL in
448478
owner.showAlert.accept(AlertInfo(title: "고객센터 URL",
449-
message: "contactURL => \(contactURL)"))
479+
message: "\(contactURL)",
480+
clipboardCopyable: true))
450481
} onError: { owner, error in
451482
owner.showAlert.accept(AlertInfo(title: "고객센터 URL",
452483
message: "고객센터 URL을 가져오지 못했습니다.\nerror=> \(error.localizedDescription)"))
@@ -465,23 +496,24 @@ extension DeveloperViewModel {
465496
return TCGBUtil.osVersion()
466497
}
467498

468-
func getIDFA() -> String {
469-
return TCGBUtil.idfa()
499+
func idfa() {
500+
let idfa = TCGBUtil.idfa()
501+
self.showAlert.accept(AlertInfo(title: "IDFA", message: idfa, clipboardCopyable: true))
470502
}
471503

472-
func getDeviceLanguage() -> String {
473-
return TCGBUtil.deviceLanguageCode()
504+
func deviceLanguage() {
505+
let deviceLanguage = TCGBUtil.deviceLanguageCode()
506+
self.showAlert.accept(AlertInfo(title: "Device Language", message: deviceLanguage, clipboardCopyable: true))
474507
}
475508

476-
func getDisplayLanguage() -> String {
477-
if let displayLanguageCode = TCGBGamebase.displayLanguageCode() {
478-
return displayLanguageCode
479-
}
480-
return "Display Language가 설정되지 않았습니다."
509+
func deviceCountryCode() {
510+
let deviceCountryCode = TCGBUtil.deviceCountryCode()
511+
self.showAlert.accept(AlertInfo(title: "Device Country Code", message: deviceCountryCode, clipboardCopyable: true))
481512
}
482-
483-
func getDeviceCountryCode() -> String {
484-
return TCGBUtil.deviceCountryCode()
513+
514+
func displayLanguage() {
515+
let displayLanguageCode = TCGBGamebase.displayLanguageCode() ?? "Display Language가 설정되지 않았습니다."
516+
self.showAlert.accept(AlertInfo(title: "Display Language", message: displayLanguageCode, clipboardCopyable: true))
485517
}
486518
}
487519

GamebaseSampleApp/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ target 'GamebaseSampleApp' do
1818
pod 'QuickTableViewController', '1.3.1'
1919

2020
# Gamebase
21-
$GAMEBASE_SDK_VERSION = '2.64.0'
21+
$GAMEBASE_SDK_VERSION = '2.65.0'
2222
pod 'Gamebase', $GAMEBASE_SDK_VERSION
2323
pod 'GamebaseAuthFacebookAdapter', $GAMEBASE_SDK_VERSION
2424
pod 'GamebaseAuthGamecenterAdapter', $GAMEBASE_SDK_VERSION

0 commit comments

Comments
 (0)