Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
"deno.unstable": true,
"deno.enablePaths": [
"./supabase/functions"
]
],
"nuxt.isNuxtApp": false
}
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,42 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.9.0-alpha.0](https://github.com/Cap-go/capgo/compare/1.8.7-alpha.3...1.9.0-alpha.0) (2022-07-28)


### Features

* add missing api endpoint ([94f21a7](https://github.com/Cap-go/capgo/commit/94f21a7911fa60c593e490df1e91ede781654c0a))

### [1.8.7-alpha.3](https://github.com/Cap-go/capgo/compare/1.8.7-alpha.2...1.8.7-alpha.3) (2022-07-28)


### Bug Fixes

* add log for runtime ([4929bf5](https://github.com/Cap-go/capgo/commit/4929bf5c5c88f8250ca00c34aaa4877ca86ce101))

### [1.8.7-alpha.2](https://github.com/Cap-go/capgo/compare/1.8.7-alpha.1...1.8.7-alpha.2) (2022-07-28)


### Bug Fixes

* stats be more explicit ([5dedac8](https://github.com/Cap-go/capgo/commit/5dedac8b9689d6f9d5e280deba3027d4625ca3cb))

### [1.8.7-alpha.1](https://github.com/Cap-go/capgo/compare/1.8.7-alpha.0...1.8.7-alpha.1) (2022-07-22)


### Bug Fixes

* add deleted_modal and system ([638f3b9](https://github.com/Cap-go/capgo/commit/638f3b9a2d37345e4539ba594133b9f927c71672))

### [1.8.7-alpha.0](https://github.com/Cap-go/capgo/compare/1.8.6...1.8.7-alpha.0) (2022-07-21)


### Bug Fixes

* :boom: update to v4 ([44ca2e4](https://github.com/Cap-go/capgo/commit/44ca2e405e44349c5e7c8d66edcd5a54594fc9e4))
* make android work ([f9d660b](https://github.com/Cap-go/capgo/commit/f9d660b6cb1cb3707d9c674278efd336e8a72216))

### [1.8.6](https://github.com/Cap-go/capgo/compare/1.8.5...1.8.6) (2022-07-21)


Expand Down
5 changes: 3 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "ee.forgr.capacitor_go"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1080600
versionName "1.8.6"
versionCode 1090000
versionName "1.9.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand All @@ -33,6 +33,7 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation project(':capacitor-android')
implementation 'com.android.volley:volley:1.2.0'
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
Expand Down
56 changes: 26 additions & 30 deletions android/app/src/main/java/ee/forgr/capacitor_go/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.hardware.SensorManager;

import ee.forgr.capacitor_updater.BundleInfo;
import ee.forgr.capacitor_updater.CapacitorUpdater;

import com.android.volley.toolbox.Volley;
import com.getcapacitor.Bridge;
import com.getcapacitor.BridgeActivity;
import android.os.Bundle;
import android.util.Log;

import com.getcapacitor.plugin.WebView;
import com.squareup.seismic.ShakeDetector;

import java.io.File;
import java.text.MessageFormat;

public class MainActivity extends BridgeActivity implements ShakeDetector.Listener {
Expand All @@ -38,17 +42,12 @@ public void onStart() {

@Override public void hearShake() {
Log.i("Capgo", "hearShake");
CapacitorUpdater updater;
String LatestVersionAutoUpdate = prefs.getString("LatestVersionAutoUpdate", "");
try {
updater = new CapacitorUpdater(this.bridge.getContext());
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return;
}
Log.i("Capgo hearShake", updater.getLastPathHot());

if (updater.getLastPathHot() == "public" || isShow || updater.getLastPathHot().contains(LatestVersionAutoUpdate)) {
CapacitorUpdater updater = new CapacitorUpdater();
updater.prefs = this.bridge.getContext().getSharedPreferences(WebView.WEBVIEW_PREFS_NAME, Activity.MODE_PRIVATE);
updater.editor = this.prefs.edit();
updater.documentsDir = this.bridge.getContext().getFilesDir();
updater.requestQueue = Volley.newRequestQueue(this.bridge.getContext());
if (isShow) {
return;
}
isShow = true;
Expand All @@ -65,29 +64,26 @@ public void onStart() {
builder.setPositiveButton(okButtonTitle, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User clicked OK button
String serverBasePath = updater.getLastPathHot();
File fHot = new File(serverBasePath);
String versionName = updater.getVersionName();
String LatestVersionNameAutoUpdate = prefs.getString("LatestVersionNameAutoUpdate", "");
Boolean isAssets = true;
if (!LatestVersionAutoUpdate.equals("") && !LatestVersionNameAutoUpdate.equals("")) {
isAssets = !updater.set(LatestVersionAutoUpdate, LatestVersionNameAutoUpdate);
BundleInfo current = updater.getCurrentBundle();
Log.i(CapacitorUpdater.TAG, "get next: ");
BundleInfo next = updater.getNextBundle();
Log.i(CapacitorUpdater.TAG, "next: " + next.toString());
if (!next.isBuiltin()) {
updater.set(next.getId());
} else {
updater.reset();
}
if (isAssets) {
updater.reset();
String pathHot = updater.getLastPathHot();
brd.setServerAssetPath(pathHot);
final String path = updater.getCurrentBundlePath();
Log.i(CapacitorUpdater.TAG, "Reloading: " + path);
if(updater.isUsingBuiltin()) {
brd.setServerAssetPath(path);
} else {
String pathHot = updater.getLastPathHot();
brd.setServerBasePath(pathHot);
brd.setServerBasePath(path);
}
try {
String name = fHot.getName();
updater.delete(name, versionName);
updater.delete(current.getId());
} catch (Exception err) {
Log.i("Capgo", "Cannot delete version " + versionName, err);
Log.i("Capgo", "Cannot delete version " + current.getId(), err);
}
Log.i("Capgo", "Capgo: Reload app done");
dialog.dismiss();
Expand All @@ -97,7 +93,7 @@ public void onClick(DialogInterface dialog, int id) {
builder.setNeutralButton(reloadButtonTitle, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Log.i("Capgo", reloadButtonTitle);
String pathHot = updater.getLastPathHot();
String pathHot = updater.getCurrentBundlePath();
brd.setServerBasePath(pathHot);
dialog.dismiss();
isShow = false;
Expand Down
2 changes: 1 addition & 1 deletion android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ include ':capacitor-toast'
project(':capacitor-toast').projectDir = new File('../node_modules/.pnpm/@capacitor+toast@1.0.8_@capacitor+core@3.6.0/node_modules/@capacitor/toast/android')

include ':capgo-capacitor-updater'
project(':capgo-capacitor-updater').projectDir = new File('../node_modules/.pnpm/@capgo+capacitor-updater@4.0.0-alpha.10_@capacitor+core@3.6.0/node_modules/@capgo/capacitor-updater/android')
project(':capgo-capacitor-updater').projectDir = new File('../node_modules/.pnpm/@capgo+capacitor-updater@4.0.0-alpha.24_@capacitor+core@3.6.0/node_modules/@capgo/capacitor-updater/android')

include ':robingenz-capacitor-file-picker'
project(':robingenz-capacitor-file-picker').projectDir = new File('../node_modules/.pnpm/@robingenz+capacitor-file-picker@0.3.0_@capacitor+core@3.6.0/node_modules/@robingenz/capacitor-file-picker/android')
Expand Down
2 changes: 1 addition & 1 deletion android/variables.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ext {
minSdkVersion = 23
compileSdkVersion = 31
compileSdkVersion = 32
targetSdkVersion = 30
androidxActivityVersion = '1.2.0'
androidxAppCompatVersion = '1.2.0'
Expand Down
8 changes: 4 additions & 4 deletions ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "1.8.6";
CURRENT_PROJECT_VERSION = "1.9.0";
DEVELOPMENT_TEAM = UVTJ336J2D;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = "1.8.6";
MARKETING_VERSION = "1.9.0";
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = ee.forgr.capacitorgo;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -371,12 +371,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "1.8.6";
CURRENT_PROJECT_VERSION = "1.9.0";
DEVELOPMENT_TEAM = UVTJ336J2D;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = "1.8.6";
MARKETING_VERSION = "1.9.0";
PRODUCT_BUNDLE_IDENTIFIER = ee.forgr.capacitorgo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
Expand Down
78 changes: 46 additions & 32 deletions ios/App/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,27 @@ import Capacitor
import CapgoCapacitorUpdater
import RobingenzCapacitorScreenOrientation

extension UIApplication {


public class func topViewController(_ base: UIViewController? = UIApplication.shared.windows.first?.rootViewController) -> UIViewController? {
if let nav = base as? UINavigationController {
return topViewController(nav.visibleViewController)
}
if let tab = base as? UITabBarController {
if let selected = tab.selectedViewController {
return topViewController(selected)
}
}
if let presented = base?.presentedViewController {
return topViewController(presented)
}
return base
}}

extension UIWindow {
alertShake = nil
open override func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?) {
let defaults = UserDefaults.standard
if (alertShake != nil)
return
if motion == .motionShake {
let appName = "app"
let title = "Preview \(appName) Menu"
Expand All @@ -18,37 +33,37 @@ extension UIWindow {
let cancelButtonTitle = "Close menu"
let updater = CapacitorUpdater()
if let vc = (rootViewController as? CAPBridgeViewController) {
print("getServerBasePath", vc.getServerBasePath())
let serverBasePath = defaults.object(forKey:"serverBasePath") as? String ?? ""
let versionName = defaults.object(forKey:"versionName") as? String ?? ""
let LatestVersionAutoUpdate = UserDefaults.standard.string(forKey: "LatestVersionAutoUpdate") ?? ""
if (serverBasePath == "" || serverBasePath.contains(versionName)) {
if UIApplication.topViewController()!.isKind(of: UIAlertController.self) {
print("UIAlertController is already presented")
return
}
alertShake = UIAlertController(title: title, message: message, preferredStyle: UIAlertController.Style.alert)
func resetBuiltin () {
updater.reset()
vc.setServerBasePath(path: "")
DispatchQueue.main.async {
vc.loadView()
vc.viewDidLoad()
_ = updater.delete(id: bundleId)
print("✨ Capgo: Reset to builtin version")
}
}
let bundleId = updater.getCurrentBundleId()
print("getServerBasePath", vc.getServerBasePath())
print("bundleId", bundleId)
let alertShake = UIAlertController(title: title, message: message, preferredStyle: UIAlertController.Style.alert)
alertShake.addAction(UIAlertAction(title: okButtonTitle, style: UIAlertAction.Style.default, handler: { (_) -> Void in
let LatestVersionNameAutoUpdate = UserDefaults.standard.string(forKey: "LatestVersionNameAutoUpdate") ?? ""
if(LatestVersionAutoUpdate != "" && LatestVersionNameAutoUpdate != "") {
_ = updater.set(version: LatestVersionAutoUpdate, versionName: LatestVersionNameAutoUpdate)
let pathHot = updater.getLastPathHot()
let pathPersist = updater.getLastPathPersist()
if (pathHot != "" && pathPersist != "") {
UserDefaults.standard.set(String(pathPersist.suffix(10)), forKey: "serverBasePath")
vc.setServerBasePath(path: pathHot)
_ = updater.delete(version: serverBasePath, versionName: versionName)
} else {

}
guard let next = updater.getNextBundle() else {
resetBuiltin()
return
}
if (!next.isBuiltin()) {
print("✨ Capgo: Resetting to: \(next.toString())")
_ = updater.set(bundle: next)
let destHot = updater.getPathHot(id: next.getId())
print("✨ Capgo: Reloading \(next.toString())")
vc.setServerBasePath(path: destHot.path)
} else {
updater.reset()
let pathPersist = updater.getLastPathPersist()
vc.setServerBasePath(path: pathPersist)
defaults.set("", forKey: "serverBasePath")
DispatchQueue.main.async {
vc.loadView()
vc.viewDidLoad()
_ = updater.delete(version: serverBasePath, versionName: versionName)
}
resetBuiltin()
}
print("✨ Capgo: Reload app done")
}))
Expand All @@ -60,7 +75,7 @@ extension UIWindow {
}))
DispatchQueue.main.async {
vc.present(alertShake, animated: true, completion: { () -> Void in
alertShake = nil
// alertShake = nil
})
}
}
Expand Down Expand Up @@ -134,5 +149,4 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
NotificationCenter.default.post(name: .capacitorStatusBarTapped, object: nil)
}
}

}
2 changes: 1 addition & 1 deletion ios/App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def capacitor_pods
pod 'CapacitorStorage', :path => '../../node_modules/.pnpm/@capacitor+storage@1.2.5_@capacitor+core@3.6.0/node_modules/@capacitor/storage'
pod 'CapacitorTextZoom', :path => '../../node_modules/.pnpm/@capacitor+text-zoom@1.0.8_@capacitor+core@3.6.0/node_modules/@capacitor/text-zoom'
pod 'CapacitorToast', :path => '../../node_modules/.pnpm/@capacitor+toast@1.0.8_@capacitor+core@3.6.0/node_modules/@capacitor/toast'
pod 'CapgoCapacitorUpdater', :path => '../../node_modules/.pnpm/@capgo+capacitor-updater@4.0.0-alpha.10_@capacitor+core@3.6.0/node_modules/@capgo/capacitor-updater'
pod 'CapgoCapacitorUpdater', :path => '../../node_modules/.pnpm/@capgo+capacitor-updater@4.0.0-alpha.24_@capacitor+core@3.6.0/node_modules/@capgo/capacitor-updater'
pod 'RobingenzCapacitorFilePicker', :path => '../../node_modules/.pnpm/@robingenz+capacitor-file-picker@0.3.0_@capacitor+core@3.6.0/node_modules/@robingenz/capacitor-file-picker'
pod 'RobingenzCapacitorScreenOrientation', :path => '../../node_modules/.pnpm/@robingenz+capacitor-screen-orientation@1.1.7_@capacitor+core@3.6.0/node_modules/@robingenz/capacitor-screen-orientation'
pod 'TeamhiveCapacitorVideoRecorder', :path => '../../node_modules/.pnpm/@teamhive+capacitor-video-recorder@5.0.0_@capacitor+core@3.6.0/node_modules/@teamhive/capacitor-video-recorder'
Expand Down
1 change: 1 addition & 0 deletions locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ account:
billing: Abrechnung
changePassword: Kennwort ändern
delete-account: Mein Konto löschen
delete_sure: Bist du dir sicher ?
discord: Zwietracht
heading: Konto
keys: API-Schlüssel
Expand Down
2 changes: 2 additions & 0 deletions locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ account:
billing: Billing
changePassword: Change password
delete-account: Delete my account
delete_sure: Are you sure ?
discord: Discord
error: Error
heading: Account
keys: API keys
legal: Terms of services
Expand Down
1 change: 1 addition & 0 deletions locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ account:
billing: Facturación
changePassword: Cambia la contraseña
delete-account: Borrar mi cuenta
delete_sure: Está seguro ?
discord: Discordia
heading: Cuenta
keys: claves API
Expand Down
1 change: 1 addition & 0 deletions locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ account:
billing: Facturation
changePassword: Changer le mot de passe
delete-account: Supprimer mon compte
delete_sure: Êtes-vous sûr ?
discord: Discorde
heading: Compte
keys: Clés API
Expand Down
1 change: 1 addition & 0 deletions locales/id.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ account:
billing: Penagihan
changePassword: Ganti kata sandi
delete-account: Hapus akun Saya
delete_sure: Apa kamu yakin ?
discord: Perselisihan
heading: Akun
keys: kunci API
Expand Down
1 change: 1 addition & 0 deletions locales/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ account:
billing: Fatturazione
changePassword: Cambiare la password
delete-account: Cancella il mio account
delete_sure: Sei sicuro ?
discord: Discordia
heading: Account
keys: Chiavi API
Expand Down
1 change: 1 addition & 0 deletions locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ account:
billing: 請求する
changePassword: パスワードを変更する
delete-account: アカウントを削除します
delete_sure: 本気ですか ?
discord: 不和
heading: アカウント
keys: APIキー
Expand Down
Loading