New store

This commit is contained in:
Christian Pauly 2020-01-26 11:17:54 +00:00
parent 5cf7e7f3dd
commit 46f7a947f5
19 changed files with 159 additions and 969 deletions

View file

@ -3,6 +3,7 @@ include: package:pedantic/analysis_options.yaml
linter: linter:
rules: rules:
- camel_case_types - camel_case_types
- avoid_print
analyzer: analyzer:
errors: errors:

View file

@ -44,7 +44,7 @@ android {
defaultConfig { defaultConfig {
applicationId "chat.fluffy.fluffychat" applicationId "chat.fluffy.fluffychat"
minSdkVersion 16 minSdkVersion 18
targetSdkVersion 28 targetSdkVersion 28
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName

View file

@ -1,587 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
825E8C4DDFD87D133ACCCC1A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14FAF412639B88C5C2721D00 /* Pods_Runner.framework */; };
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
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 */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
0EF69A899CE7F4E07C5F6599 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
14FAF412639B88C5C2721D00 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
6D40C7CF338C6054DF530EE6 /* 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>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
B7CDE45F1181122C41ED566D /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
97C146EB1CF9000F007C117D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
825E8C4DDFD87D133ACCCC1A /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
587F23226AD40CECE246E2A7 /* Pods */ = {
isa = PBXGroup;
children = (
0EF69A899CE7F4E07C5F6599 /* Pods-Runner.debug.xcconfig */,
6D40C7CF338C6054DF530EE6 /* Pods-Runner.release.xcconfig */,
B7CDE45F1181122C41ED566D /* Pods-Runner.profile.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
3B80C3931E831B6300D905FE /* App.framework */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEBA1CF902C7004384FC /* Flutter.framework */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
9740EEB31CF90195004384FC /* Generated.xcconfig */,
);
name = Flutter;
sourceTree = "<group>";
};
97C146E51CF9000F007C117D = {
isa = PBXGroup;
children = (
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
587F23226AD40CECE246E2A7 /* Pods */,
9BE4B8D2394D0E419F06E05E /* Frameworks */,
);
sourceTree = "<group>";
};
97C146EF1CF9000F007C117D /* Products */ = {
isa = PBXGroup;
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
);
name = Products;
sourceTree = "<group>";
};
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
97C147021CF9000F007C117D /* Info.plist */,
97C146F11CF9000F007C117D /* Supporting Files */,
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
);
path = Runner;
sourceTree = "<group>";
};
97C146F11CF9000F007C117D /* Supporting Files */ = {
isa = PBXGroup;
children = (
);
name = "Supporting Files";
sourceTree = "<group>";
};
9BE4B8D2394D0E419F06E05E /* Frameworks */ = {
isa = PBXGroup;
children = (
14FAF412639B88C5C2721D00 /* Pods_Runner.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
97C146ED1CF9000F007C117D /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
F4901FBEE4C8B0FA7B998652 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
BAF2985AB306D24B14B17E3F /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = Runner;
productName = Runner;
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "The Chromium Authors";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = 4HV29TJN3A;
LastSwiftMigration = 1100;
};
};
};
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
97C146ED1CF9000F007C117D /* Runner */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
97C146EC1CF9000F007C117D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Thin Binary";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
BAF2985AB306D24B14B17E3F /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
F4901FBEE4C8B0FA7B998652 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
97C146EA1CF9000F007C117D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C146FB1CF9000F007C117D /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C147001CF9000F007C117D /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
249021D3217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Profile;
};
249021D4217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 4HV29TJN3A;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = chat.fluffy.fluffychat;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Profile;
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
97C147061CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 4HV29TJN3A;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = chat.fluffy.fluffychat;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
};
97C147071CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 4HV29TJN3A;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = chat.fluffy.fluffychat;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147031CF9000F007C117D /* Debug */,
97C147041CF9000F007C117D /* Release */,
249021D3217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147061CF9000F007C117D /* Debug */,
97C147071CF9000F007C117D /* Release */,
249021D4217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>

View file

@ -1,91 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View file

@ -6,8 +6,8 @@ import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/i18n/i18n.dart'; import 'package:fluffychat/i18n/i18n.dart';
import 'package:fluffychat/utils/app_route.dart'; import 'package:fluffychat/utils/app_route.dart';
import 'package:fluffychat/utils/event_extension.dart'; import 'package:fluffychat/utils/event_extension.dart';
import 'package:fluffychat/utils/famedlysdk_store.dart';
import 'package:fluffychat/utils/room_extension.dart'; import 'package:fluffychat/utils/room_extension.dart';
import 'package:fluffychat/utils/sqflite_store.dart';
import 'package:fluffychat/views/chat.dart'; import 'package:fluffychat/views/chat.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -48,52 +48,8 @@ class MatrixState extends State<Matrix> {
String activeRoomId; String activeRoomId;
/// Used to load the old account if there is no store available.
void loadAccount() async {
final LocalStorage storage = LocalStorage('LocalStorage');
await storage.ready;
final credentialsStr = storage.getItem(widget.clientName);
if (credentialsStr == null || credentialsStr.isEmpty) {
client.onLoginStateChanged.add(LoginState.loggedOut);
return;
}
print("[Matrix] Restoring account credentials");
final Map<String, dynamic> credentials = json.decode(credentialsStr);
client.connect(
newDeviceID: credentials["deviceID"],
newDeviceName: credentials["deviceName"],
newHomeserver: credentials["homeserver"],
newLazyLoadMembers: credentials["lazyLoadMembers"],
//newMatrixVersions: credentials["matrixVersions"], // FIXME: wrong List type
newToken: credentials["token"],
newUserID: credentials["userID"],
);
}
/// Used to save the current account persistently if there is no store available.
Future<void> saveAccount() async {
if (!kIsWeb) return;
print("[Matrix] Save account credentials in crypted preferences");
final Map<String, dynamic> credentials = {
"deviceID": client.deviceID,
"deviceName": client.deviceName,
"homeserver": client.homeserver,
"lazyLoadMembers": client.lazyLoadMembers,
"matrixVersions": client.matrixVersions,
"token": client.accessToken,
"userID": client.userID,
};
final LocalStorage storage = LocalStorage('LocalStorage');
await storage.ready;
await storage.setItem(widget.clientName, json.encode(credentials));
return;
}
void clean() async { void clean() async {
if (!kIsWeb) return; if (!kIsWeb) return;
print("Clear session...");
final LocalStorage storage = LocalStorage('LocalStorage'); final LocalStorage storage = LocalStorage('LocalStorage');
await storage.ready; await storage.ready;
@ -202,7 +158,7 @@ class MatrixState extends State<Matrix> {
(r) => r.isFirst); (r) => r.isFirst);
} catch (_) { } catch (_) {
Toast.show("Failed to open chat...", context); Toast.show("Failed to open chat...", context);
print(_); debugPrint(_);
} }
}; };
@ -211,7 +167,6 @@ class MatrixState extends State<Matrix> {
AndroidInitializationSettings('notifications_icon'); AndroidInitializationSettings('notifications_icon');
var initializationSettingsIOS = var initializationSettingsIOS =
IOSInitializationSettings(onDidReceiveLocalNotification: (i, a, b, c) { IOSInitializationSettings(onDidReceiveLocalNotification: (i, a, b, c) {
print("onDidReceiveLocalNotification: $i $a $b $c");
return null; return null;
}); });
var initializationSettings = InitializationSettings( var initializationSettings = InitializationSettings(
@ -313,7 +268,7 @@ class MatrixState extends State<Matrix> {
platformChannelSpecifics, platformChannelSpecifics,
payload: roomId); payload: roomId);
} catch (exception) { } catch (exception) {
print("[Push] Error while processing notification: " + debugPrint("[Push] Error while processing notification: " +
exception.toString()); exception.toString());
} }
return null; return null;
@ -322,7 +277,7 @@ class MatrixState extends State<Matrix> {
// Currently fires unexpectetly... https://github.com/FirebaseExtended/flutterfire/issues/1060 // Currently fires unexpectetly... https://github.com/FirebaseExtended/flutterfire/issues/1060
//onLaunch: goToRoom, //onLaunch: goToRoom,
); );
print("[Push] Firebase initialized"); debugPrint("[Push] Firebase initialized");
return; return;
} }
@ -331,13 +286,15 @@ class MatrixState extends State<Matrix> {
IosNotificationSettings(sound: true, badge: true, alert: true)); IosNotificationSettings(sound: true, badge: true, alert: true));
_firebaseMessaging.onIosSettingsRegistered _firebaseMessaging.onIosSettingsRegistered
.listen((IosNotificationSettings settings) { .listen((IosNotificationSettings settings) {
print("Settings registered: $settings"); debugPrint("Settings registered: $settings");
}); });
} }
void _initWithStore() async { void _initWithStore() async {
Future<LoginState> initLoginState = client.onLoginStateChanged.stream.first; Future<LoginState> initLoginState = client.onLoginStateChanged.stream.first;
client.store = Store(client); client.storeAPI = kIsWeb ? Store(client) : ExtendedStore(client);
debugPrint(
"[Store] Store is extended: ${client.storeAPI.extended.toString()}");
if (await initLoginState == LoginState.logged) { if (await initLoginState == LoginState.logged) {
await setupFirebase(); await setupFirebase();
} }
@ -346,14 +303,9 @@ class MatrixState extends State<Matrix> {
@override @override
void initState() { void initState() {
if (widget.client == null) { if (widget.client == null) {
print("[Matrix] Init matrix client"); debugPrint("[Matrix] Init matrix client");
client = Client(widget.clientName, debug: false); client = Client(widget.clientName, debug: false);
if (!kIsWeb) { _initWithStore();
_initWithStore();
} else {
print("[Web] Web platform detected - Store disabled!");
loadAccount();
}
} else { } else {
client = widget.client; client = widget.client;
} }

View file

@ -1,94 +1,158 @@
/*
* Copyright (c) 2019 Zender & Kurtz GbR.
*
* Authors:
* Christian Pauly <krille@famedly.com>
* Marcel Radzio <mtrnord@famedly.com>
*
* This file is part of famedlysdk_store_sqflite.
*
* famedlysdk_store_sqflite is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* famedlysdk_store_sqflite is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with famedlysdk_store_sqflite. If not, see <http://www.gnu.org/licenses/>.
*/
library famedlysdk_store_sqflite;
import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:core';
import 'package:famedlysdk/famedlysdk.dart'; import 'package:famedlysdk/famedlysdk.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:localstorage/localstorage.dart';
import 'dart:async';
import 'dart:core';
import 'package:path/path.dart' as p; import 'package:path/path.dart' as p;
import 'package:sqflite/sqflite.dart'; import 'package:sqflite/sqflite.dart';
/// Responsible to store all data persistent and to query objects from the
/// database.
class Store extends StoreAPI { class Store extends StoreAPI {
final Client client; final Client client;
final LocalStorage storage;
final FlutterSecureStorage secureStorage;
Store(this.client) { Store(this.client)
: storage = !kIsWeb ? null : LocalStorage('LocalStorage'),
secureStorage = kIsWeb ? null : FlutterSecureStorage() {
_init(); _init();
} }
Future<dynamic> getItem(String key) async {
if (kIsWeb) {
await storage.ready;
return await storage.getItem(key);
}
return await secureStorage.read(key: key);
}
Future<void> setItem(String key, String value) async {
if (kIsWeb) {
await storage.ready;
return await storage.setItem(key, value);
}
return await secureStorage.write(key: key, value: value);
}
_init() async {
final credentialsStr = await getItem(client.clientName);
if (credentialsStr == null || credentialsStr.isEmpty) {
client.onLoginStateChanged.add(LoginState.loggedOut);
return;
}
debugPrint("[Matrix] Restoring account credentials");
final Map<String, dynamic> credentials = json.decode(credentialsStr);
client.connect(
newDeviceID: credentials["deviceID"],
newDeviceName: credentials["deviceName"],
newHomeserver: credentials["homeserver"],
newLazyLoadMembers: credentials["lazyLoadMembers"],
newMatrixVersions: List<String>.from(credentials["matrixVersions"]),
newToken: credentials["token"],
newUserID: credentials["userID"],
newPrevBatch: kIsWeb
? null
: (credentials["prev_batch"]?.isEmpty ?? true)
? null
: credentials["prev_batch"],
);
}
Future<void> storeClient() async {
final Map<String, dynamic> credentials = {
"deviceID": client.deviceID,
"deviceName": client.deviceName,
"homeserver": client.homeserver,
"lazyLoadMembers": client.lazyLoadMembers,
"matrixVersions": client.matrixVersions,
"token": client.accessToken,
"userID": client.userID,
};
await setItem(client.clientName, json.encode(credentials));
return;
}
Future<void> clear() => kIsWeb ? storage.clear() : secureStorage.deleteAll();
}
/// Responsible to store all data persistent and to query objects from the
/// database.
class ExtendedStore extends Store implements ExtendedStoreAPI {
@override
final bool extended = true;
ExtendedStore(Client client) : super(client);
Database _db; Database _db;
var txn;
/// SQLite database for all persistent data. It is recommended to extend this /// SQLite database for all persistent data. It is recommended to extend this
/// SDK instead of writing direct queries to the database. /// SDK instead of writing direct queries to the database.
//Database get db => _db; //Database get db => _db;
@override
_init() async { _init() async {
// Open the database and migrate if necessary.
var databasePath = await getDatabasesPath(); var databasePath = await getDatabasesPath();
String path = p.join(databasePath, "FluffyMatrix.db"); String path = p.join(databasePath, "FluffyMatrix.db");
_db = await openDatabase(path, version: 15, _db = await openDatabase(path, version: 16,
onCreate: (Database db, int version) async { onCreate: (Database db, int version) async {
await createTables(db); await createTables(db);
}, onUpgrade: (Database db, int oldVersion, int newVersion) async { }, onUpgrade: (Database db, int oldVersion, int newVersion) async {
print("[Store] Migrate databse from version $oldVersion to $newVersion"); debugPrint(
"[Store] Migrate database from version $oldVersion to $newVersion");
if (oldVersion != newVersion) { if (oldVersion != newVersion) {
schemes.forEach((String name, String scheme) async { // Look for an old entry in an old clients library
if (name != "Clients") await db.execute("DROP TABLE IF EXISTS $name"); List<Map> list = [];
}); try {
await createTables(db); list = await db.rawQuery(
await db.rawUpdate("UPDATE Clients SET prev_batch='' WHERE client=?", "SELECT * FROM Clients WHERE client=?", [client.clientName]);
[client.clientName]); } on DatabaseException catch (_) {} catch (_) {
rethrow;
}
if (list.length == 1) {
debugPrint("[Store] Found old client from deprecated store");
var clientList = list[0];
_db = db;
client.connect(
newToken: clientList["token"],
newHomeserver: clientList["homeserver"],
newUserID: clientList["matrix_id"],
newDeviceID: clientList["device_id"],
newDeviceName: clientList["device_name"],
newLazyLoadMembers: clientList["lazy_load_members"] == 1,
newMatrixVersions:
clientList["matrix_versions"].toString().split(","),
newPrevBatch: null,
);
await db.execute("DROP TABLE IF EXISTS Clients");
if (client.debug) {
debugPrint(
"[Store] Restore client credentials from deprecated database of ${client.userID}");
}
schemes.forEach((String name, String scheme) async {
await db.execute("DROP TABLE IF EXISTS $name");
});
await createTables(db);
}
} else {
client.onLoginStateChanged.add(LoginState.loggedOut);
} }
}); });
// Mark all pending events as failed.
await _db.rawUpdate("UPDATE Events SET status=-1 WHERE status=0"); await _db.rawUpdate("UPDATE Events SET status=-1 WHERE status=0");
super._init();
}
List<Map> list = await _db Future<void> setRoomPrevBatch(String roomId, String prevBatch) async {
.rawQuery("SELECT * FROM Clients WHERE client=?", [client.clientName]); await txn.rawUpdate(
if (list.length == 1) { "UPDATE Rooms SET prev_batch=? WHERE room_id=?", [roomId, prevBatch]);
var clientList = list[0]; return;
print("[Store] Previous batch: '${clientList["prev_batch"].toString()}'");
client.connect(
newToken: clientList["token"],
newHomeserver: clientList["homeserver"],
newUserID: clientList["matrix_id"],
newDeviceID: clientList["device_id"],
newDeviceName: clientList["device_name"],
newLazyLoadMembers: clientList["lazy_load_members"] == 1,
newMatrixVersions: clientList["matrix_versions"].toString().split(","),
newPrevBatch: clientList["prev_batch"].toString().isEmpty
? null
: clientList["prev_batch"],
);
if (client.debug) {
print("[Store] Restore client credentials of ${client.userID}");
}
} else {
client.onLoginStateChanged.add(LoginState.loggedOut);
}
} }
Future<void> createTables(Database db) async { Future<void> createTables(Database db) async {
@ -97,36 +161,12 @@ class Store extends StoreAPI {
}); });
} }
Future<String> queryPrevBatch() async {
List<Map> list = await txn.rawQuery(
"SELECT prev_batch FROM Clients WHERE client=?", [client.clientName]);
return list[0]["prev_batch"];
}
/// Will be automatically called when the client is logged in successfully.
Future<void> storeClient() async {
await _db
.rawInsert('INSERT OR IGNORE INTO Clients VALUES(?,?,?,?,?,?,?,?,?)', [
client.clientName,
client.accessToken,
client.homeserver,
client.userID,
client.deviceID,
client.deviceName,
client.prevBatch,
client.matrixVersions.join(","),
client.lazyLoadMembers,
]);
return;
}
/// Clears all tables from the database. /// Clears all tables from the database.
Future<void> clear() async { Future<void> clear() async {
await _db
.rawDelete("DELETE FROM Clients WHERE client=?", [client.clientName]);
schemes.forEach((String name, String scheme) async { schemes.forEach((String name, String scheme) async {
if (name != "Clients") await _db.rawDelete("DELETE FROM $name"); await _db.rawDelete("DELETE FROM $name");
}); });
await super.clear();
return; return;
} }
@ -138,11 +178,13 @@ class Store extends StoreAPI {
}); });
} }
/// Will be automatically called on every synchronisation. Must be called inside of /// Will be automatically called on every synchronisation.
// /// [transaction]. Future<void> storePrevBatch(String prevBatch) async {
void storePrevBatch(String prevBatch) { final credentialsStr = await getItem(client.clientName);
txn.rawUpdate("UPDATE Clients SET prev_batch=? WHERE client=?", if (credentialsStr == null) return;
[prevBatch, client.clientName]); final Map<String, dynamic> credentials = json.decode(credentialsStr);
credentials["prev_batch"] = prevBatch;
await setItem(client.clientName, json.encode(credentials));
} }
Future<void> storeRoomPrevBatch(Room room) async { Future<void> storeRoomPrevBatch(Room room) async {
@ -345,37 +387,6 @@ class Store extends StoreAPI {
return Event.fromJson(res[0], room).asUser; return Event.fromJson(res[0], room).asUser;
} }
/// Loads all Users in the database to provide a contact list
/// except users who are in the Room with the ID [exceptRoomID].
Future<List<User>> loadContacts({String exceptRoomID = ""}) async {
List<Map<String, dynamic>> res = await _db.rawQuery(
"SELECT * FROM RoomStates WHERE state_key LIKE '@%:%' AND state_key!=? AND room_id!=? GROUP BY state_key ORDER BY state_key",
[client.userID, exceptRoomID]);
List<User> userList = [];
for (int i = 0; i < res.length; i++) {
userList.add(Event.fromJson(res[i], Room(id: "", client: client)).asUser);
}
return userList;
}
/// Returns all users of a room by a given [roomID].
Future<List<User>> loadParticipants(Room room) async {
List<Map<String, dynamic>> res = await _db.rawQuery(
"SELECT * " +
" FROM RoomStates " +
" WHERE room_id=? " +
" AND type='m.room.member'",
[room.id]);
List<User> participants = [];
for (num i = 0; i < res.length; i++) {
participants.add(Event.fromJson(res[i], room).asUser);
}
return participants;
}
/// Returns a list of events for the given room and sets all participants. /// Returns a list of events for the given room and sets all participants.
Future<List<Event>> getEventList(Room room) async { Future<List<Event>> getEventList(Room room) async {
List<Map<String, dynamic>> eventRes = await _db.rawQuery( List<Map<String, dynamic>> eventRes = await _db.rawQuery(
@ -416,17 +427,6 @@ class Store extends StoreAPI {
return roomList; return roomList;
} }
/// Returns a room without events and participants.
@deprecated
Future<Room> getRoomById(String id) async {
List<Map<String, dynamic>> res =
await _db.rawQuery("SELECT * FROM Rooms WHERE room_id=?", [id]);
if (res.length != 1) return null;
return Room.getRoomFromTableRow(res[0], client,
roomAccountData: getAccountDataFromRoomId(id),
states: getStatesFromRoomId(id));
}
Future<List<Map<String, dynamic>>> getStatesFromRoomId(String id) async { Future<List<Map<String, dynamic>>> getStatesFromRoomId(String id) async {
return _db.rawQuery("SELECT * FROM RoomStates WHERE room_id=?", [id]); return _db.rawQuery("SELECT * FROM RoomStates WHERE room_id=?", [id]);
} }
@ -487,48 +487,7 @@ class Store extends StoreAPI {
return; return;
} }
Future forgetNotification(String roomID) async {
assert(roomID != "");
await _db
.rawDelete("DELETE FROM NotificationsCache WHERE chat_id=?", [roomID]);
return;
}
Future addNotification(String roomID, String eventId, int uniqueID) async {
assert(roomID != "");
assert(eventId != "");
await _db.rawInsert(
"INSERT OR REPLACE INTO NotificationsCache(id, chat_id, event_id) VALUES (?, ?, ?)",
[uniqueID, roomID, eventId]);
// Make sure we got the same unique ID everywhere
await _db.rawUpdate("UPDATE NotificationsCache SET id=? WHERE chat_id=?",
[uniqueID, roomID]);
return;
}
Future<List<Map<String, dynamic>>> getNotificationByRoom(
String roomId) async {
assert(roomId != "");
List<Map<String, dynamic>> res = await _db
.rawQuery("SELECT * FROM NotificationsCache WHERE chat_id=?", [roomId]);
if (res.isEmpty) return null;
return res;
}
static final Map<String, String> schemes = { static final Map<String, String> schemes = {
/// The database scheme for the Client class.
"Clients": 'CREATE TABLE IF NOT EXISTS Clients(' +
'client TEXT PRIMARY KEY, ' +
'token TEXT, ' +
'homeserver TEXT, ' +
'matrix_id TEXT, ' +
'device_id TEXT, ' +
'device_name TEXT, ' +
'prev_batch TEXT, ' +
'matrix_versions TEXT, ' +
'lazy_load_members INTEGER, ' +
'UNIQUE(client))',
/// The database scheme for the Room class. /// The database scheme for the Room class.
'Rooms': 'CREATE TABLE IF NOT EXISTS Rooms(' + 'Rooms': 'CREATE TABLE IF NOT EXISTS Rooms(' +
'room_id TEXT PRIMARY KEY, ' + 'room_id TEXT PRIMARY KEY, ' +
@ -587,12 +546,5 @@ class Store extends StoreAPI {
'sender TEXT, ' + 'sender TEXT, ' +
'content TEXT, ' + 'content TEXT, ' +
'UNIQUE(sender))', 'UNIQUE(sender))',
/// The database scheme for the NotificationsCache class.
"NotificationsCache": 'CREATE TABLE IF NOT EXISTS NotificationsCache(' +
'id int, ' +
'chat_id TEXT, ' + // The chat id
'event_id TEXT, ' + // The matrix id of the Event
'UNIQUE(event_id))',
}; };
} }

View file

@ -11,7 +11,6 @@ class UrlLauncher {
const UrlLauncher(this.context, this.url); const UrlLauncher(this.context, this.url);
void launchUrl() { void launchUrl() {
print("Open url: $url");
if (url.startsWith("https://matrix.to/#/")) { if (url.startsWith("https://matrix.to/#/")) {
return openMatrixToUrl(); return openMatrixToUrl();
} }
@ -22,7 +21,6 @@ class UrlLauncher {
final matrix = Matrix.of(context); final matrix = Matrix.of(context);
final String identifier = url.replaceAll("https://matrix.to/#/", ""); final String identifier = url.replaceAll("https://matrix.to/#/", "");
if (identifier.substring(0, 1) == "#") { if (identifier.substring(0, 1) == "#") {
print("Join room ${Uri.encodeFull(identifier)}");
final response = await matrix.tryRequestWithLoadingDialog( final response = await matrix.tryRequestWithLoadingDialog(
matrix.client.joinRoomById( matrix.client.joinRoomById(
Uri.encodeComponent(identifier), Uri.encodeComponent(identifier),
@ -35,7 +33,6 @@ class UrlLauncher {
(r) => r.isFirst, (r) => r.isFirst,
); );
} else if (identifier.substring(0, 1) == "@") { } else if (identifier.substring(0, 1) == "@") {
print("Start chat with user $identifier");
final User user = User( final User user = User(
identifier, identifier,
room: Room(id: "", client: matrix.client), room: Room(id: "", client: matrix.client),

View file

@ -14,7 +14,6 @@ class AuthWebView extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final String url = Matrix.of(context).client.homeserver + final String url = Matrix.of(context).client.homeserver +
"/_matrix/client/r0/auth/$authType/fallback/web?session=$session"; "/_matrix/client/r0/auth/$authType/fallback/web?session=$session";
print(url);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(I18n.of(context).authentication), title: Text(I18n.of(context).authentication),

View file

@ -85,9 +85,7 @@ class _ChatListState extends State<ChatList> {
void getSharedData() { void getSharedData() {
// For sharing or opening urls/text coming from outside the app while the app is in the memory // For sharing or opening urls/text coming from outside the app while the app is in the memory
_intentDataStreamSubscription = ReceiveSharingIntent.getTextStream() _intentDataStreamSubscription = ReceiveSharingIntent.getTextStream()
.listen(processSharedText, onError: (err) { .listen(processSharedText, onError: (err) {});
print("getLinkStream error: $err");
});
// For sharing or opening urls/text coming from outside the app while the app is closed // For sharing or opening urls/text coming from outside the app while the app is closed
ReceiveSharingIntent.getInitialText().then(processSharedText); ReceiveSharingIntent.getInitialText().then(processSharedText);
} }

View file

@ -13,7 +13,6 @@ class ContentWebView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final String url = content.getDownloadLink(Matrix.of(context).client); final String url = content.getDownloadLink(Matrix.of(context).client);
print(url);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text( title: Text(

View file

@ -50,7 +50,6 @@ class _LoginState extends State<Login> {
} }
try { try {
print("[Login] Check server...");
setState(() => loading = true); setState(() => loading = true);
if (!await matrix.client.checkServer(homeserver)) { if (!await matrix.client.checkServer(homeserver)) {
setState( setState(
@ -63,7 +62,6 @@ class _LoginState extends State<Login> {
return setState(() => loading = false); return setState(() => loading = false);
} }
try { try {
print("[Login] Try to login...");
await matrix.client.login( await matrix.client.login(
usernameController.text, passwordController.text, usernameController.text, passwordController.text,
initialDeviceDisplayName: matrix.widget.clientName); initialDeviceDisplayName: matrix.widget.clientName);
@ -76,19 +74,14 @@ class _LoginState extends State<Login> {
} }
if (!kIsWeb) { if (!kIsWeb) {
try { try {
print("[Login] Setup Firebase...");
await matrix.setupFirebase(); await matrix.setupFirebase();
} catch (exception) { } catch (exception) {
print("[Login] Failed to setup Firebase. Logout now...");
await matrix.client.logout(); await matrix.client.logout();
matrix.clean(); matrix.clean();
setState(() => passwordError = exception.toString()); setState(() => passwordError = exception.toString());
return setState(() => loading = false); return setState(() => loading = false);
} }
} }
print("[Login] Store account and go to ChatListView");
await Matrix.of(context).saveAccount();
setState(() => loading = false); setState(() => loading = false);
await Navigator.of(context).pushAndRemoveUntil( await Navigator.of(context).pushAndRemoveUntil(
AppRoute.defaultRoute(context, ChatListView()), (r) => false); AppRoute.defaultRoute(context, ChatListView()), (r) => false);

View file

@ -76,7 +76,6 @@ class _SettingsState extends State<Settings> {
), ),
), ),
); );
print(success);
if (success != false) { if (success != false) {
Toast.show( Toast.show(
I18n.of(context).avatarHasBeenChanged, I18n.of(context).avatarHasBeenChanged,

View file

@ -58,7 +58,6 @@ class _SignUpState extends State<SignUp> {
} }
try { try {
print("[Sign Up] Check server...");
setState(() => loading = true); setState(() => loading = true);
if (!await matrix.client.checkServer(homeserver)) { if (!await matrix.client.checkServer(homeserver)) {
setState( setState(
@ -72,7 +71,6 @@ class _SignUpState extends State<SignUp> {
} }
try { try {
print("[Sign Up] Check if username is available...");
await matrix.client.usernameAvailable(preferredUsername); await matrix.client.usernameAvailable(preferredUsername);
} on MatrixException catch (exception) { } on MatrixException catch (exception) {
setState(() => usernameError = exception.errorMessage); setState(() => usernameError = exception.errorMessage);

View file

@ -39,7 +39,6 @@ class _SignUpPasswordState extends State<SignUpPassword> {
} }
try { try {
print("[Sign Up] Create account...");
setState(() => loading = true); setState(() => loading = true);
Future<LoginState> waitForLogin = Future<LoginState> waitForLogin =
matrix.client.onLoginStateChanged.stream.first; matrix.client.onLoginStateChanged.stream.first;
@ -52,8 +51,6 @@ class _SignUpPasswordState extends State<SignUpPassword> {
await waitForLogin; await waitForLogin;
} on MatrixException catch (exception) { } on MatrixException catch (exception) {
if (exception.requireAdditionalAuthentication) { if (exception.requireAdditionalAuthentication) {
print(exception.raw);
final List<String> stages = exception.authenticationFlows final List<String> stages = exception.authenticationFlows
.firstWhere((a) => !a.stages.contains("m.login.email.identity")) .firstWhere((a) => !a.stages.contains("m.login.email.identity"))
.stages; .stages;
@ -90,7 +87,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
return setState(() => loading = false); return setState(() => loading = false);
} }
} catch (exception) { } catch (exception) {
print(exception); debugPrint(exception);
setState(() => passwordError = exception.toString()); setState(() => passwordError = exception.toString());
return setState(() => loading = false); return setState(() => loading = false);
} }

View file

@ -110,8 +110,8 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
path: "." path: "."
ref: "2545995bbe96a1d96fe176ab666f4dd03d591aa6" ref: "1ff04785c0fb7db986c8a7b33396bf06301f1a14"
resolved-ref: "2545995bbe96a1d96fe176ab666f4dd03d591aa6" resolved-ref: "1ff04785c0fb7db986c8a7b33396bf06301f1a14"
url: "https://gitlab.com/famedly/famedlysdk.git" url: "https://gitlab.com/famedly/famedlysdk.git"
source: git source: git
version: "0.0.1" version: "0.0.1"
@ -160,6 +160,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_secure_storage:
dependency: "direct main"
description:
name: flutter_secure_storage
url: "https://pub.dartlang.org"
source: hosted
version: "3.3.1+1"
flutter_speed_dial: flutter_speed_dial:
dependency: "direct main" dependency: "direct main"
description: description:

View file

@ -27,7 +27,7 @@ dependencies:
famedlysdk: famedlysdk:
git: git:
url: https://gitlab.com/famedly/famedlysdk.git url: https://gitlab.com/famedly/famedlysdk.git
ref: bc2ca9749cfcc0506c59f97f4ae4987f0e84fbf4 ref: 1ff04785c0fb7db986c8a7b33396bf06301f1a14
localstorage: ^3.0.1+4 localstorage: ^3.0.1+4
bubble: ^1.1.9+1 bubble: ^1.1.9+1
@ -46,6 +46,7 @@ dependencies:
webview_flutter: ^0.3.19+4 webview_flutter: ^0.3.19+4
share: ^0.6.3+5 share: ^0.6.3+5
receive_sharing_intent: ^1.3.2 receive_sharing_intent: ^1.3.2
flutter_secure_storage: ^3.3.1+1
intl: ^0.16.0 intl: ^0.16.0
intl_translation: ^0.17.9 intl_translation: ^0.17.9