mirror of
https://github.com/nerzhul/ownCloud-SMS-App.git
synced 2025-06-21 14:56:27 +00:00
Use disable push_on_receive mechanism and comment new feature to prepare next release
This commit is contained in:
parent
af171ce788
commit
9ba7054d14
@ -103,7 +103,7 @@
|
||||
style="@style/StandardButton"
|
||||
android:text="@string/ma_button_sync_accounts_now" />
|
||||
|
||||
<TextView
|
||||
<!-- <TextView
|
||||
android:id="@+id/tv_remoteaccount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@ -125,15 +125,16 @@
|
||||
android:background="@drawable/standard_button"
|
||||
style="@style/StandardButton"
|
||||
android:text="@string/choose_account" />
|
||||
|
||||
-->
|
||||
<ImageView
|
||||
android:id="@+id/imageView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/textView1"
|
||||
android:layout_alignStart="@+id/textView1"
|
||||
android:layout_below="@+id/main_button_choose_account"
|
||||
android:layout_below="@+id/main_button_sync"
|
||||
android:layout_marginTop="33dp"
|
||||
android:src="@drawable/next_arrow" />
|
||||
<!-- android:layout_below="@+id/main_button_choose_account" -->
|
||||
|
||||
</RelativeLayout>
|
@ -27,7 +27,7 @@
|
||||
-->
|
||||
<resources>
|
||||
<!-- Translation version, reference for translators -->
|
||||
<string name="translation_version">6</string>
|
||||
<string name="translation_version">7</string>
|
||||
|
||||
<!-- Translations must begin there -->
|
||||
<!-- Preferences -->
|
||||
@ -91,6 +91,7 @@
|
||||
<item>-1</item>
|
||||
</string-array>
|
||||
|
||||
<string name="pref_push_on_receive">Push SMS on reception</string>
|
||||
<string name="pref_sync_wifi">Synchronize in Wi-Fi</string>
|
||||
<string name="pref_sync_4g">Synchronize in 4G</string>
|
||||
<string name="pref_sync_3g">Synchronize in 3G</string>
|
||||
|
@ -27,7 +27,7 @@
|
||||
-->
|
||||
<resources>
|
||||
<!-- Translation version, reference for translators -->
|
||||
<string name="translation_version">6</string>
|
||||
<string name="translation_version">7</string>
|
||||
|
||||
<!-- Translations must begin there -->
|
||||
|
||||
@ -71,6 +71,7 @@
|
||||
<item>-1</item>
|
||||
</string-array>
|
||||
|
||||
<string name="pref_push_on_receive">Pousser le SMS à la réception</string>
|
||||
<string name="pref_sync_wifi">Synchroniser en Wi-Fi</string>
|
||||
<string name="pref_sync_4g">Synchroniser en 4G</string>
|
||||
<string name="pref_sync_3g">Synchroniser en 3G</string>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<resources>
|
||||
|
||||
<!-- Translation version, reference for translators -->
|
||||
<string name="translation_version">6</string>
|
||||
<string name="translation_version">7</string>
|
||||
|
||||
<!-- System strings, do not translate -->
|
||||
<string name="app_name">ownCloud-SMS</string>
|
||||
@ -96,6 +96,7 @@
|
||||
<item>-1</item>
|
||||
</string-array>
|
||||
|
||||
<string name="pref_push_on_receive">Push SMS on reception</string>
|
||||
<string name="pref_sync_wifi">Synchronize in Wi-Fi</string>
|
||||
<string name="pref_sync_4g">Synchronize in 4G</string>
|
||||
<string name="pref_sync_3g">Synchronize in 3G</string>
|
||||
|
@ -25,12 +25,15 @@ import android.content.ContentResolver;
|
||||
import android.content.PeriodicSync;
|
||||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.util.Log;
|
||||
import fr.nrz.androidlib.activities.NrzSettingsActivity;
|
||||
import fr.unix_experience.owncloud_sms.R;
|
||||
import fr.unix_experience.owncloud_sms.defines.DefaultPrefs;
|
||||
import fr.unix_experience.owncloud_sms.prefs.OCSMSSharedPrefs;
|
||||
|
||||
public class GeneralSettingsActivity extends NrzSettingsActivity {
|
||||
private static final String TAG = GeneralSettingsActivity.class.getSimpleName();
|
||||
|
||||
private static AccountManager _accountMgr;
|
||||
private static String _accountAuthority;
|
||||
private static String _accountType;
|
||||
@ -65,6 +68,8 @@ public class GeneralSettingsActivity extends NrzSettingsActivity {
|
||||
key.equals(new String("sync_3g")) || key.equals("sync_gprs") ||
|
||||
key.equals("sync_4g") || key.equals("sync_others")) {
|
||||
final OCSMSSharedPrefs prefs = new OCSMSSharedPrefs(_context);
|
||||
Log.d(TAG,"GeneralSettingsActivity.handleCheckboxPreference: set " + key + " to "
|
||||
+ value.toString());
|
||||
prefs.putBoolean(key, value);
|
||||
}
|
||||
else {
|
||||
|
@ -12,28 +12,35 @@ package fr.unix_experience.owncloud_sms.broadcast_receivers;
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import org.json.JSONArray;
|
||||
|
||||
import fr.unix_experience.owncloud_sms.engine.ASyncSMSSync;
|
||||
import fr.unix_experience.owncloud_sms.engine.ConnectivityMonitor;
|
||||
import fr.unix_experience.owncloud_sms.engine.SmsFetcher;
|
||||
import fr.unix_experience.owncloud_sms.prefs.OCSMSSharedPrefs;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import fr.unix_experience.owncloud_sms.engine.ASyncSMSSync;
|
||||
import fr.unix_experience.owncloud_sms.engine.ConnectivityMonitor;
|
||||
import fr.unix_experience.owncloud_sms.engine.SmsFetcher;
|
||||
import fr.unix_experience.owncloud_sms.prefs.OCSMSSharedPrefs;
|
||||
|
||||
public class ConnectivityChanged extends BroadcastReceiver implements ASyncSMSSync {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
ConnectivityMonitor cMon = new ConnectivityMonitor(context);
|
||||
|
||||
public void onReceive(final Context context, final Intent intent) {
|
||||
final ConnectivityMonitor cMon = new ConnectivityMonitor(context);
|
||||
|
||||
final OCSMSSharedPrefs prefs = new OCSMSSharedPrefs(context);
|
||||
|
||||
if (!prefs.pushOnReceive()) {
|
||||
Log.d(TAG,"ConnectivityChanges.onReceive: pushOnReceive is disabled");
|
||||
return;
|
||||
}
|
||||
|
||||
// If data is available and previous dataConnectionState was false, then we need to sync
|
||||
if (cMon.isValid() && dataConnectionAvailable == false) {
|
||||
dataConnectionAvailable = true;
|
||||
@ -46,24 +53,24 @@ public class ConnectivityChanged extends BroadcastReceiver implements ASyncSMSSy
|
||||
Log.d(TAG,"ConnectivityChanges.onReceive: data conn is off");
|
||||
}
|
||||
}
|
||||
|
||||
private void checkMessagesAndSend(Context context) {
|
||||
|
||||
private void checkMessagesAndSend(final Context context) {
|
||||
// Get last message synced from preferences
|
||||
Long lastMessageSynced = (new OCSMSSharedPrefs(context)).getLastMessageDate();
|
||||
final Long lastMessageSynced = (new OCSMSSharedPrefs(context)).getLastMessageDate();
|
||||
Log.d(TAG,"Synced Last:" + lastMessageSynced);
|
||||
|
||||
|
||||
// Now fetch messages since last stored date
|
||||
JSONArray smsList = new SmsFetcher(context).bufferizeMessagesSinceDate(lastMessageSynced);
|
||||
|
||||
ConnectivityMonitor cMon = new ConnectivityMonitor(context);
|
||||
|
||||
final JSONArray smsList = new SmsFetcher(context).bufferizeMessagesSinceDate(lastMessageSynced);
|
||||
|
||||
final ConnectivityMonitor cMon = new ConnectivityMonitor(context);
|
||||
|
||||
// Synchronize if network is valid and there are SMS
|
||||
if (cMon.isValid() && smsList != null) {
|
||||
new SyncTask(context, smsList).execute();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static boolean dataConnectionAvailable = false;
|
||||
|
||||
|
||||
private static final String TAG = ConnectivityChanged.class.getSimpleName();
|
||||
}
|
||||
|
@ -39,6 +39,10 @@ public class OCSMSSharedPrefs extends SharedPrefs {
|
||||
return _sPrefs.getLong(_context.getString(R.string.pref_lastmsgdate), 0);
|
||||
}
|
||||
|
||||
public Boolean pushOnReceive() {
|
||||
return _sPrefs.getBoolean("push_on_receive", DefaultPrefs.pushOnReceive);
|
||||
}
|
||||
|
||||
public Boolean syncInWifi() {
|
||||
return _sPrefs.getBoolean("sync_wifi", DefaultPrefs.syncWifi);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user