Skip to content

Commit

Permalink
Merge shared Preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
githengi committed Oct 30, 2018
1 parent 5378be0 commit 37d383c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=1.1.1-SNAPSHOT
VERSION_NAME=1.1.2-SNAPSHOT
VERSION_CODE=1
GROUP=org.smartregister
POM_SETTING_DESCRIPTION=OpenSRP Client Configurable Views Library
Expand Down
2 changes: 1 addition & 1 deletion opensrp-configurable-views/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ tasks.withType(Test) {
}

dependencies {
implementation('org.smartregister:opensrp-client-core:1.3.2-SNAPSHOT@aar') {
implementation('org.smartregister:opensrp-client-core:1.4.2-SNAPSHOT@aar') {
transitive = true
exclude group: 'com.github.bmelnychuk', module: 'atv'
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package org.smartregister.configurableviews.helper;

import android.content.Context;
import android.preference.PreferenceManager;

import org.smartregister.configurableviews.util.Constants;
import org.smartregister.util.Utils;

import static org.smartregister.configurableviews.util.Constants.LAST_VIEWS_SYNC_TIMESTAMP;
import static org.smartregister.configurableviews.util.Constants.VIEW_CONFIGURATION_PREFIX;
import static org.smartregister.util.Utils.getPreference;

/**
* Created by ndegwamartin on 21/02/2018.
Expand All @@ -31,16 +30,16 @@ private PreferenceHelper(Context context) {
}

public long getLastViewsSyncTimeStamp() {
return Long.parseLong(getPreference(context, LAST_VIEWS_SYNC_TIMESTAMP, "0"));
return PreferenceManager.getDefaultSharedPreferences(context).getLong(LAST_VIEWS_SYNC_TIMESTAMP, 0);
}

public void updateLastViewsSyncTimeStamp(long lastSyncTimeStamp) {
Utils.writePreference(context, LAST_VIEWS_SYNC_TIMESTAMP, lastSyncTimeStamp + "");
PreferenceManager.getDefaultSharedPreferences(context).edit().putLong(LAST_VIEWS_SYNC_TIMESTAMP, lastSyncTimeStamp).commit();
}


public void updateLoginConfigurableViewPreference(String loginJson) {
Utils.writePreference(context, VIEW_CONFIGURATION_PREFIX + Constants.CONFIGURATION.LOGIN, loginJson);
PreferenceManager.getDefaultSharedPreferences(context).edit().putString(VIEW_CONFIGURATION_PREFIX + Constants.CONFIGURATION.LOGIN, loginJson).commit();
}


Expand Down
2 changes: 1 addition & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ android {

dependencies {

implementation('org.smartregister:opensrp-client-core:1.3.2-SNAPSHOT@aar') {
implementation('org.smartregister:opensrp-client-core:1.4.2-SNAPSHOT@aar') {
transitive = true
exclude group: 'com.github.bmelnychuk', module: 'atv'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ public SampleRepository(Context context, org.smartregister.Context openSRPContex
public void onCreate(SQLiteDatabase database) {
super.onCreate(database);
EventClientRepository.createTable(database, EventClientRepository.Table.client, EventClientRepository.client_column.values());
EventClientRepository.createTable(database, EventClientRepository.Table.address, EventClientRepository.address_column.values());
EventClientRepository.createTable(database, EventClientRepository.Table.event, EventClientRepository.event_column.values());
EventClientRepository.createTable(database, EventClientRepository.Table.obs, EventClientRepository.obs_column.values());

ConfigurableViewsRepository.createTable(database);

Expand Down

0 comments on commit 37d383c

Please sign in to comment.