77
88import com .google .common .base .Optional ;
99
10- import jp .studyplus .android .sdk .R ;
10+ import jp .studyplus .android .sdk .BuildConfig ;
1111import jp .studyplus .android .sdk .service .api .ApiCertification ;
1212
1313import static android .content .SharedPreferences .Editor ;
@@ -19,18 +19,16 @@ public class CertificationStore {
1919 private final SharedPreferences preferences ;
2020
2121 private static String KEY_ACCESS_TOKEN = "access_token" ;
22- private final String baseUrl ;
2322
2423 public static CertificationStore create (Context context ) {
25- String baseUrl = context .getString (R .string .studyplus_api_base_url );
26- String prefName = "Certification:" + Uri .parse (baseUrl ).getHost ();
24+ String prefName = "Certification:" + Uri .parse (BuildConfig .API_ENDPOINT ).getHost ();
2725 SharedPreferences pref = context .getSharedPreferences (prefName , Context .MODE_PRIVATE );
28- return new CertificationStore (pref , baseUrl );
26+ return new CertificationStore (pref );
2927 }
30- private CertificationStore (SharedPreferences preferences , String baseUrl ) {
28+ private CertificationStore (SharedPreferences preferences ) {
3129 this .preferences = preferences ;
32- this .baseUrl = baseUrl ;
3330 }
31+
3432 public void update (Intent data ){
3533 if (data == null ){
3634 return ;
@@ -57,26 +55,19 @@ public ApiCertification getDefault() {
5755 if (!token .isPresent ()){
5856 throw new AccessTokenNotFound ();
5957 }
60- return new ApiCertificationImpl (token .get (), baseUrl );
58+ return new ApiCertificationImpl (token .get ());
6159 }
6260
6361 private static class ApiCertificationImpl implements ApiCertification {
6462 private final String accessToken ;
65- private final String baseUrl ;
6663
67- private ApiCertificationImpl (String accessToken , String baseUrl ) {
64+ private ApiCertificationImpl (String accessToken ) {
6865 this .accessToken = accessToken ;
69- this .baseUrl = baseUrl ;
7066 }
7167
7268 @ Override
7369 public String getAccessToken () {
7470 return accessToken ;
7571 }
76-
77- @ Override
78- public String getBaseUrl () {
79- return baseUrl ;
80- }
8172 }
8273}
0 commit comments