Search in sources :

Example 1 with Payment

use of net.iGap.model.payment.Payment in project iGap-Android by KianIranian-STDG.

the class ActivityMain method checkIntent.

private void checkIntent(Intent intent) {
    if (G.isRestartActivity) {
        return;
    }
    if (intent.getAction() != null && intent.getAction().equals("net.iGap.payment")) {
        FragmentManager fragmentManager = getSupportFragmentManager();
        Fragment fragment = fragmentManager.findFragmentByTag(PaymentFragment.class.getName());
        if (fragment instanceof PaymentFragment) {
            ((PaymentFragment) fragment).setPaymentResult(new Payment(intent.getStringExtra("status"), intent.getStringExtra("message"), intent.getStringExtra("order_id"), intent.getStringExtra("tax"), intent.getStringExtra("discount")));
        }
    }
    new HelperGetDataFromOtherApp(this, intent);
    // check has shared data if true setup main fragment (room list) ui
    Fragment fragmentBottomNav = getSupportFragmentManager().findFragmentByTag(BottomNavigationFragment.class.getName());
    if (fragmentBottomNav instanceof BottomNavigationFragment) {
        // set true just for checking state
        ((BottomNavigationFragment) fragmentBottomNav).checkHasSharedData(true);
        ((BottomNavigationFragment) fragmentBottomNav).isFirstTabItem();
    }
    if (intent.getAction() != null && intent.getAction().equals("net.iGap.activities.OPEN_ACCOUNT")) {
        new HelperFragment(getSupportFragmentManager(), new FragmentSetting()).load();
    }
    Bundle extras = intent.getExtras();
    if (extras != null) {
        long roomId = extras.getLong(ActivityMain.openChat);
        if (!FragmentLanguage.languageChanged && roomId > 0) {
            // if language changed not need check enter to chat
            // GoToChatActivity goToChatActivity = new GoToChatActivity(roomId);
            // TODO this change is duo to room null bug. if it works server must change routine.
            long peerId = extras.getLong("PeerID");
            long userId = extras.getLong(ActivityMain.userId);
            if (AccountManager.getInstance().getCurrentUser().getId() != userId) {
                new AccountHelper().changeAccount(userId);
                updateUiForChangeAccount();
            }
            HelperUrl.goToActivityFromFCM(this, roomId, peerId);
        }
        FragmentLanguage.languageChanged = false;
        boolean openMediaPlayer = extras.getBoolean(ActivityMain.openMediaPlayer);
        if (openMediaPlayer) {
            if (getSupportFragmentManager().findFragmentByTag(FragmentMediaPlayer.class.getName()) == null) {
                FragmentMediaPlayer fragment = new FragmentMediaPlayer();
                new HelperFragment(getSupportFragmentManager(), fragment).setReplace(false).load();
            }
        }
    }
}
Also used : HelperGetDataFromOtherApp(net.iGap.helper.HelperGetDataFromOtherApp) AccountHelper(net.iGap.module.accountManager.AccountHelper) PaymentFragment(net.iGap.fragments.PaymentFragment) FragmentSetting(net.iGap.fragments.FragmentSetting) Bundle(android.os.Bundle) PaymentFragment(net.iGap.fragments.PaymentFragment) Fragment(androidx.fragment.app.Fragment) HelperFragment(net.iGap.helper.HelperFragment) OpenFragment(net.iGap.observers.interfaces.OpenFragment) TabletEmptyChatFragment(net.iGap.fragments.TabletEmptyChatFragment) BaseFragment(net.iGap.fragments.BaseFragment) CameraStoryFragment(net.iGap.story.CameraStoryFragment) CallSelectFragment(net.iGap.fragments.CallSelectFragment) SearchFragment(net.iGap.fragments.SearchFragment) DiscoveryFragment(net.iGap.fragments.discovery.DiscoveryFragment) BottomNavigationFragment(net.iGap.fragments.BottomNavigationFragment) FragmentManager(androidx.fragment.app.FragmentManager) OnPayment(net.iGap.observers.interfaces.OnPayment) Payment(net.iGap.model.payment.Payment) BottomNavigationFragment(net.iGap.fragments.BottomNavigationFragment) FragmentMediaPlayer(net.iGap.fragments.FragmentMediaPlayer) HelperFragment(net.iGap.helper.HelperFragment)

Aggregations

Bundle (android.os.Bundle)1 Fragment (androidx.fragment.app.Fragment)1 FragmentManager (androidx.fragment.app.FragmentManager)1 BaseFragment (net.iGap.fragments.BaseFragment)1 BottomNavigationFragment (net.iGap.fragments.BottomNavigationFragment)1 CallSelectFragment (net.iGap.fragments.CallSelectFragment)1 FragmentMediaPlayer (net.iGap.fragments.FragmentMediaPlayer)1 FragmentSetting (net.iGap.fragments.FragmentSetting)1 PaymentFragment (net.iGap.fragments.PaymentFragment)1 SearchFragment (net.iGap.fragments.SearchFragment)1 TabletEmptyChatFragment (net.iGap.fragments.TabletEmptyChatFragment)1 DiscoveryFragment (net.iGap.fragments.discovery.DiscoveryFragment)1 HelperFragment (net.iGap.helper.HelperFragment)1 HelperGetDataFromOtherApp (net.iGap.helper.HelperGetDataFromOtherApp)1 Payment (net.iGap.model.payment.Payment)1 AccountHelper (net.iGap.module.accountManager.AccountHelper)1 OnPayment (net.iGap.observers.interfaces.OnPayment)1 OpenFragment (net.iGap.observers.interfaces.OpenFragment)1 CameraStoryFragment (net.iGap.story.CameraStoryFragment)1