From 83cfc7dd703c04613c6b83f2a9234a3c98229660 Mon Sep 17 00:00:00 2001
From: OmarHatem <omarh.ismail1@gmail.com>
Date: Mon, 25 Nov 2024 21:05:36 +0200
Subject: [PATCH] fix building with haven

---
 cw_haven/android/build.gradle                 | 18 +++++++++++++++---
 cw_shared_external/android/build.gradle       | 15 ++++++++++++++-
 linux/flutter/generated_plugins.cmake         |  1 +
 macos/Flutter/GeneratedPluginRegistrant.swift |  2 ++
 pubspec_base.yaml                             |  2 +-
 scripts/android/inject_app_details.sh         |  2 +-
 windows/flutter/generated_plugins.cmake       |  1 +
 7 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/cw_haven/android/build.gradle b/cw_haven/android/build.gradle
index d29c31d4e..8eb728a67 100644
--- a/cw_haven/android/build.gradle
+++ b/cw_haven/android/build.gradle
@@ -2,14 +2,14 @@ group 'com.cakewallet.cw_haven'
 version '1.0-SNAPSHOT'
 
 buildscript {
-    ext.kotlin_version = '1.7.10'
+    ext.kotlin_version = '2.0.21'
     repositories {
         google()
         mavenCentral()
     }
 
     dependencies {
-        classpath 'com.android.tools.build:gradle:7.3.0'
+        classpath 'com.android.tools.build:gradle:8.7.1'
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
     }
 }
@@ -25,8 +25,20 @@ apply plugin: 'com.android.library'
 apply plugin: 'kotlin-android'
 
 android {
-    compileSdkVersion 28
+    compileSdkVersion 33
 
+    if (project.android.hasProperty("namespace")) {
+        namespace 'com.cakewallet.cw_haven'
+    }
+
+    compileOptions {
+        sourceCompatibility JavaVersion.VERSION_17
+        targetCompatibility JavaVersion.VERSION_17
+    }
+
+    kotlinOptions {
+        jvmTarget = '17'
+    }
     sourceSets {
         main.java.srcDirs += 'src/main/kotlin'
     }
diff --git a/cw_shared_external/android/build.gradle b/cw_shared_external/android/build.gradle
index 64b550364..8d2b1b13d 100644
--- a/cw_shared_external/android/build.gradle
+++ b/cw_shared_external/android/build.gradle
@@ -25,7 +25,20 @@ apply plugin: 'com.android.library'
 apply plugin: 'kotlin-android'
 
 android {
-    compileSdkVersion 30
+    compileSdkVersion 33
+
+    if (project.android.hasProperty("namespace")) {
+        namespace 'com.cakewallet.cw_shared_external'
+    }
+
+    compileOptions {
+        sourceCompatibility JavaVersion.VERSION_17
+        targetCompatibility JavaVersion.VERSION_17
+    }
+
+    kotlinOptions {
+        jvmTarget = '17'
+    }
 
     sourceSets {
         main.java.srcDirs += 'src/main/kotlin'
diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake
index 4b9eb3b2d..f52be7481 100644
--- a/linux/flutter/generated_plugins.cmake
+++ b/linux/flutter/generated_plugins.cmake
@@ -10,6 +10,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
 )
 
 list(APPEND FLUTTER_FFI_PLUGIN_LIST
+  sp_scanner
 )
 
 set(PLUGIN_BUNDLED_LIBRARIES)
diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift
index 52b44e53e..42b9fa84c 100644
--- a/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -6,6 +6,7 @@ import FlutterMacOS
 import Foundation
 
 import connectivity_plus
+import cw_mweb
 import device_info_plus
 import devicelocale
 import fast_scanner
@@ -23,6 +24,7 @@ import wakelock_plus
 
 func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
   ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
+  CwMwebPlugin.register(with: registry.registrar(forPlugin: "CwMwebPlugin"))
   DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
   DevicelocalePlugin.register(with: registry.registrar(forPlugin: "DevicelocalePlugin"))
   MobileScannerPlugin.register(with: registry.registrar(forPlugin: "MobileScannerPlugin"))
diff --git a/pubspec_base.yaml b/pubspec_base.yaml
index 39fe953d0..221f1d9bf 100644
--- a/pubspec_base.yaml
+++ b/pubspec_base.yaml
@@ -26,7 +26,7 @@ dependencies:
   share_plus: ^10.0.0
   # date_range_picker: ^1.0.6
   #https://api.flutter.dev/flutter/material/showDateRangePicker.html
-  dio: ^4.0.6
+  dio: ^5.7.0
   hive: ^2.2.3
   hive_flutter: ^1.1.0
   local_auth_android: ^1.0.46
diff --git a/scripts/android/inject_app_details.sh b/scripts/android/inject_app_details.sh
index 2e50ea31b..7b0d74798 100755
--- a/scripts/android/inject_app_details.sh
+++ b/scripts/android/inject_app_details.sh
@@ -6,10 +6,10 @@ if [ -z "$APP_ANDROID_TYPE" ]; then
 fi
 
 cd ../..
+set -x
 universal_sed "1,/version:/ {s/version:.*/version: ${APP_ANDROID_VERSION}+${APP_ANDROID_BUILD_NUMBER}/;}" ./pubspec.yaml
 universal_sed "1,/version:/ {s/__APP_PACKAGE__/${APP_ANDROID_PACKAGE}/;}" ./android/app/src/main/AndroidManifest.xml
 universal_sed "1,/__APP_SCHEME__/ {s/__APP_SCHEME__/${APP_ANDROID_SCHEME}/;}" ./android/app/src/main/AndroidManifest.xml
 universal_sed "1,/version:/ {s/__versionCode__/${APP_ANDROID_BUILD_NUMBER}/;}" ./android/app/src/main/AndroidManifest.xml
 universal_sed "1,/version:/ {s/__versionName__/${APP_ANDROID_VERSION}/;}" ./android/app/src/main/AndroidManifest.xml
-
 cd scripts/android
diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake
index f8f89611c..e0f2c11c0 100644
--- a/windows/flutter/generated_plugins.cmake
+++ b/windows/flutter/generated_plugins.cmake
@@ -14,6 +14,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
 )
 
 list(APPEND FLUTTER_FFI_PLUGIN_LIST
+  sp_scanner
 )
 
 set(PLUGIN_BUNDLED_LIBRARIES)