This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pikepdf | |
''' | |
Opens a password protected PDF, then saves it as non-password protected | |
Simply set the pdf you want to open, the password, and the pdf you want to save to | |
''' | |
def main(): | |
OPEN_PDF = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Center( | |
child: Column( | |
children: [ | |
SizedBox( | |
height: 50, | |
), | |
Padding( | |
padding: const EdgeInsets.all(20.0), | |
child: TextField( | |
onChanged: (text) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void configureAmplify() async { | |
if (!mounted) return; | |
try { | |
AmplifyAnalyticsPinpoint analyticsPlugin = AmplifyAnalyticsPinpoint(); | |
AmplifyAuthCognito authPlugin = AmplifyAuthCognito(); | |
AmplifyStorageS3 storage = AmplifyStorageS3(); | |
// Authentication -> AWS Cognito | |
// Analytics -> AWS Pinpoint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<List<StorageItem>> listFiles() async { | |
try { | |
ListResult res = await Amplify.Storage.list(); | |
AuthUser user = await Amplify.Auth.getCurrentUser(); | |
List<StorageItem> items = res.items | |
.where((e) => e.key.split('/').first.contains(user.username)) | |
.toList(); | |
return items; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void deleteFile(StorageItem item) async { | |
try { | |
await Amplify.Storage.remove( | |
key: item.key, | |
); | |
} catch (e) { | |
Alert( | |
context: context, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void downloadFile(StorageItem item) async { | |
try { | |
var dir = await DownloadsPathProvider.downloadsDirectory; | |
var url = await Amplify.Storage.getUrl( | |
key: item.key, options: GetUrlOptions(expires: 3600)); | |
await checkPermission(); | |
await FlutterDownloader.enqueue( | |
url: url.url, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void uploadFile() async { | |
File file = await FilePicker.getFile(); | |
AuthUser user = await Amplify.Auth.getCurrentUser(); | |
try { | |
if (file.existsSync()) { | |
setState(() { | |
uploading = true; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
logout() async { | |
try { | |
Amplify.Auth.signOut(); | |
Navigator.pushReplacement( | |
context, MaterialPageRoute(builder: (context) => Login())); | |
} on AuthError catch (e) { | |
Alert( | |
context: context, | |
type: AlertType.error, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
confirmUser() async { | |
SignUpResult res = await Amplify.Auth.confirmSignUp( | |
username: this.widget.username, | |
confirmationCode: code.trim() | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<String> _registerUser(LoginData data) async { | |
try { | |
Map<String, dynamic> userAttributes = { | |
"email": data.name, | |
}; | |
SignUpResult res = await Amplify.Auth.signUp( | |
username: data.name, | |
password: data.password, | |
options: CognitoSignUpOptions(userAttributes: userAttributes)); |
NewerOlder