#Region Project Attributes
#ApplicationLabel: DB Test
#VersionCode: 1
#VersionName: 1 (2023)
#SupportedOrientations: portrait
#AdditionalJar:dropbox-android-sdk-6.0.0.aar
#AdditionalJar:dropbox-core-sdk-6.0.0
#AdditionalJar: androidx.legacy:legacy-support-core-utils
#AdditionalJar: jackson-core-2.7.4.jar
#MultiDex: true
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#FullScreen: False
#IncludeTitle: False
#DebuggerForceFullDeployment: True
#End Region
Sub Process_Globals
Dim token As String
Dim clientDbx As DbxClientV2
Dim configDbx As DbxRequestConfig
Dim dbxFiles As DbxUserFilesRequests
Dim dbxSharing As DbxUserSharingRequests
Dim dbxUsers As DbxUserUsersRequests
Dim clientId As String
Dim AccessToken As String
End Sub
Sub globals
Private auth As DbxAuth
Dim configDbx As DbxRequestConfig
Private BtnBackupDropBox As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("testdbv2") 'has only a button
configDbx.Initialize("","clientidentifier","de-de",5) ' de-de is my locale
auth.Initialize("yourappkey")
End Sub
Sub Activity_Resume
If auth.OAuth2Token <> Null Then
If auth.OAuth2Token <> "" Then
token = auth.OAuth2Token
Dim cred As DbxCredential = auth.DbxCredential
Log($"cred.AccessToken: ${cred.AccessToken}"$)
Log($"cred.aboutToExpire: ${cred.aboutToExpire}"$)
Log($"cred.ExpiresAt: ${cred.ExpiresAt}"$)
Log($"cred.RefreshToken: ${cred.RefreshToken}"$)
Log("Token available. Dropbox enabled")
Log("Token "&token)
Starter.kvs.Put("dbxtokenv2", token)
Dim dbxhost As DbxHost
dbxhost.Initialize
clientDbx.Initialize("Dropbox",configDbx,token,dbxhost)
dbxFiles = clientDbx.files
dbxFiles.setEventname("dbxFiles")
dbxSharing = clientDbx.sharing
dbxSharing.setEventname("dbxSharing")
dbxUsers = clientDbx.users
dbxUsers.setEventname("dbxUsers")
dbxUsers.CurrentAccount
Else
Log($"Token = """$)
End If
Else
Log("OAuth2Token is null. This is usually OK. Do not log it. t will only become not null after you start a Authentification flow...")
End If
End Sub
Sub BtnBackupDropBox_Click
auth.Initialize("clientid")
auth.startOAuth2Authentication ' here crash with error
'java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics;
' at com.dropbox.core.android.Auth$Companion.startOAuth2Authentication(Unknown Source:2)
' at com.dropbox.core.android.Auth.startOAuth2Authentication(Unknown Source:2)
' at de.donmanfred.dbxv2.AuthWrapper.startOAuth2Authentication(AuthWrapper.java:35)
End Sub
Sub ResultadoToken(lToken As String)
token = lToken
configDbx.Initialize("","mifkq3tp0ieeubm","",5)
Dim dbxhost As DbxHost
dbxhost.Initialize
clientDbx.Initialize("Dropbox",configDbx,token,dbxhost)
If clientDbx.auth.IsInitialized Then
End If
dbxFiles = clientDbx.files
dbxFiles.setEventname("dbxFiles")
dbxSharing = clientDbx.sharing
dbxSharing.setEventname("dbxSharing")
dbxUsers = clientDbx.users
dbxUsers.setEventname("dbxUsers")
Starter.kvs.Put("tokendb", token)
Log("Token es-2 : " & token)
End Sub
Sub Lbl_DropBoxHacerBackup_Click
End Sub
Sub dropbox_JobStatus (meta As Map)
Log(meta)
End Sub
Sub dbxSharing_listFolders(success As Boolean, folders As List, error As String)
Log($"dbxSharing_listFolders(${success}, ${folders.Size}, ${error})"$)
If folders.Size > 0 Then
For i = 0 To folders.Size-1
Dim meta As SharedFolderMetadata = folders.Get(i)
Log(meta.toString)
Next
End If
End Sub
Sub dbxSharing_AddFileMember(success As Boolean, members As List, error As String)
Log($"dbxSharing_listFolders(${success}, ${members.Size}, ${error})"$)
End Sub
Sub dbxSharing_listMountableFolders(success As Boolean, folders As List, error As String)
Log($"dbxSharing_listFolders(${success}, ${folders.Size}, ${error})"$)
End Sub
Sub dbxSharing_listReceivedFiles(success As Boolean, receivedFiles As List, error As String)
Log($"dbxSharing_listFolders(${success}, ${receivedFiles.Size}, ${error})"$)
End Sub
Sub dbxSharing_listSharedLinks(success As Boolean, sharedLinks As List, error As String)
Log($"dbxSharing_listFolders(${success}, ${sharedLinks.Size}, ${error})"$)
End Sub
Sub dbxSharing_SharedFolderMetadata(success As Boolean, meta As SharedFolderMetadata, error As String)
Log($"dbxSharing_listFolders(${success}, ${meta.toString}, ${error})"$)
End Sub
Sub dbxFiles_CopyBatch(success As Boolean, meta As Map, error As String)
End Sub
Sub dbxFiles_CopyBatchCheck(success As Boolean, meta As Map, error As String)
End Sub
Sub dbxFiles_CopyReference(metainfo As Map)
End Sub
Sub dbxFiles_ListRevisions(success As Boolean, meta As Map, error As String)
End Sub
Sub dbxFiles_MoveBatch(success As Boolean, meta As Map, error As String)
End Sub
Sub dbxFiles_MoveBatchCheck(success As Boolean, meta As Map, error As String)
End Sub
Sub dbxFiles_Restore(success As Boolean, meta As FileMetadata, error As String)
End Sub
Sub dbxFiles_UploadFinished(success As Boolean, metaObj As Object, info As String, localpath As String, localfilename As String)
Dim meta As FileMetadata = metaObj
Log($"dbxFiles_UploadFinished(${success} Localpath ${localpath} -> Localfilename ${localfilename} -> ${meta})"$)
Log($"dbxFiles_UploadFinished(${success} Info ${info})"$)
If success=False Then
Return
End If
End Sub
Sub dbxUsers_getAccount(account As BasicAccount)
Log($"dbxUsers_getAccount(${account})"$)
End Sub
Sub dbxUsers_getAccountBatch(batch As List)
End Sub
Sub dbxUsers_getCurrentAccount(account As FullAccount)
Log($"dbxUsers_getCurrentAccount(${account})"$)
End Sub
Sub dbxFiles_listFolder(success As Boolean, entries As List, error As String)
End Sub
Sub dbxSharing_Error(lError As String)
End Sub
Sub dbxFiles_DownloadFinished(success As Boolean, meta As FileMetadata, error As String)
Log($"dbxFiles_DownloadFinished(${success}, ${meta}, ${error})"$)
End Sub
Sub DropBox_UploadSessionStatus(session As Map)
End Sub
Sub DropBox_FileUpload (session As Map)
End Sub
Sub dropbox_FileSearch (result As Map)
End Sub
Sub dbxFiles_CreateFolder(success As Boolean, meta As FolderMetadata, error As String)
dbxFiles.CreateFolder("/tropicinvoicebackup/images_invoices",True)
End Sub
Sub DropBox_CurrentAccount(meta As Map)
Log("Dropbox_CurrentAccount: "&meta)
End Sub