11
11
import androidx .annotation .NonNull ;
12
12
import androidx .appcompat .app .AppCompatActivity ;
13
13
14
- import com .google .android .gms .auth .api .signin .GoogleSignIn ;
15
- import com .google .android .gms .auth .api .signin .GoogleSignInAccount ;
16
- import com .google .android .gms .auth .api .signin .GoogleSignInClient ;
17
- import com .google .android .gms .auth .api .signin .GoogleSignInOptions ;
18
- import com .google .android .gms .common .SignInButton ;
19
- import com .google .android .gms .common .api .ApiException ;
20
- import com .google .android .gms .common .api .CommonStatusCodes ;
21
- import com .google .android .gms .tasks .Task ;
22
-
23
14
import org .json .JSONException ;
24
15
import org .json .JSONObject ;
25
16
import org .walletconnect .Session ;
29
20
import java .util .concurrent .Executors ;
30
21
31
22
import ai .elimu .crowdsource .BaseApplication ;
32
- import ai .elimu .crowdsource .BuildConfig ;
33
23
import ai .elimu .crowdsource .MainActivity ;
34
24
import ai .elimu .crowdsource .R ;
35
25
import ai .elimu .crowdsource .rest .ContributorService ;
51
41
*/
52
42
public class SignInWithWeb3Activity extends AppCompatActivity implements Session .Callback {
53
43
54
- private static String w3Account = "" ;
55
44
public static final String W3_SIGN_MESSAGE = "elimu.ai" ;
56
-
45
+ private static String w3Account = "" ;
57
46
private Button connectW3Button ;
58
47
59
48
private ProgressBar signInProgressBar ;
@@ -131,7 +120,7 @@ protected void onStart() {
131
120
// Web3 Sign In button.
132
121
initialSetup ();
133
122
134
- if (!w3Account .equals ("" )){
123
+ if (!w3Account .equals ("" )) {
135
124
updateUIW3 (w3Account );
136
125
}
137
126
@@ -163,15 +152,15 @@ private void updateUIW3(String web3Account) {
163
152
} catch (JSONException e ) {
164
153
Timber .e (e );
165
154
}
166
- Timber .i ("contributorJSONObject: " + contributorJSONObject );
155
+ Timber .i ("contributorJSONObject: %s" , contributorJSONObject );
167
156
168
157
// Register the Contributor in the webapp's database
169
158
BaseApplication baseApplication = (BaseApplication ) getApplication ();
170
159
Retrofit retrofit = baseApplication .getRetrofit ();
171
160
ContributorService contributorService = retrofit .create (ContributorService .class );
172
161
RequestBody requestBody = RequestBody .create (MediaType .parse ("application/json" ), contributorJSONObject .toString ());
173
162
Call <ResponseBody > call = contributorService .createContributor (requestBody );
174
- Timber .i ("call.request(): " + call .request ());
163
+ Timber .i ("call.request(): %s" , call .request ());
175
164
ExecutorService executorService = Executors .newSingleThreadExecutor ();
176
165
executorService .execute (new Runnable () {
177
166
@ Override
@@ -180,11 +169,11 @@ public void run() {
180
169
181
170
try {
182
171
Response <ResponseBody > response = call .execute ();
183
- Timber .i ("response: " + response );
184
- Timber .i ("response.isSuccessful(): " + response .isSuccessful ());
172
+ Timber .i ("response: %s" , response );
173
+ Timber .i ("response.isSuccessful(): %s" , response .isSuccessful ());
185
174
if (response .isSuccessful ()) {
186
175
String bodyString = response .body ().string ();
187
- Timber .i ("bodyString: " + bodyString );
176
+ Timber .i ("bodyString: %s" , bodyString );
188
177
189
178
// Persist the Contributor's account details in SharedPreferences
190
179
SharedPreferencesHelper .storeWeb3Account (getApplicationContext (), web3Account );
@@ -195,7 +184,7 @@ public void run() {
195
184
finish ();
196
185
} else {
197
186
String errorBodyString = response .errorBody ().string ();
198
- Timber .e ("errorBodyString: " + errorBodyString );
187
+ Timber .e ("errorBodyString: %s" , errorBodyString );
199
188
// TODO: Handle error
200
189
201
190
runOnUiThread (() -> {
@@ -208,7 +197,7 @@ public void run() {
208
197
});
209
198
}
210
199
} catch (IOException e ) {
211
- Timber .e (e , null );
200
+ Timber .e (e );
212
201
// TODO: Handle error
213
202
214
203
runOnUiThread (() -> {
0 commit comments