Skip to content

Commit

Permalink
Merge pull request #32 from leo-lox/dev
Browse files Browse the repository at this point in the history
gPlay - clickable hashtags + db
  • Loading branch information
leo-lox authored Jul 16, 2023
2 parents e243c64 + b7e63ce commit b91c5eb
Show file tree
Hide file tree
Showing 129 changed files with 12,744 additions and 4,469 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
"prefs",
"pubkey",
"Pubkeys"
]
],
"java.configuration.updateBuildConfiguration": "interactive"
}
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.lox.dev.camelus">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package de.lox.dev.camelus


import android.os.Build
import androidx.annotation.NonNull
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.EventChannel
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugins.GeneratedPluginRegistrant
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.GlobalScope.coroutineContext

Expand All @@ -14,5 +16,10 @@ import kotlinx.coroutines.GlobalScope.coroutineContext

class MainActivity : FlutterActivity() {

override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {

GeneratedPluginRegistrant.registerWith(flutterEngine)
}

}

6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.8.20'
ext.javalite_version = '3.21.7'
ext.protoc_version = '3.9.2'
ext.protobuf_gradle = '0.9.1'
Expand All @@ -10,7 +10,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.protobuf:protobuf-gradle-plugin:$protobuf_gradle"
}
Expand All @@ -31,6 +31,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
1 change: 1 addition & 0 deletions assets/icons/question.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/icons/speaker-simple-slash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/icons/target.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions integration_test/onboarding_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import 'package:camelus/routes/nostr/onboarding/onboarding.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:flutter/material.dart';
import 'package:camelus/main.dart' as app;

main() {
//IntegrationTestWidgetsFlutterBinding.ensureInitialized();

final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();

binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;

group('end-to-end test', () {
testWidgets('test onboarding, terms acceptance', (tester) async {
app.main();
await tester.pumpAndSettle();

expect(find.text('camelus'), findsOneWidget);

// check agb link
expect(find.text('terms and conditions'), findsOneWidget);

await tester.tap(find.widgetWithText(ElevatedButton, 'next'));
await tester.pumpAndSettle();
expect(find.byType(SnackBar), findsOneWidget);
expect(find.text('Please read and accept the terms and conditions first'),
findsOneWidget);
await tester.pumpAndSettle();

await tester.tap(find.byType(Checkbox));
await tester.pumpAndSettle();

await tester.tap(find.widgetWithText(ElevatedButton, 'next'));
await tester.pump(const Duration(milliseconds: 500));
expect(find.byType(NostrOnboarding), findsNothing);

//await tester.pumpAndSettle(const Duration(minutes: 1));
});
});
}
35 changes: 35 additions & 0 deletions lib/atoms/back_button_round.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import 'package:camelus/config/palette.dart';
import 'package:flutter/material.dart';

class BackButtonRound extends StatelessWidget {
const BackButtonRound({
super.key,
});

@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.all(0),
padding: const EdgeInsets.only(top: 10, right: 0, left: 0),
child: ButtonTheme(
minWidth: 10,
height: 1,
child: ElevatedButton(
onPressed: () {
Navigator.pop(context);
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.black54,
padding: const EdgeInsets.all(0),
shape: const CircleBorder(),
),
child: const Icon(
Icons.arrow_back,
color: Palette.white,
size: 20,
),
),
),
);
}
}
54 changes: 54 additions & 0 deletions lib/atoms/follow_button.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import 'package:camelus/config/palette.dart';
import 'package:flutter/material.dart';

Widget followButton({
required bool isFollowing,
required VoidCallback onPressed,
}) {
if (isFollowing) {
return Container(
margin: const EdgeInsets.only(top: 0, right: 10),
child: ElevatedButton(
onPressed: () {
onPressed();
},
style: ElevatedButton.styleFrom(
backgroundColor: Palette.black,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
side: const BorderSide(color: Palette.white, width: 1),
),
),
child: const Text(
'unfollow',
style: TextStyle(
color: Palette.white,
fontSize: 16,
),
),
),
);
}
return Container(
margin: const EdgeInsets.only(top: 0, right: 10),
child: ElevatedButton(
onPressed: () {
onPressed();
},
style: ElevatedButton.styleFrom(
backgroundColor: Palette.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
side: const BorderSide(color: Palette.black, width: 1),
),
),
child: const Text(
'follow',
style: TextStyle(
color: Palette.black,
fontSize: 16,
),
),
),
);
}
135 changes: 135 additions & 0 deletions lib/atoms/hashtag_card.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
import 'dart:math';

import 'package:camelus/config/palette.dart';
import 'package:flutter/material.dart';

class HashtagCard extends StatelessWidget {
final int index;
final String hashtag;
final int threadsCount;
final Function(String hashtag) onTap;

const HashtagCard({
super.key,
required this.index,
required this.hashtag,
required this.threadsCount,
required this.onTap,
});

@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
onTap(hashtag);
},
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
"${index + 1}. ",
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
height: BorderSide.strokeAlignCenter,
),
),
const SizedBox(width: 5),
Text(
hashtag,
style: const TextStyle(
height: BorderSide.strokeAlignCenter,
letterSpacing: 1,
fontSize: 28,
fontWeight: FontWeight.w600,
),
),
],
),
const SizedBox(height: 2),
Row(
children: [
const SizedBox(width: 25),
Text(
threadsCount.toString(),
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w400,
color: Palette.gray,
),
),
const SizedBox(width: 8),
const Text(
"threads",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w400,
color: Palette.gray,
),
),
],
),
],
),
),
);
}
}

class HashtagCardSkeleton extends StatelessWidget {
const HashtagCardSkeleton({super.key});

@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Container(
width: 20,
height: 20,
decoration: BoxDecoration(
color: Palette.extraDarkGray,
borderRadius: BorderRadius.circular(5),
),
),
const SizedBox(width: 5),
Container(
// random between 100 and 200
width: 80 + (140 * (Random().nextDouble() * 1.0)),
height: 40,
decoration: BoxDecoration(
color: Palette.extraDarkGray,
borderRadius: BorderRadius.circular(5),
),
),
],
),
const SizedBox(height: 2),
Row(
children: [
const SizedBox(width: 25),
Container(
width: 100,
height: 20,
decoration: BoxDecoration(
color: Palette.extraDarkGray,
borderRadius: BorderRadius.circular(5),
),
),
],
),
],
),
);
}
}
42 changes: 42 additions & 0 deletions lib/atoms/long_button.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import 'package:camelus/config/palette.dart';
import 'package:flutter/material.dart';

Widget longButton({
required String name,
required Function() onPressed,
bool inverted = false,
bool disabled = false,
bool loading = false,
}) {
return ElevatedButton(
onPressed: disabled && !loading ? null : onPressed,
style: ElevatedButton.styleFrom(
disabledBackgroundColor: Palette.darkGray,
foregroundColor: inverted ? Palette.black : Palette.lightGray,
backgroundColor: inverted ? Palette.extraLightGray : Palette.black,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
side: const BorderSide(color: Palette.white, width: 1),
),
),
child: loading
? _progress()
: Text(
name,
style: TextStyle(
color: inverted ? Palette.black : Palette.white,
fontSize: 18,
),
),
);
}

Widget _progress() {
return const Padding(
padding: EdgeInsets.only(left: 10, right: 10),
child: LinearProgressIndicator(
backgroundColor: Palette.gray,
color: Palette.black,
),
);
}
Loading

0 comments on commit b91c5eb

Please sign in to comment.