// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.oliodevices.assist.app.api; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.os.Bundle; import com.google.gson.FieldNamingPolicy; import com.google.gson.GsonBuilder; import com.olio.util.ALog; import com.squareup.okhttp.OkHttpClient; import java.io.IOException; import java.lang.ref.SoftReference; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.client.OkClient; import retrofit.converter.GsonConverter; // Referenced classes of package com.oliodevices.assist.app.api: // TimeZoneService public class TimeZoneApi { private static final int HTTPS_PORT = 443; private static final int HTTPS_PREFIX_LENGTH = 8; private static final int TIMEOUT = 500; private static final int TTL = 0x36ee80; private static String sEndpoint; private static long sLastCheck; private static SoftReference sTimeZoneRef; public TimeZoneApi() { } public static TimeZoneService.CityResponse autocomplete(Context context, String s) { return getTimeZoneService().autocomplete(s, "(cities)", s.length(), 0x1312d00L, getWebServiceApiKey(context)); } private static String getAndroidServicesApiKey(Context context) { context = context.getPackageManager().getApplicationInfo(context.getPackageName(), 128).metaData.getString("com.google.android.geo.API_KEY"); return context; context; ALog.e("Failed to load meta-data, NameNotFound", context, new Object[] { Integer.valueOf(0) }); _L2: return ""; context; ALog.e("Failed to load meta-data, NullPointer", context, new Object[] { Integer.valueOf(0) }); if (true) goto _L2; else goto _L1 _L1: } private static String getServiceEndpoint() { Socket socket; if (sEndpoint != null && System.currentTimeMillis() - sLastCheck > 0x36ee80L) { return sEndpoint; } socket = new Socket(); socket.connect(new InetSocketAddress(InetAddress.getByName("https://maps.googleapis.com/".substring(8, "https://maps.googleapis.com/".length() - 1)).getHostAddress(), 443), 500); sEndpoint = "https://maps.googleapis.com/"; Object obj; try { socket.close(); } catch (IOException ioexception) { } sLastCheck = System.currentTimeMillis(); return sEndpoint; obj; _L2: ALog.d("Maps API unreachable, trying china address", new Object[] { obj }); sEndpoint = "http://maps.google.cn/"; try { socket.close(); } // Misplaced declaration of an exception variable catch (Object obj) { } break MISSING_BLOCK_LABEL_78; obj; try { socket.close(); } catch (IOException ioexception1) { } throw obj; obj; if (true) goto _L2; else goto _L1 _L1: } private static TimeZoneService getTimeZoneService() { if (sTimeZoneRef != null) { TimeZoneService timezoneservice = (TimeZoneService)sTimeZoneRef.get(); if (timezoneservice != null) { return timezoneservice; } } Object obj = (new GsonBuilder()).setFieldNamingStrategy(FieldNamingPolicy.IDENTITY).create(); OkHttpClient okhttpclient = new OkHttpClient(); obj = (TimeZoneService)(new retrofit.RestAdapter.Builder()).setEndpoint(getServiceEndpoint()).setClient(new OkClient(okhttpclient)).setConverter(new GsonConverter(((com.google.gson.Gson) (obj)))).build().create(com/oliodevices/assist/app/api/TimeZoneService); sTimeZoneRef = new SoftReference(obj); return ((TimeZoneService) (obj)); } private static String getWebServiceApiKey(Context context) { context = context.getPackageManager().getApplicationInfo(context.getPackageName(), 128).metaData.getString("com.google.web.places.API_KEY"); return context; context; ALog.e("Failed to load meta-data, NameNotFound", context, new Object[] { Integer.valueOf(0) }); _L2: return ""; context; ALog.e("Failed to load meta-data, NullPointer", context, new Object[] { Integer.valueOf(0) }); if (true) goto _L2; else goto _L1 _L1: } public static void resolve(Context context, double d, double d1, long l, Callback callback) { getTimeZoneService().resolve(String.format("%f,%f", new Object[] { Double.valueOf(d), Double.valueOf(d1) }), String.valueOf(l / 1000L), getAndroidServicesApiKey(context), callback); } }