| 6 |
| import org.telegram.messenger.FileLog; |
| 7 |
| 8 | public class ExternalGcm { |
| 9 |
| 10 | interface Interface { |
| 11 | boolean checkSplit(Context ctx); |
| 12 |
| 13 | boolean checkPlayServices(); |
| 14 |
| 15 | void initPlayServices(); |
| 16 |
| 17 | void sendRegistrationToServer(); |
| 18 |
| 19 | void checkUpdate(Activity ctx); |
| 20 | } |
| 21 |
| 22 | static class NoImpl implements Interface { |
| 23 |
| 24 | @Override |
| 25 | public boolean checkSplit(Context ctx) { |
| 26 | return false; |
| 27 | } |
| 28 |
| 29 | @Override |
| 30 | public boolean checkPlayServices() { |
| 31 | return false; |
| 32 | } |
| 33 |
| 34 | @Override |
| 35 | public void initPlayServices() { |
| 36 | } |
| 37 |
| 38 | @Override |
| 39 | public void sendRegistrationToServer() { |
| 40 | } |
| 41 |
| 42 | @Override |
| 43 | public void checkUpdate(Activity ctx) { |
| 44 | } |
| 45 |
| 46 | } |
| 47 |
| 48 | private static Interface impl; |
| 49 |
| 50 | static { |
| 51 | try { |
| 52 | impl = (Interface) Class.forName("tw.nekomimi.nekogram.GcmImpl").newInstance(); |
| 53 | } catch (ClassNotFoundException e) { |
| 54 | impl = new NoImpl(); |
| 55 | } catch (Exception e) { |
| 56 | impl = new NoImpl(); |
| 57 | FileLog.e(e); |
| 58 | } |
| 59 | } |
| 60 |
| 61 | public static boolean checkSplit(Context ctx) { |
| 62 | return impl.checkSplit(ctx); |
| 63 | } |
| 64 |
| 65 | public static void initPlayServices() { |
| 66 | impl.initPlayServices(); |
| 67 | } |
| 68 |
| 69 | public static boolean checkPlayServices() { |
| 70 | return impl.checkPlayServices(); |
| 71 | } |
| 72 |
| 73 | public static void sendRegistrationToServer() { |
| 74 | impl.sendRegistrationToServer(); |
| 75 | } |
| 76 |
| 77 |
| 78 | public static void checkUpdate(Activity ctx) { |
| 79 | impl.checkUpdate(ctx); |
| 80 | } |
| 81 |
| 82 | } |
| 83 |