RegisterDeviceRequest.java 2.86 KB
package com.arellomobile.android.push.request;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Build;
import android.os.Build.VERSION;
import com.arellomobile.android.push.utils.GeneralUtils;
import java.util.Calendar;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;

public class RegisterDeviceRequest
  extends PushRequest
{
  private String b;
  
  public RegisterDeviceRequest(String paramString)
  {
    this.b = paramString;
  }
  
  private static String a(String paramString)
  {
    String str;
    if ((paramString == null) || (paramString.length() == 0)) {
      str = "";
    }
    char c;
    do
    {
      return str;
      c = paramString.charAt(0);
      str = paramString;
    } while (Character.isUpperCase(c));
    return Character.toUpperCase(c) + paramString.substring(1);
  }
  
  protected void buildParams(Context paramContext, Map<String, Object> paramMap)
  {
    String str;
    if (GeneralUtils.isTablet(paramContext))
    {
      str = "Tablet";
      paramMap.put("device_name", str);
      if (!GeneralUtils.isAmazonDevice()) {
        break label206;
      }
      paramMap.put("device_type", "9");
      label37:
      paramMap.put("v", "2.2");
      paramMap.put("language", Locale.getDefault().getLanguage());
      paramMap.put("timezone", Integer.valueOf(Calendar.getInstance().getTimeZone().getRawOffset() / 1000));
      str = paramContext.getPackageName();
      paramMap.put("android_package", str);
      paramMap.put("push_token", this.b);
      paramMap.put("sounds", GeneralUtils.getRawResourses(paramContext));
      if (paramContext.getPackageManager().getInstallerPackageName(str) != null) {
        break label220;
      }
      paramMap.put("jailbroken", Integer.valueOf(1));
    }
    for (;;)
    {
      paramMap.put("device_model", getDeviceName());
      paramMap.put("os_version", Build.VERSION.RELEASE);
      try
      {
        paramMap.put("app_version", paramContext.getPackageManager().getPackageInfo(str, 0).versionName);
        return;
      }
      catch (PackageManager.NameNotFoundException paramContext) {}
      str = "Phone";
      break;
      label206:
      paramMap.put("device_type", "3");
      break label37;
      label220:
      paramMap.put("jailbroken", Integer.valueOf(0));
    }
  }
  
  public String getDeviceName()
  {
    String str1 = Build.MANUFACTURER;
    String str2 = Build.MODEL;
    if (str2.startsWith(str1)) {
      return a(str2);
    }
    return a(str1) + " " + str2;
  }
  
  public String getMethod()
  {
    return "registerDevice";
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/arellomobile/android/push/request/RegisterDeviceRequest.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */