Skip to content

Commit 7ae08b2

Browse files
authored
Merge pull request #25 from raj457036/v0.1.24
V0.1.24 ( 0.1.28 - patches )
2 parents 4e875ed + 5d6168d commit 7ae08b2

File tree

18 files changed

+186
-107
lines changed

18 files changed

+186
-107
lines changed

android/app/google-services.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"project_info": {
33
"project_number": "892296995692",
44
"project_id": "clipboard-419514",
5-
"storage_bucket": "clipboard-419514.appspot.com"
5+
"storage_bucket": "clipboard-419514.firebasestorage.app"
66
},
77
"client": [
88
{

git-scripts/switch-branch.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
if [ -z "$1" ]; then
4+
echo "Usage: $0 <branch-name>"
5+
exit 1
6+
fi
7+
8+
BRANCH=$1
9+
10+
# Switch the main repository to the specified branch
11+
echo "Switching main repository to branch: $BRANCH"
12+
git checkout "$BRANCH"
13+
if [ $? -ne 0 ]; then
14+
echo "Failed to switch main repository to branch: $BRANCH"
15+
exit 1
16+
fi
17+
18+
# Update submodules to ensure they are initialized
19+
echo "Initializing and updating submodules..."
20+
git submodule update --init --recursive
21+
22+
# Switch all submodules to the specified branch
23+
echo "Switching all submodules to branch: $BRANCH"
24+
git submodule foreach --recursive "git checkout $BRANCH || echo 'Branch $BRANCH does not exist in submodule'"
25+
26+
# Update submodules to match the branch and main repo's references
27+
echo "Updating submodules to remote tracking branch: $BRANCH"
28+
git submodule update --remote --recursive
29+
30+
echo "Switched main repository and all submodules to branch: $BRANCH"

ios/Runner.xcodeproj/project.pbxproj

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@
291291
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
292292
D32916227F280D31E202A571 /* [CP] Embed Pods Frameworks */,
293293
D2C8199ACC7208E63509A4F9 /* [CP] Copy Pods Resources */,
294-
ADB4322C3E21A9B959E553DB /* FlutterFire: "flutterfire upload-crashlytics-symbols" */,
294+
1F1257162C8A34FED2858627 /* FlutterFire: "flutterfire upload-crashlytics-symbols" */,
295295
);
296296
buildRules = (
297297
);
@@ -378,6 +378,24 @@
378378
/* End PBXResourcesBuildPhase section */
379379

380380
/* Begin PBXShellScriptBuildPhase section */
381+
1F1257162C8A34FED2858627 /* FlutterFire: "flutterfire upload-crashlytics-symbols" */ = {
382+
isa = PBXShellScriptBuildPhase;
383+
buildActionMask = 2147483647;
384+
files = (
385+
);
386+
inputFileListPaths = (
387+
);
388+
inputPaths = (
389+
);
390+
name = "FlutterFire: \"flutterfire upload-crashlytics-symbols\"";
391+
outputFileListPaths = (
392+
);
393+
outputPaths = (
394+
);
395+
runOnlyForDeploymentPostprocessing = 0;
396+
shellPath = /bin/sh;
397+
shellScript = "\n#!/bin/bash\nPATH=${PATH}:$FLUTTER_ROOT/bin:$HOME/.pub-cache/bin\nflutterfire upload-crashlytics-symbols --upload-symbols-script-path=$PODS_ROOT/FirebaseCrashlytics/upload-symbols --platform=ios --apple-project-path=${SRCROOT} --env-platform-name=${PLATFORM_NAME} --env-configuration=${CONFIGURATION} --env-project-dir=${PROJECT_DIR} --env-built-products-dir=${BUILT_PRODUCTS_DIR} --env-dwarf-dsym-folder-path=${DWARF_DSYM_FOLDER_PATH} --env-dwarf-dsym-file-name=${DWARF_DSYM_FILE_NAME} --env-infoplist-path=${INFOPLIST_PATH} --default-config=default\n";
398+
};
381399
2579210AC2D0D9A6ECBC51F0 /* [CP] Check Pods Manifest.lock */ = {
382400
isa = PBXShellScriptBuildPhase;
383401
buildActionMask = 2147483647;
@@ -453,24 +471,6 @@
453471
shellPath = /bin/sh;
454472
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
455473
};
456-
ADB4322C3E21A9B959E553DB /* FlutterFire: "flutterfire upload-crashlytics-symbols" */ = {
457-
isa = PBXShellScriptBuildPhase;
458-
buildActionMask = 2147483647;
459-
files = (
460-
);
461-
inputFileListPaths = (
462-
);
463-
inputPaths = (
464-
);
465-
name = "FlutterFire: \"flutterfire upload-crashlytics-symbols\"";
466-
outputFileListPaths = (
467-
);
468-
outputPaths = (
469-
);
470-
runOnlyForDeploymentPostprocessing = 0;
471-
shellPath = /bin/sh;
472-
shellScript = "\n#!/bin/bash\nPATH=${PATH}:$FLUTTER_ROOT/bin:$HOME/.pub-cache/bin\nflutterfire upload-crashlytics-symbols --upload-symbols-script-path=$PODS_ROOT/FirebaseCrashlytics/upload-symbols --platform=ios --apple-project-path=${SRCROOT} --env-platform-name=${PLATFORM_NAME} --env-configuration=${CONFIGURATION} --env-project-dir=${PROJECT_DIR} --env-built-products-dir=${BUILT_PRODUCTS_DIR} --env-dwarf-dsym-folder-path=${DWARF_DSYM_FOLDER_PATH} --env-dwarf-dsym-file-name=${DWARF_DSYM_FILE_NAME} --env-infoplist-path=${INFOPLIST_PATH} --default-config=default\n";
473-
};
474474
D23738D31A79A78D4DE2D496 /* [CP] Check Pods Manifest.lock */ = {
475475
isa = PBXShellScriptBuildPhase;
476476
buildActionMask = 2147483647;

ios/Runner/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import UIKit
22
import Flutter
33
import share_handler_ios
44

5-
@UIApplicationMain
5+
@main
66
@objc class AppDelegate: FlutterAppDelegate {
77
override func application(
88
_ application: UIApplication,

ios/Runner/GoogleService-Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<key>PROJECT_ID</key>
1414
<string>clipboard-419514</string>
1515
<key>STORAGE_BUCKET</key>
16-
<string>clipboard-419514.appspot.com</string>
16+
<string>clipboard-419514.firebasestorage.app</string>
1717
<key>IS_ADS_ENABLED</key>
1818
<false></false>
1919
<key>IS_ANALYTICS_ENABLED</key>

lib/firebase_options.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class DefaultFirebaseOptions {
4141
messagingSenderId: '892296995692',
4242
projectId: 'clipboard-419514',
4343
authDomain: 'clipboard-419514.firebaseapp.com',
44-
storageBucket: 'clipboard-419514.appspot.com',
44+
storageBucket: 'clipboard-419514.firebasestorage.app',
4545
measurementId: 'G-8LF9RP87DF',
4646
);
4747

@@ -50,15 +50,15 @@ class DefaultFirebaseOptions {
5050
appId: '1:892296995692:android:64012302abe55897490949',
5151
messagingSenderId: '892296995692',
5252
projectId: 'clipboard-419514',
53-
storageBucket: 'clipboard-419514.appspot.com',
53+
storageBucket: 'clipboard-419514.firebasestorage.app',
5454
);
5555

5656
static const FirebaseOptions ios = FirebaseOptions(
5757
apiKey: 'AIzaSyDu5UXxIRpcUq1h680iS6mUtbEEsTNwsfA',
5858
appId: '1:892296995692:ios:4bf415b9b852d3af490949',
5959
messagingSenderId: '892296995692',
6060
projectId: 'clipboard-419514',
61-
storageBucket: 'clipboard-419514.appspot.com',
61+
storageBucket: 'clipboard-419514.firebasestorage.app',
6262
iosBundleId: 'com.entilitystudio.CopyCat',
6363
);
6464

@@ -67,7 +67,7 @@ class DefaultFirebaseOptions {
6767
appId: '1:892296995692:ios:4bf415b9b852d3af490949',
6868
messagingSenderId: '892296995692',
6969
projectId: 'clipboard-419514',
70-
storageBucket: 'clipboard-419514.appspot.com',
70+
storageBucket: 'clipboard-419514.firebasestorage.app',
7171
iosBundleId: 'com.entilitystudio.CopyCat',
7272
);
7373

@@ -77,7 +77,7 @@ class DefaultFirebaseOptions {
7777
messagingSenderId: '892296995692',
7878
projectId: 'clipboard-419514',
7979
authDomain: 'clipboard-419514.firebaseapp.com',
80-
storageBucket: 'clipboard-419514.appspot.com',
80+
storageBucket: 'clipboard-419514.firebasestorage.app',
8181
measurementId: 'G-TBGBJVH2GS',
8282
);
8383

lib/main.dart

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import 'package:copycat_base/bloc/offline_persistance_cubit/offline_persistance_
2121
import 'package:copycat_base/bloc/sync_manager_cubit/sync_manager_cubit.dart';
2222
import 'package:copycat_base/bloc/window_action_cubit/window_action_cubit.dart';
2323
import 'package:copycat_base/common/bloc_config.dart';
24+
import 'package:copycat_base/common/logging.dart';
2425
import 'package:copycat_base/constants/key.dart';
2526
import 'package:copycat_base/constants/widget_styles.dart';
2627
import 'package:copycat_base/l10n/generated/app_localizations.dart';
@@ -46,10 +47,15 @@ import 'package:window_manager/window_manager.dart';
4647
import 'firebase_options.dart';
4748

4849
Future<void> main() async {
49-
WidgetsFlutterBinding.ensureInitialized();
50-
await initializeServices();
50+
runZonedGuarded(() async {
51+
WidgetsFlutterBinding.ensureInitialized();
52+
await initializeServices();
5153

52-
runApp(const MainApp());
54+
runApp(const MainApp());
55+
}, (error, stack) async {
56+
FirebaseCrashlytics.instance.recordError(error, stack, fatal: true);
57+
debugPrint('Uncaught Error: $error');
58+
});
5359
}
5460

5561
Future<void> initializeServices() async {
@@ -96,27 +102,36 @@ Future<void> initializeDesktopServices() async {
96102
titleBarStyle: TitleBarStyle.hidden,
97103
);
98104
windowManager.waitUntilReadyToShow(windowOptions).then((_) async {
99-
// if (Platform.isMacOS) {
100-
// await windowManager.setVisibleOnAllWorkspaces(
101-
// true,
102-
// visibleOnFullScreen: true,
103-
// );
104-
// }
105-
windowManager.hide();
105+
await windowManager.hide();
106106
});
107107
}
108108

109109
Future<void> initializeFirebase() async {
110-
if (isAnalyticsSupported) {
111-
await Firebase.initializeApp(
112-
options: DefaultFirebaseOptions.currentPlatform,
113-
);
110+
try {
111+
if (isAnalyticsSupported) {
112+
await Firebase.initializeApp(
113+
options: DefaultFirebaseOptions.currentPlatform,
114+
);
114115

115-
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError;
116-
PlatformDispatcher.instance.onError = (error, stack) {
117-
FirebaseCrashlytics.instance.recordError(error, stack, fatal: true);
118-
return true;
119-
};
116+
FlutterError.onError = (errorDetail) {
117+
try {
118+
FirebaseCrashlytics.instance.recordFlutterFatalError(errorDetail);
119+
} catch (e) {
120+
logger.e(e);
121+
}
122+
};
123+
PlatformDispatcher.instance.onError = (error, stack) {
124+
try {
125+
FirebaseCrashlytics.instance
126+
.recordError(error, stack, printDetails: true, fatal: false);
127+
} catch (e) {
128+
logger.e(e);
129+
}
130+
return true;
131+
};
132+
}
133+
} catch (e) {
134+
logger.e(e);
120135
}
121136
}
122137

lib/pages/settings/widgets/info_card.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class InfoCard extends StatelessWidget {
2222
child: Padding(
2323
padding: const EdgeInsets.all(padding12),
2424
child: Column(
25+
mainAxisSize: MainAxisSize.min,
2526
crossAxisAlignment: CrossAxisAlignment.start,
2627
children: [
2728
Text(

lib/widgets/dialogs/e2ee_dialog.dart

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'dart:async';
12
import 'dart:convert' show jsonEncode, jsonDecode, utf8;
23

34
import 'package:clipboard/widgets/dialogs/e2ee_dialogs/export_e2ee.dart';
@@ -39,13 +40,35 @@ class _E2EESettingDialogState extends State<E2EESettingDialog> {
3940
bool invalidImportedKey = false;
4041
String? secret;
4142
bool rebuilding = false;
43+
Timer? canContinueTimer;
44+
int allowedIn = 0;
4245

4346
late AppConfigCubit appConfigCubit;
4447

4548
@override
4649
void initState() {
4750
super.initState();
4851
appConfigCubit = context.read<AppConfigCubit>();
52+
allowedIn = 9;
53+
startTimer();
54+
}
55+
56+
void updateCanContinueTimer(Timer? timer) {
57+
setState(() {
58+
allowedIn -= 1;
59+
});
60+
if (allowedIn <= 0) {
61+
timer?.cancel();
62+
canContinueTimer = null;
63+
}
64+
}
65+
66+
void startTimer() {
67+
setState(() {
68+
allowedIn = 5;
69+
});
70+
canContinueTimer =
71+
Timer.periodic(const Duration(seconds: 1), updateCanContinueTimer);
4972
}
5073

5174
Future<void> importEnc2Key(String keyId) async {
@@ -116,22 +139,27 @@ class _E2EESettingDialogState extends State<E2EESettingDialog> {
116139
}
117140

118141
Future<void> generateEnc2Key() async {
119-
final enc2 = EncryptionSecret.generate();
120-
final keyId = const Uuid().v4();
121-
final encryptor = EncryptionManager(enc2);
122-
123-
final enc1Decrypt = EncryptionSecret.generate();
124-
final enc1 = encryptor.encrypt(enc1Decrypt.serialized);
125-
126-
setState(() => loading = true);
127-
128-
await context.read<AuthCubit>().setupEncryption(keyId, enc1);
129-
130-
setState(() {
131-
loading = false;
132-
});
133-
134-
appConfigCubit.setE2EEKey(enc2.serialized);
142+
try {
143+
setState(() => loading = true);
144+
final enc2 = EncryptionSecret.generate();
145+
final keyId = const Uuid().v4();
146+
final encryptor = EncryptionManager(enc2);
147+
final authCubit = context.read<AuthCubit>();
148+
149+
final enc1Decrypt = EncryptionSecret.generate();
150+
final enc1 = encryptor.encrypt(enc1Decrypt.serialized);
151+
152+
final failure = await appConfigCubit.setE2EEKey(enc2.serialized);
153+
if (failure != null) {
154+
showFailureSnackbar(failure);
155+
return;
156+
}
157+
await authCubit.setupEncryption(keyId, enc1);
158+
} finally {
159+
setState(() {
160+
loading = false;
161+
});
162+
}
135163
}
136164

137165
@override
@@ -180,6 +208,7 @@ class _E2EESettingDialogState extends State<E2EESettingDialog> {
180208
return GenerateE2eeDialog(
181209
loading: loading,
182210
generateEnc2Key: generateEnc2Key,
211+
allowedIn: allowedIn,
183212
);
184213
}
185214

lib/widgets/dialogs/e2ee_dialogs/generate_e2ee.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ import 'package:flutter/material.dart';
66
class GenerateE2eeDialog extends StatelessWidget {
77
final bool loading;
88
final VoidCallback generateEnc2Key;
9+
final int allowedIn;
910

1011
const GenerateE2eeDialog({
1112
super.key,
1213
required this.loading,
1314
required this.generateEnc2Key,
15+
this.allowedIn = 0,
1416
});
1517

1618
@override
@@ -62,11 +64,13 @@ class GenerateE2eeDialog extends StatelessWidget {
6264
),
6365
height10,
6466
ElevatedButton.icon(
65-
onPressed: loading ? null : generateEnc2Key,
67+
onPressed: loading || allowedIn > 0 ? null : generateEnc2Key,
6668
icon: const Icon(Icons.key),
6769
label: loading
6870
? Text(context.locale.generating)
69-
: Text(context.locale.generateKey),
71+
: allowedIn > 0
72+
? Text("${context.locale.generateKey} ($allowedIn s )")
73+
: Text(context.locale.generateKey),
7074
),
7175
],
7276
),

0 commit comments

Comments
 (0)