Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dbilgin/notelytask
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.0.3
Choose a base ref
...
head repository: dbilgin/notelytask
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3.1.0
Choose a head ref
  • 16 commits
  • 28 files changed
  • 1 contributor

Commits on Apr 1, 2024

  1. added settings state

    dbilgin committed Apr 1, 2024
    Copy the full SHA
    9240f59 View commit details
  2. added policy

    dbilgin committed Apr 1, 2024
    Copy the full SHA
    a5559f4 View commit details
  3. fix policy

    dbilgin committed Apr 1, 2024
    Copy the full SHA
    9cb0c2b View commit details

Commits on Apr 8, 2024

  1. added signin to google

    dbilgin committed Apr 8, 2024
    Copy the full SHA
    1aee378 View commit details
  2. added google sign in

    dbilgin committed Apr 8, 2024
    Copy the full SHA
    ae32e7c View commit details
  3. Revert "added signin to google"

    This reverts commit 1aee378.
    dbilgin committed Apr 8, 2024
    Copy the full SHA
    1c161cf View commit details
  4. remove unnecessary

    dbilgin committed Apr 8, 2024
    Copy the full SHA
    4cd0e29 View commit details

Commits on Apr 11, 2024

  1. Copy the full SHA
    e9afc8e View commit details

Commits on Jun 3, 2024

  1. Copy the full SHA
    2d5169d View commit details
  2. Check state in AppBar

    dbilgin committed Jun 3, 2024
    Copy the full SHA
    8c9c9b1 View commit details

Commits on Jun 7, 2024

  1. Merge pull request #3 from dbilgin/google-drive

    Google drive
    dbilgin authored Jun 7, 2024
    Copy the full SHA
    4f2310b View commit details
  2. Copy the full SHA
    216211a View commit details
  3. added connection warning

    dbilgin committed Jun 7, 2024
    Copy the full SHA
    404f00d View commit details
  4. got rid of google sign in

    dbilgin committed Jun 7, 2024
    Copy the full SHA
    b520650 View commit details
  5. bumped android version

    dbilgin committed Jun 7, 2024
    Copy the full SHA
    99f876f View commit details

Commits on Sep 29, 2024

  1. updated dependencies

    dbilgin committed Sep 29, 2024
    Copy the full SHA
    4add7f7 View commit details
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -46,3 +46,5 @@ app.*.map.json
/android/key.properties
*.keystore
.env

google-services.json
25 changes: 20 additions & 5 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -4,6 +4,14 @@ plugins {
id "dev.flutter.flutter-gradle-plugin"
}

def keyProperties = new Properties()
keyProperties.load(new FileInputStream(file('key.properties')))

def debugStoreFile = keyProperties.getProperty('DEBUG_STORE_FILE')
def debugStorePassword = keyProperties.getProperty('DEBUG_STORE_PASSWORD')
def debugKeyAlias = keyProperties.getProperty('DEBUG_KEY_ALIAS')
def debugKeyPassword = keyProperties.getProperty('DEBUG_KEY_PASSWORD')

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
@@ -14,12 +22,12 @@ if (localPropertiesFile.exists()) {

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '80'
flutterVersionCode = '81'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '3.0.3'
flutterVersionName = '3.1.0'
}

android {
@@ -41,14 +49,21 @@ android {
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.omedacore.notelytask"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}

signingConfigs {
debug {
storeFile file(debugStoreFile)
storePassword debugStorePassword
keyAlias debugKeyAlias
keyPassword debugKeyPassword
}
}

buildTypes {
2 changes: 1 addition & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
id "org.jetbrains.kotlin.android" version "1.9.23" apply false
}

include ":app"
57 changes: 29 additions & 28 deletions lib/cubit/github_cubit.dart
Original file line number Diff line number Diff line change
@@ -40,7 +40,6 @@ class GithubCubit extends HydratedCubit<GithubState> {
Future<GetNotesResult> getRemoteNotes({
required BuildContext context,
String? encryptionKey,
String? redirectNoteId,
}) async {
final accessToken = state.accessToken;
final ownerRepo = state.ownerRepo;
@@ -89,7 +88,7 @@ class GithubCubit extends HydratedCubit<GithubState> {
final accessToken = state.accessToken;
if (accessToken == null) {
reset(shouldError: true);
return RemoteConnectionResult();
return const RemoteConnectionResult();
}
emit(state.copyWith(loading: true, error: false));

@@ -98,30 +97,31 @@ class GithubCubit extends HydratedCubit<GithubState> {
accessToken,
);

final content = existingFile?.content;

if (keepLocal || existingFile?.sha == null || content == null) {
return const RemoteConnectionResult(shouldCreateRemote: true);
}

emit(
state.copyWith(
ownerRepo: ownerRepo,
sha: existingFile?.sha,
),
);
final content = existingFile?.content;

if (keepLocal || existingFile?.sha == null || content == null) {
return RemoteConnectionResult(shouldCreateRemote: true);
}

final isEncryptedString = isEncrypted(content);
if (isEncryptedString) {
final encryptionKey = await enterEncryptionKeyDialog();
if (encryptionKey == null) {
reset(shouldError: true);
return RemoteConnectionResult();
return const RemoteConnectionResult();
}

final decrypted = decrypt(content, encryptionKey);
if (decrypted == null) {
reset(shouldError: true);
return RemoteConnectionResult();
return const RemoteConnectionResult();
}

emit(state.copyWith(loading: false));
@@ -132,12 +132,6 @@ class GithubCubit extends HydratedCubit<GithubState> {
return RemoteConnectionResult(content: content);
}

bool isLoggedIn() {
final ownerRepo = state.ownerRepo;
final accessToken = state.accessToken;
return ownerRepo != null && accessToken != null;
}

Future<FileData?> uploadNewFile(
String safeFileName,
Uint8List data,
@@ -149,7 +143,7 @@ class GithubCubit extends HydratedCubit<GithubState> {
}
emit(state.copyWith(loading: true));

var newFile = await githubRepository.createNewFile(
final newFile = await githubRepository.createNewFile(
ownerRepo,
accessToken,
data,
@@ -163,7 +157,7 @@ class GithubCubit extends HydratedCubit<GithubState> {
}

emit(state.copyWith(loading: false));
return FileData(name: safeFileName, sha: sha);
return FileData(name: safeFileName, id: sha);
}

Future<bool> deleteFile(FileData fileData) async {
@@ -177,7 +171,7 @@ class GithubCubit extends HydratedCubit<GithubState> {
bool isDeleted = await githubRepository.deleteFile(
ownerRepo,
accessToken,
fileData.sha,
fileData.id,
fileData.name,
);

@@ -193,7 +187,7 @@ class GithubCubit extends HydratedCubit<GithubState> {
final ownerRepo = state.ownerRepo;
final sha = state.sha;
final accessToken = state.accessToken;
if (!isLoggedIn() || ownerRepo == null || accessToken == null) {
if (!state.isLoggedIn() || ownerRepo == null || accessToken == null) {
return;
}
emit(state.copyWith(loading: true));
@@ -203,7 +197,7 @@ class GithubCubit extends HydratedCubit<GithubState> {
? stringifiedContent
: encrypt(stringifiedContent, encryptionKey);

var newNote = await githubRepository.createOrUpdateNotesFile(
final newNote = await githubRepository.createOrUpdateNotesFile(
ownerRepo,
accessToken,
finalizedStringContent,
@@ -222,21 +216,28 @@ class GithubCubit extends HydratedCubit<GithubState> {
}

void reset({bool shouldError = false}) {
emit(const GithubState());
emit(state.copyWith(
loading: false,
ownerRepo: null,
error: shouldError,
accessToken: null,
));
emit(
const GithubState().copyWith(
loading: false,
ownerRepo: null,
error: shouldError,
accessToken: null,
),
);
}

void invalidateError() {
emit(state.copyWith(error: false));
}

Future<void> launchLogin() async {
var loginResult = await githubRepository.initialLogin();
reset();
final loginResult = await githubRepository.initialLogin();
if (loginResult == null) {
reset(shouldError: true);
return;
}

emit(
state.copyWith(
deviceCode: loginResult.deviceCode,
9 changes: 7 additions & 2 deletions lib/cubit/models/remote_connection_result.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
class RemoteConnectionResult {
import 'package:equatable/equatable.dart';

class RemoteConnectionResult extends Equatable {
final String? content;
final bool shouldCreateRemote;

RemoteConnectionResult({
const RemoteConnectionResult({
this.content,
this.shouldCreateRemote = false,
});

@override
List<Object?> get props => [content, shouldCreateRemote];
}
Loading