WebUtils.java 2.53 KB
package com.bitstrips.imoji.util;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.os.Build;
import android.os.Build.VERSION;
import android.provider.Settings.Secure;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import retrofit.client.Header;
import retrofit.client.Response;

public class WebUtils
{
  public static final String BITMOJI_TOKEN_HEADER = "bitmoji-token";
  public static final String BITMOJI_USER_AGENT_HEADER = "Bitmoji-User-Agent";
  public static final String MONOUSER_TOKEN_HEADER = "authorization";
  public static final String MONOUSER_TOKEN_TYPE_PREFIX = "Bearer ";
  public static final String SNAPCHAT_TOKEN_HEADER = "bitmoji-sc-token";
  
  public static String getBitmojiUserAgent(Context paramContext)
  {
    String str3 = paramContext.getPackageName();
    try
    {
      String str1 = paramContext.getPackageManager().getPackageInfo(paramContext.getPackageName(), 0).versionName;
      String str4 = Build.VERSION.RELEASE;
      String str5 = Build.MANUFACTURER + " " + Build.MODEL;
      String str6 = Settings.Secure.getString(paramContext.getContentResolver(), "android_id");
      paramContext = Float.toString(paramContext.getResources().getDisplayMetrics().density);
      String str7 = Locale.getDefault().toString();
      return "1|" + str3.replaceAll("\\|", "") + "|" + str1.replaceAll("\\|", "") + "|" + "Android".replaceAll("\\|", "") + "|" + str4.replaceAll("\\|", "") + "|" + str5.replaceAll("\\|", "") + "|" + str6.replaceAll("\\|", "") + "|" + paramContext.replaceAll("\\|", "") + "|" + str7.replaceAll("\\|", "");
    }
    catch (PackageManager.NameNotFoundException localNameNotFoundException)
    {
      for (;;)
      {
        String str2 = "";
      }
    }
  }
  
  public static String getETag(Response paramResponse)
  {
    paramResponse = paramResponse.getHeaders().iterator();
    while (paramResponse.hasNext())
    {
      Header localHeader = (Header)paramResponse.next();
      if ((!TextUtils.isEmpty(localHeader.getName())) && ("etag".equals(localHeader.getName().toLowerCase()))) {
        return localHeader.getValue();
      }
    }
    return null;
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/util/WebUtils.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */