Skip to content

Commit

Permalink
Merge pull request #46 from raxysstudios/v1.0
Browse files Browse the repository at this point in the history
v1.1.1
  • Loading branch information
alkaitagi authored Jul 11, 2022
2 parents d5dac40 + 07f255e commit 137ebea
Show file tree
Hide file tree
Showing 63 changed files with 837 additions and 1,127 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
# Andax

Expandable parallel reference to the languages of the Caucasus in English. Currently includes Dictionary, with more modules to come soon. Legacy experimental implementation with 4 modules is available at https://ex.avzag.app/.
Expandable parallel dictionary for the languages of the Caucasus in English.

Google Play: https://play.google.com/store/apps/details?id=com.alkaitagi.avzag
Web application: https://avzag.app/.
Google Play: <https://play.google.com/store/apps/details?id=com.alkaitagi.bazur>
Web application: <https://bazur.raxys.app/>.

Built with Flutter & Firebase & Algolia.

## Roadmap

### 2021

- [x] September: start of beta-test.
- [x] November: release of crowdsourcing functionality.
- [x] December: general availability on Android & Web.

### 2022

- [x] Spring: Home-screen map, iOS release.
- [x] Summer: Deep-linking, word sharing.
- [ ] Autumn: Word of the day, search UI improvements.
- [ ] Winter: Material 3, UI & UX overhaul.

## Getting Started

```sh
> git clone https://github.com/raxysstudios/avzag.git
> cd avzag
> git clone https://github.com/raxysstudios/bazur.git
> cd bazur
> pub get
> flutter run -d chrome --web-port 80
```
2 changes: 1 addition & 1 deletion android/app/src/debug/res/values/string.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">🛠️ Avzag</string>
<string name="app_name">🛠️ Bazur</string>
</resources>
2 changes: 1 addition & 1 deletion android/app/src/main/res/values/string.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Avzag</string>
<string name="app_name">Bazur</string>
</resources>
17 changes: 11 additions & 6 deletions functions/src/dictionary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import * as functions from "firebase-functions";
import algoliasearch from "algoliasearch";
import {firestore} from "firebase-admin";

const dictionary = algoliasearch(
functions.config().algolia.app,
Expand All @@ -25,6 +26,8 @@ export const indexDictionary = functions
entryID,
headword: entry.headword,
language: entry.language,
rand: Math.random(),
lastUpdated: firestore.Timestamp.now().toDate().valueOf(),
forms: [
entry.headword,
...(entry.forms?.map((s: any) => s.text) ?? []),
Expand All @@ -36,13 +39,15 @@ export const indexDictionary = functions

const records = [];

for (const use of entry.uses) {
const record = Object.assign({term: use.term}, base) as any;
if (use.tags?.length || entry.tags?.length) {
record.tags = (use.tags ?? []).concat(entry.tags ?? []);
for (const definition of entry.definitions) {
const record = Object.assign({
translation: definition.translation,
}, base) as any;
if (definition.tags?.length || entry.tags?.length) {
record.tags = (definition.tags ?? []).concat(entry.tags ?? []);
}
if (use.aliases?.length) {
record.aliases = use.aliases;
if (definition.aliases?.length) {
record.aliases = definition.aliases;
}
records.push(record);
}
Expand Down
18 changes: 9 additions & 9 deletions functions/src/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ const dictionary = algoliasearch(

export const collectStats = functions
.region("europe-central2")
.pubsub.schedule("every 6 hours")
.pubsub.schedule("every 24 hours")
.timeZone("Europe/Moscow")
.onRun(async () => {
const db = admin.firestore();
const langs = await db
.collection("languages").get()
.collection("languages")
.get()
.then((d) => d.docs.map((l) => l.id));

for (const lang of langs) {
await db.doc("languages/" + lang).update({
stats: {
dictionary: await dictionary
.search("", {
facetFilters: ["language:" + lang],
hitsPerPage: 0,
}).then((s) => s.nbHits),
},
dictionary: await dictionary
.search("", {
facetFilters: ["language:" + lang],
hitsPerPage: 0,
})
.then((s) => s.nbHits),
});
}
});
4 changes: 2 additions & 2 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>avzag</string>
<string>bazur</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
Expand Down Expand Up @@ -60,7 +60,7 @@
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>avzag.raxys.app</string>
<string>bazur.raxys.app</string>
<key>CFBundleURLSchemes</key>
<array>
<string>customscheme</string>
Expand Down
8 changes: 4 additions & 4 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:algolia/algolia.dart';
import 'package:avzag/store.dart';
import 'package:bazur/store.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
Expand All @@ -8,8 +8,8 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:url_strategy/url_strategy.dart';

import 'firebase_options.dart';
import 'modules/navigation/services/root_guard.dart';
import 'modules/navigation/services/router.gr.dart';
import 'navigation/root_guard.dart';
import 'navigation/router.gr.dart';
import 'theme_set.dart';

void main() async {
Expand Down Expand Up @@ -41,7 +41,7 @@ class App extends StatelessWidget {
Widget build(context) {
final theme = ThemeSet(Theme.of(context).colorScheme);
return MaterialApp.router(
title: 'Avzag',
title: 'Bazur',
theme: theme.light,
darkTheme: theme.dark,
routerDelegate: _appRouter.delegate(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import 'package:algolia/algolia.dart';
import 'package:avzag/shared/utils.dart';
import 'package:bazur/shared/utils.dart';

class Entry {
final String entryID;
final String objectID;
final String headword;
final String? form;
final String language;
final String term;
final String translation;
final bool unverified;
final List<String>? tags;

Expand All @@ -17,7 +17,7 @@ class Entry {
required this.headword,
this.form,
required this.language,
required this.term,
required this.translation,
this.tags,
this.unverified = false,
});
Expand All @@ -37,7 +37,7 @@ class Entry {
headword: json['headword'] as String,
form: form >= 0 ? json2list(json['forms'])![form] : null,
language: json['language'] as String,
term: json['term'] as String,
translation: json['translation'] as String,
unverified: json['unverified'] as bool? ?? false,
tags: json2list(json['tags']),
);
Expand Down
33 changes: 5 additions & 28 deletions lib/models/language.dart
Original file line number Diff line number Diff line change
@@ -1,53 +1,30 @@
import 'package:avzag/shared/utils.dart';
import 'package:bazur/shared/utils.dart';
import 'package:cloud_firestore/cloud_firestore.dart';

class LanguageStats {
final int dictionary;

LanguageStats({
this.dictionary = 0,
});

LanguageStats.fromJson(Map<String, Object?> json)
: this(
dictionary: json['dictionary'] as int,
);

Map<String, Object?> toJson() => {
'dictionary': dictionary,
};
}

class Language {
final String name;
final String endonym;
final String? flag;
final String? contact;
final List<String>? aliases;
final GeoPoint? location;
final LanguageStats? stats;
final int dictionary;

const Language({
required this.name,
required this.endonym,
this.flag,
this.contact,
this.aliases,
this.location,
this.stats,
this.dictionary = 0,
});

Language.fromJson(Map<String, Object?> json)
: this(
name: json['name'] as String,
endonym: json['endonym'] as String,
flag: json['flag'] as String?,
contact: json['contact'] as String?,
aliases: json2list(json['aliases']),
location:
json['location'] == null ? null : json['location'] as GeoPoint,
stats: json['stats'] == null
? null
: LanguageStats.fromJson(json['stats'] as Map<String, Object?>),
location: json['location'] as GeoPoint?,
dictionary: json['dictionary'] as int? ?? 0,
);
}
File renamed without changes.
16 changes: 8 additions & 8 deletions lib/modules/dictionary/models/use.dart → lib/models/use.dart
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import 'package:avzag/shared/utils.dart';
import 'package:bazur/shared/utils.dart';

import 'sample.dart';

class Use {
String term;
class Definition {
String translation;
List<String> aliases;
List<String> tags;
String? note;
List<Sample> examples;

Use(
this.term, {
Definition(
this.translation, {
required this.aliases,
required this.tags,
this.note,
required this.examples,
});

Use.fromJson(Map<String, dynamic> json)
Definition.fromJson(Map<String, dynamic> json)
: this(
json['term'] as String,
json['translation'] as String,
aliases: json2list(json['aliases']) ?? [],
tags: json2list(json['tags']) ?? [],
note: json['note'] as String?,
Expand All @@ -32,7 +32,7 @@ class Use {

Map<String, dynamic> toJson() {
final data = <String, dynamic>{};
data['term'] = term;
data['translation'] = translation;
if (aliases.isNotEmpty) data['aliases'] = aliases;
if (tags.isNotEmpty) data['tags'] = tags;
if (note?.isNotEmpty ?? false) data['note'] = note;
Expand Down
16 changes: 8 additions & 8 deletions lib/modules/dictionary/models/word.dart → lib/models/word.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:avzag/models/contribution.dart';
import 'package:avzag/shared/utils.dart';
import 'package:bazur/models/contribution.dart';
import 'package:bazur/shared/utils.dart';

import 'sample.dart';
import 'use.dart';
Expand All @@ -12,15 +12,15 @@ class Word {
String language;
List<String> tags;
String? note;
List<Use> uses;
List<Definition> definitions;
Contribution? contribution;

Word(
this.id, {
required this.headword,
this.ipa,
required this.language,
required this.uses,
required this.definitions,
required this.forms,
required this.tags,
this.contribution,
Expand All @@ -38,9 +38,9 @@ class Word {
) ??
[],
language: json['language'] as String,
uses: listFromJson(
json['uses'],
(dynamic j) => Use.fromJson(j as Map<String, dynamic>),
definitions: listFromJson(
json['definitions'],
(dynamic j) => Definition.fromJson(j as Map<String, dynamic>),
)!,
tags: json2list(json['tags']) ?? [],
note: json['note'] as String?,
Expand All @@ -60,7 +60,7 @@ class Word {
data['language'] = language;
if (tags.isNotEmpty) data['tags'] = tags;
if (note?.isNotEmpty ?? false) data['note'] = note;
data['uses'] = uses.map((v) => v.toJson()).toList();
data['definitions'] = definitions.map((v) => v.toJson()).toList();
if (contribution != null) data['contribution'] = contribution!.toJson();
return data;
}
Expand Down
Loading

0 comments on commit 137ebea

Please sign in to comment.