Skip to content

Commit

Permalink
revert: load web js sdk localy
Browse files Browse the repository at this point in the history
  • Loading branch information
YoloMao committed Oct 14, 2024
1 parent d3782fe commit c818268
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 35 deletions.
5 changes: 1 addition & 4 deletions GrowingAnalytics.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ GrowingAnalytics具备自动采集基本的用户行为事件,比如访问和
trackerCore.dependency 'GrowingUtils/TrackerCore', '~> 1.2.3'
trackerCore.source_files = 'GrowingTrackerCore/**/*{.h,.m,.c,.cpp,.mm}'
trackerCore.public_header_files = 'GrowingTrackerCore/Public/*.h'
trackerCore.ios.resource_bundles = {'GrowingAnalytics' => [
'Resources/iOS/GrowingAnalytics.bundle/PrivacyInfo.xcprivacy',
'Resources/iOS/GrowingAnalytics.bundle/gdp-full.js'
]}
trackerCore.ios.resource_bundles = {'GrowingAnalytics' => ['Resources/iOS/GrowingAnalytics.bundle/PrivacyInfo.xcprivacy']}
trackerCore.osx.resource_bundles = {'GrowingAnalytics' => ['Resources/macOS/GrowingAnalytics.bundle/PrivacyInfo.xcprivacy']}
trackerCore.watchos.resource_bundles = {'GrowingAnalytics' => ['Resources/watchOS/GrowingAnalytics.bundle/PrivacyInfo.xcprivacy']}
trackerCore.tvos.resource_bundles = {'GrowingAnalytics' => ['Resources/tvOS/GrowingAnalytics.bundle/PrivacyInfo.xcprivacy']}
Expand Down
25 changes: 0 additions & 25 deletions Modules/Hybrid/GrowingWKWebViewJavascriptBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
#import "Modules/Hybrid/GrowingWebViewJavascriptBridgeConfiguration.h"
#import "Modules/Hybrid/Public/GrowingHybridModule.h"

#if SWIFT_PACKAGE
@import GrowingBundle;
#endif

static NSString *const kGrowingWKWebViewJavascriptBridge = @"GrowingWKWebViewJavascriptBridge";

@interface GrowingWKWebViewJavascriptBridge () <WKScriptMessageHandler>
Expand Down Expand Up @@ -128,34 +124,13 @@ + (WKUserScript *)bridgeJsUserScriptWithConfig:(GrowingWebViewJavascriptBridgeCo
}

+ (WKUserScript *)javaScriptSdkInjectJsUserScriptWithConfig:(GrowingWebViewJavascriptBridgeConfiguration *)config {
// NSBundle *bundle = [self resourcesBundle];
// NSString *filePath = [bundle pathForResource:@"gdp-full" ofType:@"js"];
// NSString *webJSContent = [NSString stringWithContentsOfFile:filePath
// encoding:NSUTF8StringEncoding
// error:nil];
// webJSContent =
// [webJSContent stringByAppendingFormat:@"gdp('init', '%@', '%@');", config.accountId, config.dataSourceId];
// WKUserScript *userScript = [[WKUserScript alloc] initWithSource:webJSContent
// injectionTime:WKUserScriptInjectionTimeAtDocumentEnd
// forMainFrameOnly:NO];
WKUserScript *userScript = [[WKUserScript alloc]
initWithSource:[GrowingWKWebViewJavascriptBridge_JS createJavascriptSdkInjectJsWithNativeConfiguration:config]
injectionTime:WKUserScriptInjectionTimeAtDocumentEnd
forMainFrameOnly:NO];
return userScript;
}

+ (NSBundle *)resourcesBundle {
#if SWIFT_PACKAGE
return GrowingBundleWrapper_SWIFTPM_MODULE_BUNDLE();
#else
NSBundle *bundle = [NSBundle bundleForClass:self.class];
NSString *bundleName = @"GrowingAnalytics.bundle";
NSString *path = [bundle.resourcePath stringByAppendingPathComponent:bundleName];
return [NSBundle bundleWithPath:path];
#endif
}

- (void)userContentController:(WKUserContentController *)userContentController
didReceiveScriptMessage:(WKScriptMessage *)message {
if ([GrowingWKWebViewJavascriptBridge webViewDontTrackCheck:message.webView]) {
Expand Down
5 changes: 1 addition & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,7 @@ extension Target {
enum Resources {
static let bundle = target(name: .bundle,
path: .Path.bundle,
resources: [
.copy("Resources/GrowingAnalytics.bundle/PrivacyInfo.xcprivacy"),
.copy("Resources/GrowingAnalytics.bundle/gdp-full.js"),
])
resources: [.copy("Resources/GrowingAnalytics.bundle/PrivacyInfo.xcprivacy")])

static let bundle_macOS = target(name: .bundle_macOS,
path: .Path.bundle_macOS,
Expand Down
1 change: 0 additions & 1 deletion Resources/iOS/GrowingAnalytics.bundle/gdp-full.js

This file was deleted.

2 changes: 1 addition & 1 deletion Services/Database/FMDB/GrowingFMDatabaseQueue.m
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ - (void)inDatabase:(void (^)(GrowingFMDatabase *db))block {
#if defined(DEBUG) && DEBUG
NSSet *openSetCopy = FMG3DBReturnAutoreleased([[db valueForKey:@"_openResultSets"] copy]);
for (NSValue *rsInWrappedInATastyValueMeal in openSetCopy) {
GrowingFMResultSet *rs = (GrowingFMResultSet *)[rsInWrappedInATastyValueMeal pointerValue];
// GrowingFMResultSet *rs = (GrowingFMResultSet *)[rsInWrappedInATastyValueMeal pointerValue];
// NSLog(@"query: '%@'", [rs query]);
}
#endif
Expand Down

0 comments on commit c818268

Please sign in to comment.