diff --git a/Modules/Flutter/GrowingFlutterPlugin.m b/Modules/Flutter/GrowingFlutterPlugin.m index 9f765cbde..d2a28446f 100644 --- a/Modules/Flutter/GrowingFlutterPlugin.m +++ b/Modules/Flutter/GrowingFlutterPlugin.m @@ -21,6 +21,7 @@ #import "GrowingTrackerCore/Event/Autotrack/GrowingPageEvent.h" #import "GrowingTrackerCore/Event/Autotrack/GrowingViewElementEvent.h" #import "GrowingTrackerCore/Event/GrowingEventManager.h" +#import "GrowingTrackerCore/Manager/GrowingSession.h" #import "GrowingTrackerCore/Public/GrowingAttributesBuilder.h" #import "GrowingTrackerCore/Thread/GrowingDispatchManager.h" @@ -108,8 +109,15 @@ - (void)trackViewElementEvent:(NSDictionary *)arguments } - (void)trackAutotrackEventWithBuilder:(GrowingBaseBuilder *)builder { - builder = builder.setScene(GrowingEventSceneFlutter); - [[GrowingEventManager sharedInstance] postEventBuilder:builder]; + [GrowingDispatchManager dispatchInGrowingThread:^{ + if ([GrowingSession currentSession].state != GrowingSessionStateActive) { + // 避免在session正在切换的时机之前,flutter侧因用户业务逻辑在后台状态下触发PAGE,回到前台后生成,造成上一个session的访问时长过长 + // 另外,flutter sdk的逻辑中,会在返回前台时补发一个当前页面的PAGE,可覆盖上述场景的PAGE生成 + return; + } + GrowingBaseBuilder *b = builder.setScene(GrowingEventSceneFlutter); + [[GrowingEventManager sharedInstance] postEventBuilder:b]; + }]; } @end diff --git a/Modules/MobileDebugger/GrowingMobileDebugger.m b/Modules/MobileDebugger/GrowingMobileDebugger.m index d9327259f..a92601c8c 100644 --- a/Modules/MobileDebugger/GrowingMobileDebugger.m +++ b/Modules/MobileDebugger/GrowingMobileDebugger.m @@ -221,7 +221,6 @@ - (BOOL)isRunning { } - (void)sendJson:(id)json { - NSLog(@"sendJson : %@", json); if (self.webSocket.readyState == Growing_WS_OPEN && ([json isKindOfClass:[NSDictionary class]] || [json isKindOfClass:[NSArray class]])) { NSString *jsonString = [json growingHelper_jsonString]; diff --git a/Services/Database/FMDB/GrowingFMDatabase.m b/Services/Database/FMDB/GrowingFMDatabase.m index 1f5d167f7..f07cc083a 100755 --- a/Services/Database/FMDB/GrowingFMDatabase.m +++ b/Services/Database/FMDB/GrowingFMDatabase.m @@ -176,7 +176,7 @@ - (BOOL)open { int err = sqlite3_open([self sqlitePath], &_db ); if(err != SQLITE_OK) { - NSLog(@"error opening!: %d", err); +// NSLog(@"error opening!: %d", err); return NO; } @@ -200,7 +200,7 @@ - (BOOL)openWithFlags:(int)flags vfs:(NSString *)vfsName { int err = sqlite3_open_v2([self sqlitePath], &_db, flags, [vfsName UTF8String]); if(err != SQLITE_OK) { - NSLog(@"error opening!: %d", err); +// NSLog(@"error opening!: %d", err); return NO; } @@ -235,14 +235,14 @@ - (BOOL)close { triedFinalizingOpenStatements = YES; sqlite3_stmt *pStmt; while ((pStmt = sqlite3_next_stmt(_db, nil)) !=0) { - NSLog(@"Closing leaked statement"); +// NSLog(@"Closing leaked statement"); sqlite3_finalize(pStmt); retry = YES; } } } else if (SQLITE_OK != rc) { - NSLog(@"error closing!: %d", rc); +// NSLog(@"error closing!: %d", rc); } } while (retry); @@ -277,7 +277,7 @@ static int FMG3DBDatabaseBusyHandler(void *f, int count) { int requestedSleepInMillseconds = (int) arc4random_uniform(50) + 50; int actualSleepInMilliseconds = sqlite3_sleep(requestedSleepInMillseconds); if (actualSleepInMilliseconds != requestedSleepInMillseconds) { - NSLog(@"WARNING: Requested sleep of %i milliseconds, but SQLite returned %i. Maybe SQLite wasn't built with HAVE_USLEEP=1?", requestedSleepInMillseconds, actualSleepInMilliseconds); +// NSLog(@"WARNING: Requested sleep of %i milliseconds, but SQLite returned %i. Maybe SQLite wasn't built with HAVE_USLEEP=1?", requestedSleepInMillseconds, actualSleepInMilliseconds); } return 1; } @@ -311,15 +311,15 @@ - (NSTimeInterval)maxBusyRetryTimeInterval { // but for folks who don't bother noticing that the interface to FMG3Database changed, // we'll still implement the method so they don't get suprise crashes - (int)busyRetryTimeout { - NSLog(@"%s:%d", __FUNCTION__, __LINE__); - NSLog(@"FMG3DB: busyRetryTimeout no longer works, please use maxBusyRetryTimeInterval"); +// NSLog(@"%s:%d", __FUNCTION__, __LINE__); +// NSLog(@"FMG3DB: busyRetryTimeout no longer works, please use maxBusyRetryTimeInterval"); return -1; } - (void)setBusyRetryTimeout:(int)i { #pragma unused(i) - NSLog(@"%s:%d", __FUNCTION__, __LINE__); - NSLog(@"FMG3DB: setBusyRetryTimeout does nothing, please use setMaxBusyRetryTimeInterval:"); +// NSLog(@"%s:%d", __FUNCTION__, __LINE__); +// NSLog(@"FMG3DB: setBusyRetryTimeout does nothing, please use setMaxBusyRetryTimeInterval:"); } #pragma mark Result set functions @@ -406,8 +406,8 @@ - (BOOL)rekeyWithData:(NSData *)keyData { int rc = sqlite3_rekey(_db, [keyData bytes], (int)[keyData length]); if (rc != SQLITE_OK) { - NSLog(@"error on rekey: %d", rc); - NSLog(@"%@", [self lastErrorMessage]); +// NSLog(@"error on rekey: %d", rc); +// NSLog(@"%@", [self lastErrorMessage]); } return (rc == SQLITE_OK); @@ -486,7 +486,7 @@ - (BOOL)goodConnection { } - (void)warnInUse { - NSLog(@"The FMG3Database %@ is currently in use.", self); +// NSLog(@"The FMG3Database %@ is currently in use.", self); #ifndef NS_BLOCK_ASSERTIONS if (_crashOnErrors) { @@ -500,7 +500,7 @@ - (BOOL)databaseExists { if (!_db) { - NSLog(@"The FMG3Database %@ is not open.", self); +// NSLog(@"The FMG3Database %@ is not open.", self); #ifndef NS_BLOCK_ASSERTIONS if (_crashOnErrors) { @@ -793,7 +793,7 @@ - (GrowingFMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArr GrowingFMResultSet *rs = 0x00; if (_traceExecution && sql) { - NSLog(@"%@ executeQuery: %@", self, sql); +// NSLog(@"%@ executeQuery: %@", self, sql); } if (_shouldCacheStatements) { @@ -808,9 +808,9 @@ - (GrowingFMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArr if (SQLITE_OK != rc) { if (_logsErrors) { - NSLog(@"DB Error: %d \"%@\"", [self lastErrorCode], [self lastErrorMessage]); - NSLog(@"DB Query: %@", sql); - NSLog(@"DB Path: %@", _databasePath); +// NSLog(@"DB Error: %d \"%@\"", [self lastErrorCode], [self lastErrorMessage]); +// NSLog(@"DB Query: %@", sql); +// NSLog(@"DB Path: %@", _databasePath); } if (_crashOnErrors) { @@ -837,7 +837,7 @@ - (GrowingFMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArr NSString *parameterName = [[NSString alloc] initWithFormat:@":%@", dictionaryKey]; if (_traceExecution) { - NSLog(@"%@ = %@", parameterName, [dictionaryArgs objectForKey:dictionaryKey]); +// NSLog(@"%@ = %@", parameterName, [dictionaryArgs objectForKey:dictionaryKey]); } // Get the index for the parameter name. @@ -852,7 +852,7 @@ - (GrowingFMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArr idx++; } else { - NSLog(@"Could not find index for %@", dictionaryKey); +// NSLog(@"Could not find index for %@", dictionaryKey); } } } @@ -873,10 +873,10 @@ - (GrowingFMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArr if (_traceExecution) { if ([obj isKindOfClass:[NSData class]]) { - NSLog(@"data: %ld bytes", (unsigned long)[(NSData*)obj length]); +// NSLog(@"data: %ld bytes", (unsigned long)[(NSData*)obj length]); } else { - NSLog(@"obj: %@", obj); +// NSLog(@"obj: %@", obj); } } @@ -887,7 +887,7 @@ - (GrowingFMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArr } if (idx != queryCount) { - NSLog(@"Error: the bind count is not correct for the # of variables (executeQuery)"); +// NSLog(@"Error: the bind count is not correct for the # of variables (executeQuery)"); sqlite3_finalize(pStmt); _isExecutingStatement = NO; return nil; @@ -979,7 +979,7 @@ - (BOOL)executeUpdate:(NSString*)sql error:(NSError**)outErr withArgumentsInArra GrowingFMStatement *cachedStmt = 0x00; if (_traceExecution && sql) { - NSLog(@"%@ executeUpdate: %@", self, sql); +// NSLog(@"%@ executeUpdate: %@", self, sql); } if (_shouldCacheStatements) { @@ -993,9 +993,9 @@ - (BOOL)executeUpdate:(NSString*)sql error:(NSError**)outErr withArgumentsInArra if (SQLITE_OK != rc) { if (_logsErrors) { - NSLog(@"DB Error: %d \"%@\"", [self lastErrorCode], [self lastErrorMessage]); - NSLog(@"DB Query: %@", sql); - NSLog(@"DB Path: %@", _databasePath); +// NSLog(@"DB Error: %d \"%@\"", [self lastErrorCode], [self lastErrorMessage]); +// NSLog(@"DB Query: %@", sql); +// NSLog(@"DB Path: %@", _databasePath); } if (_crashOnErrors) { @@ -1027,7 +1027,7 @@ - (BOOL)executeUpdate:(NSString*)sql error:(NSError**)outErr withArgumentsInArra NSString *parameterName = [[NSString alloc] initWithFormat:@":%@", dictionaryKey]; if (_traceExecution) { - NSLog(@"%@ = %@", parameterName, [dictionaryArgs objectForKey:dictionaryKey]); +// NSLog(@"%@ = %@", parameterName, [dictionaryArgs objectForKey:dictionaryKey]); } // Get the index for the parameter name. int namedIdx = sqlite3_bind_parameter_index(pStmt, [parameterName UTF8String]); @@ -1042,7 +1042,7 @@ - (BOOL)executeUpdate:(NSString*)sql error:(NSError**)outErr withArgumentsInArra idx++; } else { - NSLog(@"Could not find index for %@", dictionaryKey); +// NSLog(@"Could not find index for %@", dictionaryKey); } } } @@ -1063,10 +1063,10 @@ - (BOOL)executeUpdate:(NSString*)sql error:(NSError**)outErr withArgumentsInArra if (_traceExecution) { if ([obj isKindOfClass:[NSData class]]) { - NSLog(@"data: %ld bytes", (unsigned long)[(NSData*)obj length]); +// NSLog(@"data: %ld bytes", (unsigned long)[(NSData*)obj length]); } else { - NSLog(@"obj: %@", obj); +// NSLog(@"obj: %@", obj); } } @@ -1078,7 +1078,7 @@ - (BOOL)executeUpdate:(NSString*)sql error:(NSError**)outErr withArgumentsInArra if (idx != queryCount) { - NSLog(@"Error: the bind count (%d) is not correct for the # of variables in the query (%d) (%@) (executeUpdate)", idx, queryCount, sql); +// NSLog(@"Error: the bind count (%d) is not correct for the # of variables in the query (%d) (%@) (executeUpdate)", idx, queryCount, sql); sqlite3_finalize(pStmt); _isExecutingStatement = NO; return NO; @@ -1095,22 +1095,22 @@ - (BOOL)executeUpdate:(NSString*)sql error:(NSError**)outErr withArgumentsInArra } else if (SQLITE_ERROR == rc) { if (_logsErrors) { - NSLog(@"Error calling sqlite3_step (%d: %s) SQLITE_ERROR", rc, sqlite3_errmsg(_db)); - NSLog(@"DB Query: %@", sql); +// NSLog(@"Error calling sqlite3_step (%d: %s) SQLITE_ERROR", rc, sqlite3_errmsg(_db)); +// NSLog(@"DB Query: %@", sql); } } else if (SQLITE_MISUSE == rc) { // uh oh. if (_logsErrors) { - NSLog(@"Error calling sqlite3_step (%d: %s) SQLITE_MISUSE", rc, sqlite3_errmsg(_db)); - NSLog(@"DB Query: %@", sql); +// NSLog(@"Error calling sqlite3_step (%d: %s) SQLITE_MISUSE", rc, sqlite3_errmsg(_db)); +// NSLog(@"DB Query: %@", sql); } } else { // wtf? if (_logsErrors) { - NSLog(@"Unknown error calling sqlite3_step (%d: %s) eu", rc, sqlite3_errmsg(_db)); - NSLog(@"DB Query: %@", sql); +// NSLog(@"Unknown error calling sqlite3_step (%d: %s) eu", rc, sqlite3_errmsg(_db)); +// NSLog(@"DB Query: %@", sql); } } @@ -1143,8 +1143,8 @@ - (BOOL)executeUpdate:(NSString*)sql error:(NSError**)outErr withArgumentsInArra if (closeErrorCode != SQLITE_OK) { if (_logsErrors) { - NSLog(@"Unknown error finalizing or resetting statement (%d: %s)", closeErrorCode, sqlite3_errmsg(_db)); - NSLog(@"DB Query: %@", sql); +// NSLog(@"Unknown error finalizing or resetting statement (%d: %s)", closeErrorCode, sqlite3_errmsg(_db)); +// NSLog(@"DB Query: %@", sql); } } @@ -1226,7 +1226,7 @@ - (BOOL)executeStatements:(NSString *)sql withResultBlock:(FMG3DBExecuteStatemen rc = sqlite3_exec([self sqliteHandle], [sql UTF8String], block ? FMG3DBExecuteBulkSQLCallback : nil, (__bridge void *)(block), &errmsg); if (errmsg && [self logsErrors]) { - NSLog(@"Error inserting batch: %s", errmsg); +// NSLog(@"Error inserting batch: %s", errmsg); sqlite3_free(errmsg); } diff --git a/Services/Database/FMDB/GrowingFMDatabaseAdditions.m b/Services/Database/FMDB/GrowingFMDatabaseAdditions.m index b1a6f21e0..ad5c9d9d5 100755 --- a/Services/Database/FMDB/GrowingFMDatabaseAdditions.m +++ b/Services/Database/FMDB/GrowingFMDatabaseAdditions.m @@ -190,7 +190,7 @@ - (NSString*)applicationIDString { - (void)setApplicationIDString:(NSString*)s { if ([s length] != 4) { - NSLog(@"setApplicationIDString: string passed is not exactly 4 chars long. (was %ld)", [s length]); +// NSLog(@"setApplicationIDString: string passed is not exactly 4 chars long. (was %ld)", [s length]); } [self setApplicationID:NSHFSTypeCodeFromFileType([NSString stringWithFormat:@"'%@'", s])]; diff --git a/Services/Database/FMDB/GrowingFMDatabasePool.m b/Services/Database/FMDB/GrowingFMDatabasePool.m index 0939e161b..32306efe3 100755 --- a/Services/Database/FMDB/GrowingFMDatabasePool.m +++ b/Services/Database/FMDB/GrowingFMDatabasePool.m @@ -147,7 +147,7 @@ - (GrowingFMDatabase*)db { NSUInteger currentCount = [self->_databaseOutPool count] + [self->_databaseInPool count]; if (currentCount >= self->_maximumNumberOfDatabasesToCreate) { - NSLog(@"Maximum number of databases (%ld) has already been reached!", (long)currentCount); +// NSLog(@"Maximum number of databases (%ld) has already been reached!", (long)currentCount); return; } } @@ -179,7 +179,7 @@ - (GrowingFMDatabase*)db { } } else { - NSLog(@"Could not open up the database at path %@", self->_path); +// NSLog(@"Could not open up the database at path %@", self->_path); db = 0x00; } }]; diff --git a/Services/Database/FMDB/GrowingFMDatabaseQueue.m b/Services/Database/FMDB/GrowingFMDatabaseQueue.m index 84791e167..6227891e9 100755 --- a/Services/Database/FMDB/GrowingFMDatabaseQueue.m +++ b/Services/Database/FMDB/GrowingFMDatabaseQueue.m @@ -96,7 +96,7 @@ - (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags vfs:(NSString BOOL success = [_db open]; #endif if (!success) { - NSLog(@"Could not create database queue for path %@", aPath); +// NSLog(@"Could not create database queue for path %@", aPath); FMG3DBRelease(self); return 0x00; } @@ -160,7 +160,7 @@ - (GrowingFMDatabase*)database { BOOL success = [_db open]; #endif if (!success) { - NSLog(@"GrowingFMDatabaseQueue could not reopen database for path %@", _path); +// NSLog(@"GrowingFMDatabaseQueue could not reopen database for path %@", _path); FMG3DBRelease(_db); _db = 0x00; return 0x00; @@ -184,13 +184,13 @@ - (void)inDatabase:(void (^)(GrowingFMDatabase *db))block { block(db); if ([db hasOpenResultSets]) { - NSLog(@"Warning: there is at least one open result set around after performing [GrowingFMDatabaseQueue inDatabase:]"); +// NSLog(@"Warning: there is at least one open result set around after performing [GrowingFMDatabaseQueue inDatabase:]"); #if defined(DEBUG) && DEBUG NSSet *openSetCopy = FMG3DBReturnAutoreleased([[db valueForKey:@"_openResultSets"] copy]); for (NSValue *rsInWrappedInATastyValueMeal in openSetCopy) { GrowingFMResultSet *rs = (GrowingFMResultSet *)[rsInWrappedInATastyValueMeal pointerValue]; - NSLog(@"query: '%@'", [rs query]); +// NSLog(@"query: '%@'", [rs query]); } #endif } diff --git a/Services/Database/FMDB/GrowingFMResultSet.m b/Services/Database/FMDB/GrowingFMResultSet.m index 498b29eb9..e35d1cf7c 100755 --- a/Services/Database/FMDB/GrowingFMResultSet.m +++ b/Services/Database/FMDB/GrowingFMResultSet.m @@ -149,7 +149,7 @@ - (NSDictionary*)resultDict { return FMG3DBReturnAutoreleased([dict copy]); } else { - NSLog(@"Warning: There seem to be no columns in this set."); +// NSLog(@"Warning: There seem to be no columns in this set."); } return nil; @@ -177,7 +177,7 @@ - (NSDictionary*)resultDictionary { return dict; } else { - NSLog(@"Warning: There seem to be no columns in this set."); +// NSLog(@"Warning: There seem to be no columns in this set."); } return nil; @@ -195,8 +195,8 @@ - (BOOL)nextWithError:(NSError **)outErr { int rc = sqlite3_step([_statement statement]); if (SQLITE_BUSY == rc || SQLITE_LOCKED == rc) { - NSLog(@"%s:%d Database busy (%@)", __FUNCTION__, __LINE__, [_parentDB databasePath]); - NSLog(@"Database busy"); +// NSLog(@"%s:%d Database busy (%@)", __FUNCTION__, __LINE__, [_parentDB databasePath]); +// NSLog(@"Database busy"); if (outErr) { *outErr = [_parentDB lastError]; } @@ -205,14 +205,14 @@ - (BOOL)nextWithError:(NSError **)outErr { // all is well, let's return. } else if (SQLITE_ERROR == rc) { - NSLog(@"Error calling sqlite3_step (%d: %s) rs", rc, sqlite3_errmsg([_parentDB sqliteHandle])); +// NSLog(@"Error calling sqlite3_step (%d: %s) rs", rc, sqlite3_errmsg([_parentDB sqliteHandle])); if (outErr) { *outErr = [_parentDB lastError]; } } else if (SQLITE_MISUSE == rc) { // uh oh. - NSLog(@"Error calling sqlite3_step (%d: %s) rs", rc, sqlite3_errmsg([_parentDB sqliteHandle])); +// NSLog(@"Error calling sqlite3_step (%d: %s) rs", rc, sqlite3_errmsg([_parentDB sqliteHandle])); if (outErr) { if (_parentDB) { *outErr = [_parentDB lastError]; @@ -228,7 +228,7 @@ - (BOOL)nextWithError:(NSError **)outErr { } else { // wtf? - NSLog(@"Unknown error calling sqlite3_step (%d: %s) rs", rc, sqlite3_errmsg([_parentDB sqliteHandle])); +// NSLog(@"Unknown error calling sqlite3_step (%d: %s) rs", rc, sqlite3_errmsg([_parentDB sqliteHandle])); if (outErr) { *outErr = [_parentDB lastError]; } @@ -255,7 +255,7 @@ - (int)columnIndexForName:(NSString*)columnName { return [n intValue]; } - NSLog(@"Warning: I could not find the column named '%@'.", columnName); +// NSLog(@"Warning: I could not find the column named '%@'.", columnName); return -1; } diff --git a/Services/WebSocket/GrowingSRWebSocket.m b/Services/WebSocket/GrowingSRWebSocket.m index d44b58a25..b9ec70e50 100644 --- a/Services/WebSocket/GrowingSRWebSocket.m +++ b/Services/WebSocket/GrowingSRWebSocket.m @@ -281,7 +281,7 @@ - (id)initWithURLRequest:(NSURLRequest *)request protocols:(NSArray *)protocols; self = [super init]; if (self) { if (!request.URL) { - NSLog(@"请刷新二维码,重新扫码,出错链接:%@", request.URL.absoluteString); +// NSLog(@"请刷新二维码,重新扫码,出错链接:%@", request.URL.absoluteString); } assert(request.URL); _url = request.URL;