Skip to content
This repository has been archived by the owner on May 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #532 from a93h/master
Browse files Browse the repository at this point in the history
Limit Database Overwrite & Optimize Imports
  • Loading branch information
Austin H authored Sep 16, 2019
2 parents bc3fa68 + e598244 commit 1c933bc
Show file tree
Hide file tree
Showing 18 changed files with 31 additions and 36 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "com.adam.aslfms"
minSdkVersion 14
targetSdkVersion 26
versionCode = 58
versionName = "1.6.7"
versionCode = 59
versionName = "1.6.8"

testApplicationId "com.adam.aslfms.test"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
Expand Down
3 changes: 1 addition & 2 deletions app/src/androidTest/res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
android:layout_height="fill_parent">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/assets/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Visit,
https://github.com/simple-last-fm-scrobbler/sls
For more details.
https://github.com/simple-last-fm-scrobbler/sls/wiki/Privacy-Concerns
For privacy concerns.

- 1.6.8 (2019-9-15) codename: kingus
* Correction Rules database problem fixed

- 1.6.7 (2019-9-15) codename: jingus
* Fixed non-foreground service crash Bug
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/com/adam/aslfms/ChangeThemeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/com/adam/aslfms/MusicAppsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
import android.support.v4.app.NavUtils;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/com/adam/aslfms/OptionsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.net.sip.SipSession;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/adam/aslfms/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ protected void onCreate(Bundle savedInstanceState) {
int v = Util.getAppVersionCode(this, getPackageName());
if (settings.getWhatsNewViewedVersion() < v){
settings.setKeyBypassNewPermissions(2);
mDb.rebuildDataBaseOnce(); // keep as not all users have the newest database.
mDb.rebuildScrobblesDatabaseOnce(); // keep as not all users have the newest database.
// TODO: verify only needed databases are destroyed
}
if (settings.getKeyBypassNewPermissions() == 2){
startActivity(new Intent(this, PermissionsActivity.class));
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/com/adam/aslfms/UserCredActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import android.util.Log;
import android.view.MenuItem;

import com.adam.aslfms.service.ControllerReceiverService;
import com.adam.aslfms.service.NetApp;
import com.adam.aslfms.service.ScrobblingService;
import com.adam.aslfms.util.AppSettings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
import android.support.v4.app.NavUtils;
import android.util.Log;
import android.view.MenuItem;

import com.adam.aslfms.service.NetApp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import android.view.View;
import android.widget.TextView;

import com.adam.aslfms.util.ScrobblesDatabase;
import com.adam.aslfms.util.CorrectionRule;
import com.adam.aslfms.util.ScrobblesDatabase;

import java.util.AbstractMap.SimpleEntry;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
import android.widget.TextView;

import com.adam.aslfms.util.AppSettings;
import com.adam.aslfms.util.CorrectionRule;
import com.adam.aslfms.util.MyContextWrapper;
import com.adam.aslfms.util.ScrobblesDatabase;
import com.adam.aslfms.util.CorrectionRule;
import com.adam.aslfms.util.Util;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
Expand All @@ -43,7 +41,6 @@
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.CursorAdapter;
import android.widget.ListView;
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/com/adam/aslfms/ViewScrobbleInfoDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.database.Cursor;
import android.os.Build;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/adam/aslfms/service/Scrobbler.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ private void notifyAuthStatusUpdate(int st) {
}

/**
* @return a {@link ScrobbleResult} struct with some info
* @throws BadSessionException
* @throws TemporaryFailureException
* @throws AuthStatus.BadSessionException
*/
public void scrobbleCommit(HandshakeResult hInfo, Track[] tracks)
throws BadSessionException, TemporaryFailureException, AuthStatus.ClientBannedException, AuthStatus.UnknownResponseException {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/adam/aslfms/util/MyBase64.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class MyBase64 {
public static final int URL_SAFE = 8;

/**
* Flag to pass to {@link Base64OutputStream} to indicate that it
* Flag to pass to {@link MyBase64} OutputStream to indicate that it
* should not close the output stream it is wrapping when it
* itself is closed.
*/
Expand Down
26 changes: 17 additions & 9 deletions app/src/main/java/com/adam/aslfms/util/ScrobblesDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -504,21 +504,29 @@ public CorrectionRule fetchCorrectioneRule(int id) {
return rule;
}

public void rebuildDataBaseOnce() {
mDb.execSQL("DROP TABLE IF EXISTS " + TABLENAME_SCROBBLES);
public void rebuildCoreNetappDatabaseOnce(){
Log.d(TAG, "dropping sql corenetapp ");
mDb.execSQL("DROP TABLE IF EXISTS " + TABLENAME_CORRNETAPP);
// TODO add migration of old rules if/when necessary
Log.d(TAG, "create sql corrnetapp: " + DATABASE_CREATE_CORRNETAPP);
mDb.execSQL(DATABASE_CREATE_CORRNETAPP);
}

public void rebuildCorrectionsDatabaseOnce(){
Log.d(TAG, "dropping sql corrections ");
mDb.execSQL("DROP TABLE IF EXISTS " + TABLENAME_CORRECTION_RULES);
mDb.execSQL("DROP TABLE IF EXISTS " + TABLENAME_RULE_CHANGES);
mDb.execSQL("DROP TRIGGER IF EXISTS " + TRIGGER_NAME_CHECK_CORRECTION_RULES);
Log.d(TAG, "create sql scrobbles: " + DATABASE_CREATE_SCROBBLES);
Log.d(TAG, "create sql corrnetapp: " + DATABASE_CREATE_CORRNETAPP);

mDb.execSQL(DATABASE_CREATE_SCROBBLES);
mDb.execSQL(DATABASE_CREATE_CORRNETAPP);
// Tables and trigger for updating scrobbles based on rules.
Log.d(TAG, "create sql corrections: " + DATABASE_CREATE_CORRECTION_RULES);
mDb.execSQL(DATABASE_CREATE_CORRECTION_RULES);
mDb.execSQL(DATABASE_CREATE_RULE_CHANGES);
mDb.execSQL(TRIGGGER_CREATE_CHECK_CORRECTION_RULES);
}


public void rebuildScrobblesDatabaseOnce(){
Log.d(TAG, "dropping sql scrobbles ");
mDb.execSQL("DROP TABLE IF EXISTS " + TABLENAME_SCROBBLES);
Log.d(TAG, "create sql scrobbles: " + DATABASE_CREATE_SCROBBLES);
mDb.execSQL(DATABASE_CREATE_SCROBBLES);
}
}
1 change: 0 additions & 1 deletion app/src/main/res/layout/activity_permissions.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
7 changes: 0 additions & 7 deletions app/src/main/res/layout/theme_options.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,4 @@

</RadioGroup>
</LinearLayout>

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:orientation="horizontal"></LinearLayout>
</LinearLayout>

0 comments on commit 1c933bc

Please sign in to comment.