Clean todos (#6897)

* Clean todos

* Remove DatabaseHelper folder
This commit is contained in:
Daniel Espino García
2023-01-12 14:25:39 +01:00
committed by GitHub
parent 612fd5022f
commit b191154db9
10 changed files with 7 additions and 112 deletions

View File

@@ -546,7 +546,7 @@ export class ParsedCommand {
this.incomplete += c;
this.i++;
if (escaped) {
//TODO: handle \n, \t, other escaped chars
//TODO: handle \n, \t, other escaped chars https://mattermost.atlassian.net/browse/MM-43476
escaped = false;
}
break;
@@ -735,7 +735,7 @@ export class ParsedCommand {
this.incomplete += c;
this.i++;
if (escaped) {
//TODO: handle \n, \t, other escaped chars
//TODO: handle \n, \t, other escaped chars https://mattermost.atlassian.net/browse/MM-43476
escaped = false;
}
break;
@@ -1079,7 +1079,7 @@ export class AppCommandParser {
}
// Add "Execute Current Command" suggestion
// TODO get full text from SuggestionBox
// TODO get full text from SuggestionBox https://mattermost.atlassian.net/browse/MM-43477
const executableStates: string[] = [
ParseState.EndCommand,
ParseState.CommandSeparator,

View File

@@ -19,7 +19,7 @@ import IntegrationsManager from '@managers/integrations_manager';
import {AppCommandParser} from './app_command_parser/app_command_parser';
import SlashSuggestionItem from './slash_suggestion_item';
// TODO: Remove when all below commands have been implemented
// TODO: Remove when all below commands have been implemented https://mattermost.atlassian.net/browse/MM-43478
const COMMANDS_TO_IMPLEMENT_LATER = ['collapse', 'expand', 'logout'];
const NON_MOBILE_COMMANDS = ['shortcuts', 'search', 'settings'];

View File

@@ -11,8 +11,6 @@ import type GlobalModelInterface from '@typings/database/models/app/global';
const {GLOBAL} = MM_TABLES.APP;
// TODO : add TS definitions to sanitizer function signature.
/**
* The Global model will act as a dictionary of name-value pairs. The value field can be a JSON object or any other
* data type. It will hold information that applies to the whole app ( e.g. sidebar settings for tablets)

View File

@@ -94,7 +94,7 @@ export const getServerCredentials = async (serverUrl: string): Promise<ServerCre
if (credentials) {
// TODO: Pre-Gekidou we were concatenating the deviceToken and the userId in
// credentials.username so we need to check the length of credentials.username.split(',').
// This check should be removed at some point.
// This check should be removed at some point. https://mattermost.atlassian.net/browse/MM-43483
const parts = credentials.username.split(',');
const userId = parts[parts.length - 1];

View File

@@ -6,11 +6,7 @@ import DeviceInfo from 'react-native-device-info';
import LocalConfig from '@assets/config.json';
import {Device} from '@constants';
const isSystemAdmin = (roles: string) => {
// TODO: Replace this function with an utility function based on previous code
return roles === 'system_admin';
};
import {isSystemAdmin} from '@utils/user';
const clientMap: Record<string, Analytics> = {};

View File

@@ -21,7 +21,7 @@ const enhanced = withObservables([], () => {
switchMap((url) => of$(DatabaseManager.serverDatabases[url]?.database)),
);
// TODO: to be optimized
// TODO: to be optimized https://mattermost.atlassian.net/browse/MM-49338
const participantsDict = combineLatest([database, currentCall]).pipe(
switchMap(([db, call]) => (db && call ? queryUsersById(db, Object.keys(call.participants)).observeWithColumns(['nickname', 'username', 'first_name', 'last_name', 'last_picture_update']) : of$([])).pipe(
// eslint-disable-next-line max-nested-callbacks

View File

@@ -61,9 +61,6 @@ const SelectedOptions = ({
/>);
});
// eslint-disable-next-line no-warning-comments
// TODO Consider using a Virtualized List since the number of elements is potentially unbounded.
// https://mattermost.atlassian.net/browse/MM-48420
return (
<ScrollView
style={style.container}

View File

@@ -1,12 +0,0 @@
//
// DatabaseHelper-Bridging-Header.h
// DatabaseHelper
//
// Created by Miguel Alatzar on 6/15/21.
//
#ifndef DatabaseHelper_Bridging_Header_h
#define DatabaseHelper_Bridging_Header_h
#endif /* DatabaseHelper_Bridging_Header_h */

View File

@@ -1,82 +0,0 @@
//
// DatabaseHelper.swift
// DatabaseHelper
//
// Created by Miguel Alatzar on 6/14/21.
//
import Foundation
import SQLite3
// TODO: This should be exposed to Objective-C in order to handle
// any DatabaseHelper throwable methods.
enum DatabaseError: Error {
case OpenFailure(_ dbPath: String)
case MultipleServers
case NoResults(_ query: String)
}
extension DatabaseError: LocalizedError {
var errorDescription: String? {
switch self {
case .OpenFailure(dbPath: let dbPath):
return "Error opening database: \(dbPath)"
case .MultipleServers:
return "Cannot determine server URL as there are multiple servers"
case .NoResults(query: let query):
return "No results for query: \(query)"
}
}
}
public class DatabaseHelper: NSObject {
internal let DEFAULT_DB_NAME = "app.db"
internal var DEFAULT_DB_PATH: String
internal var defaultDB: OpaquePointer? = nil
@objc public static let `default` = DatabaseHelper()
override private init() {
let appGroupId = Bundle.main.object(forInfoDictionaryKey: "AppGroupIdentifier") as! String
let sharedDirectory = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupId)!
let databaseUrl = sharedDirectory.appendingPathComponent("databases/\(DEFAULT_DB_NAME)")
DEFAULT_DB_PATH = databaseUrl.path
}
@objc public func getOnlyServerUrlObjc() -> String {
do {
return try getOnlyServerUrl()
} catch {
print(error)
return ""
}
}
public func getOnlyServerUrl() throws -> String {
if sqlite3_open(DEFAULT_DB_PATH, &defaultDB) != SQLITE_OK {
throw DatabaseError.OpenFailure(DEFAULT_DB_PATH)
}
defer {
sqlite3_finalize(queryStatement)
sqlite3_close(defaultDB)
}
var queryStatement: OpaquePointer?
let queryString = "SELECT url FROM Servers;"
if sqlite3_prepare_v2(defaultDB, queryString, -1, &queryStatement, nil) == SQLITE_OK {
if sqlite3_step(queryStatement) == SQLITE_ROW,
let result = sqlite3_column_text(queryStatement, 0) {
return String(cString: result)
}
if sqlite3_step(queryStatement) == SQLITE_ROW {
// Throw since we have more than one row in the `servers` table
throw DatabaseError.MultipleServers
}
}
throw DatabaseError.NoResults(queryString)
}
}

View File

@@ -9,8 +9,6 @@ import Foundation
import SQLite3
import SQLite
// TODO: This should be exposed to Objective-C in order to handle
// any Database throwable methods.
enum DatabaseError: Error {
case OpenFailure(_ dbPath: String)
case MultipleServers