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