Skip to content

Commit 9f90059

Browse files
committed
manage lookup visitor
1 parent c1c38e3 commit 9f90059

File tree

12 files changed

+162
-43
lines changed

12 files changed

+162
-43
lines changed

example/ios/Flutter/AppFrameworkInfo.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>12.0</string>
24+
<string>13.0</string>
2525
</dict>
2626
</plist>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# Generated file, do not edit.
3+
#
4+
5+
import lldb
6+
7+
def handle_new_rx_page(frame: lldb.SBFrame, bp_loc, extra_args, intern_dict):
8+
"""Intercept NOTIFY_DEBUGGER_ABOUT_RX_PAGES and touch the pages."""
9+
base = frame.register["x0"].GetValueAsAddress()
10+
page_len = frame.register["x1"].GetValueAsUnsigned()
11+
12+
# Note: NOTIFY_DEBUGGER_ABOUT_RX_PAGES will check contents of the
13+
# first page to see if handled it correctly. This makes diagnosing
14+
# misconfiguration (e.g. missing breakpoint) easier.
15+
data = bytearray(page_len)
16+
data[0:8] = b'IHELPED!'
17+
18+
error = lldb.SBError()
19+
frame.GetThread().GetProcess().WriteMemory(base, data, error)
20+
if not error.Success():
21+
print(f'Failed to write into {base}[+{page_len}]', error)
22+
return
23+
24+
def __lldb_init_module(debugger: lldb.SBDebugger, _):
25+
target = debugger.GetDummyTarget()
26+
# Caveat: must use BreakpointCreateByRegEx here and not
27+
# BreakpointCreateByName. For some reasons callback function does not
28+
# get carried over from dummy target for the later.
29+
bp = target.BreakpointCreateByRegex("^NOTIFY_DEBUGGER_ABOUT_RX_PAGES$")
30+
bp.SetScriptCallbackFunction('{}.handle_new_rx_page'.format(__name__))
31+
bp.SetAutoContinue(True)
32+
print("-- LLDB integration loaded --")
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#
2+
# Generated file, do not edit.
3+
#
4+
5+
command script import --relative-to-command-file flutter_lldb_helper.py

example/ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Uncomment this line to define a global platform for your project
2-
platform :ios, '12.0'
2+
platform :ios, '13.0'
33

44
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
55
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

example/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ EXTERNAL SOURCES:
3333

3434
SPEC CHECKSUMS:
3535
device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe
36-
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
36+
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
3737
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
3838
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
3939
sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0
4040

41-
PODFILE CHECKSUM: ce13d36744da294d67f8e460dbb7aed7c09bd7f4
41+
PODFILE CHECKSUM: 30517025a2fecca2d72dac25f08abb5b9a8f1a56
4242

4343
COCOAPODS: 1.16.2

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@
342342
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
343343
GCC_WARN_UNUSED_FUNCTION = YES;
344344
GCC_WARN_UNUSED_VARIABLE = YES;
345-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
345+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
346346
MTL_ENABLE_DEBUG_INFO = NO;
347347
SDKROOT = iphoneos;
348348
SUPPORTED_PLATFORMS = iphoneos;
@@ -423,7 +423,7 @@
423423
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
424424
GCC_WARN_UNUSED_FUNCTION = YES;
425425
GCC_WARN_UNUSED_VARIABLE = YES;
426-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
426+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
427427
MTL_ENABLE_DEBUG_INFO = YES;
428428
ONLY_ACTIVE_ARCH = YES;
429429
SDKROOT = iphoneos;
@@ -472,7 +472,7 @@
472472
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
473473
GCC_WARN_UNUSED_FUNCTION = YES;
474474
GCC_WARN_UNUSED_VARIABLE = YES;
475-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
475+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
476476
MTL_ENABLE_DEBUG_INFO = NO;
477477
SDKROOT = iphoneos;
478478
SUPPORTED_PLATFORMS = iphoneos;

example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
2930
shouldUseLaunchSchemeArgsEnv = "YES">
3031
<Testables>
3132
</Testables>
@@ -45,11 +46,13 @@
4546
buildConfiguration = "Debug"
4647
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4748
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
49+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
4850
launchStyle = "0"
4951
useCustomWorkingDirectory = "NO"
5052
ignoresPersistentStateOnLaunch = "NO"
5153
debugDocumentVersioning = "YES"
5254
debugServiceExtension = "internal"
55+
enableGPUValidationMode = "1"
5356
allowLocationSimulation = "YES">
5457
<BuildableProductRunnable
5558
runnableDebuggingMode = "0">

example/pubspec.lock

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,26 @@ packages:
2121
dependency: transitive
2222
description:
2323
name: characters
24-
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
24+
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
2525
url: "https://pub.dev"
2626
source: hosted
27-
version: "1.3.0"
27+
version: "1.4.0"
2828
clock:
2929
dependency: transitive
3030
description:
3131
name: clock
32-
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
32+
sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b
3333
url: "https://pub.dev"
3434
source: hosted
35-
version: "1.1.1"
35+
version: "1.1.2"
3636
collection:
3737
dependency: transitive
3838
description:
3939
name: collection
40-
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
40+
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
4141
url: "https://pub.dev"
4242
source: hosted
43-
version: "1.19.0"
43+
version: "1.19.1"
4444
crypto:
4545
dependency: transitive
4646
description:
@@ -77,10 +77,10 @@ packages:
7777
dependency: transitive
7878
description:
7979
name: fake_async
80-
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
80+
sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44"
8181
url: "https://pub.dev"
8282
source: hosted
83-
version: "1.3.1"
83+
version: "1.3.3"
8484
ffi:
8585
dependency: transitive
8686
description:
@@ -103,7 +103,7 @@ packages:
103103
path: ".."
104104
relative: true
105105
source: path
106-
version: "4.1.2-beta"
106+
version: "4.2.0-beta"
107107
flutter:
108108
dependency: "direct main"
109109
description: flutter
@@ -163,34 +163,34 @@ packages:
163163
dependency: transitive
164164
description:
165165
name: leak_tracker
166-
sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06"
166+
sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de"
167167
url: "https://pub.dev"
168168
source: hosted
169-
version: "10.0.7"
169+
version: "11.0.2"
170170
leak_tracker_flutter_testing:
171171
dependency: transitive
172172
description:
173173
name: leak_tracker_flutter_testing
174-
sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379"
174+
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"
175175
url: "https://pub.dev"
176176
source: hosted
177-
version: "3.0.8"
177+
version: "3.0.10"
178178
leak_tracker_testing:
179179
dependency: transitive
180180
description:
181181
name: leak_tracker_testing
182-
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
182+
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"
183183
url: "https://pub.dev"
184184
source: hosted
185-
version: "3.0.1"
185+
version: "3.0.2"
186186
matcher:
187187
dependency: transitive
188188
description:
189189
name: matcher
190-
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
190+
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
191191
url: "https://pub.dev"
192192
source: hosted
193-
version: "0.12.16+1"
193+
version: "0.12.17"
194194
material_color_utilities:
195195
dependency: transitive
196196
description:
@@ -203,10 +203,10 @@ packages:
203203
dependency: transitive
204204
description:
205205
name: meta
206-
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
206+
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
207207
url: "https://pub.dev"
208208
source: hosted
209-
version: "1.15.0"
209+
version: "1.16.0"
210210
murmurhash:
211211
dependency: transitive
212212
description:
@@ -227,10 +227,10 @@ packages:
227227
dependency: transitive
228228
description:
229229
name: path
230-
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
230+
sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
231231
url: "https://pub.dev"
232232
source: hosted
233-
version: "1.9.0"
233+
version: "1.9.1"
234234
path_provider:
235235
dependency: transitive
236236
description:
@@ -424,18 +424,18 @@ packages:
424424
dependency: transitive
425425
description:
426426
name: stack_trace
427-
sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
427+
sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1"
428428
url: "https://pub.dev"
429429
source: hosted
430-
version: "1.12.0"
430+
version: "1.12.1"
431431
stream_channel:
432432
dependency: transitive
433433
description:
434434
name: stream_channel
435-
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
435+
sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d"
436436
url: "https://pub.dev"
437437
source: hosted
438-
version: "2.1.2"
438+
version: "2.1.4"
439439
string_scanner:
440440
dependency: transitive
441441
description:
@@ -464,10 +464,10 @@ packages:
464464
dependency: transitive
465465
description:
466466
name: test_api
467-
sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
467+
sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00"
468468
url: "https://pub.dev"
469469
source: hosted
470-
version: "0.7.3"
470+
version: "0.7.6"
471471
typed_data:
472472
dependency: transitive
473473
description:
@@ -488,10 +488,10 @@ packages:
488488
dependency: transitive
489489
description:
490490
name: vector_math
491-
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
491+
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
492492
url: "https://pub.dev"
493493
source: hosted
494-
version: "2.1.4"
494+
version: "2.2.0"
495495
vm_service:
496496
dependency: transitive
497497
description:
@@ -533,5 +533,5 @@ packages:
533533
source: hosted
534534
version: "1.1.0"
535535
sdks:
536-
dart: ">=3.6.0 <4.0.0"
536+
dart: ">=3.8.0-0 <4.0.0"
537537
flutter: ">=3.27.0"

lib/Storage/database_management.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,22 @@ class DatabaseManagement {
159159
return '';
160160
}
161161
}
162+
163+
// Check if visitor exists in database
164+
Future<bool> visitorExists(String visitorId, String nameTable) async {
165+
try {
166+
final db = _visitorDatabase;
167+
if (db == null) return false;
168+
169+
List<Map> result = await db.rawQuery(
170+
'SELECT COUNT(*) as count FROM $nameTable WHERE id = ?', [visitorId]);
171+
172+
int count = result.first['count'] ?? 0;
173+
return count > 0;
174+
} on Exception catch (e) {
175+
Flagship.logger(Level.EXCEPTIONS,
176+
"Error checking if visitor exists: ${e.toString()}");
177+
return false;
178+
}
179+
}
162180
}

lib/cache/default_cache.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,12 @@ class DefaultCacheVisitorImp with IVisitorCacheImplementation {
9595
await _checkDatabase();
9696
return dbMgt.readVisitor(visitoId, 'table_visitors');
9797
}
98+
99+
@override
100+
Future<bool> visitorExists(String visitorId) async {
101+
Flagship.logger(
102+
Level.DEBUG, "visitorExists from default cache Implementation");
103+
await _checkDatabase();
104+
return dbMgt.visitorExists(visitorId, 'table_visitors');
105+
}
98106
}

0 commit comments

Comments
 (0)