Skip to content

Commit

Permalink
Replaced DatabaseFramework with DBModule
Browse files Browse the repository at this point in the history
  • Loading branch information
oxtoacart committed Sep 27, 2023
1 parent 5352475 commit f7b5ecd
Show file tree
Hide file tree
Showing 14 changed files with 99 additions and 760 deletions.
24 changes: 10 additions & 14 deletions DBModule/Sources/DBModule/Database.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public struct DatabaseFactory {
userInfo: [NSLocalizedDescriptionKey: "Database path cannot be blank"])
}
let connection = try! Connection(databasePath)
connection.trace { print($0) }
connection.trace { print($0) }
return DatabaseManager(database: connection)
}
}
Expand Down Expand Up @@ -71,9 +71,9 @@ class DatabaseManager: NSObject, MinisqlDBProtocol {
domain: "ArgumentError", code: 1,
userInfo: [NSLocalizedDescriptionKey: "Query or arguments are nil"])
}

let bindings = ValueUtil.toBindingsArray(args)

let statement = try db.prepare(query)

var rows: [Statement.Element] = []
Expand Down Expand Up @@ -130,14 +130,14 @@ class TransactionManager: NSObject, MinisqlTxProtocol {
}

do {
try statement.run(bindings)
try statement.run(bindings)
} catch {
switch error {
case let SQLite.Result.error(message, _, _):
throw message
default:
throw error
}
switch error {
case let SQLite.Result.error(message, code, _):
throw NSError(domain: message, code: Int(code), userInfo: nil)
default:
throw error
}
}
return QueryResult(changes: database.changes)
}
Expand Down Expand Up @@ -272,7 +272,3 @@ extension Date {
return Int64(Date().timeIntervalSince1970 * 1000)
}
}

extension String: LocalizedError {
public var errorDescription: String? { return self }
}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ build-framework: assert-go-version install-gomobile
-tags='headless lantern ios' \
-ldflags="$(LDFLAGS)" \
$(GOMOBILE_EXTRA_BUILD_FLAGS) \
github.com/getlantern/android-lantern/internalsdk github.com/getlantern/pathdb/testsupport github.com/getlantern/pathdb/minisql
github.com/getlantern/android-lantern/internalsdk github.com/getlantern/pathdb/testsupport github.com/getlantern/pathdb/minisql github.com/getlantern/flashlight/v7/ios
@echo "moving framework"
mkdir -p $(INTERNALSDK_FRAMEWORK_DIR)
mv ./$(INTERNALSDK_FRAMEWORK_NAME) $(INTERNALSDK_FRAMEWORK_DIR)/$(INTERNALSDK_FRAMEWORK_NAME)
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

42 changes: 21 additions & 21 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,21 @@ PODS:
- Flutter
- Google-Mobile-Ads-SDK (~> 10.4.0)
- webview_flutter_wkwebview
- GoogleAppMeasurement (10.14.0):
- GoogleAppMeasurement/AdIdSupport (= 10.14.0)
- GoogleAppMeasurement (10.15.0):
- GoogleAppMeasurement/AdIdSupport (= 10.15.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- GoogleAppMeasurement/AdIdSupport (10.14.0):
- GoogleAppMeasurement/WithoutAdIdSupport (= 10.14.0)
- GoogleAppMeasurement/AdIdSupport (10.15.0):
- GoogleAppMeasurement/WithoutAdIdSupport (= 10.15.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- GoogleAppMeasurement/WithoutAdIdSupport (10.14.0):
- GoogleAppMeasurement/WithoutAdIdSupport (10.15.0):
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
- GoogleUtilities/MethodSwizzler (~> 7.11)
- GoogleUtilities/Network (~> 7.11)
Expand All @@ -107,17 +107,17 @@ PODS:
- GoogleUtilities/Logger
- integration_test (0.0.1):
- Flutter
- libwebp (1.3.1):
- libwebp/demux (= 1.3.1)
- libwebp/mux (= 1.3.1)
- libwebp/sharpyuv (= 1.3.1)
- libwebp/webp (= 1.3.1)
- libwebp/demux (1.3.1):
- libwebp (1.3.2):
- libwebp/demux (= 1.3.2)
- libwebp/mux (= 1.3.2)
- libwebp/sharpyuv (= 1.3.2)
- libwebp/webp (= 1.3.2)
- libwebp/demux (1.3.2):
- libwebp/webp
- libwebp/mux (1.3.1):
- libwebp/mux (1.3.2):
- libwebp/demux
- libwebp/sharpyuv (1.3.1)
- libwebp/webp (1.3.1):
- libwebp/sharpyuv (1.3.2)
- libwebp/webp (1.3.2):
- libwebp/sharpyuv
- MTBBarcodeScanner (5.0.11)
- nanopb (2.30909.0):
Expand All @@ -136,9 +136,9 @@ PODS:
- qr_code_scanner (0.2.0):
- Flutter
- MTBBarcodeScanner
- SDWebImage (5.17.0):
- SDWebImage/Core (= 5.17.0)
- SDWebImage/Core (5.17.0)
- SDWebImage (5.18.2):
- SDWebImage/Core (= 5.18.2)
- SDWebImage/Core (5.18.2)
- share_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
Expand Down Expand Up @@ -288,19 +288,19 @@ SPEC CHECKSUMS:
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
Google-Mobile-Ads-SDK: 32fe7836431a06a29f7734ae092b600137c8108d
google_mobile_ads: 53b1f0d74445963e5810e34ac38dfb27aabe278e
GoogleAppMeasurement: 7fee012a868315d418f365fbc8d394d8e020e749
GoogleAppMeasurement: 722db6550d1e6d552b08398b69a975ac61039338
GoogleUserMessagingPlatform: dce302b8f1b84d6e945812ee7a15c3f65a102cbf
GoogleUtilities: 13e2c67ede716b8741c7989e26893d151b2b2084
integration_test: 13825b8a9334a850581300559b8839134b124670
libwebp: 33dc822fbbf4503668d09f7885bbfedc76c45e96
libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4
qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e
SDWebImage: 750adf017a315a280c60fde706ab1e552a3ae4e9
SDWebImage: c0de394d7cf7f9838aed1fd6bb6037654a4572e4
share_plus: 599aa54e4ea31d4b4c0e9c911bcc26c55e791028
shared_preferences_foundation: e2dae3258e06f44cc55f49d42024fd8dd03c590c
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
Expand All @@ -316,4 +316,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 4cde1e23c4c277b696c6e6e9589bbb76fb18fd3a

COCOAPODS: 1.11.3
COCOAPODS: 1.12.1
102 changes: 34 additions & 68 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
0308A1392AAEF8DE0086157A /* FlashlightManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0321C3F82AA9D8DF00D462C1 /* FlashlightManager.swift */; };
0308A13D2AAF39F80086157A /* FlashlightManagerExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0308A13C2AAF39F80086157A /* FlashlightManagerExtension.swift */; };
0308A13E2AAF43A10086157A /* UserNotificationsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0308A12B2AAEEE2C0086157A /* UserNotificationsManager.swift */; };
0315F55D2AC1C1A500D49F7B /* DatabaseFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0315F55C2AC1C1A500D49F7B /* DatabaseFramework.framework */; };
0315F55E2AC1C1A500D49F7B /* DatabaseFramework.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0315F55C2AC1C1A500D49F7B /* DatabaseFramework.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
0321C3F72AA9D84700D462C1 /* Process.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0321C3F62AA9D84700D462C1 /* Process.swift */; };
0321C3F92AA9D8DF00D462C1 /* FlashlightManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0321C3F82AA9D8DF00D462C1 /* FlashlightManager.swift */; };
0321C3FB2AA9DC6E00D462C1 /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03A1AB312AA890AB00FB41B2 /* NetworkExtension.framework */; };
Expand Down Expand Up @@ -55,25 +53,14 @@
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
EC22F6242AC44C8E0017D36C /* Internalsdk.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 035FDDD42A6A547F007B15C8 /* Internalsdk.xcframework */; };
EC22F6252AC44C8E0017D36C /* Internalsdk.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 035FDDD42A6A547F007B15C8 /* Internalsdk.xcframework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
EC27DE902AC44FAD00B840F2 /* DBModule in Frameworks */ = {isa = PBXBuildFile; productRef = EC27DE8F2AC44FAD00B840F2 /* DBModule */; };
ECCA8C672ABD16D20037BF9B /* LanternTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECCA8C662ABD16D20037BF9B /* LanternTests.swift */; };
F309D8C575359E6D35A75E9D /* Pods_LanternTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 49496710B5388EA1D58F0B15 /* Pods_LanternTests.framework */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
031B6A872AC166D900FE72A4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 031B6A822AC166D800FE72A4 /* DatabaseFramework.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 031B6A682AC166D800FE72A4;
remoteInfo = DatabaseFramework;
};
031B6A892AC166D900FE72A4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 031B6A822AC166D800FE72A4 /* DatabaseFramework.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 031B6A722AC166D800FE72A4;
remoteInfo = DatabaseFrameworkTests;
};
03A1AB382AA890AB00FB41B2 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
Expand All @@ -91,26 +78,26 @@
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
0315F55F2AC1C1A500D49F7B /* Embed Frameworks */ = {
03A1AB3F2AA890AB00FB41B2 /* Embed Foundation Extensions */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
dstSubfolderSpec = 13;
files = (
0315F55E2AC1C1A500D49F7B /* DatabaseFramework.framework in Embed Frameworks */,
03A1AB3A2AA890AB00FB41B2 /* Tunnel.appex in Embed Foundation Extensions */,
);
name = "Embed Frameworks";
name = "Embed Foundation Extensions";
runOnlyForDeploymentPostprocessing = 0;
};
03A1AB3F2AA890AB00FB41B2 /* Embed Foundation Extensions */ = {
EC22F6262AC44C8E0017D36C /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 13;
dstSubfolderSpec = 10;
files = (
03A1AB3A2AA890AB00FB41B2 /* Tunnel.appex in Embed Foundation Extensions */,
EC22F6252AC44C8E0017D36C /* Internalsdk.xcframework in Embed Frameworks */,
);
name = "Embed Foundation Extensions";
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
Expand All @@ -123,7 +110,6 @@
0308A12F2AAEF3AA0086157A /* Event.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Event.swift; sourceTree = "<group>"; };
0308A13C2AAF39F80086157A /* FlashlightManagerExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FlashlightManagerExtension.swift; sourceTree = "<group>"; };
0315F55C2AC1C1A500D49F7B /* DatabaseFramework.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DatabaseFramework.framework; path = "../../../../../Library/Developer/Xcode/DerivedData/DatabaseFramework-csnjouuwjwleiddbptbupimqigld/Build/Products/Debug-iphoneos/DatabaseFramework.framework"; sourceTree = "<group>"; };
031B6A822AC166D800FE72A4 /* DatabaseFramework.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = DatabaseFramework.xcodeproj; path = DatabaseFramework/DatabaseFramework.xcodeproj; sourceTree = "<group>"; };
0321C3F62AA9D84700D462C1 /* Process.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Process.swift; sourceTree = "<group>"; };
0321C3F82AA9D8DF00D462C1 /* FlashlightManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FlashlightManager.swift; sourceTree = "<group>"; };
032A43572AA6F8AA00EF442B /* DnsDetector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DnsDetector.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -176,6 +162,7 @@
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
CA815533D3563C2353745CE2 /* Pods-LanternTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LanternTests.release.xcconfig"; path = "Target Support Files/Pods-LanternTests/Pods-LanternTests.release.xcconfig"; sourceTree = "<group>"; };
E33BD5976CBD307AC6B17F23 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
EC27DE8E2AC44F4300B840F2 /* DBModule */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = DBModule; path = ../DBModule; sourceTree = "<group>"; };
ECCA8C642ABD16D20037BF9B /* LanternTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LanternTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
ECCA8C662ABD16D20037BF9B /* LanternTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LanternTests.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand All @@ -193,9 +180,10 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
EC27DE902AC44FAD00B840F2 /* DBModule in Frameworks */,
038A011E2AC1C329002FE1A9 /* Pods_Runner.framework in Frameworks */,
EC22F6242AC44C8E0017D36C /* Internalsdk.xcframework in Frameworks */,
0321C3FB2AA9DC6E00D462C1 /* NetworkExtension.framework in Frameworks */,
0315F55D2AC1C1A500D49F7B /* DatabaseFramework.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -210,23 +198,6 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
031B6A5D2AC166A200FE72A4 /* DatabaseFramework */ = {
isa = PBXGroup;
children = (
031B6A822AC166D800FE72A4 /* DatabaseFramework.xcodeproj */,
);
path = DatabaseFramework;
sourceTree = "<group>";
};
031B6A832AC166D800FE72A4 /* Products */ = {
isa = PBXGroup;
children = (
031B6A882AC166D900FE72A4 /* DatabaseFramework.framework */,
031B6A8A2AC166D900FE72A4 /* DatabaseFrameworkTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
032A43562AA6F86A00EF442B /* Network */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -350,7 +321,7 @@
97C146E51CF9000F007C117D = {
isa = PBXGroup;
children = (
031B6A5D2AC166A200FE72A4 /* DatabaseFramework */,
EC22F61E2AC44B000017D36C /* Packages */,
03CD38182A693C050044B004 /* internalsdk */,
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
Expand Down Expand Up @@ -402,6 +373,14 @@
path = Pods;
sourceTree = "<group>";
};
EC22F61E2AC44B000017D36C /* Packages */ = {
isa = PBXGroup;
children = (
EC27DE8E2AC44F4300B840F2 /* DBModule */,
);
name = Packages;
sourceTree = "<group>";
};
ECCA8C652ABD16D20037BF9B /* LanternTests */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -467,14 +446,17 @@
3F72706DAEB45E756D135F84 /* [CP] Embed Pods Frameworks */,
8CFC94838D10599DD335E9EC /* [CP] Copy Pods Resources */,
03A1AB3F2AA890AB00FB41B2 /* Embed Foundation Extensions */,
0315F55F2AC1C1A500D49F7B /* Embed Frameworks */,
EC22F6262AC44C8E0017D36C /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
03A1AB392AA890AB00FB41B2 /* PBXTargetDependency */,
);
name = Runner;
packageProductDependencies = (
EC27DE8F2AC44FAD00B840F2 /* DBModule */,
);
productName = Runner;
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
productType = "com.apple.product-type.application";
Expand Down Expand Up @@ -534,12 +516,6 @@
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 031B6A832AC166D800FE72A4 /* Products */;
ProjectRef = 031B6A822AC166D800FE72A4 /* DatabaseFramework.xcodeproj */;
},
);
projectRoot = "";
targets = (
97C146ED1CF9000F007C117D /* Runner */,
Expand All @@ -549,23 +525,6 @@
};
/* End PBXProject section */

/* Begin PBXReferenceProxy section */
031B6A882AC166D900FE72A4 /* DatabaseFramework.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = DatabaseFramework.framework;
remoteRef = 031B6A872AC166D900FE72A4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
031B6A8A2AC166D900FE72A4 /* DatabaseFrameworkTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = DatabaseFrameworkTests.xctest;
remoteRef = 031B6A892AC166D900FE72A4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */

/* Begin PBXResourcesBuildPhase section */
03A1AB2E2AA890AB00FB41B2 /* Resources */ = {
isa = PBXResourcesBuildPhase;
Expand Down Expand Up @@ -1344,6 +1303,13 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCSwiftPackageProductDependency section */
EC27DE8F2AC44FAD00B840F2 /* DBModule */ = {
isa = XCSwiftPackageProductDependency;
productName = DBModule;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}
Loading

0 comments on commit f7b5ecd

Please sign in to comment.