.
This commit is contained in:
@@ -38,10 +38,6 @@
|
||||
android:theme="@style/Theme.SimpliTend"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".welcome.activities.NewUpdateActivity"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
android:name=".chats.ChatsActivity"
|
||||
android:exported="false"
|
||||
|
||||
@@ -394,6 +394,8 @@ public abstract class AppUtil {
|
||||
public static final String IS_BATTERY_LOW_NOTIFICATION_SENT = "battery_low_notification_sent";
|
||||
public static final String IS_BATTERY_LOW_NOTIFICATION_SHOWN = "battery_low_notification_shown";
|
||||
|
||||
public static final String SKIPPED_UPDATE_VERSION = "skipped_update_version";
|
||||
|
||||
public static void savePatientData(String token, int patient_uid, Context context, boolean isLoggedIn) {
|
||||
SharedPreferences sp = context.getSharedPreferences(PATIENT_DETAILS, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
@@ -682,6 +684,20 @@ public abstract class AppUtil {
|
||||
return sp.getBoolean(FUA_DIALOG, true);
|
||||
}
|
||||
|
||||
public static void setSkippedUpdateVersion(Context context, int skipped_version){
|
||||
SharedPreferences sp = context.getSharedPreferences(CAREGIVER_DETAILS, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sp.edit();
|
||||
|
||||
editor.putInt(SKIPPED_UPDATE_VERSION, skipped_version);
|
||||
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static int getSkippedVersion(Context context){
|
||||
SharedPreferences sp = context.getSharedPreferences(CAREGIVER_DETAILS, Context.MODE_PRIVATE);
|
||||
return sp.getInt(SKIPPED_UPDATE_VERSION, -1);
|
||||
}
|
||||
|
||||
// patient geofencing
|
||||
private static final String PATIENT_GEOFENCE_RADIUS = "patient_geofence_radius";
|
||||
private static final String PATIENT_GEOFENCE_RADIUS_UNIT = "patient_geofence_radius_unit";
|
||||
|
||||
@@ -804,17 +804,18 @@ public class CgGeoFencingActivity extends AppCompatActivity implements OnMapRead
|
||||
}
|
||||
|
||||
options.icon(BitmapDescriptorFactory.fromBitmap(iconGenerator.makeIcon()));
|
||||
if (curr_loc_marker != null) curr_loc_marker.remove();
|
||||
curr_loc_marker = mMap.addMarker(options);
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.into(markerBgBinding.markerBgImage);
|
||||
} else {
|
||||
options.icon(BitmapDescriptorFactory.fromResource(R.drawable.img_pat_curr_location));
|
||||
if (curr_loc_marker != null) curr_loc_marker.remove();
|
||||
curr_loc_marker = mMap.addMarker(options);
|
||||
}
|
||||
|
||||
if (curr_loc_marker != null) curr_loc_marker.remove();
|
||||
curr_loc_marker = mMap.addMarker(options);
|
||||
|
||||
if (isTrackingSenior) {
|
||||
mMap.animateCamera(CameraUpdateFactory.newLatLng(pat_cur_latLng));
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.app.simplitend.welcome.activities;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.app.simplitend.BuildConfig;
|
||||
import com.app.simplitend.databinding.ActivityNewUpdateBinding;
|
||||
import com.app.simplitend.welcome.welcomepatient.mvvm.models.NewUpdate;
|
||||
|
||||
public class NewUpdateActivity extends AppCompatActivity {
|
||||
|
||||
public static final String IS_MANDATORY_UPDATE = "is_mandatory_update";
|
||||
|
||||
protected ActivityNewUpdateBinding binding;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityNewUpdateBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
boolean isMandatoryUpdate = getIntent().getBooleanExtra(IS_MANDATORY_UPDATE, false);
|
||||
|
||||
if (isMandatoryUpdate){
|
||||
binding.skipBtn.setVisibility(View.GONE);
|
||||
}else{
|
||||
binding.skipBtn.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.app.simplitend.welcome.welcomepatient.fragments.register;
|
||||
|
||||
import static com.app.simplitend.welcome.activities.NewUpdateActivity.IS_MANDATORY_UPDATE;
|
||||
import static com.app.simplitend.welcome.welcomecg.fragments.CgConnectFragment.CAREGIVER_EMAIL;
|
||||
import static com.app.simplitend.welcome.welcomepatient.fragments.register.ReActivateFragment.CG_STATUS_KEY;
|
||||
import static com.app.simplitend.welcome.welcomepatient.fragments.register.ReActivateFragment.CG_XID_KEY;
|
||||
@@ -33,7 +32,6 @@ import com.app.simplitend.databinding.SplashFragmentBinding;
|
||||
import com.app.simplitend.patient_dashboard.DashBoardActivity;
|
||||
import com.app.simplitend.patientprofile.PatientProfileAPIService;
|
||||
import com.app.simplitend.patientprofile.ProfileContracts;
|
||||
import com.app.simplitend.welcome.activities.NewUpdateActivity;
|
||||
import com.app.simplitend.welcome.welcomecg.WelcomeApiService;
|
||||
import com.app.simplitend.welcome.welcomecg.WelcomeContracts;
|
||||
import com.app.simplitend.welcome.welcomecg.fragments.CgAuthActivity;
|
||||
@@ -56,6 +54,8 @@ public class SplashFragment extends Fragment
|
||||
// view binding
|
||||
protected SplashFragmentBinding binding;
|
||||
|
||||
private int latest_version = -1;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
@@ -71,10 +71,17 @@ public class SplashFragment extends Fragment
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
binding.newUpdateView.getRoot().setVisibility(View.GONE);
|
||||
checkNewUpdates();
|
||||
|
||||
binding.newUpdateView.skipBtn.setOnClickListener(v -> {
|
||||
AppUtil.setSkippedUpdateVersion(requireContext(), latest_version);
|
||||
checkIfAhyUser();
|
||||
});
|
||||
}
|
||||
|
||||
private void checkNewUpdates() {
|
||||
binding.newUpdateView.getRoot().setVisibility(View.GONE);
|
||||
binding.retry.setVisibility(View.GONE);
|
||||
binding.loadAnim.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -94,32 +101,38 @@ public class SplashFragment extends Fragment
|
||||
return;
|
||||
}
|
||||
|
||||
latest_version = response.body().result.new_version;
|
||||
|
||||
if (BuildConfig.VERSION_CODE < response.body().result.new_version){
|
||||
// current version is less than latest version
|
||||
// update is required
|
||||
|
||||
Intent intent = new Intent(requireActivity(), NewUpdateActivity.class);
|
||||
try {
|
||||
// checking if this update is already skipped by user
|
||||
if (AppUtil.getSkippedVersion(requireContext()) == response.body().result.new_version){
|
||||
// already skipped version
|
||||
checkIfAhyUser();
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
binding.newUpdateView.getRoot().setVisibility(View.VISIBLE);
|
||||
|
||||
if (BuildConfig.VERSION_CODE < response.body().result.force_update_version) {
|
||||
// current version is less than forced latest version
|
||||
// update is mandatory
|
||||
intent.putExtra(IS_MANDATORY_UPDATE, true);
|
||||
binding.newUpdateView.skipBtn.setVisibility(View.GONE);
|
||||
}else{
|
||||
// current version is greater than or equal to force update version
|
||||
// thus, this update can be skipped
|
||||
intent.putExtra(IS_MANDATORY_UPDATE, false);
|
||||
}
|
||||
|
||||
try {
|
||||
startActivity(intent);
|
||||
requireActivity().finish();
|
||||
} catch (Exception e) {
|
||||
// do nothing
|
||||
onFailure(call, e);
|
||||
binding.newUpdateView.skipBtn.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}else{
|
||||
// current version is equal to latest version
|
||||
// no update is required
|
||||
binding.newUpdateView.getRoot().setVisibility(View.GONE);
|
||||
checkIfAhyUser();
|
||||
}
|
||||
|
||||
@@ -139,6 +152,7 @@ public class SplashFragment extends Fragment
|
||||
}
|
||||
|
||||
private void checkIfAhyUser() {
|
||||
binding.newUpdateView.getRoot().setVisibility(View.GONE);
|
||||
binding.retry.setVisibility(View.GONE);
|
||||
binding.loadAnim.setVisibility(View.VISIBLE);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
@@ -53,4 +53,9 @@
|
||||
|
||||
/>
|
||||
|
||||
<include
|
||||
android:id="@+id/new_update_view"
|
||||
layout="@layout/layout_new_update"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
Reference in New Issue
Block a user