package net.youmi.ads.nativead.adconfig;

import android.content.Context;
import android.content.SharedPreferences;

import net.youmi.ads.nativead.BuildConfig;

/**
 * @author zhitao
 * @since 2017-05-31 17:08
 */
public class YoumiSpConfig {
	
	private final static String KEY_APPID = "appid";
	
	public static String getAppId(Context context) {
		SharedPreferences sharedPreferences =
				context.getApplicationContext().getSharedPreferences(BuildConfig.APPLICATION_ID, Context.MODE_PRIVATE);
		return sharedPreferences.getString(KEY_APPID, null);
	}
	
	static void setAppId(Context context, String appId) {
		SharedPreferences sharedPreferences =
				context.getApplicationContext().getSharedPreferences(BuildConfig.APPLICATION_ID, Context.MODE_PRIVATE);
		SharedPreferences.Editor editor = sharedPreferences.edit();
		editor.putString(KEY_APPID, appId);
		editor.apply();
	}
	
}

@@ -70,50 +70,8 @@
 ext;
-%0Aimport android.content.SharedPreferences;
 %0A%0Aim
@@ -93,28 +93,26 @@
 ads.
-nativead.BuildConfig
+base.utils.SPUtils
 ;%0A%0A/
@@ -302,191 +302,42 @@
 %7B%0A%09%09
-SharedPreferences sharedPreferences =%0A%09%09%09%09context.getApplicationContext().getSharedPreferences(BuildConfig.APPLICATION_ID, Context.MODE_PRIVATE);%0A%09%09return sharedPreferences.getString(
+return SPUtils.getString(context, 
 KEY_
@@ -345,14 +345,8 @@
 PPID
-, null
 );%0A%09
@@ -411,268 +411,50 @@
 %0A%09%09S
-haredPreferences sharedPreferences =%0A%09%09%09%09context.getApplicationContext().getSharedPreferences(BuildConfig.APPLICATION_ID, Context.MODE_PRIVATE);%0A%09%09SharedPreferences.Editor editor = sharedPreferences.edit();%0A%09%09editor.putString(KEY_APPID, appId);%0A%09%09editor.apply(
+PUtils.putString(context, KEY_APPID, appId
 );%0A%09

update SpConfig