Skip to content

Commit

Permalink
Merge pull request #321 from bobs4462/main
Browse files Browse the repository at this point in the history
2.2.9+1 build
  • Loading branch information
bmuddha authored Mar 4, 2021
2 parents 14867ce + 3ce13b6 commit c6d3f71
Show file tree
Hide file tree
Showing 52 changed files with 767 additions and 333 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ app.*.symbols
app.*.map.json
/ios/Runner/GoogleService-Info.plist
/android/app/google-services.json
/android/key.properties
/android/android.jks
18 changes: 15 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
compileSdkVersion 29

Expand All @@ -46,11 +52,17 @@ android {
versionName flutterVersionName
}

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
signingConfig signingConfigs.release
}
}
}
Expand Down
23 changes: 23 additions & 0 deletions android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Gson rules
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature

# For using GSON @Expose annotation
-keepattributes *Annotation*

# Gson specific classes
-dontwarn sun.misc.**
#-keep class com.google.gson.stream.** { *; }

# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * extends com.google.gson.TypeAdapter
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions android/app/src/main/res/drawable/launch_background.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@
android:gravity="center"
android:src="@drawable/logo" />
</item>
<item>
<bitmap
android:gravity="center"
android:src="@drawable/logo_blue" />
</item>
</layer-list>
Binary file added android/app/src/main/res/drawable/logo_blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ PODS:
- Flutter (1.0.0)
- flutter_inappwebview (0.0.1):
- Flutter
- flutter_local_notifications (0.0.1):
- Flutter
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
Expand Down Expand Up @@ -104,6 +106,7 @@ DEPENDENCIES:
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
- Flutter (from `Flutter`)
- flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- image_picker (from `.symlinks/plugins/image_picker/ios`)
- package_info (from `.symlinks/plugins/package_info/ios`)
- path_provider (from `.symlinks/plugins/path_provider/ios`)
Expand Down Expand Up @@ -142,6 +145,8 @@ EXTERNAL SOURCES:
:path: Flutter
flutter_inappwebview:
:path: ".symlinks/plugins/flutter_inappwebview/ios"
flutter_local_notifications:
:path: ".symlinks/plugins/flutter_local_notifications/ios"
image_picker:
:path: ".symlinks/plugins/image_picker/ios"
package_info:
Expand Down Expand Up @@ -170,6 +175,7 @@ SPEC CHECKSUMS:
FirebaseMessaging: 5eca4ef173de76253352511aafef774caa1cba2a
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
flutter_inappwebview: 69dfbac46157b336ffbec19ca6dfd4638c7bf189
flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833
GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3
Expand Down
78 changes: 52 additions & 26 deletions lib/blocs/add_channel_bloc/add_channel_bloc.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:twake/repositories/add_channel_repository.dart';
import 'package:twake/repositories/add_direct_repository.dart';
import 'add_channel_event.dart';
import 'add_channel_state.dart';

class AddChannelBloc extends Bloc<AddChannelEvent, AddChannelState> {
final AddChannelRepository repository;
final AddChannelRepository channelRepository;
final AddDirectRepository directRepository;

AddChannelBloc(this.repository) : super(AddChannelInitial());
AddChannelBloc(
this.channelRepository,
this.directRepository,
) : super(AddChannelInitial());

@override
Stream<AddChannelState> mapEventToState(
Expand All @@ -16,43 +21,64 @@ class AddChannelBloc extends Bloc<AddChannelEvent, AddChannelState> {
if (event is SetFlowStage) {
yield StageUpdated(event.stage);
} else if (event is Update) {
repository.icon = event.icon ?? repository.icon;
repository.name = event.name ?? repository.name;
repository.description = event.description ?? repository.description;
repository.channelGroup = event.groupName ?? repository.channelGroup;
repository.type = event.type ?? repository.type ?? ChannelType.public;
repository.members = event.participants ?? repository.members ?? [];
repository.def = event.automaticallyAddNew ?? repository.def ?? true;
channelRepository.icon = event.icon ?? channelRepository.icon;
channelRepository.name = event.name ?? channelRepository.name;
channelRepository.description =
event.description ?? channelRepository.description;
channelRepository.channelGroup =
event.groupName ?? channelRepository.channelGroup;
channelRepository.type =
event.type ?? channelRepository.type ?? ChannelType.public;
channelRepository.members =
event.participants ?? channelRepository.members ?? [];
channelRepository.def =
event.automaticallyAddNew ?? channelRepository.def ?? true;

// print('Updated data: ${repository.toJson()}');
var newRepo = AddChannelRepository(
icon: repository.icon,
companyId: repository.companyId,
workspaceId: repository.workspaceId,
name: repository.name,
visibility: repository.visibility,
description: repository.description,
channelGroup: repository.channelGroup,
type: repository.type,
members: repository.members,
def: repository.def,
final newRepo = AddChannelRepository(
icon: channelRepository.icon,
companyId: channelRepository.companyId,
workspaceId: channelRepository.workspaceId,
name: channelRepository.name,
visibility: channelRepository.visibility,
description: channelRepository.description,
channelGroup: channelRepository.channelGroup,
type: channelRepository.type,
members: channelRepository.members,
def: channelRepository.def,
);

yield Updated(newRepo);
} else if (event is UpdateDirect) {
directRepository.member = event.member;
// print('Updated data: ${repository.toJson()}');
final newRepo = AddDirectRepository(
companyId: directRepository.companyId,
workspaceId: directRepository.workspaceId,
member: directRepository.member,
);
yield DirectUpdated(newRepo);
} else if (event is Create) {
yield Creation();
final type = repository.type;
final result = await repository.create();
final type = channelRepository.type;
final result = await channelRepository.create();
if (result.isNotEmpty) {
repository.clear();
yield Created(result, type);
channelRepository.clear();
yield Created(result, channelType: type);
} else {
yield Error('Channel creation failure!');
}
} else if (event is Clear) {
repository.clear();
channelRepository.clear();
} else if (event is SetFlowType) {
yield FlowTypeSet(event.isDirect);
} else if (event is CreateDirect) {
yield Creation();
final result = await directRepository.create();
if (result.isNotEmpty) {
yield DirectCreated(result);
} else {
yield Error('Direct creation failure!');
}
}
}
}
14 changes: 14 additions & 0 deletions lib/blocs/add_channel_bloc/add_channel_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class Create extends AddChannelEvent {
List<Object> get props => [];
}

class CreateDirect extends AddChannelEvent {
@override
List<Object> get props => [];
}

class Update extends AddChannelEvent {
final String icon;
final String name;
Expand Down Expand Up @@ -46,6 +51,15 @@ class Update extends AddChannelEvent {
];
}

class UpdateDirect extends AddChannelEvent {
final String member;

UpdateDirect({this.member});

@override
List<Object> get props => [member];
}

class SetFlowType extends AddChannelEvent {
final bool isDirect;

Expand Down
21 changes: 20 additions & 1 deletion lib/blocs/add_channel_bloc/add_channel_state.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:equatable/equatable.dart';
import 'package:twake/repositories/add_channel_repository.dart';
import 'package:twake/repositories/add_direct_repository.dart';

abstract class AddChannelState extends Equatable {
const AddChannelState();
Expand All @@ -19,6 +20,15 @@ class Updated extends AddChannelState {
List<Object> get props => [repository];
}

class DirectUpdated extends AddChannelState {
final AddDirectRepository repository;

DirectUpdated(this.repository);

@override
List<Object> get props => [repository];
}

class Creation extends AddChannelState {
@override
List<Object> get props => [];
Expand All @@ -28,12 +38,21 @@ class Created extends AddChannelState {
final String id;
final ChannelType channelType;

Created(this.id, this.channelType);
Created(this.id, {this.channelType});

@override
List<Object> get props => [id, channelType];
}

class DirectCreated extends AddChannelState {
final String id;

DirectCreated(this.id);

@override
List<Object> get props => [id];
}

class Error extends AddChannelState {
final String message;

Expand Down
10 changes: 8 additions & 2 deletions lib/blocs/auth_bloc/auth_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,16 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
);
switch (res) {
case AuthResult.WrongCredentials:
yield WrongCredentials();
yield WrongCredentials(
username: event.username,
password: event.password,
);
break;
case AuthResult.NetworkError:
yield AuthenticationError();
yield AuthenticationError(
username: event.username,
password: event.password,
);
break;
default:
final InitData initData = await initMain();
Expand Down
14 changes: 9 additions & 5 deletions lib/blocs/auth_bloc/auth_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ class AuthInitializing extends AuthState {

class Unauthenticated extends AuthState {
final String message;
final String username;
final String password;

const Unauthenticated({this.message});
const Unauthenticated({this.message, this.username, this.password});

@override
List<Object> get props => [message];
List<Object> get props => [username, password];
}

class WrongCredentials extends Unauthenticated {
const WrongCredentials();
const WrongCredentials({String username, String password})
: super(username: username, password: password);

@override
List<Object> get props => [];
Expand Down Expand Up @@ -62,8 +65,9 @@ class PasswordReset extends AuthState {
List<Object> get props => [link];
}

class AuthenticationError extends AuthState {
const AuthenticationError();
class AuthenticationError extends Unauthenticated {
const AuthenticationError({String username, String password})
: super(username: username, password: password);

@override
List<Object> get props => [];
Expand Down
8 changes: 4 additions & 4 deletions lib/blocs/base_channel_bloc/base_channel_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,25 @@ abstract class BaseChannelBloc extends Bloc<ChannelsEvent, ChannelState> {
Future<void> updateMessageCount(ModifyMessageCount event) async {
final ch = await repository.getItemById(event.channelId);
if (ch != null) {
repository.logger.d("UPDATING CHANNEL UNREAD");
// ch.messagesTotal += event.totalModifier ?? 0;
ch.hasUnread = 1;
ch.messagesUnread += event.unreadModifier ?? 0;
ch.lastActivity =
event.timeStamp ?? DateTime.now().millisecondsSinceEpoch;
repository.saveOne(ch);
} else
return;
}
}

Future<void> updateChannelState(ModifyChannelState event) async {
final ch = await repository.getItemById(event.channelId);
repository.logger.d("UPDATING CHANNEL STATE");
if (ch != null) {
ch.hasUnread = 1;
if (event.threadId != null || event.messageId != null) {
ch.messagesUnread += 1;
}
repository.saveOne(ch);
} else
return;
}
}
}
Loading

0 comments on commit c6d3f71

Please sign in to comment.