@ -1265,6 +1265,27 @@ public class MeditationAssistant extends Application {
// Do nothing
}
// Upgrade custom sound preferences.
String [ ] soundPrefs = { "start" , "interval" , "finish" , "bell" } ;
for ( String prefKey : soundPrefs ) {
try {
// Check for custom sound.
String soundPref = getPrefs ( ) . getString ( "pref_meditation_sound_" + prefKey , "" ) ;
if ( ! soundPref . equals ( "custom" ) ) {
continue ;
}
// Check for legacy custom sound path.
String customSound = getPrefs ( ) . getString ( "pref_meditation_sound_" + prefKey + "_custom" , "" ) ;
if ( customSound . contains ( "/" ) ) {
// Reset to default sound.
getPrefs ( ) . edit ( ) . putString ( "pref_meditation_sound_" + prefKey , "" ) . putString ( "pref_meditation_sound_" + prefKey + "_custom" , "" ) . apply ( ) ;
}
} catch ( Exception e ) {
// Do nothing.
}
}
db = DatabaseHandler . getInstance ( getApplicationContext ( ) ) ;
setDailyReminder ( getApplicationContext ( ) ) ;
@ -2654,7 +2675,7 @@ public class MeditationAssistant extends Application {
}
public static boolean hasPermission ( Context context , String permission ) {
if ( Build . VERSION . SDK_INT > = Build . VERSION_CODES . S) {
if ( Build . VERSION . SDK_INT > = Build . VERSION_CODES . TIRAMI SU ) {
return true ;
}
return ContextCompat . checkSelfPermission ( context , permission ) = = PackageManager . PERMISSION_GRANTED ;