Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Commit 5ce2bcd

Browse files
committed
Cleans up logs
1 parent 9d1b490 commit 5ce2bcd

File tree

3 files changed

+63
-77
lines changed

3 files changed

+63
-77
lines changed

Sources/MagicSDK/Modules/Auth/AuthModule.swift

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,60 +25,47 @@ public class AuthModule: BaseModule {
2525
}
2626

2727
public func loginWithMagicLink (_ configuration: LoginWithMagicLinkConfiguration) -> Promise<String> {
28-
if #available(iOS 14.0, *) {
29-
AuthModule.logger.warning("loginWithMagicLink: \(BaseWarningLog.MA_Method)")
30-
} else {
31-
print("\(BaseWarningLog.MA_Method)")
32-
}
33-
3428
return Promise { resolver in
3529
loginWithMagicLink(configuration, response: promiseResolver(resolver))
3630
}
3731
}
3832

3933
public func loginWithMagicLink (_ configuration: LoginWithMagicLinkConfiguration, eventLog: Bool) -> MagicEventPromise<String> {
40-
if #available(iOS 14.0, *) {
41-
AuthModule.logger.warning("loginWithMagicLink: \(BaseWarningLog.MA_Method)")
42-
} else {
43-
print("\(BaseWarningLog.MA_Method)")
44-
}
45-
4634
return MagicEventPromise (eventCenter: self.magicEventCenter, eventLog: eventLog) { resolver in
4735
self.loginWithMagicLink(configuration, response: promiseResolver(resolver))
4836
}
4937
}
5038

5139
// MARK: - Login with SMS
5240
public func loginWithSMS (_ configuration: LoginWithSmsConfiguration, response: @escaping Web3ResponseCompletion<String> ) {
41+
if #available(iOS 14.0, *) {
42+
AuthModule.logger.warning("loginWithSMS: \(BaseWarningLog.MA_Method)")
43+
} else {
44+
print("loginWithSMS: \(BaseWarningLog.MA_Method)")
45+
}
5346
let request = RPCRequest<[LoginWithSmsConfiguration]>(method: AuthMethod.magic_auth_login_with_sms.rawValue, params: [configuration])
5447
self.provider.send(request: request, response: response)
5548
}
5649

5750
public func loginWithSMS (_ configuration: LoginWithSmsConfiguration) -> Promise<String> {
58-
if #available(iOS 14.0, *) {
59-
AuthModule.logger.warning("loginWithSMS: \(BaseWarningLog.MA_Method)")
60-
} else {
61-
print("\(BaseWarningLog.MA_Method)")
62-
}
63-
6451
return Promise { resolver in
6552
loginWithSMS(configuration, response: promiseResolver(resolver))
6653
}
6754
}
6855

6956
// MARK: - Login with EmailOTP
7057
public func loginWithEmailOTP (_ configuration: LoginWithEmailOTPConfiguration, response: @escaping Web3ResponseCompletion<String> ) {
71-
let request = RPCRequest<[LoginWithEmailOTPConfiguration]>(method: AuthMethod.magic_auth_login_with_email_otp.rawValue, params: [configuration])
72-
self.provider.send(request: request, response: response)
73-
}
74-
75-
public func loginWithEmailOTP (_ configuration: LoginWithEmailOTPConfiguration) -> Promise<String> {
7658
if #available(iOS 14.0, *) {
7759
AuthModule.logger.warning("loginWithEmailOTP: \(BaseWarningLog.MA_Method)")
7860
} else {
79-
print("\(BaseWarningLog.MA_Method)")
61+
print("loginWithEmailOTP: \(BaseWarningLog.MA_Method)")
8062
}
8163

64+
let request = RPCRequest<[LoginWithEmailOTPConfiguration]>(method: AuthMethod.magic_auth_login_with_email_otp.rawValue, params: [configuration])
65+
self.provider.send(request: request, response: response)
66+
}
67+
68+
public func loginWithEmailOTP (_ configuration: LoginWithEmailOTPConfiguration) -> Promise<String> {
8269
return Promise { resolver in
8370
loginWithEmailOTP(configuration, response: promiseResolver(resolver))
8471
}

Sources/MagicSDK/Modules/User/UserModule.swift

Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,18 @@ public class UserModule: BaseModule {
2020
GetIdToken
2121
*/
2222
public func getIdToken(_ configuration: GetIdTokenConfiguration? = nil, response: @escaping Web3ResponseCompletion<String>) {
23+
if #available(iOS 14.0, *) {
24+
UserModule.logger.warning("getIdToken: \(BaseWarningLog.MA_Method)")
25+
} else {
26+
print("getIdToken: \(BaseWarningLog.MA_Method)")
27+
}
28+
2329
let request = RPCRequest<[GetIdTokenConfiguration?]>(method: UserMethod.magic_auth_get_id_token.rawValue, params: [configuration])
2430

2531
return self.provider.send(request: request, response: response)
2632
}
2733

2834
public func getIdToken(_ configuration: GetIdTokenConfiguration? = nil) -> Promise<String> {
29-
if #available(iOS 14.0, *) {
30-
UserModule.logger.warning("getIdToken: \(BaseWarningLog.MA_Method)")
31-
} else {
32-
print("\(BaseWarningLog.MA_Method)")
33-
}
3435
return Promise { resolver in
3536
getIdToken(configuration, response: promiseResolver(resolver))
3637
}
@@ -40,18 +41,18 @@ public class UserModule: BaseModule {
4041
Generate Id Token
4142
*/
4243
public func generateIdToken(_ configuration: GenerateIdTokenConfiguration? = nil, response: @escaping Web3ResponseCompletion<String>) {
44+
if #available(iOS 14.0, *) {
45+
UserModule.logger.warning("generateIdToken: \(BaseWarningLog.MA_Method)")
46+
} else {
47+
print("generateIdToken: \(BaseWarningLog.MA_Method)")
48+
}
49+
4350
let request = RPCRequest<[GenerateIdTokenConfiguration?]>(method: UserMethod.magic_auth_generate_id_token.rawValue, params: [configuration])
4451

4552
return self.provider.send(request: request, response: response)
4653
}
4754

4855
public func generateIdToken(_ configuration: GenerateIdTokenConfiguration? = nil) -> Promise<String> {
49-
if #available(iOS 14.0, *) {
50-
UserModule.logger.warning("generateIdToken: \(BaseWarningLog.MA_Method)")
51-
} else {
52-
print("\(BaseWarningLog.MA_Method)")
53-
}
54-
5556
return Promise { resolver in
5657
generateIdToken(configuration, response: promiseResolver(resolver))
5758
}
@@ -62,17 +63,17 @@ public class UserModule: BaseModule {
6263
Get Metadata
6364
*/
6465
public func getMetadata(response: @escaping Web3ResponseCompletion<UserMetadata>) {
65-
let request = BasicRPCRequest(method: UserMethod.magic_auth_get_metadata.rawValue, params: [])
66-
return self.provider.send(request: request, response: response)
67-
}
68-
69-
public func getMetadata() -> Promise<UserMetadata> {
7066
if #available(iOS 14.0, *) {
7167
UserModule.logger.warning("getMetadata: \(BaseWarningLog.MA_Method)")
7268
} else {
73-
print("\(BaseWarningLog.MA_Method)")
69+
print("getMetadata: \(BaseWarningLog.MA_Method)")
7470
}
7571

72+
let request = BasicRPCRequest(method: UserMethod.magic_auth_get_metadata.rawValue, params: [])
73+
return self.provider.send(request: request, response: response)
74+
}
75+
76+
public func getMetadata() -> Promise<UserMetadata> {
7677
return Promise { resolver in
7778
getMetadata(response: promiseResolver(resolver))
7879
}
@@ -82,17 +83,16 @@ public class UserModule: BaseModule {
8283
IsLogged In
8384
*/
8485
public func isLoggedIn(response: @escaping Web3ResponseCompletion<Bool>) {
86+
if #available(iOS 14.0, *) {
87+
UserModule.logger.warning("isLoggedIn: \(BaseWarningLog.MA_Method)")
88+
} else {
89+
print("isLoggedIn: \(BaseWarningLog.MA_Method)")
90+
}
8591
let request = BasicRPCRequest(method: UserMethod.magic_auth_is_logged_in.rawValue, params: [])
8692
self.provider.send(request: request, response: response)
8793
}
8894

8995
public func isLoggedIn() -> Promise<Bool> {
90-
if #available(iOS 14.0, *) {
91-
UserModule.logger.warning("isLoggedIn: \(BaseWarningLog.MA_Method)")
92-
} else {
93-
print("\(BaseWarningLog.MA_Method)")
94-
}
95-
9696
return Promise { resolver in
9797
isLoggedIn(response: promiseResolver(resolver))
9898
}
@@ -102,31 +102,18 @@ public class UserModule: BaseModule {
102102
* Update Email
103103
*/
104104
public func updateEmail(_ configuration: UpdateEmailConfiguration, response: @escaping Web3ResponseCompletion<Bool>) {
105-
106105
let request = RPCRequest<[UpdateEmailConfiguration]>(method: UserMethod.magic_auth_update_email.rawValue, params: [configuration])
107106

108107
return self.provider.send(request: request, response: response)
109108
}
110109

111110
public func updateEmail(_ configuration: UpdateEmailConfiguration) -> Promise<Bool> {
112-
if #available(iOS 14.0, *) {
113-
UserModule.logger.warning("updateEmail: \(BaseWarningLog.MA_Method)")
114-
} else {
115-
print("\(BaseWarningLog.MA_Method)")
116-
}
117-
118111
return Promise { resolver in
119112
updateEmail(configuration, response: promiseResolver(resolver))
120113
}
121114
}
122115

123116
public func updateEmail(_ configuration: UpdateEmailConfiguration, eventLog: Bool) -> MagicEventPromise<Bool> {
124-
if #available(iOS 14.0, *) {
125-
UserModule.logger.warning("updateEmail: \(BaseWarningLog.MA_Method)")
126-
} else {
127-
print("\(BaseWarningLog.MA_Method)")
128-
}
129-
130117
return MagicEventPromise (eventCenter: self.magicEventCenter, eventLog: eventLog){ resolver in
131118
self.updateEmail(configuration, response: promiseResolver(resolver))
132119
}
@@ -136,17 +123,17 @@ public class UserModule: BaseModule {
136123
Logout
137124
*/
138125
public func logout (response: @escaping Web3ResponseCompletion<Bool>) {
139-
let request = BasicRPCRequest(method: UserMethod.magic_auth_logout.rawValue, params: [])
140-
self.provider.send(request: request, response: response)
141-
}
142-
143-
public func logout() -> Promise<Bool> {
144126
if #available(iOS 14.0, *) {
145127
UserModule.logger.warning("logout: \(BaseWarningLog.MA_Method)")
146128
} else {
147-
print("\(BaseWarningLog.MA_Method)")
129+
print("logout: \(BaseWarningLog.MA_Method)")
148130
}
149131

132+
let request = BasicRPCRequest(method: UserMethod.magic_auth_logout.rawValue, params: [])
133+
self.provider.send(request: request, response: response)
134+
}
135+
136+
public func logout() -> Promise<Bool> {
150137
return Promise { resolver in
151138
logout(response: promiseResolver(resolver))
152139
}
@@ -155,17 +142,17 @@ public class UserModule: BaseModule {
155142
showSettings
156143
*/
157144
public func showSettings(response: @escaping Web3ResponseCompletion<String>) {
158-
let request = BasicRPCRequest(method: UserMethod.magic_auth_settings.rawValue, params: [])
159-
self.provider.send(request: request, response: response)
160-
}
161-
162-
public func showSettings() -> Promise<String> {
163145
if #available(iOS 14.0, *) {
164146
UserModule.logger.warning("showSettings: \(BaseWarningLog.MA_Method)")
165147
} else {
166-
print("\(BaseWarningLog.MA_Method)")
148+
print("showSettings: \(BaseWarningLog.MA_Method)")
167149
}
168150

151+
let request = BasicRPCRequest(method: UserMethod.magic_auth_settings.rawValue, params: [])
152+
self.provider.send(request: request, response: response)
153+
}
154+
155+
public func showSettings() -> Promise<String> {
169156
return Promise { resolver in
170157
showSettings(response: promiseResolver(resolver))
171158
}
@@ -175,6 +162,12 @@ public class UserModule: BaseModule {
175162
updatePhoneNumber
176163
*/
177164
public func updatePhoneNumber(response: @escaping Web3ResponseCompletion<String>) {
165+
if #available(iOS 14.0, *) {
166+
UserModule.logger.warning("updatePhoneNumber: \(BaseWarningLog.MA_Method)")
167+
} else {
168+
print("updatePhoneNumber: \(BaseWarningLog.MA_Method)")
169+
}
170+
178171
let request = BasicRPCRequest(method: UserMethod.magic_auth_update_phone_number.rawValue, params: [])
179172
self.provider.send(request: request, response: response)
180173
}
@@ -189,6 +182,11 @@ public class UserModule: BaseModule {
189182
recoverAccount
190183
*/
191184
public func recoverAccount(_ configuration: RecoverAccountConfiguration, response: @escaping Web3ResponseCompletion<Bool>) {
185+
if #available(iOS 14.0, *) {
186+
UserModule.logger.warning("recoverAccount: \(BaseWarningLog.MA_Method)")
187+
} else {
188+
print("recoverAccount: \(BaseWarningLog.MA_Method)")
189+
}
192190

193191
let request = RPCRequest<[RecoverAccountConfiguration]>(method: UserMethod.magic_auth_recover_account.rawValue, params: [configuration])
194192

Sources/MagicSDK/Modules/Wallet/WalletModule.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ public class WalletModule: BaseModule {
1616
category: String(describing: WalletModule.self)
1717
)
1818

19+
1920
/**
2021
connectWithUI
2122
*/
2223
public func connectWithUI(response: @escaping Web3ResponseCompletion<[String]>) {
2324
if #available(iOS 14.0, *) {
2425
WalletModule.logger.warning("connectWithUI: \(BaseWarningLog.MC_Method)")
2526
} else {
26-
print("\(BaseWarningLog.MC_Method)")
27+
print("connectWithUI: \(BaseWarningLog.MC_Method)")
2728
}
2829

2930
let request = BasicRPCRequest(method: WalletMethod.mc_login.rawValue, params: [])
@@ -38,7 +39,7 @@ public class WalletModule: BaseModule {
3839
if #available(iOS 14.0, *) {
3940
WalletModule.logger.warning("showUI: \(BaseWarningLog.MC_Method)")
4041
} else {
41-
print("\(BaseWarningLog.MC_Method)")
42+
print("showUI: \(BaseWarningLog.MC_Method)")
4243
}
4344

4445
let request = BasicRPCRequest(method: WalletMethod.mc_wallet.rawValue, params: [])
@@ -53,7 +54,7 @@ public class WalletModule: BaseModule {
5354
if #available(iOS 14.0, *) {
5455
WalletModule.logger.warning("getInfo: \(BaseWarningLog.MC_Method)")
5556
} else {
56-
print("\(BaseWarningLog.MC_Method)")
57+
print("getInfo: \(BaseWarningLog.MC_Method)")
5758
}
5859

5960
let request = BasicRPCRequest(method: WalletMethod.mc_get_wallet_info.rawValue, params: [])
@@ -69,7 +70,7 @@ public class WalletModule: BaseModule {
6970
if #available(iOS 14.0, *) {
7071
WalletModule.logger.warning("requestUserInfoWithUI: \(BaseWarningLog.MC_Method)")
7172
} else {
72-
print("\(BaseWarningLog.MC_Method)")
73+
print("requestUserInfoWithUI: \(BaseWarningLog.MC_Method)")
7374
}
7475

7576
let request = RPCRequest<[RequestUserInfoWithUIConfiguration?]>(method: WalletMethod.mc_request_user_info.rawValue, params: (configuration != nil) ? [configuration]: [])
@@ -84,7 +85,7 @@ public class WalletModule: BaseModule {
8485
if #available(iOS 14.0, *) {
8586
WalletModule.logger.warning("disconnect: \(BaseWarningLog.MC_Method)")
8687
} else {
87-
print("\(BaseWarningLog.MC_Method)")
88+
print("disconnect: \(BaseWarningLog.MC_Method)")
8889
}
8990

9091
let request = BasicRPCRequest(method: WalletMethod.mc_disconnect.rawValue, params: [])

0 commit comments

Comments
 (0)