
package com.mobage.air.extension;

import com.adobe.fre.FREContext;
import com.adobe.fre.FREObject;

import com.mobage.android.Error;
import com.mobage.android.Mobage;

public class PlatformListenerWrapper implements Mobage.PlatformListener {

	private FREContext context;

	private FREObject object;

	public PlatformListenerWrapper(FREContext context, FREObject object) {
		this.context = context;
		this.object = object;
	}

	@Override
	public void onLoginError(Error error) {
		Dispatcher.dispatch(context, "PlatformListener.onLoginError", error);
	}

	@Override
	public void onLoginCancel() {
		Dispatcher.dispatch(context, "PlatformListener.onLoginCancel");
	}

	@Override
	public void onLoginComplete(String userId) {
		Dispatcher.dispatch(context, "PlatformListener.onLoginComplete", userId);
	}

	@Override
	public void onLoginRequired() {
		Dispatcher.dispatch(context, "PlatformListener.onLoginRequired");
	}

	@Override
	public void onSplashComplete() {
		Dispatcher.dispatch(context, "PlatformListener.onSplashComplete");
	}

	@Override
	public int hashCode() {
		return object.hashCode();
	}

	@Override
	public boolean equals(Object other) {
		if (other instanceof PlatformListenerWrapper) {
			return object.equals(other);
		}
		return false;
	}
}
