Panagiotis Triantafyllou

db fixes, new version

...@@ -5,7 +5,7 @@ android.buildFeatures.buildConfig = true ...@@ -5,7 +5,7 @@ android.buildFeatures.buildConfig = true
5 5
6 ext { 6 ext {
7 PUBLISH_GROUP_ID = 'ly.warp' 7 PUBLISH_GROUP_ID = 'ly.warp'
8 - PUBLISH_VERSION = '4.5.5.4p10' 8 + PUBLISH_VERSION = '4.5.5.4p11'
9 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 9 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
10 } 10 }
11 11
...@@ -107,9 +107,9 @@ dependencies { ...@@ -107,9 +107,9 @@ dependencies {
107 implementation 'com.huawei.hms:maps-basic:6.9.0.300' 107 implementation 'com.huawei.hms:maps-basic:6.9.0.300'
108 108
109 //------------------------------ SQLCipher -----------------------------// 109 //------------------------------ SQLCipher -----------------------------//
110 - api "net.zetetic:android-database-sqlcipher:4.5.2" 110 + api "net.zetetic:android-database-sqlcipher:4.5.4"
111 - api "androidx.sqlite:sqlite:2.2.0" 111 + api "androidx.sqlite:sqlite:2.5.1"
112 - api 'com.getkeepsafe.relinker:relinker:1.4.4' 112 + api 'com.getkeepsafe.relinker:relinker:1.4.5'
113 113
114 //------------------------------ Calligraphy -----------------------------// 114 //------------------------------ Calligraphy -----------------------------//
115 // api 'io.github.inflationx:calligraphy3:3.1.1' 115 // api 'io.github.inflationx:calligraphy3:3.1.1'
......
...@@ -258,8 +258,8 @@ ...@@ -258,8 +258,8 @@
258 <!-- </intent-filter>--> 258 <!-- </intent-filter>-->
259 <!-- </receiver>--> 259 <!-- </receiver>-->
260 260
261 - <!-- <provider--> 261 + <provider
262 - <!-- android:name=".utils.WarplyProvider"--> 262 + android:name=".utils.WarplyProvider"
263 - <!-- android:authorities="ly.warp.sdk.utils.WarplyProvider" />--> 263 + android:authorities="ly.warp.sdk.utils.WarplyProvider" />
264 </application> 264 </application>
265 </manifest> 265 </manifest>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -2,6 +2,7 @@ package ly.warp.sdk.utils; ...@@ -2,6 +2,7 @@ package ly.warp.sdk.utils;
2 2
3 import android.content.ContentProvider; 3 import android.content.ContentProvider;
4 import android.content.ContentValues; 4 import android.content.ContentValues;
5 +import android.content.Context;
5 import android.database.Cursor; 6 import android.database.Cursor;
6 import android.net.Uri; 7 import android.net.Uri;
7 8
...@@ -9,6 +10,8 @@ import androidx.annotation.NonNull; ...@@ -9,6 +10,8 @@ import androidx.annotation.NonNull;
9 import androidx.annotation.Nullable; 10 import androidx.annotation.Nullable;
10 import androidx.appcompat.app.AppCompatDelegate; 11 import androidx.appcompat.app.AppCompatDelegate;
11 12
13 +import ly.warp.sdk.db.WarplyDBHelper;
14 +
12 /** 15 /**
13 * Created by Panagiotis Triantafyllou on 05/Αυγ/2022. 16 * Created by Panagiotis Triantafyllou on 05/Αυγ/2022.
14 */ 17 */
...@@ -16,7 +19,14 @@ public class WarplyProvider extends ContentProvider { ...@@ -16,7 +19,14 @@ public class WarplyProvider extends ContentProvider {
16 19
17 @Override 20 @Override
18 public boolean onCreate() { 21 public boolean onCreate() {
19 - AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); 22 +// AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
23 +
24 + // Initialize the database helper
25 + Context context = getContext();
26 + if (context != null) {
27 + WarplyDBHelper dbHelper = WarplyDBHelper.getInstance(context);
28 + dbHelper.initialize(); // This will initialize the database connection on a background thread
29 + }
20 // ViewPump.init(ViewPump.builder() 30 // ViewPump.init(ViewPump.builder()
21 // .addInterceptor(new CalligraphyInterceptor( 31 // .addInterceptor(new CalligraphyInterceptor(
22 // new CalligraphyConfig.Builder() 32 // new CalligraphyConfig.Builder()
...@@ -34,6 +44,18 @@ public class WarplyProvider extends ContentProvider { ...@@ -34,6 +44,18 @@ public class WarplyProvider extends ContentProvider {
34 return true; 44 return true;
35 } 45 }
36 46
47 + @Override
48 + public void shutdown() {
49 + // Get the database helper instance and shut it down
50 + Context context = getContext();
51 + if (context != null) {
52 + WarplyDBHelper dbHelper = WarplyDBHelper.getInstance(context);
53 + dbHelper.shutdown();
54 + }
55 +
56 + super.shutdown();
57 + }
58 +
37 @Nullable 59 @Nullable
38 @Override 60 @Override
39 public Cursor query(@NonNull Uri uri, @Nullable String[] strings, @Nullable String s, @Nullable String[] strings1, @Nullable String s1) { 61 public Cursor query(@NonNull Uri uri, @Nullable String[] strings, @Nullable String s, @Nullable String[] strings1, @Nullable String s1) {
......