-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* rt: scaffolded rid app * rt: hello world + logging * rt: reddit models and deps * rt: querying page with ureq * rt: dart script for faster iteration * rt: completed extracting page from page response * rt: completed extracting page from page response * rt: setup score with a fake post * rt: add rid messaging implementation * rt: bloc deps and app skeleton * rt: post/posts cubits * rt: post and posts views * rt: add google charts dependency * rt: showing fake scores * rt: implemented add post * rt: stop watching post * rt: polling post scores * rt: running on ios + android * rt: adding database support * rt: storing added posts in db * rt: adding scores to database * rt: retrieving posts with scores from db on init * rt: deleting removed posts and scored from db * rt: optimizing post access in post_cubit * rt: including rid user message types
- Loading branch information
Showing
387 changed files
with
46,359 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
.DS_Store | ||
.idea/ | ||
.metadata | ||
|
||
## Flutter ### | ||
# Flutter/Dart/Pub related | ||
**/doc/api/ | ||
.dart_tool/ | ||
.flutter-plugins | ||
.flutter-plugins-dependencies | ||
.fvm/ | ||
.packages | ||
.pub-cache/ | ||
.pub/ | ||
build/ | ||
coverage/ | ||
lib/generated_plugin_registrant.dart | ||
# For library packages, don’t commit the pubspec.lock file. | ||
# Regenerating the pubspec.lock file lets you test your package against the latest compatible versions of its dependencies. | ||
# See https://dart.dev/guides/libraries/private-files#pubspeclock | ||
#pubspec.lock | ||
|
||
# Android related | ||
**/android/**/gradle-wrapper.jar | ||
**/android/.gradle | ||
**/android/captures/ | ||
**/android/gradlew | ||
**/android/gradlew.bat | ||
**/android/key.properties | ||
**/android/local.properties | ||
**/android/**/GeneratedPluginRegistrant.java | ||
|
||
# iOS/XCode related | ||
**/ios/**/*.mode1v3 | ||
**/ios/**/*.mode2v3 | ||
**/ios/**/*.moved-aside | ||
**/ios/**/*.pbxuser | ||
**/ios/**/*.perspectivev3 | ||
**/ios/**/*sync/ | ||
**/ios/**/.sconsign.dblite | ||
**/ios/**/.tags* | ||
**/ios/**/.vagrant/ | ||
**/ios/**/DerivedData/ | ||
**/ios/**/Icon? | ||
**/ios/**/Pods/ | ||
**/ios/**/.symlinks/ | ||
**/ios/**/profile | ||
**/ios/**/xcuserdata | ||
**/ios/.generated/ | ||
**/ios/Flutter/.last_build_id | ||
**/ios/Flutter/App.framework | ||
**/ios/Flutter/Flutter.framework | ||
**/ios/Flutter/Flutter.podspec | ||
**/ios/Flutter/Generated.xcconfig | ||
**/ios/Flutter/app.flx | ||
**/ios/Flutter/app.zip | ||
**/ios/Flutter/flutter_assets/ | ||
**/ios/Flutter/flutter_export_environment.sh | ||
**/ios/ServiceDefinitions.json | ||
**/ios/Runner/GeneratedPluginRegistrant.* | ||
|
||
# Exceptions to above rules. | ||
!**/ios/**/default.mode1v3 | ||
!**/ios/**/default.mode2v3 | ||
!**/ios/**/default.pbxuser | ||
!**/ios/**/default.perspectivev3 | ||
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages | ||
|
||
### Rust ### | ||
**/target/** | ||
**/Cargo.lock | ||
|
||
### Rid ### | ||
**/generated/** | ||
**/Classes/bindings.h | ||
**/macos/*.a | ||
**/ios/*.a | ||
**/android/src/main/jniLibs/* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[package] | ||
name = "reddit_ticker" | ||
version = "0.1.0" | ||
authors = ["Thorsten Lorenz <thlorenz@gmx.de>"] | ||
edition = "2018" | ||
|
||
[lib] | ||
crate-type = ["cdylib", "staticlib" ] | ||
|
||
[[bin]] | ||
name = "rid_build" | ||
path = "rid_build.rs" | ||
|
||
[dependencies] | ||
cbindgen = "0.20.0" | ||
rid_build = { path = "../../../rid/rid-build" } | ||
rid = { path = "../../../rid" } | ||
serde = { version = "1.0.123", features = [ "derive" ] } | ||
serde_json = "1.0.64" | ||
ureq = { version = "2.0.2", features = [ "json" ] } | ||
anyhow = "1.0.38" | ||
rusqlite = { version = "0.24.2", features = [ "bundled" ] } |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# reddit_ticker | ||
|
||
Rust integrated Dart Flutter Project | ||
|
||
## Getting Started | ||
|
||
Use the below scripts to get the app ready to run with Flutter. | ||
|
||
### 1. Generate Glue Code | ||
|
||
```sh | ||
./sh/bindgen | ||
``` | ||
|
||
### 2. Build For Desired Target/Device | ||
|
||
Run any of the below three to build the binary for the specific device and have it placed into | ||
the devices specific plugin folder. | ||
|
||
```sh | ||
./sh/macos | ||
``` | ||
|
||
### 3. Run with Flutter | ||
|
||
Run on the device. | ||
|
||
```sh | ||
flutter run -d macos | ||
``` | ||
|
||
### 4. Develop | ||
|
||
Run step `1` whenever a function exposed to Flutter changes. | ||
|
||
Run step `2` whenever any of your Rust code changes. | ||
|
||
**Note** that to apply changes from Rust you need to restart the app to reload the compiled binary. | ||
A hot restart/reload does not achieve this. | ||
|
||
## Folder Structure | ||
|
||
``` | ||
├── android | ||
├── ios | ||
├── macos | ||
├── lib | ||
├── plugin | ||
│ ├── android | ||
│ ├── ios | ||
│ ├── macos | ||
│ └── lib | ||
└── src | ||
``` | ||
|
||
### `./plugin` | ||
|
||
Provides connection from Flutter to Rust. | ||
|
||
Rust binaries are placed into the respective plugin folders `./ios, ./macos, ./android` when | ||
they are built. | ||
|
||
Generated Dart glue code is placed inside `./plugin/lib/generated` while | ||
`./plugin/lib/plugin.dart` just exposes the API to the app. | ||
|
||
### `./src` | ||
|
||
Contains the starter Rust code inside `./src/lib.rs`. Keep developing the Rust part of your app | ||
here. | ||
|
||
### `./lib` | ||
|
||
Contains the starter Flutter app inside `./lib/main.dart`. | ||
|
||
### `./sh` | ||
|
||
Provides scripts to run build and code generation tasks. In the future a tool will provide the | ||
functionality currently provided by these scripts. | ||
|
||
- `bindgen` generates the `binding.h` header file for the extern Rust functions found inside | ||
`./src`. These are then placed inside the `./plugin` device folders were needed as well as | ||
`./plugin/lib/generated/binding.h` where they are used to generate Dart glue code | ||
- as part of this script `ffigen` generates Dart glue code inside | ||
`./plugin/lib/generated/ffigen_binding.dart` using `./plugin/lib/generated/binding.h` as input | ||
- `./android` builds the Rust binary to run on Android devices/emulators and places it inside | ||
`./plugin/lib/android` | ||
- `./ios` builds the Rust binary to run on IOS devices/emulators and places it inside | ||
`./plugin/lib/ios` | ||
- `./macos` builds the Rust binary to run on MacOs directly and places it inside | ||
`./plugin/lib/macos`, this is the same format as running `cargo build` on your Mac | ||
- `clean` cleans both the Flutter plugin and application, run this to reset Flutter when things | ||
aren't working |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# This file configures the analyzer, which statically analyzes Dart code to | ||
# check for errors, warnings, and lints. | ||
# | ||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled | ||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be | ||
# invoked from the command line by running `flutter analyze`. | ||
|
||
# The following line activates a set of recommended lints for Flutter apps, | ||
# packages, and plugins designed to encourage good coding practices. | ||
include: package:flutter_lints/flutter.yaml | ||
|
||
linter: | ||
# The lint rules applied to this project can be customized in the | ||
# section below to disable rules from the `package:flutter_lints/flutter.yaml` | ||
# included above or to enable additional rules. A list of all available lints | ||
# and their documentation is published at | ||
# https://dart-lang.github.io/linter/lints/index.html. | ||
# | ||
# Instead of disabling a lint rule for the entire project in the | ||
# section below, it can also be suppressed for a single line of code | ||
# or a specific dart file by using the `// ignore: name_of_lint` and | ||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file | ||
# producing the lint. | ||
rules: | ||
# avoid_print: false # Uncomment to disable the `avoid_print` rule | ||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule | ||
|
||
# Additional information about this file can be found at | ||
# https://dart.dev/guides/language/analysis-options |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
gradle-wrapper.jar | ||
/.gradle | ||
/captures/ | ||
/gradlew | ||
/gradlew.bat | ||
/local.properties | ||
GeneratedPluginRegistrant.java | ||
|
||
# Remember to never publicly share your keystore. | ||
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app | ||
key.properties | ||
**/*.keystore | ||
**/*.jks |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
def localProperties = new Properties() | ||
def localPropertiesFile = rootProject.file('local.properties') | ||
if (localPropertiesFile.exists()) { | ||
localPropertiesFile.withReader('UTF-8') { reader -> | ||
localProperties.load(reader) | ||
} | ||
} | ||
|
||
def flutterRoot = localProperties.getProperty('flutter.sdk') | ||
if (flutterRoot == null) { | ||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") | ||
} | ||
|
||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode') | ||
if (flutterVersionCode == null) { | ||
flutterVersionCode = '1' | ||
} | ||
|
||
def flutterVersionName = localProperties.getProperty('flutter.versionName') | ||
if (flutterVersionName == null) { | ||
flutterVersionName = '1.0' | ||
} | ||
|
||
apply plugin: 'com.android.application' | ||
apply plugin: 'kotlin-android' | ||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" | ||
|
||
android { | ||
compileSdkVersion 30 | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
|
||
kotlinOptions { | ||
jvmTarget = '1.8' | ||
} | ||
|
||
sourceSets { | ||
main.java.srcDirs += 'src/main/kotlin' | ||
} | ||
|
||
defaultConfig { | ||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). | ||
applicationId "com.example.reddit_ticker" | ||
minSdkVersion 16 | ||
targetSdkVersion 30 | ||
versionCode flutterVersionCode.toInteger() | ||
versionName flutterVersionName | ||
} | ||
|
||
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 | ||
} | ||
} | ||
} | ||
|
||
flutter { | ||
source '../..' | ||
} | ||
|
||
dependencies { | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | ||
} |
7 changes: 7 additions & 0 deletions
7
flutter/reddit_ticker/android/app/src/debug/AndroidManifest.xml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.reddit_ticker"> | ||
<!-- Flutter needs it to communicate with the running application | ||
to allow setting breakpoints, to provide hot reload, etc. | ||
--> | ||
<uses-permission android:name="android.permission.INTERNET"/> | ||
</manifest> |
32 changes: 32 additions & 0 deletions
32
flutter/reddit_ticker/android/app/src/main/AndroidManifest.xml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.reddit_ticker"> | ||
<application | ||
android:label="reddit_ticker" | ||
android:icon="@mipmap/ic_launcher"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:launchMode="singleTop" | ||
android:theme="@style/LaunchTheme" | ||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" | ||
android:hardwareAccelerated="true" | ||
android:windowSoftInputMode="adjustResize"> | ||
<!-- Specifies an Android theme to apply to this Activity as soon as | ||
the Android process has started. This theme is visible to the user | ||
while the Flutter UI initializes. After that, this theme continues | ||
to determine the Window background behind the Flutter UI. --> | ||
<meta-data | ||
android:name="io.flutter.embedding.android.NormalTheme" | ||
android:resource="@style/NormalTheme" | ||
/> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN"/> | ||
<category android:name="android.intent.category.LAUNCHER"/> | ||
</intent-filter> | ||
</activity> | ||
<!-- Don't delete the meta-data below. | ||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> | ||
<meta-data | ||
android:name="flutterEmbedding" | ||
android:value="2" /> | ||
</application> | ||
</manifest> |
6 changes: 6 additions & 0 deletions
6
flutter/reddit_ticker/android/app/src/main/kotlin/com/example/reddit_ticker/MainActivity.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.example.reddit_ticker | ||
|
||
import io.flutter.embedding.android.FlutterActivity | ||
|
||
class MainActivity: FlutterActivity() { | ||
} |
12 changes: 12 additions & 0 deletions
12
flutter/reddit_ticker/android/app/src/main/res/drawable-v21/launch_background.xml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Modify this file to customize your launch splash screen --> | ||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:drawable="?android:colorBackground" /> | ||
|
||
<!-- You can insert your own image assets here --> | ||
<!-- <item> | ||
<bitmap | ||
android:gravity="center" | ||
android:src="@mipmap/launch_image" /> | ||
</item> --> | ||
</layer-list> |
12 changes: 12 additions & 0 deletions
12
flutter/reddit_ticker/android/app/src/main/res/drawable/launch_background.xml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Modify this file to customize your launch splash screen --> | ||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:drawable="@android:color/white" /> | ||
|
||
<!-- You can insert your own image assets here --> | ||
<!-- <item> | ||
<bitmap | ||
android:gravity="center" | ||
android:src="@mipmap/launch_image" /> | ||
</item> --> | ||
</layer-list> |
Binary file added
BIN
+544 Bytes
flutter/reddit_ticker/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+442 Bytes
flutter/reddit_ticker/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+721 Bytes
flutter/reddit_ticker/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.01 KB
flutter/reddit_ticker/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.41 KB
flutter/reddit_ticker/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.