Skip to content

Commit

Permalink
chore: preparation for uploading to store. v 0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
developertobi committed Mar 18, 2024
1 parent 09fede5 commit 4feaf21
Show file tree
Hide file tree
Showing 53 changed files with 180 additions and 24 deletions.
36 changes: 35 additions & 1 deletion .github/workflows/basic_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,42 @@ jobs:
- name: Show Flutter Version
run: flutter --version

- name: Upload apk to google drive
run: flutter build apk

- name: Get Branch Name
id: branch
run: echo "::set-output name=branch::${GITHUB_HEAD_REF}"

- name: Get Today's Date
id: date
run: echo "::set-output name=date::$(date + '%Y-%m-%d')"

- name: Get Folder Id by condition
uses: haya14busa/action-cond@v1
id: folderId
with:
cond: ${{ steps.branch.outputs.branch == 'dev' }}
if_true: ${{ secrets.APKFOLDER }}
if_false: ${{ secrets.APKFOLDER2 }}

- name: Get dependencies
run: flutter pub get

- name: Start release build
run: flutter build apk
run: flutter build apk

- name: Archive Files
run: |
sudo apt-get update
sudo apt-get install zip
zip -r archive.zip *
- name: Upload apk to Google Drive
uses: adityak74/google-drive-upload-git-action@main
with:
credentials: ${{ secrets.CREDENTIALS }}
filename: "build/app/outputs/apk/release/app-release.apk"
folderId: ${{ steps.folderId.outputs.value }}
name: ${{steps.branch.outputs.branch}}_apk_${{steps.date.outputs.date}}.apk
mimeType: "application/vnd.android.package-archive"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release

android/key.properties
app/upload-keystore.jks
20 changes: 16 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
Expand All @@ -44,7 +50,7 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.article_idea_generator"
applicationId "com.articleideagenerator"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
Expand All @@ -53,11 +59,17 @@ android {
versionName flutterVersionName
}

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
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
signingConfig signingConfigs.release
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<uses-permission android:name="android.permission.INTERNET"/>
<application
android:label="article_idea_generator"
android:label="Article Idea Generator"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
Expand Down
6 changes: 6 additions & 0 deletions android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
</adaptive-icon>
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/app_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011

COCOAPODS: 1.12.1
COCOAPODS: 1.15.2
6 changes: 3 additions & 3 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.articleIdeaGenerator;
PRODUCT_BUNDLE_IDENTIFIER = com.articleideagenerator;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -495,7 +495,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.articleIdeaGenerator;
PRODUCT_BUNDLE_IDENTIFIER = com.articleideagenerator;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -518,7 +518,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.articleIdeaGenerator;
PRODUCT_BUNDLE_IDENTIFIER = com.articleideagenerator;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
4 changes: 2 additions & 2 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Article Idea Generator</string>
<string>Article Idea Generator</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>article_idea_generator</string>
<string>Article Idea Generator</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import 'dart:developer';

import 'package:article_idea_generator/core/utilities/exceptions.dart';
import 'package:article_idea_generator/features/article_ideas/data/models/article_idea.dart';
import 'package:dio/dio.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:google_generative_ai/google_generative_ai.dart'
hide ServerException;
import 'package:google_generative_ai/google_generative_ai.dart' hide ServerException;

abstract class ArticleIdeasDataSource {
Future<List<ArticleIdea>> getArticleIdeas({
Expand All @@ -26,6 +27,8 @@ class DioArticleIdeasDataSource implements ArticleIdeasDataSource {
}) async {
const apiUrl = String.fromEnvironment('apiUrl');

log('Api url: $apiUrl');

try {
final response = await _dio.get(
'$apiUrl/request?seoEnabled=$seoEnabled',
Expand All @@ -34,18 +37,17 @@ class DioArticleIdeasDataSource implements ArticleIdeasDataSource {
},
);

final List<String> splitResult =
(response.data['result'] as String).split('\n');
log('Api response: $response');
final List<String> splitResult = (response.data['result'] as String).split('\n');

final articleIdeas =
splitResult.map((result) => ArticleIdea(title: result)).toList();
final articleIdeas = splitResult.map((result) => ArticleIdea(title: result)).toList();

return articleIdeas;
} on DioException catch (ex) {
if (ex.response != null) {
throw ServerException(ex.response?.data['error']);
} else {
throw ServerException(ex.message ?? '');
throw ServerException(ex.message ?? 'Here');
}
} catch (ex) {
throw const ServerException('Something went wrong');
Expand All @@ -67,21 +69,21 @@ class GeminiArticleIdeasDataSource implements ArticleIdeasDataSource {
}) async {
try {
const initialPrompt = String.fromEnvironment('initialPrompt');
log('Api initialPrompt: $initialPrompt');

final prompt =
'$initialPrompt payload: {query: $query, seoEnabled: $seoEnabled}. ';
final prompt = '$initialPrompt payload: {query: $query, seoEnabled: $seoEnabled}. ';

final response = await _model.generateContent(
[Content.text(prompt)],
);

log('Api response: $response');

if (response.text == null) return [];

final List<String> splitResult = (response.text as String).split('\n');

return splitResult
.map((result) => ArticleIdea(title: result.replaceAll('- ', '')))
.toList();
return splitResult.map((result) => ArticleIdea(title: result.replaceAll('- ', ''))).toList();
} on FormatException catch (ex) {
throw ServerException(ex.message);
} catch (ex) {
Expand Down
88 changes: 88 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "5.13.0"
archive:
dependency: transitive
description:
name: archive
sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d"
url: "https://pub.dev"
source: hosted
version: "3.4.10"
args:
dependency: transitive
description:
Expand Down Expand Up @@ -49,6 +57,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.0"
checked_yaml:
dependency: transitive
description:
name: checked_yaml
sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff
url: "https://pub.dev"
source: hosted
version: "2.0.3"
cli_util:
dependency: transitive
description:
name: cli_util
sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19
url: "https://pub.dev"
source: hosted
version: "0.4.1"
clock:
dependency: transitive
description:
Expand Down Expand Up @@ -142,6 +166,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_launcher_icons:
dependency: "direct dev"
description:
name: flutter_launcher_icons
sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea"
url: "https://pub.dev"
source: hosted
version: "0.13.1"
flutter_lints:
dependency: "direct dev"
description:
Expand Down Expand Up @@ -240,6 +272,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.0.2"
image:
dependency: transitive
description:
name: image
sha256: "4c68bfd5ae83e700b5204c1e74451e7bf3cf750e6843c6e158289cf56bda018e"
url: "https://pub.dev"
source: hosted
version: "4.1.7"
io:
dependency: transitive
description:
Expand All @@ -256,6 +296,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.6.7"
json_annotation:
dependency: transitive
description:
name: json_annotation
sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467
url: "https://pub.dev"
source: hosted
version: "4.8.1"
lints:
dependency: transitive
description:
Expand All @@ -264,6 +312,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.1"
logger:
dependency: transitive
description:
name: logger
sha256: b3ff55aeb08d9d8901b767650285872cb1bb8f508373b3e348d60268b0c7f770
url: "https://pub.dev"
source: hosted
version: "2.1.0"
logging:
dependency: transitive
description:
Expand Down Expand Up @@ -384,6 +440,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.7"
petitparser:
dependency: transitive
description:
name: petitparser
sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
url: "https://pub.dev"
source: hosted
version: "6.0.2"
platform:
dependency: transitive
description:
Expand All @@ -400,6 +464,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
pointycastle:
dependency: transitive
description:
name: pointycastle
sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29"
url: "https://pub.dev"
source: hosted
version: "3.7.4"
pool:
dependency: transitive
description:
Expand All @@ -424,6 +496,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
rename:
dependency: "direct main"
description:
name: rename
sha256: "4d08eafe78e0787167c2fcdd5e32bbb0a6b2d8a7d23b38280f590df2a051415c"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
riverpod:
dependency: transitive
description:
Expand Down Expand Up @@ -701,6 +781,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.0"
xml:
dependency: transitive
description:
name: xml
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
url: "https://pub.dev"
source: hosted
version: "6.5.0"
yaml:
dependency: transitive
description:
Expand Down
Loading

0 comments on commit 4feaf21

Please sign in to comment.