forked from github/wulkanowy-mirror
Call of SyncJob only after user register in app (#105)
This commit is contained in:
parent
be8ee4c835
commit
23183c9d7a
@ -17,6 +17,7 @@ import javax.inject.Inject;
|
|||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import io.github.wulkanowy.R;
|
import io.github.wulkanowy.R;
|
||||||
|
import io.github.wulkanowy.services.jobs.SyncJob;
|
||||||
import io.github.wulkanowy.ui.base.BaseActivity;
|
import io.github.wulkanowy.ui.base.BaseActivity;
|
||||||
import io.github.wulkanowy.ui.base.BasePagerAdapter;
|
import io.github.wulkanowy.ui.base.BasePagerAdapter;
|
||||||
import io.github.wulkanowy.ui.main.attendance.AttendanceFragment;
|
import io.github.wulkanowy.ui.main.attendance.AttendanceFragment;
|
||||||
@ -140,6 +141,11 @@ public class MainActivity extends BaseActivity implements MainContract.View,
|
|||||||
viewPager.setCurrentItem(tabPosition, false);
|
viewPager.setCurrentItem(tabPosition, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startSyncService(int interval, boolean useOnlyWifi) {
|
||||||
|
SyncJob.start(getApplicationContext(), interval, useOnlyWifi);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
@ -18,6 +18,8 @@ public interface MainContract {
|
|||||||
void initiationViewPager(int tabPosition);
|
void initiationViewPager(int tabPosition);
|
||||||
|
|
||||||
void initiationBottomNav(int tabPosition);
|
void initiationBottomNav(int tabPosition);
|
||||||
|
|
||||||
|
void startSyncService(int interval, boolean useOnlyWifi);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PerActivity
|
@PerActivity
|
||||||
|
@ -32,6 +32,11 @@ public class MainPresenter extends BasePresenter<MainContract.View>
|
|||||||
|
|
||||||
getView().initiationBottomNav(tabPosition);
|
getView().initiationBottomNav(tabPosition);
|
||||||
getView().initiationViewPager(tabPosition);
|
getView().initiationViewPager(tabPosition);
|
||||||
|
|
||||||
|
if (getRepository().getSharedRepo().isServicesEnable()) {
|
||||||
|
getView().startSyncService(getRepository().getSharedRepo().getServicesInterval(),
|
||||||
|
getRepository().getSharedRepo().isMobileDisable());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,7 +5,6 @@ import android.os.Bundle;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import io.github.wulkanowy.services.jobs.SyncJob;
|
|
||||||
import io.github.wulkanowy.services.notifies.NotificationService;
|
import io.github.wulkanowy.services.notifies.NotificationService;
|
||||||
import io.github.wulkanowy.ui.base.BaseActivity;
|
import io.github.wulkanowy.ui.base.BaseActivity;
|
||||||
import io.github.wulkanowy.ui.login.LoginActivity;
|
import io.github.wulkanowy.ui.login.LoginActivity;
|
||||||
@ -44,11 +43,6 @@ public class SplashActivity extends BaseActivity implements SplashContract.View
|
|||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void startSyncService(int interval, boolean useOnlyWifi) {
|
|
||||||
SyncJob.start(getApplicationContext(), interval, useOnlyWifi);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cancelNotifications() {
|
public void cancelNotifications() {
|
||||||
new NotificationService(getApplicationContext()).cancelAll();
|
new NotificationService(getApplicationContext()).cancelAll();
|
||||||
|
@ -12,8 +12,6 @@ public interface SplashContract {
|
|||||||
|
|
||||||
void openMainActivity();
|
void openMainActivity();
|
||||||
|
|
||||||
void startSyncService(int interval, boolean useOnlyWifi);
|
|
||||||
|
|
||||||
void cancelNotifications();
|
void cancelNotifications();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,11 +20,6 @@ public class SplashPresenter extends BasePresenter<SplashContract.View>
|
|||||||
super.onStart(activity);
|
super.onStart(activity);
|
||||||
getView().cancelNotifications();
|
getView().cancelNotifications();
|
||||||
|
|
||||||
if (getRepository().getSharedRepo().isServicesEnable()) {
|
|
||||||
getView().startSyncService(getRepository().getSharedRepo().getServicesInterval(),
|
|
||||||
getRepository().getSharedRepo().isMobileDisable());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getRepository().getSharedRepo().isUserLoggedIn()) {
|
if (getRepository().getSharedRepo().isUserLoggedIn()) {
|
||||||
getView().openMainActivity();
|
getView().openMainActivity();
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user